@webority/ui-elements 0.68.2 → 0.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{WuiAutocomplete-5pVUMbGl.js → WuiAutocomplete-CYpMjHs3.js} +1 -1
  2. package/dist/{WuiCommentThread-BrCd4o4b.js → WuiCommentThread-BHtcGLX0.js} +1 -1
  3. package/dist/{WuiContextMenu-CBy0O4HT.js → WuiContextMenu-BLNKaFsB.js} +1 -1
  4. package/dist/{WuiCountrySelect-B4O8uijt.js → WuiCountrySelect-DlmQ6qeN.js} +1 -1
  5. package/dist/{WuiDatePicker-CeqLTVTD.js → WuiDatePicker-CpRYPtYz.js} +1 -1
  6. package/dist/{WuiDateRange-Bk45QgnB.js → WuiDateRange-h4lDtS-H.js} +1 -1
  7. package/dist/{WuiHoverCard-BsYAwmbA.js → WuiHoverCard-Ql6CD3BL.js} +1 -1
  8. package/dist/{WuiMentionInput-U87MXi2S.js → WuiMentionInput-BxYXpBRt.js} +1 -1
  9. package/dist/{WuiMenubar-D2tb_3eU.js → WuiMenubar-4MOZ51R_.js} +1 -1
  10. package/dist/{WuiMultiSelect-CR4meVOZ.js → WuiMultiSelect-CBbY_sPD.js} +1 -1
  11. package/dist/{WuiOverflow-CB3j6q6n.js → WuiOverflow-Ixc3PRuW.js} +1 -1
  12. package/dist/{WuiPhone-Cbt2ekvK.js → WuiPhone-BfM_ttOi.js} +1 -1
  13. package/dist/{WuiSelect-C-NN9ZSX.js → WuiSelect-DJgzL9Z_.js} +1 -1
  14. package/dist/{WuiTimePicker-F0KkpOGq.js → WuiTimePicker-BIhwlHuA.js} +1 -1
  15. package/dist/{WuiTour-DW3kPaR9.js → WuiTour-Bi_0ayiH.js} +1 -1
  16. package/dist/{WuiWhatsNew-BO78119Z.js → WuiWhatsNew-68sOQOTO.js} +1 -1
  17. package/dist/{anchorOverlay-WcDeH46q.js → anchorOverlay-HAWsGzlr.js} +1 -1
  18. package/dist/elements/autocomplete.js +1 -1
  19. package/dist/elements/comment-thread.js +1 -1
  20. package/dist/elements/context-menu.js +1 -1
  21. package/dist/elements/country-select.js +1 -1
  22. package/dist/elements/date-range.js +1 -1
  23. package/dist/elements/datepicker.js +1 -1
  24. package/dist/elements/filter-popover.js +1 -1
  25. package/dist/elements/hover-card.js +1 -1
  26. package/dist/elements/kanban.js +1 -1
  27. package/dist/elements/mention-input.js +1 -1
  28. package/dist/elements/menubar.js +1 -1
  29. package/dist/elements/multiselect.js +1 -1
  30. package/dist/elements/overflow.js +1 -1
  31. package/dist/elements/phone.js +1 -1
  32. package/dist/elements/select.js +1 -1
  33. package/dist/elements/timepicker.js +1 -1
  34. package/dist/elements/tour.js +1 -1
  35. package/dist/elements/whats-new.js +1 -1
  36. package/dist/{fileViewerImage-DEhhKbIU.js → fileViewerImage-Du71Tgbf.js} +1 -1
  37. package/dist/{fileViewerMedia-B12HzBnN.js → fileViewerMedia-BWRNH-we.js} +1 -1
  38. package/dist/{fileViewerPdf-L8OJZRPO.js → fileViewerPdf-CL451vuw.js} +1 -1
  39. package/dist/fileViewerUi-DAWY2fNB.js +1 -0
  40. package/dist/{filterPopover-B4nw2nUP.js → filterPopover-BD8kwDfx.js} +1 -1
  41. package/dist/kanban-C0RiKTUx.js +1 -0
  42. package/dist/ui-chart.global.js +1 -1
  43. package/dist/ui-chart.js +1 -1
  44. package/dist/ui-elements.global.js +112 -112
  45. package/dist/ui-elements.js +1 -1
  46. package/dist/ui-file-viewer.global.js +11 -11
  47. package/dist/ui-file-viewer.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/fileViewerUi-KPTQsM_Y.js +0 -1
  50. package/dist/kanban-DclZZohi.js +0 -1
