locustio / locust

Write scalable load tests in plain Python 🚗💨
MIT License
24.55k stars 2.96k forks source link

[LocustLineChart] Implement an option/configuration for users to customize the color of the LocustLineChart. #2578

Closed G1-Diep-Duong closed 7 months ago

G1-Diep-Duong commented 7 months ago

Prerequisites

Description

The default color scheme of the LineChart component feels repetitive and visually unappealing. To enhance user experience and customization, could we introduce an option or configuration that allows users to personalize the line colors according to their preferences? (See attached screenshot for a reference.) image

G1-Diep-Duong commented 7 months ago

This code snippet implements the static default colors displayed in the preceding screenshot:

// init charts
var rpsChart = new LocustLineChart($(".charts-container"), "Total Requests per Second", ["RPS", "Failures/s"], "reqs/s", ['#22ff22', '#ff2222']);
var responseTimeChart = new LocustLineChart($(".charts-container"), "Response Times (ms)", [(percentile1 * 100).toString() + "th percentile", (percentile2 * 100).toString() + "th percentile"], "ms", ['#00ffee', '#eeff00']);
var usersChart = new LocustLineChart($(".charts-container"), "Number of Users", ["Users"], "users", ['#0099ff']);
cyberw commented 7 months ago

Thats the old UI. Do you find the new one more appealing? Either download the latest build, where the modern UI is on by default (pip install --pre -U locust), or enable it using --modern-ui.

While we're focused on stabilizing the new UI right now, so we shouldnt take in any changes at the moment, I guess we could add this feature later on.

G1-Diep-Duong commented 7 months ago