package/dist/ui-chart.js CHANGED
@@ -18,4 +18,4 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
18
18
  `||r===``)){var i=e.isSelected(r);W(n,r)?n[r]=n[r]&&i:n[r]=i}}),n}function dV(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,ae(lV,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,ae(lV,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,ae(lV,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,ae(lV,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,ae(lV,`unSelect`))}var fV=Yc(pV);function pV(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;n<t.length;n++)if(!t[n].isSelected(e.name))return!1;return!0})}function mV(e){e.registerComponentModel($B),e.registerComponentView(rV),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,fV),e.registerSubTypeDefaulter(`legend`,function(){return`plain`}),dV(e)}var hV=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(t,n,r){var i=p_(t);e.prototype.init.call(this,t,n,r),gV(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),gV(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=Eh($B.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:Y.color.accent50,pageIconInactiveColor:Y.color.accent10,pageIconSize:15,pageTextStyle:{color:Y.color.tertiary},animationDurationUpdate:800}),t}($B);function gV(e,t,n){var r=e.getOrient(),i=[1,1];i[r.index]=0,f_(t,n,{type:`box`,ignoreSize:!!i})}var _V=zu,vV=[`width`,`height`],yV=[`x`,`y`],bV=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!0,n._currentIndex=0,n}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new _V),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new _V)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(t,n,r,i,a,o,s){var c=this;e.prototype.renderInner.call(this,t,n,r,i,a,o,s);var l=this._controllerGroup,u=n.get(`pageIconSize`,!0),d=R(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new Uo({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=xf(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:L(c._pageGo,c,r,n,i)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});a.name=e,l.add(a)}},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getSelectorGroup(),s=e.getOrient().index,c=vV[s],l=yV[s],u=vV[1-s],d=yV[1-s];i&&n_(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=E(n);i&&(h[c]=n[c]-p[c]-f);var g=this._layoutContentAndController(e,r,h,s,c,u,d,l);if(i){if(a===`end`)m[s]+=g[c]+f;else{var _=p[c]+f;m[s]-=_,g[l]-=_}g[c]+=p[c]+f,m[1-s]+=g[d]+g[u]/2-p[u]/2,g[u]=Math.max(g[u],p[u]),g[d]=Math.min(g[d],p[d]+m[1-s]),o.x=m[0],o.y=m[1],o.markRedraw()}return g},t.prototype._layoutContentAndController=function(e,t,n,r,i,a,o,s){var c=this.getContentGroup(),l=this._containerGroup,u=this._controllerGroup;n_(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),n_(`horizontal`,u,e.get(`pageButtonItemGap`,!0));var d=c.getBoundingRect(),f=u.getBoundingRect(),p=this._showController=d[i]>n[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=H(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new Ro({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&Hd(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;N([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,B(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=vV[i],o=yV[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i<g.i&&(g=h,f.pagePrevDataIndex??=h.i,++f.pageCount,++f.pageIndex),h=_;return f;function v(e){if(e){var t=e.getBoundingRect(),n=t[o]+e[o];return{s:n,e:n+t[a],i:e.__legendDataIndex}}}function y(e,t){return e.e>=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(rV);function xV(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function SV(e){Lj(mV),e.registerComponentModel(hV),e.registerComponentView(bV),xV(e)}function CV(e){Lj(mV),Lj(SV)}var wV=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=Eh(Az.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Az),TV=yc();function EV(e,t,n){TV(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function DV(e,t){for(var n=TV(e).coordSysRecordMap,r=n.keys(),i=0;i<r.length;i++){var a=r[i],o=n.get(a),s=o.dataZoomInfoMap;if(s){var c=t.uid;s.get(c)&&(s.removeKey(c),s.keys().length||OV(n,o))}}}function OV(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function kV(e,t){var n={model:t,containsPoint:ae(jV,t),dispatchAction:ae(AV,e),dataZoomInfoMap:null,controller:null},r=n.controller=new nN(e.getZr());return N([`pan`,`zoom`,`scrollMove`],function(e){r.on(e,function(t){var r=[];n.dataZoomInfoMap.each(function(i){if(t.isAvailableBehavior(i.model.option)){var a=(i.getRange||{})[e],o=a&&a(i.dzReferCoordSysInfo,n.model.mainType,n.controller,t);!i.model.get(`disabled`,!0)&&o&&r.push({dataZoomId:i.model.id,start:o[0],end:o[1]})}}),r.length&&n.dispatchAction(r)})}),n}function AV(e,t){e.isDisposed()||e.dispatchAction({type:`dataZoom`,animation:{easing:`cubicOut`,duration:100},batch:t})}function jV(e,t,n,r){return e.coordinateSystem.containPoint([n,r])}function MV(e,t,n){var r,i=`type_`,a={type_true:2,type_move:1,type_false:0,type_undefined:-1},o=!0,s,c;return e.each(function(e){var t=e.model,n=t.get(`disabled`,!0)?!1:!t.get(`zoomLock`,!0)||`move`;a[i+n]>a[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0),s=H(t.get(`cursorGrab`,!0),s),c=H(t.get(`cursorGrabbing`,!0),c)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:c}}}function NV(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=TV(t),r=n.coordSysRecordMap||=U();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){N(wz(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,kV(t,n.model));(a.dataZoomInfoMap||=U()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i){OV(r,e);return}var s=MV(a,e,t);n.enable(s.controlType,s.opt),xw(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)})})}var PV=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){if(e.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),EV(r,t,{pan:L(FV.pan,this),zoom:L(FV.zoom,this),scrollMove:L(FV.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){DV(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(Mz),FV={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=LV[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(RI(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:IV(function(e,t,n,r,i,a){var o=LV[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:IV(function(e,t,n,r,i,a){return LV[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function IV(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(RI(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var LV={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return 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,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return 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}};function RV(e){Lz(e),e.registerComponentModel(wV),e.registerComponentView(PV),NV(e)}var zV=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=Eh(Az.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:Y.color.accent10,borderRadius:0,backgroundColor:Y.color.transparent,dataBackground:{lineStyle:{color:Y.color.accent30,width:.5},areaStyle:{color:Y.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:Y.color.accent40,width:.5},areaStyle:{color:Y.color.accent20,opacity:.3}},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:Y.color.neutral00,borderColor:Y.color.accent20},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:Y.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:Y.color.tertiary},brushSelect:!0,brushStyle:{color:Y.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:Y.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(Az),BV=Ro,VV=1,HV=30,UV=7,WV=`horizontal`,GV=`vertical`,KV=5,qV=[`line`,`bar`,`candlestick`,`scatter`],JV={easing:`cubicOut`,duration:100,delay:0},YV=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=L(this._onBrush,this),this._onBrushEnd=L(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){if(e.prototype.render.apply(this,arguments),xw(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!==`dataZoom`||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Sw(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new zu;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?UV:0,r=c_(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===WV?{right:r.width-i.x-i.width,top:r.height-HV-a-n,width:i.width,height:HV}:{right:a,top:i.y,width:HV,height:i.height},s=p_(e.option);N([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=o_(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===GV&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===WV&&!i?{scaleY:o?1:-1,scaleX:1}:n===WV&&i?{scaleY:o?1:-1,scaleX:-1}:n===GV&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new BV({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new BV({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:L(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b){v||(y+=g);return}y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:_s(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new zu,r=new fd({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new md({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){N(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&j(qV,e.get(`type`))<0)){var o=r.getComponent(Sz(i),a).axis,s=ZV(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new BV({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new BV({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:VV,fill:Y.color.transparent}})),N([0,1],function(t){var a=o.get(`handleIcon`);!jv[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Pv(a,-1,0,2,2,null,!0);s.attr({cursor:QV(this._orient),draggable:!0,drift:L(this._onDragMove,this,t),ondragend:L(this._onDragEnd,this),onmouseover:L(this._onOverDataInfoTriggerArea,this,!0),onmouseout:L(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=q(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),iu(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new Uo({silent:!0,invisible:!f,style:Yf(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=q(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new Ro({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=Pv(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,Y.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new Ro({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:L(this._onActualMoveZoneDrift,this),ondragstart:L(this._onActualMoveZoneDragStart,this),ondragend:L(this._onActualMoveZoneDragEnd,this),onmouseover:L(this._onOverDataInfoTriggerArea,this,!0),onmouseout:L(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[_s(e[0],[0,100],t,!0),_s(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];RI(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:_s(a.minSpan,o,i,!0),a.maxSpan==null?null:_s(a.maxSpan,o,i,!0));var s=this._range,c=this._range=Cs([_s(r[0],i,o,!0),_s(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=Cs(n.slice()),i=this._size;N([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;c<o.length;c++){var l=o[c],u=l.getClipPath();u||(u=new Ro,l.setClipPath(u)),u.setShape({x:s[c],y:0,width:s[c+1]-s[c],height:i[1]})}this._updateDataInfo(e)},t.prototype._updateDataInfo=function(e){var t=this.dataZoomModel,n=this._displayables,r=n.handleLabels,i=this._orient,a=[``,``];if(t.get(`showDetail`)){var o=t.findRepresentativeAxisProxy(),s=o.getAxisModel().axis.scale;if(o){var c=this._range,l;if(e){var u={start:c[0],end:c[1]},d=Oz(t,o);if(d){var f=d.calculateDataWindow(u).percentInverted;u={start:f[0],end:f[1]}}l=o.calculateDataWindow(u)}else l=o.getWindow();a=[XV(t,0,l,s),XV(t,1,l,s)]}}var p=Cs(this._handleEnds.slice());m.call(this,0),m.call(this,1);function m(e){var t=pf(n.handles[e].parent,this.group),o=hf(e===0?`right`:`left`,t),s=this._handleWidth/2+KV,c=mf([p[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===WV?`middle`:o,align:i===WV?o:`center`,text:a[e]})}},t.prototype._onOverDataInfoTriggerArea=function(e){this._isOverDataInfoTriggerArea=e,this._showDataInfo(e)},t.prototype._showDataInfo=function(e){var t=(this.dataZoomModel.get(`handleLabel`)||{}).show||!1,n=this.dataZoomModel.getModel([`emphasis`,`handleLabel`]).get(`show`)||!1,r=e||this._dragging?n:t,i=this._displayables,a=i.handleLabels;a[0].attr(`invisible`,!r),a[1].attr(`invisible`,!r),i.moveHandle&&this.api[r?`enterEmphasis`:`leaveEmphasis`](i.moveHandle,1)},t.prototype._onActualMoveZoneDrift=function(e,t,n){this.api.getZr().setCursorStyle(`grabbing`),this._onDragMove(`all`,e,t,n)},t.prototype._onActualMoveZoneDragStart=function(e){e.target.attr(`cursor`,`grabbing`),this._showDataInfo(!0)},t.prototype._onActualMoveZoneDragEnd=function(e){e.target.attr(`cursor`,`grab`),this._onDragEnd()},t.prototype._onDragMove=function(e,t,n,r){this._dragging=!0,uE(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=mf([t,n],i,!0),o=this._updateInterval(e,a[0]),s=this.dataZoomModel.get(`realtime`);this._updateView(!s),o&&s&&this._dispatchZoomAction(!0)},t.prototype._onDragEnd=function(){this._dragging=!1,this._isOverDataInfoTriggerArea||this._showDataInfo(!1),!this.dataZoomModel.get(`realtime`)&&this._dispatchZoomAction(!1)},t.prototype._onClickPanel=function(e){var t=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(e.offsetX,e.offsetY);if(!(n[0]<0||n[0]>t[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new G(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();RI(0,a,r,0,o.minSpan==null?null:_s(o.minSpan,i,r,!0),o.maxSpan==null?null:_s(o.maxSpan,i,r,!0)),this._range=Cs([_s(a[0],r,i,!0),_s(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(uE(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new BV({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?JV:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=wz(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(Mz);function XV(e,t,n,r){var i=e.get(`labelFormatter`),a=e.get(`labelPrecision`);(a==null||a===`auto`)&&(a=n.valuePrecision);var o=n.value[t],s=o==null||isNaN(o)?``:qy(r)||Gy(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?Ss(o,a,!0):o+``;return z(i)?i(o,s):B(i)?i.replace(`{value}`,s):s}function ZV(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function QV(e){return e===`vertical`?`ns-resize`:`ew-resize`}function $V(e){e.registerComponentModel(zV),e.registerComponentView(YV),Lz(e)}function eH(e){Lj(RV),Lj($V)}var tH={get:function(e,t,n){var r=E((nH[e]||{})[t]);return n&&R(r)?r[r.length-1]:r}},nH={color:{active:[`#006edd`,`#e0ffff`],inactive:[Y.color.transparent]},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]}},rH=TF.mapVisual,iH=TF.eachVisual,aH=R,oH=N,sH=Cs,cH=_s,lH=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&bB(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=L(e,this),this.controllerVisuals=yB(this.option.controller,t,e),this.targetVisuals=yB(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return oH(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=Tc(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return P(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){N(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],R(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);if(B(o))return o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c);if(z(o))return s?o(e[0],e[1]):o(e);if(s)return e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1];return c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=sH([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=re(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};D(r,n),D(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){aH(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},oH(r,function(e,t){if(TF.isValidType(t)){var n=tH.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;oH(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??=t&&E(t)||(a?i:[i]),c.symbolSize??=n&&E(n)||(a?s[0]:[s[0],s[0]]),c.symbol=rH(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;iH(l,function(e){e>u&&(u=e)}),c.symbolSize=rH(l,function(e){return cH(e,[0,u],[0,s[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(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:Y.color.transparent,borderColor:Y.color.borderTint,contentColor:Y.color.theme[0],inactiveColor:Y.color.disabled,borderWidth:0,padding:Y.size.m,textGap:10,precision:0,textStyle:{color:Y.color.secondary}},t}(g_),uH=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.autoPositionValues={left:1,right:1,top:1,bottom:1},n}return t.prototype.init=function(e,t){this.ecModel=e,this.api=t},t.prototype.render=function(e,t,n,r){if(this.visualMapModel=e,e.get(`show`)===!1){this.group.removeAll();return}this.doRender(e,t,n,r)},t.prototype.renderBackground=function(e){var t=this.visualMapModel,n=Ug(t.get(`padding`)||0),r=e.getBoundingRect();e.add(new Ro({z2:-1,silent:!0,shape:{x:r.x-n[3],y:r.y-n[0],width:r.width+n[3]+n[1],height:r.height+n[0]+n[2]},style:{fill:t.get(`backgroundColor`),stroke:t.get(`borderColor`),lineWidth:t.get(`borderWidth`)}}))},t.prototype.getControllerVisual=function(e,t,n){n||={};var r=n.forceState,i=this.visualMapModel,a={};t===`color`&&(a.color=i.get(`contentColor`));function o(e){return a[e]}function s(e,t){a[e]=t}var c=i.controllerVisuals[r||i.getValueState(e)];return N(TF.prepareVisualTypes(c),function(r){var i=c[r];n.convertOpacityToAlpha&&r===`opacity`&&(r=`colorAlpha`,i=c.__alphaForOpacity),TF.dependsOn(r,t)&&i&&i.applyVisual(e,o,s)}),a[t]},t.prototype.positionGroup=function(e){var t=this.visualMapModel,n=this.api,r=c_(t,n).refContainer;l_(e,t.getBoxLayoutParams(),r)},t.prototype.doRender=function(e,t,n,r){},t.type=`visualMap`,t}(gO),dH=[[`left`,`right`,`width`],[`top`,`bottom`,`height`]];function fH(e,t,n){var r=e.option,i=r.align;if(i!=null&&i!==`auto`)return i;for(var a={width:t.getWidth(),height:t.getHeight()},o=+(r.orient===`horizontal`),s=dH[o],c=[0,null,10],l={},u=0;u<3;u++)l[dH[1-o][u]]=c[u],l[s[u]]=u===2?n[0]:r[s[u]];var d=[[`x`,`width`,3],[`y`,`height`,0]][o],f=o_(l,a,r.padding);return s[(f.margin[d[2]]||0)+f[d[0]]+f[d[1]]*.5<a[d[1]]*.5?0:1]}function pH(e,t){return N(e||[],function(e){e.dataIndex!=null&&(e.dataIndexInside=e.dataIndex,e.dataIndex=null),e.highlightKey=`visualMap`+(t?t.componentIndex:``)}),e}var mH={type:`selectDataRange`,event:`dataRangeSelected`,update:`update`},hH=function(e,t){t.eachComponent({mainType:`visualMap`,query:e},function(t){t.setSelected(e.selected)})},gH=[{createOnAllSeries:!0,reset:function(e,t){var n=[];return t.eachComponent(`visualMap`,function(t){var r=e.pipelineContext;!t.isTargetSeries(e)||r&&r.large||n.push(xB(t.stateList,t.targetVisuals,L(t.getValueState,t),t.getDataDimensionIndex(e.getData())))}),n}},{createOnAllSeries:!0,reset:function(e,t){var n=e.getData(),r=[];t.eachComponent(`visualMap`,function(t){if(t.isTargetSeries(e)){var i=t.getVisualMeta(L(_H,null,e,t))||{stops:[],outerColors:[]},a=t.getDataDimensionIndex(n);a>=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function _H(e,t,n,r){for(var i=t.targetVisuals[r],a=TF.prepareVisualTypes(i),o={color:$O(e.getData(),`color`)},s=0,c=a.length;s<c;s++){var l=a[s],u=i[l===`opacity`?`__alphaForOpacity`:l];u&&u.applyVisual(n,d,f)}return o.color;function d(e){return o[e]}function f(e,t){o[e]=t}}var vH=N;function yH(e){var t=e&&e.visualMap;R(t)||(t=t?[t]:[]),vH(t,function(e){if(e){bH(e,`splitList`)&&!bH(e,`pieces`)&&(e.pieces=e.splitList,delete e.splitList);var t=e.pieces;t&&R(t)&&vH(t,function(e){V(e)&&(bH(e,`start`)&&!bH(e,`min`)&&(e.min=e.start),bH(e,`end`)&&!bH(e,`max`)&&(e.max=e.end))})}})}function bH(e,t){return e&&e.hasOwnProperty&&e.hasOwnProperty(t)}var xH=!1;function SH(e){xH||(xH=!0,e.registerSubTypeDefaulter(`visualMap`,function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(mH,hH),N(gH,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(yH))}var CH=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],wH[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=E(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=P(this._pieceList,function(e){return e=E(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=TF.listVisualTypes(),i=this.isCategory();N(t.pieces,function(e){N(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),N(n,function(e,n){var r=!1;N(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&N(this.stateList,function(e){(t[e]||(t[e]={}))[n]=tH.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,N(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;N(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=E(e)},t.prototype.getValueState=function(e){var t=TF.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){TF.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return N(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=Eh(lH.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}(lH),wH={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o<i;s+=a,o++){var c=o===i-1?r[1]:s+a;e.push({interval:[s,c],close:[1,1]})}t.maxOpen&&e.push({interval:[r[1],1/0],close:[0,0]}),Ls(e),N(e,function(e,t){e.index=t,e.text=this.formatValueText(e.interval)},this)},categories:function(e){var t=this.option;N(t.categories,function(t){e.push({text:this.formatValueText(t,!0),value:t})},this),TH(t,e)},pieces:function(e){var t=this.option;N(t.pieces,function(t,n){V(t)||(t={value:t});var r={text:``,index:n};if(t.label!=null&&(r.text=t.label),t.hasOwnProperty(`value`)){var i=r.value=t.value;r.interval=[i,i],r.close=[1,1]}else{for(var a=r.interval=[],o=r.close=[0,0],s=[1,0,1],c=[-1/0,1/0],l=[],u=0;u<2;u++){for(var d=[[`gte`,`gt`,`min`],[`lte`,`lt`,`max`]][u],f=0;f<3&&a[u]==null;f++)a[u]=t[d[f]],o[u]=s[f],l[u]=f===2;a[u]??(a[u]=c[u])}l[0]&&a[1]===1/0&&(o[0]=0),l[1]&&a[0]===-1/0&&(o[1]=0),a[0]===a[1]&&o[0]&&o[1]&&(r.value=a[0])}r.visual=TF.retrieveVisuals(t),e.push(r)},this),TH(t,e),Ls(e),N(e,function(e){var t=e.close,n=[[`<`,`≤`][t[1]],[`>`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function TH(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var EH=function(e){r(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=me(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),N(o.viewPieceList,function(o){var s=o.piece,u=new zu;u.onclick=L(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new Uo({style:Yf(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:H(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),n_(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:pH(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return fH(e,this.api,e.itemSize);var n=t.align;return(!n||n===`auto`)&&(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new zu,o=this.visualMapModel.textStyleModel;a.add(new Uo({style:Yf(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=P(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=Pv(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=E(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,N(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(uH);function DH(e){e.registerComponentModel(CH),e.registerComponentView(EH),SH(e)}function OH(e){if(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].slice());return t}}function kH(e,t){var n=e.label,r=t&&t.getTextGuideLine();return{dataIndex:e.dataIndex,dataType:e.dataType,seriesIndex:e.seriesModel.seriesIndex,text:e.label.style.text,rect:e.hostRect,labelRect:e.rect,align:n.style.align,verticalAlign:n.style.verticalAlign,labelLinePoints:OH(r&&r.shape.points)}}var AH=[`align`,`verticalAlign`,`width`,`height`,`fontSize`],jH=new Kn,MH=yc(),NH=yc();function PH(e,t,n){for(var r=0;r<n.length;r++){var i=n[r];t[i]!=null&&(e[i]=t[i])}}var FH=[`x`,`y`,`rotation`],IH=function(){function e(){this._labelList=[],this._chartViewList=[]}return e.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},e.prototype._addLabel=function(e,t,n,r,i){var a=r.style,o=r.__hostTarget.textConfig||{},s=r.getComputedTransform(),c=r.getBoundingRect().plain();K.applyTransform(c,c,s),s?jH.setLocalTransform(s):(jH.x=jH.y=jH.rotation=jH.originX=jH.originY=0,jH.scaleX=jH.scaleY=1),jH.rotation=ro(jH.rotation);var l=r.__hostTarget,u;if(l){u=l.getBoundingRect().plain();var d=l.getComputedTransform();K.applyTransform(u,u,d)}var f=u&&l.getTextGuideLine();this._labelList.push({label:r,labelLine:f,seriesModel:n,dataIndex:e,dataType:t,layoutOptionOrCb:i,layoutOption:null,rect:c,hostRect:u,priority:u?u.width*u.height:0,defaultAttr:{ignore:r.ignore,labelGuideIgnore:f&&f.ignore,x:jH.x,y:jH.y,scaleX:jH.scaleX,scaleY:jH.scaleY,rotation:jH.rotation,style:{x:a.x,y:a.y,align:a.align,verticalAlign:a.verticalAlign,width:a.width,height:a.height,fontSize:a.fontSize},cursor:r.cursor,attachedPos:o.position,attachedRot:o.rotation}})},e.prototype.addLabelsOfSeries=function(e){var t=this;this._chartViewList.push(e);var n=e.__model,r=n.get(`labelLayout`);(z(r)||I(r).length)&&e.group.traverse(function(e){if(e.ignore)return!0;var i=e.getTextContent(),a=J(e);i&&!i.disableLabelLayout&&t._addLabel(a.dataIndex,a.dataType,n,i,r)})},e.prototype.updateLayoutConfig=function(e){var t=e.getWidth(),n=e.getHeight();function r(e,t){return function(){TT(e,t)}}for(var i=0;i<this._labelList.length;i++){var a=this._labelList[i],o=a.label,s=o.__hostTarget,c=a.defaultAttr,l=void 0;l=z(a.layoutOptionOrCb)?a.layoutOptionOrCb(kH(a,s)):a.layoutOptionOrCb,l||={},a.layoutOption=l;var u=Math.PI/180;s&&s.setTextConfig({local:!1,position:l.x!=null||l.y!=null?null:c.attachedPos,rotation:l.rotate==null?c.attachedRot:l.rotate*u,offset:[l.dx||0,l.dy||0]});var d=!1;if(l.x==null?(o.x=c.x,o.setStyle(`x`,c.style.x)):(o.x=q(l.x,t),o.setStyle(`x`,0),d=!0),l.y==null?(o.y=c.y,o.setStyle(`y`,c.style.y)):(o.y=q(l.y,n),o.setStyle(`y`,0),d=!0),l.labelLinePoints){var f=s.getTextGuideLine();f&&(f.setShape({points:l.labelLinePoints}),d=!1)}var p=MH(o);p.needsUpdateLabelLine=d,o.rotation=l.rotate==null?c.rotation:l.rotate*u,o.scaleX=c.scaleX,o.scaleY=c.scaleY;for(var m=0;m<AH.length;m++){var h=AH[m];o.setStyle(h,l[h]==null?c.style[h]:l[h])}if(l.draggable){if(o.draggable=!0,o.cursor=`move`,s){var g=a.seriesModel;a.dataIndex!=null&&(g=a.seriesModel.getData(a.dataType).getItemModel(a.dataIndex)),o.on(`drag`,r(s,g.getModel(`labelLine`)))}}else o.off(`drag`),o.cursor=c.cursor}},e.prototype.layout=function(e){var t=e.getWidth(),n=e.getHeight(),r=[];N(this._labelList,function(e){e.defaultAttr.ignore||r.push(ES({},e))});var i=F(r,function(e){return e.layoutOption.moveOverlap===`shiftX`}),a=F(r,function(e){return e.layoutOption.moveOverlap===`shiftY`});OS(i,0,0,t),OS(a,1,0,n);var o=F(r,function(e){return e.layoutOption.hideOverlap});kS(o),AS(o)},e.prototype.processLabelsOverall=function(){var e=this;N(this._chartViewList,function(t){var n=t.__model,r=t.ignoreLabelLineUpdate,i=n.isAnimationEnabled();t.group.traverse(function(t){if(t.ignore&&!t.forceLabelAnimation)return!0;var a=!r,o=t.getTextContent();!a&&o&&(a=MH(o).needsUpdateLabelLine),a&&e._updateLabelLine(t,n),i&&e._animateLabels(t,n)})})},e.prototype._updateLabelLine=function(e,t){var n=e.getTextContent(),r=J(e),i=r.dataIndex;if(n&&i!=null){var a=t.getData(r.dataType),o=a.getItemModel(i),s={},c=a.getItemVisual(i,`style`);c&&(s.stroke=c[a.getVisual(`drawType`)]);var l=o.getModel(`labelLine`);MT(e,NT(o),s),TT(e,l)}},e.prototype._animateLabels=function(e,t){var n=e.getTextContent(),r=e.getTextGuideLine();if(n&&(e.forceLabelAnimation||!n.ignore&&!n.invisible&&!e.disableLabelAnimation&&!Wd(e))){var i=MH(n),a=i.oldLayout,o=J(e),s=o.dataIndex,c={x:n.x,y:n.y,rotation:n.rotation},l=t.getData(o.dataType);if(a){n.attr(a);var u=e.prevStates;u&&(j(u,`select`)>=0&&n.attr(i.oldLayoutSelect),j(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),Hd(n,c,t,s)}else if(n.attr(c),!ip(n).valueAnimation){var d=H(n.style.opacity,1);n.style.opacity=0,Ud(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};PH(f,c,FH),PH(f,n.states.select,FH)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};PH(p,c,FH),PH(p,n.states.emphasis,FH)}op(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=NH(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),Hd(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,Ud(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),LH=yc();function RH(e){e.registerUpdateLifecycle(`series:beforeupdate`,function(e,t,n){var r=LH(t).labelManager;r||=LH(t).labelManager=new IH,r.clearLabels()}),e.registerUpdateLifecycle(`series:layoutlabels`,function(e,t,n){var r=LH(t).labelManager;N(n.updatedSeries,function(e){r.addLabelsOfSeries(t.getViewOfSeriesModel(e))}),r.updateLayoutConfig(t),r.layout(t),r.processLabelsOverall()})}var zH=function(){function e(t,n){Py(this,e.decoratedMethods),this._outOfBrk=By(null,n);var r=this._linear=By(null,n);Fy(this,r),this.breaks=t&&t.breaks||[]}return e.prototype.hasBreaks=function(){return!!this.breaks.length},e.prototype.calcNiceTickMultiple=function(e,t){for(var n=0;n<this.breaks.length;n++){var r=this.breaks[n];if(r.vmin<e&&e<r.vmax)return t(e,r.vmax)}return 0},e.decoratedMethods={needTransform:function(){return!this.breaks.length},getExtent:function(){return this._outOfBrk.getExtent()},getExtentUnsafe:function(e,t){return t==null||t===2?this._outOfBrk.getExtentUnsafe(e,null):this._linear.getExtentUnsafe(e,null)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){Rc(t,n)&&(e===0&&UH(this,[t,n]),this._outOfBrk.setExtent2(e,t,n),this._linear.setExtent2(e,this.transformIn(t,null),this.transformIn(n,null)))},normalize:function(e){return this._linear.normalize(this.transformIn(e,null))},scale:function(e){return this.transformOut(this._linear.scale(e),null)},contain:function(e){return this._outOfBrk.contain(e)},transformIn:function(e,t){if(t&&t.depth===2)return e;for(var n=VH,r=HH,i=!0,a=0;a<this.breaks.length;a++){var o=this.breaks[a];if(e<=o.vmax){e>o.vmin?n+=o.vmin-r+(e-o.vmin)/(o.vmax-o.vmin)*o.gapReal:n+=e-r,r=o.vmax,i=!1;break}n+=o.vmin-r+o.gapReal,r=o.vmax}return i&&(n+=e-r),n},transformOut:function(e,t){if(t&&t.depth===2)return e;for(var n=VH,r=HH,i=!0,a=0,o=0;o<this.breaks.length;o++){var s=this.breaks[o],c=n+s.vmin-r,l=c+s.gapReal;if(e<=l){a=e>c?s.vmin+(e-c)/(l-c)*(s.vmax-s.vmin):r+e-n,r=s.vmax,i=!1;break}n=l,r=s.vmax}return i&&(a=r+e-n),a}},e}();function BH(e,t){return new zH(e,t)}var VH=0,HH=0;function UH(e,t){var n=0,r={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},i=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},a={S:{tpAbs:i(),tpPrct:i()},E:{tpAbs:i(),tpPrct:i()}};N(e.breaks,function(e){var i=e.gapParsed;i.type===`tpPrct`&&(n+=i.val);var o=KH(e,t);if(o){var s=o.vmin!==e.vmin,c=o.vmax!==e.vmax,l=o.vmax-o.vmin;if(!(s&&c))if(s||c){var u=s?`S`:`E`;a[u][i.type].has=!0,a[u][i.type].span=l,a[u][i.type].inExtFrac=l/(e.vmax-e.vmin),a[u][i.type].val=i.val}else r[i.type].span+=l,r[i.type].val+=i.val}});var o=n*(0+(t[1]-t[0])+(r.tpAbs.val-r.tpAbs.span)+(a.S.tpAbs.has?(a.S.tpAbs.val-a.S.tpAbs.span)*a.S.tpAbs.inExtFrac:0)+(a.E.tpAbs.has?(a.E.tpAbs.val-a.E.tpAbs.span)*a.E.tpAbs.inExtFrac:0)-r.tpPrct.span-(a.S.tpPrct.has?a.S.tpPrct.span*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.span*a.E.tpPrct.inExtFrac:0))/(1-r.tpPrct.val-(a.S.tpPrct.has?a.S.tpPrct.val*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.val*a.E.tpPrct.inExtFrac:0));N(e.breaks,function(e){var t=e.gapParsed;t.type===`tpPrct`&&(e.gapReal=n===0?0:ss(o,0)*t.val/n),t.type===`tpAbs`&&(e.gapReal=t.val),e.gapReal??=0})}function WH(e,t,n,r,i,a){e!==`no`&&N(n,function(n){var o=KH(n,a);if(o)for(var s=t.length-1;s>=0;s--){var c=t[s],l=r(c),u=i*3/4;l>o.vmin-u&&l<o.vmax+u&&(e!==`preserve_extent_bound`||l!==a[0]&&l!==a[1])&&t.splice(s,1)}})}function GH(e,t,n,r){N(t,function(t){var i=KH(t,n);i&&(e.push({value:i.vmin,break:{type:`vmin`,parsedBreak:i},time:r?r(i):void 0}),e.push({value:i.vmax,break:{type:`vmax`,parsedBreak:i},time:r?r(i):void 0}))}),t.length&&e.sort(function(e,t){return e.value-t.value})}function KH(e,t){var n=ss(e.vmin,t[0]),r=os(e.vmax,t[1]);return n<r||n===r&&n>t[0]&&n<t[1]?{vmin:n,vmax:r,breakOption:e.breakOption,gapParsed:e.gapParsed,gapReal:e.gapReal}:null}function qH(e,t,n){var r=[];if(!e)return{breaks:r};function i(e,t){return e>=0&&e<.99999}N(e,function(e){if(!(!e||e.start==null||e.end==null)&&!e.isExpanded){var a={breakOption:E(e),vmin:t.parse(e.start),vmax:t.parse(e.end),gapParsed:{type:`tpAbs`,val:0},gapReal:null};if(e.gap!=null){var o=!1;if(B(e.gap)){var s=ye(e.gap);if(s.match(/%$/)){var c=parseFloat(s)/100;i(c,`Percent gap`)||(c=0),a.gapParsed.type=`tpPrct`,a.gapParsed.val=c,o=!0}}if(!o){var l=t.parse(e.gap);(!isFinite(l)||l<0)&&(l=0),a.gapParsed.type=`tpAbs`,a.gapParsed.val=l}}if(a.vmin===a.vmax&&(a.gapParsed.type=`tpAbs`,a.gapParsed.val=0),n&&n.noNegative&&N([`vmin`,`vmax`],function(e){a[e]<0&&(a[e]=0)}),a.vmin>a.vmax){var u=a.vmax;a.vmax=a.vmin,a.vmin=u}r.push(a)}}),r.sort(function(e,t){return e.vmin-t.vmin});var a=-1/0;return N(r,function(e,t){a>e.vmin&&(r[t]=null),a=e.vmax}),{breaks:F(r,function(e){return!!e})}}function JH(e,t){return YH(t)===YH(e)}function YH(e){return e.start+`_\0_`+e.end}function XH(e,t,n){var r=[];N(e,function(e,n){var i=t(e);i&&i.type===`vmin`&&r.push([n])}),N(e,function(n,i){var a=t(n);if(a&&a.type===`vmax`){var o=re(r,function(n){return JH(t(e[n[0]]).parsedBreak.breakOption,a.parsedBreak.breakOption)});o&&o.push(i)}});var i=[];return N(r,function(t){t.length===2&&i.push(n?t:[e[t[0]],e[t[1]]])}),i}function ZH(e,t,n,r){if(t.break){var i=t.break.parsedBreak,a=re(n,function(e){return JH(e.breakOption,t.break.parsedBreak.breakOption)}),o={lookup:r,depth:2},s={vmin:e.transformOut(i.vmin,o),vmax:e.transformOut(i.vmax,o),breakOption:i.breakOption,gapParsed:E(a.gapParsed),gapReal:i.gapReal};return{tickVal:s[t.break.type],vBreak:{type:t.break.type,parsedBreak:s}}}}function QH(e,t,n,r,i){i.original=qH(e,t,n);var a=i.transformed=qH(e,t,n),o=i.lookup;a.breaks=P(a.breaks,function(e,n){var i={depth:2},a=t.transformIn(e.vmin,i),s=t.transformIn(e.vmax,i),c={type:e.gapParsed.type,val:e.gapParsed.type===`tpAbs`?t.transformIn(e.vmin+e.gapParsed.val,i)-a:e.gapParsed.val};return o.from[r+n]=a,o.to[r+n]=e.vmin,o.from[r+n+1]=s,o.to[r+n+1]=e.vmax,{vmin:a,vmax:s,gapParsed:c,gapReal:e.gapReal,breakOption:e.breakOption}})}var $H={vmin:`start`,vmax:`end`};function eU(e,t){return t&&(e||={},e.break={type:$H[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function tU(){eg({createBreakScaleMapper:BH,pruneTicksByBreak:WH,addBreaksToTicks:GH,parseAxisBreakOption:qH,identifyAxisBreak:JH,serializeAxisBreakIdentifier:YH,retrieveAxisBreakPairs:XH,getTicksBreakOutwardTransform:ZH,parseAxisBreakOptionInwardTransform:QH,makeAxisLabelFormatterParamBreak:eU})}var nU=yc();function rU(e,t){var n=re(e,function(e){return tg().identifyAxisBreak(e.parsedBreak.breakOption,t.breakOption)});return n||e.push(n={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),n}function iU(e){N(e,function(e){return e.shouldRemove=!0})}function aU(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function oU(e,t,n,r,i){var a=n.axis;if(a.scale.isBlank()||!tg())return;var o=tg().retrieveAxisBreakPairs(a.scale.getTicks({breakTicks:`only_break`}),function(e){return e.break},!1);if(!o.length)return;var s=n.getModel(`breakArea`),c=s.get(`zigzagAmplitude`),l=s.get(`zigzagMinSpan`),u=s.get(`zigzagMaxSpan`);l=Math.max(2,l||0),u=Math.max(l,u||0);var d=s.get(`expandOnClick`),f=s.get(`zigzagZ`),p=s.getModel(`itemStyle`).getItemStyle(),m=p.stroke,h=p.lineWidth,g=p.lineDash,_=p.fill,v=new zu({ignoreModelZ:!0}),y=a.isHorizontal(),b=nU(t).visualList||(nU(t).visualList=[]);iU(b);for(var x=function(e){var t=o[e][0].break.parsedBreak,r=[];r[0]=a.toGlobalCoord(a.dataToCoord(t.vmin,!0)),r[1]=a.toGlobalCoord(a.dataToCoord(t.vmax,!0)),r[1]<r[0]&&r.reverse();var s=rU(b,t);s.shouldRemove=!1;var c=new zu;C(s.zigzagRandomList,c,r[0],r[1],y,t),d&&c.on(`click`,function(){var e={type:FS,breaks:[{start:t.breakOption.start,end:t.breakOption.end}]};e[a.dim+`AxisIndex`]=n.componentIndex,i.dispatchAction(e)}),c.silent=!d,v.add(c)},S=0;S<o.length;S++)x(S);e.add(v),aU(b);function C(e,t,n,i,a,o){var s={stroke:m,lineWidth:h,lineDash:g,fill:`none`},d=+!a,v=1-d,y=r[Zd[v]]+r[Qd[v]];function b(e){var t=[],n=[];t[d]=n[d]=e,t[v]=r[Zd[v]],n[v]=y;var i={x1:t[0],y1:t[1],x2:n[0],y2:n[1]};return No(i,i,{lineWidth:1}),t[0]=i.x1,t[1]=i.y1,t[d]}n=b(n),i=b(i);for(var x=[],S=[],C=!0,w=r[Zd[v]],T=0;;T++){var E=w===r[Zd[v]],D=w>=y;D&&(w=y);var O=[],k=[];O[d]=n,k[d]=i,!E&&!D&&(O[d]+=C?-c:c,k[d]-=C?c:-c),O[v]=w,k[v]=w,x.push(O),S.push(k);var A=void 0;if(T<e.length?A=e[T]:(A=Math.random(),e.push(A)),w+=A*(u-l)+l,C=!C,D)break}var j=tg().serializeAxisBreakIdentifier(o.breakOption);if(t.add(new md({anid:`break_a_`+j,shape:{points:x},style:s,z:f})),o.gapReal!==0){t.add(new md({anid:`break_b_`+j,shape:{points:S},style:s,z:f}));var ee=S.slice();ee.reverse();var te=x.concat(ee);t.add(new fd({anid:`break_c_`+j,shape:{points:te},style:{fill:_,opacity:p.opacity},z:f}))}}}function sU(e,t,n,r){var i=e.axis,a=n.transform;ve(r.style);var o=i.getExtent();i.inverse&&(o=o.slice(),o.reverse());var s=P(tg().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:`only_break`}),function(e){return e.break},!1),function(e){var t=e[0].break.parsedBreak,n=[i.dataToCoord(t.vmin,!0),i.dataToCoord(t.vmax,!0)];return n[0]>n[1]&&n.reverse(),{coordPair:n,brkId:tg().serializeAxisBreakIdentifier(t.breakOption)}});s.sort(function(e,t){return e.coordPair[0]-t.coordPair[0]});for(var c=o[0],l=null,u=0;u<s.length;u++){var d=s[u],f=Math.max(d.coordPair[0],o[0]),p=Math.min(d.coordPair[1],o[1]);c<=f&&m(c,f,l,d),c=p,l=d}c<=o[1]&&m(c,o[1],l,null);function m(e,n,i,o){function s(e,t){a&&(kt(e,e,a),kt(t,t,a))}function c(e,t){var n={x1:e[0],y1:e[1],x2:t[0],y2:t[1]};No(n,n,r.style),e[0]=n.x1,e[1]=n.y1,t[0]=n.x2,t[1]=n.y2}var l=[e,0],u=[n,0],d=[e,5],f=[n,5];s(l,d),c(l,d),s(u,f),c(u,f),c(l,u);var p=new _d(O({shape:{x1:l[0],y1:l[1],x2:u[0],y2:u[1]}},r));t.add(p),p.anid=`breakLine_`+(i?i.brkId:`\0`)+`_\0_`+(o?o.brkId:`\0`)}}function cU(e,t,n){if(re(n,function(e){return!e}))return;var r=new G;if(!jS(n[0],n[1],r,{direction:-(e?t+Math.PI:t),touchThreshold:0,bidirectional:!1}))return;var i=ot();dt(i,i,-t);var a=P(n,function(e){return e.transform?lt(ot(),i,e.transform):i});function o(e){var t=n[0].localRect,r=new G(t[Qd[e]]*a[0][0],t[Qd[e]]*a[0][1]);return Math.abs(r.y)<1e-5}var s=.5;if(o(0)||o(1)){var c=P(n,function(e,t){var n=e.localRect.clone();return n.applyTransform(a[t]),n}),l=new G;l.copy(n[0].label).add(n[1].label).scale(.5),l.transform(i);var u=r.clone().transform(i),d=(c[0].x+c[1].x+(u.x>=0?c[0].width:c[1].width)+u.x)/2-l.x,f=Math.min(d,d-u.x),p=Math.max(d,d-u.x);s=(d-(p<0?p:f>0?f:0))/u.x}var m=new G,h=new G;G.scale(m,r,-s),G.scale(h,r,1-s),TS(n[0],m),TS(n[1],h)}function lU(e,t){var n={breaks:[]};return N(t.breaks,function(r){if(r){var i=re(e.get(`breaks`,!0),function(e){return tg().identifyAxisBreak(e,r)});if(i){var a=t.type,o={isExpanded:!!i.isExpanded};i.isExpanded=a===`expandAxisBreak`?!0:a===`collapseAxisBreak`?!1:a===`toggleAxisBreak`?!i.isExpanded:i.isExpanded,n.breaks.push({start:i.start,end:i.end,isExpanded:!!i.isExpanded,old:o})}}}),n}function uU(){NS({adjustBreakLabelPair:cU,buildAxisBreakLine:sU,rectCoordBuildBreakAxis:oU,updateModelAxisBreak:lU})}function dU(e){US(e),tU(),uU()}var fU=Math.sin,pU=Math.cos,mU=Math.PI,hU=Math.PI*2,gU=180/mU,_U=function(){function e(){}return e.prototype.reset=function(e){this._start=!0,this._d=[],this._str=``,this._p=10**(e||4)},e.prototype.moveTo=function(e,t){this._add(`M`,e,t)},e.prototype.lineTo=function(e,t){this._add(`L`,e,t)},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){this._add(`C`,e,t,n,r,i,a)},e.prototype.quadraticCurveTo=function(e,t,n,r){this._add(`Q`,e,t,n,r)},e.prototype.arc=function(e,t,n,r,i,a){this.ellipse(e,t,n,n,0,r,i,a)},e.prototype.ellipse=function(e,t,n,r,i,a,o,s){var c=o-a,l=!s,u=Math.abs(c),d=ei(u-hU)||(l?c>=hU:-c>=hU),f=c>0?c%hU:c%hU+hU,p=!1;p=d?!0:!ei(u)&&f>=mU==!!l;var m=e+n*pU(a),h=t+r*fU(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*gU);if(d){var _=1/this._p,v=(l?1:-1)*(hU-_);this._add(`A`,n,r,g,1,+l,e+n*pU(a+v),t+r*fU(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*pU(o),b=t+r*fU(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d<arguments.length;d++){var f=arguments[d];if(isNaN(f)){this._invalid=!0;return}l.push(Math.round(f*u)/u)}this._d.push(e+l.join(` `)),this._start=e===`Z`},e.prototype.generateStr=function(){this._str=this._invalid?``:this._d.join(``),this._d=[]},e.prototype.getStr=function(){return this._str},e}(),vU=`none`,yU=Math.round;function bU(e){var t=e.fill;return t!=null&&t!==vU}function xU(e){var t=e.stroke;return t!=null&&t!==vU}var SU=[`lineCap`,`miterLimit`,`lineJoin`],CU=P(SU,function(e){return`stroke-`+e.toLowerCase()});function wU(e,t,n,r){var i=t.opacity==null?1:t.opacity;if(n instanceof Ao){e(`opacity`,i);return}if(bU(t)){var a=Qr(t.fill);e(`fill`,a.color);var o=t.fillOpacity==null?a.opacity*i:t.fillOpacity*a.opacity*i;(r||o<1)&&e(`fill-opacity`,o)}else e(`fill`,vU);if(xU(t)){var s=Qr(t.stroke);e(`stroke`,s.color);var c=t.strokeNoScale?n.getLineScale():1,l=c?(t.lineWidth||0)/c:0,u=t.strokeOpacity==null?s.opacity*i:t.strokeOpacity*s.opacity*i,d=t.strokeFirst;if((r||l!==1)&&e(`stroke-width`,l),(r||d)&&e(`paint-order`,d?`stroke`:`fill`),(r||u<1)&&e(`stroke-opacity`,u),t.lineDash){var f=yk(n),p=f[0],m=f[1];p&&(m=yU(m||0),e(`stroke-dasharray`,p.join(`,`)),(m||r)&&e(`stroke-dashoffset`,m))}else r&&e(`stroke-dasharray`,vU);for(var h=0;h<SU.length;h++){var g=SU[h];if(r||t[g]!==xo[g]){var _=t[g]||xo[g];_&&e(CU[h],_)}}}else r&&e(`stroke`,vU)}var TU=`http://www.w3.org/2000/svg`,EU=`http://www.w3.org/1999/xlink`,DU=`http://www.w3.org/2000/xmlns/`,OU=`http://www.w3.org/XML/1998/namespace`,kU=`ecmeta_`;function AU(e){return document.createElementNS(TU,e)}function jU(e,t,n,r,i){return{tag:e,attrs:n||{},children:r,text:i,key:t}}function MU(e,t){var n=[];if(t)for(var r in t){var i=t[r],a=r;i!==!1&&(i!==!0&&i!=null&&(a+=`="`+i+`"`),n.push(a))}return`<`+e+` `+n.join(` `)+`>`}function NU(e){return`</`+e+`>`}function PU(e,t){t||={};var n=t.newline?`
19
19
  `:``;function r(e){var t=e.children,i=e.tag,a=e.attrs,o=e.text;return MU(i,a)+(i===`style`?o||``:Bh(o))+(t?``+n+P(t,function(e){return r(e)}).join(n)+n:``)+NU(i)}return r(e)}function FU(e,t,n){n||={};var r=n.newline?`
20
20
  `:``,i=` {`+r,a=r+`}`,o=P(I(e),function(t){return t+i+P(I(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=P(I(t),function(e){return`@keyframes `+e+i+P(I(t[e]),function(n){return n+i+P(I(t[e][n]),function(r){var i=t[e][n][r];return r===`d`&&(i=`path("`+i+`")`),r+`:`+i+`;`}).join(r)+a}).join(r)+a}).join(r);return!o&&!s?``:[`<![CDATA[`,o,s,`]]>`].join(r)}function IU(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function LU(e,t,n,r){return jU(`svg`,`root`,{width:e,height:t,xmlns:TU,"xmlns:xlink":EU,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var RU=0;function zU(){return RU++}var BU={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},VU=`transform-origin`;function HU(e,t,n){var r=O({},e.shape);O(r,t),e.buildPath(n,r);var i=new _U;return i.reset(hi(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function UU(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[VU]=n+`px `+r+`px`)}var WU={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function GU(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function KU(e,t,n){var r=e.shape.paths,i={},a,o;if(N(r,function(e){var t=IU(n.zrId);t.animation=!0,JU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=I(r),l=c.length;if(l){o=c[l-1];var u=r[o];for(var d in u){var f=u[d];i[d]=i[d]||{d:``},i[d].d+=f.d||``}for(var p in s){var m=s[p].animation;m.indexOf(o)>=0&&(a=m)}}}),a){t.d=!1;var s=GU(i,n);return a.replace(o,s)}}function qU(e){return B(e)?BU[e]?`cubic-bezier(`+BU[e]+`)`:wr(e)?e:``:``}function JU(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof wd){var s=KU(e,t,n);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var c={},l=0;l<a;l++){var u=i[l],d=[u.getMaxTime()/1e3+`s`],f=qU(u.getClip().easing),p=u.getDelay();f?d.push(f):d.push(`linear`),p&&d.push(p/1e3+`s`),u.getLoop()&&d.push(`infinite`);var m=d.join(` `);c[m]=c[m]||[m,[]],c[m][1].push(u)}function h(i){var a=i[1],o=a.length,s={},c={},l={},u=`animation-timing-function`;function d(e,t,n){for(var r=e.getTracks(),i=e.getMaxTime(),a=0;a<r.length;a++){var o=r[a];if(o.needsAnimate()){var s=o.keyframes,c=o.propName;if(n&&(c=n(c)),c)for(var l=0;l<s.length;l++){var d=s[l],f=Math.round(d.time/i*100)+`%`,p=qU(d.easing),m=d.rawValue;(B(m)||se(m))&&(t[f]=t[f]||{},t[f][c]=d.rawValue,p&&(t[f][u]=p))}}}}for(var f=0;f<o;f++){var p=a[f],m=p.targetName;m?m===`shape`&&d(p,c):!r&&d(p,s)}for(var h in s){var g={};Xn(g,e),O(g,s[h]);var _=gi(g),v=s[h][u];l[h]=_?{transform:_}:{},UU(l[h],g),v&&(l[h][u]=v)}var y,b=!0;for(var h in c){l[h]=l[h]||{};var x=!y,v=c[h][u];x&&(y=new Qa);var S=y.len();y.reset(),l[h].d=HU(e,c[h],y);var C=y.len();if(!x&&S!==C){b=!1;break}v&&(l[h][u]=v)}if(!b)for(var h in l)delete l[h].d;if(!r)for(var f=0;f<o;f++){var p=a[f],m=p.targetName;m===`style`&&d(p,l,function(e){return WU[e]})}for(var w=I(l),T=!0,E,f=1;f<w.length;f++){var D=w[f-1],k=w[f];if(l[D][VU]!==l[k][VU]){T=!1;break}E=l[D][VU]}if(T&&E){for(var h in l)l[h][VU]&&delete l[h][VU];t[VU]=E}if(F(w,function(e){return I(l[e]).length>0}).length)return GU(l,n)+` `+i[0]+` both`}for(var g in c){var s=h(c[g]);s&&o.push(s)}if(o.length){var _=n.zrId+`-cls-`+zU();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function YU(e,t,n){if(!e.ignore)if(e.isSilent()){var r={"pointer-events":`none`};XU(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=Xr(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),XU(r,t,n,!0)}}function XU(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+zU(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var ZU=Math.round;function QU(e){return e&&B(e.src)}function $U(e){return e&&z(e.toDataURL)}function eW(e,t,n,r){wU(function(i,a){var o=i===`fill`||i===`stroke`;o&&pi(a)?hW(t,e,i,r):o&&ui(a)?gW(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),mW(n,e,r)}function tW(e,t){var n=_D(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[kU+`silent`]=`true`))}function nW(e){return ei(e[0]-1)&&ei(e[1])&&ei(e[2])&&ei(e[3]-1)}function rW(e){return ei(e[4])&&ei(e[5])}function iW(e,t,n){if(t&&!(rW(t)&&nW(t))){var r=n?10:1e4;e.transform=nW(t)?`translate(`+ZU(t[4]*r)/r+` `+ZU(t[5]*r)/r+`)`:ri(t)}}function aW(e,t,n){for(var r=e.points,i=[],a=0;a<r.length;a++)i.push(ZU(r[a][0]*n)/n),i.push(ZU(r[a][1]*n)/n);t.points=i.join(` `)}function oW(e){return!e.smooth}function sW(e){var t=P(e,function(e){return typeof e==`string`?[e,e]:e});return function(e,n,r){for(var i=0;i<t.length;i++){var a=t[i],o=e[a[0]];o!=null&&(n[a[1]]=ZU(o*r)/r)}}}var cW={circle:[sW([`cx`,`cy`,`r`])],polyline:[aW,oW],polygon:[aW,oW]};function lW(e){for(var t=e.animators,n=0;n<t.length;n++)if(t[n].targetName===`shape`)return!0;return!1}function uW(e,t){var n=e.style,r=e.shape,i=cW[e.type],a={},o=t.animation,s=`path`,c=e.style.strokePercent,l=t.compress&&hi(e)||4;if(i&&!t.willUpdate&&!(i[1]&&!i[1](r))&&!(o&&lW(e))&&!(c<1)){s=e.type;var u=10**l;i[0](r,a,u)}else{var d=!e.path||e.shapeChanged();e.path||e.createPathProxy();var f=e.path;d&&(f.beginPath(),e.buildPath(f,e.shape),e.pathUpdated());var p=f.getVersion(),m=e,h=m.__svgPathBuilder;(m.__svgPathVersion!==p||!h||c!==m.__svgPathStrokePercent)&&(h||=m.__svgPathBuilder=new _U,h.reset(l),f.rebuildPath(h,c),h.generateStr(),m.__svgPathVersion=p,m.__svgPathStrokePercent=c),a.d=h.getStr()}return iW(a,e.transform),eW(a,n,e,t),tW(a,e),t.animation&&JU(e,a,t),t.emphasis&&YU(e,a,t),jU(s,e.id+``,a)}function dW(e,t){var n=e.style,r=n.image;if(r&&!B(r)&&(QU(r)?r=r.src:$U(r)&&(r=r.toDataURL())),r){var i=n.x||0,a=n.y||0,o=n.width,s=n.height,c={href:r,width:o,height:s};return i&&(c.x=i),a&&(c.y=a),iW(c,e.transform),eW(c,n,e,t),tW(c,e),t.animation&&JU(e,c,t),jU(`image`,e.id+``,c)}}function fW(e,t){var n=e.style,r=n.text;if(r!=null&&(r+=``),!(!r||isNaN(n.x)||isNaN(n.y))){var i=n.font||`12px sans-serif`,a=n.x||0,o=ai(n.y||0,mn(i),n.textBaseline),s={"dominant-baseline":`central`,"text-anchor":ii[n.textAlign]||n.textAlign};if(Yo(n)){var c=``,l=n.fontStyle,u=qo(n.fontSize);if(!parseFloat(u))return;var d=n.fontFamily||`sans-serif`,f=n.fontWeight;c+=`font-size:`+u+`;font-family:`+d+`;`,l&&l!==`normal`&&(c+=`font-style:`+l+`;`),f&&f!==`normal`&&(c+=`font-weight:`+f+`;`),s.style=c}else s.style=`font: `+i;return r.match(/\s/)&&(s[`xml:space`]=`preserve`),a&&(s.x=a),o&&(s.y=o),iW(s,e.transform),eW(s,n,e,t),tW(s,e),t.animation&&JU(e,s,t),jU(`text`,e.id+``,s,void 0,r)}}function pW(e,t){if(e instanceof wo)return uW(e,t);if(e instanceof Ao)return dW(e,t);if(e instanceof Eo)return fW(e,t)}function mW(e,t,n){var r=e.style;if(oi(r)){var i=si(e),a=n.shadowCache,o=a[i];if(!o){var s=e.getGlobalScale(),c=s[0],l=s[1];if(!c||!l)return;var u=r.shadowOffsetX||0,d=r.shadowOffsetY||0,f=r.shadowBlur,p=Qr(r.shadowColor),m=p.opacity,h=p.color,g=f/2/c,_=f/2/l,v=g+` `+_;o=n.zrId+`-s`+n.shadowIdx++,n.defs[o]=jU(`filter`,o,{id:o,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`},[jU(`feDropShadow`,``,{dx:u/c,dy:d/l,stdDeviation:v,"flood-color":h,"flood-opacity":m})]),a[i]=o}t.filter=mi(o)}}function hW(e,t,n,r){var i=e[n],a,o={gradientUnits:i.global?`userSpaceOnUse`:`objectBoundingBox`};if(di(i))a=`linearGradient`,o.x1=i.x,o.y1=i.y,o.x2=i.x2,o.y2=i.y2;else if(fi(i))a=`radialGradient`,o.cx=H(i.x,.5),o.cy=H(i.y,.5),o.r=H(i.r,.5);else return;for(var s=i.colorStops,c=[],l=0,u=s.length;l<u;++l){var d=ni(s[l].offset)*100+`%`,f=s[l].color,p=Qr(f),m=p.color,h=p.opacity,g={offset:d};g[`stop-color`]=m,h<1&&(g[`stop-opacity`]=h),c.push(jU(`stop`,l+``,g))}var _=PU(jU(a,``,o,c)),v=r.gradientCache,y=v[_];y||(y=r.zrId+`-g`+r.gradientIdx++,v[_]=y,o.id=y,r.defs[y]=jU(a,y,o,c)),t[n]=mi(y)}function gW(e,t,n,r){var i=e.style[n],a=e.getBoundingRect(),o={},s=i.repeat,c=s===`no-repeat`,l=s===`repeat-x`,u=s===`repeat-y`,d;if(ci(i)){var f=i.imageWidth,p=i.imageHeight,m=void 0,h=i.image;if(B(h)?m=h:QU(h)?m=h.src:$U(h)&&(m=h.toDataURL()),typeof Image>`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;ve(f,g),ve(p,g)}else if(f==null||p==null){var _=function(e,t){if(e){var n=e.elm,r=f||t.width,i=p||t.height;e.tag===`pattern`&&(l?(i=1,r/=a.width):u&&(r=1,i/=a.height)),e.attrs.width=r,e.attrs.height=i,n&&(n.setAttribute(`width`,r),n.setAttribute(`height`,i))}},v=rt(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=jU(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=E(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=gi(i);x&&(o.patternTransform=x);var S=jU(`pattern`,``,o,[d]),C=PU(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=jU(`pattern`,T,o,[d])),t[n]=mi(T)}}function _W(e,t,n){var r=n.clipPathCache,i=n.defs,a=r[e.id];if(!a){a=n.zrId+`-c`+n.clipPathIdx++;var o={id:a};r[e.id]=a,i[a]=jU(`clipPath`,a,o,[uW(e,n)])}t[`clip-path`]=mi(a)}function vW(e){return document.createTextNode(e)}function yW(e,t,n){e.insertBefore(t,n)}function bW(e,t){e.removeChild(t)}function xW(e,t){e.appendChild(t)}function SW(e){return e.parentNode}function CW(e){return e.nextSibling}function wW(e,t){e.textContent=t}var TW=58,EW=120,DW=jU(``,``);function OW(e){return e===void 0}function kW(e){return e!==void 0}function AW(e,t,n){for(var r={},i=t;i<=n;++i){var a=e[i].key;a!==void 0&&(r[a]=i)}return r}function jW(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function MW(e){var t,n=e.children,r=e.tag;if(kW(r)){var i=e.elm=AU(r);if(FW(DW,e),R(n))for(t=0;t<n.length;++t){var a=n[t];a!=null&&xW(i,MW(a))}else kW(e.text)&&!V(e.text)&&xW(i,vW(e.text))}else e.elm=vW(e.text);return e.elm}function NW(e,t,n,r,i){for(;r<=i;++r){var a=n[r];a!=null&&yW(e,MW(a),t)}}function PW(e,t,n,r){for(;n<=r;++n){var i=t[n];i!=null&&(kW(i.tag)?bW(SW(i.elm),i.elm):bW(e,i.elm))}}function FW(e,t){var n,r=t.elm,i=e&&e.attrs||{},a=t.attrs||{};if(i!==a){for(n in a){var o=a[n];i[n]!==o&&(o===!0?r.setAttribute(n,``):o===!1?r.removeAttribute(n):n===`style`?r.style.cssText=o:n.charCodeAt(0)===EW?n===`xmlns:xlink`||n===`xmlns`?r.setAttributeNS(DU,n,o):n.charCodeAt(3)===TW?r.setAttributeNS(OU,n,o):n.charCodeAt(5)===TW?r.setAttributeNS(EU,n,o):r.setAttribute(n,o):r.setAttribute(n,o))}for(n in i)n in a||r.removeAttribute(n)}}function IW(e,t,n){for(var r=0,i=0,a=t.length-1,o=t[0],s=t[a],c=n.length-1,l=n[0],u=n[c],d,f,p,m;r<=a&&i<=c;)o==null?o=t[++r]:s==null?s=t[--a]:l==null?l=n[++i]:u==null?u=n[--c]:jW(o,l)?(LW(o,l),o=t[++r],l=n[++i]):jW(s,u)?(LW(s,u),s=t[--a],u=n[--c]):jW(o,u)?(LW(o,u),yW(e,o.elm,CW(s.elm)),o=t[++r],u=n[--c]):jW(s,l)?(LW(s,l),yW(e,s.elm,o.elm),s=t[--a],l=n[++i]):(OW(d)&&(d=AW(t,r,a)),f=d[l.key],OW(f)?yW(e,MW(l),o.elm):(p=t[f],p.tag===l.tag?(LW(p,l),t[f]=void 0,yW(e,p.elm,o.elm)):yW(e,MW(l),o.elm)),l=n[++i]);(r<=a||i<=c)&&(r>a?(m=n[c+1]==null?null:n[c+1].elm,NW(e,m,n,i,c)):PW(e,t,r,a))}function LW(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(FW(e,t),OW(t.text)?kW(r)&&kW(i)?r!==i&&IW(n,r,i):kW(i)?(kW(e.text)&&wW(n,``),NW(n,null,i,0,i.length-1)):kW(r)?PW(n,r,0,r.length-1):kW(e.text)&&wW(n,``):e.text!==t.text&&(kW(r)&&PW(n,r,0,r.length-1),wW(n,t.text)))}function RW(e,t){if(jW(e,t))LW(e,t);else{var n=e.elm,r=SW(n);MW(t),r!==null&&(yW(r,t.elm,CW(n)),PW(r,[e],0,0))}return t}var zW=0,BW=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=VW(`configLayer`),this.storage=t,this._opts=n=O({},n),this.root=e,this._id=`zr`+zW++,this._oldVNode=LU(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=AU(`svg`);FW(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,RW(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return pW(e,IU(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=IU(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=HW(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=jU(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=P(I(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(jU(`defs`,`defs`,{},c)),e.animation){var l=FU(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=jU(`style`,`stl`,{},[],l);a.push(u)}}return LU(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},PU(this.renderToVNode({animation:H(e.cssAnimation,!0),emphasis:H(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:H(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l<r;l++){var u=e[l];if(!u.invisible){var d=u.__clipPaths,f=d&&d.length||0,p=s&&s.length||0,m=void 0;for(m=Math.max(f-1,p-1);m>=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g<f;g++){var _={};_W(d[g],_,t);var v=jU(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=pW(u,t);y&&(o?o.children:n).push(y)}}},e.prototype.resize=function(e,t){var n=this._opts,r=this.root,i=this._viewport;if(e!=null&&(n.width=e),t!=null&&(n.height=t),r&&i&&(i.style.display=`none`,e=_k(r,0,n),t=_k(r,1,n),i.style.display=``),this._width!==e||this._height!==t){if(this._width=e,this._height=t,i){var a=i.style;a.width=e+`px`,a.height=t+`px`}if(ui(this._backgroundColor))this.refresh();else{var o=this._svgDom;o&&(o.setAttribute(`width`,e),o.setAttribute(`height`,t));var s=this._bgVNode&&this._bgVNode.elm;s&&(s.setAttribute(`width`,e),s.setAttribute(`height`,t))}}},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e.prototype.dispose=function(){this.root&&(this.root.innerHTML=``),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},e.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},e.prototype.toDataURL=function(e){var t=this.renderToString(),n=`data:image/svg+xml;`;return e?(t=_i(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}();function VW(e){return function(){}}function HW(e,t,n,r){var i;if(n&&n!==`none`)if(i=jU(`rect`,`bg`,{width:e,height:t,x:`0`,y:`0`}),pi(n))hW({fill:n},i.attrs,`fill`,r);else if(ui(n))gW({style:{fill:n},dirty:Ae,getBoundingRect:function(){return{width:e,height:t}}},i.attrs,`fill`,r);else{var a=Qr(n),o=a.color,s=a.opacity;i.attrs.fill=o,s<1&&(i.attrs[`fill-opacity`]=s)}return i}function UW(e){e.registerPainter(`svg`,BW)}function WW(e,t,n){var r=u.createCanvas(),i=t.getWidth(),a=t.getHeight(),o=r.style;return o&&(o.position=`absolute`,o.left=`0`,o.top=`0`,o.width=i+`px`,o.height=a+`px`,r.setAttribute(`data-zr-dom-id`,e)),r.width=i*n,r.height=a*n,r}function GW(e){return!e.__cursors.get(0)}function KW(e){var t=e.__cursors.get(0);return{startIdx:t?t.startIdx:0,endIdx:t?t.endIdx:0}}var qW=function(e){r(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.zlevel=0,i.zlevel2=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__prevIdx={startIdx:0,endIdx:0};var a;r||=Ui,typeof t==`string`?a=WW(t,n,r):V(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(ke(a),a.onselectstart=function(){return!1},o.padding=`0`,o.margin=`0`,o.borderWidth=`0`),i.painter=n,i.dpr=r,i}return t.prototype.afterBrush=function(){this.__prevIdx=KW(this)},t.prototype.initContext=function(){this.ctx=this.dom.getContext(`2d`),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=WW(`back-`+this.id,this.painter,e),this.ctxBack=this.domBack.getContext(`2d`),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,t,n,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var i=[],a=this.maxRepaintRectCount,o=!1,s=new K(0,0,0,0);function c(e){if(!(!e.isFinite()||e.isZero()))if(i.length===0){var t=new K(0,0,0,0);t.copy(e),i.push(t)}else{for(var n=!1,r=1/0,c=0,l=0;l<i.length;++l){var u=i[l];if(u.intersect(e)){var d=new K(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}else if(o){s.copy(e),s.union(u);var f=e.width*e.height,p=u.width*u.height,m=s.width*s.height-f-p;m<r&&(r=m,c=l)}}if(o&&(i[c].union(e),n=!0),!n){var t=new K(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}for(var l=KW(this),u=l.startIdx;u<l.endIdx;++u){var d=e[u];if(d){var f=d.shouldBePainted(n,r,!0,!0),p=d.__isRendered&&(d.__dirty&1||!f)?d.getPrevPaintRect():null;p&&c(p);var m=f&&(d.__dirty&1||!d.__isRendered)?d.getPaintRect():null;m&&c(m)}}for(var h=this.__prevIdx,u=h.startIdx;u<h.endIdx;++u){var d=t[u],f=d&&d.shouldBePainted(n,r,!0,!0);if(d&&(!f||!d.__zr)&&d.__isRendered){var p=d.getPrevPaintRect();p&&c(p)}}var g;do{g=!1;for(var u=0;u<i.length;){if(i[u].isZero()){i.splice(u,1);continue}for(var _=u+1;_<i.length;)i[u].intersect(i[_])?(g=!0,i[u].union(i[_]),i.splice(_,1)):_++;u++}}while(g);return this._paintRects=i,i},t.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},t.prototype.resize=function(e,t){var n=this.dpr,r=this.dom,i=r.style,a=this.domBack;i&&(i.width=e+`px`,i.height=t+`px`),r.width=e*n,r.height=t*n,a&&(a.width=e*n,a.height=t*n,n!==1&&this.ctxBack.scale(n,n))},t.prototype.clear=function(e,t,n){var r=this.dom,i=this.ctx,a=r.width,o=r.height;t||=this.clearColor;var s=this.motionBlur&&!e,c=this.lastFrameAlpha,l=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation=`copy`,this.ctxBack.drawImage(r,0,0,a/l,o/l));var d=this.domBack;function f(e,n,r,a){if(i.clearRect(e,n,r,a),t&&t!==`transparent`){var o=void 0;de(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||mk(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):fe(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=Ek(i,t,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),i.save(),i.fillStyle=o||t,i.fillRect(e,n,r,a),i.restore()}s&&(i.save(),i.globalAlpha=c,i.drawImage(d,e,n,r,a),i.restore())}!n||s?f(0,0,a,o):n.length&&N(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(Vi),JW=1e5,YW=314159,XW=void 0,ZW=1,QW=2;function $W(e){return e?e.__builtin__?!0:!(typeof e.resize!=`function`||typeof e.refresh!=`function`):!1}function eG(e,t){var n=document.createElement(`div`);return n.style.cssText=[`position:relative`,`width:`+e+`px`,`height:`+t+`px`,`padding:0`,`margin:0`,`border-width:0`].join(`;`)+`;`,n}function tG(e,t,n,r){var i=new qW(e,t,t.dpr);return i.zlevel=n,i.zlevel2=r,i.__builtin__=!0,nG(i),i}function nG(e){e.__cursorStack=[],e.__cursors=U()}function rG(e){return e.startIdx=e.drawIdx=e.endIdx=e.endIdxNew=0,e.used=!1,e.first=e.last=NaN,e.notClearIdx=-1,e}function iG(e,t){var n=e.__cursors,r=+t;return n.get(r)||(e.__cursorStack.push(r),n.set(r,rG({key:r})))}function aG(e,t){for(var n=e.__cursorStack,r=0;r<n.length;r++)t(e.__cursors.get(n[r]))}function oG(e,t){var n=e.layers;return n[t]||(n[t]=[,,,])}function sG(e,t,n){for(var r=e.layerStack,i=0;i<r.length;i++){var a=r[i].zl,o=r[i].zl2,s=e.layers[a][o];(!n||(!(n&cG)||s.__builtin__)&&(!(n&lG)||!s.__builtin__)&&(!(n&uG)||s!==e.hoverlayer))&&t(s,a,o,i)}}var cG=1,lG=2,uG=4,dG=cG|uG,fG=function(){function e(e,t,n,r){this.type=`canvas`,this._prevDisplayList=[],this._layerConfig={},this._needsManuallyCompositing=!1,this.type=`canvas`,this._i={layerStack:[],layers:[]};var i=!e.nodeName||e.nodeName.toUpperCase()===`CANVAS`;if(this._opts=n=O({},n||{}),this.dpr=n.devicePixelRatio||Ui,this._singleCanvas=i,this.root=e,e.style&&(ke(e),e.innerHTML=``),this.storage=t,this._prevDisplayList=[],i){var a=e,o=a.width,s=a.height;n.width!=null&&(o=n.width),n.height!=null&&(s=n.height),this.dpr=n.devicePixelRatio||1,a.width=o*this.dpr,a.height=s*this.dpr,this._width=o,this._height=s;var c=tG(a,this,YW,0);c.initContext(),this._insertLayer(c,YW,0,!0),this._domRoot=e}else{this._width=_k(e,0,n),this._height=_k(e,1,n);var l=this._domRoot=eG(this._width,this._height);e.appendChild(l)}}return e.prototype.getType=function(){return`canvas`},e.prototype.isSingleCanvas=function(){return this._singleCanvas},e.prototype.getViewportRoot=function(){return this._domRoot},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.refresh=function(e){var t=e&&!V(e)?{paintAll:!!e}:e||{},n=H(t.refresh,!0),r=H(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=QW),!n)return r&&this._paintHoverList(this.storage.getDisplayList(!1)),this;var i=this.storage.getDisplayList(!0);this._updateLayerStatus(i,t.paintAll),this._redrawId=Math.random();var a=this._prevDisplayList;this._paintList(i,a,this._redrawId);var o=this._backgroundColor;return sG(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},lG),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=XW,n!==XW&&(!t&&n===QW&&(t=this._i.hoverlayer=this._ensureLayer(JW)),t)){t.clear();for(var r={inHover:!0,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},i,a=0,o=e.length;a<o;a++){var s=e[a];if(s.__inHover){i||(i=t.ctx,i.save());var c=s.__hoverStyle,l=void 0;c&&(l=s.style,s.style=c),Gk(i,s,r),c&&(s.style=l)}}i&&(Kk(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(JW)},e.prototype.paintOne=function(e,t){Wk(e,t)},e.prototype._paintList=function(e,t,n){if(this._redrawId===n){var r=this._doPaintList(e,t);if(this._needsManuallyCompositing&&this._compositeManually(),r)sG(this._i,function(e){e.afterBrush&&e.afterBrush()},dG),this._paintHoverList(e);else{var i=this;VE(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(YW).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),sG(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},cG)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return sG(this._i,function(i){var a=!1;if(aG(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),!(!a&&!i.__dirty)){var o=n._opts.useDirtyRect&&!GW(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}aG(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},dG),Ne.wxa&&sG(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r)if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s<r.length;++s){var c=r[s];a.save(),a.beginPath(),a.rect(c.x*o,c.y*o,c.width*o,c.height*o),a.clip(),this._paintPerCursorInRect(e,t,n,c,i),a.restore()}else a.save(),this._paintPerCursorInRect(e,t,n,null,i),a.restore();return t.drawIdx>=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=GW(e),c=s&&u.getTime(),l=t.drawIdx,d=t.notClearIdx,f=d>=0?Math.min(d,l):l;f<t.endIdx;f++){var p=n[f];if(!(f<l&&!p.notClear)){if(p.__inHover&&(this._hoverLayerDirty=QW),r!=null){var m=p.getPaintRect();m&&m.intersect(r)&&(Gk(o,p,a),p.setPrevPaintRect(m))}else Gk(o,p,a);if(s&&u.getTime()-c>15){f++;break}}}Kk(o,a),t.drawIdx=Math.max(f,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=YW,t=0);var i=oG(this._i,e)[t];return i||(i=tG(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&D(i,this._layerConfig[e],!0),(n||r&&e!==YW)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&$W(e)){for(var l=o.length,u=0;u<l&&(o[u].zl<t||o[u].zl===t&&o[u].zl2<n);)u++;if(u>0&&(c=oG(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),oG(i,t)[n]=e,!r&&!e.virtual)if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom);e.painter||=this}},e.prototype.eachLayer=function(e,t){return sG(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return sG(this._i,function(n,r){e.call(t,n,r)},cG)},e.prototype.eachOtherLayer=function(e,t){return sG(this._i,function(n,r){e.call(t,n,r)},lG)},e.prototype.getLayers=function(){var e={};return sG(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r<e.length;r++){var i=e[r];if(i.zlevel!==e[r-1].zlevel||i.incremental){n._needsManuallyCompositing=!0;break}}sG(n._i,function(e){e.__dirty=!1,aG(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},dG);for(var a,o=null,s=null,c=!1,l=0,u=e.length;l<u;l++){var i=e[l],d=i.zlevel,f=i.incremental,p=void 0;if(a!==d&&(a=d,c=!1),f?(c=!0,p=1):p=c?2:0,(!o||d!==o.zlevel||p!==o.zlevel2)&&(o=n._ensureLayer(d,p),s=null,!o.__builtin__)){T(`ZLevel `+d+` has been used by unknown layer `+o.id);continue}if((!s||f!==s.key)&&(s=iG(o,f),!s.used))if(s.used=!0,!t&&s.first===i.id){var m=l-s.startIdx;s.startIdx=l,s.drawIdx+=m,s.endIdx+=m}else o.__dirty=!0,s.first=i.id,s.startIdx=s.drawIdx=l,s.endIdx=l+1;s.endIdxNew=l+1,i.__dirty&1&&!i.__inHover&&((!f||!i.notClear&&l<s.drawIdx)&&(o.__dirty=!0),f&&i.notClear&&s.notClearIdx<0&&(s.notClearIdx=l))}sG(n._i,function(t){for(var r=t.__cursorStack,i=t.__cursors,a=r.length-1;a>=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(GW(t)?s<o.drawIdx:s!==o.endIdx||!s||e[s-1].id!==o.last)&&(t.__dirty=!0),o.endIdx=o.endIdxNew,o.last=s?e[s-1].id:NaN}}t.__dirty&&(aG(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===XW&&(n._hoverLayerDirty=ZW))},dG)},e.prototype.clear=function(){return sG(this._i,function(e){e.clear(),nG(e)},cG),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,sG(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?D(n[e],t,!0):n[e]=t,sG(this._i,function(e,t){D(e,n[t],!0)})}},e.prototype.delLayer=function(e){for(var t=this._i.layerStack,n=this._i.layers,r=t.length-1;r>=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=_k(i,0,r),t=_k(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,sG(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer(YW).resize(e,t)}return this},e.prototype.clearLayer=function(e){N(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[YW][0].dom;var t=new qW(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;sG(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s<c;s++){var l=o[s];Gk(n,l,a)}Kk(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function pG(e){e.registerPainter(`canvas`,fG)}var mG=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],hG=[`INR`],gG=[`rupees`,`paise`],_G=[`ms`,`s`,`min`,`h`],vG=[`day`,`month`,`year`,`datetime`,`time`],yG=`−`,bG=`₹`,xG=330*60*1e3,SG=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],CG=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],wG=(e,t)=>Number.isInteger(e)&&e>=0&&e<=20?e:t,TG=new Map,EG=e=>(TG.has(e)||TG.set(e,new Intl.NumberFormat(`en-IN`,{minimumFractionDigits:0,maximumFractionDigits:e})),TG.get(e)),DG=new Map,OG=e=>(DG.has(e)||DG.set(e,new Intl.NumberFormat(`en-IN`,{minimumFractionDigits:e,maximumFractionDigits:e})),DG.get(e)),kG=e=>typeof e==`number`&&Number.isFinite(e),AG=e=>e<0&&!Object.is(Math.abs(e),0)?yG:``,jG=(e,t)=>t===`paise`?e/100:e;function MG(e,{decimals:t}={}){if(!kG(e))return`-`;let n=EG(wG(t,2)).format(Math.abs(e));return n===`0`?`0`:AG(e)+n}function NG(e,{unit:t=`rupees`,decimals:n}={}){if(!kG(e))return`-`;let r=jG(e,t),i=OG(wG(n,0)).format(Math.abs(r));return(Number(i.replace(/,/g,``))===0?``:AG(r))+bG+i}var PG=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2;function FG(e,{currency:t,unit:n=`rupees`}={}){if(!kG(e))return`-`;let r=t?jG(e,n):e,i=t?bG:``,a=Math.abs(r),o=CG.findIndex(([e])=>a>=e);if(o===-1){let e=EG(PG(a)).format(a);if(e!==`1,000`)return(e===`0`?``:AG(r))+i+e;o=CG.length-1}let[s,c]=CG[o],l=a/s,u=l>=100?0:l>=10?1:2,d=Number(l.toFixed(u));return d>=100&&o>0&&(--o,[s,c]=CG[o],l=a/s,u=l>=100?0:l>=10?1:2,d=Number(l.toFixed(u))),`${AG(r)}${i}${EG(u).format(d)} ${c}`}function IG(e,{decimals:t}={}){return kG(e)?`${MG(e*100,{decimals:wG(t,1)})}%`:`-`}function LG(e,{unit:t=`s`}={}){if(!kG(e))return`-`;let n={ms:1,s:1e3,min:6e4,h:36e5}[t]??1e3,r=Math.abs(e*n),i=AG(e);if(Math.round(r)<1e3)return`${i}${EG(0).format(r)} ms`;let a=r/1e3;if(a<10)return`${i}${EG(1).format(a)}s`;let o=Math.round(a);if(o<60)return`${i}${o}s`;let s=e=>String(e).padStart(2,`0`),c=Math.floor(o/60);if(c<60)return`${i}${c}m ${s(o%60)}s`;let l=Math.floor(c/60);return`${i}${EG(0).format(l)}h ${s(c%60)}m`}function RG(e){if(e instanceof Date)return e.getTime();if(kG(e))return e;if(typeof e!=`string`)return NaN;let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(t){let[e,n,r]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(2e3,n-1,r));return i.setUTCFullYear(e),i.getUTCFullYear()===e&&i.getUTCMonth()===n-1&&i.getUTCDate()===r?i.getTime()-xG:NaN}return Date.parse(e)}function zG(e){let t=new Date(e+xG);return{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes()}}function BG(e,{pattern:t=`day`}={}){let n=RG(e);if(!Number.isFinite(n))return`-`;let r=zG(n),i=e=>String(e).padStart(2,`0`),a=`${i(r.day)}-${SG[r.month]}-${r.year}`,o=`${i(r.hour)}:${i(r.minute)}`;switch(t){case`month`:return`${SG[r.month]}-${r.year}`;case`year`:return String(r.year);case`datetime`:return`${a} ${o}`;case`time`:return o;default:return a}}function VG(e){let t=RG(e);if(!Number.isFinite(t))return`-`;let n=zG(t);return`${String(n.day).padStart(2,`0`)}-${SG[n.month]}`}function Z(e,t){if(e==null||e===``)return`-`;let n=t?.style;if(n===`date`)return BG(e,t);if(typeof e!=`number`)return String(e);switch(n){case`currency`:return NG(e,t);case`percent`:return IG(e,t);case`compact`:return FG(e,t);case`duration`:return LG(e,t);default:return MG(e,t)}}function HG(e){let t=e?.style;return t===`currency`?{style:`compact`,currency:e.currency??`INR`,unit:e.unit}:!t||t===`number`?{style:`compact`}:e}var UG=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],WG=[`none`,`stacked`,`percent`],GG=[`category`,`time`,`value`],KG=[`auto`,`svg`,`canvas`],qG=[`ready`,`loading`,`empty`,`error`],JG=[`chart`,`table`],YG=8,XG=6,ZG=`Other`,QG=`No data to show for this chart.`,$G=`This chart couldn't load. Try again in a moment.`,eK=`This chart has more series than it can show clearly.`,tK=`This chart has more groups than it can show clearly.`,nK={line:`Line chart`,area:`Area chart`,column:`Column chart`,bar:`Bar chart`,donut:`Donut chart`,heatmap:`Heatmap`,calendar:`Calendar heatmap`,funnel:`Funnel chart`,gauge:`Gauge`,waterfall:`Waterfall chart`,treemap:`Treemap`,sankey:`Sankey diagram`,scatter:`Scatter plot`,bubble:`Bubble chart`,multiples:`Small multiples`},rK=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],iK=e=>rK.includes(e),aK=[`area`,`column`,`bar`],oK=[`line`,`area`,`column`,`bar`,`multiples`],sK={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},cK={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`]},lK={gauge:240,calendar:200,treemap:340,sankey:340},uK=100,dK=72,fK=32,pK=[`type`,`title`,`description`,`data`,`x`,`series`,`group`,`to`,`size`,`trend`,`zoom`,`bands`,`stack`,`y`,`target`,`height`,`state`,`emptyText`,`errorText`,`renderer`],mK=[`key`,`kind`,`format`,`label`],hK=[`key`,`label`,`format`],gK=[`key`,`label`],_K=[`key`,`label`,`format`],vK=[`upTo`,`label`],yK=[`label`,`format`,`min`,`max`],bK=[`value`,`label`],xK=[`style`,`currency`,`unit`,`decimals`,`pattern`],SK=new Set;function CK(e){SK.has(e)||(SK.add(e),console.warn(`[@webority/ui-elements] <wui-chart> ${e}`))}var wK=e=>e.map(e=>`"${e}"`).join(` | `);function TK(e,t,n){t==null||n.includes(t)||CK(`received ${e}="${String(t)}", which is not one of ${wK(n)}. The chart uses its default instead.`)}function EK(e,t,n){for(let r of Object.keys(t))if(!n.includes(r)){if(/^(y2|secondary)/i.test(r)){CK(`ignores ${e}.${r}: a chart has one value axis by design. Show the second measure as its own chart.`);continue}CK(`ignores the unknown key ${e}.${r}. Known keys: ${n.join(`, `)}.`)}}function DK(e,t){if(t!=null){if(typeof t!=`object`){CK(`expects ${e} to be an object such as { style: "currency" }.`);return}if(EK(e,t,xK),TK(`${e}.style`,t.style,mG),TK(`${e}.currency`,t.currency,hG),t.unit!=null){let n=t.style===`duration`?_G:gG;TK(`${e}.unit`,t.unit,n)}TK(`${e}.pattern`,t.pattern,vG),t.decimals!=null&&!(Number.isInteger(t.decimals)&&t.decimals>=0&&t.decimals<=20)&&CK(`received ${e}.decimals=${String(t.decimals)}, which is not a whole number from 0 to 20. The chart uses its default instead.`)}}var OK=e=>typeof e==`number`&&Number.isFinite(e),kK=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function AK(e){let t=(e,t=$G)=>(console.error(`[@webority/ui-elements] <wui-chart> ${e}`),{spec:null,problem:t});if(!kK(e))return t('has no spec: set the `spec` property or add a <script type="application/json"> child.');if(EK(`spec`,e,pK),TK(`type`,e.type,UG),!UG.includes(e.type))return t(`cannot draw type "${String(e.type)}".`);let n=e.type;(typeof e.title!=`string`||!e.title.trim())&&CK("needs a `title`: it names the chart for screen readers and names exported files.");for(let[t,r]of Object.entries(cK))e[t]!=null&&!r.includes(n)&&CK(`ignores spec.${t} on a ${n} chart: it applies to ${r.join(`, `)}.`);let r=kK(e.x)?e.x:{};EK(`spec.x`,r,mK);let i=sK[n]??[`category`];TK(`x.kind`,r.kind,GG),GG.includes(r.kind)&&!i.includes(r.kind)&&CK(`ignores x.kind="${r.kind}" on a ${n} chart: it takes ${wK(i)}.`),DK(`x.format`,r.format),typeof r.key!=`string`&&n!==`gauge`&&CK("needs `x.key`, the column holding each row's x value or slice name.");let a=kK(e.y)?e.y:{};EK(`spec.y`,a,yK),DK(`y.format`,a.format);let o=Array.isArray(e.series)?e.series.filter(kK):[];for(let[e,t]of o.entries())EK(`spec.series[${e}]`,t,hK),DK(`series[${e}].format`,t.format),typeof t.key!=`string`&&CK(`needs series[${e}].key, the column holding that series' values.`);if(o.length===0)return t(`has no series to draw.`);let s=o.map(e=>e.key).filter(e=>typeof e==`string`),c=s.find((e,t)=>s.indexOf(e)!==t);if(c!==void 0)return t(`has two series with the key "${c}": each series needs its own key.`);if(o.length>8)return t(`refuses ${o.length} series: 8 is the most that stay distinguishable. Fold the smallest into an Other series, or split the chart.`,eK);let l=iK(n);if(l&&o.length>1){let e=n===`donut`?`Compare parts across groups with a percent-stacked column instead.`:`Show the other measures as their own charts, or use small multiples.`;CK(`draws one series as a ${n}; it got ${o.length} and shows the first. ${e}`)}let u=(e,t,n,r)=>t==null?null:kK(t)?(EK(e,t,n),typeof t.key==`string`?(DK(`${e}.format`,t.format),{key:t.key,label:typeof t.label==`string`?t.label:``,format:t.format}):(CK(`needs ${e}.key, the column holding ${r}.`),null)):(CK(`expects ${e} to be an object such as { key: "column" }.`),null),d=cK.group.includes(n)?u(`spec.group`,e.group,gK,`each row's group`):null,f=n===`sankey`?u(`spec.to`,e.to,gK,`where each flow ends`):null,p=n===`bubble`?u(`spec.size`,e.size,_K,`each bubble's size`):null;if((n===`heatmap`||n===`treemap`)&&!d)return t(`needs \`group.key\` to draw a ${n}: the column holding each ${n===`heatmap`?`row`:`parent`}.`);if(n===`sankey`&&!f)return t("needs `to.key` to draw a sankey: the column holding where each flow ends.");if(n===`bubble`&&!p)return t("needs `size.key` to draw a bubble chart: the column holding each bubble's size.");let m=aK.includes(n)?WG:[`none`];TK(`stack`,e.stack,m),TK(`state`,e.state,qG),TK(`renderer`,e.renderer,KG),e.target!=null&&(kK(e.target)&&EK(`spec.target`,e.target,bK),(!kK(e.target)||!OK(e.target.value))&&CK("ignores a `target` without a numeric `value`.")),e.trend!=null&&typeof e.trend!=`boolean`&&CK("expects `trend` to be true or false."),e.zoom!=null&&typeof e.zoom!=`boolean`&&CK("expects `zoom` to be true or false.");let h=[];if(n===`gauge`&&e.bands!=null){let t=Array.isArray(e.bands)?e.bands.filter(kK):[];for(let e of t)EK(`spec.bands[]`,e,vK);h=t.filter(e=>OK(e.upTo)&&typeof e.label==`string`&&e.label).map(e=>({upTo:e.upTo,label:e.label})).sort((e,t)=>e.upTo-t.upTo),(!Array.isArray(e.bands)||h.length!==t.length)&&CK("ignores a gauge band without a numeric `upTo` and a `label`.")}let g=a.format??o[0].format,_=(l?o.slice(0,1):o).map(e=>({key:e.key,label:typeof e.label==`string`&&e.label?e.label:String(e.key),format:e.format??g})),v=i.includes(r.kind)?r.kind:i[0],y=Array.isArray(e.data)?e.data.filter(kK):[],b=-1,x=null;n===`donut`&&y.length>6&&(x=y,{data:y,otherIndex:b}=NK(y,r.key,_[0].key),CK(`draws at most 6 donut slices; the smallest ${e.data.length-5} are shown as "${ZG}". Send fewer rows, or use a bar chart for many parts.`));let S=_[0].key,C=(e,t)=>{let n=y.filter(e);n.length!==y.length&&CK(`leaves out ${y.length-n.length} row(s) ${t}.`),y=n},w=e=>e!=null&&e!==``,T=e=>OK(e)&&e>0;if(v===`time`&&oK.includes(n)&&C(e=>Number.isFinite(RG(e[r.key])),`without a readable date`),n===`gauge`&&y.length>1)CK(`draws one value as a gauge; it got ${y.length} rows and shows the first.`),y=y.slice(0,1);else if(n===`scatter`||n===`bubble`){C(e=>OK(e[r.key])&&OK(e[S])&&(n!==`bubble`||T(e[p.key])),`without a number for x and y (and a positive size)`);let e=new Set(d?y.map(e=>String(e[d.key]??``)):[]);if(e.size>3)return t(`refuses ${e.size} colour groups on a ${n} chart: 3 is the most that stay tellable apart. Keep the three that matter and fold the rest into one, or split the chart.`,tK)}else if(n===`calendar`)C(e=>Number.isFinite(RG(e[r.key])),`without a readable date`);else if(n===`heatmap`)C(e=>w(e[r.key])&&w(e[d.key]),`without a column or a row`);else if(n===`treemap`){C(e=>w(e[r.key])&&w(e[d.key])&&T(e[S]),`without a name, a parent and a positive size`);let e=new Set(y.map(e=>String(e[d.key])));if(e.size>8)return t(`refuses ${e.size} parents in a treemap: 8 is the most that keep their own colour. Fold the smallest into one, or split the chart.`,tK)}else if(n===`sankey`){C(e=>w(e[r.key])&&w(e[f.key])&&T(e[S]),`without a start, an end and a positive size`);let e=jK(y,r.key,f.key);if(e)return t(e.reason,e.text)}else if(n===`waterfall`){let e=MK(y,S);if(e?.refuse)return t(e.refuse);e&&CK(e.warn)}let E=OK(e.height)&&e.height>0?e.height:null;if(n===`multiples`){let e=dK*_.length+fK;E!=null&&E<e&&(CK(`needs at least ${e}px of height for ${_.length} small charts; it got ${E}px and draws at ${e}px.`),E=e),E??=uK*_.length+40}return E??=lK[n]??320,{problem:null,spec:{type:n,title:typeof e.title==`string`?e.title.trim():``,description:typeof e.description==`string`?e.description:``,data:y,allData:x??y,x:{key:r.key,kind:v,format:r.format??(v===`time`?{style:`date`}:v===`value`?{style:`number`}:void 0),label:r.label??``},series:_,group:d,to:f,size:p,trend:cK.trend.includes(n)&&e.trend===!0,zoom:cK.zoom.includes(n)?(e.zoom??y.length>5e3)===!0:!1,bands:h,stack:m.includes(e.stack)?e.stack:`none`,y:{label:a.label??``,format:g,min:OK(a.min)?a.min:void 0,max:OK(a.max)?a.max:void 0},target:kK(e.target)&&OK(e.target.value)?{value:e.target.value,label:String(e.target.label??``)}:null,height:E,state:qG.includes(e.state)?e.state:`ready`,emptyText:typeof e.emptyText==`string`&&e.emptyText?e.emptyText:QG,errorText:typeof e.errorText==`string`&&e.errorText?e.errorText:$G,renderer:KG.includes(e.renderer)?e.renderer:`auto`,otherIndex:b}}}function jK(e,t,n){let r=e.map(e=>[String(e[t]),String(e[n])]),i=new Map;for(let[e,t]of r)i.has(e)||i.set(e,0),i.set(t,(i.get(t)??0)+1);let a=[...i].filter(([,e])=>e===0).map(([e])=>e);if(a.length>8)return{reason:`refuses ${a.length} flow starts in a sankey: 8 is the most that keep their own colour. Fold the smallest into one, or split the chart.`,text:tK};let o=0;for(;a.length;){let e=a.pop();o+=1;for(let[t,n]of r)t===e&&(i.set(n,i.get(n)-1),i.get(n)===0&&a.push(n))}return o<i.size?{reason:`cannot draw a sankey whose flows loop back on themselves.`,text:$G}:null}function MK(e,t){let n=e.map(e=>OK(e[t])?e[t]:0),r=n[n.length-1]??0,i=n[0]??0,a=i;for(let e of n.slice(1,-1))i+=e,a=Math.min(a,i);return a<0||n.length>1&&r<0?{refuse:`cannot draw a waterfall whose running total goes below zero.`}:n.length>2&&Math.abs(r-i)>.5?{warn:`draws the waterfall's closing total (${r}) as given, though the opening total plus the steps is ${i}.`}:null}function NK(e,t,n){let r=new Set(e.map((e,t)=>({i:t,v:OK(e[n])?e[n]:0})).sort((e,t)=>t.v-e.v).slice(0,5).map(e=>e.i)),i=e.reduce((e,t,i)=>r.has(i)||!OK(t[n])?e:e+t[n],0),a=e.filter((e,t)=>r.has(t)),o=new Set(a.map(e=>String(e[t]))),s=ZG;for(let e=2;o.has(s);e+=1)s=`${ZG} (${e})`;return a.push({[t]:s,[n]:i}),{data:a,otherIndex:a.length-1}}function Q(e,t,n){let r=e.data[n]?.[t];return OK(r)?r:null}function PK(e){return e.type===`gauge`||e.series.some(t=>e.data.some((n,r)=>Q(e,t.key,r)!=null))}function $(e,t){let n=e.data[t]?.[e.x.key];return n==null||n===``?`-`:e.x.format?Z(n,e.x.format):String(n)}function FK(e,t){return RG(e.data[t]?.[e.x.key])}function IK(e,t){let n=e.group?e.data[t]?.[e.group.key]:null;return n==null||n===``?`-`:String(n)}function LK(e,t){let n=e.to?e.data[t]?.[e.to.key]:null;return n==null||n===``?`-`:String(n)}var RK=e=>[...new Set(e)];function zK(e){return e.group?RK(e.data.map((t,n)=>IK(e,n))):[]}function BK(e){return iK(e.type)?e.data.length:e.data.length*e.series.length}function VK(e){return e.renderer===`auto`?BK(e)>5e3?`canvas`:`svg`:e.renderer}function HK(e){switch(e.type){case`donut`:return e.data.map((t,n)=>$(e,n));case`scatter`:case`bubble`:return zK(e);case`line`:case`area`:case`column`:case`bar`:return e.series.map(e=>e.key);default:return[]}}function UK(e){return[`line`,`area`,`column`,`bar`].includes(e.type)?e.series.map(e=>e.label):HK(e)}function WK(e,t,n){return e.type===`donut`?n.has($(e,t)):(e.type===`scatter`||e.type===`bubble`)&&e.group?n.has(IK(e,t)):!1}function GK(e,t){return e.data.map((n,r)=>{let i=e.series.filter(e=>!t.has(e.key)).reduce((t,n)=>t+Math.abs(Q(e,n.key,r)??0),0);return Object.fromEntries(e.series.map(t=>[t.key,i&&Q(e,t.key,r)!=null?Q(e,t.key,r)/i:null]))})}var KK=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function qK(e){return`${KK[new Date(e+xG).getUTCDay()]}, ${BG(e)}`}var JK=e=>e.reduce((e,t)=>t<e?t:e,1/0),YK=e=>e.reduce((e,t)=>t>e?t:e,-1/0),XK=(e,t)=>e.data.map((n,r)=>Q(e,t,r)).filter(e=>e!=null),ZK=(e,t)=>t?Z(e/t,{style:`percent`}):`-`;function QK(e,t){let n=e.filter(OK);if(!n.length)return[];let r=JK(n),i=YK(n),a=[t[1],t[2],t[3],t[5],t[6]];if(r===i)return[{from:r,to:i,colour:a[2]}];let o=(i-r)/a.length;return a.map((e,t)=>({from:r+o*t,to:t===a.length-1?i:r+o*(t+1),colour:e}))}function $K(e,t){if(t==null||!e.length)return;let n=e.length-1,r=e.findIndex((e,r)=>t>=e.from&&(r===n?t<=e.to:t<e.to));return e[r<0?n:r].colour}function eq(e,t){return Array.from({length:e},(n,r)=>t[e===1?6:Math.round(6-r*4/(e-1))])}function tq(e,t){return e.bands.find(e=>t<=e.upTo)??e.bands[e.bands.length-1]??null}var nq=(e,t)=>t==null?`-`:tq(e,t).label;function rq(e){return{min:e.y.min??0,max:e.y.max??100}}function iq(e){let t=e.series[0].key,n=e.data.length-1,r=0;return e.data.map((i,a)=>{let o=Q(e,t,a)??0,s=a===0||a===n,c=s?0:r,l=s?o:r+o;return a===0?r=o:s||(r=l),{index:a,total:s,value:o,from:c,to:l,level:s?o:l}})}function aq(e,t){let n=e.series[0].key,r=e.data.map(t=>({from:String(t[e.x.key]),to:String(t[e.to.key]),value:t[n]})),i=new Map;for(let e of r)i.has(e.from)||i.set(e.from,[]),i.set(e.to,[...i.get(e.to)??[],e]);let a=new Map,o=0;for(let[e,n]of i)n.length||a.set(e,t[o++%t.length]);let s=[...a.keys()],c=new Map([...i].filter(([,e])=>e.length).map(([e,t])=>[e,t.length]));for(;s.length;){let e=s.shift();for(let t of r.filter(t=>t.from===e)){if(c.set(t.to,c.get(t.to)-1),c.get(t.to)>0)continue;let e=i.get(t.to).reduce((e,t)=>t.value>e.value?t:e);a.set(t.to,a.get(e.from)),s.push(t.to)}}return a}function oq(e){let t=e.series[0].key,n=new Map(zK(e).map(e=>[e,0]));return e.data.forEach((r,i)=>n.set(IK(e,i),n.get(IK(e,i))+r[t])),n}function sq(e,t,n){let{palette:r,neutral:i,seq:a}=n,o=e.series[0].key;switch(e.type){case`donut`:return uq(e,t,n);case`funnel`:return eq(e.data.length,a)[t];case`heatmap`:case`calendar`:return $K(QK(XK(e,o),a),Q(e,o,t));case`gauge`:return r[0];case`waterfall`:{let n=iq(e)[t];return n.total?r[0]:n.value>=0?r[2]:r[7]}case`treemap`:return r[[...oq(e).keys()].indexOf(IK(e,t))%r.length];case`sankey`:return aq(e,r).get(String(e.data[t][e.x.key]));case`scatter`:case`bubble`:return r[Math.max(0,zK(e).indexOf(IK(e,t)))];default:return r[0]??i}}function cq(e,t,n,r){let i=e.series[0],a=Q(e,i.key,t),o=()=>sq(e,t,r);switch(e.type){case`donut`:{let r=e.data.reduce((t,r,a)=>t+(n.has($(e,a))?0:Q(e,i.key,a)??0),0);return{title:$(e,t),rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share`,value:r&&a!=null?Z(a/r,{style:`percent`}):`-`}],foot:``}}case`heatmap`:return{title:`${IK(e,t)}, ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`calendar`:return{title:qK(FK(e,t)),rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`funnel`:{let n=Q(e,i.key,0),r=t?Q(e,i.key,t-1):null,s=[{color:o(),label:i.label,value:Z(a,i.format)}];return t&&s.push({label:`Of previous step`,value:ZK(a,r)}),s.push({label:`Of ${$(e,0)}`,value:ZK(a,n)}),{title:$(e,t),rows:s,foot:``}}case`gauge`:{let{min:n,max:r}=rq(e),s=a==null?null:tq(e,a),c=[{color:o(),label:i.label,value:Z(a,i.format)}];return c.push({label:`Scale`,value:`${Z(n,i.format)} to ${Z(r,i.format)}`}),s&&c.push({label:`Band`,value:s.label}),{title:e.data[t]?.[e.x.key]==null?i.label:$(e,t),rows:c,foot:``}}case`waterfall`:{let n=iq(e)[t],r=iq(e)[0].value,a=n.total?[{color:o(),label:i.label,value:Z(n.value,i.format)}]:[{color:o(),label:`Change`,value:lq(n.value,i.format)},{label:`Running total`,value:Z(n.level,i.format)}],s=!n.total&&r?`${lq(n.value/r*100,{style:`number`,decimals:2},`%`)} of opening`:``;return{title:$(e,t),rows:a,foot:s}}case`treemap`:{let n=IK(e,t),r=oq(e).get(n);return{title:`${n} / ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:ZK(a,r)}],foot:``}}case`sankey`:{let n=String(e.data[t][e.x.key]),r=e.data.reduce((t,r,a)=>String(r[e.x.key])===n?t+(Q(e,i.key,a)??0):t,0);return{title:`${n} to ${LK(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:ZK(a,r)}],foot:``}}case`scatter`:case`bubble`:{let n=[{color:o(),label:e.x.label||String(e.x.key),value:$(e,t)},{label:i.label,value:Z(a,i.format)}];return e.size&&n.push({label:e.size.label||String(e.size.key),value:Z(e.data[t][e.size.key],e.size.format)}),{title:e.group?IK(e,t):i.label,rows:n,foot:``}}default:break}let s=e.stack===`percent`?GK(e,n)[t]:null,c=e.series.map((e,t)=>({s:e,i:t})).filter(({s:e})=>!n.has(e.key)),l=c.map(({s:n,i})=>{let a=Q(e,n.key,t),o=Z(a,n.format);return{color:e.type===`multiples`?r.palette[0]:r.palette[i],line:e.type===`line`||e.type===`multiples`,label:n.label,value:s&&a!=null?`${o} (${Z(s[n.key],{style:`percent`})})`:o}}),u=``;if(e.stack!==`none`&&c.length>1&&(u=`Total ${Z(c.reduce((n,{s:r})=>n+(Q(e,r.key,t)??0),0),c[0].s.format)}`),e.target&&c.length===1){let n=Q(e,c[0].s.key,t);if(n!=null){let t=n-e.target.value,r=e.target.label||`target`;u=`${t>=0?`Above`:`Below`} ${r} by ${Z(Math.abs(t),c[0].s.format)}`}}return{title:$(e,t),rows:l,foot:u}}function lq(e,t,n=``){let r=`${Z(Math.abs(e),t)}${n}`;return e>0?`+${r}`:e<0?`−${r}`:r}function uq(e,t,n){return t===e.otherIndex?n.neutral:n.palette[t%n.palette.length]}function dq(e){let t=(e,t)=>{let n=document.createElement(`div`);return n.className=e,t!=null&&(n.textContent=t),n},n=t(`wui-chart-tooltip-body`);e.title&&n.append(t(`wui-chart-tooltip-title`,e.title));for(let r of e.rows){let e=t(`wui-chart-tooltip-row`);if(r.color){let t=document.createElement(`span`);t.className=r.line?`wui-chart-tooltip-swatch wui-chart-tooltip-swatch-line`:`wui-chart-tooltip-swatch`,t.style.background=r.color,e.append(t)}let i=document.createElement(`span`);i.className=`wui-chart-tooltip-label`,i.textContent=r.label;let a=document.createElement(`span`);a.className=`wui-chart-tooltip-value`,a.textContent=r.value,e.append(i,a),n.append(e)}return e.foot&&n.append(t(`wui-chart-tooltip-foot`,e.foot)),n}function fq(e){let t=[e.title,...e.rows.map(e=>`${e.label} ${e.value}`)];return e.foot&&t.push(e.foot),t.filter(Boolean).join(`. `)}function pq(e){return e.x.label?e.x.label:{gauge:`Measure`,funnel:`Stage`,waterfall:`Step`,sankey:`From`,scatter:`X`,bubble:`X`}[e.type]??(e.x.kind===`time`?`Date`:`Category`)}function mq(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=t.series[0],r=(e,r=n)=>Z(Q(t,r.key,e),r.format),i=(e,n,r=n.length)=>({caption:t.title,head:e,rows:n.slice(0,500),total:r,truncated:r>500}),a=t.data.map((e,t)=>t);switch(t.type){case`heatmap`:{let e=RK(a.map(e=>$(t,e))),n=zK(t),o=new Map(a.map(e=>[`${IK(t,e)}\u0000${$(t,e)}`,r(e)]));return i([t.group.label||`Row`,...e],n.map(t=>({head:t,cells:e.map(e=>o.get(`${t}\u0000${e}`)??`-`)})))}case`funnel`:{let e=Q(t,n.key,0);return i([pq(t),n.label,`Of previous step`,`Of ${$(t,0)}`],a.map(i=>({head:$(t,i),cells:[r(i),i?ZK(Q(t,n.key,i),Q(t,n.key,i-1)):`-`,ZK(Q(t,n.key,i),e)]})))}case`gauge`:return i([pq(t),n.label,...t.bands.length?[`Band`]:[]],a.map(e=>({head:t.data[e][t.x.key]==null?n.label:$(t,e),cells:[r(e),...t.bands.length?[nq(t,Q(t,n.key,e))]:[]]})));case`waterfall`:return i([pq(t),`Change`,`Running total`],iq(t).map(e=>({head:$(t,e.index),cells:[e.total?`-`:lq(e.value,n.format),Z(e.level,n.format)]})));case`treemap`:{let e=oq(t);return i([t.group.label||`Group`,t.x.label||`Item`,n.label,`Share of group`],a.map(i=>({head:IK(t,i),cells:[$(t,i),r(i),ZK(Q(t,n.key,i),e.get(IK(t,i)))]})))}case`sankey`:return i([pq(t),t.to.label||`To`,n.label],a.map(e=>({head:$(t,e),cells:[LK(t,e),r(e)]})));case`scatter`:case`bubble`:return i([pq(t),n.label,...t.size?[t.size.label||t.size.key]:[],...t.group?[t.group.label||`Group`]:[]],a.map(e=>({head:$(t,e),cells:[r(e),...t.size?[Z(t.data[e][t.size.key],t.size.format)]:[],...t.group?[IK(t,e)]:[]]})));default:break}let o=t.type===`donut`,s=o?t.data.reduce((e,r,i)=>e+(Q(t,n.key,i)??0),0):0,c=[pq(t),...t.series.map(e=>e.label)];return o&&c.push(`Share`),i(c,a.slice(0,500).map(e=>{let i=t.series.map(t=>r(e,t));if(o){let r=Q(t,n.key,e);i.push(s&&r!=null?Z(r/s,{style:`percent`}):`-`)}return{head:$(t,e),cells:i}}),t.data.length)}function hq(e){switch(e?.style){case`currency`:case`compact`:return e.currency||e.style===`currency`?` (${e.currency??`INR`})`:``;case`percent`:return` (%)`;case`duration`:return` (${e.unit??`s`})`;default:return``}}function gq(e,t){return e==null?e:t?.unit===`paise`?e/100:t?.style===`percent`?Number((e*100).toPrecision(12)):e}function _q(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=e=>{if(e==null)return``;let t=String(e);return typeof e==`string`&&/^[=+\-@\t\r]/.test(t)&&(t=`'${t}`),/[",\r\n]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t},r={head:t.x.label||t.x.key,value:e=>{let n=e[t.x.key];return t.x.kind===`time`?BG(n,{pattern:t.x.format?.pattern??`day`}):n}},i=t.series.map(e=>({head:`${e.label}${hq(e.format)}`,value:t=>gq(OK(t[e.key])?t[e.key]:null,e.format)})),a=t.group?{head:t.group.label||t.group.key,value:e=>e[t.group.key]}:null,o;switch(t.type){case`heatmap`:o=[r,a,...i];break;case`treemap`:o=[a,r,...i];break;case`sankey`:o=[r,{head:t.to.label||t.to.key,value:e=>e[t.to.key]},...i];break;case`bubble`:o=[r,...i,{head:`${t.size.label||t.size.key}${hq(t.size.format)}`,value:e=>gq(e[t.size.key],t.size.format)},...a?[a]:[]];break;case`scatter`:o=[r,...i,...a?[a]:[]];break;case`gauge`:o=typeof t.x.key==`string`?[r,...i]:i;break;default:o=[r,...i]}let s=[o.map(e=>n(e.head)).join(`,`)];for(let e of t.data)s.push(o.map(t=>n(t.value(e))).join(`,`));return`${s.join(`\r
21
- `)}`}function vq(e){return(e?.title??``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)||`chart`}var yq=(e,t,n)=>{if(!t.length)return null;let r=JK(t),i=YK(t);return r===i?`${e} is ${Z(r,n)}.`:`${e} runs from ${Z(r,n)} to ${Z(i,n)}.`};function bq(e){let t=[];e.description&&t.push(e.description.replace(/\.?\s*$/,`.`));let n=e.data.length,r=e.series[0],i=XK(e,r.key),a=i.reduce((e,t)=>e+t,0),o=()=>e.data.reduce((t,n,i)=>(Q(e,r.key,i)??-1/0)>(Q(e,r.key,t)??-1/0)?i:t,0),s=()=>e.data.reduce((t,n,i)=>(Q(e,r.key,i)??1/0)<(Q(e,r.key,t)??1/0)?i:t,0);switch(e.type){case`donut`:{let i=o();return t.push(`${nK.donut} of ${r.label} in ${n} parts, ${Z(a,r.format)} in all.`),n&&a&&t.push(`${$(e,i)} is the largest, at ${Z(Q(e,r.key,i)/a,{style:`percent`})}.`),t.join(` `)}case`heatmap`:if(t.push(`${nK.heatmap} of ${r.label} by ${e.group.label||`row`} and ${e.x.label||`column`}, ${n} cells.`),i.length){let n=o(),r=s();t.push(`Highest is ${xq(e,n)} at ${IK(e,n)}, ${$(e,n)}; lowest is ${xq(e,r)} at ${IK(e,r)}, ${$(e,r)}.`)}return t.join(` `);case`calendar`:return t.push(`${nK.calendar} of ${r.label}, ${n} ${n===1?`day`:`days`}${n>1?`, from ${$(e,0)} to ${$(e,n-1)}`:``}.`),i.length&&t.push(`Highest is ${xq(e,o())} on ${$(e,o())}; lowest is ${xq(e,s())} on ${$(e,s())}.`),t.join(` `);case`funnel`:return t.push(`${nK.funnel} of ${r.label} in ${n} stages.`),n>1&&t.push(`${$(e,0)} is ${xq(e,0)} and ${$(e,n-1)} is ${xq(e,n-1)}, ${ZK(Q(e,r.key,n-1),Q(e,r.key,0))} of the start.`),t.join(` `);case`gauge`:{let n=Q(e,r.key,0),{min:i,max:a}=rq(e),o=n==null?null:tq(e,n);return t.push(`${nK.gauge}: ${r.label} is ${Z(n,r.format)} on a scale from ${Z(i,r.format)} to ${Z(a,r.format)}${o?`, in the ${o.label} band`:``}.`),t.join(` `)}case`waterfall`:{let i=iq(e);if(t.push(`${nK.waterfall} of ${r.label}.`),n>1){let a=i.filter(e=>!e.total);t.push(`It opens at ${Z(i[0].value,r.format)} and closes at ${Z(i[n-1].value,r.format)}.`);let o=a.reduce((e,t)=>t.value>(e?.value??0)?t:e,null),s=a.reduce((e,t)=>t.value<(e?.value??0)?t:e,null);o&&t.push(`The largest rise is ${$(e,o.index)}, ${lq(o.value,r.format)}.`),s&&t.push(`The largest fall is ${$(e,s.index)}, ${lq(s.value,r.format)}.`)}return t.join(` `)}case`treemap`:{let i=oq(e);if(!i.size)return`${nK.treemap} of ${r.label}: no items.`;let[o,s]=[...i].reduce((e,t)=>t[1]>e[1]?t:e);return t.push(`${nK.treemap} of ${r.label}: ${n} items in ${i.size} groups, ${Z(a,r.format)} in all.`),t.push(`${o} is the largest group, at ${ZK(s,a)}.`),t.join(` `)}case`sankey`:{let i=RK(e.data.flatMap(t=>[String(t[e.x.key]),String(t[e.to.key])])),a=o();return t.push(`${nK.sankey} of ${r.label}: ${n} flows between ${i.length} places.`),t.push(`The largest flow is ${$(e,a)} to ${LK(e,a)}, ${xq(e,a)}.`),t.join(` `)}case`scatter`:case`bubble`:{let a=zK(e);t.push(`${nK[e.type]} of ${r.label} against ${e.x.label||e.x.key}, ${n} points${a.length?` in ${a.length} groups: ${a.join(`, `)}`:``}.`);let o=e.data.map(t=>t[e.x.key]).filter(OK);for(let n of[yq(e.x.label||String(e.x.key),o,e.x.format),yq(r.label,i,r.format)])n&&t.push(n);return t.join(` `)}default:break}let c=e.stack===`percent`?`, stacked to 100%`:e.stack===`stacked`?`, stacked`:``;t.push(`${nK[e.type]} of ${e.series.map(e=>e.label).join(`, `)}${c}${e.type===`multiples`?`, sharing one x axis`:``}.`),n&&t.push(`${n} ${n===1?`point`:`points`}, ${n>1?`from ${$(e,0)} to ${$(e,n-1)}`:$(e,0)}.`);for(let n of e.series){let r=yq(n.label,XK(e,n.key),n.format);r&&t.push(r)}return t.join(` `)}var xq=(e,t)=>Z(Q(e,e.series[0].key,t),e.series[0].format);function Sq(e){return e.stack===`percent`?{style:`percent`,decimals:0}:HG(e.y.format)}var Cq=864e5,wq={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},Tq=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function Eq(e,t){let n=e.data.map((e,t)=>t).filter(n=>!WK(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>e.data[t][e.x.key];return n.sort((e,t)=>r(e)-r(t)||e-t)}function Dq(e){let t=RK(e.data.map((t,n)=>$(e,n))),n=zK(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf($(e,i))},${n.indexOf(IK(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf($(e,r)),n.indexOf(IK(e,r))]}}function Oq(e,t,n,r){if(n===`Escape`)return null;let i=e.data.length;if(!i)return t;if(e.type===`gauge`)return n in wq||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return kq(e,t,n);let a=Tq.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?Eq(e,r):null;if(a?!s.length:!o.length)return t;let c=t??{index:a?s[0]:0,series:a?0:o[0]};if(t==null&&n in wq)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:s[0],series:0}:n===`End`?{index:s[s.length-1],series:0}:n in wq?{index:s[(e+wq[n]+s.length)%s.length],series:0}:t}if(n===`Home`)return{...c,index:0};if(n===`End`)return{...c,index:i-1};if(!(n in wq))return t;if(e.type===`bar`?n===`ArrowUp`||n===`ArrowDown`:n===`ArrowLeft`||n===`ArrowRight`)return{...c,index:Math.min(i-1,Math.max(0,c.index+wq[n]))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?wq[n]:-wq[n];return{...c,series:o[Math.min(o.length-1,Math.max(0,l+u))]}}function kq(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>FK(e,t)-FK(e,n)):null,o=i?null:Dq(e),s=t??{index:i?a[0]:0,series:0};if(t==null&&n in wq)return s;if(n===`Home`)return{index:i?a[0]:0,series:0};if(n===`End`)return{index:i?a[r-1]:r-1,series:0};if(!(n in wq))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?wq[n]:wq[n]*7,r=t=>Math.floor((FK(e,t)+xG)/Cq),i=r(s.index),o=a.filter(e=>t>0?r(e)>i:r(e)<i);if(!o.length)return{index:s.index,series:0};let c=i+t;return{index:o.reduce((e,t)=>Math.abs(r(t)-c)<Math.abs(r(e)-c)?t:e),series:0}}let[c,l]=o.position(s.index),[u,d]=n===`ArrowLeft`||n===`ArrowRight`?[wq[n],0]:[0,wq[n]];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}Lj([dx,tT,ZT,EL,LI,EI,XF,yL,ZM,KR,gB,CV,ZB,_z,$R,DH,eH,wB,dU,RH,UW,pG]);var Aq=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],jq=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function Mq(e,t,n,r){let i=HG(e);if(i.style!==`compact`||!Number.isFinite(t)||!Number.isFinite(n))return i;let a=(n-t)/r;if(!(a>0)||a>=Math.max(Math.abs(t),Math.abs(n))*.02)return i;let o=Math.min(6,Math.max(0,Math.ceil(-Math.log10(a))));return i.currency?{style:`currency`,currency:i.currency,unit:i.unit,decimals:o}:{style:`number`,decimals:o}}var Nq=(e,t)=>{let n=e.filter(e=>e!=null&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},Pq=24,Fq=4,Iq=.6,Lq=(e,t)=>String(e).length*t*Iq;function Rq(e){let t=String(e??``).trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1].length===3?[...n[1]].map(e=>e+e).join(``):n[1];return[0,2,4].map(t=>Number.parseInt(e.slice(t,t+2),16))}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);return r?r.slice(1,4).map(Number):null}function zq(e,t){let n=Rq(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function Bq(e,t,n){let r=Rq(e),i=Rq(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+(i[t]-e)*n)).join(`,`)})`:e}var Vq=e=>e.map(e=>e/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,n)=>e+t*[.2126,.7152,.0722][n],0),Hq=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function Uq(e,t){let n=Rq(e),r=Rq(t.text),i=Rq(t.surface);return!n||!r||!i||Hq(Vq(n),Vq(r))>=Hq(Vq(n),Vq(i))?t.text:t.surface}var Wq=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:zq(e,t)},{offset:1,color:zq(e,0)}]}),Gq=e=>e+xG;function Kq(e){let t=e.x.format?.pattern;return e=>{let n=e-xG;if(t===`month`||t===`year`)return BG(n,{pattern:t});let r=zG(n);return r.hour||r.minute?BG(n,{pattern:`time`}):VG(n)}}function qq(e,t,n){let r=Fq,i=e=>n?e?[r,0,0,r]:[0,r,r,0]:e?[0,0,r,r]:[r,r,0,0];return e.data.map((n,r)=>{let a={};if(e.stack===`none`){for(let t of e.series)a[t.key]=i((Q(e,t.key,r)??0)<0);return a}let o=null,s=null;for(let n of e.series){let i=Q(e,n.key,r);t.has(n.key)||i==null||i===0||(i>0?o=n.key:s=n.key)}for(let t of e.series)a[t.key]=t.key===o?i(!1):t.key===s?i(!0):0;return a})}function Jq(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&BK(e)<=5e3,o=HK(e),s=Object.fromEntries(o.map(e=>[e,!r.hidden.has(e)])),c={palette:t.palette,neutral:t.neutral,seq:t.seq},l={backgroundColor:t.surface,borderColor:t.grid,borderWidth:1,padding:[10,12],confine:!0,className:`wui-chart-tooltip`,extraCssText:`box-shadow:${t.shadow};border-radius:10px;`,textStyle:{fontFamily:t.font,color:t.textBody,fontSize:12},transitionDuration:a?.25:0},u={backgroundColor:`transparent`,animation:a,animationDuration:1e3,animationEasing:`cubicOut`,animationDurationUpdate:650,animationEasingUpdate:`cubicInOut`,textStyle:{fontFamily:t.font,color:t.label},color:t.palette,legend:{show:!1,data:o,selected:s}},d={base:u,tooltipBase:l,colours:c,compact:i,animate:a},f=FJ[e.type];if(f)return f(e,t,n,r,d);let p=e.type===`bar`,m=e.x.kind===`time`,h=e.stack===`percent`?GK(e,r.hidden):null,g=p||e.type===`column`?qq(e,r.hidden,p):null,_=e.series.length===1,v=r.renderer===`canvas`,[y,b]=Nq(e.series.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))),!0),x=e.stack===`percent`?Sq(e):Mq(e.y.format,e.y.min??y,e.y.max??b,i?3:4),S=h?.some(e=>Object.values(e).some(e=>e!=null&&e<0))?-1:0,C=e.series.findIndex(e=>!r.hidden.has(e.key)),w={type:m?`time`:`category`,boundaryGap:!m&&(e.type===`column`||p),inverse:p,axisLine:{show:!0,lineStyle:{color:t.axis}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:t.label,fontSize:11,margin:12,hideOverlap:!0,...m?{formatter:Kq(e)}:{}},...m?{}:{data:e.data.map((t,n)=>$(e,n))}},T={type:`value`,splitNumber:i?3:4,min:e.stack===`percent`?S:e.y.min,max:e.stack===`percent`?1:e.y.max,interval:e.stack===`percent`?.25:void 0,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:t.grid,type:`solid`,width:1}},axisLabel:{color:t.label,fontSize:11,formatter:e=>Z(e,x)},...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,align:p?`right`:`left`}}:{}},E=e.zoom,D=_&&e.type!==`column`&&!p&&!i,O=e.series.map((n,r)=>{let o=t.palette[r],s=e.data.some((t,r)=>Q(e,n.key,r)!=null&&Q(e,n.key,r-1)==null&&Q(e,n.key,r+1)==null),c=t=>{let r=Q(e,n.key,t),i=h?h[t][n.key]:r;return m?[Gq(FK(e,t)),i]:i},l={id:n.key,name:n.key,stack:e.stack===`none`?void 0:`total`,emphasis:{focus:_?`none`:`series`,blurScope:`coordinateSystem`},blur:{itemStyle:{opacity:.22},lineStyle:{opacity:.22},areaStyle:{opacity:.08}}};if(e.type===`line`||e.type===`area`){let n=e.type===`area`?_||e.stack!==`none`?t.dark?.34:.22:.1:0;return{...l,type:`line`,data:e.data.map((e,t)=>c(t)),smooth:.35,connectNulls:!1,symbol:`circle`,showSymbol:s,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:zq(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:n?{color:Wq(o,n)}:void 0,endLabel:D?{show:!0,formatter:e=>Z(Array.isArray(e.value)?e.value[1]:e.value,x),color:o,fontWeight:600,fontSize:12,distance:8,fontFamily:t.font,valueAnimation:a}:void 0,markLine:r===C?Yq(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:Pq,barCategoryGap:i?`28%`:`38%`,itemStyle:{color:o,borderColor:t.surface,borderWidth:e.stack===`none`?0:1},animationDelay:a?e=>e*45+r*110:0,data:e.data.map((e,t)=>({value:c(t),itemStyle:{borderRadius:g[t][n.key]}})),markLine:r===C?Yq(e,t,p,a):void 0}});return{...u,useUTC:m,grid:{left:4,right:D?64:i?8:16,top:e.y.label?28:12,bottom:E?44:4,outerBoundsMode:`same`},dataZoom:E?MJ(e,t,t.palette[0],r.zoom):void 0,tooltip:{...l,trigger:`axis`,axisPointer:e.type===`line`||e.type===`area`?{type:`line`,lineStyle:{color:t.axis}}:{type:`shadow`,shadowStyle:{color:zq(t.neutral,t.dark?.12:.1)}},formatter:t=>dq(cq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?T:w,yAxis:p?w:T,series:O}}function Yq(e,t,n,r){if(!e.target)return;let i=e.series[0].format;return{silent:!0,symbol:`none`,animation:r,lineStyle:{color:t.label,type:[5,4],width:1},label:{position:`insideEndTop`,formatter:()=>[e.target.label,Z(e.target.value,i)].filter(Boolean).join(` `),color:t.textMuted,fontSize:11,fontFamily:t.font,backgroundColor:t.surface,padding:[2,6],borderRadius:4},data:[n?{xAxis:e.target.value}:{yAxis:e.target.value}]}}function Xq(e,t,n,r,{base:i,tooltipBase:a,colours:o,compact:s}){let c=e.series[0],l=e.data.map((t,n)=>$(e,n)),u=e.data.reduce((t,n,i)=>t+(r.hidden.has(l[i])?0:Q(e,c.key,i)??0),0);return{...i,tooltip:{...a,trigger:`item`,formatter:t=>dq(cq(e,t.dataIndex,r.hidden,o))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(u,HG(c.format)),x:0,y:-10,align:`center`,verticalAlign:`middle`,fill:t.text,fontSize:s?18:22,fontWeight:650,fontFamily:t.font}},{type:`text`,style:{text:`Total`,x:0,y:14,align:`center`,verticalAlign:`middle`,fill:t.label,fontSize:12,fontFamily:t.font}}]}],series:[{id:c.key,name:c.key,type:`pie`,radius:s?[`50%`,`70%`]:[`54%`,`72%`],center:[`50%`,`50%`],padAngle:1.6,minAngle:3,startAngle:90,avoidLabelOverlap:!0,itemStyle:{borderRadius:6,borderColor:t.surface,borderWidth:2},animationType:`expansion`,animationDuration:1100,label:s?{show:!1}:{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:11.5,lineHeight:16,formatter:e=>`${e.name}\n${Z(e.percent/100,{style:`percent`,decimals:0})}`},labelLine:{length:10,length2:8,smooth:.2,lineStyle:{color:t.axis}},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:6,itemStyle:{shadowBlur:16,shadowColor:`rgba(0,0,0,0.18)`}},data:e.data.map((t,n)=>({name:l[n],value:Q(e,c.key,n)??0,itemStyle:{color:uq(e,n,o)}}))}]}}var Zq=e=>[...new Set(e)],Qq=(e,t)=>e.data.map((n,r)=>Q(e,t,r));function $q(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var eJ=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:11,margin:12,hideOverlap:!0},...n}),tJ=(e,t,n={})=>({type:`value`,splitNumber:4,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:e.grid,type:`solid`,width:1}},axisLabel:{color:e.label,fontSize:11,formatter:t},...n});function nJ(e,t,n){return{type:`piecewise`,orient:`horizontal`,right:4,bottom:0,pieces:t.map((e,n)=>({gte:e.from,[n===t.length-1?`lte`:`lt`]:e.to,color:e.colour})),itemWidth:11,itemHeight:11,itemGap:3,itemSymbol:`roundRect`,showLabel:!1,text:[`More`,`Less`],textGap:8,selectedMode:!1,textStyle:{color:e.label,fontSize:11,fontFamily:e.font},...n}}function rJ(e,t,n,r,i){let a=e.series[0],o=Zq(e.data.map((t,n)=>$(e,n))),s=zK(e),c=QK(Qq(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:$q(i.tooltipBase,t=>dq(cq(e,t.dataIndex,r.hidden,i.colours))),xAxis:eJ(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:eJ(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:nJ(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf($(e,n)),s.indexOf(IK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderColor:t.surface,borderWidth:2,borderRadius:4},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}},progressive:0,animationDuration:800}]}}var iJ=7*864e5,aJ=e=>{let t=zG(e);return`${t.year}-${String(t.month+1).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`};function oJ(e,t){let n=e.data.map((t,n)=>FK(e,n)).filter(Number.isFinite),r=sJ(n),i=cJ(n),a=Math.ceil((i-r)/iJ)+1,o=Math.floor((t.height-62)/7),s=Math.max(lJ,Math.min(uJ,o,Math.floor((t.width-44)/a))),c=Math.max(1,Math.floor((t.width-44)/s));return{cell:s,from:a>c?i-(c-1)*iJ:r,to:i}}var sJ=e=>e.reduce((e,t)=>t<e?t:e,1/0),cJ=e=>e.reduce((e,t)=>t>e?t:e,-1/0),lJ=9,uJ=24;function dJ(e,t,n,r,i){let a=e.series[0],{cell:o,from:s,to:c}=oJ(e,n),l=QK(Qq(e,a.key),t.seq);return{...i.base,tooltip:$q(i.tooltipBase,t=>dq(cq(e,t.dataIndex,r.hidden,i.colours))),visualMap:nJ(t,l,{right:4}),calendar:{range:[aJ(s),aJ(c)],top:24,left:34,cellSize:[o,o],splitLine:{show:!1},itemStyle:{color:t.seq[0],borderColor:t.surface,borderWidth:o<16?2:3},dayLabel:{firstDay:1,nameMap:[``,`Mon`,``,`Wed`,``,`Fri`,``],color:t.label,fontSize:10,fontFamily:t.font,margin:8},monthLabel:{color:t.label,fontSize:11,fontFamily:t.font,margin:8},yearLabel:{show:!1}},series:[{type:`heatmap`,coordinateSystem:`calendar`,data:e.data.map((t,n)=>[aJ(FK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function fJ(e,t,n,r,i){let a=e.series[0],o=eq(e.data.length,t.seq),s=Q(e,a.key,0);return{...i.base,tooltip:$q(i.tooltipBase,t=>dq(cq(e,t.dataIndex,r.hidden,i.colours))),series:[{type:`funnel`,sort:`none`,gap:3,left:0,right:0,top:4,bottom:4,minSize:`38%`,maxSize:`100%`,funnelAlign:`center`,animationDuration:900,itemStyle:{borderColor:t.surface,borderWidth:0,borderRadius:6},emphasis:{itemStyle:{shadowBlur:14,shadowColor:`rgba(0,0,0,0.18)`}},label:{show:!0,position:`inside`,fontFamily:t.font,lineHeight:17},data:e.data.map((n,r)=>{let i=Uq(o[r],t),c=Q(e,a.key,r),l=r?`${ZK(c,Q(e,a.key,r-1))} of previous step`:`${ZK(c,s)} of ${jq($(e,0))}`;return{name:$(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${jq($(e,r))}} {v|${jq(Z(c,a.format))}}\n{p|${r?l:`first stage`}}`,rich:{n:{color:i,fontSize:12.5,fontWeight:500,fontFamily:t.font},v:{color:i,fontSize:13,fontWeight:700,fontFamily:t.font},p:{color:zq(i,.78),fontSize:11,fontFamily:t.font}}}}})}]}}function pJ(e,t,n,r,i){let a=e.series[0],{min:o,max:s}=rq(e),c=Q(e,a.key,0),l=c??o,u=c==null?null:tq(e,c),d=t.palette[0],f=s-o||1,p=e.bands.length?e.bands.map((e,n)=>[Math.min(1,Math.max(0,(e.upTo-o)/f)),t.seq[1+Math.min(n,3)]]):[[1,t.grid]];return e.bands.length&&p[p.length-1][0]<1&&p.push([1,t.grid]),{...i.base,tooltip:$q(i.tooltipBase,()=>dq(cq(e,0,r.hidden,i.colours))),series:[{type:`gauge`,startAngle:215,endAngle:-35,min:o,max:s,radius:`96%`,center:[`50%`,`58%`],splitNumber:10,pointer:{show:!1},anchor:{show:!1},progress:{show:c!=null,width:14,roundCap:!0,itemStyle:{color:d,shadowBlur:i.animate?12:0,shadowColor:zq(d,.35)}},axisLine:{roundCap:!0,lineStyle:{width:14,color:p}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:!1},title:{offsetCenter:[0,`30%`],color:t.label,fontSize:12.5,fontFamily:t.font},detail:{valueAnimation:i.animate,offsetCenter:[0,`-4%`],fontFamily:t.font,formatter:e=>`{v|${jq(c==null?Z(null):Z(e,a.format))}}{u|/${jq(Z(s,a.format))}}${u?`\n{s|${jq(u.label)}}`:``}`,rich:{v:{fontSize:36,fontWeight:650,color:t.text,fontFamily:t.font,padding:[0,2,0,0]},u:{fontSize:14,color:t.label,fontFamily:t.font,padding:[12,0,0,0]},s:{fontSize:12,color:t.label,fontFamily:t.font,padding:[8,0,0,0]}}},data:[{value:l,name:e.data[0]?.[e.x.key]==null?a.label:$(e,0)}]}]}}function mJ(e){let t=cJ(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=sJ(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=cJ(e.filter(e=>!e.total).map(e=>Math.abs(e.value)));if(!(t>0)||!(n>t*.4)||!(r<t*.15))return null;let i=10**Math.floor(Math.log10(t))/10,a=Math.round(t*.08/i)*i,o=Math.floor(n*.965/i)*i;return o>a?{start:a,end:o}:null}var hJ=4,gJ=72;function _J(e,t,n,r){let i=r?10:11,a=r?10.5:12,o=Math.floor(n/Math.max(1,e.length)-hJ);return{nameSize:i,valueSize:a,category:cJ(e.flatMap(e=>String(e).split(/\s+/)).map(e=>Lq(e,i)))<=o?{interval:0,width:o,overflow:`break`}:{interval:0,rotate:45,width:gJ,overflow:`truncate`,hideOverlap:!0},showValues:t.every(e=>Lq(e,a)<=o)}}function vJ(e,t,n,r,i){let a=e.series[0],o=iq(e),s=Sq(e),c=mJ(o),l=t=>sq(e,t.index,i.colours),u=o.map(t=>$(e,t.index)),d=o.map(e=>e.total?Z(e.value,s):lq(e.value,s)),f=o.flatMap(e=>[e.from,e.to]),p=Math.max(Lq(Z(cJ(f),s),11),Lq(Z(sJ(f),s),11))+8,m=_J(u,d,n.width-p-12,i.compact);return{...i.base,grid:{left:4,right:8,top:28,bottom:4,outerBoundsMode:`same`},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`shadow`,shadowStyle:{color:zq(t.neutral,.1)}},formatter:t=>dq(cq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:eJ(t,u,{axisLabel:{color:t.label,fontSize:m.nameSize,margin:12,...m.category}}),yAxis:tJ(t,e=>Z(e,s),{min:0,splitNumber:5,...c?{breaks:[{start:c.start,end:c.end,gap:`6%`}],breakArea:{show:!0,itemStyle:{color:t.surface,borderColor:t.axis,borderWidth:1,borderType:`solid`,opacity:1},zigzagAmplitude:3,zigzagZ:200}}:{}}),series:[{type:`line`,step:`end`,data:o.map(e=>e.level),symbol:`none`,silent:!0,z:1,lineStyle:{color:t.axis,width:1},tooltip:{show:!1},animation:!1,emphasis:{disabled:!0}},{type:`bar`,stack:`w`,data:o.map(e=>Math.min(e.from,e.to)),silent:!0,itemStyle:{color:`transparent`},emphasis:{disabled:!0},tooltip:{show:!1},barMaxWidth:48},{name:a.key,type:`bar`,stack:`w`,z:3,barMaxWidth:48,barCategoryGap:`34%`,itemStyle:{borderRadius:5},emphasis:{itemStyle:{shadowBlur:10,shadowColor:`rgba(0,0,0,0.15)`}},animationDelay:i.animate?e=>e*140:0,label:{show:m.showValues,position:`top`,distance:6,fontFamily:t.font,fontSize:m.valueSize,fontWeight:600,color:t.text,formatter:e=>d[e.dataIndex]},data:o.map(e=>({value:Math.abs(e.to-e.from),itemStyle:{color:l(e)}}))}]}}function yJ(e){let t=e.series[0].key;return zK(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>IK(e,t)===n).sort((n,r)=>Q(e,t,r)-Q(e,t,n)||n-r)}))}function bJ(e,t,n,r,i){let a=e.series[0],o=oq(e),s=[...o.values()].reduce((e,t)=>e+t,0),c=(e,t)=>{let r=e/s*n.width*n.height*.82;return r>5200&&Math.max(Lq(t[0],12),Lq(t[1],11.5))+20<=Math.sqrt(r)},l=yJ(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=t.palette[i%t.palette.length],u=Uq(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${jq(n)}} {v|${jq(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:zq(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=Bq(l,t.surface,Math.min(.55,r*.14)),o=Uq(i,t),s=Q(e,a.key,n);return{name:$(e,n),value:s,row:n,itemStyle:{color:i},label:{show:c(s,[$(e,n),Z(s,a.format)]),formatter:`{n|${jq($(e,n))}}\n{v|${jq(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:zq(o,.82),fontSize:11.5,fontFamily:t.font}}}}})}});return{...i.base,tooltip:$q(i.tooltipBase,t=>t.data?.row==null?dq({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:`Share of all`,value:ZK(t.value,s)}],foot:``}):dq(cq(e,t.data.row,r.hidden,i.colours))),series:[{type:`treemap`,roam:!1,nodeClick:!1,breadcrumb:{show:!1},left:0,right:0,top:0,bottom:0,animationDurationUpdate:700,label:{show:!0,position:`insideTopLeft`,padding:[8,10],overflow:`truncate`,fontFamily:t.font},upperLabel:{show:!0,height:28,padding:[0,10],fontFamily:t.font},levels:[{itemStyle:{borderWidth:0,gapWidth:4,borderColor:t.surface}},{itemStyle:{borderWidth:3,gapWidth:2,borderRadius:8}},{itemStyle:{borderWidth:0,gapWidth:0,borderRadius:5},emphasis:{itemStyle:{borderColor:t.text,borderWidth:0}}}],data:l}]}}function xJ(e){let t=e.data.map(t=>[String(t[e.x.key]),String(t[e.to.key])]),n=new Map(t.flatMap(([e,t])=>[[e,0],[t,0]]));for(let e=0;e<n.size;e+=1)for(let[e,r]of t)n.set(r,Math.max(n.get(r),n.get(e)+1));return n}function SJ(e,t,n,r,i){let a=e.series[0],o=aq(e,t.palette),s=xJ(e),c=cJ([...s.values()]),l=new Map,u=new Map;e.data.forEach((t,n)=>{let r=Q(e,a.key,n)??0;l.set(String(t[e.x.key]),(l.get(String(t[e.x.key]))??0)+r),u.set(String(t[e.to.key]),(u.get(String(t[e.to.key]))??0)+r)});let d=e=>u.get(e)??l.get(e)??0,f=e=>({position:e,color:t.text,fontFamily:t.font,fontSize:i.compact?11:12,formatter:e=>`{n|${jq(e.name)}}\n{v|${Z(d(e.name),{style:`compact`})}}`,rich:{n:{color:t.textBody,fontSize:i.compact?11:12,fontFamily:t.font,lineHeight:15},v:{color:t.label,fontSize:11,fontFamily:t.font}}});return{...i.base,tooltip:$q(i.tooltipBase,t=>dq(t.dataType===`edge`?cq(e,t.dataIndex,r.hidden,i.colours):{title:t.name,rows:[{color:t.color,label:a.label,value:Z(d(t.name),a.format)}],foot:``})),series:[{type:`sankey`,left:0,right:0,top:6,bottom:6,nodeWidth:10,nodeGap:i.compact?10:14,nodeAlign:`justify`,draggable:!1,layoutIterations:64,animationDuration:1200,emphasis:{focus:`adjacency`,lineStyle:{opacity:.55}},itemStyle:{borderWidth:0,borderRadius:3},lineStyle:{curveness:.5},levels:Array.from({length:c+1},(e,t)=>({depth:t,label:f(t===c&&c>0?`left`:`right`)})),data:[...s.keys()].map(e=>({name:e,itemStyle:{color:o.get(e)}})),links:e.data.map(n=>({source:String(n[e.x.key]),target:String(n[e.to.key]),value:n[a.key],lineStyle:{color:o.get(String(n[e.x.key])),opacity:t.dark?.32:.26}}))}]}}function CJ(e){let t=e.length,n=e.reduce((e,t)=>e+t[0],0)/t,r=e.reduce((e,t)=>e+t[1],0)/t,i=e.reduce((e,t)=>e+(t[0]-n)**2,0);if(!t||!i)return null;let a=e.reduce((e,t)=>e+(t[0]-n)*(t[1]-r),0)/i,o=sJ(e.map(e=>e[1])),s=cJ(e.map(e=>e[1])),c=e=>{let t=r+a*(e-n);return t<o?[e+(o-t)/a,o]:t>s?[e+(s-t)/a,s]:[e,t]};return[c(sJ(e.map(e=>e[0]))),c(cJ(e.map(e=>e[0])))]}var wJ=44,TJ=28,EJ=8;function DJ(e,t,n,r,i){let a=e.series[0],o=zK(e),s=e.type===`bubble`,c=cJ(s?e.data.map(t=>t[e.size.key]):[]),l=e=>Math.max(EJ,(i.compact?TJ:wJ)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||IK(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?CJ(d.map(t=>[e.data[t][e.x.key],Q(e,a.key,t)])):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>Q(e,a.key,n)),[h,g]=Nq(p,!1),[_,v]=Nq(m,!1),y=Mq(e.y.format,e.y.min??_,e.y.max??v,4),b=Mq(e.x.format,h,g,4),x=(e.group?o:[null]).map((n,r)=>({name:n??a.key,type:`scatter`,symbolSize:s?e=>l(e[2]):i.compact?8:10,itemStyle:{color:zq(t.palette[r],.85),borderColor:t.surface,borderWidth:1.5},emphasis:{focus:`series`,scale:1.5,itemStyle:{color:t.palette[r]}},blur:{itemStyle:{opacity:.15}},animationDelay:i.animate?e=>e*6+r*120:0,data:u(n).map(t=>({value:[e.data[t][e.x.key],Q(e,a.key,t),...s?[e.data[t][e.size.key]]:[]],row:t}))}));return f&&x.push({name:`Trend`,type:`line`,data:f,symbol:`none`,silent:!0,z:1,tooltip:{show:!1},lineStyle:{color:t.label,width:1.5,type:[6,4]},emphasis:{disabled:!0},endLabel:{show:!0,formatter:`Trend`,color:t.label,fontSize:11,fontFamily:t.font,offset:[-30,-12]}}),{...i.base,grid:{left:4,right:16,top:e.y.label?28:12,bottom:e.x.label?24:4,outerBoundsMode:`same`},tooltip:$q(i.tooltipBase,t=>t.data?.row==null?``:dq(cq(e,t.data.row,r.hidden,i.colours))),xAxis:tJ(t,e=>Z(e,b),{scale:!0,splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:t.axis}},...e.x.label?{name:e.x.label,nameLocation:`middle`,nameGap:28,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font}}:{}}),yAxis:tJ(t,e=>Z(e,y),{min:e.y.min,max:e.y.max,...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font,align:`left`}}:{}}),series:x}}var OJ=32,kJ=8,AJ=26;function jJ(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-AJ)/o,c=s-OJ-kJ,l=t.palette[0],u=e.data.map((t,n)=>$(e,n)),d=e.series.flatMap((n,r)=>{let i=Qq(e,n.key).filter(e=>e!=null).pop();return[{text:n.label,left:0,top:6+r*s,textStyle:{fontSize:12.5,fontWeight:600,color:t.text,fontFamily:t.font}},{text:`Latest ${Z(i,n.format)}`,right:8,top:7+r*s,textStyle:{fontSize:12,fontWeight:500,color:t.label,fontFamily:t.font}}]}),f=(t,n)=>{let r=Q(e,t.key,n);return a?[Gq(FK(e,n)),r]:r};return{...i.base,useUTC:a,title:d,grid:e.series.map((e,t)=>({left:52,right:8,top:6+t*s+OJ,height:c})),axisPointer:{link:[{xAxisIndex:`all`}],lineStyle:{color:t.axis},label:{show:!1}},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`line`,lineStyle:{color:t.axis}},formatter:t=>dq(cq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:eJ(t,u,{boundaryGap:!1}),gridIndex:r,axisLine:{lineStyle:{color:r===o-1?t.axis:t.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:r===o-1,color:t.label,fontSize:11,hideOverlap:!0,margin:10,...a?{formatter:Kq(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=Nq(Qq(e,n.key),!1),o=Mq(n.format,e.y.min??i,e.y.max??a,2);return tJ(t,e=>Z(e,o),{gridIndex:r,splitNumber:2,scale:e.y.min==null,min:e.y.min,max:e.y.max,axisLabel:{color:t.label,fontSize:10.5,formatter:e=>Z(e,o)}})}),series:e.series.map((n,r)=>({id:n.key,name:n.key,type:`line`,xAxisIndex:r,yAxisIndex:r,data:e.data.map((e,t)=>f(n,t)),smooth:.3,symbol:`circle`,showSymbol:!1,symbolSize:7,lineStyle:{width:1.75,color:l},itemStyle:{color:l,borderColor:t.surface,borderWidth:2},areaStyle:{color:Wq(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function MJ(e,t,n,r){let i=r?.start??(e.data.length>5e3?70:0),a=r?.end??100;return[{type:`inside`,start:i,end:a},{type:`slider`,start:i,end:a,height:26,bottom:8,left:52,right:12,borderColor:`transparent`,backgroundColor:t.grid,borderRadius:6,fillerColor:zq(n,t.dark?.22:.12),handleStyle:{color:t.surface,borderColor:t.axis},moveHandleSize:0,brushSelect:!1,dataBackground:{lineStyle:{color:t.axis,width:.75},areaStyle:{color:zq(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:zq(n,.18)}},textStyle:{color:t.label,fontSize:11,fontFamily:t.font}}]}function NJ(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=IK(e,n),r=e.data.map((e,t)=>t).filter(n=>IK(e,n)===t);return{seriesIndex:zK(e).indexOf(t),dataIndex:r.indexOf(n)}}case`waterfall`:return{seriesIndex:2,dataIndex:n};case`sankey`:return{seriesIndex:0,dataIndex:n,dataType:`edge`,tip:!1};case`treemap`:{let t=1;for(let r of yJ(e)){let e=r.rows.indexOf(n);if(e>=0)return{seriesIndex:0,dataIndex:t+1+e};t+=1+r.rows.length}return{seriesIndex:0,dataIndex:n}}case`gauge`:case`donut`:case`heatmap`:case`calendar`:case`funnel`:return{seriesIndex:0,dataIndex:n};default:return{seriesIndex:t,dataIndex:n}}}function PJ(e,t){switch(e.type){case`scatter`:case`bubble`:return t.data?.row==null?null:{series:0,row:t.data.row};case`treemap`:return t.data?.row==null?null:{series:0,row:t.data.row};case`sankey`:return t.dataType===`edge`?{series:0,row:t.dataIndex}:null;case`waterfall`:return t.seriesIndex===2?{series:0,row:t.dataIndex}:null;case`line`:case`area`:case`column`:case`bar`:case`multiples`:return{series:t.seriesIndex,row:t.dataIndex};default:return{series:0,row:t.dataIndex}}}var FJ={donut:Xq,heatmap:rJ,calendar:dJ,funnel:fJ,gauge:pJ,waterfall:vJ,treemap:bJ,sankey:SJ,scatter:DJ,bubble:DJ,multiples:jJ};function IJ(e,t,n,r,{pixelRatio:i=2}={}){let a=document.createElement(`div`);a.style.cssText=`position:fixed;left:-10000px;top:0;width:${n.width}px;height:${n.height}px;`,document.body.append(a);let o=_j(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(Jq(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function LJ(e,{renderer:t}){let n=_j(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?n.getOption()?.dataZoom?.[0]:null,l=Number.isFinite(c?.start)&&Number.isFinite(c?.end)?{start:c.start,end:c.end}:null,u=Jq(e,t,a,{...o,zoom:l});i=e,n.setOption(u,s||!r?{notMerge:!0}:{replaceMerge:Aq}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=NJ(i,e,t);n.dispatchAction({type:`downplay`}),n.dispatchAction({type:`highlight`,...a}),r&&n.dispatchAction({type:`showTip`,...a})},clearFocus(){n.dispatchAction({type:`hideTip`}),n.dispatchAction({type:`downplay`})},resize(){n.resize()},onSelect(e){n.on(`click`,t=>{if(t.componentType!==`series`)return;let n=PJ(i,t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var RJ=typeof HTMLElement>`u`?class{}:HTMLElement,zJ=`wui-chart:select`,BJ=`wui-chart:legend-change`,VJ=`wui-chart:ready`,HJ=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],UJ=`(prefers-color-scheme: dark)`,WJ=`(prefers-reduced-motion: reduce)`,GJ=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,KJ=!1;function qJ(e){let t=getComputedStyle(e),n=e=>t.getPropertyValue(e).trim(),r=e.closest(`[data-bs-theme], [data-theme]`)??document.documentElement,i=r.getAttribute(`data-bs-theme`)||r.getAttribute(`data-theme`),a={palette:[1,2,3,4,5,6,7,8].map(e=>n(`--wui-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>n(`--wui-chart-seq-${e}`)),neutral:n(`--wui-chart-neutral`),grid:n(`--wui-chart-grid`),axis:n(`--wui-chart-axis`),label:n(`--wui-chart-label`),surface:n(`--color-surface`),text:n(`--color-text`),textBody:n(`--color-text-body`),textMuted:n(`--color-text-muted`),shadow:n(`--wui-shadow-overlay`),font:t.fontFamily,dark:i===`dark`||i===`auto`&&!!GJ(UJ)?.matches,reducedMotion:!!GJ(WJ)?.matches};return!a.palette[0]&&!KJ&&(KJ=!0,console.warn(`[@webority/ui-elements] <wui-chart> found no --wui-chart-* colours: load @webority/theme on the page.`)),a}var JJ=new Set,YJ=null;function XJ(e){if(JJ.add(e),YJ)return;let t=()=>{for(let e of JJ)e._themeChanged()},n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-bs-theme`,`class`]});let r=new MutationObserver(t);r.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:[`data-theme`,`data-bs-theme`]});let i=[GJ(UJ),GJ(WJ)].filter(Boolean);for(let e of i)e.addEventListener?.(`change`,t);YJ=()=>{n.disconnect(),r.disconnect();for(let e of i)e.removeEventListener?.(`change`,t);YJ=null}}function ZJ(e){JJ.delete(e),JJ.size||YJ?.()}function QJ(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var $J=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r},eY=0,tY=class extends RJ{static get observedAttributes(){return[`view`]}constructor(){super(),eY+=1,this.uid=`wui-chart-${eY}`,this._spec=null,this._normal=null,this._hidden=new Set,this._focus=null}get spec(){return this._spec}set spec(e){this._spec=e??null,this._normal=null,this._clearFocus(),this._parts&&this._update()}get view(){return this.getAttribute(`view`)===`table`?`table`:`chart`}set view(e){this.setAttribute(`view`,String(e??`chart`))}connectedCallback(){if(Object.hasOwn(this,`spec`)){let e=this.spec;delete this.spec,this._spec=e??null}this._spec??=this._readScript(),this._spec==null&&!this.querySelector(`:scope > script[type='application/json']`)&&(this._awaitingSpec=!0,queueMicrotask(()=>{this._awaitingSpec=!1,this._parts&&this._update()})),this._build(),XJ(this),this._theme=qJ(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`?(this._visible=!1,this._intersection=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this._intersection.disconnect(),this._visible=!0,this._update())},{threshold:.05}),this._intersection.observe(this)):this._visible=!0,this._update()}disconnectedCallback(){ZJ(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null}attributeChangedCallback(e,t,n){t===n||!this._parts||(TK(`view`,n,JG),this._update())}toCsv(){let{spec:e}=this._normalized();return e?_q(e):``}toPng(){let{spec:e}=this._normalized();return e?IJ(e,this._theme??qJ(this),this._size(e),{hidden:this._hidden,renderer:VK(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));QJ(t,e??`${vq(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&QJ(t,e??`${vq(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return console.error(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e?.message),null}}_normalized(){return this._normal??=AK(this._spec),this._normal}_build(){let e=$J(`div`,`wui-chart-legend`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Legend`),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target.closest?.(`.wui-chart-legend-item`);t&&this._toggle(t.dataset.key)});let t=$J(`div`,`wui-chart-surface`);t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,`chart`),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=$J(`div`,`wui-chart-canvas`);n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=$J(`div`,`wui-chart-state`);r.setAttribute(`role`,`status`),r.hidden=!0;let i=$J(`div`,`wui-chart-table-wrap visually-hidden`),a=$J(`p`,`visually-hidden`);a.id=`${this.uid}-summary`;let o=$J(`div`,`visually-hidden`);o.setAttribute(`aria-live`,`polite`),this.replaceChildren(e,t,r,i,a,o),this.setAttribute(`role`,`figure`),this.setAttribute(`aria-describedby`,a.id),this._parts={legend:e,surface:t,canvas:n,state:r,tableWrap:i,summary:a,live:o},this._legendSignature=null,this._tableSpec=null}_size(e){return{width:this._parts?.surface.clientWidth||this.clientWidth||800,height:e.height}}_update(){if(!this._parts||this._awaitingSpec&&this._spec==null)return;let{spec:e,problem:t}=this._normalized(),n=this._parts,r=t?`error`:e.state===`ready`&&(!e.data.length||!PK(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e&&(r===`ready`||r===`loading`&&this._drawn),s=r===`loading`&&o;if(this.setAttribute(`aria-label`,e?.title||`Chart`),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,`${e?.title||`Chart`}: use the arrow keys to read the values`),n.summary.textContent=e?bq(e):``,e){if(!s){let t=new Set(HK(e));for(let e of this._hidden)t.has(e)||this._hidden.delete(e)}this._renderTable(e)}else n.tableWrap.replaceChildren();s||this._renderLegend(e,o&&!a),this._renderState(r,t??(r===`error`?e.errorText:e?.emptyText),i,o);let c=n.surface.hidden&&o&&!a;n.surface.hidden=!o||a,n.surface.style.height=i,n.tableWrap.className=a&&e?`wui-chart-table-wrap`:`wui-chart-table-wrap visually-hidden`,n.tableWrap.style.height=a&&e?i:``,a&&e?(n.tableWrap.tabIndex=0,n.tableWrap.setAttribute(`role`,`region`),n.tableWrap.setAttribute(`aria-label`,`${e.title||`Chart`} data`)):(n.tableWrap.removeAttribute(`tabindex`),n.tableWrap.removeAttribute(`role`),n.tableWrap.removeAttribute(`aria-label`)),c&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts.state,a=!r&&e!==`ready`;if(i.hidden=!a,!a){i.replaceChildren();return}i.style.height=n,e===`loading`?i.replaceChildren($J(`div`,`skeleton wui-chart-skeleton`),$J(`span`,`visually-hidden`,`Loading chart`)):i.replaceChildren($J(`p`,`wui-chart-state-text`,t))}_colour(e,t){return e.type===`donut`?sq(e,t,this._theme):this._theme.palette[t]}_renderLegend(e,t){let n=this._parts.legend,r=e?HK(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!i)return;let a=UK(e),o=r.map((t,n)=>this._colour(e,n)),s=JSON.stringify([e.type,r,a,o]);s!==this._legendSignature&&(this._legendSignature=s,n.replaceChildren(...r.map((t,n)=>{let r=$J(`button`,`wui-chart-legend-item`);r.type=`button`,r.dataset.key=t;let i=$J(`span`,e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`);return i.style.background=o[n],r.append(i,$J(`span`,`wui-chart-legend-label`,a[n])),r})));for(let e of n.children)e.setAttribute(`aria-pressed`,String(!this._hidden.has(e.dataset.key)))}_renderTable(e){if(this._tableSpec===e)return;this._tableSpec=e;let t=mq(e),n=$J(`table`,`wui-chart-table`);n.append($J(`caption`,`visually-hidden`,t.caption));let r=$J(`tr`);t.head.forEach((e,t)=>{let n=$J(`th`,t?`wui-chart-num`:null,e);n.scope=`col`,r.append(n)});let i=$J(`thead`);i.append(r),n.append(i);let a=$J(`tbody`);for(let e of t.rows){let t=$J(`tr`),n=$J(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>$J(`td`,`wui-chart-num`,e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push($J(`p`,`wui-chart-table-note`,`Showing the first ${t.rows.length} of ${t.total} rows. Download the CSV for all of them.`)),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized(),t=VK(e),n=e.type!==this._drawnType;this._engine&&this._engine.renderer!==t&&(this._engine.dispose(),this._engine=null);let r=`${e.height}px`,i=this._parts.canvas.style.height!==r;this._parts.canvas.style.height=r,i&&this._engine?.resize(),this._engine||(this._engine=LJ(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(VJ,{bubbles:!0,detail:{renderer:t}})))}),n=!0),this._engine.render(e,this._theme,this._size(e),{hidden:this._hidden,renderer:t},{replace:n}),this._drawnType=e.type,this._drawn=!0}_themeChanged(){if(!this._parts)return;let e=qJ(this);JSON.stringify(e)!==JSON.stringify(this._theme)&&(this._theme=e,this._update())}_resized(){let e=this.clientWidth;e!==this._width&&(this._width=e,!(!this._engine||!this._drawn)&&(this._parts.surface.hidden||this._engine.resize(),this._update()))}_toggle(e){let{spec:t}=this._normalized();if(!t||e==null)return;this._hidden.has(e)?this._hidden.delete(e):this._hidden.add(e),this._clearFocus(),this._update();let n=Object.fromEntries(HK(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(BJ,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||this.view===`table`||e.altKey||e.ctrlKey||e.metaKey)return;if(e.key===`Enter`){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!HJ.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=Oq(t,this._focus,e.key,this._hidden);if(!n){this._clearFocus();return}this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(fq(cq(t,n.index,this._hidden,this._theme)))}_announce(e){let t=this._parts.live;t.textContent=e===t.textContent?`${e}\u00a0`:e}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized(),r=n?.series[iK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(zJ,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:Q(n,r.key,t),row:i,index:t}}))}};typeof customElements<`u`&&!customElements.get(`wui-chart`)&&customElements.define(`wui-chart`,tY);export{qG as CHART_STATES,UG as CHART_TYPES,JG as CHART_VIEWS,YG as MAX_SERIES,XG as MAX_SLICES,KG as RENDERERS,WG as STACK_MODES,tY as WuiChart,GG as X_KINDS,Z as formatValue,AK as normalizeSpec};
21
+ `)}`}function vq(e){return(e?.title??``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)||`chart`}var yq=(e,t,n)=>{if(!t.length)return null;let r=JK(t),i=YK(t);return r===i?`${e} is ${Z(r,n)}.`:`${e} runs from ${Z(r,n)} to ${Z(i,n)}.`};function bq(e,t=new Set){let n=[];e.description&&n.push(e.description.replace(/\.?\s*$/,`.`));let r=HK(e);if(r.length&&r.every(e=>t.has(e)))return n.push(`Every series is hidden.`),n.join(` `);let i=e.data.length,a=e.data.map((e,t)=>t).filter(n=>!WK(e,n,t)),o=e.series[0],s=XK(e,o.key),c=s.reduce((e,t)=>e+t,0),l=()=>e.data.reduce((t,n,r)=>(Q(e,o.key,r)??-1/0)>(Q(e,o.key,t)??-1/0)?r:t,0),u=()=>e.data.reduce((t,n,r)=>(Q(e,o.key,r)??1/0)<(Q(e,o.key,t)??1/0)?r:t,0);switch(e.type){case`donut`:{let t=a.reduce((t,n)=>t+(Q(e,o.key,n)??0),0),r=a.reduce((t,n)=>(Q(e,o.key,n)??-1/0)>(Q(e,o.key,t)??-1/0)?n:t,a[0]);return n.push(`${nK.donut} of ${o.label} in ${a.length} ${a.length===1?`part`:`parts`}, ${Z(t,o.format)} in all.`),a.length&&t&&n.push(`${$(e,r)} is the largest, at ${Z(Q(e,o.key,r)/t,{style:`percent`})}.`),n.join(` `)}case`heatmap`:if(n.push(`${nK.heatmap} of ${o.label} by ${e.group.label||`row`} and ${e.x.label||`column`}, ${i} cells.`),s.length){let t=l(),r=u();n.push(`Highest is ${xq(e,t)} at ${IK(e,t)}, ${$(e,t)}; lowest is ${xq(e,r)} at ${IK(e,r)}, ${$(e,r)}.`)}return n.join(` `);case`calendar`:return n.push(`${nK.calendar} of ${o.label}, ${i} ${i===1?`day`:`days`}${i>1?`, from ${$(e,0)} to ${$(e,i-1)}`:``}.`),s.length&&n.push(`Highest is ${xq(e,l())} on ${$(e,l())}; lowest is ${xq(e,u())} on ${$(e,u())}.`),n.join(` `);case`funnel`:return n.push(`${nK.funnel} of ${o.label} in ${i} stages.`),i>1&&n.push(`${$(e,0)} is ${xq(e,0)} and ${$(e,i-1)} is ${xq(e,i-1)}, ${ZK(Q(e,o.key,i-1),Q(e,o.key,0))} of the start.`),n.join(` `);case`gauge`:{let t=Q(e,o.key,0),{min:r,max:i}=rq(e),a=t==null?null:tq(e,t);return n.push(`${nK.gauge}: ${o.label} is ${Z(t,o.format)} on a scale from ${Z(r,o.format)} to ${Z(i,o.format)}${a?`, in the ${a.label} band`:``}.`),n.join(` `)}case`waterfall`:{let t=iq(e);if(n.push(`${nK.waterfall} of ${o.label}.`),i>1){let r=t.filter(e=>!e.total);n.push(`It opens at ${Z(t[0].value,o.format)} and closes at ${Z(t[i-1].value,o.format)}.`);let a=r.reduce((e,t)=>t.value>(e?.value??0)?t:e,null),s=r.reduce((e,t)=>t.value<(e?.value??0)?t:e,null);a&&n.push(`The largest rise is ${$(e,a.index)}, ${lq(a.value,o.format)}.`),s&&n.push(`The largest fall is ${$(e,s.index)}, ${lq(s.value,o.format)}.`)}return n.join(` `)}case`treemap`:{let t=oq(e);if(!t.size)return`${nK.treemap} of ${o.label}: no items.`;let[r,a]=[...t].reduce((e,t)=>t[1]>e[1]?t:e);return n.push(`${nK.treemap} of ${o.label}: ${i} items in ${t.size} groups, ${Z(c,o.format)} in all.`),n.push(`${r} is the largest group, at ${ZK(a,c)}.`),n.join(` `)}case`sankey`:{let t=RK(e.data.flatMap(t=>[String(t[e.x.key]),String(t[e.to.key])])),r=l();return n.push(`${nK.sankey} of ${o.label}: ${i} flows between ${t.length} places.`),n.push(`The largest flow is ${$(e,r)} to ${LK(e,r)}, ${xq(e,r)}.`),n.join(` `)}case`scatter`:case`bubble`:{let r=zK(e).filter(e=>!t.has(e));n.push(`${nK[e.type]} of ${o.label} against ${e.x.label||e.x.key}, ${a.length} points${r.length?` in ${r.length} groups: ${r.join(`, `)}`:``}.`);let i=a.map(t=>e.data[t][e.x.key]).filter(OK),s=a.map(t=>Q(e,o.key,t)).filter(e=>e!=null);for(let t of[yq(e.x.label||String(e.x.key),i,e.x.format),yq(o.label,s,o.format)])t&&n.push(t);return n.join(` `)}default:break}let d=e.stack===`percent`?`, stacked to 100%`:e.stack===`stacked`?`, stacked`:``,f=e.series.filter(e=>!t.has(e.key));n.push(`${nK[e.type]} of ${f.map(e=>e.label).join(`, `)}${d}${e.type===`multiples`?`, sharing one x axis`:``}.`),i&&n.push(`${i} ${i===1?`point`:`points`}, ${i>1?`from ${$(e,0)} to ${$(e,i-1)}`:$(e,0)}.`);for(let t of f){let r=yq(t.label,XK(e,t.key),t.format);r&&n.push(r)}return n.join(` `)}var xq=(e,t)=>Z(Q(e,e.series[0].key,t),e.series[0].format);function Sq(e){return e.stack===`percent`?{style:`percent`,decimals:0}:HG(e.y.format)}var Cq=864e5,wq={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},Tq=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function Eq(e,t){let n=e.data.map((e,t)=>t).filter(n=>!WK(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>e.data[t][e.x.key];return n.sort((e,t)=>r(e)-r(t)||e-t)}function Dq(e){let t=RK(e.data.map((t,n)=>$(e,n))),n=zK(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf($(e,i))},${n.indexOf(IK(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf($(e,r)),n.indexOf(IK(e,r))]}}function Oq(e,t,n,r){if(n===`Escape`)return null;let i=e.data.length;if(!i)return t;if(e.type===`gauge`)return n in wq||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return kq(e,t,n);let a=Tq.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?Eq(e,r):null;if(a?!s.length:!o.length)return t;let c=t??{index:a?s[0]:0,series:a?0:o[0]};if(t==null&&n in wq)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:s[0],series:0}:n===`End`?{index:s[s.length-1],series:0}:n in wq?{index:s[(e+wq[n]+s.length)%s.length],series:0}:t}if(n===`Home`)return{...c,index:0};if(n===`End`)return{...c,index:i-1};if(!(n in wq))return t;if(e.type===`bar`?n===`ArrowUp`||n===`ArrowDown`:n===`ArrowLeft`||n===`ArrowRight`)return{...c,index:Math.min(i-1,Math.max(0,c.index+wq[n]))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?wq[n]:-wq[n];return{...c,series:o[Math.min(o.length-1,Math.max(0,l+u))]}}function kq(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>FK(e,t)-FK(e,n)):null,o=i?null:Dq(e),s=t??{index:i?a[0]:0,series:0};if(t==null&&n in wq)return s;if(n===`Home`)return{index:i?a[0]:0,series:0};if(n===`End`)return{index:i?a[r-1]:r-1,series:0};if(!(n in wq))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?wq[n]:wq[n]*7,r=t=>Math.floor((FK(e,t)+xG)/Cq),i=r(s.index),o=a.filter(e=>t>0?r(e)>i:r(e)<i);if(!o.length)return{index:s.index,series:0};let c=i+t;return{index:o.reduce((e,t)=>Math.abs(r(t)-c)<Math.abs(r(e)-c)?t:e),series:0}}let[c,l]=o.position(s.index),[u,d]=n===`ArrowLeft`||n===`ArrowRight`?[wq[n],0]:[0,wq[n]];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}Lj([dx,tT,ZT,EL,LI,EI,XF,yL,ZM,KR,gB,CV,ZB,_z,$R,DH,eH,wB,dU,RH,UW,pG]);var Aq=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],jq=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function Mq(e,t,n,r){let i=HG(e);if(i.style!==`compact`||!Number.isFinite(t)||!Number.isFinite(n))return i;let a=(n-t)/r;if(!(a>0)||a>=Math.max(Math.abs(t),Math.abs(n))*.02)return i;let o=Math.min(6,Math.max(0,Math.ceil(-Math.log10(a))));return i.currency?{style:`currency`,currency:i.currency,unit:i.unit,decimals:o}:{style:`number`,decimals:o}}var Nq=(e,t)=>{let n=e.filter(e=>e!=null&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},Pq=24,Fq=4,Iq=.6,Lq=(e,t)=>String(e).length*t*Iq;function Rq(e){let t=String(e??``).trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1].length===3?[...n[1]].map(e=>e+e).join(``):n[1];return[0,2,4].map(t=>Number.parseInt(e.slice(t,t+2),16))}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);return r?r.slice(1,4).map(Number):null}function zq(e,t){let n=Rq(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function Bq(e,t,n){let r=Rq(e),i=Rq(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+(i[t]-e)*n)).join(`,`)})`:e}var Vq=e=>e.map(e=>e/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,n)=>e+t*[.2126,.7152,.0722][n],0),Hq=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function Uq(e,t){let n=Rq(e),r=Rq(t.text),i=Rq(t.surface);return!n||!r||!i||Hq(Vq(n),Vq(r))>=Hq(Vq(n),Vq(i))?t.text:t.surface}var Wq=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:zq(e,t)},{offset:1,color:zq(e,0)}]}),Gq=e=>e+xG;function Kq(e){let t=e.x.format?.pattern;return e=>{let n=e-xG;if(t===`month`||t===`year`)return BG(n,{pattern:t});let r=zG(n);return r.hour||r.minute?BG(n,{pattern:`time`}):VG(n)}}function qq(e,t,n){let r=Fq,i=e=>n?e?[r,0,0,r]:[0,r,r,0]:e?[0,0,r,r]:[r,r,0,0];return e.data.map((n,r)=>{let a={};if(e.stack===`none`){for(let t of e.series)a[t.key]=i((Q(e,t.key,r)??0)<0);return a}let o=null,s=null;for(let n of e.series){let i=Q(e,n.key,r);t.has(n.key)||i==null||i===0||(i>0?o=n.key:s=n.key)}for(let t of e.series)a[t.key]=t.key===o?i(!1):t.key===s?i(!0):0;return a})}function Jq(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&BK(e)<=5e3,o=HK(e),s=Object.fromEntries(o.map(e=>[e,!r.hidden.has(e)])),c={palette:t.palette,neutral:t.neutral,seq:t.seq},l={backgroundColor:t.surface,borderColor:t.grid,borderWidth:1,padding:[10,12],confine:!0,className:`wui-chart-tooltip`,extraCssText:`box-shadow:${t.shadow};border-radius:10px;`,textStyle:{fontFamily:t.font,color:t.textBody,fontSize:12},transitionDuration:a?.25:0},u={backgroundColor:`transparent`,animation:a,animationDuration:1e3,animationEasing:`cubicOut`,animationDurationUpdate:650,animationEasingUpdate:`cubicInOut`,textStyle:{fontFamily:t.font,color:t.label},color:t.palette,legend:{show:!1,data:o,selected:s}},d={base:u,tooltipBase:l,colours:c,compact:i,animate:a},f=FJ[e.type];if(f)return f(e,t,n,r,d);let p=e.type===`bar`,m=e.x.kind===`time`,h=e.stack===`percent`?GK(e,r.hidden):null,g=p||e.type===`column`?qq(e,r.hidden,p):null,_=e.series.length===1,v=r.renderer===`canvas`,[y,b]=Nq(e.series.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))),!0),x=e.stack===`percent`?Sq(e):Mq(e.y.format,e.y.min??y,e.y.max??b,i?3:4),S=h?.some(e=>Object.values(e).some(e=>e!=null&&e<0))?-1:0,C=e.series.findIndex(e=>!r.hidden.has(e.key)),w={type:m?`time`:`category`,boundaryGap:!m&&(e.type===`column`||p),inverse:p,axisLine:{show:!0,lineStyle:{color:t.axis}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:t.label,fontSize:11,margin:12,hideOverlap:!0,...m?{formatter:Kq(e)}:{}},...m?{}:{data:e.data.map((t,n)=>$(e,n))}},T={type:`value`,splitNumber:i?3:4,min:e.stack===`percent`?S:e.y.min,max:e.stack===`percent`?1:e.y.max,interval:e.stack===`percent`?.25:void 0,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:t.grid,type:`solid`,width:1}},axisLabel:{color:t.label,fontSize:11,formatter:e=>Z(e,x)},...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,align:p?`right`:`left`}}:{}},E=e.zoom,D=_&&e.type!==`column`&&!p&&!i,O=e.series.map((n,r)=>{let o=t.palette[r],s=e.data.some((t,r)=>Q(e,n.key,r)!=null&&Q(e,n.key,r-1)==null&&Q(e,n.key,r+1)==null),c=t=>{let r=Q(e,n.key,t),i=h?h[t][n.key]:r;return m?[Gq(FK(e,t)),i]:i},l={id:n.key,name:n.key,stack:e.stack===`none`?void 0:`total`,emphasis:{focus:_?`none`:`series`,blurScope:`coordinateSystem`},blur:{itemStyle:{opacity:.22},lineStyle:{opacity:.22},areaStyle:{opacity:.08}}};if(e.type===`line`||e.type===`area`){let n=e.type===`area`?_||e.stack!==`none`?t.dark?.34:.22:.1:0;return{...l,type:`line`,data:e.data.map((e,t)=>c(t)),smooth:.35,connectNulls:!1,symbol:`circle`,showSymbol:s,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:zq(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:n?{color:Wq(o,n)}:void 0,endLabel:D?{show:!0,formatter:e=>Z(Array.isArray(e.value)?e.value[1]:e.value,x),color:o,fontWeight:600,fontSize:12,distance:8,fontFamily:t.font,valueAnimation:a}:void 0,markLine:r===C?Yq(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:Pq,barCategoryGap:i?`28%`:`38%`,itemStyle:{color:o,borderColor:t.surface,borderWidth:e.stack===`none`?0:1},animationDelay:a?e=>e*45+r*110:0,data:e.data.map((e,t)=>({value:c(t),itemStyle:{borderRadius:g[t][n.key]}})),markLine:r===C?Yq(e,t,p,a):void 0}});return{...u,useUTC:m,grid:{left:4,right:D?64:i?8:16,top:e.y.label?28:12,bottom:E?44:4,outerBoundsMode:`same`},dataZoom:E?MJ(e,t,t.palette[0],r.zoom):void 0,tooltip:{...l,trigger:`axis`,axisPointer:e.type===`line`||e.type===`area`?{type:`line`,lineStyle:{color:t.axis}}:{type:`shadow`,shadowStyle:{color:zq(t.neutral,t.dark?.12:.1)}},formatter:t=>dq(cq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?T:w,yAxis:p?w:T,series:O}}function Yq(e,t,n,r){if(!e.target)return;let i=e.series[0].format;return{silent:!0,symbol:`none`,animation:r,lineStyle:{color:t.label,type:[5,4],width:1},label:{position:`insideEndTop`,formatter:()=>[e.target.label,Z(e.target.value,i)].filter(Boolean).join(` `),color:t.textMuted,fontSize:11,fontFamily:t.font,backgroundColor:t.surface,padding:[2,6],borderRadius:4},data:[n?{xAxis:e.target.value}:{yAxis:e.target.value}]}}function Xq(e,t,n,r,{base:i,tooltipBase:a,colours:o,compact:s}){let c=e.series[0],l=e.data.map((t,n)=>$(e,n)),u=e.data.reduce((t,n,i)=>t+(r.hidden.has(l[i])?0:Q(e,c.key,i)??0),0);return{...i,tooltip:{...a,trigger:`item`,formatter:t=>dq(cq(e,t.dataIndex,r.hidden,o))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(u,HG(c.format)),x:0,y:-10,align:`center`,verticalAlign:`middle`,fill:t.text,fontSize:s?18:22,fontWeight:650,fontFamily:t.font}},{type:`text`,style:{text:`Total`,x:0,y:14,align:`center`,verticalAlign:`middle`,fill:t.label,fontSize:12,fontFamily:t.font}}]}],series:[{id:c.key,name:c.key,type:`pie`,radius:s?[`50%`,`70%`]:[`54%`,`72%`],center:[`50%`,`50%`],padAngle:1.6,minAngle:3,startAngle:90,avoidLabelOverlap:!0,itemStyle:{borderRadius:6,borderColor:t.surface,borderWidth:2},animationType:`expansion`,animationDuration:1100,label:s?{show:!1}:{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:11.5,lineHeight:16,formatter:e=>`${e.name}\n${Z(e.percent/100,{style:`percent`,decimals:0})}`},labelLine:{length:10,length2:8,smooth:.2,lineStyle:{color:t.axis}},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:6,itemStyle:{shadowBlur:16,shadowColor:`rgba(0,0,0,0.18)`}},data:e.data.map((t,n)=>({name:l[n],value:Q(e,c.key,n)??0,itemStyle:{color:uq(e,n,o)}}))}]}}var Zq=e=>[...new Set(e)],Qq=(e,t)=>e.data.map((n,r)=>Q(e,t,r));function $q(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var eJ=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:11,margin:12,hideOverlap:!0},...n}),tJ=(e,t,n={})=>({type:`value`,splitNumber:4,axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:e.grid,type:`solid`,width:1}},axisLabel:{color:e.label,fontSize:11,formatter:t},...n});function nJ(e,t,n){return{type:`piecewise`,orient:`horizontal`,right:4,bottom:0,pieces:t.map((e,n)=>({gte:e.from,[n===t.length-1?`lte`:`lt`]:e.to,color:e.colour})),itemWidth:11,itemHeight:11,itemGap:3,itemSymbol:`roundRect`,showLabel:!1,text:[`More`,`Less`],textGap:8,selectedMode:!1,textStyle:{color:e.label,fontSize:11,fontFamily:e.font},...n}}function rJ(e,t,n,r,i){let a=e.series[0],o=Zq(e.data.map((t,n)=>$(e,n))),s=zK(e),c=QK(Qq(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:$q(i.tooltipBase,t=>dq(cq(e,t.dataIndex,r.hidden,i.colours))),xAxis:eJ(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:eJ(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:nJ(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf($(e,n)),s.indexOf(IK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderColor:t.surface,borderWidth:2,borderRadius:4},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}},progressive:0,animationDuration:800}]}}var iJ=7*864e5,aJ=e=>{let t=zG(e);return`${t.year}-${String(t.month+1).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`};function oJ(e,t){let n=e.data.map((t,n)=>FK(e,n)).filter(Number.isFinite),r=sJ(n),i=cJ(n),a=Math.ceil((i-r)/iJ)+1,o=Math.floor((t.height-62)/7),s=Math.max(lJ,Math.min(uJ,o,Math.floor((t.width-44)/a))),c=Math.max(1,Math.floor((t.width-44)/s));return{cell:s,from:a>c?i-(c-1)*iJ:r,to:i}}var sJ=e=>e.reduce((e,t)=>t<e?t:e,1/0),cJ=e=>e.reduce((e,t)=>t>e?t:e,-1/0),lJ=9,uJ=24;function dJ(e,t,n,r,i){let a=e.series[0],{cell:o,from:s,to:c}=oJ(e,n),l=QK(Qq(e,a.key),t.seq);return{...i.base,tooltip:$q(i.tooltipBase,t=>dq(cq(e,t.dataIndex,r.hidden,i.colours))),visualMap:nJ(t,l,{right:4}),calendar:{range:[aJ(s),aJ(c)],top:24,left:34,cellSize:[o,o],splitLine:{show:!1},itemStyle:{color:t.seq[0],borderColor:t.surface,borderWidth:o<16?2:3},dayLabel:{firstDay:1,nameMap:[``,`Mon`,``,`Wed`,``,`Fri`,``],color:t.label,fontSize:10,fontFamily:t.font,margin:8},monthLabel:{color:t.label,fontSize:11,fontFamily:t.font,margin:8},yearLabel:{show:!1}},series:[{type:`heatmap`,coordinateSystem:`calendar`,data:e.data.map((t,n)=>[aJ(FK(e,n)),Q(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function fJ(e,t,n,r,i){let a=e.series[0],o=eq(e.data.length,t.seq),s=Q(e,a.key,0);return{...i.base,tooltip:$q(i.tooltipBase,t=>dq(cq(e,t.dataIndex,r.hidden,i.colours))),series:[{type:`funnel`,sort:`none`,gap:3,left:0,right:0,top:4,bottom:4,minSize:`38%`,maxSize:`100%`,funnelAlign:`center`,animationDuration:900,itemStyle:{borderColor:t.surface,borderWidth:0,borderRadius:6},emphasis:{itemStyle:{shadowBlur:14,shadowColor:`rgba(0,0,0,0.18)`}},label:{show:!0,position:`inside`,fontFamily:t.font,lineHeight:17},data:e.data.map((n,r)=>{let i=Uq(o[r],t),c=Q(e,a.key,r),l=r?`${ZK(c,Q(e,a.key,r-1))} of previous step`:`${ZK(c,s)} of ${jq($(e,0))}`;return{name:$(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${jq($(e,r))}} {v|${jq(Z(c,a.format))}}\n{p|${r?l:`first stage`}}`,rich:{n:{color:i,fontSize:12.5,fontWeight:500,fontFamily:t.font},v:{color:i,fontSize:13,fontWeight:700,fontFamily:t.font},p:{color:zq(i,.78),fontSize:11,fontFamily:t.font}}}}})}]}}function pJ(e,t,n,r,i){let a=e.series[0],{min:o,max:s}=rq(e),c=Q(e,a.key,0),l=c??o,u=c==null?null:tq(e,c),d=t.palette[0],f=s-o||1,p=e.bands.length?e.bands.map((e,n)=>[Math.min(1,Math.max(0,(e.upTo-o)/f)),t.seq[1+Math.min(n,3)]]):[[1,t.grid]];return e.bands.length&&p[p.length-1][0]<1&&p.push([1,t.grid]),{...i.base,tooltip:$q(i.tooltipBase,()=>dq(cq(e,0,r.hidden,i.colours))),series:[{type:`gauge`,startAngle:215,endAngle:-35,min:o,max:s,radius:`96%`,center:[`50%`,`58%`],splitNumber:10,pointer:{show:!1},anchor:{show:!1},progress:{show:c!=null,width:14,roundCap:!0,itemStyle:{color:d,shadowBlur:i.animate?12:0,shadowColor:zq(d,.35)}},axisLine:{roundCap:!0,lineStyle:{width:14,color:p}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:!1},title:{offsetCenter:[0,`30%`],color:t.label,fontSize:12.5,fontFamily:t.font},detail:{valueAnimation:i.animate,offsetCenter:[0,`-4%`],fontFamily:t.font,formatter:e=>`{v|${jq(c==null?Z(null):Z(e,a.format))}}{u|/${jq(Z(s,a.format))}}${u?`\n{s|${jq(u.label)}}`:``}`,rich:{v:{fontSize:36,fontWeight:650,color:t.text,fontFamily:t.font,padding:[0,2,0,0]},u:{fontSize:14,color:t.label,fontFamily:t.font,padding:[12,0,0,0]},s:{fontSize:12,color:t.label,fontFamily:t.font,padding:[8,0,0,0]}}},data:[{value:l,name:e.data[0]?.[e.x.key]==null?a.label:$(e,0)}]}]}}function mJ(e){let t=cJ(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=sJ(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=cJ(e.filter(e=>!e.total).map(e=>Math.abs(e.value)));if(!(t>0)||!(n>t*.4)||!(r<t*.15))return null;let i=10**Math.floor(Math.log10(t))/10,a=Math.round(t*.08/i)*i,o=Math.floor(n*.965/i)*i;return o>a?{start:a,end:o}:null}var hJ=4,gJ=72;function _J(e,t,n,r){let i=r?10:11,a=r?10.5:12,o=Math.floor(n/Math.max(1,e.length)-hJ);return{nameSize:i,valueSize:a,category:cJ(e.flatMap(e=>String(e).split(/\s+/)).map(e=>Lq(e,i)))<=o?{interval:0,width:o,overflow:`break`}:{interval:0,rotate:45,width:gJ,overflow:`truncate`,hideOverlap:!0},showValues:t.every(e=>Lq(e,a)<=o)}}function vJ(e,t,n,r,i){let a=e.series[0],o=iq(e),s=Sq(e),c=mJ(o),l=t=>sq(e,t.index,i.colours),u=o.map(t=>$(e,t.index)),d=o.map(e=>e.total?Z(e.value,s):lq(e.value,s)),f=o.flatMap(e=>[e.from,e.to]),p=Math.max(Lq(Z(cJ(f),s),11),Lq(Z(sJ(f),s),11))+8,m=_J(u,d,n.width-p-12,i.compact);return{...i.base,grid:{left:4,right:8,top:28,bottom:4,outerBoundsMode:`same`},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`shadow`,shadowStyle:{color:zq(t.neutral,.1)}},formatter:t=>dq(cq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:eJ(t,u,{axisLabel:{color:t.label,fontSize:m.nameSize,margin:12,...m.category}}),yAxis:tJ(t,e=>Z(e,s),{min:0,splitNumber:5,...c?{breaks:[{start:c.start,end:c.end,gap:`6%`}],breakArea:{show:!0,itemStyle:{color:t.surface,borderColor:t.axis,borderWidth:1,borderType:`solid`,opacity:1},zigzagAmplitude:3,zigzagZ:200}}:{}}),series:[{type:`line`,step:`end`,data:o.map(e=>e.level),symbol:`none`,silent:!0,z:1,lineStyle:{color:t.axis,width:1},tooltip:{show:!1},animation:!1,emphasis:{disabled:!0}},{type:`bar`,stack:`w`,data:o.map(e=>Math.min(e.from,e.to)),silent:!0,itemStyle:{color:`transparent`},emphasis:{disabled:!0},tooltip:{show:!1},barMaxWidth:48},{name:a.key,type:`bar`,stack:`w`,z:3,barMaxWidth:48,barCategoryGap:`34%`,itemStyle:{borderRadius:5},emphasis:{itemStyle:{shadowBlur:10,shadowColor:`rgba(0,0,0,0.15)`}},animationDelay:i.animate?e=>e*140:0,label:{show:m.showValues,position:`top`,distance:6,fontFamily:t.font,fontSize:m.valueSize,fontWeight:600,color:t.text,formatter:e=>d[e.dataIndex]},data:o.map(e=>({value:Math.abs(e.to-e.from),itemStyle:{color:l(e)}}))}]}}function yJ(e){let t=e.series[0].key;return zK(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>IK(e,t)===n).sort((n,r)=>Q(e,t,r)-Q(e,t,n)||n-r)}))}function bJ(e,t,n,r,i){let a=e.series[0],o=oq(e),s=[...o.values()].reduce((e,t)=>e+t,0),c=(e,t)=>{let r=e/s*n.width*n.height*.82;return r>5200&&Math.max(Lq(t[0],12),Lq(t[1],11.5))+20<=Math.sqrt(r)},l=yJ(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=t.palette[i%t.palette.length],u=Uq(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${jq(n)}} {v|${jq(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:zq(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=Bq(l,t.surface,Math.min(.55,r*.14)),o=Uq(i,t),s=Q(e,a.key,n);return{name:$(e,n),value:s,row:n,itemStyle:{color:i},label:{show:c(s,[$(e,n),Z(s,a.format)]),formatter:`{n|${jq($(e,n))}}\n{v|${jq(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:zq(o,.82),fontSize:11.5,fontFamily:t.font}}}}})}});return{...i.base,tooltip:$q(i.tooltipBase,t=>t.data?.row==null?dq({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:`Share of all`,value:ZK(t.value,s)}],foot:``}):dq(cq(e,t.data.row,r.hidden,i.colours))),series:[{type:`treemap`,roam:!1,nodeClick:!1,breadcrumb:{show:!1},left:0,right:0,top:0,bottom:0,animationDurationUpdate:700,label:{show:!0,position:`insideTopLeft`,padding:[8,10],overflow:`truncate`,fontFamily:t.font},upperLabel:{show:!0,height:28,padding:[0,10],fontFamily:t.font},levels:[{itemStyle:{borderWidth:0,gapWidth:4,borderColor:t.surface}},{itemStyle:{borderWidth:3,gapWidth:2,borderRadius:8}},{itemStyle:{borderWidth:0,gapWidth:0,borderRadius:5},emphasis:{itemStyle:{borderColor:t.text,borderWidth:0}}}],data:l}]}}function xJ(e){let t=e.data.map(t=>[String(t[e.x.key]),String(t[e.to.key])]),n=new Map(t.flatMap(([e,t])=>[[e,0],[t,0]]));for(let e=0;e<n.size;e+=1)for(let[e,r]of t)n.set(r,Math.max(n.get(r),n.get(e)+1));return n}function SJ(e,t,n,r,i){let a=e.series[0],o=aq(e,t.palette),s=xJ(e),c=cJ([...s.values()]),l=new Map,u=new Map;e.data.forEach((t,n)=>{let r=Q(e,a.key,n)??0;l.set(String(t[e.x.key]),(l.get(String(t[e.x.key]))??0)+r),u.set(String(t[e.to.key]),(u.get(String(t[e.to.key]))??0)+r)});let d=e=>u.get(e)??l.get(e)??0,f=e=>({position:e,color:t.text,fontFamily:t.font,fontSize:i.compact?11:12,formatter:e=>`{n|${jq(e.name)}}\n{v|${Z(d(e.name),{style:`compact`})}}`,rich:{n:{color:t.textBody,fontSize:i.compact?11:12,fontFamily:t.font,lineHeight:15},v:{color:t.label,fontSize:11,fontFamily:t.font}}});return{...i.base,tooltip:$q(i.tooltipBase,t=>dq(t.dataType===`edge`?cq(e,t.dataIndex,r.hidden,i.colours):{title:t.name,rows:[{color:t.color,label:a.label,value:Z(d(t.name),a.format)}],foot:``})),series:[{type:`sankey`,left:0,right:0,top:6,bottom:6,nodeWidth:10,nodeGap:i.compact?10:14,nodeAlign:`justify`,draggable:!1,layoutIterations:64,animationDuration:1200,emphasis:{focus:`adjacency`,lineStyle:{opacity:.55}},itemStyle:{borderWidth:0,borderRadius:3},lineStyle:{curveness:.5},levels:Array.from({length:c+1},(e,t)=>({depth:t,label:f(t===c&&c>0?`left`:`right`)})),data:[...s.keys()].map(e=>({name:e,itemStyle:{color:o.get(e)}})),links:e.data.map(n=>({source:String(n[e.x.key]),target:String(n[e.to.key]),value:n[a.key],lineStyle:{color:o.get(String(n[e.x.key])),opacity:t.dark?.32:.26}}))}]}}function CJ(e){let t=e.length,n=e.reduce((e,t)=>e+t[0],0)/t,r=e.reduce((e,t)=>e+t[1],0)/t,i=e.reduce((e,t)=>e+(t[0]-n)**2,0);if(!t||!i)return null;let a=e.reduce((e,t)=>e+(t[0]-n)*(t[1]-r),0)/i,o=sJ(e.map(e=>e[1])),s=cJ(e.map(e=>e[1])),c=e=>{let t=r+a*(e-n);return t<o?[e+(o-t)/a,o]:t>s?[e+(s-t)/a,s]:[e,t]};return[c(sJ(e.map(e=>e[0]))),c(cJ(e.map(e=>e[0])))]}var wJ=44,TJ=28,EJ=8;function DJ(e,t,n,r,i){let a=e.series[0],o=zK(e),s=e.type===`bubble`,c=cJ(s?e.data.map(t=>t[e.size.key]):[]),l=e=>Math.max(EJ,(i.compact?TJ:wJ)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||IK(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?CJ(d.map(t=>[e.data[t][e.x.key],Q(e,a.key,t)])):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>Q(e,a.key,n)),[h,g]=Nq(p,!1),[_,v]=Nq(m,!1),y=Mq(e.y.format,e.y.min??_,e.y.max??v,4),b=Mq(e.x.format,h,g,4),x=(e.group?o:[null]).map((n,r)=>({name:n??a.key,type:`scatter`,symbolSize:s?e=>l(e[2]):i.compact?8:10,itemStyle:{color:zq(t.palette[r],.85),borderColor:t.surface,borderWidth:1.5},emphasis:{focus:`series`,scale:1.5,itemStyle:{color:t.palette[r]}},blur:{itemStyle:{opacity:.15}},animationDelay:i.animate?e=>e*6+r*120:0,data:u(n).map(t=>({value:[e.data[t][e.x.key],Q(e,a.key,t),...s?[e.data[t][e.size.key]]:[]],row:t}))}));return f&&x.push({name:`Trend`,type:`line`,data:f,symbol:`none`,silent:!0,z:1,tooltip:{show:!1},lineStyle:{color:t.label,width:1.5,type:[6,4]},emphasis:{disabled:!0},endLabel:{show:!0,formatter:`Trend`,color:t.label,fontSize:11,fontFamily:t.font,offset:[-30,-12]}}),{...i.base,grid:{left:4,right:16,top:e.y.label?28:12,bottom:e.x.label?24:4,outerBoundsMode:`same`},tooltip:$q(i.tooltipBase,t=>t.data?.row==null?``:dq(cq(e,t.data.row,r.hidden,i.colours))),xAxis:tJ(t,e=>Z(e,b),{scale:!0,splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:t.axis}},...e.x.label?{name:e.x.label,nameLocation:`middle`,nameGap:28,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font}}:{}}),yAxis:tJ(t,e=>Z(e,y),{min:e.y.min,max:e.y.max,...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:11,fontFamily:t.font,align:`left`}}:{}}),series:x}}var OJ=32,kJ=8,AJ=26;function jJ(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-AJ)/o,c=s-OJ-kJ,l=t.palette[0],u=e.data.map((t,n)=>$(e,n)),d=e.series.flatMap((n,r)=>{let i=Qq(e,n.key).filter(e=>e!=null).pop();return[{text:n.label,left:0,top:6+r*s,textStyle:{fontSize:12.5,fontWeight:600,color:t.text,fontFamily:t.font}},{text:`Latest ${Z(i,n.format)}`,right:8,top:7+r*s,textStyle:{fontSize:12,fontWeight:500,color:t.label,fontFamily:t.font}}]}),f=(t,n)=>{let r=Q(e,t.key,n);return a?[Gq(FK(e,n)),r]:r};return{...i.base,useUTC:a,title:d,grid:e.series.map((e,t)=>({left:52,right:8,top:6+t*s+OJ,height:c})),axisPointer:{link:[{xAxisIndex:`all`}],lineStyle:{color:t.axis},label:{show:!1}},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`line`,lineStyle:{color:t.axis}},formatter:t=>dq(cq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:eJ(t,u,{boundaryGap:!1}),gridIndex:r,axisLine:{lineStyle:{color:r===o-1?t.axis:t.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:r===o-1,color:t.label,fontSize:11,hideOverlap:!0,margin:10,...a?{formatter:Kq(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=Nq(Qq(e,n.key),!1),o=Mq(n.format,e.y.min??i,e.y.max??a,2);return tJ(t,e=>Z(e,o),{gridIndex:r,splitNumber:2,scale:e.y.min==null,min:e.y.min,max:e.y.max,axisLabel:{color:t.label,fontSize:10.5,formatter:e=>Z(e,o)}})}),series:e.series.map((n,r)=>({id:n.key,name:n.key,type:`line`,xAxisIndex:r,yAxisIndex:r,data:e.data.map((e,t)=>f(n,t)),smooth:.3,symbol:`circle`,showSymbol:!1,symbolSize:7,lineStyle:{width:1.75,color:l},itemStyle:{color:l,borderColor:t.surface,borderWidth:2},areaStyle:{color:Wq(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function MJ(e,t,n,r){let i=r?.start??(e.data.length>5e3?70:0),a=r?.end??100;return[{type:`inside`,start:i,end:a},{type:`slider`,start:i,end:a,height:26,bottom:8,left:52,right:12,borderColor:`transparent`,backgroundColor:t.grid,borderRadius:6,fillerColor:zq(n,t.dark?.22:.12),handleStyle:{color:t.surface,borderColor:t.axis},moveHandleSize:0,brushSelect:!1,dataBackground:{lineStyle:{color:t.axis,width:.75},areaStyle:{color:zq(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:zq(n,.18)}},textStyle:{color:t.label,fontSize:11,fontFamily:t.font}}]}function NJ(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=IK(e,n),r=e.data.map((e,t)=>t).filter(n=>IK(e,n)===t);return{seriesIndex:zK(e).indexOf(t),dataIndex:r.indexOf(n)}}case`waterfall`:return{seriesIndex:2,dataIndex:n};case`sankey`:return{seriesIndex:0,dataIndex:n,dataType:`edge`,tip:!1};case`treemap`:{let t=1;for(let r of yJ(e)){let e=r.rows.indexOf(n);if(e>=0)return{seriesIndex:0,dataIndex:t+1+e};t+=1+r.rows.length}return{seriesIndex:0,dataIndex:n}}case`gauge`:case`donut`:case`heatmap`:case`calendar`:case`funnel`:return{seriesIndex:0,dataIndex:n};default:return{seriesIndex:t,dataIndex:n}}}function PJ(e,t){switch(e.type){case`scatter`:case`bubble`:return t.data?.row==null?null:{series:0,row:t.data.row};case`treemap`:return t.data?.row==null?null:{series:0,row:t.data.row};case`sankey`:return t.dataType===`edge`?{series:0,row:t.dataIndex}:null;case`waterfall`:return t.seriesIndex===2?{series:0,row:t.dataIndex}:null;case`line`:case`area`:case`column`:case`bar`:case`multiples`:return{series:t.seriesIndex,row:t.dataIndex};default:return{series:0,row:t.dataIndex}}}var FJ={donut:Xq,heatmap:rJ,calendar:dJ,funnel:fJ,gauge:pJ,waterfall:vJ,treemap:bJ,sankey:SJ,scatter:DJ,bubble:DJ,multiples:jJ};function IJ(e,t,n,r,{pixelRatio:i=2}={}){let a=document.createElement(`div`);a.style.cssText=`position:fixed;left:-10000px;top:0;width:${n.width}px;height:${n.height}px;`,document.body.append(a);let o=_j(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(Jq(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function LJ(e,{renderer:t}){let n=_j(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?n.getOption()?.dataZoom?.[0]:null,l=Number.isFinite(c?.start)&&Number.isFinite(c?.end)?{start:c.start,end:c.end}:null,u=Jq(e,t,a,{...o,zoom:l});i=e,n.setOption(u,s||!r?{notMerge:!0}:{replaceMerge:Aq}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=NJ(i,e,t);n.dispatchAction({type:`downplay`}),n.dispatchAction({type:`highlight`,...a}),r&&n.dispatchAction({type:`showTip`,...a})},clearFocus(){n.dispatchAction({type:`hideTip`}),n.dispatchAction({type:`downplay`})},resize(){n.resize()},onSelect(e){n.on(`click`,t=>{if(t.componentType!==`series`)return;let n=PJ(i,t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var RJ=typeof HTMLElement>`u`?class{}:HTMLElement,zJ=`wui-chart:select`,BJ=`wui-chart:legend-change`,VJ=`wui-chart:ready`,HJ=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],UJ=`(prefers-color-scheme: dark)`,WJ=`(prefers-reduced-motion: reduce)`,GJ=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,KJ=!1;function qJ(e){let t=getComputedStyle(e),n=e=>t.getPropertyValue(e).trim(),r=e.closest(`[data-bs-theme], [data-theme]`)??document.documentElement,i=r.getAttribute(`data-bs-theme`)||r.getAttribute(`data-theme`),a={palette:[1,2,3,4,5,6,7,8].map(e=>n(`--wui-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>n(`--wui-chart-seq-${e}`)),neutral:n(`--wui-chart-neutral`),grid:n(`--wui-chart-grid`),axis:n(`--wui-chart-axis`),label:n(`--wui-chart-label`),surface:n(`--color-surface`),text:n(`--color-text`),textBody:n(`--color-text-body`),textMuted:n(`--color-text-muted`),shadow:n(`--wui-shadow-overlay`),font:t.fontFamily,dark:i===`dark`||i===`auto`&&!!GJ(UJ)?.matches,reducedMotion:!!GJ(WJ)?.matches};return!a.palette[0]&&!KJ&&(KJ=!0,console.warn(`[@webority/ui-elements] <wui-chart> found no --wui-chart-* colours: load @webority/theme on the page.`)),a}var JJ=new Set,YJ=null;function XJ(e){if(JJ.add(e),YJ)return;let t=()=>{for(let e of JJ)e._themeChanged()},n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-bs-theme`,`class`]});let r=new MutationObserver(t);r.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:[`data-theme`,`data-bs-theme`]});let i=[GJ(UJ),GJ(WJ)].filter(Boolean);for(let e of i)e.addEventListener?.(`change`,t);YJ=()=>{n.disconnect(),r.disconnect();for(let e of i)e.removeEventListener?.(`change`,t);YJ=null}}function ZJ(e){JJ.delete(e),JJ.size||YJ?.()}function QJ(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var $J=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r},eY=0,tY=class extends RJ{static get observedAttributes(){return[`view`]}constructor(){super(),eY+=1,this.uid=`wui-chart-${eY}`,this._spec=null,this._normal=null,this._hidden=new Set,this._focus=null}get spec(){return this._spec}set spec(e){this._spec=e??null,this._normal=null,this._clearFocus(),this._parts&&this._update()}get view(){return this.getAttribute(`view`)===`table`?`table`:`chart`}set view(e){this.setAttribute(`view`,String(e??`chart`))}connectedCallback(){if(Object.hasOwn(this,`spec`)){let e=this.spec;delete this.spec,this._spec=e??null}this._spec??=this._readScript(),this._spec==null&&!this.querySelector(`:scope > script[type='application/json']`)&&(this._awaitingSpec=!0,queueMicrotask(()=>{this._awaitingSpec=!1,this._parts&&this._update()})),this._build(),XJ(this),this._theme=qJ(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`?(this._visible=!1,this._intersection=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this._intersection.disconnect(),this._visible=!0,this._update())},{threshold:.05}),this._intersection.observe(this)):this._visible=!0,this._update()}disconnectedCallback(){ZJ(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null}attributeChangedCallback(e,t,n){t===n||!this._parts||(TK(`view`,n,JG),this._update())}toCsv(){let{spec:e}=this._normalized();return e?_q(e):``}toPng(){let{spec:e}=this._normalized();return e?IJ(e,this._theme??qJ(this),this._size(e),{hidden:this._hidden,renderer:VK(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));QJ(t,e??`${vq(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&QJ(t,e??`${vq(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return console.error(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e?.message),null}}_normalized(){return this._normal??=AK(this._spec),this._normal}_build(){let e=$J(`div`,`wui-chart-legend`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Legend`),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target.closest?.(`.wui-chart-legend-item`);t&&this._toggle(t.dataset.key)});let t=$J(`div`,`wui-chart-surface`);t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,`chart`),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=$J(`div`,`wui-chart-canvas`);n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=$J(`div`,`wui-chart-state`);r.setAttribute(`role`,`status`),r.hidden=!0;let i=$J(`div`,`wui-chart-table-wrap visually-hidden`),a=$J(`p`,`visually-hidden`);a.id=`${this.uid}-summary`;let o=$J(`div`,`visually-hidden`);o.setAttribute(`aria-live`,`polite`),this.replaceChildren(e,t,r,i,a,o),this.setAttribute(`role`,`figure`),this.setAttribute(`aria-describedby`,a.id),this._parts={legend:e,surface:t,canvas:n,state:r,tableWrap:i,summary:a,live:o},this._legendSignature=null,this._tableSpec=null}_size(e){return{width:this._parts?.surface.clientWidth||this.clientWidth||800,height:e.height}}_update(){if(!this._parts||this._awaitingSpec&&this._spec==null)return;let{spec:e,problem:t}=this._normalized(),n=this._parts,r=t?`error`:e.state===`ready`&&(!e.data.length||!PK(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e&&(r===`ready`||r===`loading`&&this._drawn),s=r===`loading`&&o;if(this.setAttribute(`aria-label`,e?.title||`Chart`),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,`${e?.title||`Chart`}: use the arrow keys to read the values`),n.summary.textContent=e?bq(e,this._hidden):``,e){if(!s){let t=new Set(HK(e));for(let e of this._hidden)t.has(e)||this._hidden.delete(e)}this._renderTable(e)}else n.tableWrap.replaceChildren();s||this._renderLegend(e,o&&!a),this._renderState(r,t??(r===`error`?e.errorText:e?.emptyText),i,o);let c=n.surface.hidden&&o&&!a;n.surface.hidden=!o||a,n.surface.style.height=i,n.tableWrap.className=a&&e?`wui-chart-table-wrap`:`wui-chart-table-wrap visually-hidden`,n.tableWrap.style.height=a&&e?i:``,a&&e?(n.tableWrap.tabIndex=0,n.tableWrap.setAttribute(`role`,`region`),n.tableWrap.setAttribute(`aria-label`,`${e.title||`Chart`} data`)):(n.tableWrap.removeAttribute(`tabindex`),n.tableWrap.removeAttribute(`role`),n.tableWrap.removeAttribute(`aria-label`)),c&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts.state,a=!r&&e!==`ready`;if(i.hidden=!a,!a){i.replaceChildren();return}i.style.height=n,e===`loading`?i.replaceChildren($J(`div`,`skeleton wui-chart-skeleton`),$J(`span`,`visually-hidden`,`Loading chart`)):i.replaceChildren($J(`p`,`wui-chart-state-text`,t))}_colour(e,t){return e.type===`donut`?sq(e,t,this._theme):this._theme.palette[t]}_renderLegend(e,t){let n=this._parts.legend,r=e?HK(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!i)return;let a=UK(e),o=r.map((t,n)=>this._colour(e,n)),s=JSON.stringify([e.type,r,a,o]);s!==this._legendSignature&&(this._legendSignature=s,n.replaceChildren(...r.map((t,n)=>{let r=$J(`button`,`wui-chart-legend-item`);r.type=`button`,r.dataset.key=t;let i=$J(`span`,e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`);return i.style.background=o[n],r.append(i,$J(`span`,`wui-chart-legend-label`,a[n])),r})));for(let e of n.children)e.setAttribute(`aria-pressed`,String(!this._hidden.has(e.dataset.key)))}_renderTable(e){if(this._tableSpec===e)return;this._tableSpec=e;let t=mq(e),n=$J(`table`,`wui-chart-table`);n.append($J(`caption`,`visually-hidden`,t.caption));let r=$J(`tr`);t.head.forEach((e,t)=>{let n=$J(`th`,t?`wui-chart-num`:null,e);n.scope=`col`,r.append(n)});let i=$J(`thead`);i.append(r),n.append(i);let a=$J(`tbody`);for(let e of t.rows){let t=$J(`tr`),n=$J(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>$J(`td`,`wui-chart-num`,e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push($J(`p`,`wui-chart-table-note`,`Showing the first ${t.rows.length} of ${t.total} rows. Download the CSV for all of them.`)),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized(),t=VK(e),n=e.type!==this._drawnType;this._engine&&this._engine.renderer!==t&&(this._engine.dispose(),this._engine=null);let r=`${e.height}px`,i=this._parts.canvas.style.height!==r;this._parts.canvas.style.height=r,i&&this._engine?.resize(),this._engine||(this._engine=LJ(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(VJ,{bubbles:!0,detail:{renderer:t}})))}),n=!0),this._engine.render(e,this._theme,this._size(e),{hidden:this._hidden,renderer:t},{replace:n}),this._drawnType=e.type,this._drawn=!0}_themeChanged(){if(!this._parts)return;let e=qJ(this);JSON.stringify(e)!==JSON.stringify(this._theme)&&(this._theme=e,this._update())}_resized(){let e=this.clientWidth;e!==this._width&&(this._width=e,!(!this._engine||!this._drawn)&&(this._parts.surface.hidden||this._engine.resize(),this._update()))}_toggle(e){let{spec:t}=this._normalized();if(!t||e==null)return;this._hidden.has(e)?this._hidden.delete(e):this._hidden.add(e),this._clearFocus(),this._update();let n=Object.fromEntries(HK(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(BJ,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||this.view===`table`||e.altKey||e.ctrlKey||e.metaKey)return;if(e.key===`Enter`){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!HJ.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=Oq(t,this._focus,e.key,this._hidden);if(!n){this._clearFocus();return}this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(fq(cq(t,n.index,this._hidden,this._theme)))}_announce(e){let t=this._parts.live;t.textContent=e===t.textContent?`${e}\u00a0`:e}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized(),r=n?.series[iK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(zJ,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:Q(n,r.key,t),row:i,index:t}}))}};typeof customElements<`u`&&!customElements.get(`wui-chart`)&&customElements.define(`wui-chart`,tY);export{qG as CHART_STATES,UG as CHART_TYPES,JG as CHART_VIEWS,YG as MAX_SERIES,XG as MAX_SLICES,KG as RENDERERS,WG as STACK_MODES,tY as WuiChart,GG as X_KINDS,Z as formatValue,AK as normalizeSpec};