Hi @cyberw, This issue still occurs on version 2.22.0: As you can see: The color of the LineChart (RPS, 95th percentile and Number of Users) component feels repetitive and visually unappealing image See below for my sample that promotes user-friendly customization: image My sample color code I used are: ${\color{#22ff22}RPS}$: #22ff22 ${\color{#ff2222}Failures/s}$: #ff2222 ${\color{#00ffee}95th Percentile}$: #00ffee ${\color{#eeff00}Average Response Time}$: #eeff00 ${\color{#0099ff}Number of Users}$: #0099ff

cyberw commented 7 months ago

Using different colors makes a lot of sense, what do you think @andrewbaldwin44 ? Just changing the defaults to the ones in the screenshots could be enough. Configurability is also nice, but maybe not as important as just using different colors for different things....

G1-Diep-Duong commented 7 months ago

Instead of implementing the requested dynamic color feature, opting for a static color scheme now simplifies the user experience, mitigating potential confusion.

andrewbaldwin44 commented 7 months ago

Sure I can understand the reasoning behind this, the lines represent different data so therefore the corresponding color should be different. I think simply changing the colors we have hard-coded should be sufficient.

One thing we may want to consider is that the response time percentiles that are shown can be configured to show any number of different percentiles, so we might end up with the same colors there.

@G1-Diep-Duong PR's are welcome if you want to take a look into this, otherwise I can do it when I have some time

G1-Diep-Duong commented 7 months ago

Thankz @andrewbaldwin44 I'm unsure of the ideal location for hard-coding, so I've temporarily modified lines 243 and 252 in "locust/webui/dist/assets/index-f31faefc.js" of version 2.22.0 as a workaround. Please refer to the code snippet from lines 243-252 of the JS file.:

`||u==="")){var c=o.isSelected(u);n.hasOwnProperty(u)?n[u]=n[u]&&c:n[u]=c}})}),e==="allSelect"||e==="inverseSelect"?{selected:n}:{name:t.name,selected:n}}function RNe(e){e.registerAction("legendToggleSelect","legendselectchanged",Ie(eh,"toggleSelected")),e.registerAction("legendAllSelect","legendselectall",Ie(eh,"allSelect")),e.registerAction("legendInverseSelect","legendinverseselect",Ie(eh,"inverseSelect")),e.registerAction("legendSelect","legendselected",Ie(eh,"select")),e.registerAction("legendUnSelect","legendunselected",Ie(eh,"unSelect"))}function B7(e){e.registerComponentModel(GA),e.registerComponentView(z7),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,DNe),e.registerSubTypeDefaulter("legend",function(){return"plain"}),RNe(e)}var LNe=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.setScrollDataIndex=function(r){this.option.scrollDataIndex=r},t.prototype.init=function(r,n,i){var a=id(r);e.prototype.init.call(this,r,n,i),$$(this,r,a)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.call(this,r,n),$$(this,this.option,r)},t.type="legend.scroll",t.defaultOption=Ks(GA.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),t}(GA);function $$(e,t,r){var n=e.getOrient(),i=[1,1];i[n.index]=0,Bs(t,r,{type:"box",ignoreSize:!!i})}const ENe=LNe;var F$=Me,Aw=["width","height"],Mw=["x","y"],ONe=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.newlineDisabled=!0,r._currentIndex=0,r}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new F$),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new F$)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(r,n,i,a,o,s,l){var u=this;e.prototype.renderInner.call(this,r,n,i,a,o,s,l);var c=this._controllerGroup,f=n.get("pageIconSize",!0),d=Y(f)?f:[f,f];p("pagePrev",0);var h=n.getModel("pageTextStyle");c.add(new rt({name:"pageText",style:{text:"xx/xx",fill:h.getTextColor(),font:h.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),p("pageNext",1);function p(v,g){var m=v+"DataIndex",y=Ev(n.get("pageIcons",!0)[n.getOrient().name][g],{onclick:ce(u._pageGo,u,m,n,a)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});y.name=v,c.add(y)}},t.prototype.layoutInner=function(r,n,i,a,o,s){var l=this.getSelectorGroup(),u=r.getOrient().index,c=Aw[u],f=Mw[u],d=Aw[1-u],h=Mw[1-u];o&&fu("horizontal",l,r.get("selectorItemGap",!0));var p=r.get("selectorButtonGap",!0),v=l.getBoundingRect(),g=[-v.x,-v.y],m=Te(i);o&&(m[c]=i[c]-v[c]-p);var y=this._layoutContentAndController(r,a,m,u,c,d,h,f);if(o){if(s==="end")g[u]+=y[c]+p;else{var x=v[c]+p;g[u]-=x,y[f]-=x}y[c]+=v[c]+p,g[1-u]+=y[h]+y[d]/2-v[d]/2,y[d]=Math.max(y[d],v[d]),y[h]=Math.min(y[h],v[h]+g[1-u]),l.x=g[0],l.y=g[1],l.markRedraw()}return y},t.prototype._layoutContentAndController=function(r,n,i,a,o,s,l,u){var c=this.getContentGroup(),f=this._containerGroup,d=this._controllerGroup;fu(r.get("orient"),c,r.get("itemGap"),a?i.width:null,a?null:i.height),fu("horizontal",d,r.get("pageButtonItemGap",!0));var h=c.getBoundingRect(),p=d.getBoundingRect(),v=this._showController=h[o]>i[o],g=[-h.x,-h.y];n||(g[a]=c[u]);var m=[0,0],y=[-p.x,-p.y],x=Ee(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(v){var S=r.get("pageButtonPosition",!0);S==="end"?y[a]+=i[o]-p[o]:m[a]+=p[o]+x}y[1-a]+=h[s]/2-p[s]/2,c.setPosition(g),f.setPosition(m),d.setPosition(y);var _={x:0,y:0};if(_[o]=v?i[o]:h[o],_[s]=Math.max(h[s],p[s]),_[l]=Math.min(0,p[l]+y[1-a]),f.__rectSize=i[o],v){var b={x:0,y:0};b[o]=Math.max(i[o]-p[o]-x,0),b[s]=_[s],f.setClipPath(new Qe({shape:b})),f.__rectSize=b[o]}else d.eachChild(function(C){C.attr({invisible:!0,silent:!0})});var w=this._getPageInfo(r);return w.pageIndex!=null&&at(c,{x:w.contentPosition[0],y:w.contentPosition[1]},v?r:null),this._updatePageInfoView(r,w),_},t.prototype._pageGo=function(r,n,i){var a=this._getPageInfo(n)[r];a!=null&&i.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var i=this._controllerGroup;D(["pagePrev","pageNext"],function(c){var f=c+"DataIndex",d=n[f]!=null,h=i.childOfName(c);h&&(h.setStyle("fill",d?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),h.cursor=d?"pointer":"default")});var a=i.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;a&&o&&a.setStyle("text",oe(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),i=this.getContentGroup(),a=this._containerGroup.__rectSize,o=r.getOrient().index,s=Aw[o],l=Mw[o],u=this._findTargetItemIndex(n),c=i.children(),f=c[u],d=c.length,h=d?1:0,p={contentPosition:[i.x,i.y],pageCount:h,pageIndex:h-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!f)return p;var v=S(f);p.contentPosition[o]=-v.s;for(var g=u+1,m=v,y=v,x=null;g<=d;++g)x=S(c[g]),(!x&&y.e>m.s+a||x&&!_(x,m.s))&&(y.i>m.i?m=y:m=x,m&&(p.pageNextDataIndex==null&&(p.pageNextDataIndex=m.i),++p.pageCount)),y=x;for(var g=u-1,m=v,y=v,x=null;g>=-1;--g)x=S(c[g]),(!x||!_(y,x.s))&&m.i<y.i&&(y=m,p.pagePrevDataIndex==null&&(p.pagePrevDataIndex=m.i),++p.pageCount,++p.pageIndex),m=x;return p;function S(b){if(b){var w=b.getBoundingRect(),C=w[l]+b[l];return{s:C,e:C+w[s],i:b.__legendDataIndex}}}function _(b,w){return b.e>=w&&b.s<=w+a}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,i=this.getContentGroup(),a;return i.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===r&&(n=s)}),n??a},t.type="legend.scroll",t}(z7);const NNe=ONe;function zNe(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(i){i.setScrollDataIndex(n)})})}function BNe(e){Fe(B7),e.registerComponentModel(ENe),e.registerComponentView(NNe),zNe(e)}function $Ne(e){Fe(B7),Fe(BNe)}var FNe=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.inside",t.defaultOption=Ks(uv.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(uv);const VNe=FNe;var gP=Je();function GNe(e,t,r){gP(e).coordSysRecordMap.each(function(n){var i=n.dataZoomInfoMap.get(t.uid);i&&(i.getRange=r)})}function HNe(e,t){for(var r=gP(e).coordSysRecordMap,n=r.keys(),i=0;i<n.length;i++){var a=n[i],o=r.get(a),s=o.dataZoomInfoMap;if(s){var l=t.uid,u=s.get(l);u&&(s.removeKey(l),s.keys().length||$7(r,o))}}}function $7(e,t){if(t){e.removeKey(t.model.uid);var r=t.controller;r&&r.dispose()}}function WNe(e,t){var r={model:t,containsPoint:Ie(UNe,t),dispatchAction:Ie(jNe,e),dataZoomInfoMap:null,controller:null},n=r.controller=new Uv(e.getZr());return D(["pan","zoom","scrollMove"],function(i){n.on(i,function(a){var o=[];r.dataZoomInfoMap.each(function(s){if(a.isAvailableBehavior(s.model.option)){var l=(s.getRange||{})[i],u=l&&l(s.dzReferCoordSysInfo,r.model.mainType,r.controller,a);!s.model.get("disabled",!0)&&u&&o.push({dataZoomId:s.model.id,start:u[0],end:u[1]})}}),o.length&&r.dispatchAction(o)})}),r}function jNe(e,t){e.isDisposed()||e.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:t})}function UNe(e,t,r,n){return e.coordinateSystem.containPoint([r,n])}function qNe(e){var t,r="type_",n={type_true:2,type_move:1,type_false:0,type_undefined:-1},i=!0;return e.each(function(a){var o=a.model,s=o.get("disabled",!0)?!1:o.get("zoomLock",!0)?"move":!0;n[r+s]>n[r+t]&&(t=s),i=i&&o.get("preventDefaultMouseMove",!0)}),{controlType:t,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!i}}}function YNe(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,function(t,r){var n=gP(r),i=n.coordSysRecordMap||(n.coordSysRecordMap=ge());i.each(function(a){a.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=S7(a);D(o.infoList,function(s){var l=s.model.uid,u=i.get(l)||i.set(l,WNe(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=ge());c.set(a.uid,{dzReferCoordSysInfo:s,model:a,getRange:null})})}),i.each(function(a){var o=a.controller,s,l=a.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){$7(i,a);return}var c=qNe(l);o.enable(c.controlType,c.opt),o.setPointerChecker(a.containsPoint),ld(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var XNe=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return t.prototype.render=function(r,n,i){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),GNe(i,r,{pan:ce(kw.pan,this),zoom:ce(kw.zoom,this),scrollMove:ce(kw.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){HNe(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(sP),kw={zoom:function(e,t,r,n){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=Iw[t](null,[n.originX,n.originY],o,r,e),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/n.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(ju(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:V$(function(e,t,r,n,i,a){var o=Iw[n]([a.oldX,a.oldY],[a.newX,a.newY],t,i,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:V$(function(e,t,r,n,i,a){var o=Iw[n]([0,0],[a.scrollDelta,a.scrollDelta],t,i,r);return o.signal*(e[1]-e[0])*a.scrollDelta})};function V$(e){return function(t,r,n,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,i);if(ju(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var Iw={grid:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem.getRect();return e=e||[0,0],a.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),r.mainType==="radiusAxis"?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,r,n,i){var a=r.axis,o=i.model.coordinateSystem.getRect(),s={};return e=e||[0,0],a.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};const ZNe=XNe;function F7(e){lP(e),e.registerComponentModel(VNe),e.registerComponentView(ZNe),YNe(e)}var KNe=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=Ks(uv.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),t}(uv);const QNe=KNe;var th=Qe,G$=7,JNe=1,Pw=30,eze=7,rh="horizontal",H$="vertical",tze=5,rze=["line","bar","candlestick","scatter"],nze={easing:"cubicOut",duration:100,delay:0},ize=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._displayables={},r}return t.prototype.init=function(r,n){this.api=n,this._onBrush=ce(this._onBrush,this),this._onBrushEnd=ce(this._onBrushEnd,this)},t.prototype.render=function(r,n,i,a){if(e.prototype.render.apply(this,arguments),ld(this,"_dispatchZoomAction",r.get("throttle"),"fixRate"),this._orient=r.getOrient(),r.get("show")===!1){this.group.removeAll();return}if(r.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Kp(this,"_dispatchZoomAction");var r=this.api.getZr();r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var r=this.group;r.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new Me;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,i=r.get("brushSelect"),a=i?eze:0,o=this._findCoordRect(),s={width:n.getWidth(),height:n.getHeight()},l=this._orient===rh?{right:s.width-o.x-o.width,top:s.height-Pw-G$-a,width:o.width,height:Pw}:{right:G$,top:o.y,width:Pw,height:o.height},u=id(r.option);D(["right","top","width","height"],function(f){u[f]==="ph"&&(u[f]=l[f])});var c=pr(u,s);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===H$&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,i=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(i===rh&&!o?{scaleY:l?1:-1,scaleX:1}:i===rh&&o?{scaleY:l?1:-1,scaleX:-1}:i===H$&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=r.getBoundingRect([s]);r.x=n.x-u.x,r.y=n.y-u.y,r.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var r=this.dataZoomModel,n=this._size,i=this._displayables.sliderGroup,a=r.get("brushSelect");i.add(new th({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new th({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:ce(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),i.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,i=this._shadowSize||[],a=r.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==i[0]||n[1]!==i[1]){var f=o.getDataExtent(l),d=(f[1]-f[0])*.3;f=[f[0]-d,f[1]+d];var h=[0,n[1]],p=[0,n[0]],v=[[n[0],0],[0,0]],g=[],m=p[1]/(o.count()-1),y=0,x=Math.round(o.count()/n[0]),S;o.each([l],function(A,T){if(x>0&&T%x){y+=m;return}var M=A==null||isNaN(A)||A==="",k=M?0:ft(A,f,h,!0);M&&!S&&T?(v.push([v[v.length-1][0],0]),g.push([g[g.length-1][0],0])):!M&&S&&(v.push([y,0]),g.push([y,0])),v.push([y,k]),g.push([y,k]),y+=m,S=M}),u=this._shadowPolygonPts=v,c=this._shadowPolylinePts=g}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var _=this.dataZoomModel;function b(A){var T=_.getModel(A?"selectedDataBackground":"dataBackground"),M=new Me,k=new Rn({shape:{points:u},segmentIgnoreThreshold:1,style:T.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),I=new En({shape:{points:c},segmentIgnoreThreshold:1,style:T.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return M.add(k),M.add(I),M}for(var w=0;w<3;w++){var C=b(w===1);this._displayables.sliderGroup.add(C),this._displayables.dataShadowSegs.push(C)}},t.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,n=r.get("showDataShadow");if(n!==!1){var i,a=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();D(l,function(u){if(!i&&!(n!==!0&&ze(rze,u.get("type"))<0)){var c=a.getComponent(hs(o),s).axis,f=aze(o),d,h=u.coordinateSystem;f!=null&&h.getOtherAxis&&(d=h.getOtherAxis(c).inverse),f=u.getData().mapDimension(f),i={thisAxis:c,series:u,thisDim:o,otherDim:f,otherAxisInverse:d}}},this)},this),i}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,i=n.handles=[null,null],a=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,f=l.get("brushSelect"),d=n.filler=new th({silent:f,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(d),o.add(new th({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:JNe,fill:"rgba(0,0,0,0)"}})),D([0,1],function(x){var S=l.get("handleIcon");!A0[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var _=lr(S,-1,0,2,2,null,!0);_.attr({cursor:W$(this._orient),draggable:!0,drift:ce(this._onDragMove,this,x),ondragend:ce(this._onDragEnd,this),onmouseover:ce(this._showDataInfo,this,!0),onmouseout:ce(this._showDataInfo,this,!1),z2:5});var b=_.getBoundingRect(),w=l.get("handleSize");this._handleHeight=ne(w,this._size[1]),this._handleWidth=b.width/b.height*this._handleHeight,_.setStyle(l.getModel("handleStyle").getItemStyle()),_.style.strokeNoScale=!0,_.rectHover=!0,_.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),uu(_);var C=l.get("handleColor");C!=null&&(_.style.fill=C),o.add(i[x]=_);var A=l.getModel("textStyle");r.add(a[x]=new rt({silent:!0,invisible:!0,style:_t(A,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:A.getTextColor(),font:A.getFont()}),z2:10}))},this);var h=d;if(f){var p=ne(l.get("moveHandleSize"),s[1]),v=n.moveHandle=new Qe({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:p}}),g=p*.8,m=n.moveHandleIcon=lr(l.get("moveHandleIcon"),-g/2,-g/2,g,g,"#fff",!0);m.silent=!0,m.y=s[1]+p/2-.5,v.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var y=Math.min(s[1]/2,Math.max(p,10));h=n.moveZone=new Qe({invisible:!0,shape:{y:s[1]-y,height:p+y}}),h.on("mouseover",function(){u.enterEmphasis(v)}).on("mouseout",function(){u.leaveEmphasis(v)}),o.add(v),o.add(m),o.add(h)}h.attr({draggable:!0,cursor:W$(this._orient),drift:ce(this._onDragMove,this,"all"),ondragstart:ce(this._showDataInfo,this,!0),ondragend:ce(this._onDragEnd,this),onmouseover:ce(this._showDataInfo,this,!0),onmouseout:ce(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[ft(r[0],[0,100],n,!0),ft(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var i=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=i.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];ju(n,a,o,i.get("zoomLock")?"all":r,s.minSpan!=null?ft(s.minSpan,l,o,!0):null,s.maxSpan!=null?ft(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=yi([ft(a[0],o,l,!0),ft(a[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,i=this._handleEnds,a=yi(i.slice()),o=this._size;D([0,1],function(h){var p=n.handles[h],v=this._handleHeight;p.attr({scaleX:v/2,scaleY:v/2,x:i[h]+(h?-1:1),y:o[1]/2-v/2})},this),n.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,a[0],a[1],o[0]],c=0;c<l.length;c++){var f=l[c],d=f.getClipPath();d||(d=new Qe,f.setClipPath(d)),d.setShape({x:u[c],y:0,width:u[c+1]-u[c],height:o[1]})}this._updateDataInfo(r)},t.prototype._updateDataInfo=function(r){var n=this.dataZoomModel,i=this._displayables,a=i.handleLabels,o=this._orient,s=["",""];if(n.get("showDetail")){var l=n.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,c=this._range,f=r?l.calculateDataWindow({start:c[0],end:c[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(f[0],u),this._formatLabel(f[1],u)]}}var d=yi(this._handleEnds.slice());h.call(this,0),h.call(this,1);function h(p){var v=cu(i.handles[p].parent,this.group),g=Lx(p===0?"right":"left",v),m=this._handleWidth/2+tze,y=Yi([d[p]+(p===0?-m:m),this._size[1]/2],v);a[p].setStyle({x:y[0],y:y[1],verticalAlign:o===rh?"middle":g,align:o===rh?g:"center",text:s[p]})}},t.prototype._formatLabel=function(r,n){var i=this.dataZoomModel,a=i.get("labelFormatter"),o=i.get("labelPrecision");(o==null||o==="auto")&&(o=n.getPixelPrecision());var s=r==null||isNaN(r)?"":n.type==="category"||n.type==="time"?n.scale.getLabel({value:Math.round(r)}):r.toFixed(Math.min(o,20));return Se(a)?a(r,s):oe(a)?a.replace("{value}",s):s},t.prototype._showDataInfo=function(r){r=this._dragging||r;var n=this._displayables,i=n.handleLabels;i[0].attr("invisible",!r),i[1].attr("invisible",!r),n.moveHandle&&this.api[r?"enterEmphasis":"leaveEmphasis"](n.moveHandle,1)},t.prototype._onDragMove=function(r,n,i,a){this._dragging=!0,bo(a.event);var o=this._displayables.sliderGroup.getLocalTransform(),s=Yi([n,i],o,!0),l=this._updateInterval(r,s[0]),u=this.dataZoomModel.get("realtime");this._updateView(!u),l&&u&&this._dispatchZoomAction(!0)},t.prototype._onDragEnd=function(){this._dragging=!1,this._showDataInfo(!1);var r=this.dataZoomModel.get("realtime");!r&&this._dispatchZoomAction(!1)},t.prototype._onClickPanel=function(r){var n=this._size,i=this._displayables.sliderGroup.transformCoordToLocal(r.offsetX,r.offsetY);if(!(i[0]<0||i[0]>n[0]||i[1]<0||i[1]>n[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",i[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,i=r.offsetY;this._brushStart=new Le(n,i),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(r){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var i=n.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(i.width)<5)){var o=this._getViewExtent(),s=[0,100];this._range=yi([ft(i.x,o,s,!0),ft(i.x+i.width,o,s,!0)]),this._handleEnds=[i.x,i.x+i.width],this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(bo(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var i=this._displayables,a=this.dataZoomModel,o=i.brushRect;o||(o=i.brushRect=new th({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),i.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(r,n),c=l.transformCoordToLocal(s.x,s.y),f=this._size;u[0]=Math.max(Math.min(f[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:f[1]})},t.prototype._dispatchZoomAction=function(r){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:r?nze:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=S7(this.dataZoomModel).infoList;if(!r&&n.length){var i=n[0].model.coordinateSystem;r=i.getRect&&i.getRect()}if(!r){var a=this.api.getWidth(),o=this.api.getHeight();r={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(sP);function aze(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function W$(e){return e==="vertical"?"ns-resize":"ew-resize"}const oze=ize;function V7(e){e.registerComponentModel(QNe),e.registerComponentView(oze),lP(e)}function sze(e){Fe(F7),Fe(V7)}var lze={get:function(e,t,r){var n=Te((uze[e]||{})[t]);return r&&Y(n)?n[n.length-1]:n}},uze={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}};const G7=lze;var j$=Or.mapVisual,cze=Or.eachVisual,fze=Y,U$=D,dze=yi,hze=ft,pze=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.stateList=["inRange","outOfRange"],r.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],r.layoutMode={type:"box",ignoreSize:!0},r.dataBound=[-1/0,1/0],r.targetVisuals={},r.controllerVisuals={},r}return t.prototype.init=function(r,n,i){this.mergeDefaultAndTheme(r,i)},t.prototype.optionUpdated=function(r,n){var i=this.option;!n&&P7(i,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=ce(r,this),this.controllerVisuals=$A(this.option.controller,n,r),this.targetVisuals=$A(this.option.target,n,r)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var r=this.option.seriesIndex,n=[];return r==null||r==="all"?this.ecModel.eachSeries(function(i,a){n.push(a)}):n=pt(r),n},t.prototype.eachTargetSeries=function(r,n){D(this.getTargetSeriesIndices(),function(i){var a=this.ecModel.getSeriesByIndex(i);a&&r.call(n,a)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(i){i===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,i){var a=this.option,o=a.precision,s=this.dataBound,l=a.formatter,u;i=i||["<",">"],Y(r)&&(r=r.slice(),u=!0);var c=n?r:u?[f(r[0]),f(r[1])]:f(r);if(oe(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Se(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?i[0]+" "+c[1]:r[1]===s[1]?i[1]+" "+c[0]:c[0]+" - "+c[1];return c;function f(d){return d===s[0]?"min":d===s[1]?"max":(+d).toFixed(Math.min(o,20))}},t.prototype.resetExtent=function(){var r=this.option,n=dze([r.min,r.max]);this._dataExtent=n},t.prototype.getDataDimensionIndex=function(r){var n=this.option.dimension;if(n!=null)return r.getDimensionIndex(n);for(var i=r.dimensions,a=i.length-1;a>=0;a--){var o=i[a],s=r.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var r=this.ecModel,n=this.option,i={inRange:n.inRange,outOfRange:n.outOfRange},a=n.target||(n.target={}),o=n.controller||(n.controller={});Oe(a,i),Oe(o,i);var s=this.isCategory();l.call(this,a),l.call(this,o),u.call(this,a,"inRange","outOfRange"),c.call(this,o);function l(f){fze(n.color)&&!f.inRange&&(f.inRange={color:n.color.slice().reverse()}),f.inRange=f.inRange||{color:r.get("gradientColor")}}function u(f,d,h){var p=f[d],v=f[h];p&&!v&&(v=f[h]={},U$(p,function(g,m){if(Or.isValidType(m)){var y=G7.get(m,"inactive",s);y!=null&&(v[m]=y,m==="color"&&!v.hasOwnProperty("opacity")&&!v.hasOwnProperty("colorAlpha")&&(v.opacity=[0,0]))}}))}function c(f){var d=(f.inRange||{}).symbol||(f.outOfRange||{}).symbol,h=(f.inRange||{}).symbolSize||(f.outOfRange||{}).symbolSize,p=this.get("inactiveColor"),v=this.getItemSymbol(),g=v||"roundRect";U$(this.stateList,function(m){var y=this.itemSize,x=f[m];x||(x=f[m]={color:s?p:[p]}),x.symbol==null&&(x.symbol=d&&Te(d)||(s?g:[g])),x.symbolSize==null&&(x.symbolSize=h&&Te(h)||(s?y[0]:[y[0],y[0]])),x.symbol=j$(x.symbol,function(b){return b==="none"?g:b});var S=x.symbolSize;if(S!=null){var _=-1/0;cze(S,function(b){b>_&&(_=b)}),x.symbolSize=j$(S,function(b){return hze(b,[0,_],[0,y[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(r){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(r){return null},t.prototype.getVisualMeta=function(r){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},t}(et);const Q0=pze;var q$=[20,140],vze=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(i){i.mappingMethod="linear",i.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var r=this.itemSize;(r[0]==null||isNaN(r[0]))&&(r[0]=q$[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=q$[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):Y(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],r[0]),n[1]=Math.min(n[1],r[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),D(this.stateList,function(r){var n=this.option.controller[r].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},t.prototype.setSelected=function(r){this.option.range=r.slice(),this._resetRange()},t.prototype.getSelected=function(){var r=this.getExtent(),n=yi((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]<r[0]&&(n[0]=r[0]),n[1]<r[0]&&(n[1]=r[0]),n},t.prototype.getValueState=function(r){var n=this.option.range,i=this.getExtent();return(n[0]<=i[0]||n[0]<=r)&&(n[1]>=i[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(i){var a=[],o=i.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&a.push(l)},this),n.push({seriesId:i.id,dataIndex:a})},this),n},t.prototype.getVisualMeta=function(r){var n=Y$(this,"outOfRange",this.getExtent()),i=Y$(this,"inRange",this.option.range.slice()),a=[];function o(h,p){a.push({value:h,color:r(h,p)})}for(var s=0,l=0,u=i.length,c=n.length;l<c&&(!i.length||n[l]<=i[0]);l++)n[l]<i[s]&&o(n[l],"outOfRange");for(var f=1;s<u;s++,f=0)f&&a.length&&o(i[s],"outOfRange"),o(i[s],"inRange");for(var f=1;l<c;l++)(!i.length||i[i.length-1]<n[l])&&(f&&(a.length&&o(a[a.length-1].value,"outOfRange"),f=0),o(n[l],"outOfRange"));var d=a.length;return{stops:a,outerColors:[d?a[0].color:"transparent",d?a[d-1].color:"transparent"]}},t.type="visualMap.continuous",t.defaultOption=Ks(Q0.defaultOption,{align:"auto",calculable:!1,hoverLink:!0,realtime:!0,handleIcon:"path://M-11.39,9.77h0a3.5,3.5,0,0,1-3.5,3.5h-22a3.5,3.5,0,0,1-3.5-3.5h0a3.5,3.5,0,0,1,3.5-3.5h22A3.5,3.5,0,0,1-11.39,9.77Z",handleSize:"120%",handleStyle:{borderColor:"#fff",borderWidth:1},indicatorIcon:"circle",indicatorSize:"50%",indicatorStyle:{borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}}),t}(Q0);function Y$(e,t,r){if(r[0]===r[1])return r.slice();for(var n=200,i=(r[1]-r[0])/n,a=r[0],o=[],s=0;s<=n&&a<r[1];s++)o.push(a),a+=i;return o.push(r[1]),o}const gze=vze;var mze=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.autoPositionValues={left:1,right:1,top:1,bottom:1},r}return t.prototype.init=function(r,n){this.ecModel=r,this.api=n},t.prototype.render=function(r,n,i,a){if(this.visualMapModel=r,r.get("show")===!1){this.group.removeAll();return}this.doRender(r,n,i,a)},t.prototype.renderBackground=function(r){var n=this.visualMapModel,i=nd(n.get("padding")||0),a=r.getBoundingRect();r.add(new Qe({z2:-1,silent:!0,shape:{x:a.x-i[3],y:a.y-i[0],width:a.width+i[3]+i[1],height:a.height+i[0]+i[2]},style:{fill:n.get("backgroundColor"),stroke:n.get("borderColor"),lineWidth:n.get("borderWidth")}}))},t.prototype.getControllerVisual=function(r,n,i){i=i||{};var a=i.forceState,o=this.visualMapModel,s={};if(n==="color"){var l=o.get("contentColor");s.color=l}function u(h){return s[h]}function c(h,p){s[h]=p}var f=o.controllerVisuals[a||o.getValueState(r)],d=Or.prepareVisualTypes(f);return D(d,function(h){var p=f[h];i.convertOpacityToAlpha&&h==="opacity"&&(h="colorAlpha",p=f.__alphaForOpacity),Or.dependsOn(h,n)&&p&&p.applyVisual(r,u,c)}),s[n]},t.prototype.positionGroup=function(r){var n=this.visualMapModel,i=this.api;Fx(r,n.getBoxLayoutParams(),{width:i.getWidth(),height:i.getHeight()})},t.prototype.doRender=function(r,n,i,a){},t.type="visualMap",t}(Ut);const H7=mze;var X$=[["left","right","width"],["top","bottom","height"]];function W7(e,t,r){var n=e.option,i=n.align;if(i!=null&&i!=="auto")return i;for(var a={width:t.getWidth(),height:t.getHeight()},o=n.orient==="horizontal"?1:0,s=X$[o],l=[0,null,10],u={},c=0;c<3;c++)u[X$[1-o][c]]=l[c],u[s[c]]=c===2?r[0]:n[s[c]];var f=[["x","width",3],["y","height",0]][o],d=pr(u,a,n.padding);return s[(d.margin[f[2]]||0)+d[f[0]]+d[f[1]]*.5<a[f[1]]*.5?0:1]}function vy(e,t){return D(e||[],function(r){r.dataIndex!=null&&(r.dataIndexInside=r.dataIndex,r.dataIndex=null),r.highlightKey="visualMap"+(t?t.componentIndex:"")}),e}var ca=ft,yze=D,Z$=Math.min,Dw=Math.max,xze=12,Sze=6,bze=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._shapes={},r._dataInterval=[],r._handleEnds=[],r._hoverLinkDataIndices=[],r}return t.prototype.doRender=function(r,n,i,a){this._api=i,(!a||a.type!=="selectDataRange"||a.from!==this.uid)&&this._buildView()},t.prototype._buildView=function(){this.group.removeAll();var r=this.visualMapModel,n=this.group;this._orient=r.get("orient"),this._useHandle=r.get("calculable"),this._resetInterval(),this._renderBar(n);var i=r.get("text");this._renderEndsText(n,i,0),this._renderEndsText(n,i,1),this._updateView(!0),this.renderBackground(n),this._updateView(),this._enableHoverLinkToSeries(),this._enableHoverLinkFromSeries(),this.positionGroup(n)},t.prototype._renderEndsText=function(r,n,i){if(n){var a=n[1-i];a=a!=null?a+"":"";var o=this.visualMapModel,s=o.get("textGap"),l=o.itemSize,u=this._shapes.mainGroup,c=this._applyTransform([l[0]/2,i===0?-s:l[1]+s],u),f=this._applyTransform(i===0?"bottom":"top",u),d=this._orient,h=this.visualMapModel.textStyleModel;this.group.add(new rt({style:_t(h,{x:c[0],y:c[1],verticalAlign:d==="horizontal"?"middle":f,align:d==="horizontal"?f:"center",text:a})}))}},t.prototype._renderBar=function(r){var n=this.visualMapModel,i=this._shapes,a=n.itemSize,o=this._orient,s=this._useHandle,l=W7(n,this.api,a),u=i.mainGroup=this._createBarGroup(l),c=new Me;u.add(c),c.add(i.outOfRange=K$()),c.add(i.inRange=K$(null,s?J$(this._orient):null,ce(this._dragHandle,this,"all",!1),ce(this._dragHandle,this,"all",!0))),c.setClipPath(new Qe({shape:{x:0,y:0,width:a[0],height:a[1],r:3}}));var f=n.textStyleModel.getTextRect("国"),d=Dw(f.width,f.height);s&&(i.handleThumbs=[],i.handleLabels=[],i.handleLabelPoints=[],this._createHandle(n,u,0,a,d,o),this._createHandle(n,u,1,a,d,o)),this._createIndicator(n,u,a,d,o),r.add(u)},t.prototype._createHandle=function(r,n,i,a,o,s){var l=ce(this._dragHandle,this,i,!1),u=ce(this._dragHandle,this,i,!0),c=Ji(r.get("handleSize"),a[0]),f=lr(r.get("handleIcon"),-c/2,-c/2,c,c,null,!0),d=J$(this._orient);f.attr({cursor:d,draggable:!0,drift:l,ondragend:u,onmousemove:function(m){bo(m.event)}}),f.x=a[0]/2,f.useStyle(r.getModel("handleStyle").getItemStyle()),f.setStyle({strokeNoScale:!0,strokeFirst:!0}),f.style.lineWidth*=2,f.ensureState("emphasis").style=r.getModel(["emphasis","handleStyle"]).getItemStyle(),Zl(f,!0),n.add(f);var h=this.visualMapModel.textStyleModel,p=new rt({cursor:d,draggable:!0,drift:l,onmousemove:function(m){bo(m.event)},ondragend:u,style:_t(h,{x:0,y:0,text:""})});p.ensureState("blur").style={opacity:.1},p.stateTransition={duration:200},this.group.add(p);var v=[c,0],g=this._shapes;g.handleThumbs[i]=f,g.handleLabelPoints[i]=v,g.handleLabels[i]=p},t.prototype._createIndicator=function(r,n,i,a,o){var s=Ji(r.get("indicatorSize"),i[0]),l=lr(r.get("indicatorIcon"),-s/2,-s/2,s,s,null,!0);l.attr({cursor:"move",invisible:!0,silent:!0,x:i[0]/2});var u=r.getModel("indicatorStyle").getItemStyle();if(l instanceof $r){var c=l.style;l.useStyle(q({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},u))}else l.useStyle(u);n.add(l);var f=this.visualMapModel.textStyleModel,d=new rt({silent:!0,invisible:!0,style:_t(f,{x:0,y:0,text:""})});this.group.add(d);var h=[(o==="horizontal"?a/2:Sze)+i[0]/2,0],p=this._shapes;p.indicator=l,p.indicatorLabel=d,p.indicatorLabelPoint=h,this._firstShowIndicator=!0},t.prototype._dragHandle=function(r,n,i,a){if(this._useHandle){if(this._dragging=!n,!n){var o=this._applyTransform([i,a],this._shapes.mainGroup,!0);this._updateInterval(r,o[1]),this._hideIndicator(),this._updateView()}n===!this.visualMapModel.get("realtime")&&this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:this._dataInterval.slice()}),n?!this._hovering&&this._clearHoverLinkToSeries():Q$(this.visualMapModel)&&this._doHoverLinkToSeries(this._handleEnds[r],!1)}},t.prototype._resetInterval=function(){var r=this.visualMapModel,n=this._dataInterval=r.getSelected(),i=r.getExtent(),a=[0,r.itemSize[1]];this._handleEnds=[ca(n[0],i,a,!0),ca(n[1],i,a,!0)]},t.prototype._updateInterval=function(r,n){n=n||0;var i=this.visualMapModel,a=this._handleEnds,o=[0,i.itemSize[1]];ju(n,a,o,r,0);var s=i.getExtent();this._dataInterval=[ca(a[0],o,s,!0),ca(a[1],o,s,!0)]},t.prototype._updateView=function(r){var n=this.visualMapModel,i=n.getExtent(),a=this._shapes,o=[0,n.itemSize[1]],s=r?o:this._handleEnds,l=this._createBarVisual(this._dataInterval,i,s,"inRange"),u=this._createBarVisual(i,i,o,"outOfRange");a.inRange.setStyle({fill:l.barColor}).setShape("points",l.barPoints),a.outOfRange.setStyle({fill:u.barColor}).setShape("points",u.barPoints),this._updateHandle(s,l)},t.prototype._createBarVisual=function(r,n,i,a){var o={forceState:a,convertOpacityToAlpha:!0},s=this._makeColorGradient(r,o),l=[this.getControllerVisual(r[0],"symbolSize",o),this.getControllerVisual(r[1],"symbolSize",o)],u=this._createBarPoints(i,l);return{barColor:new Rv(0,0,0,1,s),barPoints:u,handlesColor:[s[0].color,s[s.length-1].color]}},t.prototype._makeColorGradient=function(r,n){var i=100,a=[],o=(r[1]-r[0])/i;a.push({color:this.getControllerVisual(r[0],"color",n),offset:0});for(var s=1;s<i;s++){var l=r[0]+o*s;if(l>r[1])break;a.push({color:this.getControllerVisual(l,"color",n),offset:s/i})}return a.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),a},t.prototype._createBarPoints=function(r,n){var i=this.visualMapModel.itemSize;return[[i[0]-n[0],r[0]],[i[0],r[0]],[i[0],r[1]],[i[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,i=this.visualMapModel.get("inverse");return new Me(n==="horizontal"&&!i?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&i?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!i?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var i=this._shapes,a=this.visualMapModel,o=i.handleThumbs,s=i.handleLabels,l=a.itemSize,u=a.getExtent();yze([0,1],function(c){var f=o[c];f.setStyle("fill",n.handlesColor[c]),f.y=r[c];var d=ca(r[c],[0,l[1]],u,!0),h=this.getControllerVisual(d,"symbolSize");f.scaleX=f.scaleY=h/l[0],f.x=l[0]-h/2;var p=Yi(i.handleLabelPoints[c],cu(f,this.group));s[c].setStyle({x:p[0],y:p[1],text:a.formatValueText(this._dataInterval[c]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",i.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,i,a){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,f=c.indicator;if(f){f.attr("invisible",!1);var d={convertOpacityToAlpha:!0},h=this.getControllerVisual(r,"color",d),p=this.getControllerVisual(r,"symbolSize"),v=ca(r,s,u,!0),g=l[0]-p/2,m={x:f.x,y:f.y};f.y=v,f.x=g;var y=Yi(c.indicatorLabelPoint,cu(f,this.group)),x=c.indicatorLabel;x.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),_=this._orient,b=_==="horizontal";x.setStyle({text:(i||"")+o.formatValueText(n),verticalAlign:b?S:"middle",align:b?"center":S});var w={x:g,y:v,style:{fill:h}},C={style:{x:y[0],y:y[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var A={duration:100,easing:"cubicInOut",additive:!0};f.x=m.x,f.y=m.y,f.animateTo(w,A),x.animateTo(C,A)}else f.attr(w),x.attr(C);this._firstShowIndicator=!1;var T=this._shapes.handleLabels;if(T)for(var M=0;M<T.length;M++)this._api.enterBlur(T[M])}},t.prototype._enableHoverLinkToSeries=function(){var r=this;this._shapes.mainGroup.on("mousemove",function(n){if(r._hovering=!0,!r._dragging){var i=r.visualMapModel.itemSize,a=r._applyTransform([n.offsetX,n.offsetY],r._shapes.mainGroup,!0,!0);a[1]=Z$(Dw(0,a[1]),i[1]),r._doHoverLinkToSeries(a[1],0<=a[0]&&a[0]<=i[0])}}).on("mouseout",function(){r._hovering=!1,!r._dragging&&r._clearHoverLinkToSeries()})},t.prototype._enableHoverLinkFromSeries=function(){var r=this.api.getZr();this.visualMapModel.option.hoverLink?(r.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),r.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},t.prototype._doHoverLinkToSeries=function(r,n){var i=this.visualMapModel,a=i.itemSize;if(i.option.hoverLink){var o=[0,a[1]],s=i.getExtent();r=Z$(Dw(o[0],r),o[1]);var l=_ze(i,s,o),u=[r-l,r+l],c=ca(r,o,s,!0),f=[ca(u[0],o,s,!0),ca(u[1],o,s,!0)];u[0]<o[0]&&(f[0]=-1/0),u[1]>o[1]&&(f[1]=1/0),n&&(f[0]===-1/0?this._showIndicator(c,f[1],"< ",l):f[1]===1/0?this._showIndicator(c,f[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var d=this._hoverLinkDataIndices,h=[];(n||Q$(i))&&(h=this._hoverLinkDataIndices=i.findTargetDataIndices(f));var p=uye(d,h);this._dispatchHighDown("downplay",vy(p[0],i)),this._dispatchHighDown("highlight",vy(p[1],i))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(Ql(r.target,function(l){var u=ke(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var i=this.ecModel.getSeriesByIndex(n.seriesIndex),a=this.visualMapModel;if(a.isTargetSeries(i)){var o=i.getData(n.dataType),s=o.getStore().get(a.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},t.prototype._hideIndicator=function(){var r=this._shapes;r.indicator&&r.indicator.attr("invisible",!0),r.indicatorLabel&&r.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var i=0;i<n.length;i++)this._api.leaveBlur(n[i])},t.prototype._clearHoverLinkToSeries=function(){this._hideIndicator();var r=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",vy(r,this.visualMapModel)),r.length=0},t.prototype._clearHoverLinkFromSeries=function(){this._hideIndicator();var r=this.api.getZr();r.off("mouseover",this._hoverLinkFromSeriesMouseOver),r.off("mouseout",this._hideIndicator)},t.prototype._applyTransform=function(r,n,i,a){var o=cu(n,a?null:this.group);return Y(r)?Yi(r,o,i):Lx(r,o,i)},t.prototype._dispatchHighDown=function(r,n){n&&n.length&&this.api.dispatchAction({type:r,batch:n})},t.prototype.dispose=function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},t.prototype.remove=function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},t.type="visualMap.continuous",t}(H7);function K$(e,t,r,n){return new Rn({shape:{points:e},draggable:!!r,cursor:t,drift:r,onmousemove:function(i){bo(i.event)},ondragend:n})}function _ze(e,t,r){var n=xze/2,i=e.get("hoverLinkDataSize");return i&&(n=ca(i,t,r,!0)/2),n}function Q$(e){var t=e.get("hoverLinkOnHandle");return!!(t??e.get("realtime"))}function J$(e){return e==="vertical"?"ns-resize":"ew-resize"}const wze=bze;var Cze={type:"selectDataRange",event:"dataRangeSelected",update:"update"},Tze=function(e,t){t.eachComponent({mainType:"visualMap",query:e},function(r){r.setSelected(e.selected)})},Aze=[{createOnAllSeries:!0,reset:function(e,t){var r=[];return t.eachComponent("visualMap",function(n){var i=e.pipelineContext;!n.isTargetSeries(e)||i&&i.large||r.push(SOe(n.stateList,n.targetVisuals,ce(n.getValueState,n),n.getDataDimensionIndex(e.getData())))}),r}},{createOnAllSeries:!0,reset:function(e,t){var r=e.getData(),n=[];t.eachComponent("visualMap",function(i){if(i.isTargetSeries(e)){var a=i.getVisualMeta(ce(Mze,null,e,i))||{stops:[],outerColors:[]},o=i.getDataDimensionIndex(r);o>=0&&(a.dimension=o,n.push(a))}}),e.getData().setVisual("visualMeta",n)}}];function Mze(e,t,r,n){for(var i=t.targetVisuals[n],a=Or.prepareVisualTypes(i),o={color:zv(e.getData(),"color")},s=0,l=a.length;s<l;s++){var u=a[s],c=i[u==="opacity"?"__alphaForOpacity":u];c&&c.applyVisual(r,f,d)}return o.color;function f(h){return o[h]}function d(h,p){o[h]=p}}var eF=D;function kze(e){var t=e&&e.visualMap;Y(t)||(t=t?[t]:[]),eF(t,function(r){if(r){Sc(r,"splitList")&&!Sc(r,"pieces")&&(r.pieces=r.splitList,delete r.splitList);var n=r.pieces;n&&Y(n)&&eF(n,function(i){_e(i)&&(Sc(i,"start")&&!Sc(i,"min")&&(i.min=i.start),Sc(i,"end")&&!Sc(i,"max")&&(i.max=i.end))})}})}function Sc(e,t){return e&&e.hasOwnProperty&&e.hasOwnProperty(t)}var tF=!1;function j7(e){tF||(tF=!0,e.registerSubTypeDefaulter("visualMap",function(t){return!t.categories&&(!(t.pieces?t.pieces.length>0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(Cze,Tze),D(Aze,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(kze))}function U7(e){e.registerComponentModel(gze),e.registerComponentView(wze),j7(e)}var Ize=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._pieceList=[],r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],Pze[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var a=this.option.categories;this.resetVisual(function(o,s){i==="categories"?(o.mappingMethod="category",o.categories=Te(a)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=Z(this._pieceList,function(l){return l=Te(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},i=Or.listVisualTypes(),a=this.isCategory();D(r.pieces,function(s){D(i,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),D(n,function(s,l){var u=!1;D(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&D(this.stateList,function(c){(r[c]||(r[c]={}))[l]=G7.get(l,c==="inRange"?"active":"inactive",a)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(r,n){var i=this.option,a=this._pieceList,o=(n?i:r).selected||{};if(i.selected=o,D(a,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),i.selectedMode==="single"){var s=!1;D(a,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(r){return this._mode==="categories"?r.value+"":r.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var r=this.option;return r.pieces&&r.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(r){this.option.selected=Te(r)},t.prototype.getValueState=function(r){var n=Or.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],i=this._pieceList;return this.eachTargetSeries(function(a){var o=[],s=a.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Or.findPieceIndex(l,i);c===r&&o.push(u)},this),n.push({seriesId:a.id,dataIndex:o})},this),n},t.prototype.getRepresentValue=function(r){var n;if(this.isCategory())n=r.value;else if(r.value!=null)n=r.value;else{var i=r.interval||[];n=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],i=["",""],a=this;function o(c,f){var d=a.getRepresentValue({interval:c});f||(f=a.getValueState(d));var h=r(d,f);c[0]===-1/0?i[0]=h:c[1]===1/0?i[1]=h:n.push({value:c[0],color:h},{value:c[1],color:h})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return D(s,function(c){var f=c.interval;f&&(f[0]>u&&o([u,f[0]],"outOfRange"),o(f.slice()),u=f[1])},this),{stops:n,outerColors:i}},t.type="visualMap.piecewise",t.defaultOption=Ks(Q0.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}(Q0),Pze={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(n[1]-n[0])/i;+a.toFixed(r)!==a&&r<5;)r++;t.precision=r,a=+a.toFixed(r),t.minOpen&&e.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o<i;s+=a,o++){var l=o===i-1?n[1]:s+a;e.push({interval:[s,l],close:[1,1]})}t.maxOpen&&e.push({interval:[n[1],1/0],close:[0,0]}),YE(e),D(e,function(u,c){u.index=c,u.text=this.formatValueText(u.interval)},this)},categories:function(e){var t=this.option;D(t.categories,function(r){e.push({text:this.formatValueText(r,!0),value:r})},this),rF(t,e)},pieces:function(e){var t=this.option;D(t.pieces,function(r,n){_e(r)||(r={value:r});var i={text:"",index:n};if(r.label!=null&&(i.text=r.label),r.hasOwnProperty("value")){var a=i.value=r.value;i.interval=[a,a],i.close=[1,1]}else{for(var o=i.interval=[],s=i.close=[0,0],l=[1,0,1],u=[-1/0,1/0],c=[],f=0;f<2;f++){for(var d=[["gte","gt","min"],["lte","lt","max"]][f],h=0;h<3&&o[f]==null;h++)o[f]=r[d[h]],s[f]=l[h],c[f]=h===2;o[f]==null&&(o[f]=u[f])}c[0]&&o[1]===1/0&&(s[0]=0),c[1]&&o[0]===-1/0&&(s[1]=0),o[0]===o[1]&&s[0]&&s[1]&&(i.value=o[0])}i.visual=Or.retrieveVisuals(r),e.push(i)},this),rF(t,e),YE(e),D(e,function(r){var n=r.close,i=[["<","≤"][n[1]],[">","≥"][n[0]]];r.text=r.text||this.formatValueText(r.value!=null?r.value:r.interval,!1,i)},this)}};function rF(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}const Dze=Ize;var Rze=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.doRender=function(){var r=this.group;r.removeAll();var n=this.visualMapModel,i=n.get("textGap"),a=n.textStyleModel,o=a.getFont(),s=a.getTextColor(),l=this._getItemAlign(),u=n.itemSize,c=this._getViewData(),f=c.endsText,d=Cr(n.get("showLabel",!0),!f);f&&this._renderEndsText(r,f[0],u,d,l),D(c.viewPieceList,function(h){var p=h.piece,v=new Me;v.onclick=ce(this._onItemClick,this,p),this._enableHoverLink(v,h.indexInModelPieceList);var g=n.getRepresentValue(p);if(this._createItemSymbol(v,g,[0,0,u[0],u[1]]),d){var m=this.visualMapModel.getValueState(g);v.add(new rt({style:{x:l==="right"?-i:u[0]+i,y:u[1]/2,text:p.text,verticalAlign:"middle",align:l,font:o,fill:s,opacity:m==="outOfRange"?.5:1}}))}r.add(v)},this),f&&this._renderEndsText(r,f[1],u,d,l),fu(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var i=this;r.on("mouseover",function(){return a("highlight")}).on("mouseout",function(){return a("downplay")});var a=function(o){var s=i.visualMapModel;s.option.hoverLink&&i.api.dispatchAction({type:o,batch:vy(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return W7(r,this.api,r.itemSize);var i=n.align;return(!i||i==="auto")&&(i="left"),i},t.prototype._renderEndsText=function(r,n,i,a,o){if(n){var s=new Me,l=this.visualMapModel.textStyleModel;s.add(new rt({style:_t(l,{x:a?o==="right"?i[0]:0:i[0]/2,y:i[1]/2,verticalAlign:"middle",align:a?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=Z(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),i=r.get("text"),a=r.get("orient"),o=r.get("inverse");return(a==="horizontal"?o:!o)?n.reverse():i&&(i=i.slice().reverse()),{viewPieceList:n,endsText:i}},t.prototype._createItemSymbol=function(r,n,i){r.add(lr(this.getControllerVisual(n,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(n,"color")))},t.prototype._onItemClick=function(r){var n=this.visualMapModel,i=n.option,a=i.selectedMode;if(a){var o=Te(i.selected),s=n.getSelectedMapKey(r);a==="single"||a===!0?(o[s]=!0,D(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},t.type="visualMap.piecewise",t}(H7);const Lze=Rze;function q7(e){e.registerComponentModel(Dze),e.registerComponentView(Lze),j7(e)}function Eze(e){Fe(U7),Fe(q7)}var Oze={label:{enabled:!0},decal:{show:!1}},nF=Je(),Nze={};function zze(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=Te(Oze);Oe(n.label,e.getLocaleModel().get("aria"),!1),Oe(r.option,n,!1),i(),a();function i(){var u=r.getModel("decal"),c=u.get("show");if(c){var f=ge();e.eachSeries(function(d){if(!d.isColorBySeries()){var h=f.get(d.type);h||(h={},f.set(d.type,h)),nF(d).scope=h}}),e.eachRawSeries(function(d){if(e.isSeriesFiltered(d))return;if(Se(d.enableAriaDecal)){d.enableAriaDecal();return}var h=d.getData();if(d.isColorBySeries()){var y=UT(d.ecModel,d.name,Nze,e.getSeriesCount()),x=h.getVisual("decal");h.setVisual("decal",S(x,y))}else{var p=d.getRawData(),v={},g=nF(d).scope;h.each(function(_){var b=h.getRawIndex(_);v[b]=_});var m=p.count();p.each(function(_){var b=v[_],w=p.getName(_)||_+"",C=UT(d.ecModel,w,g,m),A=h.getItemVisual(b,"decal");h.setItemVisual(b,"decal",S(A,C))})}function S(_,b){var w=_?q(q({},b),_):b;return w.dirty=!0,w}})}}function a(){var u=e.getLocaleModel().get("aria"),c=r.getModel("label");if(c.option=be(c.option,u),!!c.get("enabled")){var f=t.getZr().dom;if(c.get("description")){f.setAttribute("aria-label",c.get("description"));return}var d=e.getSeriesCount(),h=c.get(["data","maxCount"])||10,p=c.get(["series","maxCount"])||10,v=Math.min(d,p),g;if(!(d<1)){var m=s();if(m){var y=c.get(["general","withTitle"]);g=o(y,{title:m})}else g=c.get(["general","withoutTitle"]);var x=[],S=d>1?c.get(["series","multiple","prefix"]):c.get(["series","single","prefix"]);g+=o(S,{seriesCount:d}),e.eachSeries(function(C,A){if(A<v){var T=void 0,M=C.get("name"),k=M?"withName":"withoutName";T=d>1?c.get(["series","multiple",k]):c.get(["series","single",k]),T=o(T,{seriesId:C.seriesIndex,seriesName:C.get("name"),seriesType:l(C.subType)});var I=C.getData();if(I.count()>h){var P=c.get(["data","partialData"]);T+=o(P,{displayCnt:h})}else T+=c.get(["data","allData"]);for(var L=c.get(["data","separator","middle"]),z=c.get(["data","separator","end"]),V=[],N=0;N<I.count();N++)if(N<h){var F=I.getName(N),E=I.getValues(N),G=c.get(["data",F?"withName":"withoutName"]);V.push(o(G,{name:F,value:E.join(L)}))}T+=V.join(L)+z,x.push(T)}});var _=c.getModel(["series","multiple","separator"]),b=_.get("middle"),w=_.get("end");g+=x.join(b)+w,f.setAttribute("aria-label",g)}}}function o(u,c){if(!oe(u))return u;var f=u;return D(c,function(d,h){f=f.replace(new RegExp("\\{\\s*"+h+"\\s*\\}","g"),d)}),f}function s(){var u=e.get("title");return u&&u.length&&(u=u[0]),u&&u.text}function l(u){return e.getLocaleModel().get(["series","typeNames"])[u]||"自定义图"}}function Bze(e){if(!(!e||!e.aria)){var t=e.aria;t.show!=null&&(t.enabled=t.show),t.label=t.label||{},D(["description","general","series","data"],function(r){t[r]!=null&&(t.label[r]=t[r])})}}function $ze(e){e.registerPreprocessor(Bze),e.registerVisual(e.PRIORITY.VISUAL.ARIA,zze)}var iF={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},Fze=function(){function e(t){var r=this._condVal=oe(t)?new RegExp(t):Sge(t)?t:null;if(r==null){var n="";lt(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return oe(r)?this._condVal.test(t):nt(r)?this._condVal.test(t+""):!1},e}(),Vze=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),Gze=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r<t.length;r++)if(!t[r].evaluate())return!1;return!0},e}(),Hze=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r<t.length;r++)if(t[r].evaluate())return!0;return!1},e}(),Wze=function(){function e(){}return e.prototype.evaluate=function(){return!this.child.evaluate()},e}(),jze=function(){function e(){}return e.prototype.evaluate=function(){for(var t=!!this.valueParser,r=this.getValue,n=r(this.valueGetterParam),i=t?this.valueParser(n):null,a=0;a<this.subCondList.length;a++)if(!this.subCondList[a].evaluate(t?i:n))return!1;return!0},e}();function mP(e,t){if(e===!0||e===!1){var r=new Vze;return r.value=e,r}var n="";return Y7(e)||lt(n),e.and?aF("and",e,t):e.or?aF("or",e,t):e.not?Uze(e,t):qze(e,t)}function aF(e,t,r){var n=t[e],i="";Y(n)||lt(i),n.length||lt(i);var a=e==="and"?new Gze:new Hze;return a.children=Z(n,function(o){return mP(o,r)}),a.children.length||lt(i),a}function Uze(e,t){var r=e.not,n="";Y7(r)||lt(n);var i=new Wze;return i.child=mP(r,t),i.child||lt(n),i}function qze(e,t){for(var r="",n=t.prepareGetValue(e),i=[],a=Ye(e),o=e.parser,s=o?Cj(o):null,l=0;l<a.length;l++){var u=a[l];if(!(u==="parser"||t.valueGetterAttrMap.get(u))){var c=fe(iF,u)?iF[u]:u,f=e[u],d=s?s(f):f,h=Txe(c,d)||c==="reg"&&new Fze(d);h||lt(r),i.push(h)}}i.length||lt(r);var p=new jze;return p.valueGetterParam=n,p.valueParser=s,p.getValue=t.getValue,p.subCondList=i,p}function Y7(e){return _e(e)&&!Zr(e)}var Yze=function(){function e(t,r){this._cond=mP(t,r)}return e.prototype.evaluate=function(){return this._cond.evaluate()},e}();function Xze(e,t){return new Yze(e,t)}var Zze={type:"echarts:filter",transform:function(e){for(var t=e.upstream,r,n=Xze(e.config,{valueGetterAttrMap:ge({dimension:!0}),prepareGetValue:function(s){var l="",u=s.dimension;fe(s,"dimension")||lt(l);var c=t.getDimensionInfo(u);return c||lt(l),{dimIdx:c.index}},getValue:function(s){return t.retrieveValueFromItem(r,s.dimIdx)}}),i=[],a=0,o=t.count();a<o;a++)r=t.getRawDataItem(a),n.evaluate()&&i.push(r);return{data:i}}},Kze={type:"echarts:sort",transform:function(e){var t=e.upstream,r=e.config,n="",i=pt(r);i.length||lt(n);var a=[];D(i,function(c){var f=c.dimension,d=c.order,h=c.parser,p=c.incomparable;if(f==null&&lt(n),d!=="asc"&&d!=="desc"&&lt(n),p&&p!=="min"&&p!=="max"){var v="";lt(v)}if(d!=="asc"&&d!=="desc"){var g="";lt(g)}var m=t.getDimensionInfo(f);m||lt(n);var y=h?Cj(h):null;h&&!y&&lt(n),a.push({dimIdx:m.index,parser:y,comparator:new Aj(d,p)})});var o=t.sourceFormat;o!==Kr&&o!==Di&&lt(n);for(var s=[],l=0,u=t.count();l<u;l++)s.push(t.getRawDataItem(l));return s.sort(function(c,f){for(var d=0;d<a.length;d++){var h=a[d],p=t.retrieveValueFromItem(c,h.dimIdx),v=t.retrieveValueFromItem(f,h.dimIdx);h.parser&&(p=h.parser(p),v=h.parser(v));var g=h.comparator.evaluate(p,v);if(g!==0)return g}return 0}),{data:s}}};function Qze(e){e.registerTransform(Zze),e.registerTransform(Kze)}var Jze=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataset",r}return t.prototype.init=function(r,n,i){e.prototype.init.call(this,r,n,i),this._sourceManager=new Pj(this),lN(this)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.call(this,r,n),lN(this)},t.prototype.optionUpdated=function(){this._sourceManager.dirty()},t.prototype.getSourceManager=function(){return this._sourceManager},t.type="dataset",t.defaultOption={seriesLayoutBy:Oa},t}(et),e5e=function(e){H(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataset",r}return t.type="dataset",t}(Ut);function t5e(e){e.registerComponentModel(Jze),e.registerComponentView(e5e)}var la=Wa.CMD;function Xc(e,t){return Math.abs(e-t)<1e-5}function UA(e){var t=e.data,r=e.len(),n=[],i,a=0,o=0,s=0,l=0;function u(I,P){i&&i.length>2&&n.push(i),i=[I,P]}function c(I,P,L,z){Xc(I,L)&&Xc(P,z)||i.push(I,P,L,z,L,z)}function f(I,P,L,z,V,N){var F=Math.abs(P-I),E=Math.tan(F/4)*4/3,G=P<I?-1:1,j=Math.cos(I),B=Math.sin(I),U=Math.cos(P),X=Math.sin(P),W=j*V+L,ee=B*N+z,te=U*V+L,ie=X*N+z,re=V*E*G,Q=N*E*G;i.push(W-re*B,ee+Q*j,te+re*X,ie-Q*U,te,ie)}for(var d,h,p,v,g=0;g<r;){var m=t[g++],y=g===1;switch(y&&(a=t[g],o=t[g+1],s=a,l=o,(m===la.L||m===la.C||m===la.Q)&&(i=[s,l])),m){case la.M:a=s=t[g++],o=l=t[g++],u(s,l);break;case la.L:d=t[g++],h=t[g++],c(a,o,d,h),a=d,o=h;break;case la.C:i.push(t[g++],t[g++],t[g++],t[g++],a=t[g++],o=t[g++]);break;case la.Q:d=t[g++],h=t[g++],p=t[g++],v=t[g++],i.push(a+2/3*(d-a),o+2/3*(h-o),p+2/3*(d-p),v+2/3*(h-v),p,v),a=p,o=v;break;case la.A:var x=t[g++],S=t[g++],_=t[g++],b=t[g++],w=t[g++],C=t[g++]+w;g+=1;var A=!t[g++];d=Math.cos(w)*_+x,h=Math.sin(w)*b+S,y?(s=d,l=h,u(s,l)):c(a,o,d,h),a=Math.cos(C)*_+x,o=Math.sin(C)*b+S;for(var T=(A?-1:1)*Math.PI/2,M=w;A?M>C:M<C;M+=T){var k=A?Math.max(M+T,C):Math.min(M+T,C);f(M,k,x,S,_,b)}break;case la.R:s=a=t[g++],l=o=t[g++],d=s+t[g++],h=l+t[g++],u(d,l),c(d,l,d,h),c(d,h,s,h),c(s,h,s,l),c(s,l,d,l);break;case la.Z:i&&c(a,o,s,l),a=s,o=l;break}}return i&&i.length>2&&n.push(i),n}function qA(e,t,r,n,i,a,o,s,l,u){if(Xc(e,r)&&Xc(t,n)&&Xc(i,o)&&Xc(a,s)){l.push(o,s);return}var c=2/u,f=c*c,d=o-e,h=s-t,p=Math.sqrt(d*d+h*h);d/=p,h/=p;var v=r-e,g=n-t,m=i-o,y=a-s,x=v*v+g*g,S=m*m+y*y;if(x<f&&S<f){l.push(o,s);return}var _=d*v+h*g,b=-d*m-h*y,w=x-_*_,C=S-b*b;if(w<f&&_>=0&&C<f&&b>=0){l.push(o,s);return}var A=[],T=[];Ns(e,r,i,o,.5,A),Ns(t,n,a,s,.5,T),qA(A[0],T[0],A[1],T[1],A[2],T[2],A[3],T[3],l,u),qA(A[4],T[4],A[5],T[5],A[6],T[6],A[7],T[7],l,u)}function r5e(e,t){var r=UA(e),n=[];t=t||1;for(var i=0;i<r.length;i++){var a=r[i],o=[],s=a[0],l=a[1];o.push(s,l);for(var u=2;u<a.length;){var c=a[u++],f=a[u++],d=a[u++],h=a[u++],p=a[u++],v=a[u++];qA(s,l,c,f,d,h,p,v,o,t),s=p,l=v}n.push(o)}return n}function X7(e,t,r){var n=e[t],i=e[1-t],a=Math.abs(n/i),o=Math.ceil(Math.sqrt(a*r)),s=Math.floor(r/o);s===0&&(s=1,o=r);for(var l=[],u=0;u<o;u++)l.push(s);var c=o*s,f=r-c;if(f>0)for(var u=0;u<f;u++)l[u%o]+=1;return l}function oF(e,t,r){for(var n=e.r0,i=e.r,a=e.startAngle,o=e.endAngle,s=Math.abs(o-a),l=s*i,u=i-n,c=l>Math.abs(u),f=X7([l,u],c?0:1,t),d=(c?s:u)/f.length,h=0;h<f.length;h++)for(var p=(c?u:s)/f[h],v=0;v<f[h];v++){var g={};c?(g.startAngle=a+d*h,g.endAngle=a+d*(h+1),g.r0=n+p*v,g.r=n+p*(v+1)):(g.startAngle=a+p*v,g.endAngle=a+p*(v+1),g.r0=n+d*h,g.r=n+d*(h+1)),g.clockwise=e.clockwise,g.cx=e.cx,g.cy=e.cy,r.push(g)}}function n5e(e,t,r){for(var n=e.width,i=e.height,a=n>i,o=X7([n,i],a?0:1,t),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",c=a?"y":"x",f=e[s]/o.length,d=0;d<o.length;d++)for(var h=e[l]/o[d],p=0;p<o[d];p++){var v={};v[u]=d*f,v[c]=p*h,v[s]=f,v[l]=h,v.x+=e.x,v.y+=e.y,r.push(v)}}function sF(e,t,r,n){return e*n-r*t}function i5e(e,t,r,n,i,a,o,s){var l=r-e,u=n-t,c=o-i,f=s-a,d=sF(c,f,l,u);if(Math.abs(d)<1e-6)return null;var h=e-i,p=t-a,v=sF(h,p,c,f)/d;return v<0||v>1?null:new Le(v*l+e,v*u+t)}function a5e(e,t,r){var n=new Le;Le.sub(n,r,t),n.normalize();var i=new Le;Le.sub(i,e,t);var a=i.dot(n);return a}function bc(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function o5e(e,t,r){for(var n=e.length,i=[],a=0;a<n;a++){var o=e[a],s=e[(a+1)%n],l=i5e(o[0],o[1],s[0],s[1],t.x,t.y,r.x,r.y);l&&i.push({projPt:a5e(l,t,r),pt:l,idx:a})}if(i.length<2)return[{points:e},{points:e}];i.sort(function(g,m){return g.projPt-m.projPt});var u=i[0],c=i[i.length-1];if(c.idx<u.idx){var f=u;u=c,c=f}for(var d=[u.pt.x,u.pt.y],h=[c.pt.x,c.pt.y],p=[d],v=[h],a=u.idx+1;a<=c.idx;a++)bc(p,e[a].slice());bc(p,h),bc(p,d);for(var a=c.idx+1;a<=u.idx+n;a++)bc(v,e[a%n].slice());return bc(v,d),bc(v,h),[{points:p},{points:v}]}function lF(e){var t=e.points,r=[],n=[];Mx(t,r,n);var i=new Ne(r[0],r[1],n[0]-r[0],n[1]-r[1]),a=i.width,o=i.height,s=i.x,l=i.y,u=new Le,c=new Le;return a>o?(u.x=c.x=s+a/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+a),o5e(t,u,c)}function J0(e,t,r,n){if(r===1)n.push(t);else{var i=Math.floor(r/2),a=e(t);J0(e,a[0],i,n),J0(e,a[1],r-i,n)}return n}function s5e(e,t){for(var r=[],n=0;n<t;n++)r.push(Lk(e));return r}function l5e(e,t){t.setStyle(e.style),t.z=e.z,t.z2=e.z2,t.zlevel=e.zlevel}function u5e(e){for(var t=[],r=0;r<e.length;)t.push([e[r++],e[r++]]);return t}function c5e(e,t){var r=[],n=e.shape,i;switch(e.type){case"rect":n5e(n,t,r),i=Qe;break;case"sector":oF(n,t,r),i=Dn;break;case"circle":oF({r0:0,r:n.r,startAngle:0,endAngle:Math.PI*2,cx:n.cx,cy:n.cy},t,r),i=Dn;break;default:var a=e.getComputedTransform(),o=a?Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1],a[2]*a[2]+a[3]*a[3])):1,s=Z(r5e(e.getUpdatedPathProxy(),o),function(m){return u5e(m)}),l=s.length;if(l===0)J0(lF,{points:s[0]},t,r);else if(l===t)for(var u=0;u<l;u++)r.push({points:s[u]});else{var c=0,f=Z(s,function(m){var y=[],x=[];Mx(m,y,x);var S=(x[1]-y[1])*(x[0]-y[0]);return c+=S,{poly:m,area:S}});f.sort(function(m,y){return y.area-m.area});for(var d=t,u=0;u<l;u++){var h=f[u];if(d<=0)break;var p=u===l-1?d:Math.ceil(h.area/c*t);p<0||(J0(lF,{points:h.poly},p,r),d-=p)}}i=Rn;break}if(!i)return s5e(e,t);for(var v=[],u=0;u<r.length;u++){var g=new i;g.setShape(r[u]),l5e(e,g),v.push(g)}return v}function f5e(e,t){var r=e.length,n=t.length;if(r===n)return[e,t];for(var i=[],a=[],o=r<n?e:t,s=Math.min(r,n),l=Math.abs(n-r)/6,u=(s-2)/6,c=Math.ceil(l/u)+1,f=[o[0],o[1]],d=l,h=2;h<s;){var p=o[h-2],v=o[h-1],g=o[h++],m=o[h++],y=o[h++],x=o[h++],S=o[h++],_=o[h++];if(d<=0){f.push(g,m,y,x,S,_);continue}for(var b=Math.min(d,c-1)+1,w=1;w<=b;w++){var C=w/b;Ns(p,g,y,S,C,i),Ns(v,m,x,_,C,a),p=i[3],v=a[3],f.push(i[1],a[1],i[2],a[2],p,v),g=i[5],m=a[5],y=i[6],x=a[6]}d-=b-1}return o===e?[f,t]:[e,f]}function uF(e,t){for(var r=e.length,n=e[r-2],i=e[r-1],a=[],o=0;o<t.length;)a[o++]=n,a[o++]=i;return a}function d5e(e,t){for(var r,n,i,a=[],o=[],s=0;s<Math.max(e.length,t.length);s++){var l=e[s],u=t[s],c=void 0,f=void 0;l?u?(r=f5e(l,u),c=r[0],f=r[1],n=c,i=f):(f=uF(i||l,l),c=l):(c=uF(n||u,u),f=u),a.push(c),o.push(f)}return[a,o]}function cF(e){for(var t=0,r=0,n=0,i=e.length,a=0,o=i-2;a<i;o=a,a+=2){var s=e[o],l=e[o+1],u=e[a],c=e[a+1],f=s*c-u*l;t+=f,r+=(s+u)*f,n+=(l+c)*f}return t===0?[e[0]||0,e[1]||0]:[r/t/3,n/t/3,t]}function h5e(e,t,r,n){for(var i=(e.length-2)/6,a=1/0,o=0,s=e.length,l=s-2,u=0;u<i;u++){for(var c=u*6,f=0,d=0;d<s;d+=2){var h=d===0?c:(c+d-2)%l+2,p=e[h]-r[0],v=e[h+1]-r[1],g=t[d]-n[0],m=t[d+1]-n[1],y=g-p,x=m-v;f+=y*y+x*x}f<a&&(a=f,o=u)}return o}function p5e(e){for(var t=[],r=e.length,n=0;n<r;n+=2)t[n]=e[r-n-2],t[n+1]=e[r-n-1];return t}function v5e(e,t,r,n){for(var i=[],a,o=0;o<e.length;o++){var s=e[o],l=t[o],u=cF(s),c=cF(l);a==null&&(a=u[2]<0!=c[2]<0);var f=[],d=[],h=0,p=1/0,v=[],g=s.length;a&&(s=p5e(s));for(var m=h5e(s,l,u,c)*6,y=g-2,x=0;x<y;x+=2){var S=(m+x)%y+2;f[x+2]=s[S]-u[0],f[x+3]=s[S+1]-u[1]}if(f[0]=s[m]-u[0],f[1]=s[m+1]-u[1],r>0)for(var _=n/r,b=-n/2;b<=n/2;b+=_){for(var w=Math.sin(b),C=Math.cos(b),A=0,x=0;x<s.length;x+=2){var T=f[x],M=f[x+1],k=l[x]-c[0],I=l[x+1]-c[1],P=k*C-I*w,L=k*w+I*C;v[x]=P,v[x+1]=L;var z=P-T,V=L-M;A+=z*z+V*V}if(A<p){p=A,h=b;for(var N=0;N<v.length;N++)d[N]=v[N]}}else for(var F=0;F<g;F+=2)d[F]=l[F]-c[0],d[F+1]=l[F+1]-c[1];i.push({from:f,to:d,fromCp:u,toCp:c,rotation:-h})}return i}function e1(e){return e.__isCombineMorphing}var Z7="__mOriginal_";function t1(e,t,r){var n=Z7+t,i=e[n]||e[t];e[n]||(e[n]=e[t]);var a=r.replace,o=r.after,s=r.before;e[t]=function(){var l=arguments,u;return s&&s.apply(this,l),a?u=a.apply(this,l):u=i.apply(this,l),o&&o.apply(this,l),u}}function ap(e,t){var r=Z7+t;e[r]&&(e[t]=e[r],e[r]=null)}function fF(e,t){for(var r=0;r<e.length;r++)for(var n=e[r],i=0;i<n.length;){var a=n[i],o=n[i+1];n[i++]=t[0]*a+t[2]*o+t[4],n[i++]=t[1]*a+t[3]*o+t[5]}}function K7(e,t){var r=e.getUpdatedPathProxy(),n=t.getUpdatedPathProxy(),i=d5e(UA(r),UA(n)),a=i[0],o=i[1],s=e.getComputedTransform(),l=t.getComputedTransform();function u(){this.transform=null}s&&fF(a,s),l&&fF(o,l),t1(t,"updateTransform",{replace:u}),t.transform=null;var c=v5e(a,o,10,Math.PI),f=[];t1(t,"buildPath",{replace:function(d){for(var h=t.__morphT,p=1-h,v=[],g=0;g<c.length;g++){var m=c[g],y=m.from,x=m.to,S=m.rotation*h,_=m.fromCp,b=m.toCp,w=Math.sin(S),C=Math.cos(S);Km(v,_,b,h);for(var A=0;A<y.length;A+=2){var T=y[A],M=y[A+1],k=x[A],I=x[A+1],P=T*p+k*h,L=M*p+I*h;f[A]=P*C-L*w+v[0],f[A+1]=P*w+L*C+v[1]}var z=f[0],V=f[1];d.moveTo(z,V);for(var A=2;A<y.length;){var k=f[A++],I=f[A++],N=f[A++],F=f[A++],E=f[A++],G=f[A++];z===k&&V===I&&N===E&&F===G?d.lineTo(E,G):d.bezierCurveTo(k,I,N,F,E,G),z=E,V=G}}}})}function yP(e,t,r){if(!e||!t)return t;var n=r.done,i=r.during;K7(e,t),t.__morphT=0;function a(){ap(t,"buildPath"),ap(t,"updateTransform"),t.__morphT=-1,t.createPathProxy(),t.dirtyShape()}return t.animateTo({__morphT:1},be({during:function(o){t.dirtyShape(),i&&i(o)},done:function(){a(),n&&n()}},r)),t}function g5e(e,t,r,n,i,a){var o=16;e=i===r?0:Math.round(32767*(e-r)/(i-r)),t=a===n?0:Math.round(32767*(t-n)/(a-n));for(var s=0,l,u=(1<<o)/2;u>0;u/=2){var c=0,f=0;(e&u)>0&&(c=1),(t&u)>0&&(f=1),s+=u*u*(3*c^f),f===0&&(c===1&&(e=u-1-e,t=u-1-t),l=e,e=t,t=l)}return s}function r1(e){var t=1/0,r=1/0,n=-1/0,i=-1/0,a=Z(e,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),f=l.y+l.height/2+(u?u[5]:0);return t=Math.min(c,t),r=Math.min(f,r),n=Math.max(c,n),i=Math.max(f,i),[c,f]}),o=Z(a,function(s,l){return{cp:s,z:g5e(s[0],s[1],t,r,n,i),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function Q7(e){return c5e(e.path,e.count)}function YA(){return{fromIndividuals:[],toIndividuals:[],count:0}}function m5e(e,t,r){var n=[];function i(_){for(var b=0;b<_.length;b++){var w=_[b];e1(w)?i(w.childrenRef()):w instanceof We&&n.push(w)}}i(e);var a=n.length;if(!a)return YA();var o=r.dividePath||Q7,s=o({path:t,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),YA();n=r1(n),s=r1(s);for(var l=r.done,u=r.during,c=r.individualDelay,f=new oo,d=0;d<a;d++){var h=n[d],p=s[d];p.parent=t,p.copyTransform(f),c||K7(h,p)}t.__isCombineMorphing=!0,t.childrenRef=function(){return s};function v(_){for(var b=0;b<s.length;b++)s[b].addSelfToZr(_)}t1(t,"addSelfToZr",{after:function(_){v(_)}}),t1(t,"removeSelfFromZr",{after:function(_){for(var b=0;b<s.length;b++)s[b].removeSelfFromZr(_)}});function g(){t.__isCombineMorphing=!1,t.__morphT=-1,t.childrenRef=null,ap(t,"addSelfToZr"),ap(t,"removeSelfFromZr")}var m=s.length;if(c)for(var y=m,x=function(){y--,y===0&&(g(),l&&l())},d=0;d<m;d++){var S=c?be({delay:(r.delay||0)+c(d,m,n[d],s[d]),done:x},r):r;yP(n[d],s[d],S)}else t.__morphT=0,t.animateTo({__morphT:1},be({during:function(_){for(var b=0;b<m;b++){var w=s[b];w.__morphT=t.__morphT,w.dirtyShape()}u&&u(_)},done:function(){g();for(var _=0;_<e.length;_++)ap(e[_],"updateTransform");l&&l()}},r));return t.__zr&&v(t.__zr),{fromIndividuals:n,toIndividuals:s,count:m}}function y5e(e,t,r){var n=t.length,i=[],a=r.dividePath||Q7;function o(h){for(var p=0;p<h.length;p++){var v=h[p];e1(v)?o(v.childrenRef()):v instanceof We&&i.push(v)}}if(e1(e)){o(e.childrenRef());var s=i.length;if(s<n)for(var l=0,u=s;u<n;u++)i.push(Lk(i[l++%s]));i.length=n}else{i=a({path:e,count:n});for(var c=e.getComputedTransform(),u=0;u<i.length;u++)i[u].setLocalTransform(c);if(i.length!==n)return console.error("Invalid morphing: unmatched splitted path"),YA()}i=r1(i),t=r1(t);for(var f=r.individualDelay,u=0;u<n;u++){var d=f?be({delay:(r.delay||0)+f(u,n,i[u],t[u])},r):r;yP(i[u],t[u],d)}return{fromIndividuals:i,toIndividuals:t,count:t.length}}function dF(e){return Y(e[0])}function hF(e,t){for(var r=[],n=e.length,i=0;i<n;i++)r.push({one:e[i],many:[]});for(var i=0;i<t.length;i++){var a=t[i].length,o=void 0;for(o=0;o<a;o++)r[o%n].many.push(t[i][o])}for(var s=0,i=n-1;i>=0;i--)if(!r[i].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var a=l.length,u=Math.ceil(a/2);r[i].many=l.slice(u,a),r[s].many=l.slice(0,u),s++}return r}var x5e={clone:function(e){for(var t=[],r=1-Math.pow(1-e.path.style.opacity,1/e.count),n=0;n<e.count;n++){var i=Lk(e.path);i.setStyle("opacity",r),t.push(i)}return t},split:null};function Rw(e,t,r,n,i,a){if(!e.length||!t.length)return;var o=Jf("update",n,i);if(!(o&&o.duration>0))return;var s=n.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;dF(e)&&(u=e,c=t),dF(t)&&(u=t,c=e);function f(m,y,x,S,_){var b=m.many,w=m.one;if(b.length===1&&!_){var C=y?b[0]:w,A=y?w:b[0];if(e1(C))f({many:[C],one:A},!0,x,S,!0);else{var T=s?be({delay:s(x,S)},l):l;yP(C,A,T),a(C,A,C,A,T)}}else for(var M=be({dividePath:x5e[r],individualDelay:s&&function(V,N,F,E){return s(V+x,S)}},l),k=y?m5e(b,w,M):y5e(w,b,M),I=k.fromIndividuals,P=k.toIndividuals,L=I.length,z=0;z<L;z++){var T=s?be({delay:s(z,L)},l):l;a(I[z],P[z],y?b[z]:m.one,y?m.one:b[z],T)}}for(var d=u?u===e:e.length>t.length,h=u?hF(c,u):hF(d?t:e,[d?e:t]),p=0,v=0;v<h.length;v++)p+=h[v].many.length;for(var g=0,v=0;v<h.length;v++)f(h[v],d,g,p),g+=h[v].many.length}function Ol(e){if(!e)return[];if(Y(e)){for(var t=[],r=0;r<e.length;r++)t.push(Ol(e[r]));return t}var n=[];return e.traverse(function(i){i instanceof We&&!i.disableMorphing&&!i.invisible&&!i.ignore&&n.push(i)}),n}var J7=1e4,S5e=Je();function b5e(e){for(var t=e.dimensions,r=0;r<t.length;r++){var n=e.getDimensionInfo(t[r]);if(n&&n.otherDims.itemGroupId===0)return t[r]}}function pF(e){var t=[];return D(e,function(r){var n=r.data;if(!(n.count()>J7))for(var i=n.getIndices(),a=b5e(n),o=0;o<i.length;o++)t.push({dataGroupId:r.dataGroupId,data:n,dim:r.dim||a,divide:r.divide,dataIndex:o})}),t}function Lw(e,t,r){e.traverse(function(n){n instanceof We&&Lt(n,{style:{opacity:0}},t,{dataIndex:r,isFrom:!0})})}function Ew(e){if(e.parent){var t=e.getComputedTransform();e.setLocalTransform(t),e.parent.remove(e)}}function _c(e){e.stopAnimation(),e.isGroup&&e.traverse(function(t){t.stopAnimation()})}function _5e(e,t,r){var n=Jf("update",r,t);n&&e.traverse(function(i){if(i instanceof Ti){var a=i1e(i);a&&i.animateFrom({style:a},n)}})}function w5e(e,t){var r=e.length;if(r!==t.length)return!1;for(var n=0;n<r;n++){var i=e[n],a=t[n];if(i.data.getId(i.dataIndex)!==a.data.getId(a.dataIndex))return!1}return!0}function eq(e,t,r){var n=pF(e),i=pF(t);function a(m,y,x,S,_){(x||m)&&y.animateFrom({style:x&&x!==m?q(q({},x.style),m.style):m.style},_)}function o(m){for(var y=0;y<m.length;y++)if(m[y].dim)return m[y].dim}var s=o(n),l=o(i),u=!1;function c(m,y){return function(x){var S=x.data,_=x.dataIndex;if(y)return S.getId(_);var b=x.dataGroupId,w=m?s||l:l||s,C=w&&S.getDimensionInfo(w),A=C&&C.ordinalMeta;if(C){var T=S.get(C.name,_);return A&&A.categories[T]||T+""}var M=S.getRawDataItem(_);return M&&M.groupId?M.groupId+"":b||S.getId(_)}}var f=w5e(n,i),d={};if(!f)for(var h=0;h<i.length;h++){var p=i[h],v=p.data.getItemGraphicEl(p.dataIndex);v&&(d[v.id]=!0)}function g(m,y){var x=n[y],S=i[m],_=S.data.hostModel,b=x.data.getItemGraphicEl(x.dataIndex),w=S.data.getItemGraphicEl(S.dataIndex);if(b===w){w&&_5e(w,S.dataIndex,_);return}b&&d[b.id]||w&&(_c(w),b?(_c(b),Ew(b),u=!0,Rw(Ol(b),Ol(w),S.divide,_,m,a)):Lw(w,_,m))}new To(n,i,c(!0,f),c(!1,f),null,"multiple").update(g).updateManyToOne(function(m,y){var x=i[m],S=x.data,_=S.hostModel,b=S.getItemGraphicEl(x.dataIndex),w=dt(Z(y,function(C){return n[C].data.getItemGraphicEl(n[C].dataIndex)}),function(C){return C&&C!==b&&!d[C.id]});b&&(_c(b),w.length?(D(w,function(C){_c(C),Ew(C)}),u=!0,Rw(Ol(w),Ol(b),x.divide,_,m,a)):Lw(b,_,x.dataIndex))}).updateOneToMany(function(m,y){var x=n[y],S=x.data.getItemGraphicEl(x.dataIndex);if(!(S&&d[S.id])){var _=dt(Z(m,function(w){return i[w].data.getItemGraphicEl(i[w].dataIndex)}),function(w){return w&&w!==S}),b=i[m[0]].data.hostModel;_.length&&(D(_,function(w){return _c(w)}),S?(_c(S),Ew(S),u=!0,Rw(Ol(S),Ol(_),x.divide,b,m[0],a)):D(_,function(w){return Lw(w,b,m[0])}))}}).updateManyToMany(function(m,y){new To(y,m,function(x){return n[x].data.getId(n[x].dataIndex)},function(x){return i[x].data.getId(i[x].dataIndex)}).update(function(x,S){g(m[x],y[S])}).execute()}).execute(),u&&D(t,function(m){var y=m.data,x=y.hostModel,S=x&&r.getViewOfSeriesModel(x),_=Jf("update",x,0);S&&x.isAnimationEnabled()&&_&&_.duration>0&&S.group.traverse(function(b){b instanceof We&&!b.animators.length&&b.animateFrom({style:{opacity:0}},_)})})}function vF(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function gF(e){return Y(e)?e.sort().join(","):e}function Jo(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function C5e(e,t){var r=ge(),n=ge(),i=ge();return D(e.oldSeries,function(a,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=vF(a),c=gF(u);n.set(c,{dataGroupId:s,data:l}),Y(u)&&D(u,function(f){i.set(f,{key:c,dataGroupId:s,data:l})})}),D(t.updatedSeries,function(a){if(a.isUniversalTransitionEnabled()&&a.isAnimationEnabled()){var o=a.get("dataGroupId"),s=a.getData(),l=vF(a),u=gF(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:Jo(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:Jo(s),data:s}]});else if(Y(l)){var f=[];D(l,function(p){var v=n.get(p);v.data&&f.push({dataGroupId:v.dataGroupId,divide:Jo(v.data),data:v.data})}),f.length&&r.set(u,{oldSeries:f,newSeries:[{dataGroupId:o,data:s,divide:Jo(s)}]})}else{var d=i.get(l);if(d){var h=r.get(d.key);h||(h={oldSeries:[{dataGroupId:d.dataGroupId,data:d.data,divide:Jo(d.data)}],newSeries:[]},r.set(d.key,h)),h.newSeries.push({dataGroupId:o,data:s,divide:Jo(s)})}}}}),r}function mF(e,t){for(var r=0;r<e.length;r++){var n=t.seriesIndex!=null&&t.seriesIndex===e[r].seriesIndex||t.seriesId!=null&&t.seriesId===e[r].id;if(n)return r}}function T5e(e,t,r,n){var i=[],a=[];D(pt(e.from),function(o){var s=mF(t.oldSeries,o);s>=0&&i.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:Jo(t.oldData[s]),dim:o.dimension})}),D(pt(e.to),function(o){var s=mF(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();a.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:Jo(l),dim:o.dimension})}}),i.length>0&&a.length>0&&eq(i,a,n)}function A5e(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){D(pt(n.seriesTransition),function(i){D(pt(i.to),function(a){for(var o=n.updatedSeries,s=0;s<o.length;s++)(a.seriesIndex!=null&&a.seriesIndex===o[s].seriesIndex||a.seriesId!=null&&a.seriesId===o[s].id)&&(o[s][uy]=!0)})})}),e.registerUpdateLifecycle("series:transition",function(t,r,n){var i=S5e(r);if(i.oldSeries&&n.updatedSeries&&n.optionChanged){var a=n.seriesTransition;if(a)D(pt(a),function(h){T5e(h,i,n,r)});else{var o=C5e(i,n);D(o.keys(),function(h){var p=o.get(h);eq(p.oldSeries,p.newSeries,r)})}D(n.updatedSeries,function(h){h[uy]&&(h[uy]=!1)})}for(var s=t.getSeries(),l=i.oldSeries=[],u=i.oldDataGroupIds=[],c=i.oldData=[],f=0;f<s.length;f++){var d=s[f].getData();d.count()<J7&&(l.push(s[f]),u.push(s[f].get("dataGroupId")),c.push(d))}})}Fe([Hwe]);Fe([Nwe]);Fe([hCe,DCe,WCe,DTe,YTe,GAe,x2e,aMe,LMe,GMe,JMe,nIe,PIe,HIe,uPe,gPe,EPe,WPe,nDe,fDe,CDe,uRe]);Fe(RRe);Fe(dLe);Fe(XU);Fe(ILe);Fe(O8);Fe(NLe);Fe(jLe);Fe(UEe);Fe(vOe);Fe(Yv);Fe(OOe);Fe(BOe);Fe(JOe);Fe(uNe);Fe(mNe);Fe(TNe);Fe($Ne);Fe(sze);Fe(F7);Fe(V7);Fe(Eze);Fe(U7);Fe(q7);Fe($ze);Fe(Qze);Fe(t5e);Fe(A5e);Fe(rwe);const op="#b3c3bc",XA="#5b6f66",yF=["#00ffee","#eeff00"];sI("locust",{color:yF,backgroundColor:"#27272a",xAxis:{lineColor:"#f00"},graph:{color:yF},textStyle:{color:op},title:{textStyle:{color:op}}});const M5e=({charts:e,title:t,seriesData:r,colors:n})=>({legend:{icon:"circle",inactiveColor:op,textStyle:{color:op}},title:{text:t,x:10,y:10},tooltip:{trigger:"axis",formatter:i=>i&&Array.isArray(i)&&i.length>0&&i.some(a=>!!a.value)?i.reduce((a,{axisValue:o,color:s,seriesName:l,value:u},c)=>`
          ${c===0?o:""}
          ${a}
          <br>
          <span style="color:${s};">
            ${l}:&nbsp${u}
          </span>
        `, "") : "No data", axisPointer: { animation: !0 }, textStyle: { color: op, fontSize: 13 }, backgroundColor: "rgba(21,35,28, 0.93)", borderWidth: 0, extraCssText: "z-index:1;"
}, xAxis: { type: "category", splitLine: { show: !1 }, axisLine: { lineStyle: { color: XA } }, data: e.time }, yAxis: { type: "value", boundaryGap: [0, "5%"], splitLine: { show: !1 }, axisLine: { lineStyle: { color: XA } } }, series: r, grid: { x: 60, y: 70, x2: 40, y2: 40 }, color: n, toolbox: { feature: { saveAsImage: { name: t.replace(/\s+/g, "_").toLowerCase() + "_" + new Date().getTime() / 1e3, title: "Download as PNG", emphasis: { iconStyle: { textPosition: "left" } } } } }
}), k5e = ({ charts: e, lines: t }) => t.map(({ key: r, name: n }) => ({ name: n, type: "line", showSymbol: !0, data: e[r] })), I5e = e => ({ symbol: "none", label: { formatter: t => `Run #${t.dataIndex + 1}` }, lineStyle: { color: XA }, data: (e.markers || []).map(t => ({ xAxis: t })) }); function P5e({ charts: e, title: t, lines: r, colors: n }) { const [i, a] = O.useState(null), o = O.useRef(null); return O.useEffect(() => { if (!o.current) return; const s = mbe(o.current, "locust"); s.setOption(M5e({ charts: e, title: t, seriesData: k5e({ charts: e, lines: r }), colors: n })); const l = () => s.resize(); return window.addEventListener("resize", l), s.group = "swarmCharts", ybe("swarmCharts"), a(s), () => { xbe(s), window.removeEventListener("resize", l) } }, [o]), O.useEffect(() => { const s = r.every(({ key: l }) => !!e[l]); i && s && i.setOption({ xAxis: { data: e.time }, series: r.map(({ key: l }, u) => ({ data: e[l], ...u === 0 ? { markLine: I5e(e) } : {} })) }) }, [e, i, r]), R.jsx("div", { ref: o, style: { width: "100%", height: "300px" } }) } const D5e = La.percentilesToChart ? La.percentilesToChart.map(e => ({ name: `${e * 100}th percentile`, key: `responseTimePercentile${e}` })) : [], R5e = [{ title: "Total Requests per Second", lines: [{ name: "RPS", key: "currentRps" }, { name: "Failures/s", key: "currentFailPerSec" }], colors: ["#22ff22", "#ff2222"] }, { title: "Response Times (ms)", lines: [...D5e, { name: "Average Response Time", key: "totalAvgResponseTime" }] }, { title: "Number of Users", lines: [{ name: "Number of Users", key: "userCount" }], colors: ["#0099ff"]}];function tq({charts:e}){return R.jsx("div",{children:R5e.map((t,r)=>R.jsx(P5e,{...t,charts:e},`swarm-chart-${r}`))})}const L5e=({ui:{charts:e}})=>({charts:e}),E5e=Ln(L5e)(tq);function O5e(e){return(e*100).toFixed(1)+"%"}function ZA({classRatio:e}){return R.jsx("ul",{children:Object.entries(e).map(([t,{ratio:r,tasks:n}])=>R.jsxs("li",{children:[`${O5e(r)} ${t}`,n&&R.jsx(ZA,{classRatio:n})]},`nested-ratio-${t}`))})}function rq({ratios:{perClass:e,total:t}}){return!e&&!t?null:R.jsxs("div",{children:[e&&R.jsxs(R.Fragment,{children:[R.jsx("h3",{children:"Ratio Per Class"}),R.jsx(ZA,{classRatio:e})]}),t&&R.jsxs(R.Fragment,{children:[R.jsx("h3",{children:"Total Ratio"}),R.jsx(ZA,{classRatio:t})]})]})}const N5e=({ui:{ratios:e}})=>({ratios:e}),z5e=Ln(N5e)(rq),B5e=[{key:"id",title:"Worker"},{key:"state",title:"State"},{key:"userCount",title:"# users"},{key:"cpuUsage",title:"CPU usage"},{key:"memoryUsage",title:"Memory usage",formatter:fue}];function $5e({workers:e=[]}){const{onTableHeadClick:t,sortedStats:r,currentSortField:n}=sk(e,{defaultSortKey:"worker"});return R.jsx(qf,{currentSortField:n,onTableHeadClick:t,rows:r,structure:B5e})}const F5e=({ui:{workers:e}})=>({workers:e}),V5e=Ln(F5e)($5e),G5e=[{component:nge,key:"stats",title:"Statistics"},{component:E5e,key:"charts",title:"Charts"},{component:Wve,key:"failures",title:"Failures"},{component:Fve,key:"exceptions",title:"Exceptions"},{component:z5e,key:"ratios",title:"Current Ratio"},{component:Yve,key:"reports",title:"Download Data"},{component:jve,key:"logViewer",title:"Logs"}],H5e=[{component:V5e,key:"workers",title:"Workers",shouldDisplayTab:e=>e.swarm.isDistributed}],W5e=e=>{const t=new URL(window.location.href);for(const[r,n]of Object.entries(e))t.searchParams.set(r,n);window.history.pushState(null,"",t)},j5e=()=>window.location.search?cue(window.location.search):null,U5e={query:j5e()},nq=li({name:"url",initialState:U5e,reducers:{setUrl:Tv}}),q5e=nq.actions,Y5e=nq.reducer;function X5e({hasNotification:e,title:t}){return R.jsxs(it,{sx:{display:"flex",alignItems:"center"},children:[e&&R.jsx(o6,{color:"secondary"}),R.jsx("span",{children:t})]})}function Z5e({currentTabIndexFromQuery:e,notification:t,setNotification:r,setUrl:n,tabs:i}){const[a,o]=O.useState(e),s=(l,u)=>{const c=i[u].key;t[c]&&r({[c]:!1}),W5e({tab:c}),n({query:{tab:c}}),o(u)};return R.jsxs(jf,{maxWidth:"xl",children:[R.jsx(it,{sx:{mb:2},children:R.jsx(ele,{onChange:s,value:a,children:i.map(({key:l,title:u},c)=>R.jsx(Boe,{label:R.jsx(X5e,{hasNotification:t[l],title:u})},`tab-${c}`))})}),i.map(({component:l=zve},u)=>a===u&&R.jsx(l,{},`tabpabel-${u}`))]})}const K5e=e=>{const{notification:t,swarm:{extendedTabs:r=[]},url:{query:n}}=e,i=H5e.filter(({shouldDisplayTab:o})=>o(e)),a=[...G5e,...i,...r];return{notification:t,tabs:a,currentTabIndexFromQuery:n&&n.tab?a.findIndex(({key:o})=>o===n.tab):0}},Q5e={setNotification:i6.setNotification,setUrl:q5e.setUrl},J5e=Ln(K5e,Q5e)(Z5e);var SF;const eBe={totalRps:0,failRatio:0,stats:[],errors:[],exceptions:[],charts:(SF=La.history)==null?void 0:SF.reduce(hx,{}),ratios:{},userCount:0};var bF;const tBe=(bF=La.percentilesToChart)==null?void 0:bF.reduce((e,t)=>({...e,[`responseTimePercentile${t}`]:{value:null}}),{}),rBe=e=>hx(e,{...tBe,currentRps:{value:null},currentFailPerSec:{value:null},totalAvgResponseTime:{value:null},userCount:{value:null},time:""}),iq=li({name:"ui",initialState:eBe,reducers:{setUi:Tv,updateCharts:(e,{payload:t})=>({...e,charts:hx(e.charts,t)}),updateChartMarkers:(e,{payload:t})=>({...e,charts:{...rBe(e.charts),markers:e.charts.markers?[...e.charts.markers,t]:[e.charts.time[0],t]}})}}),Ow=iq.actions,nBe=iq.reducer,xF=2e3;function iBe(){const e=Ul(qM.setSwarm),t=Ul(Ow.setUi),r=Ul(Ow.updateCharts),n=Ul(Ow.updateChartMarkers),i=Ys(({swarm:m})=>m),a=O.useRef(i.state),o=O.useRef(!1),[s,l]=O.useState(!1),{data:u,refetch:c}=_ce(),{data:f,refetch:d}=wce(),{data:h,refetch:p}=Cce(),v=i.state===mi.SPAWNING||i.state==mi.RUNNING,g=()=>{if(!u)return;const{currentResponseTimePercentiles:m,extendedStats:y,stats:x,errors:S,totalRps:_,totalFailPerSec:b,failRatio:w,workers:C,userCount:A,totalAvgResponseTime:T}=u,M=new Date().toLocaleTimeString();s&&(l(!1),n(M));const k=dh(_,2),I=dh(b,2),P=dh(w*100),L={...m,currentRps:k,currentFailPerSec:I,totalAvgResponseTime:dh(T,2),userCount:A,time:M};t({extendedStats:y,stats:x,errors:S,totalRps:k,failRatio:P,workers:C,userCount:A}),r(L)};O.useEffect(()=>{u&&e({state:u.state})},[u&&u.state]),O.useEffect(()=>{u&&(o.current||g(),o.current=!0)},[u]),fh(g,xF,{shouldRunInterval:!!u&&v}),O.useEffect(()=>{f&&t({ratios:f})},[f]),O.useEffect(()=>{h&&t({exceptions:h.exceptions})},[h]),fh(c,xF,{shouldRunInterval:v}),fh(d,5e3,{shouldRunInterval:v}),fh(p,5e3,{shouldRunInterval:v}),O.useEffect(()=>{i.state===mi.RUNNING&&a.current===mi.STOPPED&&l(!0),a.current=i.state},[i.state,a])}function aBe({isDarkMode:e,swarmState:t}){iBe(),cfe();const r=O.useMemo(()=>zM(e?Si.DARK:Si.LIGHT),[e]);return R.jsxs(R2,{theme:r,children:[R.jsx(kM,{}),R.jsx(rfe,{children:t===mi.READY?R.jsx(r6,{}):R.jsx(J5e,{})})]})}const oBe=({swarm:{state:e},theme:{isDarkMode:t}})=>({isDarkMode:t,swarmState:e}),sBe=Ln(oBe)(aBe),lBe=o1({[KC.reducerPath]:KC.reducer,logViewer:lfe,notification:ife,swarm:Gce,theme:BG,ui:nBe,url:Y5e}),uBe=GF({reducer:lBe}),cBe=[{key:"method",title:"Method"},{key:"name",title:"Name"}];function fBe({responseTimes:e}){const t=O.useMemo(()=>Object.keys(e[0]).filter(r=>!!Number(r)).map(r=>({key:r,title:`${Number(r)*100}%ile (ms)`})),[e]);return R.jsx(qf,{rows:e,structure:[...cBe,...t]})}const dBe=zM(window.theme||NG);function hBe({locustfile:e,showDownloadLink:t,startTime:r,endTime:n,charts:i,host:a,exceptionsStatistics:o,requestsStatistics:s,failuresStatistics:l,responseTimeStatistics:u,tasks:c}){return R.jsxs(R2,{theme:dBe,children:[R.jsx(kM,{}),R.jsxs(jf,{maxWidth:"lg",sx:{my:4},children:[R.jsxs(it,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-end"},children:[R.jsx(qe,{component:"h1",noWrap:!0,sx:{fontWeight:700},variant:"h3",children:"Locust Test Report"}),t&&R.jsx(on,{href:`?download=1&theme=${window.theme}`,children:"Download the Report"})]}),R.jsxs(it,{sx:{my:2},children:[R.jsxs(it,{sx:{display:"flex",columnGap:.5},children:[R.jsx(qe,{fontWeight:600,children:"During:"}),R.jsxs(qe,{children:[r," - ",n]})]}),R.jsxs(it,{sx:{display:"flex",columnGap:.5},children:[R.jsx(qe,{fontWeight:600,children:"Target Host:"}),R.jsx(qe,{children:a||"None"})]}),R.jsxs(it,{sx:{display:"flex",columnGap:.5},children:[R.jsx(qe,{fontWeight:600,children:"Script:"}),R.jsx(qe,{children:e})]})]}),R.jsxs(it,{sx:{display:"flex",flexDirection:"column",rowGap:4},children:[R.jsxs(it,{children:[R.jsx(qe,{component:"h2",mb:1,noWrap:!0,variant:"h4",children:"Request Statistics"}),R.jsx(q6,{stats:s})]}),R.jsxs(it,{children:[R.jsx(qe,{component:"h2",mb:1,noWrap:!0,variant:"h4",children:"Response Time Statistics"}),R.jsx(fBe,{responseTimes:u})]}),R.jsxs(it,{children:[R.jsx(qe,{component:"h2",mb:1,noWrap:!0,variant:"h4",children:"Failures Statistics"}),R.jsx(j6,{errors:l})]}),!!o.length&&R.jsxs(it,{children:[R.jsx(qe,{component:"h2",mb:1,noWrap:!0,variant:"h4",children:"Exceptions Statistics"}),R.jsx(W6,{exceptions:o})]}),R.jsxs(it,{children:[R.jsx(qe,{component:"h2",mb:1,noWrap:!0,variant:"h4",children:"Charts"}),R.jsx(tq,{charts:i})]}),R.jsxs(it,{children:[R.jsx(qe,{component:"h2",mb:1,noWrap:!0,variant:"h4",children:"Final ratio"}),R.jsx(rq,{ratios:c})]})]})]})]})}const Nw=YC.createRoot(document.getElementById("root"));var _F;if(window.authArgs){const e=GF({reducer:o1({theme:BG})});Nw.render(R.jsx(rL,{store:e,children:R.jsx(due,{})}))}else if(La.isReport){const e={...La,charts:(_F=La.history)==null?void 0:_F.reduce((t,{currentResponseTimePercentiles:r,...n})=>hx(t,{...r,...n}),{})};Nw.render(R.jsx(hBe,{...e}))}else Nw.render(R.jsx(rL,{store:uBe,children:R.jsx(sBe,{})}));
//# sourceMappingURL=index-f31faefc.js.map

image