@webority/ui-elements 0.157.0 → 0.160.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WuiCarousel-BdhJLo1m.js +1 -0
- package/dist/{WuiCommentThread-BmRsl0K1.js → WuiCommentThread-CnwvJUDn.js} +1 -1
- package/dist/{WuiContextMenu-sPTmEEVn.js → WuiContextMenu-Re2CG8yT.js} +1 -1
- package/dist/{WuiMentionInput-8Xjkzdqg.js → WuiMentionInput-HwsLGhyr.js} +1 -1
- package/dist/{WuiPhone-BVNVerap.js → WuiPhone-NdIYg_Gb.js} +1 -1
- package/dist/{WuiSelect-BeWVthnD.js → WuiSelect-CWul-aM1.js} +2 -2
- package/dist/{WuiTree-0Yqu199O.js → WuiTree-JK4JqcBr.js} +1 -1
- package/dist/chips-DD_C4G0w.js +2 -0
- package/dist/elements/carousel.js +1 -1
- package/dist/elements/comment-thread.js +1 -1
- package/dist/elements/context-menu.js +1 -1
- package/dist/elements/mention-input.js +1 -1
- package/dist/elements/phone.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/tree.js +1 -1
- package/dist/listboxKeyNav-Bxkq7dvu.js +1 -0
- package/dist/{search-BSh_V66D.js → search-DMniXhEK.js} +1 -1
- package/dist/ui-chart.global.js +2 -2
- package/dist/ui-chart.js +2 -2
- package/dist/ui-elements/carousel.global.js +1 -1
- package/dist/ui-elements/code-block.global.js +1 -1
- package/dist/ui-elements/command-palette.global.js +1 -1
- package/dist/ui-elements/comment-thread.global.js +1 -1
- package/dist/ui-elements/consent-banner.global.js +1 -1
- package/dist/ui-elements/context-menu.global.js +1 -1
- package/dist/ui-elements/date-range.global.js +1 -1
- package/dist/ui-elements/drawer.global.js +1 -1
- package/dist/ui-elements/glyphs.global.js +1 -1
- package/dist/ui-elements/image-crop.global.js +1 -1
- package/dist/ui-elements/inline-edit.global.js +1 -1
- package/dist/ui-elements/kanban.global.js +1 -1
- package/dist/ui-elements/lead-popup.global.js +1 -1
- package/dist/ui-elements/lightbox.global.js +1 -1
- package/dist/ui-elements/markdown.global.js +1 -1
- package/dist/ui-elements/org-tree.global.js +1 -1
- package/dist/ui-elements/phone.global.js +1 -1
- package/dist/ui-elements/resizable.global.js +1 -1
- package/dist/ui-elements/saved-views.global.js +1 -1
- package/dist/ui-elements/select-chips.global.js +2 -2
- package/dist/ui-elements/select-recents.global.js +1 -1
- package/dist/ui-elements/select-search.global.js +1 -1
- package/dist/ui-elements/slider.global.js +1 -1
- package/dist/ui-elements/sortable.global.js +1 -1
- package/dist/ui-elements/status-icon.global.js +1 -1
- package/dist/ui-elements/timepicker.global.js +1 -1
- package/dist/ui-elements/tour.global.js +1 -1
- package/dist/ui-elements/tree.global.js +1 -1
- package/dist/ui-elements/wizard.global.js +1 -1
- package/dist/ui-elements.global.js +3 -3
- package/dist/ui-elements.js +1 -1
- package/package.json +4 -4
- package/dist/WuiCarousel-DthhDxH-.js +0 -1
- package/dist/chips-Br0I60dD.js +0 -2
- package/dist/listboxKeyNav-4LeEjKq6.js +0 -1
package/dist/ui-chart.global.js
CHANGED
|
@@ -17,5 +17,5 @@ var WeborityChart=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value
|
|
|
17
17
|
`)){var p=new iV;p.newline=!0,s.add(p)}else{var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,nV(cV,f,null,r,d)).on(`mouseover`,nV(lV,m.name,null,r,d)).on(`mouseout`,nV(uV,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=Zc(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=Br(h.fill);_&&_[3]===0&&(_[3]=.2,h=A(A({},h),{fill:Jr(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,nV(cV,null,f,r,d)).on(`mouseover`,nV(lV,null,f,r,d)).on(`mouseout`,nV(uV,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=Zc(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};Zc(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();rV(e,function(e){var r=e.type,i=new Wo({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),Yf(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),ou(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=oV(c,r,o,s,d,m,u),y=new iV,b=r.getModel(`textStyle`);if(V(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(sV({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;H(w)&&w?T=w.replace(`{name}`,t??``):V(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new Wo({style:Zf(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new zo({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&jf({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),ou(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();i_(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){i_(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(vO);function oV(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),rV(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:$k(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function sV(e){var t=e.icon||`roundRect`,n=Iv(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=Y.color.neutral00,n.style.lineWidth=2),n}function cV(e,t,n,r){uV(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),lV(e,t,n,r)}function lV(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function uV(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function dV(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),fV(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){F(i,function(t,n){e[t?`select`:`unSelect`](n)}),fV(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function fV(e,t){var n=t||{};return F(e.getData(),function(t){var r=t.get(`name`);if(r!==`
|
|
18
18
|
`&&r!==``){var i=e.isSelected(r);n[r]=Ae(n,r)?n[r]&&i:i}}),n}function pV(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,z(dV,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,z(dV,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,z(dV,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,z(dV,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,z(dV,`unSelect`))}var mV=Xc(hV);function hV(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 gV(e){e.registerComponentModel(tV),e.registerComponentView(aV),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,mV),e.registerSubTypeDefaulter(`legend`,function(){return`plain`}),pV(e)}var _V=function(e){a(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=h_(t);e.prototype.init.call(this,t,n,r),vV(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),vV(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=Oh(tV.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}(tV);function vV(e,t,n){var r=e.getOrient(),i=[1,1];i[r.index]=0,m_(t,n,{type:`box`,ignoreSize:!!i})}var yV=Vu,bV=[`width`,`height`],xV=[`x`,`y`],SV=function(e){a(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 yV),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new yV)},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=B(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new Wo({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=Cf(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:R(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=bV[s],l=xV[s],u=bV[1-s],d=xV[1-s];i&&i_(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=O(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;i_(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),i_(`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],_=W(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 zo({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&&Wd(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;F([`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`,H(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=bV[i],o=xV[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}(aV);function CV(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 wV(e){zj(gV),e.registerComponentModel(_V),e.registerComponentView(SV),CV(e)}function TV(e){zj(gV),zj(wV)}var EV=function(e){a(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=Oh(Mz.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Mz),DV=bc();function OV(e,t,n){DV(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function kV(e,t){for(var n=DV(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||AV(n,o))}}}function AV(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function jV(e,t){var n={model:t,containsPoint:z(NV,t),dispatchAction:z(MV,e),dataZoomInfoMap:null,controller:null},r=n.controller=new iN(e.getZr());return F([`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 MV(e,t){e.isDisposed()||e.dispatchAction({type:`dataZoom`,animation:{easing:`cubicOut`,duration:100},batch:t})}function NV(e,t,n,r){return e.coordinateSystem.containPoint([n,r])}function PV(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=W(t.get(`cursorGrab`,!0),s),c=W(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 FV(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=DV(t),r=n.coordSysRecordMap||=G();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){F(Ez(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,jV(t,n.model));(a.dataZoomInfoMap||=G()).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)AV(r,e);else{var s=PV(a,e,t);n.enable(s.controlType,s.opt),Cw(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)}})})}var IV=function(e){a(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){e.prototype.render.apply(this,arguments),t.noTarget()?this._clear():(this.range=t.getPercentRange(),OV(r,t,{pan:R(LV.pan,this),zoom:R(LV.zoom,this),scrollMove:R(LV.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){kV(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(Pz),LV={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=zV[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(BI(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:RV(function(e,t,n,r,i,a){var o=zV[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:RV(function(e,t,n,r,i,a){return zV[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function RV(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(BI(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 zV={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 BV(e){zz(e),e.registerComponentModel(EV),e.registerComponentView(IV),FV(e)}var VV=function(e){a(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=Oh(Mz.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}(Mz),HV=zo,UV=1,WV=30,GV=7,KV=`horizontal`,qV=`vertical`,JV=5,YV=[`line`,`bar`,`candlestick`,`scatter`],XV={easing:`cubicOut`,duration:100,delay:0},ZV=function(e){a(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=R(this._onBrush,this),this._onBrushEnd=R(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){e.prototype.render.apply(this,arguments),Cw(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1?this.group.removeAll():t.noTarget()?(this._clear(),this.group.removeAll()):(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(){ww(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 Vu;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`)?GV:0,r=u_(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===KV?{right:r.width-i.x-i.width,top:r.height-WV-a-n,width:i.width,height:WV}:{right:a,top:i.y,width:WV,height:i.height},s=h_(e.option);F([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=c_(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===qV&&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===KV&&!i?{scaleY:o?1:-1,scaleX:1}:n===KV&&i?{scaleY:o?1:-1,scaleX:-1}:n===qV&&!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 HV({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new HV({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:R(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);else{y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:vs(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 Vu,r=new md({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new gd({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){F(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&N(YV,e.get(`type`))<0)){var o=r.getComponent(wz(i),a).axis,s=$V(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 HV({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new HV({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:UV,fill:Y.color.transparent}})),F([0,1],function(t){var a=o.get(`handleIcon`);!Nv[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Iv(a,-1,0,2,2,null,!0);s.attr({cursor:eH(this._orient),draggable:!0,drift:R(this._onDragMove,this,t),ondragend:R(this._onDragEnd,this),onmouseover:R(this._onOverDataInfoTriggerArea,this,!0),onmouseout:R(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=J(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(),ou(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 Wo({silent:!0,invisible:!f,style:Zf(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=J(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new zo({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=Iv(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 zo({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:R(this._onActualMoveZoneDrift,this),ondragstart:R(this._onActualMoveZoneDragStart,this),ondragend:R(this._onActualMoveZoneDragEnd,this),onmouseover:R(this._onOverDataInfoTriggerArea,this,!0),onmouseout:R(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[vs(e[0],[0,100],t,!0),vs(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];BI(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:vs(a.minSpan,o,i,!0),a.maxSpan==null?null:vs(a.maxSpan,o,i,!0));var s=this._range,c=this._range=ws([vs(r[0],i,o,!0),vs(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=ws(n.slice()),i=this._size;F([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 zo,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=Az(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=[QV(t,0,l,s),QV(t,1,l,s)]}}var p=ws(this._handleEnds.slice());m.call(this,0),m.call(this,1);function m(e){var t=hf(n.handles[e].parent,this.group),o=_f(e===0?`right`:`left`,t),s=this._handleWidth/2+JV,c=gf([p[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===KV?`middle`:o,align:i===KV?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,fE(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=gf([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 K(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();BI(0,a,r,0,o.minSpan==null?null:vs(o.minSpan,i,r,!0),o.maxSpan==null?null:vs(o.maxSpan,i,r,!0)),this._range=ws([vs(a[0],r,i,!0),vs(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(fE(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 HV({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?XV:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=Ez(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}(Pz);function QV(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)?``:Yy(r)||qy(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?Cs(o,a,!0):o+``;return V(i)?i(o,s):H(i)?i.replace(`{value}`,s):s}function $V(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function eH(e){return e===`vertical`?`ns-resize`:`ew-resize`}function tH(e){e.registerComponentModel(VV),e.registerComponentView(ZV),zz(e)}function nH(e){zj(BV),zj(tH)}var rH={get:function(e,t,n){var r=O((iH[e]||{})[t]);return n&&B(r)?r[r.length-1]:r}},iH={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]}},aH=DF.mapVisual,oH=DF.eachVisual,sH=B,cH=F,lH=ws,uH=vs,dH=function(e){a(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&&SB(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=R(e,this),this.controllerVisuals=xB(this.option.controller,t,e),this.targetVisuals=xB(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 cH(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=Ec(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return I(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){F(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||=[`<`,`>`],B(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return H(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):V(o)?s?o(e[0],e[1]):o(e):s?e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1]: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=lH([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=ie(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||={};k(r,n),k(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){sH(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]={},cH(r,function(e,t){if(DF.isValidType(t)){var n=rH.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`;cH(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&O(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&O(n)||(a?s[0]:[s[0],s[0]])),c.symbol=aH(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;oH(l,function(e){e>u&&(u=e)}),c.symbolSize=aH(l,function(e){return uH(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}(v_),fH=function(e){a(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){this.visualMapModel=e,e.get(`show`)===!1?this.group.removeAll():this.doRender(e,t,n,r)},t.prototype.renderBackground=function(e){var t=this.visualMapModel,n=Gg(t.get(`padding`)||0),r=e.getBoundingRect();e.add(new zo({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 F(DF.prepareVisualTypes(c),function(r){var i=c[r];n.convertOpacityToAlpha&&r===`opacity`&&(r=`colorAlpha`,i=c.__alphaForOpacity),DF.dependsOn(r,t)&&i&&i.applyVisual(e,o,s)}),a[t]},t.prototype.positionGroup=function(e){var t=this.visualMapModel,n=this.api,r=u_(t,n).refContainer;d_(e,t.getBoxLayoutParams(),r)},t.prototype.doRender=function(e,t,n,r){},t.type=`visualMap`,t}(vO),pH=[[`left`,`right`,`width`],[`top`,`bottom`,`height`]];function mH(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=pH[o],c=[0,null,10],l={},u=0;u<3;u++)l[pH[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=c_(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 hH(e,t){return F(e||[],function(e){e.dataIndex!=null&&(e.dataIndexInside=e.dataIndex,e.dataIndex=null),e.highlightKey=`visualMap`+(t?t.componentIndex:``)}),e}var gH={type:`selectDataRange`,event:`dataRangeSelected`,update:`update`},_H=function(e,t){t.eachComponent({mainType:`visualMap`,query:e},function(t){t.setSelected(e.selected)})},vH=[{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(CB(t.stateList,t.targetVisuals,R(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(R(yH,null,e,t))||{stops:[],outerColors:[]},a=t.getDataDimensionIndex(n);a>=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function yH(e,t,n,r){for(var i=t.targetVisuals[r],a=DF.prepareVisualTypes(i),o={color:tk(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 bH=F;function xH(e){var t=e&&e.visualMap;B(t)||(t=t?[t]:[]),bH(t,function(e){if(e){SH(e,`splitList`)&&!SH(e,`pieces`)&&(e.pieces=e.splitList,delete e.splitList);var t=e.pieces;t&&B(t)&&bH(t,function(e){U(e)&&(SH(e,`start`)&&!SH(e,`min`)&&(e.min=e.start),SH(e,`end`)&&!SH(e,`max`)&&(e.max=e.end))})}})}function SH(e,t){return e&&e.hasOwnProperty&&e.hasOwnProperty(t)}var CH=!1;function wH(e){CH||(CH=!0,e.registerSubTypeDefaulter(`visualMap`,function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(gH,_H),F(vH,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(xH))}var TH=function(e){a(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=[],EH[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=O(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=I(this._pieceList,function(e){return e=O(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=DF.listVisualTypes(),i=this.isCategory();F(t.pieces,function(e){F(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),F(n,function(e,n){var r=!1;F(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&F(this.stateList,function(e){(t[e]||(t[e]={}))[n]=rH.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,F(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;F(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=O(e)},t.prototype.getValueState=function(e){var t=DF.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){DF.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 F(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=Oh(dH.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}(dH),EH={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]}),Rs(e),F(e,function(e,t){e.index=t,e.text=this.formatValueText(e.interval)},this)},categories:function(e){var t=this.option;F(t.categories,function(t){e.push({text:this.formatValueText(t,!0),value:t})},this),DH(t,e)},pieces:function(e){var t=this.option;F(t.pieces,function(t,n){U(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=DF.retrieveVisuals(t),e.push(r)},this),DH(t,e),Rs(e),F(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 DH(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var OH=function(e){a(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),F(o.viewPieceList,function(o){var s=o.piece,u=new Vu;u.onclick=R(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 Wo({style:Zf(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:W(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),i_(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:hH(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return mH(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 Vu,o=this.visualMapModel.textStyleModel;a.add(new Wo({style:Zf(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=I(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=Iv(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=O(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,F(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}(fH);function kH(e){e.registerComponentModel(TH),e.registerComponentView(OH),wH(e)}function AH(e){if(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].slice());return t}}function jH(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:AH(r&&r.shape.points)}}var MH=[`align`,`verticalAlign`,`width`,`height`,`fontSize`],NH=new qn,PH=bc(),FH=bc();function IH(e,t,n){for(var r=0;r<n.length;r++){var i=n[r];t[i]!=null&&(e[i]=t[i])}}var LH=[`x`,`y`,`rotation`],RH=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();q.applyTransform(c,c,s),s?NH.setLocalTransform(s):(NH.x=NH.y=NH.rotation=NH.originX=NH.originY=0,NH.scaleX=NH.scaleY=1),NH.rotation=io(NH.rotation);var l=r.__hostTarget,u;if(l){u=l.getBoundingRect().plain();var d=l.getComputedTransform();q.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:NH.x,y:NH.y,scaleX:NH.scaleX,scaleY:NH.scaleY,rotation:NH.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`);(V(r)||L(r).length)&&e.group.traverse(function(e){if(e.ignore)return!0;var i=e.getTextContent(),a=Zc(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(){DT(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=V(a.layoutOptionOrCb)?a.layoutOptionOrCb(jH(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=J(l.x,t),o.setStyle(`x`,0),d=!0),l.y==null?(o.y=c.y,o.setStyle(`y`,c.style.y)):(o.y=J(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=PH(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<MH.length;m++){var h=MH[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=[];F(this._labelList,function(e){e.defaultAttr.ignore||r.push(OS({},e))});var i=re(r,function(e){return e.layoutOption.moveOverlap===`shiftX`}),a=re(r,function(e){return e.layoutOption.moveOverlap===`shiftY`});AS(i,0,0,t),AS(a,1,0,n);var o=re(r,function(e){return e.layoutOption.hideOverlap});jS(o),MS(o)},e.prototype.processLabelsOverall=function(){var e=this;F(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=PH(o).needsUpdateLabelLine),a&&e._updateLabelLine(t,n),i&&e._animateLabels(t,n)})})},e.prototype._updateLabelLine=function(e,t){var n=e.getTextContent(),r=Zc(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`);PT(e,FT(o),s),DT(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&&!Kd(e))){var i=PH(n),a=i.oldLayout,o=Zc(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&&(N(u,`select`)>=0&&n.attr(i.oldLayoutSelect),N(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),Wd(n,c,t,s)}else if(n.attr(c),!op(n).valueAnimation){var d=W(n.style.opacity,1);n.style.opacity=0,Gd(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};IH(f,c,LH),IH(f,n.states.select,LH)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};IH(p,c,LH),IH(p,n.states.emphasis,LH)}cp(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=FH(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),Wd(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,Gd(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),zH=bc();function BH(e){e.registerUpdateLifecycle(`series:beforeupdate`,function(e,t,n){var r=zH(t).labelManager;r||=zH(t).labelManager=new RH,r.clearLabels()}),e.registerUpdateLifecycle(`series:layoutlabels`,function(e,t,n){var r=zH(t).labelManager;F(n.updatedSeries,function(e){r.addLabelsOfSeries(t.getViewOfSeriesModel(e))}),r.updateLayoutConfig(t),r.layout(t),r.processLabelsOverall()})}var VH=function(){function e(t,n){Iy(this,e.decoratedMethods),this._outOfBrk=Hy(null,n);var r=this._linear=Hy(null,n);Ly(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){zc(t,n)&&(e===0&&GH(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=UH,r=WH,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=UH,r=WH,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 HH(e,t){return new VH(e,t)}var UH=0,WH=0;function GH(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()}};F(e.breaks,function(e){var i=e.gapParsed;i.type===`tpPrct`&&(n+=i.val);var o=JH(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));F(e.breaks,function(e){var t=e.gapParsed;t.type===`tpPrct`&&(e.gapReal=n===0?0:cs(o,0)*t.val/n),t.type===`tpAbs`&&(e.gapReal=t.val),e.gapReal??=0})}function KH(e,t,n,r,i,a){e!==`no`&&F(n,function(n){var o=JH(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 qH(e,t,n,r){F(t,function(t){var i=JH(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 JH(e,t){var n=cs(e.vmin,t[0]),r=ss(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 YH(e,t,n){var r=[];if(!e)return{breaks:r};function i(e,t){return e>=0&&e<.99999}F(e,function(e){if(e&&e.start!=null&&e.end!=null&&!e.isExpanded){var a={breakOption:O(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(H(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&&F([`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 F(r,function(e,t){a>e.vmin&&(r[t]=null),a=e.vmax}),{breaks:re(r,function(e){return!!e})}}function XH(e,t){return ZH(t)===ZH(e)}function ZH(e){return e.start+`_\0_`+e.end}function QH(e,t,n){var r=[];F(e,function(e,n){var i=t(e);i&&i.type===`vmin`&&r.push([n])}),F(e,function(n,i){var a=t(n);if(a&&a.type===`vmax`){var o=ie(r,function(n){return XH(t(e[n[0]]).parsedBreak.breakOption,a.parsedBreak.breakOption)});o&&o.push(i)}});var i=[];return F(r,function(t){t.length===2&&i.push(n?t:[e[t[0]],e[t[1]]])}),i}function $H(e,t,n,r){if(t.break){var i=t.break.parsedBreak,a=ie(n,function(e){return XH(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:O(a.gapParsed),gapReal:i.gapReal};return{tickVal:s[t.break.type],vBreak:{type:t.break.type,parsedBreak:s}}}}function eU(e,t,n,r,i){i.original=YH(e,t,n);var a=i.transformed=YH(e,t,n),o=i.lookup;a.breaks=I(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 tU={vmin:`start`,vmax:`end`};function nU(e,t){return t&&(e||={},e.break={type:tU[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function rU(){ng({createBreakScaleMapper:HH,pruneTicksByBreak:KH,addBreaksToTicks:qH,parseAxisBreakOption:YH,identifyAxisBreak:XH,serializeAxisBreakIdentifier:ZH,retrieveAxisBreakPairs:QH,getTicksBreakOutwardTransform:$H,parseAxisBreakOptionInwardTransform:eU,makeAxisLabelFormatterParamBreak:nU})}var iU=bc();function aU(e,t){var n=ie(e,function(e){return rg().identifyAxisBreak(e.parsedBreak.breakOption,t.breakOption)});return n||e.push(n={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),n}function oU(e){F(e,function(e){return e.shouldRemove=!0})}function sU(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function cU(e,t,n,r,i){var a=n.axis;if(a.scale.isBlank()||!rg())return;var o=rg().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 Vu({ignoreModelZ:!0}),y=a.isHorizontal(),b=iU(t).visualList||(iU(t).visualList=[]);oU(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=aU(b,t);s.shouldRemove=!1;var c=new Vu;C(s.zigzagRandomList,c,r[0],r[1],y,t),d&&c.on(`click`,function(){var e={type:LS,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),sU(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[$d[v]]+r[ef[v]];function b(e){var t=[],n=[];t[d]=n[d]=e,t[v]=r[$d[v]],n[v]=y;var i={x1:t[0],y1:t[1],x2:n[0],y2:n[1]};return Po(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[$d[v]],T=0;;T++){var E=w===r[$d[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=rg().serializeAxisBreakIdentifier(o.breakOption);if(t.add(new gd({anid:`break_a_`+j,shape:{points:x},style:s,z:f})),o.gapReal!==0){t.add(new gd({anid:`break_b_`+j,shape:{points:S},style:s,z:f}));var M=S.slice();M.reverse();var N=x.concat(M);t.add(new md({anid:`break_c_`+j,shape:{points:N},style:{fill:_,opacity:p.opacity},z:f}))}}}function lU(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=I(rg().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:rg().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&&(At(e,e,a),At(t,t,a))}function c(e,t){var n={x1:e[0],y1:e[1],x2:t[0],y2:t[1]};Po(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 yd(A({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 uU(e,t,n){if(ie(n,function(e){return!e}))return;var r=new K;if(!NS(n[0],n[1],r,{direction:-(e?t+Math.PI:t),touchThreshold:0,bidirectional:!1}))return;var i=st();ft(i,i,-t);var a=I(n,function(e){return e.transform?ut(st(),i,e.transform):i});function o(e){var t=n[0].localRect,r=new K(t[ef[e]]*a[0][0],t[ef[e]]*a[0][1]);return Math.abs(r.y)<1e-5}var s=.5;if(o(0)||o(1)){var c=I(n,function(e,t){var n=e.localRect.clone();return n.applyTransform(a[t]),n}),l=new K;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 K,h=new K;K.scale(m,r,-s),K.scale(h,r,1-s),DS(n[0],m),DS(n[1],h)}function dU(e,t){var n={breaks:[]};return F(t.breaks,function(r){if(r){var i=ie(e.get(`breaks`,!0),function(e){return rg().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 fU(){FS({adjustBreakLabelPair:uU,buildAxisBreakLine:lU,rectCoordBuildBreakAxis:cU,updateModelAxisBreak:dU})}function pU(e){GS(e),rU(),fU()}var mU=Math.sin,hU=Math.cos,gU=Math.PI,_U=Math.PI*2,vU=180/gU,yU=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=ti(u-_U)||(l?c>=_U:-c>=_U),f=c>0?c%_U:c%_U+_U,p=!1;p=d?!0:!ti(u)&&f>=gU==!!l;var m=e+n*hU(a),h=t+r*mU(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*vU);if(d){var _=1/this._p,v=(l?1:-1)*(_U-_);this._add(`A`,n,r,g,1,+l,e+n*hU(a+v),t+r*mU(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*hU(o),b=t+r*mU(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}(),bU=`none`,xU=Math.round;function SU(e){var t=e.fill;return t!=null&&t!==bU}function CU(e){var t=e.stroke;return t!=null&&t!==bU}var wU=[`lineCap`,`miterLimit`,`lineJoin`],TU=I(wU,function(e){return`stroke-`+e.toLowerCase()});function EU(e,t,n,r){var i=t.opacity==null?1:t.opacity;if(n instanceof jo)e(`opacity`,i);else{if(SU(t)){var a=$r(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`,bU);if(CU(t)){var s=$r(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=xk(n),p=f[0],m=f[1];p&&(m=xU(m||0),e(`stroke-dasharray`,p.join(`,`)),(m||r)&&e(`stroke-dashoffset`,m))}else r&&e(`stroke-dasharray`,bU);for(var h=0;h<wU.length;h++){var g=wU[h];if(r||t[g]!==So[g]){var _=t[g]||So[g];_&&e(TU[h],_)}}}else r&&e(`stroke`,bU)}}var DU=`http://www.w3.org/2000/svg`,OU=`http://www.w3.org/1999/xlink`,kU=`http://www.w3.org/2000/xmlns/`,AU=`http://www.w3.org/XML/1998/namespace`,jU=`ecmeta_`;function MU(e){return document.createElementNS(DU,e)}function NU(e,t,n,r,i){return{tag:e,attrs:n||{},children:r,text:i,key:t}}function PU(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 FU(e){return`</`+e+`>`}function IU(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 PU(i,a)+(i===`style`?o||``:Hh(o))+(t?``+n+I(t,function(e){return r(e)}).join(n)+n:``)+FU(i)}return r(e)}function LU(e,t,n){n||={};var r=n.newline?`
|
|
20
|
-
`:``,i=` {`+r,a=r+`}`,o=I(L(e),function(t){return t+i+I(L(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=I(L(t),function(e){return`@keyframes `+e+i+I(L(t[e]),function(n){return n+i+I(L(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 RU(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function zU(e,t,n,r){return NU(`svg`,`root`,{width:e,height:t,xmlns:DU,"xmlns:xlink":OU,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var BU=0;function VU(){return BU++}var HU={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`},UU=`transform-origin`;function WU(e,t,n){var r=A({},e.shape);A(r,t),e.buildPath(n,r);var i=new yU;return i.reset(gi(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function GU(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[UU]=n+`px `+r+`px`)}var KU={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function qU(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function JU(e,t,n){var r=e.shape.paths,i={},a,o;if(F(r,function(e){var t=RU(n.zrId);t.animation=!0,XU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=L(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=qU(i,n);return a.replace(o,s)}}function YU(e){return H(e)?HU[e]?`cubic-bezier(`+HU[e]+`)`:Tr(e)?e:``:``}function XU(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof Ed){var s=JU(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=YU(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=YU(d.easing),m=d.rawValue;(H(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={};Zn(g,e),A(g,s[h]);var _=_i(g),v=s[h][u];l[h]=_?{transform:_}:{},GU(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 $a);var S=y.len();y.reset(),l[h].d=WU(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 KU[e]})}for(var w=L(l),T=!0,E,f=1;f<w.length;f++){var D=w[f-1],O=w[f];if(l[D][UU]!==l[O][UU]){T=!1;break}E=l[D][UU]}if(T&&E){for(var h in l)l[h][UU]&&delete l[h][UU];t[UU]=E}if(re(w,function(e){return L(l[e]).length>0}).length)return qU(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-`+VU();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function ZU(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};QU(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=Zr(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),QU(r,t,n,!0)}}}function QU(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+VU(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var $U=Math.round;function eW(e){return e&&H(e.src)}function tW(e){return e&&V(e.toDataURL)}function nW(e,t,n,r){EU(function(i,a){var o=i===`fill`||i===`stroke`;o&&mi(a)?_W(t,e,i,r):o&&di(a)?vW(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),gW(n,e,r)}function rW(e,t){var n=yD(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[jU+`silent`]=`true`))}function iW(e){return ti(e[0]-1)&&ti(e[1])&&ti(e[2])&&ti(e[3]-1)}function aW(e){return ti(e[4])&&ti(e[5])}function oW(e,t,n){if(t&&!(aW(t)&&iW(t))){var r=n?10:1e4;e.transform=iW(t)?`translate(`+$U(t[4]*r)/r+` `+$U(t[5]*r)/r+`)`:ii(t)}}function sW(e,t,n){for(var r=e.points,i=[],a=0;a<r.length;a++)i.push($U(r[a][0]*n)/n),i.push($U(r[a][1]*n)/n);t.points=i.join(` `)}function cW(e){return!e.smooth}function lW(e){var t=I(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]]=$U(o*r)/r)}}}var uW={circle:[lW([`cx`,`cy`,`r`])],polyline:[sW,cW],polygon:[sW,cW]};function dW(e){for(var t=e.animators,n=0;n<t.length;n++)if(t[n].targetName===`shape`)return!0;return!1}function fW(e,t){var n=e.style,r=e.shape,i=uW[e.type],a={},o=t.animation,s=`path`,c=e.style.strokePercent,l=t.compress&&gi(e)||4;if(i&&!t.willUpdate&&(!i[1]||i[1](r))&&!(o&&dW(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 yU,h.reset(l),f.rebuildPath(h,c),h.generateStr(),m.__svgPathVersion=p,m.__svgPathStrokePercent=c),a.d=h.getStr()}return oW(a,e.transform),nW(a,n,e,t),rW(a,e),t.animation&&XU(e,a,t),t.emphasis&&ZU(e,a,t),NU(s,e.id+``,a)}function pW(e,t){var n=e.style,r=n.image;if(r&&!H(r)&&(eW(r)?r=r.src:tW(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),oW(c,e.transform),nW(c,n,e,t),rW(c,e),t.animation&&XU(e,c,t),NU(`image`,e.id+``,c)}}function mW(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=oi(n.y||0,hn(i),n.textBaseline),s={"dominant-baseline":`central`,"text-anchor":ai[n.textAlign]||n.textAlign};if(Xo(n)){var c=``,l=n.fontStyle,u=Jo(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),oW(s,e.transform),nW(s,n,e,t),rW(s,e),t.animation&&XU(e,s,t),NU(`text`,e.id+``,s,void 0,r)}}function hW(e,t){if(e instanceof To)return fW(e,t);if(e instanceof jo)return pW(e,t);if(e instanceof Do)return mW(e,t)}function gW(e,t,n){var r=e.style;if(si(r)){var i=ci(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=$r(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]=NU(`filter`,o,{id:o,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`},[NU(`feDropShadow`,``,{dx:u/c,dy:d/l,stdDeviation:v,"flood-color":h,"flood-opacity":m})]),a[i]=o}t.filter=hi(o)}}function _W(e,t,n,r){var i=e[n],a,o={gradientUnits:i.global?`userSpaceOnUse`:`objectBoundingBox`};if(fi(i))a=`linearGradient`,o.x1=i.x,o.y1=i.y,o.x2=i.x2,o.y2=i.y2;else if(pi(i))a=`radialGradient`,o.cx=W(i.x,.5),o.cy=W(i.y,.5),o.r=W(i.r,.5);else return;for(var s=i.colorStops,c=[],l=0,u=s.length;l<u;++l){var d=ri(s[l].offset)*100+`%`,f=s[l].color,p=$r(f),m=p.color,h=p.opacity,g={offset:d};g[`stop-color`]=m,h<1&&(g[`stop-opacity`]=h),c.push(NU(`stop`,l+``,g))}var _=IU(NU(a,``,o,c)),v=r.gradientCache,y=v[_];y||(y=r.zrId+`-g`+r.gradientIdx++,v[_]=y,o.id=y,r.defs[y]=NU(a,y,o,c)),t[n]=hi(y)}function vW(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(li(i)){var f=i.imageWidth,p=i.imageHeight,m=void 0,h=i.image;if(H(h)?m=h:eW(h)?m=h.src:tW(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=it(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=NU(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=O(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=_i(i);x&&(o.patternTransform=x);var S=NU(`pattern`,``,o,[d]),C=IU(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=NU(`pattern`,T,o,[d])),t[n]=hi(T)}}function yW(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]=NU(`clipPath`,a,o,[fW(e,n)])}t[`clip-path`]=hi(a)}function bW(e){return document.createTextNode(e)}function xW(e,t,n){e.insertBefore(t,n)}function SW(e,t){e.removeChild(t)}function CW(e,t){e.appendChild(t)}function wW(e){return e.parentNode}function TW(e){return e.nextSibling}function EW(e,t){e.textContent=t}var DW=58,OW=120,kW=NU(``,``);function AW(e){return e===void 0}function jW(e){return e!==void 0}function MW(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 NW(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function PW(e){var t,n=e.children,r=e.tag;if(jW(r)){var i=e.elm=MU(r);if(LW(kW,e),B(n))for(t=0;t<n.length;++t){var a=n[t];a!=null&&CW(i,PW(a))}else jW(e.text)&&!U(e.text)&&CW(i,bW(e.text))}else e.elm=bW(e.text);return e.elm}function FW(e,t,n,r,i){for(;r<=i;++r){var a=n[r];a!=null&&xW(e,PW(a),t)}}function IW(e,t,n,r){for(;n<=r;++n){var i=t[n];i!=null&&(jW(i.tag)?SW(wW(i.elm),i.elm):SW(e,i.elm))}}function LW(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)===OW?n===`xmlns:xlink`||n===`xmlns`?r.setAttributeNS(kU,n,o):n.charCodeAt(3)===DW?r.setAttributeNS(AU,n,o):n.charCodeAt(5)===DW?r.setAttributeNS(OU,n,o):r.setAttribute(n,o):r.setAttribute(n,o))}for(n in i)n in a||r.removeAttribute(n)}}function RW(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]:NW(o,l)?(zW(o,l),o=t[++r],l=n[++i]):NW(s,u)?(zW(s,u),s=t[--a],u=n[--c]):NW(o,u)?(zW(o,u),xW(e,o.elm,TW(s.elm)),o=t[++r],u=n[--c]):NW(s,l)?(zW(s,l),xW(e,s.elm,o.elm),s=t[--a],l=n[++i]):(AW(d)&&(d=MW(t,r,a)),f=d[l.key],AW(f)?xW(e,PW(l),o.elm):(p=t[f],p.tag===l.tag?(zW(p,l),t[f]=void 0,xW(e,p.elm,o.elm)):xW(e,PW(l),o.elm)),l=n[++i]);(r<=a||i<=c)&&(r>a?(m=n[c+1]==null?null:n[c+1].elm,FW(e,m,n,i,c)):IW(e,t,r,a))}function zW(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(LW(e,t),AW(t.text)?jW(r)&&jW(i)?r!==i&&RW(n,r,i):jW(i)?(jW(e.text)&&EW(n,``),FW(n,null,i,0,i.length-1)):jW(r)?IW(n,r,0,r.length-1):jW(e.text)&&EW(n,``):e.text!==t.text&&(jW(r)&&IW(n,r,0,r.length-1),EW(n,t.text)))}function BW(e,t){if(NW(e,t))zW(e,t);else{var n=e.elm,r=wW(n);PW(t),r!==null&&(xW(r,t.elm,TW(n)),IW(r,[e],0,0))}return t}var VW=0,HW=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=UW(`configLayer`),this.storage=t,this._opts=n=A({},n),this.root=e,this._id=`zr`+VW++,this._oldVNode=zU(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=MU(`svg`);LW(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`,BW(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return hW(e,RU(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=RU(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=WW(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=NU(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=I(L(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(NU(`defs`,`defs`,{},c)),e.animation){var l=LU(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=NU(`style`,`stl`,{},[],l);a.push(u)}}return zU(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},IU(this.renderToVNode({animation:W(e.cssAnimation,!0),emphasis:W(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:W(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 _={};yW(d[g],_,t);var v=NU(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=hW(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=yk(r,0,n),t=yk(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(di(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=vi(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}();function UW(e){return function(){}}function WW(e,t,n,r){var i;if(n&&n!==`none`){if(i=NU(`rect`,`bg`,{width:e,height:t,x:`0`,y:`0`}),mi(n))_W({fill:n},i.attrs,`fill`,r);else if(di(n))vW({style:{fill:n},dirty:je,getBoundingRect:function(){return{width:e,height:t}}},i.attrs,`fill`,r);else{var a=$r(n),o=a.color,s=a.opacity;i.attrs.fill=o,s<1&&(i.attrs[`fill-opacity`]=s)}}return i}function GW(e){e.registerPainter(`svg`,HW)}function KW(e,t,n){var r=f.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 qW(e){return!e.__cursors.get(0)}function JW(e){var t=e.__cursors.get(0);return{startIdx:t?t.startIdx:0,endIdx:t?t.endIdx:0}}var YW=function(e){a(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||=Wi,typeof t==`string`?a=KW(t,n,r):U(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=JW(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=KW(`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 q(0,0,0,0);function c(e){if(e.isFinite()&&!e.isZero()){if(i.length===0){var t=new q(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 q(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}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 q(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}}for(var l=JW(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);else{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||gk(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=Ok(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&&F(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(Hi),XW=1e5,ZW=314159,QW=void 0,$W=1,eG=2;function tG(e){return e?e.__builtin__?!0:typeof e.resize==`function`&&typeof e.refresh==`function`:!1}function nG(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 rG(e,t,n,r){var i=new YW(e,t,t.dpr);return i.zlevel=n,i.zlevel2=r,i.__builtin__=!0,iG(i),i}function iG(e){e.__cursorStack=[],e.__cursors=G()}function aG(e){return e.startIdx=e.drawIdx=e.endIdx=e.endIdxNew=0,e.used=!1,e.first=e.last=NaN,e.notClearIdx=-1,e}function oG(e,t){var n=e.__cursors,r=+t;return n.get(r)||(e.__cursorStack.push(r),n.set(r,aG({key:r})))}function sG(e,t){for(var n=e.__cursorStack,r=0;r<n.length;r++)t(e.__cursors.get(n[r]))}function cG(e,t){var n=e.layers;return n[t]||(n[t]=[,,,])}function lG(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&uG&&!s.__builtin__||n&dG&&s.__builtin__||n&fG&&s===e.hoverlayer)||t(s,a,o,i)}}var uG=1,dG=2,fG=4,pG=uG|fG,mG=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=A({},n||{}),this.dpr=n.devicePixelRatio||Wi,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=rG(a,this,ZW,0);c.initContext(),this._insertLayer(c,ZW,0,!0),this._domRoot=e}else{this._width=yk(e,0,n),this._height=yk(e,1,n);var l=this._domRoot=nG(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&&!U(e)?{paintAll:!!e}:e||{},n=W(t.refresh,!0),r=W(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=eG),!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 lG(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},dG),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=QW,n!==QW&&(!t&&n===eG&&(t=this._i.hoverlayer=this._ensureLayer(XW)),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),qk(i,s,r),c&&(s.style=l)}}i&&(Jk(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(XW)},e.prototype.paintOne=function(e,t){Kk(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)lG(this._i,function(e){e.afterBrush&&e.afterBrush()},pG),this._paintHoverList(e);else{var i=this;UE(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(ZW).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),lG(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},uG)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return lG(this._i,function(i){var a=!1;if(sG(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!qW(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)}sG(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},pG),Pe.wxa&&lG(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=qW(e),c=s&&f.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d<t.endIdx;d++){var p=n[d];if(!(d<l&&!p.notClear)){if(p.__inHover&&(this._hoverLayerDirty=eG),r!=null){var m=p.getPaintRect();m&&m.intersect(r)&&(qk(o,p,a),p.setPrevPaintRect(m))}else qk(o,p,a);if(s&&f.getTime()-c>15){d++;break}}}Jk(o,a),t.drawIdx=Math.max(d,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=ZW,t=0);var i=cG(this._i,e)[t];return i||(i=rG(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&k(i,this._layerConfig[e],!0),(n||r&&e!==ZW)&&(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])&&tG(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=cG(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),cG(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 lG(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return lG(this._i,function(n,r){e.call(t,n,r)},uG)},e.prototype.eachOtherLayer=function(e,t){return lG(this._i,function(n,r){e.call(t,n,r)},dG)},e.prototype.getLayers=function(){var e={};return lG(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}}lG(n._i,function(e){e.__dirty=!1,sG(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},pG);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__))D(`ZLevel `+d+` has been used by unknown layer `+o.id);else{if((!s||f!==s.key)&&(s=oG(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))}}lG(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;(qW(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&&(sG(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===QW&&(n._hoverLayerDirty=$W))},pG)},e.prototype.clear=function(){return lG(this._i,function(e){e.clear(),iG(e)},uG),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,lG(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?k(n[e],t,!0):n[e]=t,lG(this._i,function(e,t){k(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=yk(i,0,r),t=yk(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,lG(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(ZW).resize(e,t)}return this},e.prototype.clearLayer=function(e){F(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[ZW][0].dom;var t=new YW(`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;lG(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];qk(n,l,a)}Jk(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function hG(e){e.registerPainter(`canvas`,mG)}var gG=Object.freeze({INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`,JPY:`¥`}),_G=e=>typeof e==`string`&&/^[A-Z]{3}$/.test(e),vG=(e=`INR`)=>gG[e]??`${e} `;function yG(e,...t){console.warn(e,...t)}function bG(e,...t){console.error(e,...t)}function xG(e,t){if(e==null)throw Error(t);return e}var SG=`Asia/Kolkata`,CG=198e5,wG=new Map;function TG(e){let t=wG.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),wG.set(e,t)),t}function EG(e){if(typeof e!=`string`||e===``)return!1;try{return TG(e),!0}catch{return!1}}function DG(e,t=SG){if(t===`Asia/Kolkata`){let t=new Date(e+CG);return{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}let n=Object.fromEntries(TG(t).formatToParts(e).map(e=>[e.type,Number(e.value)]));return{year:Number(n.year),month:Number(n.month)-1,day:Number(n.day),hour:Number(n.hour)%24,minute:Number(n.minute),second:Number(n.second)}}function OG(e,t=SG){if(t===`Asia/Kolkata`)return CG;let n=DG(e,t),r=new Date(0);return r.setUTCFullYear(n.year,n.month,n.day),r.setUTCHours(n.hour,n.minute,n.second,0),r.getTime()-Math.floor(e/1e3)*1e3}function kG(e,t=SG){let n=e-OG(e,t);return n=e-OG(n,t),n}var AG=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],jG=[`rupees`,`paise`],MG=[`ms`,`s`,`min`,`h`],NG=[`day`,`month`,`year`,`datetime`,`time`],PG=`−`,FG=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],IG=(e,t)=>xG(e[t],`no compact unit at index ${t}`),LG=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],RG=[[1e9,`B`],[1e6,`M`],[1e3,`K`]],zG=e=>!e||e===`INR`?`en-IN`:`en-US`,BG=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=20?e:t,VG=new Map,HG=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=VG.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:e}),VG.set(n,r)),r},UG=new Map,WG=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=UG.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e}),UG.set(n,r)),r},GG=e=>typeof e==`number`&&Number.isFinite(e),KG=e=>e<0&&!Object.is(Math.abs(e),0)?PG:``;function qG(e){if(!Number.isInteger(e))throw Error(`A paise amount must be a whole number, got ${e}`);let t=BigInt(Math.abs(e)).toString().padStart(3,`0`);return`${e<0?`-`:``}${t.slice(0,-2)}.${t.slice(-2)}`}var JG=(e,t)=>t===`paise`?Number(qG(e)):e,YG=2,XG=(e,t,n)=>{let r=Math.min(t,YG),i=10n**BigInt(YG-r),a=(BigInt(qG(e).replace(`.`,``))+i/2n)/i,o=10n**BigInt(r),s=WG(0,n).format(a/o);return t===0?s:`${s}.${(a%o).toString().padStart(r,`0`)}${`0`.repeat(t-r)}`};function ZG(e,{decimals:t}={}){if(!GG(e))return`-`;let n=HG(BG(t,2)).format(Math.abs(e));return n===`0`?`0`:KG(e)+n}function QG(e,{unit:t=`rupees`,decimals:n,currency:r=`INR`}={}){if(!GG(e))return`-`;let i=BG(n,0),a=zG(r),o=t===`paise`?XG(Math.abs(e),i,a):WG(i,a).format(Math.abs(e));return(Number(o.replace(/,/g,``))===0?``:KG(e))+vG(r)+o}var $G=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2;function eK(e,{currency:t,unit:n=`rupees`}={}){if(!GG(e))return`-`;let r=t?JG(e,n):e,i=t?vG(t):``,a=t?zG(t):`en-IN`,o=a===`en-IN`?LG:RG,s=Math.abs(r),c=o.findIndex(([e])=>s>=e);if(c===-1){let e=HG($G(s),a).format(s);if(e!==`1,000`)return(e===`0`?``:KG(r))+i+e;c=o.length-1}let[l,u]=IG(o,c),d=s/l,f=d>=100?0:d>=10?1:2,p=Number(d.toFixed(f));return p>=100&&c>0&&(--c,[l,u]=IG(o,c),d=s/l,f=d>=100?0:d>=10?1:2,p=Number(d.toFixed(f))),`${KG(r)}${i}${HG(f,a).format(p)} ${u}`}function tK(e,{decimals:t}={}){return GG(e)?`${ZG(e*100,{decimals:BG(t,1)})}%`:`-`}var nK={ms:1,s:1e3,min:6e4,h:36e5};function rK(e,{unit:t=`s`}={}){if(!GG(e))return`-`;let n=nK[t]??1e3,r=Math.abs(e*n),i=KG(e);if(Math.round(r)<1e3)return`${i}${HG(0).format(r)} ms`;let a=r/1e3;if(a<10)return`${i}${HG(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}${HG(0).format(l)}h ${s(c%60)}m`}function iK(e,t=SG){if(e instanceof Date)return e.getTime();if(GG(e))return e;if(typeof e!=`string`)return NaN;let n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(n){let[e,r,i]=[Number(n[1]),Number(n[2]),Number(n[3])],a=new Date(Date.UTC(2e3,r-1,i));return a.setUTCFullYear(e),a.getUTCFullYear()===e&&a.getUTCMonth()===r-1&&a.getUTCDate()===i?kG(a.getTime(),t):NaN}return Date.parse(e)}function aK(e,t=SG){let{year:n,month:r,day:i,hour:a,minute:o}=DG(e,t);return{year:n,month:r,day:i,hour:a,minute:o}}function oK(e,{pattern:t=`day`,timeZone:n=SG}={}){let r=iK(e,n);if(!Number.isFinite(r))return`-`;let i=aK(r,n),a=e=>String(e).padStart(2,`0`),o=`${a(i.day)}-${FG[i.month]}-${i.year}`,s=`${a(i.hour)}:${a(i.minute)}`;switch(t){case`month`:return`${FG[i.month]}-${i.year}`;case`year`:return String(i.year);case`datetime`:return`${o} ${s}`;case`time`:return s;default:return o}}function sK(e,{timeZone:t=SG}={}){let n=iK(e,t);if(!Number.isFinite(n))return`-`;let r=aK(n,t);return`${String(r.day).padStart(2,`0`)}-${FG[r.month]}`}function Z(e,t){if(e==null||e===``)return`-`;let n=t?.style;if(n===`date`)return oK(e,t);if(typeof e!=`number`)return String(e);switch(n){case`currency`:return QG(e,t);case`percent`:return tK(e,t);case`compact`:return eK(e,t);case`duration`:return rK(e,t);default:return ZG(e,t)}}function cK(e){let t=e?.style;return t===`currency`?{style:`compact`,currency:e?.currency??`INR`,unit:e?.unit}:!t||t===`number`?{style:`compact`}:e??{}}var lK=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],uK=[`none`,`stacked`,`percent`],dK=[`category`,`time`,`value`],fK=[`auto`,`svg`,`canvas`],pK=[`ready`,`loading`,`empty`,`error`],mK=[`chart`,`table`],hK=8,gK=6,_K=`Other`,vK=`No data to show for this chart.`,yK=`This chart couldn't load. Try again in a moment.`,bK=`Loading chart`,xK=`This chart has more series than it can show clearly.`,SK=`This chart has more groups than it can show clearly.`,CK={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`},wK=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],TK=e=>wK.includes(e),EK=[`area`,`column`,`bar`],DK=[`line`,`area`,`column`,`bar`,`multiples`],OK={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},kK={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`],centerLabel:[`donut`],valueLabels:[`column`,`bar`]},AK={gauge:240,calendar:200,treemap:340,sankey:340},jK=100,MK=72,NK=32,PK=[`type`,`title`,`description`,`data`,`x`,`series`,`group`,`to`,`size`,`trend`,`zoom`,`bands`,`stack`,`y`,`target`,`centerLabel`,`valueLabels`,`height`,`state`,`emptyText`,`errorText`,`loadingText`,`renderer`,`timeZone`],FK=[`key`,`kind`,`format`,`label`,`labelFit`],IK=[`auto`,`all`,`rotate`,`ellipsis`],LK=[`key`,`label`,`format`],RK=[`key`,`label`],zK=[`key`,`label`,`format`],BK=[`upTo`,`label`],VK=[`label`,`format`,`min`,`max`,`wholeNumbers`],HK=[`value`,`label`],UK=[`style`,`currency`,`unit`,`decimals`,`pattern`],WK=[...jG,...MG],GK=new Set;function KK(e){GK.has(e)||(GK.add(e),yG(`[@webority/ui-elements] <wui-chart> ${e}`))}var qK=e=>e.map(e=>`"${e}"`).join(` | `),JK=e=>typeof e==`number`&&Number.isFinite(e),YK=e=>typeof e==`object`&&!!e&&!Array.isArray(e),XK=(e,t)=>Reflect.get(e,t),ZK=e=>e===null||typeof e==`string`||typeof e==`number`,QK=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ZK(t)?t:null]));function $K(e,t){if(e==null)throw Error(`${t} missing`);return e}var eq=(e,t)=>e.some(e=>e===t);function tq(e,t,n){t==null||n.includes(t)||KK(`received ${e}="${String(t)}", which is not one of ${qK(n)}. The chart uses its default instead.`)}function nq(e,t,n){for(let r of Object.keys(t))n.includes(r)||(/^(y2|secondary)/i.test(r)?KK(`ignores ${e}.${r}: a chart has one value axis by design. Show the second measure as its own chart.`):KK(`ignores the unknown key ${e}.${r}. Known keys: ${n.join(`, `)}.`))}function rq(e,t){if(t==null)return;if(typeof t!=`object`){KK(`expects ${e} to be an object such as { style: "currency" }.`);return}nq(e,t,UK);let n=XK(t,`style`);tq(`${e}.style`,n,AG);let r=XK(t,`currency`);r!=null&&!_G(r)&&KK(`received ${e}.currency="${String(r)}", which is not an ISO 4217 code such as "INR". The chart uses INR instead.`);let i=XK(t,`unit`);i!=null&&tq(`${e}.unit`,i,n===`duration`?MG:jG);let a=XK(t,`pattern`);tq(`${e}.pattern`,a,NG);let o=XK(t,`decimals`);o!=null&&!(typeof o==`number`&&Number.isInteger(o)&&o>=0&&o<=20)&&KK(`received ${e}.decimals=${String(o)}, which is not a whole number from 0 to 20. The chart uses its default instead.`);let s={style:eq(AG,n)?n:`number`};return typeof r==`string`&&_G(r)&&(s.currency=r),eq(WK,i)&&(s.unit=i),typeof o==`number`&&(s.decimals=o),eq(NG,a)&&(s.pattern=a),s}function iq(e){let t=(e,t=yK)=>(bG(`[@webority/ui-elements] <wui-chart> ${e}`),{spec:null,problem:t});if(!YK(e))return t('has no spec: set the `spec` property or add a <script type="application/json"> child.');let n=e;nq(`spec`,n,PK);let r=XK(n,`type`);if(tq(`type`,r,lK),!eq(lK,r))return t(`cannot draw type "${String(r)}".`);let i=r,a=XK(n,`title`);typeof a==`string`&&a.trim()||KK("needs a `title`: it names the chart for screen readers and names exported files.");for(let[e,t]of Object.entries(kK))XK(n,e)!=null&&!t.includes(i)&&KK(`ignores spec.${e} on a ${i} chart: it applies to ${t.join(`, `)}.`);let o=XK(n,`x`),s=YK(o)?o:{};nq(`spec.x`,s,FK);let c=OK[i]??[`category`],l=XK(s,`kind`);tq(`x.kind`,l,dK),eq(dK,l)&&!c.includes(l)&&KK(`ignores x.kind="${l}" on a ${i} chart: it takes ${qK(c)}.`);let u=XK(s,`labelFit`);tq(`x.labelFit`,u,IK);let d=rq(`x.format`,XK(s,`format`)),f=XK(s,`key`);typeof f!=`string`&&i!==`gauge`&&KK("needs `x.key`, the column holding each row's x value or slice name.");let p=typeof f==`string`?f:``,m=XK(n,`y`),h=YK(m)?m:{};nq(`spec.y`,h,VK);let g=rq(`y.format`,XK(h,`format`)),_=XK(n,`series`),v=Array.isArray(_)?_.filter(YK):[],y=[];for(let[e,t]of v.entries()){nq(`spec.series[${e}]`,t,LK);let n=rq(`series[${e}].format`,XK(t,`format`)),r=XK(t,`key`);typeof r!=`string`&&KK(`needs series[${e}].key, the column holding that series' values.`);let i=XK(t,`label`);y.push({key:String(r),named:typeof r==`string`,label:typeof i==`string`&&i?i:String(r),format:n})}let b=y[0];if(!b)return t(`has no series to draw.`);let x=y.filter(e=>e.named).map(e=>e.key),S=x.find((e,t)=>x.indexOf(e)!==t);if(S!==void 0)return t(`has two series with the key "${S}": each series needs its own key.`);if(y.length>8)return t(`refuses ${y.length} series: 8 is the most that stay distinguishable. Fold the smallest into an Other series, or split the chart.`,xK);let C=TK(i);if(C&&y.length>1){let e=i===`donut`?`Compare parts across groups with a percent-stacked column instead.`:`Show the other measures as their own charts, or use small multiples.`;KK(`draws one series as a ${i}; it got ${y.length} and shows the first. ${e}`)}let w=(e,t,n,r)=>{if(t==null)return null;if(!YK(t))return KK(`expects ${e} to be an object such as { key: "column" }.`),null;nq(e,t,n);let i=XK(t,`key`);if(typeof i!=`string`)return KK(`needs ${e}.key, the column holding ${r}.`),null;let a=rq(`${e}.format`,XK(t,`format`)),o=XK(t,`label`);return{key:i,label:typeof o==`string`?o:``,format:a}},T=kK.group.includes(i)?w(`spec.group`,XK(n,`group`),RK,`each row's group`):null,E=i===`sankey`?w(`spec.to`,XK(n,`to`),RK,`where each flow ends`):null,D=i===`bubble`?w(`spec.size`,XK(n,`size`),zK,`each bubble's size`):null;if((i===`heatmap`||i===`treemap`)&&!T)return t(`needs \`group.key\` to draw a ${i}: the column holding each ${i===`heatmap`?`row`:`parent`}.`);if(i===`sankey`&&!E)return t("needs `to.key` to draw a sankey: the column holding where each flow ends.");if(i===`bubble`&&!D)return t("needs `size.key` to draw a bubble chart: the column holding each bubble's size.");let O=EK.includes(i)?uK:[`none`],k=XK(n,`stack`);tq(`stack`,k,O);let A=XK(n,`state`);tq(`state`,A,pK);let j=XK(n,`renderer`);tq(`renderer`,j,fK);let M=XK(n,`timeZone`);M!=null&&!EG(M)&&KK(`received timeZone="${String(M)}", which is not a time zone this browser knows. The chart uses Asia/Kolkata instead.`);let N=EG(M)?M:SG,ee=XK(n,`target`),P=YK(ee)?XK(ee,`value`):void 0;ee!=null&&(YK(ee)&&nq(`spec.target`,ee,HK),YK(ee)&&JK(P)||KK("ignores a `target` without a numeric `value`."));let te=XK(n,`trend`);te!=null&&typeof te!=`boolean`&&KK("expects `trend` to be true or false.");let F=XK(n,`zoom`);F!=null&&typeof F!=`boolean`&&KK("expects `zoom` to be true or false.");let I=[],ne=XK(n,`bands`);if(i===`gauge`&&ne!=null){let e=Array.isArray(ne)?ne.filter(YK):[];for(let t of e)nq(`spec.bands[]`,t,BK);I=e.map(e=>({upTo:XK(e,`upTo`),label:XK(e,`label`)})).filter(e=>JK(e.upTo)&&typeof e.label==`string`&&e.label!==``).sort((e,t)=>e.upTo-t.upTo),Array.isArray(ne)&&I.length===e.length||KK("ignores a gauge band without a numeric `upTo` and a `label`.")}let re=g??b.format,ie=(C?y.slice(0,1):y).map(e=>({key:e.key,label:e.label,format:e.format??re})),L=eq(c,l)?l:c[0],ae=XK(n,`data`),R=Array.isArray(ae)?ae:[],z=R.filter(YK).map(QK),B=-1,V=null,H=b.key;i===`donut`&&z.length>6&&(V=z,{data:z,otherIndex:B}=sq(z,p,H),KK(`draws at most 6 donut slices; the smallest ${R.length-5} are shown as "${_K}". Send fewer rows, or use a bar chart for many parts.`));let oe=(e,t)=>{let n=z.filter(e);n.length!==z.length&&KK(`leaves out ${z.length-n.length} row(s) ${t}.`),z=n},se=e=>e!=null&&e!==``,U=e=>JK(e)&&e>0;if(L===`time`&&DK.includes(i)&&oe(e=>Number.isFinite(iK(e[p],N)),`without a readable date`),i===`gauge`&&z.length>1)KK(`draws one value as a gauge; it got ${z.length} rows and shows the first.`),z=z.slice(0,1);else if(i===`scatter`||i===`bubble`){oe(e=>JK(e[p])&&JK(e[H])&&(i!==`bubble`||D!=null&&U(e[D.key])),`without a number for x and y (and a positive size)`);let e=new Set(T?z.map(e=>String(e[T.key]??``)):[]);if(e.size>3)return t(`refuses ${e.size} colour groups on a ${i} chart: 3 is the most that stay tellable apart. Keep the three that matter and fold the rest into one, or split the chart.`,SK)}else if(i===`calendar`)oe(e=>Number.isFinite(iK(e[p],N)),`without a readable date`);else if(i===`heatmap`&&T)oe(e=>se(e[p])&&se(e[T.key]),`without a column or a row`);else if(i===`treemap`&&T){oe(e=>se(e[p])&&se(e[T.key])&&U(e[H]),`without a name, a parent and a positive size`);let e=new Set(z.map(e=>String(e[T.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.`,SK)}else if(i===`sankey`&&E){oe(e=>se(e[p])&&se(e[E.key])&&U(e[H]),`without a start, an end and a positive size`);let e=aq(z,p,E.key);if(e)return t(e.reason,e.text)}else if(i===`waterfall`){let e=oq(z,H);if(e?.refuse)return t(e.refuse);e?.warn&&KK(e.warn)}let ce=XK(n,`height`),le=JK(ce)&&ce>0?ce:null;if(i===`multiples`){let e=MK*ie.length+NK;le!=null&&le<e&&(KK(`needs at least ${e}px of height for ${ie.length} small charts; it got ${le}px and draws at ${e}px.`),le=e),le??=jK*ie.length+40}le??=AK[i]??320;let ue=eq(O,k)?k:`none`,de=kK.valueLabels.includes(i)&&XK(n,`valueLabels`)===!0;de&&ue!==`none`&&KK(`ignores valueLabels on a stacked chart.`);let fe=de&&ue===`none`,pe=XK(n,`description`),me=XK(s,`label`),W=XK(h,`label`),he=XK(h,`min`),ge=XK(h,`max`),_e=XK(n,`centerLabel`),ve=(e,t)=>typeof e==`string`&&e?e:t;return{problem:null,spec:{type:i,title:typeof a==`string`?a.trim():``,description:typeof pe==`string`?pe:``,data:z,allData:V??z,x:{key:p,kind:L,format:d??(L===`time`?{style:`date`}:L===`value`?{style:`number`}:void 0),label:typeof me==`string`?me:``,labelFit:eq(IK,u)?u:`auto`},series:ie,group:T,to:E,size:D,trend:kK.trend.includes(i)&&te===!0,zoom:kK.zoom.includes(i)?(F??z.length>5e3)===!0:!1,bands:I,stack:ue,y:{label:typeof W==`string`?W:``,format:re,min:JK(he)?he:void 0,max:JK(ge)?ge:void 0,wholeNumbers:XK(h,`wholeNumbers`)===!0},target:YK(ee)&&JK(P)?{value:P,label:String(XK(ee,`label`)??``)}:null,centerLabel:i===`donut`&&typeof _e==`string`&&_e.trim()?_e.trim():``,valueLabels:fe,height:le,state:eq(pK,A)?A:`ready`,emptyText:ve(XK(n,`emptyText`),vK),errorText:ve(XK(n,`errorText`),yK),loadingText:ve(XK(n,`loadingText`),bK),renderer:eq(fK,j)?j:`auto`,timeZone:N,otherIndex:B}}}function aq(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:SK};let o=0;for(;a.length;){let e=a.pop();o+=1;for(let[t,n]of r){if(t!==e)continue;let r=(i.get(n)??0)-1;i.set(n,r),r===0&&a.push(n)}}return o<i.size?{reason:`cannot draw a sankey whose flows loop back on themselves.`,text:yK}:null}function oq(e,t){let n=e.map(e=>JK(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 sq(e,t,n){let r=new Set(e.map((e,t)=>({i:t,v:JK(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)||!JK(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=_K;for(let e=2;o.has(s);e+=1)s=`${_K} (${e})`;return a.push({[t]:s,[n]:i}),{data:a,otherIndex:a.length-1}}function cq(e){return $K(e.series[0],`series`)}function lq(e,t){return $K(e.data[t],`row ${t}`)}function Q(e,t,n){let r=e.data[n]?.[t];return JK(r)?r:null}function uq(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,timeZone:e.timeZone}):String(n)}function dq(e,t){return iK(e.data[t]?.[e.x.key],e.timeZone)}function fq(e,t){let n=e.group?e.data[t]?.[e.group.key]:null;return n==null||n===``?`-`:String(n)}function pq(e,t){let n=e.to?e.data[t]?.[e.to.key]:null;return n==null||n===``?`-`:String(n)}var mq=e=>[...new Set(e)];function hq(e){return e.group?mq(e.data.map((t,n)=>fq(e,n))):[]}function gq(e){return TK(e.type)?e.data.length:e.data.length*e.series.length}function _q(e){return e.renderer===`auto`?gq(e)>5e3?`canvas`:`svg`:e.renderer}function vq(e){switch(e.type){case`donut`:return e.data.map((t,n)=>$(e,n));case`scatter`:case`bubble`:return hq(e);case`line`:case`area`:case`column`:case`bar`:return e.series.map(e=>e.key);default:return[]}}function yq(e){return[`line`,`area`,`column`,`bar`].includes(e.type)?e.series.map(e=>e.label):vq(e)}function bq(e,t,n){return e.type===`donut`?n.has($(e,t)):(e.type===`scatter`||e.type===`bubble`)&&e.group?n.has(fq(e,t)):!1}function xq(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=>{let n=Q(e,t.key,r);return[t.key,i&&n!=null?n/i:null]}))})}var Sq=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Cq(e,t=SG){return`${Sq[new Date(e+OG(e,t)).getUTCDay()]}, ${oK(e,{timeZone:t})}`}var wq=e=>e.reduce((e,t)=>t<e?t:e,1/0),Tq=e=>e.reduce((e,t)=>t>e?t:e,-1/0),Eq=(e,t)=>e.data.map((n,r)=>Q(e,t,r)).filter(e=>e!=null),Dq=(e,t)=>t?Z((e??0)/t,{style:`percent`}):`-`;function Oq(e,t){let n=e.filter(JK);if(!n.length)return[];let r=wq(n),i=Tq(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 kq(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 Aq(e,t){return Array.from({length:e},(n,r)=>t[e===1?6:Math.round(6-r*4/(e-1))])}function jq(e,t){return e.bands.find(e=>t<=e.upTo)??e.bands[e.bands.length-1]??null}var Mq=(e,t)=>t==null?`-`:$K(jq(e,t),`gauge band`).label;function Nq(e){return{min:e.y.min??0,max:e.y.max??100}}function Pq(e){let t=cq(e).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 Fq(e,t){let n=cq(e).key,r=$K(e.to,`to column`).key,i=e.data.map((t,i)=>({from:String(t[e.x.key]),to:String(t[r]),value:Q(e,n,i)??0})),a=new Map;for(let e of i)a.has(e.from)||a.set(e.from,[]),a.set(e.to,[...a.get(e.to)??[],e]);let o=new Map,s=0;for(let[e,n]of a)n.length||o.set(e,t[s++%t.length]);let c=[...o.keys()],l=new Map([...a].filter(([,e])=>e.length).map(([e,t])=>[e,t.length]));for(;c.length;){let e=c.shift();for(let t of i.filter(t=>t.from===e)){let e=(l.get(t.to)??0)-1;if(l.set(t.to,e),e>0)continue;let n=$K((a.get(t.to)??[]).reduce((e,t)=>e===null||t.value>e.value?t:e,null),`sankey inflow`);o.set(t.to,o.get(n.from)),c.push(t.to)}}return o}function Iq(e){let t=cq(e).key,n=new Map(hq(e).map(e=>[e,0]));return e.data.forEach((r,i)=>{n.set(fq(e,i),(n.get(fq(e,i))??0)+(Q(e,t,i)??0))}),n}function Lq(e,t,n){let{palette:r,neutral:i,seq:a}=n,o=cq(e).key;switch(e.type){case`donut`:return Bq(e,t,n);case`funnel`:return Aq(e.data.length,$K(a,`sequential colours`))[t];case`heatmap`:case`calendar`:return kq(Oq(Eq(e,o),$K(a,`sequential colours`)),Q(e,o,t));case`gauge`:return r[0];case`waterfall`:{let n=$K(Pq(e)[t],`waterfall bar ${t}`);return n.total?r[0]:n.value>=0?r[2]:r[7]}case`treemap`:return r[[...Iq(e).keys()].indexOf(fq(e,t))%r.length];case`sankey`:return Fq(e,r).get(String(lq(e,t)[e.x.key]));case`scatter`:case`bubble`:return r[Math.max(0,hq(e).indexOf(fq(e,t)))];default:return r[0]??i}}function Rq(e,t,n,r){let i=cq(e),a=Q(e,i.key,t),o=()=>Lq(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:`${fq(e,t)}, ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`calendar`:return{title:Cq(dq(e,t),e.timeZone),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:Dq(a,r)}),s.push({label:`Of ${$(e,0)}`,value:Dq(a,n)}),{title:$(e,t),rows:s,foot:``}}case`gauge`:{let{min:n,max:r}=Nq(e),s=a==null?null:jq(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=Pq(e),r=$K(n[t],`waterfall bar ${t}`),a=$K(n[0],`waterfall opening bar`).value,s=r.total?[{color:o(),label:i.label,value:Z(r.value,i.format)}]:[{color:o(),label:`Change`,value:zq(r.value,i.format)},{label:`Running total`,value:Z(r.level,i.format)}],c=!r.total&&a?`${zq(r.value/a*100,{style:`number`,decimals:2},`%`)} of opening`:``;return{title:$(e,t),rows:s,foot:c}}case`treemap`:{let n=fq(e,t),r=Iq(e).get(n);return{title:`${n} / ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:Dq(a,r)}],foot:``}}case`sankey`:{let n=String(lq(e,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 ${pq(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:Dq(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(lq(e,t)[e.size.key],e.size.format)}),{title:e.group?fq(e,t):i.label,rows:n,foot:``}}}let s=e.stack===`percent`?xq(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=``,d=c[0];if(e.stack!==`none`&&d&&c.length>1&&(u=`Total ${Z(c.reduce((n,{s:r})=>n+(Q(e,r.key,t)??0),0),d.s.format)}`),e.target&&d&&c.length===1){let n=Q(e,d.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),d.s.format)}`}}return{title:$(e,t),rows:l,foot:u}}function zq(e,t,n=``){let r=`${Z(Math.abs(e),t)}${n}`;return e>0?`+${r}`:e<0?`−${r}`:r}function Bq(e,t,n){return t===e.otherIndex?n.neutral:n.palette[t%n.palette.length]}function Vq(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 Hq(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 Uq(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 Wq(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=cq(t),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=mq(a.map(e=>$(t,e))),n=hq(t),o=new Map(a.map(e=>[`${fq(t,e)}\u0000${$(t,e)}`,r(e)]));return i([$K(t.group,`group column`).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([Uq(t),n.label,`Of previous step`,`Of ${$(t,0)}`],a.map(i=>({head:$(t,i),cells:[r(i),i?Dq(Q(t,n.key,i),Q(t,n.key,i-1)):`-`,Dq(Q(t,n.key,i),e)]})))}case`gauge`:return i([Uq(t),n.label,...t.bands.length?[`Band`]:[]],a.map(e=>({head:lq(t,e)[t.x.key]==null?n.label:$(t,e),cells:[r(e),...t.bands.length?[Mq(t,Q(t,n.key,e))]:[]]})));case`waterfall`:return i([Uq(t),`Change`,`Running total`],Pq(t).map(e=>({head:$(t,e.index),cells:[e.total?`-`:zq(e.value,n.format),Z(e.level,n.format)]})));case`treemap`:{let e=Iq(t);return i([$K(t.group,`group column`).label||`Group`,t.x.label||`Item`,n.label,`Share of group`],a.map(i=>({head:fq(t,i),cells:[$(t,i),r(i),Dq(Q(t,n.key,i),e.get(fq(t,i)))]})))}case`sankey`:return i([Uq(t),$K(t.to,`to column`).label||`To`,n.label],a.map(e=>({head:$(t,e),cells:[pq(t,e),r(e)]})));case`scatter`:case`bubble`:return i([Uq(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(lq(t,e)[t.size.key],t.size.format)]:[],...t.group?[fq(t,e)]:[]]})))}let o=t.type===`donut`,s=o?t.data.reduce((e,r,i)=>e+(Q(t,n.key,i)??0),0):0,c=[Uq(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 Gq(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 Kq(e,t){return e==null?e:t?.unit===`paise`?Number(qG(e)):t?.style===`percent`?Number((e*100).toPrecision(12)):e}function qq(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`?oK(n,{pattern:t.x.format?.pattern??`day`,timeZone:t.timeZone}):n}},i=t.series.map(e=>({head:`${e.label}${Gq(e.format)}`,value:t=>{let n=t[e.key];return Kq(JK(n)?n:null,e.format)}})),a=t.group,o=a?{head:a.label||a.key,value:e=>e[a.key]}:null,s;switch(t.type){case`heatmap`:s=[r,$K(o,`group column`),...i];break;case`treemap`:s=[$K(o,`group column`),r,...i];break;case`sankey`:{let e=$K(t.to,`to column`);s=[r,{head:e.label||e.key,value:t=>t[e.key]},...i];break}case`bubble`:{let e=$K(t.size,`size column`);s=[r,...i,{head:`${e.label||e.key}${Gq(e.format)}`,value:t=>{let n=t[e.key];return Kq(JK(n)?n:null,e.format)}},...o?[o]:[]];break}case`scatter`:s=[r,...i,...o?[o]:[]];break;case`gauge`:s=t.x.key===``?i:[r,...i];break;default:s=[r,...i]}let c=[s.map(e=>n(e.head)).join(`,`)];for(let e of t.data)c.push(s.map(t=>n(t.value(e))).join(`,`));return`${c.join(`\r
|
|
21
|
-
`)}`}function Jq(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=wq(t),i=Tq(t);return r===i?`${e} is ${Z(r,n)}.`:`${e} runs from ${Z(r,n)} to ${Z(i,n)}.`};function Xq(e,t=new Set){let n=[];e.description&&n.push(e.description.replace(/\.?\s*$/,`.`));let r=vq(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=>!bq(e,n,t)),o=cq(e),s=Eq(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);if(n.push(`${CK.donut} of ${o.label} in ${a.length} ${a.length===1?`part`:`parts`}, ${Z(t,o.format)} in all.`),a.length&&t){let r=a.reduce((t,n)=>(Q(e,o.key,n)??-1/0)>(Q(e,o.key,t)??-1/0)?n:t,$K(a[0],`first slice`));n.push(`${$(e,r)} is the largest, at ${Z((Q(e,o.key,r)??0)/t,{style:`percent`})}.`)}return n.join(` `)}case`heatmap`:if(n.push(`${CK.heatmap} of ${o.label} by ${$K(e.group,`group column`).label||`row`} and ${e.x.label||`column`}, ${i} cells.`),s.length){let t=l(),r=u();n.push(`Highest is ${Zq(e,t)} at ${fq(e,t)}, ${$(e,t)}; lowest is ${Zq(e,r)} at ${fq(e,r)}, ${$(e,r)}.`)}return n.join(` `);case`calendar`:return n.push(`${CK.calendar} of ${o.label}, ${i} ${i===1?`day`:`days`}${i>1?`, from ${$(e,0)} to ${$(e,i-1)}`:``}.`),s.length&&n.push(`Highest is ${Zq(e,l())} on ${$(e,l())}; lowest is ${Zq(e,u())} on ${$(e,u())}.`),n.join(` `);case`funnel`:return n.push(`${CK.funnel} of ${o.label} in ${i} stages.`),i>1&&n.push(`${$(e,0)} is ${Zq(e,0)} and ${$(e,i-1)} is ${Zq(e,i-1)}, ${Dq(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}=Nq(e),a=t==null?null:jq(e,t);return n.push(`${CK.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=Pq(e);if(n.push(`${CK.waterfall} of ${o.label}.`),i>1){let r=t.filter(e=>!e.total);n.push(`It opens at ${Z($K(t[0],`waterfall opening bar`).value,o.format)} and closes at ${Z($K(t[i-1],`waterfall closing bar`).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)}, ${zq(a.value,o.format)}.`),s&&n.push(`The largest fall is ${$(e,s.index)}, ${zq(s.value,o.format)}.`)}return n.join(` `)}case`treemap`:{let t=Iq(e);if(!t.size)return`${CK.treemap} of ${o.label}: no items.`;let[r,a]=[...t].reduce((e,t)=>t[1]>e[1]?t:e);return n.push(`${CK.treemap} of ${o.label}: ${i} items in ${t.size} groups, ${Z(c,o.format)} in all.`),n.push(`${r} is the largest group, at ${Dq(a,c)}.`),n.join(` `)}case`sankey`:{let t=$K(e.to,`to column`).key,r=mq(e.data.flatMap(n=>[String(n[e.x.key]),String(n[t])])),a=l();return n.push(`${CK.sankey} of ${o.label}: ${i} flows between ${r.length} places.`),n.push(`The largest flow is ${$(e,a)} to ${pq(e,a)}, ${Zq(e,a)}.`),n.join(` `)}case`scatter`:case`bubble`:{let r=hq(e).filter(e=>!t.has(e));n.push(`${CK[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=>lq(e,t)[e.x.key]).filter(JK),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(` `)}}let d=e.stack===`percent`?`, stacked to 100%`:e.stack===`stacked`?`, stacked`:``,f=e.series.filter(e=>!t.has(e.key));n.push(`${CK[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,Eq(e,t.key),t.format);r&&n.push(r)}return n.join(` `)}var Zq=(e,t)=>{let n=cq(e);return Z(Q(e,n.key,t),n.format)};function Qq(e){return e.stack===`percent`?{style:`percent`,decimals:0}:cK(e.y.format)}var $q=864e5,eJ={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},tJ=e=>eJ[e]??0,nJ=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function rJ(e,t){let n=e.data.map((e,t)=>t).filter(n=>!bq(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>Q(e,e.x.key,t)??0;return n.sort((e,t)=>r(e)-r(t)||e-t)}function iJ(e){let t=mq(e.data.map((t,n)=>$(e,n))),n=hq(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf($(e,i))},${n.indexOf(fq(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf($(e,r)),n.indexOf(fq(e,r))]}}function aJ(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 eJ||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return oJ(e,t,n);let a=nJ.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?rJ(e,r):[];if(a?!s.length:!o.length)return t;let c=t??{index:a?$K(s[0],`first mark`):0,series:a?0:$K(o[0],`first visible series`)};if(t==null&&n in eJ)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:$K(s[0],`first mark`),series:0}:n===`End`?{index:$K(s[s.length-1],`last mark`),series:0}:n in eJ?{index:$K(s[(e+tJ(n)+s.length)%s.length],`next mark`),series:0}:t}if(n===`Home`)return{...c,index:0};if(n===`End`)return{...c,index:i-1};if(!(n in eJ))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+tJ(n)))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?tJ(n):-tJ(n);return{...c,series:$K(o[Math.min(o.length-1,Math.max(0,l+u))],`series`)}}function oJ(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>dq(e,t)-dq(e,n)):[],o=i?null:iJ(e),s=t??{index:i?$K(a[0],`first day`):0,series:0};if(t==null&&n in eJ)return s;if(n===`Home`)return{index:i?$K(a[0],`first day`):0,series:0};if(n===`End`)return{index:i?$K(a[r-1],`last day`):r-1,series:0};if(!(n in eJ))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?tJ(n):tJ(n)*7,r=t=>{let n=dq(e,t);return Math.floor((n+OG(n,e.timeZone))/$q)},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}}if(!o)throw Error(`heat grid missing`);let[c,l]=o.position(s.index),[u,d]=n===`ArrowLeft`||n===`ArrowRight`?[tJ(n),0]:[0,tJ(n)];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}zj([px,rT,$T,OL,zI,OI,QF,xL,$M,JR,vB,TV,$B,yz,tz,kH,nH,EB,pU,BH,GW,hG]);function sJ(e){let t=e.series[0];if(!t)throw Error(`chart spec has no series`);return t}var cJ=e=>typeof e==`number`;function lJ(e,t){let n=e.data[t];if(!n)throw Error(`chart row ${t} missing`);return n}function uJ(e){if(!e.to)throw Error("chart spec has no `to` column");return e.to.key}function dJ(e){if(!e.size)throw Error("chart spec has no `size` column");return e.size.key}function fJ(e,t,n){let r=e[t];if(!r)throw Error(`percent shares for row ${t} missing`);return r[n]??null}function pJ(e,t,n){let r=e?.[t];if(!r)throw Error(`bar radii for row ${t} missing`);return r[n]}var mJ=e=>cJ(e)?e:null;function hJ(e){return typeof e==`object`&&e&&`row`in e?mJ(e.row):null}function gJ(e){if(typeof e!=`object`||!e||!(`dataZoom`in e)||!Array.isArray(e.dataZoom))return null;let t=e.dataZoom[0];if(typeof t!=`object`||!t||!(`start`in t)||!(`end`in t))return null;let{start:n,end:r}=t;return cJ(n)&&Number.isFinite(n)&&cJ(r)&&Number.isFinite(r)?{start:n,end:r}:null}function _J(e){if(!e)throw Error(`chart has not been drawn`);return e}var vJ=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],yJ=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function bJ(e,t,n,r,i=!1){let a=cK(e);if(i)return a.currency?{style:`currency`,currency:a.currency,unit:a.unit,decimals:0}:{style:`number`,decimals:0};if(a.style!==`compact`||!Number.isFinite(t)||!Number.isFinite(n))return a;let o=(n-t)/r;if(!(o>0)||o>=Math.max(Math.abs(t),Math.abs(n))*.02)return a;let s=Math.min(6,Math.max(0,Math.ceil(-Math.log10(o))));return a.currency?{style:`currency`,currency:a.currency,unit:a.unit,decimals:s}:{style:`number`,decimals:s}}var xJ=(e,t)=>{let n=e.filter(e=>typeof e==`number`&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},SJ=24,CJ=4,wJ=.6,TJ=(e,t)=>String(e).length*t*wJ,EJ=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`chart palette has no colour at slot ${t}`);return n};function DJ(e){let t=String(e??``).trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1]??``,t=e.length===3?[...e].map(e=>e+e).join(``):e;return[0,2,4].map(e=>Number.parseInt(t.slice(e,e+2),16))}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);return r?r.slice(1,4).map(Number):null}function OJ(e,t){let n=DJ(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function kJ(e,t,n){let r=DJ(e),i=DJ(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+((i[t]??0)-e)*n)).join(`,`)})`:e}var AJ=[.2126,.7152,.0722],jJ=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*(AJ[n]??0),0),MJ=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function NJ(e,t){let n=DJ(e),r=DJ(t.text),i=DJ(t.surface);return!n||!r||!i||MJ(jJ(n),jJ(r))>=MJ(jJ(n),jJ(i))?t.text:t.surface}var PJ=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:OJ(e,t)},{offset:1,color:OJ(e,0)}]}),FJ=(e,t)=>e+OG(e,t);function IJ(e){let t=e.x.format?.pattern;return n=>{let r=kG(n,e.timeZone);if(t===`month`||t===`year`)return oK(r,{pattern:t,timeZone:e.timeZone});let i=DG(r,e.timeZone);return i.hour||i.minute?oK(r,{pattern:`time`,timeZone:e.timeZone}):sK(r,{timeZone:e.timeZone})}}function LJ(e,t,n){let r=CJ,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 RJ(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&gq(e)<=5e3,o=vq(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=kY[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`?xq(e,r.hidden):null,g=p||e.type===`column`?LJ(e,r.hidden,p):null,_=e.series.length===1,v=r.renderer===`canvas`,[y,b]=xJ(e.series.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))),!0),x=e.stack===`percent`?Qq(e):bJ(e.y.format,e.y.min??y,e.y.max??b,i?3:4,e.y.wholeNumbers),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=e.series.filter(e=>!r.hidden.has(e.key)),T=m&&!e.valueLabels?[]:e.data.map((t,n)=>$(e,n)),E=()=>{let t=e.stack===`percent`?[1,S]:[e.y.max??b,e.y.min??y];return n.width-Math.max(...t.map(e=>TJ(Z(e,x),12)))-20},D=!1;if(e.valueLabels){let t=p?n.width-QJ(T.map(e=>TJ(e,12)))-20:cY(T.length,E())/Math.max(1,w.length);D=w.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))).filter(e=>e!=null).every(e=>TJ(Z(e,x),12)<=t)}let O={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:12,margin:12,...m||e.type!==`column`||e.x.labelFit===`auto`?{hideOverlap:!0}:uY(e.x.labelFit,T,E()),...m?{formatter:IJ(e)}:{}},...m?{}:{data:T}},k={type:`value`,splitNumber:i?3:4,min:e.stack===`percent`?S:e.y.min,max:e.stack===`percent`?1:e.y.max,minInterval:e.y.wholeNumbers?1:void 0,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:12,formatter:e=>Z(e,x)},...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:12,align:p?`right`:`left`}}:{}},A=e.zoom,j=_&&e.type!==`column`&&!p&&!i,M=e.series.map((n,r)=>{let o=EJ(t.palette,r%t.palette.length),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?fJ(h,t,n.key):r;return m?[FJ(dq(e,t),e.timeZone),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,smoothMonotone:`x`,connectNulls:!1,symbol:`circle`,showSymbol:s,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:OJ(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:n?{color:PJ(o,n)}:void 0,endLabel:j?{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?zJ(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:SJ,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:pJ(g,t,n.key)}})),label:e.valueLabels?{show:D,position:p?`right`:`top`,distance:6,fontFamily:t.font,fontSize:12,fontWeight:600,color:t.text,formatter:e=>e.value==null?``:Z(e.value,x)}:void 0,markLine:r===C?zJ(e,t,p,a):void 0}});return{...u,useUTC:m,grid:{left:4,right:j?64:i?8:16,top:e.y.label?28:D&&e.type===`column`?24:12,bottom:A?44:4,outerBoundsMode:`same`},dataZoom:A?EY(e,t,EJ(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:OJ(t.neutral,t.dark?.12:.1)}},formatter:t=>Vq(Rq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?k:O,yAxis:p?O:k,series:M}}function zJ(e,t,n,r){if(!e.target)return;let i=sJ(e).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:12,fontFamily:t.font,backgroundColor:t.surface,padding:[2,6],borderRadius:4},data:[n?{xAxis:e.target.value}:{yAxis:e.target.value}]}}function BJ(e,t,n,r,i){let{base:a,tooltipBase:o,colours:s,compact:c}=i,l=sJ(e),u=e.data.map((t,n)=>$(e,n)),d=e.data.reduce((t,n,i)=>t+(r.hidden.has($(e,i))?0:Q(e,l.key,i)??0),0);return{...a,tooltip:{...o,trigger:`item`,formatter:t=>Vq(Rq(e,t.dataIndex,r.hidden,s))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(d,cK(l.format)),x:0,y:-10,align:`center`,verticalAlign:`middle`,fill:t.text,fontSize:c?18:22,fontWeight:650,fontFamily:t.font}},{type:`text`,style:{text:e.centerLabel||`Total`,x:0,y:14,align:`center`,verticalAlign:`middle`,fill:t.label,fontSize:12,fontFamily:t.font}}]}],series:[{id:l.key,name:l.key,type:`pie`,radius:c?[`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:c?{show:!1}:{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:12,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:u[n],value:Q(e,l.key,n)??0,itemStyle:{color:Bq(e,n,s)}}))}]}}var VJ=e=>[...new Set(e)],HJ=(e,t)=>e.data.map((n,r)=>Q(e,t,r));function UJ(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var WJ=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:12,margin:12,hideOverlap:!0},...n}),GJ=(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:12,formatter:t},...n});function KJ(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:12,fontFamily:e.font},...n}}function qJ(e,t,n,r,i){let a=sJ(e),o=VJ(e.data.map((t,n)=>$(e,n))),s=hq(e),c=Oq(HJ(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:UJ(i.tooltipBase,t=>Vq(Rq(e,t.dataIndex,r.hidden,i.colours))),xAxis:WJ(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:WJ(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:KJ(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf($(e,n)),s.indexOf(fq(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 JJ=6048e5,YJ=(e,t)=>{let n=DG(e,t);return`${n.year}-${String(n.month+1).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`};function XJ(e,t){let n=e.data.map((t,n)=>dq(e,n)).filter(Number.isFinite),r=ZJ(n),i=QJ(n),a=Math.ceil((i-r)/JJ)+1,o=Math.floor((t.height-62)/7),s=Math.max($J,Math.min(eY,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)*JJ:r,to:i}}var ZJ=e=>e.reduce((e,t)=>t<e?t:e,1/0),QJ=e=>e.reduce((e,t)=>t>e?t:e,-1/0),$J=9,eY=24;function tY(e,t,n,r,i){let a=sJ(e),{cell:o,from:s,to:c}=XJ(e,n),l=Oq(HJ(e,a.key),t.seq);return{...i.base,tooltip:UJ(i.tooltipBase,t=>Vq(Rq(e,t.dataIndex,r.hidden,i.colours))),visualMap:KJ(t,l,{right:4}),calendar:{range:[YJ(s,e.timeZone),YJ(c,e.timeZone)],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:12,fontFamily:t.font,margin:8},monthLabel:{color:t.label,fontSize:12,fontFamily:t.font,margin:8},yearLabel:{show:!1}},series:[{type:`heatmap`,coordinateSystem:`calendar`,data:e.data.map((t,n)=>[YJ(dq(e,n),e.timeZone),Q(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function nY(e,t,n,r,i){let a=sJ(e),o=Aq(e.data.length,t.seq),s=Q(e,a.key,0);return{...i.base,tooltip:UJ(i.tooltipBase,t=>Vq(Rq(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=NJ(o[r],t),c=Q(e,a.key,r),l=r?`${Dq(c,Q(e,a.key,r-1))} of previous step`:`${Dq(c,s)} of ${yJ($(e,0))}`;return{name:$(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${yJ($(e,r))}} {v|${yJ(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:OJ(i,.78),fontSize:12,fontFamily:t.font}}}}})}]}}function rY(e,t,n,r,i){let a=sJ(e),{min:o,max:s}=Nq(e),c=Q(e,a.key,0),l=c??o,u=c==null?null:jq(e,c),d=EJ(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)<1&&p.push([1,t.grid]),{...i.base,tooltip:UJ(i.tooltipBase,()=>Vq(Rq(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:OJ(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|${yJ(c==null?Z(null):Z(e,a.format))}}{u|/${yJ(Z(s,a.format))}}${u?`\n{s|${yJ(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 iY(e){let t=QJ(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=ZJ(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=QJ(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 aY=4,oY=72,sY=12,cY=(e,t)=>Math.floor(t/Math.max(1,e)-aY);function lY(e,t){return QJ(e.flatMap(e=>String(e).split(/\s+/)).map(e=>TJ(e,sY)))<=t?{interval:0,width:t,overflow:`break`}:{interval:0,rotate:45,width:oY,overflow:`truncate`}}function uY(e,t,n){let r=cY(t.length,n);return e===`all`?{...lY(t,r),hideOverlap:!1}:e===`rotate`?{interval:0,rotate:45,width:oY,overflow:`truncate`,hideOverlap:!1}:e===`ellipsis`?{interval:0,rotate:0,width:Math.max(1,r),overflow:`truncate`,hideOverlap:!1}:{hideOverlap:!0}}function dY(e,t,n){let r=cY(e.length,n),i=lY(e,r);return{nameSize:sY,valueSize:12,category:`rotate`in i?{...i,hideOverlap:!0}:i,showValues:t.every(e=>TJ(e,12)<=r)}}function fY(e,t,n,r,i){let a=sJ(e),o=Pq(e),s=Qq(e),c=iY(o),l=t=>Lq(e,t.index,i.colours),u=o.map(t=>$(e,t.index)),d=o.map(e=>e.total?Z(e.value,s):zq(e.value,s)),f=o.flatMap(e=>[e.from,e.to]),p=Math.max(TJ(Z(QJ(f),s),11),TJ(Z(ZJ(f),s),11))+8,m=dY(u,d,n.width-p-12);return{...i.base,grid:{left:4,right:8,top:28,bottom:4,outerBoundsMode:`same`},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`shadow`,shadowStyle:{color:OJ(t.neutral,.1)}},formatter:t=>Vq(Rq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:WJ(t,u,{axisLabel:{color:t.label,fontSize:m.nameSize,margin:12,...m.category}}),yAxis:GJ(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 pY(e){let t=sJ(e).key;return hq(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>fq(e,t)===n).sort((n,r)=>(Q(e,t,r)??0)-(Q(e,t,n)??0)||n-r)}))}function mY(e,t,n,r,i){let a=sJ(e),o=Iq(e),s=[...o.values()].reduce((e,t)=>e+t,0),c=(e,t)=>{let r=(e??0)/s*n.width*n.height*.82;return r>5200&&Math.max(TJ(t[0],12),TJ(t[1],11.5))+20<=Math.sqrt(r)},l=pY(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=EJ(t.palette,i%t.palette.length),u=NJ(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${yJ(n)}} {v|${yJ(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:OJ(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=kJ(l,t.surface,Math.min(.55,r*.14)),o=NJ(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|${yJ($(e,n))}}\n{v|${yJ(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:OJ(o,.82),fontSize:12,fontFamily:t.font}}}}})}});return{...i.base,tooltip:UJ(i.tooltipBase,t=>t.data?.row==null?Vq({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:`Share of all`,value:Dq(mJ(t.value),s)}],foot:``}):Vq(Rq(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 hY(e){let t=uJ(e),n=e.data.map(n=>[String(n[e.x.key]),String(n[t])]),r=new Map(n.flatMap(([e,t])=>[[e,0],[t,0]]));for(let e=0;e<r.size;e+=1)for(let[e,t]of n)r.set(t,Math.max(r.get(t)??0,(r.get(e)??0)+1));return r}function gY(e,t,n,r,i){let a=sJ(e),o=uJ(e),s=Fq(e,t.palette),c=hY(e),l=QJ([...c.values()]),u=new Map,d=new Map;e.data.forEach((t,n)=>{let r=Q(e,a.key,n)??0;u.set(String(t[e.x.key]),(u.get(String(t[e.x.key]))??0)+r),d.set(String(t[o]),(d.get(String(t[o]))??0)+r)});let f=e=>d.get(e)??u.get(e)??0,p=e=>({position:e,color:t.text,fontFamily:t.font,fontSize:12,formatter:e=>`{n|${yJ(e.name)}}\n{v|${Z(f(e.name),{style:`compact`})}}`,rich:{n:{color:t.textBody,fontSize:12,fontFamily:t.font,lineHeight:15},v:{color:t.label,fontSize:12,fontFamily:t.font}}});return{...i.base,tooltip:UJ(i.tooltipBase,t=>Vq(t.dataType===`edge`?Rq(e,t.dataIndex,r.hidden,i.colours):{title:t.name,rows:[{color:t.color,label:a.label,value:Z(f(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:l+1},(e,t)=>({depth:t,label:p(t===l&&l>0?`left`:`right`)})),data:[...c.keys()].map(e=>({name:e,itemStyle:{color:s.get(e)}})),links:e.data.map(n=>({source:String(n[e.x.key]),target:String(n[o]),value:n[a.key],lineStyle:{color:s.get(String(n[e.x.key])),opacity:t.dark?.32:.26}}))}]}}function _Y(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=ZJ(e.map(e=>e[1])),s=QJ(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(ZJ(e.map(e=>e[0]))),c(QJ(e.map(e=>e[0])))]}var vY=44,yY=28,bY=8;function xY(e,t,n,r,i){let a=sJ(e),o=hq(e),s=e.type===`bubble`,c=QJ(s?e.data.map(t=>t[dJ(e)]).filter(cJ):[]),l=e=>Math.max(bY,(i.compact?yY:vY)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||fq(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?_Y(d.flatMap(t=>{let n=lJ(e,t)[e.x.key],r=Q(e,a.key,t);return cJ(n)&&r!=null?[[n,r]]:[]})):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>Q(e,a.key,n)),[h,g]=xJ(p,!1),[_,v]=xJ(m,!1),y=bJ(e.y.format,e.y.min??_,e.y.max??v,4),b=bJ(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]??NaN):i.compact?8:10,itemStyle:{color:OJ(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:[lJ(e,t)[e.x.key],Q(e,a.key,t),...s?[lJ(e,t)[dJ(e)]]:[]],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:12,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:UJ(i.tooltipBase,t=>t.data?.row==null?``:Vq(Rq(e,t.data.row,r.hidden,i.colours))),xAxis:GJ(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:12,fontFamily:t.font}}:{}}),yAxis:GJ(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:12,fontFamily:t.font,align:`left`}}:{}}),series:x}}var SY=32,CY=8,wY=26;function TY(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-wY)/o,c=s-SY-CY,l=EJ(t.palette,0),u=e.data.map((t,n)=>$(e,n)),d=e.series.flatMap((n,r)=>{let i=HJ(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?[FJ(dq(e,n),e.timeZone),r]:r};return{...i.base,useUTC:a,title:d,grid:e.series.map((e,t)=>({left:52,right:8,top:6+t*s+SY,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=>Vq(Rq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:WJ(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:12,hideOverlap:!0,margin:10,...a?{formatter:IJ(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=xJ(HJ(e,n.key),!1),o=bJ(n.format,e.y.min??i,e.y.max??a,2);return GJ(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:12,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:PJ(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function EY(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:OJ(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:OJ(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:OJ(n,.18)}},textStyle:{color:t.label,fontSize:12,fontFamily:t.font}}]}function DY(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=fq(e,n),r=e.data.map((e,t)=>t).filter(n=>fq(e,n)===t);return{seriesIndex:hq(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 pY(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 OY(e,t){switch(e.type){case`scatter`:case`bubble`:case`treemap`:{let e=hJ(t.data);return e==null?null:{series:0,row:e}}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 t.seriesIndex==null?null:{series:t.seriesIndex,row:t.dataIndex};default:return{series:0,row:t.dataIndex}}}var kY={donut:BJ,heatmap:qJ,calendar:tY,funnel:nY,gauge:rY,waterfall:fY,treemap:mY,sankey:gY,scatter:xY,bubble:xY,multiples:TY};function AY(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=yj(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(RJ(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function jY(e,{renderer:t}){let n=yj(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?gJ(n.getOption()):null,l=RJ(e,t,a,{...o,zoom:c});i=e,n.setOption(l,s||!r?{notMerge:!0}:{replaceMerge:vJ}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=DY(_J(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=OY(_J(i),t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var MY=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(MY);var NY=HTMLElement,PY=`wui-chart:select`,FY=`wui-chart:legend-change`,IY=`wui-chart:ready`,LY=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],RY=`(prefers-color-scheme: dark)`,zY=`(prefers-reduced-motion: reduce)`,BY=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,VY=!1;function HY(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(`--color-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>n(`--color-chart-seq-${e}`)),neutral:n(`--color-chart-neutral`),grid:n(`--color-chart-grid`),axis:n(`--color-chart-axis`),label:n(`--color-chart-label`),surface:n(`--color-surface`),text:n(`--color-text`),textBody:n(`--color-text-body`),textMuted:n(`--color-text-muted`),shadow:n(`--wui-shadow-popover`),font:t.fontFamily,dark:i===`dark`||i===`auto`&&!!BY(RY)?.matches,reducedMotion:!!BY(zY)?.matches};return!a.palette[0]&&!VY&&(VY=!0,yG(`[@webority/ui-elements] <wui-chart> found no --color-chart-* colours: load @webority/theme on the page.`)),a}var UY=new Set,WY=null;function GY(e){if(UY.add(e),WY)return;let t=()=>{for(let e of UY)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=[BY(RY),BY(zY)].filter(e=>e!==null);for(let e of i)e.addEventListener?.(`change`,t);WY=()=>{n.disconnect(),r.disconnect();for(let e of i)e.removeEventListener?.(`change`,t);WY=null}}function KY(e){UY.delete(e),UY.size||WY?.()}function qY(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var JY=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r},YY=0,XY=class extends NY{uid;_spec;_normal;_hidden;_focus;_awaitingSpec=!1;_parts=null;_theme=null;_width=null;_visible=!1;_resizeObserver=null;_intersection=null;_engine=null;_drawn=!1;_drawnType=null;_announcedReady=!1;_legendSignature=null;_tableSpec=null;static get observedAttributes(){return[`view`]}constructor(){super(),YY+=1,this.uid=`wui-chart-${YY}`,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}if(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(),GY(this),this._theme=HY(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`){this._visible=!1;let e=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(e.disconnect(),this._visible=!0,this._update())},{threshold:.05});this._intersection=e,e.observe(this)}else this._visible=!0;this._update()}disconnectedCallback(){KY(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null,this.removeAttribute(`data-ready`)}attributeChangedCallback(e,t,n){t!==n&&this._parts&&(tq(`view`,n,mK),this._update())}toCsv(){let{spec:e}=this._normalized();return e?qq(e):``}toPng(){let{spec:e}=this._normalized();return e?AY(e,this._theme??HY(this),this._size(e),{hidden:this._hidden,renderer:_q(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));qY(t,e??`${Jq(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&qY(t,e??`${Jq(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!(e instanceof HTMLScriptElement))return null;try{return JSON.parse(String(e.textContent))}catch(e){return bG(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e instanceof Error?e.message:void 0),null}}_normalized(){return this._normal??=iq(this._spec),this._normal}_build(){let e=JY(`div`,`wui-chart-legend`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Legend`),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-chart-legend-item`):null;t instanceof HTMLElement&&this._toggle(t.dataset.key)});let t=JY(`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=JY(`div`,`wui-chart-canvas`);n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=JY(`div`,`wui-chart-state`);r.setAttribute(`role`,`status`),r.hidden=!0;let i=JY(`div`,`wui-chart-table-wrap visually-hidden`),a=JY(`p`,`visually-hidden`);a.id=`${this.uid}-summary`;let o=JY(`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=e===null?`error`:e.state===`ready`&&(!e.data.length||!uq(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e!==null&&(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?Xq(e,this._hidden):``,e){if(!s){let t=new Set(vq(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,e===null?t:r===`error`?e.errorText:r===`loading`?e.loadingText??`Loading chart`:e.emptyText,i,o);let c=r===`ready`&&!a;s||this.toggleAttribute(`data-ready`,!c);let l=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`)),l&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts?.state;if(!i)return;let a=!r&&e!==`ready`;i.hidden=!a,a?(i.style.height=n,e===`loading`?i.replaceChildren(JY(`div`,`skeleton wui-chart-skeleton`),JY(`span`,`visually-hidden`,t)):i.replaceChildren(JY(`p`,`wui-chart-state-text`,t))):i.replaceChildren()}_colour(e,t){let n=this._theme;if(n)return e.type===`donut`?Lq(e,t,n):n.palette[t]}_renderLegend(e,t){let n=this._parts?.legend;if(!n)return;let r=e?vq(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!e||!i)return;let a=yq(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=JY(`button`,`wui-chart-legend-item`);r.type=`button`,r.dataset.key=t;let i=JY(`span`,e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`),s=o[n];return s!==void 0&&(i.style.background=s),r.append(i,JY(`span`,`wui-chart-legend-label`,a[n])),r})));for(let e of n.children){if(!(e instanceof HTMLElement))throw Error(`Expected a legend item to be an HTMLElement.`);let t=e.dataset.key;e.setAttribute(`aria-pressed`,String(t===void 0||!this._hidden.has(t)))}}_renderTable(e){if(this._tableSpec===e||!this._parts)return;this._tableSpec=e;let t=Wq(e),n=JY(`table`,`wui-chart-table`);n.append(JY(`caption`,`visually-hidden`,t.caption));let r=JY(`tr`);t.head.forEach((e,t)=>{let n=JY(`th`,t?`wui-chart-num`:null,e);n.scope=`col`,r.append(n)});let i=JY(`thead`);i.append(r),n.append(i);let a=JY(`tbody`);for(let e of t.rows){let t=JY(`tr`),n=JY(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>JY(`td`,`wui-chart-num`,e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(JY(`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();if(!e||!this._parts||!this._theme)return;let t=_q(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=jY(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this.setAttribute(`data-ready`,``),this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(IY,{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=HY(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&&(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(vq(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(FY,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||!this._theme||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(!LY.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=aJ(t,this._focus,e.key,this._hidden);n?(this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(Hq(Rq(t,n.index,this._hidden,this._theme)))):this._clearFocus()}_announce(e){let t=this._parts?.live;t&&(t.textContent=e===t.textContent?`${e} `:e)}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized();if(!n)return;let r=n.series[TK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(PY,{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}}))}};return r(`wui-chart`,XY),e.CHART_STATES=pK,e.CHART_TYPES=lK,e.CHART_VIEWS=mK,e.MAX_SERIES=hK,e.MAX_SLICES=gK,e.RENDERERS=fK,e.STACK_MODES=uK,e.WuiChart=XY,e.X_KINDS=dK,e.formatValue=Z,e.normalizeSpec=iq,e})({});
|
|
20
|
+
`:``,i=` {`+r,a=r+`}`,o=I(L(e),function(t){return t+i+I(L(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=I(L(t),function(e){return`@keyframes `+e+i+I(L(t[e]),function(n){return n+i+I(L(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 RU(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function zU(e,t,n,r){return NU(`svg`,`root`,{width:e,height:t,xmlns:DU,"xmlns:xlink":OU,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var BU=0;function VU(){return BU++}var HU={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`},UU=`transform-origin`;function WU(e,t,n){var r=A({},e.shape);A(r,t),e.buildPath(n,r);var i=new yU;return i.reset(gi(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function GU(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[UU]=n+`px `+r+`px`)}var KU={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function qU(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function JU(e,t,n){var r=e.shape.paths,i={},a,o;if(F(r,function(e){var t=RU(n.zrId);t.animation=!0,XU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=L(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=qU(i,n);return a.replace(o,s)}}function YU(e){return H(e)?HU[e]?`cubic-bezier(`+HU[e]+`)`:Tr(e)?e:``:``}function XU(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof Ed){var s=JU(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=YU(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=YU(d.easing),m=d.rawValue;(H(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={};Zn(g,e),A(g,s[h]);var _=_i(g),v=s[h][u];l[h]=_?{transform:_}:{},GU(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 $a);var S=y.len();y.reset(),l[h].d=WU(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 KU[e]})}for(var w=L(l),T=!0,E,f=1;f<w.length;f++){var D=w[f-1],O=w[f];if(l[D][UU]!==l[O][UU]){T=!1;break}E=l[D][UU]}if(T&&E){for(var h in l)l[h][UU]&&delete l[h][UU];t[UU]=E}if(re(w,function(e){return L(l[e]).length>0}).length)return qU(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-`+VU();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function ZU(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};QU(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=Zr(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),QU(r,t,n,!0)}}}function QU(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+VU(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var $U=Math.round;function eW(e){return e&&H(e.src)}function tW(e){return e&&V(e.toDataURL)}function nW(e,t,n,r){EU(function(i,a){var o=i===`fill`||i===`stroke`;o&&mi(a)?_W(t,e,i,r):o&&di(a)?vW(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),gW(n,e,r)}function rW(e,t){var n=yD(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[jU+`silent`]=`true`))}function iW(e){return ti(e[0]-1)&&ti(e[1])&&ti(e[2])&&ti(e[3]-1)}function aW(e){return ti(e[4])&&ti(e[5])}function oW(e,t,n){if(t&&!(aW(t)&&iW(t))){var r=n?10:1e4;e.transform=iW(t)?`translate(`+$U(t[4]*r)/r+` `+$U(t[5]*r)/r+`)`:ii(t)}}function sW(e,t,n){for(var r=e.points,i=[],a=0;a<r.length;a++)i.push($U(r[a][0]*n)/n),i.push($U(r[a][1]*n)/n);t.points=i.join(` `)}function cW(e){return!e.smooth}function lW(e){var t=I(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]]=$U(o*r)/r)}}}var uW={circle:[lW([`cx`,`cy`,`r`])],polyline:[sW,cW],polygon:[sW,cW]};function dW(e){for(var t=e.animators,n=0;n<t.length;n++)if(t[n].targetName===`shape`)return!0;return!1}function fW(e,t){var n=e.style,r=e.shape,i=uW[e.type],a={},o=t.animation,s=`path`,c=e.style.strokePercent,l=t.compress&&gi(e)||4;if(i&&!t.willUpdate&&(!i[1]||i[1](r))&&!(o&&dW(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 yU,h.reset(l),f.rebuildPath(h,c),h.generateStr(),m.__svgPathVersion=p,m.__svgPathStrokePercent=c),a.d=h.getStr()}return oW(a,e.transform),nW(a,n,e,t),rW(a,e),t.animation&&XU(e,a,t),t.emphasis&&ZU(e,a,t),NU(s,e.id+``,a)}function pW(e,t){var n=e.style,r=n.image;if(r&&!H(r)&&(eW(r)?r=r.src:tW(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),oW(c,e.transform),nW(c,n,e,t),rW(c,e),t.animation&&XU(e,c,t),NU(`image`,e.id+``,c)}}function mW(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=oi(n.y||0,hn(i),n.textBaseline),s={"dominant-baseline":`central`,"text-anchor":ai[n.textAlign]||n.textAlign};if(Xo(n)){var c=``,l=n.fontStyle,u=Jo(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),oW(s,e.transform),nW(s,n,e,t),rW(s,e),t.animation&&XU(e,s,t),NU(`text`,e.id+``,s,void 0,r)}}function hW(e,t){if(e instanceof To)return fW(e,t);if(e instanceof jo)return pW(e,t);if(e instanceof Do)return mW(e,t)}function gW(e,t,n){var r=e.style;if(si(r)){var i=ci(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=$r(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]=NU(`filter`,o,{id:o,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`},[NU(`feDropShadow`,``,{dx:u/c,dy:d/l,stdDeviation:v,"flood-color":h,"flood-opacity":m})]),a[i]=o}t.filter=hi(o)}}function _W(e,t,n,r){var i=e[n],a,o={gradientUnits:i.global?`userSpaceOnUse`:`objectBoundingBox`};if(fi(i))a=`linearGradient`,o.x1=i.x,o.y1=i.y,o.x2=i.x2,o.y2=i.y2;else if(pi(i))a=`radialGradient`,o.cx=W(i.x,.5),o.cy=W(i.y,.5),o.r=W(i.r,.5);else return;for(var s=i.colorStops,c=[],l=0,u=s.length;l<u;++l){var d=ri(s[l].offset)*100+`%`,f=s[l].color,p=$r(f),m=p.color,h=p.opacity,g={offset:d};g[`stop-color`]=m,h<1&&(g[`stop-opacity`]=h),c.push(NU(`stop`,l+``,g))}var _=IU(NU(a,``,o,c)),v=r.gradientCache,y=v[_];y||(y=r.zrId+`-g`+r.gradientIdx++,v[_]=y,o.id=y,r.defs[y]=NU(a,y,o,c)),t[n]=hi(y)}function vW(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(li(i)){var f=i.imageWidth,p=i.imageHeight,m=void 0,h=i.image;if(H(h)?m=h:eW(h)?m=h.src:tW(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=it(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=NU(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=O(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=_i(i);x&&(o.patternTransform=x);var S=NU(`pattern`,``,o,[d]),C=IU(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=NU(`pattern`,T,o,[d])),t[n]=hi(T)}}function yW(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]=NU(`clipPath`,a,o,[fW(e,n)])}t[`clip-path`]=hi(a)}function bW(e){return document.createTextNode(e)}function xW(e,t,n){e.insertBefore(t,n)}function SW(e,t){e.removeChild(t)}function CW(e,t){e.appendChild(t)}function wW(e){return e.parentNode}function TW(e){return e.nextSibling}function EW(e,t){e.textContent=t}var DW=58,OW=120,kW=NU(``,``);function AW(e){return e===void 0}function jW(e){return e!==void 0}function MW(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 NW(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function PW(e){var t,n=e.children,r=e.tag;if(jW(r)){var i=e.elm=MU(r);if(LW(kW,e),B(n))for(t=0;t<n.length;++t){var a=n[t];a!=null&&CW(i,PW(a))}else jW(e.text)&&!U(e.text)&&CW(i,bW(e.text))}else e.elm=bW(e.text);return e.elm}function FW(e,t,n,r,i){for(;r<=i;++r){var a=n[r];a!=null&&xW(e,PW(a),t)}}function IW(e,t,n,r){for(;n<=r;++n){var i=t[n];i!=null&&(jW(i.tag)?SW(wW(i.elm),i.elm):SW(e,i.elm))}}function LW(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)===OW?n===`xmlns:xlink`||n===`xmlns`?r.setAttributeNS(kU,n,o):n.charCodeAt(3)===DW?r.setAttributeNS(AU,n,o):n.charCodeAt(5)===DW?r.setAttributeNS(OU,n,o):r.setAttribute(n,o):r.setAttribute(n,o))}for(n in i)n in a||r.removeAttribute(n)}}function RW(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]:NW(o,l)?(zW(o,l),o=t[++r],l=n[++i]):NW(s,u)?(zW(s,u),s=t[--a],u=n[--c]):NW(o,u)?(zW(o,u),xW(e,o.elm,TW(s.elm)),o=t[++r],u=n[--c]):NW(s,l)?(zW(s,l),xW(e,s.elm,o.elm),s=t[--a],l=n[++i]):(AW(d)&&(d=MW(t,r,a)),f=d[l.key],AW(f)?xW(e,PW(l),o.elm):(p=t[f],p.tag===l.tag?(zW(p,l),t[f]=void 0,xW(e,p.elm,o.elm)):xW(e,PW(l),o.elm)),l=n[++i]);(r<=a||i<=c)&&(r>a?(m=n[c+1]==null?null:n[c+1].elm,FW(e,m,n,i,c)):IW(e,t,r,a))}function zW(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(LW(e,t),AW(t.text)?jW(r)&&jW(i)?r!==i&&RW(n,r,i):jW(i)?(jW(e.text)&&EW(n,``),FW(n,null,i,0,i.length-1)):jW(r)?IW(n,r,0,r.length-1):jW(e.text)&&EW(n,``):e.text!==t.text&&(jW(r)&&IW(n,r,0,r.length-1),EW(n,t.text)))}function BW(e,t){if(NW(e,t))zW(e,t);else{var n=e.elm,r=wW(n);PW(t),r!==null&&(xW(r,t.elm,TW(n)),IW(r,[e],0,0))}return t}var VW=0,HW=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=UW(`configLayer`),this.storage=t,this._opts=n=A({},n),this.root=e,this._id=`zr`+VW++,this._oldVNode=zU(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=MU(`svg`);LW(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`,BW(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return hW(e,RU(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=RU(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=WW(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=NU(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=I(L(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(NU(`defs`,`defs`,{},c)),e.animation){var l=LU(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=NU(`style`,`stl`,{},[],l);a.push(u)}}return zU(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},IU(this.renderToVNode({animation:W(e.cssAnimation,!0),emphasis:W(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:W(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 _={};yW(d[g],_,t);var v=NU(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=hW(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=yk(r,0,n),t=yk(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(di(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=vi(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}();function UW(e){return function(){}}function WW(e,t,n,r){var i;if(n&&n!==`none`){if(i=NU(`rect`,`bg`,{width:e,height:t,x:`0`,y:`0`}),mi(n))_W({fill:n},i.attrs,`fill`,r);else if(di(n))vW({style:{fill:n},dirty:je,getBoundingRect:function(){return{width:e,height:t}}},i.attrs,`fill`,r);else{var a=$r(n),o=a.color,s=a.opacity;i.attrs.fill=o,s<1&&(i.attrs[`fill-opacity`]=s)}}return i}function GW(e){e.registerPainter(`svg`,HW)}function KW(e,t,n){var r=f.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 qW(e){return!e.__cursors.get(0)}function JW(e){var t=e.__cursors.get(0);return{startIdx:t?t.startIdx:0,endIdx:t?t.endIdx:0}}var YW=function(e){a(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||=Wi,typeof t==`string`?a=KW(t,n,r):U(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=JW(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=KW(`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 q(0,0,0,0);function c(e){if(e.isFinite()&&!e.isZero()){if(i.length===0){var t=new q(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 q(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}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 q(0,0,0,0);t.copy(e),i.push(t)}o||=i.length>=a}}}for(var l=JW(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);else{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||gk(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=Ok(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&&F(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(Hi),XW=1e5,ZW=314159,QW=void 0,$W=1,eG=2;function tG(e){return e?e.__builtin__?!0:typeof e.resize==`function`&&typeof e.refresh==`function`:!1}function nG(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 rG(e,t,n,r){var i=new YW(e,t,t.dpr);return i.zlevel=n,i.zlevel2=r,i.__builtin__=!0,iG(i),i}function iG(e){e.__cursorStack=[],e.__cursors=G()}function aG(e){return e.startIdx=e.drawIdx=e.endIdx=e.endIdxNew=0,e.used=!1,e.first=e.last=NaN,e.notClearIdx=-1,e}function oG(e,t){var n=e.__cursors,r=+t;return n.get(r)||(e.__cursorStack.push(r),n.set(r,aG({key:r})))}function sG(e,t){for(var n=e.__cursorStack,r=0;r<n.length;r++)t(e.__cursors.get(n[r]))}function cG(e,t){var n=e.layers;return n[t]||(n[t]=[,,,])}function lG(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&uG&&!s.__builtin__||n&dG&&s.__builtin__||n&fG&&s===e.hoverlayer)||t(s,a,o,i)}}var uG=1,dG=2,fG=4,pG=uG|fG,mG=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=A({},n||{}),this.dpr=n.devicePixelRatio||Wi,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=rG(a,this,ZW,0);c.initContext(),this._insertLayer(c,ZW,0,!0),this._domRoot=e}else{this._width=yk(e,0,n),this._height=yk(e,1,n);var l=this._domRoot=nG(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&&!U(e)?{paintAll:!!e}:e||{},n=W(t.refresh,!0),r=W(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=eG),!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 lG(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},dG),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=QW,n!==QW&&(!t&&n===eG&&(t=this._i.hoverlayer=this._ensureLayer(XW)),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),qk(i,s,r),c&&(s.style=l)}}i&&(Jk(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(XW)},e.prototype.paintOne=function(e,t){Kk(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)lG(this._i,function(e){e.afterBrush&&e.afterBrush()},pG),this._paintHoverList(e);else{var i=this;UE(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(ZW).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),lG(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},uG)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return lG(this._i,function(i){var a=!1;if(sG(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!qW(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)}sG(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},pG),Pe.wxa&&lG(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=qW(e),c=s&&f.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d<t.endIdx;d++){var p=n[d];if(!(d<l&&!p.notClear)){if(p.__inHover&&(this._hoverLayerDirty=eG),r!=null){var m=p.getPaintRect();m&&m.intersect(r)&&(qk(o,p,a),p.setPrevPaintRect(m))}else qk(o,p,a);if(s&&f.getTime()-c>15){d++;break}}}Jk(o,a),t.drawIdx=Math.max(d,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=ZW,t=0);var i=cG(this._i,e)[t];return i||(i=rG(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&k(i,this._layerConfig[e],!0),(n||r&&e!==ZW)&&(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])&&tG(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=cG(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),cG(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 lG(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return lG(this._i,function(n,r){e.call(t,n,r)},uG)},e.prototype.eachOtherLayer=function(e,t){return lG(this._i,function(n,r){e.call(t,n,r)},dG)},e.prototype.getLayers=function(){var e={};return lG(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}}lG(n._i,function(e){e.__dirty=!1,sG(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},pG);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__))D(`ZLevel `+d+` has been used by unknown layer `+o.id);else{if((!s||f!==s.key)&&(s=oG(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))}}lG(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;(qW(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&&(sG(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===QW&&(n._hoverLayerDirty=$W))},pG)},e.prototype.clear=function(){return lG(this._i,function(e){e.clear(),iG(e)},uG),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,lG(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?k(n[e],t,!0):n[e]=t,lG(this._i,function(e,t){k(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=yk(i,0,r),t=yk(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,lG(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(ZW).resize(e,t)}return this},e.prototype.clearLayer=function(e){F(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[ZW][0].dom;var t=new YW(`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;lG(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];qk(n,l,a)}Jk(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function hG(e){e.registerPainter(`canvas`,mG)}var gG=Object.freeze({INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`,JPY:`¥`}),_G=e=>typeof e==`string`&&/^[A-Z]{3}$/.test(e),vG=(e=`INR`)=>gG[e]??`${e} `;function yG(e,...t){console.warn(e,...t)}function bG(e,...t){console.error(e,...t)}function xG(e,t){if(e==null)throw Error(t);return e}var SG=`Asia/Kolkata`,CG=198e5,wG=new Map;function TG(e){let t=wG.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),wG.set(e,t)),t}function EG(e){if(typeof e!=`string`||e===``)return!1;try{return TG(e),!0}catch{return!1}}function DG(e,t=SG){if(t===`Asia/Kolkata`){let t=new Date(e+CG);return{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}let n=Object.fromEntries(TG(t).formatToParts(e).map(e=>[e.type,Number(e.value)]));return{year:Number(n.year),month:Number(n.month)-1,day:Number(n.day),hour:Number(n.hour)%24,minute:Number(n.minute),second:Number(n.second)}}function OG(e,t=SG){if(t===`Asia/Kolkata`)return CG;let n=DG(e,t),r=new Date(0);return r.setUTCFullYear(n.year,n.month,n.day),r.setUTCHours(n.hour,n.minute,n.second,0),r.getTime()-Math.floor(e/1e3)*1e3}function kG(e,t=SG){let n=e-OG(e,t);return n=e-OG(n,t),n}var AG=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],jG=[`rupees`,`paise`],MG=[`ms`,`s`,`min`,`h`],NG=[`day`,`month`,`year`,`datetime`,`time`],PG=`−`,FG=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],IG=(e,t)=>xG(e[t],`no compact unit at index ${t}`),LG=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],RG=[[1e9,`B`],[1e6,`M`],[1e3,`K`]],zG=e=>!e||e===`INR`?`en-IN`:`en-US`,BG=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=20?e:t,VG=new Map,HG=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=VG.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:e}),VG.set(n,r)),r},UG=new Map,WG=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=UG.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e}),UG.set(n,r)),r},GG=e=>typeof e==`number`&&Number.isFinite(e),KG=e=>e<0&&!Object.is(Math.abs(e),0)?PG:``;function qG(e){if(!Number.isInteger(e))throw Error(`A paise amount must be a whole number, got ${e}`);let t=BigInt(Math.abs(e)).toString().padStart(3,`0`);return`${e<0?`-`:``}${t.slice(0,-2)}.${t.slice(-2)}`}var JG=(e,t)=>t===`paise`?Number(qG(e)):e,YG=2,XG=(e,t,n)=>{let r=Math.min(t,YG),i=10n**BigInt(YG-r),a=(BigInt(qG(e).replace(`.`,``))+i/2n)/i,o=10n**BigInt(r),s=WG(0,n).format(a/o);return t===0?s:`${s}.${(a%o).toString().padStart(r,`0`)}${`0`.repeat(t-r)}`};function ZG(e,{decimals:t}={}){if(!GG(e))return`-`;let n=HG(BG(t,2)).format(Math.abs(e));return n===`0`?`0`:KG(e)+n}function QG(e,{unit:t=`rupees`,decimals:n,currency:r=`INR`}={}){if(!GG(e))return`-`;let i=BG(n,0),a=zG(r),o=t===`paise`?XG(Math.abs(e),i,a):WG(i,a).format(Math.abs(e));return(Number(o.replace(/,/g,``))===0?``:KG(e))+vG(r)+o}var $G=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2;function eK(e,{currency:t,unit:n=`rupees`}={}){if(!GG(e))return`-`;let r=t?JG(e,n):e,i=t?vG(t):``,a=t?zG(t):`en-IN`,o=a===`en-IN`?LG:RG,s=Math.abs(r),c=o.findIndex(([e])=>s>=e);if(c===-1){let e=HG($G(s),a).format(s);if(e!==`1,000`)return(e===`0`?``:KG(r))+i+e;c=o.length-1}let[l,u]=IG(o,c),d=s/l,f=d>=100?0:d>=10?1:2,p=Number(d.toFixed(f));return p>=100&&c>0&&(--c,[l,u]=IG(o,c),d=s/l,f=d>=100?0:d>=10?1:2,p=Number(d.toFixed(f))),`${KG(r)}${i}${HG(f,a).format(p)} ${u}`}function tK(e,{decimals:t}={}){return GG(e)?`${ZG(e*100,{decimals:BG(t,1)})}%`:`-`}var nK={ms:1,s:1e3,min:6e4,h:36e5};function rK(e,{unit:t=`s`}={}){if(!GG(e))return`-`;let n=nK[t]??1e3,r=Math.abs(e*n),i=KG(e);if(Math.round(r)<1e3)return`${i}${HG(0).format(r)} ms`;let a=r/1e3;if(a<10)return`${i}${HG(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}${HG(0).format(l)}h ${s(c%60)}m`}function iK(e,t=SG){if(e instanceof Date)return e.getTime();if(GG(e))return e;if(typeof e!=`string`)return NaN;let n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(n){let[e,r,i]=[Number(n[1]),Number(n[2]),Number(n[3])],a=new Date(Date.UTC(2e3,r-1,i));return a.setUTCFullYear(e),a.getUTCFullYear()===e&&a.getUTCMonth()===r-1&&a.getUTCDate()===i?kG(a.getTime(),t):NaN}return Date.parse(e)}function aK(e,t=SG){let{year:n,month:r,day:i,hour:a,minute:o}=DG(e,t);return{year:n,month:r,day:i,hour:a,minute:o}}function oK(e,{pattern:t=`day`,timeZone:n=SG}={}){let r=iK(e,n);if(!Number.isFinite(r))return`-`;let i=aK(r,n),a=e=>String(e).padStart(2,`0`),o=`${a(i.day)}-${FG[i.month]}-${i.year}`,s=`${a(i.hour)}:${a(i.minute)}`;switch(t){case`month`:return`${FG[i.month]}-${i.year}`;case`year`:return String(i.year);case`datetime`:return`${o} ${s}`;case`time`:return s;default:return o}}function sK(e,{timeZone:t=SG}={}){let n=iK(e,t);if(!Number.isFinite(n))return`-`;let r=aK(n,t);return`${String(r.day).padStart(2,`0`)}-${FG[r.month]}`}function Z(e,t){if(e==null||e===``)return`-`;let n=t?.style;if(n===`date`)return oK(e,t);if(typeof e!=`number`)return String(e);switch(n){case`currency`:return QG(e,t);case`percent`:return tK(e,t);case`compact`:return eK(e,t);case`duration`:return rK(e,t);default:return ZG(e,t)}}function cK(e){let t=e?.style;return t===`currency`?{style:`compact`,currency:e?.currency??`INR`,unit:e?.unit}:!t||t===`number`?{style:`compact`}:e??{}}var lK=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],uK=[`none`,`stacked`,`percent`],dK=[`category`,`time`,`value`],fK=[`auto`,`svg`,`canvas`],pK=[`ready`,`loading`,`empty`,`error`],mK=[`chart`,`table`],hK=8,gK=6,_K=`Other`,vK=`No data to show for this chart.`,yK=`This chart couldn't load. Try again in a moment.`,bK=`Loading chart`,xK=`This chart has more series than it can show clearly.`,SK=`This chart has more groups than it can show clearly.`,CK={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`},wK=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],TK=e=>wK.includes(e),EK=[`area`,`column`,`bar`],DK=[`line`,`area`,`column`,`bar`,`multiples`],OK={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},kK={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`],centerLabel:[`donut`],valueLabels:[`column`,`bar`]},AK={gauge:240,calendar:200,treemap:340,sankey:340},jK=100,MK=72,NK=32,PK=[`type`,`title`,`description`,`data`,`x`,`series`,`group`,`to`,`size`,`trend`,`zoom`,`bands`,`stack`,`y`,`target`,`centerLabel`,`valueLabels`,`height`,`state`,`emptyText`,`errorText`,`loadingText`,`renderer`,`timeZone`],FK=[`key`,`kind`,`format`,`label`,`labelFit`],IK=[`auto`,`all`,`rotate`,`ellipsis`],LK=[`key`,`label`,`format`],RK=[`key`,`label`],zK=[`key`,`label`,`format`],BK=[`upTo`,`label`],VK=[`label`,`format`,`min`,`max`,`wholeNumbers`],HK=[`value`,`label`],UK=[`style`,`currency`,`unit`,`decimals`,`pattern`],WK=[...jG,...MG],GK=new Set;function KK(e){GK.has(e)||(GK.add(e),yG(`[@webority/ui-elements] <wui-chart> ${e}`))}var qK=e=>e.map(e=>`"${e}"`).join(` | `),JK=e=>typeof e==`number`&&Number.isFinite(e),YK=e=>typeof e==`object`&&!!e&&!Array.isArray(e),XK=(e,t)=>Reflect.get(e,t),ZK=e=>e===null||typeof e==`string`||typeof e==`number`,QK=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ZK(t)?t:null]));function $K(e,t){if(e==null)throw Error(`${t} missing`);return e}var eq=(e,t)=>e.some(e=>e===t);function tq(e,t,n){t==null||n.includes(t)||KK(`received ${e}="${String(t)}", which is not one of ${qK(n)}. The chart uses its default instead.`)}function nq(e,t,n){for(let r of Object.keys(t))n.includes(r)||(/^(y2|secondary)/i.test(r)?KK(`ignores ${e}.${r}: a chart has one value axis by design. Show the second measure as its own chart.`):KK(`ignores the unknown key ${e}.${r}. Known keys: ${n.join(`, `)}.`))}function rq(e,t){if(t==null)return;if(typeof t!=`object`){KK(`expects ${e} to be an object such as { style: "currency" }.`);return}nq(e,t,UK);let n=XK(t,`style`);tq(`${e}.style`,n,AG);let r=XK(t,`currency`);r!=null&&!_G(r)&&KK(`received ${e}.currency="${String(r)}", which is not an ISO 4217 code such as "INR". The chart uses INR instead.`);let i=XK(t,`unit`);i!=null&&tq(`${e}.unit`,i,n===`duration`?MG:jG);let a=XK(t,`pattern`);tq(`${e}.pattern`,a,NG);let o=XK(t,`decimals`);o!=null&&!(typeof o==`number`&&Number.isInteger(o)&&o>=0&&o<=20)&&KK(`received ${e}.decimals=${String(o)}, which is not a whole number from 0 to 20. The chart uses its default instead.`);let s={style:eq(AG,n)?n:`number`};return typeof r==`string`&&_G(r)&&(s.currency=r),eq(WK,i)&&(s.unit=i),typeof o==`number`&&(s.decimals=o),eq(NG,a)&&(s.pattern=a),s}function iq(e){let t=(e,t=yK)=>(bG(`[@webority/ui-elements] <wui-chart> ${e}`),{spec:null,problem:t});if(!YK(e))return t('has no spec: set the `spec` property or add a <script type="application/json"> child.');let n=e;nq(`spec`,n,PK);let r=XK(n,`type`);if(tq(`type`,r,lK),!eq(lK,r))return t(`cannot draw type "${String(r)}".`);let i=r,a=XK(n,`title`);typeof a==`string`&&a.trim()||KK("needs a `title`: it names the chart for screen readers and names exported files.");for(let[e,t]of Object.entries(kK))XK(n,e)!=null&&!t.includes(i)&&KK(`ignores spec.${e} on a ${i} chart: it applies to ${t.join(`, `)}.`);let o=XK(n,`x`),s=YK(o)?o:{};nq(`spec.x`,s,FK);let c=OK[i]??[`category`],l=XK(s,`kind`);tq(`x.kind`,l,dK),eq(dK,l)&&!c.includes(l)&&KK(`ignores x.kind="${l}" on a ${i} chart: it takes ${qK(c)}.`);let u=XK(s,`labelFit`);tq(`x.labelFit`,u,IK);let d=rq(`x.format`,XK(s,`format`)),f=XK(s,`key`);typeof f!=`string`&&i!==`gauge`&&KK("needs `x.key`, the column holding each row's x value or slice name.");let p=typeof f==`string`?f:``,m=XK(n,`y`),h=YK(m)?m:{};nq(`spec.y`,h,VK);let g=rq(`y.format`,XK(h,`format`)),_=XK(n,`series`),v=Array.isArray(_)?_.filter(YK):[],y=[];for(let[e,t]of v.entries()){nq(`spec.series[${e}]`,t,LK);let n=rq(`series[${e}].format`,XK(t,`format`)),r=XK(t,`key`);typeof r!=`string`&&KK(`needs series[${e}].key, the column holding that series' values.`);let i=XK(t,`label`);y.push({key:String(r),named:typeof r==`string`,label:typeof i==`string`&&i?i:String(r),format:n})}let b=y[0];if(!b)return t(`has no series to draw.`);let x=y.filter(e=>e.named).map(e=>e.key),S=x.find((e,t)=>x.indexOf(e)!==t);if(S!==void 0)return t(`has two series with the key "${S}": each series needs its own key.`);if(y.length>8)return t(`refuses ${y.length} series: 8 is the most that stay distinguishable. Fold the smallest into an Other series, or split the chart.`,xK);let C=TK(i);if(C&&y.length>1){let e=i===`donut`?`Compare parts across groups with a percent-stacked column instead.`:`Show the other measures as their own charts, or use small multiples.`;KK(`draws one series as a ${i}; it got ${y.length} and shows the first. ${e}`)}let w=(e,t,n,r)=>{if(t==null)return null;if(!YK(t))return KK(`expects ${e} to be an object such as { key: "column" }.`),null;nq(e,t,n);let i=XK(t,`key`);if(typeof i!=`string`)return KK(`needs ${e}.key, the column holding ${r}.`),null;let a=rq(`${e}.format`,XK(t,`format`)),o=XK(t,`label`);return{key:i,label:typeof o==`string`?o:``,format:a}},T=kK.group.includes(i)?w(`spec.group`,XK(n,`group`),RK,`each row's group`):null,E=i===`sankey`?w(`spec.to`,XK(n,`to`),RK,`where each flow ends`):null,D=i===`bubble`?w(`spec.size`,XK(n,`size`),zK,`each bubble's size`):null;if((i===`heatmap`||i===`treemap`)&&!T)return t(`needs \`group.key\` to draw a ${i}: the column holding each ${i===`heatmap`?`row`:`parent`}.`);if(i===`sankey`&&!E)return t("needs `to.key` to draw a sankey: the column holding where each flow ends.");if(i===`bubble`&&!D)return t("needs `size.key` to draw a bubble chart: the column holding each bubble's size.");let O=EK.includes(i)?uK:[`none`],k=XK(n,`stack`);tq(`stack`,k,O);let A=XK(n,`state`);tq(`state`,A,pK);let j=XK(n,`renderer`);tq(`renderer`,j,fK);let M=XK(n,`timeZone`);M!=null&&!EG(M)&&KK(`received timeZone="${String(M)}", which is not a time zone this browser knows. The chart uses Asia/Kolkata instead.`);let N=EG(M)?M:SG,ee=XK(n,`target`),P=YK(ee)?XK(ee,`value`):void 0;ee!=null&&(YK(ee)&&nq(`spec.target`,ee,HK),YK(ee)&&JK(P)||KK("ignores a `target` without a numeric `value`."));let te=XK(n,`trend`);te!=null&&typeof te!=`boolean`&&KK("expects `trend` to be true or false.");let F=XK(n,`zoom`);F!=null&&typeof F!=`boolean`&&KK("expects `zoom` to be true or false.");let I=[],ne=XK(n,`bands`);if(i===`gauge`&&ne!=null){let e=Array.isArray(ne)?ne.filter(YK):[];for(let t of e)nq(`spec.bands[]`,t,BK);I=e.map(e=>({upTo:XK(e,`upTo`),label:XK(e,`label`)})).filter(e=>JK(e.upTo)&&typeof e.label==`string`&&e.label!==``).sort((e,t)=>e.upTo-t.upTo),Array.isArray(ne)&&I.length===e.length||KK("ignores a gauge band without a numeric `upTo` and a `label`.")}let re=g??b.format,ie=(C?y.slice(0,1):y).map(e=>({key:e.key,label:e.label,format:e.format??re})),L=eq(c,l)?l:c[0],ae=XK(n,`data`),R=Array.isArray(ae)?ae:[],z=R.filter(YK).map(QK),B=-1,V=null,H=b.key;i===`donut`&&z.length>6&&(V=z,{data:z,otherIndex:B}=sq(z,p,H),KK(`draws at most 6 donut slices; the smallest ${R.length-5} are shown as "${_K}". Send fewer rows, or use a bar chart for many parts.`));let oe=(e,t)=>{let n=z.filter(e);n.length!==z.length&&KK(`leaves out ${z.length-n.length} row(s) ${t}.`),z=n},se=e=>e!=null&&e!==``,U=e=>JK(e)&&e>0;if(L===`time`&&DK.includes(i)&&oe(e=>Number.isFinite(iK(e[p],N)),`without a readable date`),i===`gauge`&&z.length>1)KK(`draws one value as a gauge; it got ${z.length} rows and shows the first.`),z=z.slice(0,1);else if(i===`scatter`||i===`bubble`){oe(e=>JK(e[p])&&JK(e[H])&&(i!==`bubble`||D!=null&&U(e[D.key])),`without a number for x and y (and a positive size)`);let e=new Set(T?z.map(e=>String(e[T.key]??``)):[]);if(e.size>3)return t(`refuses ${e.size} colour groups on a ${i} chart: 3 is the most that stay tellable apart. Keep the three that matter and fold the rest into one, or split the chart.`,SK)}else if(i===`calendar`)oe(e=>Number.isFinite(iK(e[p],N)),`without a readable date`);else if(i===`heatmap`&&T)oe(e=>se(e[p])&&se(e[T.key]),`without a column or a row`);else if(i===`treemap`&&T){oe(e=>se(e[p])&&se(e[T.key])&&U(e[H]),`without a name, a parent and a positive size`);let e=new Set(z.map(e=>String(e[T.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.`,SK)}else if(i===`sankey`&&E){oe(e=>se(e[p])&&se(e[E.key])&&U(e[H]),`without a start, an end and a positive size`);let e=aq(z,p,E.key);if(e)return t(e.reason,e.text)}else if(i===`waterfall`){let e=oq(z,H);if(e?.refuse)return t(e.refuse);e?.warn&&KK(e.warn)}let ce=XK(n,`height`),le=JK(ce)&&ce>0?ce:null;if(i===`multiples`){let e=MK*ie.length+NK;le!=null&&le<e&&(KK(`needs at least ${e}px of height for ${ie.length} small charts; it got ${le}px and draws at ${e}px.`),le=e),le??=jK*ie.length+40}le??=AK[i]??320;let ue=eq(O,k)?k:`none`,de=kK.valueLabels.includes(i)&&XK(n,`valueLabels`)===!0;de&&ue!==`none`&&KK(`ignores valueLabels on a stacked chart.`);let fe=de&&ue===`none`,pe=XK(n,`description`),me=XK(s,`label`),W=XK(h,`label`),he=XK(h,`min`),ge=XK(h,`max`),_e=XK(n,`centerLabel`),ve=(e,t)=>typeof e==`string`&&e?e:t;return{problem:null,spec:{type:i,title:typeof a==`string`?a.trim():``,description:typeof pe==`string`?pe:``,data:z,allData:V??z,x:{key:p,kind:L,format:d??(L===`time`?{style:`date`}:L===`value`?{style:`number`}:void 0),label:typeof me==`string`?me:``,labelFit:eq(IK,u)?u:`auto`},series:ie,group:T,to:E,size:D,trend:kK.trend.includes(i)&&te===!0,zoom:kK.zoom.includes(i)?(F??z.length>5e3)===!0:!1,bands:I,stack:ue,y:{label:typeof W==`string`?W:``,format:re,min:JK(he)?he:void 0,max:JK(ge)?ge:void 0,wholeNumbers:XK(h,`wholeNumbers`)===!0},target:YK(ee)&&JK(P)?{value:P,label:String(XK(ee,`label`)??``)}:null,centerLabel:i===`donut`&&typeof _e==`string`&&_e.trim()?_e.trim():``,valueLabels:fe,height:le,state:eq(pK,A)?A:`ready`,emptyText:ve(XK(n,`emptyText`),vK),errorText:ve(XK(n,`errorText`),yK),loadingText:ve(XK(n,`loadingText`),bK),renderer:eq(fK,j)?j:`auto`,timeZone:N,otherIndex:B}}}function aq(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:SK};let o=0;for(;a.length;){let e=a.pop();o+=1;for(let[t,n]of r){if(t!==e)continue;let r=(i.get(n)??0)-1;i.set(n,r),r===0&&a.push(n)}}return o<i.size?{reason:`cannot draw a sankey whose flows loop back on themselves.`,text:yK}:null}function oq(e,t){let n=e.map(e=>JK(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 sq(e,t,n){let r=new Set(e.map((e,t)=>({i:t,v:JK(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)||!JK(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=_K;for(let e=2;o.has(s);e+=1)s=`${_K} (${e})`;return a.push({[t]:s,[n]:i}),{data:a,otherIndex:a.length-1}}function cq(e){return $K(e.series[0],`series`)}function lq(e,t){return $K(e.data[t],`row ${t}`)}function Q(e,t,n){let r=e.data[n]?.[t];return JK(r)?r:null}function uq(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,timeZone:e.timeZone}):String(n)}function dq(e,t){return iK(e.data[t]?.[e.x.key],e.timeZone)}function fq(e,t){let n=e.group?e.data[t]?.[e.group.key]:null;return n==null||n===``?`-`:String(n)}function pq(e,t){let n=e.to?e.data[t]?.[e.to.key]:null;return n==null||n===``?`-`:String(n)}var mq=e=>[...new Set(e)];function hq(e){return e.group?mq(e.data.map((t,n)=>fq(e,n))):[]}function gq(e){return TK(e.type)?e.data.length:e.data.length*e.series.length}function _q(e){return e.renderer===`auto`?gq(e)>5e3?`canvas`:`svg`:e.renderer}function vq(e){switch(e.type){case`donut`:return e.data.map((t,n)=>$(e,n));case`scatter`:case`bubble`:return hq(e);case`line`:case`area`:case`column`:case`bar`:return e.series.map(e=>e.key);default:return[]}}function yq(e){return[`line`,`area`,`column`,`bar`].includes(e.type)?e.series.map(e=>e.label):vq(e)}function bq(e,t,n){return e.type===`donut`?n.has($(e,t)):(e.type===`scatter`||e.type===`bubble`)&&e.group?n.has(fq(e,t)):!1}function xq(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=>{let n=Q(e,t.key,r);return[t.key,i&&n!=null?n/i:null]}))})}var Sq=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Cq(e,t=SG){return`${Sq[new Date(e+OG(e,t)).getUTCDay()]}, ${oK(e,{timeZone:t})}`}var wq=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(e,t),1/0),Tq=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(e,t),-1/0),Eq=(e,t)=>e.data.map((n,r)=>Q(e,t,r)).filter(e=>e!=null),Dq=(e,t)=>t?Z((e??0)/t,{style:`percent`}):`-`;function Oq(e,t){let n=e.filter(JK);if(!n.length)return[];let r=wq(n),i=Tq(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 kq(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 Aq(e,t){return Array.from({length:e},(n,r)=>t[e===1?6:Math.round(6-r*4/(e-1))])}function jq(e,t){return e.bands.find(e=>t<=e.upTo)??e.bands[e.bands.length-1]??null}var Mq=(e,t)=>t==null?`-`:$K(jq(e,t),`gauge band`).label;function Nq(e){return{min:e.y.min??0,max:e.y.max??100}}function Pq(e){let t=cq(e).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 Fq(e,t){let n=cq(e).key,r=$K(e.to,`to column`).key,i=e.data.map((t,i)=>({from:String(t[e.x.key]),to:String(t[r]),value:Q(e,n,i)??0})),a=new Map;for(let e of i)a.has(e.from)||a.set(e.from,[]),a.set(e.to,[...a.get(e.to)??[],e]);let o=new Map,s=0;for(let[e,n]of a)n.length||o.set(e,t[s++%t.length]);let c=[...o.keys()],l=new Map([...a].filter(([,e])=>e.length).map(([e,t])=>[e,t.length]));for(;c.length;){let e=c.shift();for(let t of i.filter(t=>t.from===e)){let e=(l.get(t.to)??0)-1;if(l.set(t.to,e),e>0)continue;let n=$K((a.get(t.to)??[]).reduce((e,t)=>e===null||t.value>e.value?t:e,null),`sankey inflow`);o.set(t.to,o.get(n.from)),c.push(t.to)}}return o}function Iq(e){let t=cq(e).key,n=new Map(hq(e).map(e=>[e,0]));return e.data.forEach((r,i)=>{n.set(fq(e,i),(n.get(fq(e,i))??0)+(Q(e,t,i)??0))}),n}function Lq(e,t,n){let{palette:r,neutral:i,seq:a}=n,o=cq(e).key;switch(e.type){case`donut`:return Bq(e,t,n);case`funnel`:return Aq(e.data.length,$K(a,`sequential colours`))[t];case`heatmap`:case`calendar`:return kq(Oq(Eq(e,o),$K(a,`sequential colours`)),Q(e,o,t));case`gauge`:return r[0];case`waterfall`:{let n=$K(Pq(e)[t],`waterfall bar ${t}`);return n.total?r[0]:n.value>=0?r[2]:r[7]}case`treemap`:return r[[...Iq(e).keys()].indexOf(fq(e,t))%r.length];case`sankey`:return Fq(e,r).get(String(lq(e,t)[e.x.key]));case`scatter`:case`bubble`:return r[Math.max(0,hq(e).indexOf(fq(e,t)))];default:return r[0]??i}}function Rq(e,t,n,r){let i=cq(e),a=Q(e,i.key,t),o=()=>Lq(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:`${fq(e,t)}, ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`calendar`:return{title:Cq(dq(e,t),e.timeZone),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:Dq(a,r)}),s.push({label:`Of ${$(e,0)}`,value:Dq(a,n)}),{title:$(e,t),rows:s,foot:``}}case`gauge`:{let{min:n,max:r}=Nq(e),s=a==null?null:jq(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=Pq(e),r=$K(n[t],`waterfall bar ${t}`),a=$K(n[0],`waterfall opening bar`).value,s=r.total?[{color:o(),label:i.label,value:Z(r.value,i.format)}]:[{color:o(),label:`Change`,value:zq(r.value,i.format)},{label:`Running total`,value:Z(r.level,i.format)}],c=!r.total&&a?`${zq(r.value/a*100,{style:`number`,decimals:2},`%`)} of opening`:``;return{title:$(e,t),rows:s,foot:c}}case`treemap`:{let n=fq(e,t),r=Iq(e).get(n);return{title:`${n} / ${$(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:Dq(a,r)}],foot:``}}case`sankey`:{let n=String(lq(e,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 ${pq(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:`Share of ${n}`,value:Dq(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(lq(e,t)[e.size.key],e.size.format)}),{title:e.group?fq(e,t):i.label,rows:n,foot:``}}}let s=e.stack===`percent`?xq(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=``,d=c[0];if(e.stack!==`none`&&d&&c.length>1&&(u=`Total ${Z(c.reduce((n,{s:r})=>n+(Q(e,r.key,t)??0),0),d.s.format)}`),e.target&&d&&c.length===1){let n=Q(e,d.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),d.s.format)}`}}return{title:$(e,t),rows:l,foot:u}}function zq(e,t,n=``){let r=`${Z(Math.abs(e),t)}${n}`;return e>0?`+${r}`:e<0?`−${r}`:r}function Bq(e,t,n){return t===e.otherIndex?n.neutral:n.palette[t%n.palette.length]}function Vq(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 Hq(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 Uq(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 Wq(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=cq(t),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=mq(a.map(e=>$(t,e))),n=hq(t),o=new Map(a.map(e=>[`${fq(t,e)}\u0000${$(t,e)}`,r(e)]));return i([$K(t.group,`group column`).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([Uq(t),n.label,`Of previous step`,`Of ${$(t,0)}`],a.map(i=>({head:$(t,i),cells:[r(i),i?Dq(Q(t,n.key,i),Q(t,n.key,i-1)):`-`,Dq(Q(t,n.key,i),e)]})))}case`gauge`:return i([Uq(t),n.label,...t.bands.length?[`Band`]:[]],a.map(e=>({head:lq(t,e)[t.x.key]==null?n.label:$(t,e),cells:[r(e),...t.bands.length?[Mq(t,Q(t,n.key,e))]:[]]})));case`waterfall`:return i([Uq(t),`Change`,`Running total`],Pq(t).map(e=>({head:$(t,e.index),cells:[e.total?`-`:zq(e.value,n.format),Z(e.level,n.format)]})));case`treemap`:{let e=Iq(t);return i([$K(t.group,`group column`).label||`Group`,t.x.label||`Item`,n.label,`Share of group`],a.map(i=>({head:fq(t,i),cells:[$(t,i),r(i),Dq(Q(t,n.key,i),e.get(fq(t,i)))]})))}case`sankey`:return i([Uq(t),$K(t.to,`to column`).label||`To`,n.label],a.map(e=>({head:$(t,e),cells:[pq(t,e),r(e)]})));case`scatter`:case`bubble`:return i([Uq(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(lq(t,e)[t.size.key],t.size.format)]:[],...t.group?[fq(t,e)]:[]]})))}let o=t.type===`donut`,s=o?t.data.reduce((e,r,i)=>e+(Q(t,n.key,i)??0),0):0,c=[Uq(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 Gq(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 Kq(e,t){return e==null?e:t?.unit===`paise`?Number(qG(e)):t?.style===`percent`?Number((e*100).toPrecision(12)):e}function qq(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`?oK(n,{pattern:t.x.format?.pattern??`day`,timeZone:t.timeZone}):n}},i=t.series.map(e=>({head:`${e.label}${Gq(e.format)}`,value:t=>{let n=t[e.key];return Kq(JK(n)?n:null,e.format)}})),a=t.group,o=a?{head:a.label||a.key,value:e=>e[a.key]}:null,s;switch(t.type){case`heatmap`:s=[r,$K(o,`group column`),...i];break;case`treemap`:s=[$K(o,`group column`),r,...i];break;case`sankey`:{let e=$K(t.to,`to column`);s=[r,{head:e.label||e.key,value:t=>t[e.key]},...i];break}case`bubble`:{let e=$K(t.size,`size column`);s=[r,...i,{head:`${e.label||e.key}${Gq(e.format)}`,value:t=>{let n=t[e.key];return Kq(JK(n)?n:null,e.format)}},...o?[o]:[]];break}case`scatter`:s=[r,...i,...o?[o]:[]];break;case`gauge`:s=t.x.key===``?i:[r,...i];break;default:s=[r,...i]}let c=[s.map(e=>n(e.head)).join(`,`)];for(let e of t.data)c.push(s.map(t=>n(t.value(e))).join(`,`));return`${c.join(`\r
|
|
21
|
+
`)}`}function Jq(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=wq(t),i=Tq(t);return r===i?`${e} is ${Z(r,n)}.`:`${e} runs from ${Z(r,n)} to ${Z(i,n)}.`};function Xq(e,t=new Set){let n=[];e.description&&n.push(e.description.replace(/\.?\s*$/,`.`));let r=vq(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=>!bq(e,n,t)),o=cq(e),s=Eq(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);if(n.push(`${CK.donut} of ${o.label} in ${a.length} ${a.length===1?`part`:`parts`}, ${Z(t,o.format)} in all.`),a.length&&t){let r=a.reduce((t,n)=>(Q(e,o.key,n)??-1/0)>(Q(e,o.key,t)??-1/0)?n:t,$K(a[0],`first slice`));n.push(`${$(e,r)} is the largest, at ${Z((Q(e,o.key,r)??0)/t,{style:`percent`})}.`)}return n.join(` `)}case`heatmap`:if(n.push(`${CK.heatmap} of ${o.label} by ${$K(e.group,`group column`).label||`row`} and ${e.x.label||`column`}, ${i} cells.`),s.length){let t=l(),r=u();n.push(`Highest is ${Zq(e,t)} at ${fq(e,t)}, ${$(e,t)}; lowest is ${Zq(e,r)} at ${fq(e,r)}, ${$(e,r)}.`)}return n.join(` `);case`calendar`:return n.push(`${CK.calendar} of ${o.label}, ${i} ${i===1?`day`:`days`}${i>1?`, from ${$(e,0)} to ${$(e,i-1)}`:``}.`),s.length&&n.push(`Highest is ${Zq(e,l())} on ${$(e,l())}; lowest is ${Zq(e,u())} on ${$(e,u())}.`),n.join(` `);case`funnel`:return n.push(`${CK.funnel} of ${o.label} in ${i} stages.`),i>1&&n.push(`${$(e,0)} is ${Zq(e,0)} and ${$(e,i-1)} is ${Zq(e,i-1)}, ${Dq(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}=Nq(e),a=t==null?null:jq(e,t);return n.push(`${CK.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=Pq(e);if(n.push(`${CK.waterfall} of ${o.label}.`),i>1){let r=t.filter(e=>!e.total);n.push(`It opens at ${Z($K(t[0],`waterfall opening bar`).value,o.format)} and closes at ${Z($K(t[i-1],`waterfall closing bar`).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)}, ${zq(a.value,o.format)}.`),s&&n.push(`The largest fall is ${$(e,s.index)}, ${zq(s.value,o.format)}.`)}return n.join(` `)}case`treemap`:{let t=Iq(e);if(!t.size)return`${CK.treemap} of ${o.label}: no items.`;let[r,a]=[...t].reduce((e,t)=>t[1]>e[1]?t:e);return n.push(`${CK.treemap} of ${o.label}: ${i} items in ${t.size} groups, ${Z(c,o.format)} in all.`),n.push(`${r} is the largest group, at ${Dq(a,c)}.`),n.join(` `)}case`sankey`:{let t=$K(e.to,`to column`).key,r=mq(e.data.flatMap(n=>[String(n[e.x.key]),String(n[t])])),a=l();return n.push(`${CK.sankey} of ${o.label}: ${i} flows between ${r.length} places.`),n.push(`The largest flow is ${$(e,a)} to ${pq(e,a)}, ${Zq(e,a)}.`),n.join(` `)}case`scatter`:case`bubble`:{let r=hq(e).filter(e=>!t.has(e));n.push(`${CK[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=>lq(e,t)[e.x.key]).filter(JK),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(` `)}}let d=e.stack===`percent`?`, stacked to 100%`:e.stack===`stacked`?`, stacked`:``,f=e.series.filter(e=>!t.has(e.key));n.push(`${CK[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,Eq(e,t.key),t.format);r&&n.push(r)}return n.join(` `)}var Zq=(e,t)=>{let n=cq(e);return Z(Q(e,n.key,t),n.format)};function Qq(e){return e.stack===`percent`?{style:`percent`,decimals:0}:cK(e.y.format)}var $q=864e5,eJ={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},tJ=e=>eJ[e]??0,nJ=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function rJ(e,t){let n=e.data.map((e,t)=>t).filter(n=>!bq(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>Q(e,e.x.key,t)??0;return n.sort((e,t)=>r(e)-r(t)||e-t)}function iJ(e){let t=mq(e.data.map((t,n)=>$(e,n))),n=hq(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf($(e,i))},${n.indexOf(fq(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf($(e,r)),n.indexOf(fq(e,r))]}}function aJ(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 eJ||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return oJ(e,t,n);let a=nJ.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?rJ(e,r):[];if(a?!s.length:!o.length)return t;let c=t??{index:a?$K(s[0],`first mark`):0,series:a?0:$K(o[0],`first visible series`)};if(t==null&&n in eJ)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:$K(s[0],`first mark`),series:0}:n===`End`?{index:$K(s[s.length-1],`last mark`),series:0}:n in eJ?{index:$K(s[(e+tJ(n)+s.length)%s.length],`next mark`),series:0}:t}if(n===`Home`)return{...c,index:0};if(n===`End`)return{...c,index:i-1};if(!(n in eJ))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+tJ(n)))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?tJ(n):-tJ(n);return{...c,series:$K(o[Math.min(o.length-1,Math.max(0,l+u))],`series`)}}function oJ(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>dq(e,t)-dq(e,n)):[],o=i?null:iJ(e),s=t??{index:i?$K(a[0],`first day`):0,series:0};if(t==null&&n in eJ)return s;if(n===`Home`)return{index:i?$K(a[0],`first day`):0,series:0};if(n===`End`)return{index:i?$K(a[r-1],`last day`):r-1,series:0};if(!(n in eJ))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?tJ(n):tJ(n)*7,r=t=>{let n=dq(e,t);return Math.floor((n+OG(n,e.timeZone))/$q)},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}}if(!o)throw Error(`heat grid missing`);let[c,l]=o.position(s.index),[u,d]=n===`ArrowLeft`||n===`ArrowRight`?[tJ(n),0]:[0,tJ(n)];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}zj([px,rT,$T,OL,zI,OI,QF,xL,$M,JR,vB,TV,$B,yz,tz,kH,nH,EB,pU,BH,GW,hG]);function sJ(e){let t=e.series[0];if(!t)throw Error(`chart spec has no series`);return t}var cJ=e=>typeof e==`number`;function lJ(e,t){let n=e.data[t];if(!n)throw Error(`chart row ${t} missing`);return n}function uJ(e){if(!e.to)throw Error("chart spec has no `to` column");return e.to.key}function dJ(e){if(!e.size)throw Error("chart spec has no `size` column");return e.size.key}function fJ(e,t,n){let r=e[t];if(!r)throw Error(`percent shares for row ${t} missing`);return r[n]??null}function pJ(e,t,n){let r=e?.[t];if(!r)throw Error(`bar radii for row ${t} missing`);return r[n]}var mJ=e=>cJ(e)?e:null;function hJ(e){return typeof e==`object`&&e&&`row`in e?mJ(e.row):null}function gJ(e){if(typeof e!=`object`||!e||!(`dataZoom`in e)||!Array.isArray(e.dataZoom))return null;let t=e.dataZoom[0];if(typeof t!=`object`||!t||!(`start`in t)||!(`end`in t))return null;let{start:n,end:r}=t;return cJ(n)&&Number.isFinite(n)&&cJ(r)&&Number.isFinite(r)?{start:n,end:r}:null}function _J(e){if(!e)throw Error(`chart has not been drawn`);return e}var vJ=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],yJ=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function bJ(e,t,n,r,i=!1){let a=cK(e);if(i)return a.currency?{style:`currency`,currency:a.currency,unit:a.unit,decimals:0}:{style:`number`,decimals:0};if(a.style!==`compact`||!Number.isFinite(t)||!Number.isFinite(n))return a;let o=(n-t)/r;if(!(o>0)||o>=Math.max(Math.abs(t),Math.abs(n))*.02)return a;let s=Math.min(6,Math.max(0,Math.ceil(-Math.log10(o))));return a.currency?{style:`currency`,currency:a.currency,unit:a.unit,decimals:s}:{style:`number`,decimals:s}}var xJ=(e,t)=>{let n=e.filter(e=>typeof e==`number`&&Number.isFinite(e));return[Math.min(...t?[0,...n]:n),Math.max(...t?[0,...n]:n)]},SJ=24,CJ=4,wJ=.6,TJ=(e,t)=>String(e).length*t*wJ,EJ=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`chart palette has no colour at slot ${t}`);return n};function DJ(e){let t=String(e??``).trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let e=n[1]??``,t=e.length===3?[...e].map(e=>e+e).join(``):e;return[0,2,4].map(e=>Number.parseInt(t.slice(e,e+2),16))}let r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);return r?r.slice(1,4).map(Number):null}function OJ(e,t){let n=DJ(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function kJ(e,t,n){let r=DJ(e),i=DJ(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+((i[t]??0)-e)*n)).join(`,`)})`:e}var AJ=[.2126,.7152,.0722],jJ=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*(AJ[n]??0),0),MJ=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function NJ(e,t){let n=DJ(e),r=DJ(t.text),i=DJ(t.surface);return!n||!r||!i||MJ(jJ(n),jJ(r))>=MJ(jJ(n),jJ(i))?t.text:t.surface}var PJ=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:OJ(e,t)},{offset:1,color:OJ(e,0)}]}),FJ=(e,t)=>e+OG(e,t);function IJ(e){let t=e.x.format?.pattern;return n=>{let r=kG(n,e.timeZone);if(t===`month`||t===`year`)return oK(r,{pattern:t,timeZone:e.timeZone});let i=DG(r,e.timeZone);return i.hour||i.minute?oK(r,{pattern:`time`,timeZone:e.timeZone}):sK(r,{timeZone:e.timeZone})}}function LJ(e,t,n){let r=CJ,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 RJ(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&gq(e)<=5e3,o=vq(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=kY[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`?xq(e,r.hidden):null,g=p||e.type===`column`?LJ(e,r.hidden,p):null,_=e.series.length===1,v=r.renderer===`canvas`,[y,b]=xJ(e.series.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))),!0),x=e.stack===`percent`?Qq(e):bJ(e.y.format,e.y.min??y,e.y.max??b,i?3:4,e.y.wholeNumbers),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=e.series.filter(e=>!r.hidden.has(e.key)),T=m&&!e.valueLabels?[]:e.data.map((t,n)=>$(e,n)),E=()=>{let t=e.stack===`percent`?[1,S]:[e.y.max??b,e.y.min??y];return n.width-Math.max(...t.map(e=>TJ(Z(e,x),12)))-20},D=!1;if(e.valueLabels){let t=p?n.width-QJ(T.map(e=>TJ(e,12)))-20:cY(T.length,E())/Math.max(1,w.length);D=w.flatMap(t=>e.data.map((n,r)=>Q(e,t.key,r))).filter(e=>e!=null).every(e=>TJ(Z(e,x),12)<=t)}let O={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:12,margin:12,...m||e.type!==`column`||e.x.labelFit===`auto`?{hideOverlap:!0}:uY(e.x.labelFit,T,E()),...m?{formatter:IJ(e)}:{}},...m?{}:{data:T}},k={type:`value`,splitNumber:i?3:4,min:e.stack===`percent`?S:e.y.min,max:e.stack===`percent`?1:e.y.max,minInterval:e.y.wholeNumbers?1:void 0,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:12,formatter:e=>Z(e,x)},...e.y.label?{name:e.y.label,nameLocation:`end`,nameGap:12,nameTextStyle:{color:t.label,fontSize:12,align:p?`right`:`left`}}:{}},A=e.zoom,j=_&&e.type!==`column`&&!p&&!i,M=e.series.map((n,r)=>{let o=EJ(t.palette,r%t.palette.length),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?fJ(h,t,n.key):r;return m?[FJ(dq(e,t),e.timeZone),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,smoothMonotone:`x`,connectNulls:!1,symbol:`circle`,showSymbol:s,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:OJ(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:n?{color:PJ(o,n)}:void 0,endLabel:j?{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?zJ(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:SJ,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:pJ(g,t,n.key)}})),label:e.valueLabels?{show:D,position:p?`right`:`top`,distance:6,fontFamily:t.font,fontSize:12,fontWeight:600,color:t.text,formatter:e=>e.value==null?``:Z(e.value,x)}:void 0,markLine:r===C?zJ(e,t,p,a):void 0}});return{...u,useUTC:m,grid:{left:4,right:j?64:i?8:16,top:e.y.label?28:D&&e.type===`column`?24:12,bottom:A?44:4,outerBoundsMode:`same`},dataZoom:A?EY(e,t,EJ(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:OJ(t.neutral,t.dark?.12:.1)}},formatter:t=>Vq(Rq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?k:O,yAxis:p?O:k,series:M}}function zJ(e,t,n,r){if(!e.target)return;let i=sJ(e).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:12,fontFamily:t.font,backgroundColor:t.surface,padding:[2,6],borderRadius:4},data:[n?{xAxis:e.target.value}:{yAxis:e.target.value}]}}function BJ(e,t,n,r,i){let{base:a,tooltipBase:o,colours:s,compact:c}=i,l=sJ(e),u=e.data.map((t,n)=>$(e,n)),d=e.data.reduce((t,n,i)=>t+(r.hidden.has($(e,i))?0:Q(e,l.key,i)??0),0);return{...a,tooltip:{...o,trigger:`item`,formatter:t=>Vq(Rq(e,t.dataIndex,r.hidden,s))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(d,cK(l.format)),x:0,y:-10,align:`center`,verticalAlign:`middle`,fill:t.text,fontSize:c?18:22,fontWeight:650,fontFamily:t.font}},{type:`text`,style:{text:e.centerLabel||`Total`,x:0,y:14,align:`center`,verticalAlign:`middle`,fill:t.label,fontSize:12,fontFamily:t.font}}]}],series:[{id:l.key,name:l.key,type:`pie`,radius:c?[`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:c?{show:!1}:{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:12,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:u[n],value:Q(e,l.key,n)??0,itemStyle:{color:Bq(e,n,s)}}))}]}}var VJ=e=>[...new Set(e)],HJ=(e,t)=>e.data.map((n,r)=>Q(e,t,r));function UJ(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var WJ=(e,t,n={})=>({type:`category`,data:t,axisLine:{lineStyle:{color:e.axis}},axisTick:{show:!1},axisLabel:{color:e.label,fontSize:12,margin:12,hideOverlap:!0},...n}),GJ=(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:12,formatter:t},...n});function KJ(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:12,fontFamily:e.font},...n}}function qJ(e,t,n,r,i){let a=sJ(e),o=VJ(e.data.map((t,n)=>$(e,n))),s=hq(e),c=Oq(HJ(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:UJ(i.tooltipBase,t=>Vq(Rq(e,t.dataIndex,r.hidden,i.colours))),xAxis:WJ(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:WJ(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:KJ(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf($(e,n)),s.indexOf(fq(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 JJ=6048e5,YJ=(e,t)=>{let n=DG(e,t);return`${n.year}-${String(n.month+1).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`};function XJ(e,t){let n=e.data.map((t,n)=>dq(e,n)).filter(Number.isFinite),r=ZJ(n),i=QJ(n),a=Math.ceil((i-r)/JJ)+1,o=Math.floor((t.height-62)/7),s=Math.max($J,Math.min(eY,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)*JJ:r,to:i}}var ZJ=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(t,e),1/0),QJ=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(t,e),-1/0),$J=9,eY=24;function tY(e,t,n,r,i){let a=sJ(e),{cell:o,from:s,to:c}=XJ(e,n),l=Oq(HJ(e,a.key),t.seq);return{...i.base,tooltip:UJ(i.tooltipBase,t=>Vq(Rq(e,t.dataIndex,r.hidden,i.colours))),visualMap:KJ(t,l,{right:4}),calendar:{range:[YJ(s,e.timeZone),YJ(c,e.timeZone)],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:12,fontFamily:t.font,margin:8},monthLabel:{color:t.label,fontSize:12,fontFamily:t.font,margin:8},yearLabel:{show:!1}},series:[{type:`heatmap`,coordinateSystem:`calendar`,data:e.data.map((t,n)=>[YJ(dq(e,n),e.timeZone),Q(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function nY(e,t,n,r,i){let a=sJ(e),o=Aq(e.data.length,t.seq),s=Q(e,a.key,0);return{...i.base,tooltip:UJ(i.tooltipBase,t=>Vq(Rq(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=NJ(o[r],t),c=Q(e,a.key,r),l=r?`${Dq(c,Q(e,a.key,r-1))} of previous step`:`${Dq(c,s)} of ${yJ($(e,0))}`;return{name:$(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${yJ($(e,r))}} {v|${yJ(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:OJ(i,.78),fontSize:12,fontFamily:t.font}}}}})}]}}function rY(e,t,n,r,i){let a=sJ(e),{min:o,max:s}=Nq(e),c=Q(e,a.key,0),l=c??o,u=c==null?null:jq(e,c),d=EJ(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)<1&&p.push([1,t.grid]),{...i.base,tooltip:UJ(i.tooltipBase,()=>Vq(Rq(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:OJ(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|${yJ(c==null?Z(null):Z(e,a.format))}}{u|/${yJ(Z(s,a.format))}}${u?`\n{s|${yJ(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 iY(e){let t=QJ(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=ZJ(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=QJ(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 aY=4,oY=72,sY=12,cY=(e,t)=>Math.floor(t/Math.max(1,e)-aY);function lY(e,t){return QJ(e.flatMap(e=>String(e).split(/\s+/)).map(e=>TJ(e,sY)))<=t?{interval:0,width:t,overflow:`break`}:{interval:0,rotate:45,width:oY,overflow:`truncate`}}function uY(e,t,n){let r=cY(t.length,n);return e===`all`?{...lY(t,r),hideOverlap:!1}:e===`rotate`?{interval:0,rotate:45,width:oY,overflow:`truncate`,hideOverlap:!1}:e===`ellipsis`?{interval:0,rotate:0,width:Math.max(1,r),overflow:`truncate`,hideOverlap:!1}:{hideOverlap:!0}}function dY(e,t,n){let r=cY(e.length,n),i=lY(e,r);return{nameSize:sY,valueSize:12,category:`rotate`in i?{...i,hideOverlap:!0}:i,showValues:t.every(e=>TJ(e,12)<=r)}}function fY(e,t,n,r,i){let a=sJ(e),o=Pq(e),s=Qq(e),c=iY(o),l=t=>Lq(e,t.index,i.colours),u=o.map(t=>$(e,t.index)),d=o.map(e=>e.total?Z(e.value,s):zq(e.value,s)),f=o.flatMap(e=>[e.from,e.to]),p=Math.max(TJ(Z(QJ(f),s),11),TJ(Z(ZJ(f),s),11))+8,m=dY(u,d,n.width-p-12);return{...i.base,grid:{left:4,right:8,top:28,bottom:4,outerBoundsMode:`same`},tooltip:{...i.tooltipBase,trigger:`axis`,axisPointer:{type:`shadow`,shadowStyle:{color:OJ(t.neutral,.1)}},formatter:t=>Vq(Rq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:WJ(t,u,{axisLabel:{color:t.label,fontSize:m.nameSize,margin:12,...m.category}}),yAxis:GJ(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 pY(e){let t=sJ(e).key;return hq(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>fq(e,t)===n).sort((n,r)=>(Q(e,t,r)??0)-(Q(e,t,n)??0)||n-r)}))}function mY(e,t,n,r,i){let a=sJ(e),o=Iq(e),s=[...o.values()].reduce((e,t)=>e+t,0),c=(e,t)=>{let r=(e??0)/s*n.width*n.height*.82;return r>5200&&Math.max(TJ(t[0],12),TJ(t[1],11.5))+20<=Math.sqrt(r)},l=pY(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=EJ(t.palette,i%t.palette.length),u=NJ(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${yJ(n)}} {v|${yJ(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:OJ(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=kJ(l,t.surface,Math.min(.55,r*.14)),o=NJ(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|${yJ($(e,n))}}\n{v|${yJ(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:OJ(o,.82),fontSize:12,fontFamily:t.font}}}}})}});return{...i.base,tooltip:UJ(i.tooltipBase,t=>t.data?.row==null?Vq({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:`Share of all`,value:Dq(mJ(t.value),s)}],foot:``}):Vq(Rq(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 hY(e){let t=uJ(e),n=e.data.map(n=>[String(n[e.x.key]),String(n[t])]),r=new Map(n.flatMap(([e,t])=>[[e,0],[t,0]]));for(let e=0;e<r.size;e+=1)for(let[e,t]of n)r.set(t,Math.max(r.get(t)??0,(r.get(e)??0)+1));return r}function gY(e,t,n,r,i){let a=sJ(e),o=uJ(e),s=Fq(e,t.palette),c=hY(e),l=QJ([...c.values()]),u=new Map,d=new Map;e.data.forEach((t,n)=>{let r=Q(e,a.key,n)??0;u.set(String(t[e.x.key]),(u.get(String(t[e.x.key]))??0)+r),d.set(String(t[o]),(d.get(String(t[o]))??0)+r)});let f=e=>d.get(e)??u.get(e)??0,p=e=>({position:e,color:t.text,fontFamily:t.font,fontSize:12,formatter:e=>`{n|${yJ(e.name)}}\n{v|${Z(f(e.name),{style:`compact`})}}`,rich:{n:{color:t.textBody,fontSize:12,fontFamily:t.font,lineHeight:15},v:{color:t.label,fontSize:12,fontFamily:t.font}}});return{...i.base,tooltip:UJ(i.tooltipBase,t=>Vq(t.dataType===`edge`?Rq(e,t.dataIndex,r.hidden,i.colours):{title:t.name,rows:[{color:t.color,label:a.label,value:Z(f(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:l+1},(e,t)=>({depth:t,label:p(t===l&&l>0?`left`:`right`)})),data:[...c.keys()].map(e=>({name:e,itemStyle:{color:s.get(e)}})),links:e.data.map(n=>({source:String(n[e.x.key]),target:String(n[o]),value:n[a.key],lineStyle:{color:s.get(String(n[e.x.key])),opacity:t.dark?.32:.26}}))}]}}function _Y(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=ZJ(e.map(e=>e[1])),s=QJ(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(ZJ(e.map(e=>e[0]))),c(QJ(e.map(e=>e[0])))]}var vY=44,yY=28,bY=8;function xY(e,t,n,r,i){let a=sJ(e),o=hq(e),s=e.type===`bubble`,c=QJ(s?e.data.map(t=>t[dJ(e)]).filter(cJ):[]),l=e=>Math.max(bY,(i.compact?yY:vY)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||fq(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?_Y(d.flatMap(t=>{let n=lJ(e,t)[e.x.key],r=Q(e,a.key,t);return cJ(n)&&r!=null?[[n,r]]:[]})):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>Q(e,a.key,n)),[h,g]=xJ(p,!1),[_,v]=xJ(m,!1),y=bJ(e.y.format,e.y.min??_,e.y.max??v,4),b=bJ(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]??NaN):i.compact?8:10,itemStyle:{color:OJ(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:[lJ(e,t)[e.x.key],Q(e,a.key,t),...s?[lJ(e,t)[dJ(e)]]:[]],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:12,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:UJ(i.tooltipBase,t=>t.data?.row==null?``:Vq(Rq(e,t.data.row,r.hidden,i.colours))),xAxis:GJ(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:12,fontFamily:t.font}}:{}}),yAxis:GJ(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:12,fontFamily:t.font,align:`left`}}:{}}),series:x}}var SY=32,CY=8,wY=26;function TY(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-wY)/o,c=s-SY-CY,l=EJ(t.palette,0),u=e.data.map((t,n)=>$(e,n)),d=e.series.flatMap((n,r)=>{let i=HJ(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?[FJ(dq(e,n),e.timeZone),r]:r};return{...i.base,useUTC:a,title:d,grid:e.series.map((e,t)=>({left:52,right:8,top:6+t*s+SY,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=>Vq(Rq(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:WJ(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:12,hideOverlap:!0,margin:10,...a?{formatter:IJ(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=xJ(HJ(e,n.key),!1),o=bJ(n.format,e.y.min??i,e.y.max??a,2);return GJ(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:12,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:PJ(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function EY(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:OJ(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:OJ(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:OJ(n,.18)}},textStyle:{color:t.label,fontSize:12,fontFamily:t.font}}]}function DY(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=fq(e,n),r=e.data.map((e,t)=>t).filter(n=>fq(e,n)===t);return{seriesIndex:hq(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 pY(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 OY(e,t){switch(e.type){case`scatter`:case`bubble`:case`treemap`:{let e=hJ(t.data);return e==null?null:{series:0,row:e}}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 t.seriesIndex==null?null:{series:t.seriesIndex,row:t.dataIndex};default:return{series:0,row:t.dataIndex}}}var kY={donut:BJ,heatmap:qJ,calendar:tY,funnel:nY,gauge:rY,waterfall:fY,treemap:mY,sankey:gY,scatter:xY,bubble:xY,multiples:TY};function AY(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=yj(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(RJ(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function jY(e,{renderer:t}){let n=yj(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?gJ(n.getOption()):null,l=RJ(e,t,a,{...o,zoom:c});i=e,n.setOption(l,s||!r?{notMerge:!0}:{replaceMerge:vJ}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=DY(_J(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=OY(_J(i),t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var MY=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(MY);var NY=HTMLElement,PY=`wui-chart:select`,FY=`wui-chart:legend-change`,IY=`wui-chart:ready`,LY=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],RY=`(prefers-color-scheme: dark)`,zY=`(prefers-reduced-motion: reduce)`,BY=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,VY=!1;function HY(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(`--color-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>n(`--color-chart-seq-${e}`)),neutral:n(`--color-chart-neutral`),grid:n(`--color-chart-grid`),axis:n(`--color-chart-axis`),label:n(`--color-chart-label`),surface:n(`--color-surface`),text:n(`--color-text`),textBody:n(`--color-text-body`),textMuted:n(`--color-text-muted`),shadow:n(`--wui-shadow-popover`),font:t.fontFamily,dark:i===`dark`||i===`auto`&&!!BY(RY)?.matches,reducedMotion:!!BY(zY)?.matches};return!a.palette[0]&&!VY&&(VY=!0,yG(`[@webority/ui-elements] <wui-chart> found no --color-chart-* colours: load @webority/theme on the page.`)),a}var UY=new Set,WY=null;function GY(e){if(UY.add(e),WY)return;let t=()=>{for(let e of UY)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=[BY(RY),BY(zY)].filter(e=>e!==null);for(let e of i)e.addEventListener?.(`change`,t);WY=()=>{n.disconnect(),r.disconnect();for(let e of i)e.removeEventListener?.(`change`,t);WY=null}}function KY(e){UY.delete(e),UY.size||WY?.()}function qY(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var JY=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.textContent=n),r},YY=0,XY=class extends NY{uid;_spec;_normal;_hidden;_focus;_awaitingSpec=!1;_parts=null;_theme=null;_width=null;_visible=!1;_resizeObserver=null;_intersection=null;_engine=null;_drawn=!1;_drawnType=null;_announcedReady=!1;_legendSignature=null;_tableSpec=null;static get observedAttributes(){return[`view`]}constructor(){super(),YY+=1,this.uid=`wui-chart-${YY}`,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}if(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(),GY(this),this._theme=HY(this),this._width=this.clientWidth,this._resizeObserver=new ResizeObserver(()=>this._resized()),this._resizeObserver.observe(this),typeof IntersectionObserver==`function`){this._visible=!1;let e=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(e.disconnect(),this._visible=!0,this._update())},{threshold:.05});this._intersection=e,e.observe(this)}else this._visible=!0;this._update()}disconnectedCallback(){KY(this),this._resizeObserver?.disconnect(),this._intersection?.disconnect(),this._engine?.dispose(),this._engine=null,this._drawn=!1,this._parts=null,this.removeAttribute(`data-ready`)}attributeChangedCallback(e,t,n){t!==n&&this._parts&&(tq(`view`,n,mK),this._update())}toCsv(){let{spec:e}=this._normalized();return e?qq(e):``}toPng(){let{spec:e}=this._normalized();return e?AY(e,this._theme??HY(this),this._size(e),{hidden:this._hidden,renderer:_q(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));qY(t,e??`${Jq(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&qY(t,e??`${Jq(this._normalized().spec)}.png`)}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!(e instanceof HTMLScriptElement))return null;try{return JSON.parse(String(e.textContent))}catch(e){return bG(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e instanceof Error?e.message:void 0),null}}_normalized(){return this._normal??=iq(this._spec),this._normal}_build(){let e=JY(`div`,`wui-chart-legend`);e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,`Legend`),e.hidden=!0,e.addEventListener(`click`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-chart-legend-item`):null;t instanceof HTMLElement&&this._toggle(t.dataset.key)});let t=JY(`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=JY(`div`,`wui-chart-canvas`);n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=JY(`div`,`wui-chart-state`);r.setAttribute(`role`,`status`),r.hidden=!0;let i=JY(`div`,`wui-chart-table-wrap visually-hidden`),a=JY(`p`,`visually-hidden`);a.id=`${this.uid}-summary`;let o=JY(`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=e===null?`error`:e.state===`ready`&&(!e.data.length||!uq(e))?`empty`:e.state,i=`${e?.height??320}px`,a=this.view===`table`,o=e!==null&&(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?Xq(e,this._hidden):``,e){if(!s){let t=new Set(vq(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,e===null?t:r===`error`?e.errorText:r===`loading`?e.loadingText??`Loading chart`:e.emptyText,i,o);let c=r===`ready`&&!a;s||this.toggleAttribute(`data-ready`,!c);let l=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`)),l&&this._engine?.resize(),r===`ready`&&!a&&this._visible&&this._draw()}_renderState(e,t,n,r){let i=this._parts?.state;if(!i)return;let a=!r&&e!==`ready`;i.hidden=!a,a?(i.style.height=n,e===`loading`?i.replaceChildren(JY(`div`,`skeleton wui-chart-skeleton`),JY(`span`,`visually-hidden`,t)):i.replaceChildren(JY(`p`,`wui-chart-state-text`,t))):i.replaceChildren()}_colour(e,t){let n=this._theme;if(n)return e.type===`donut`?Lq(e,t,n):n.palette[t]}_renderLegend(e,t){let n=this._parts?.legend;if(!n)return;let r=e?vq(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!e||!i)return;let a=yq(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=JY(`button`,`wui-chart-legend-item`);r.type=`button`,r.dataset.key=t;let i=JY(`span`,e.type===`line`?`wui-chart-legend-swatch wui-chart-legend-swatch-line`:`wui-chart-legend-swatch`),s=o[n];return s!==void 0&&(i.style.background=s),r.append(i,JY(`span`,`wui-chart-legend-label`,a[n])),r})));for(let e of n.children){if(!(e instanceof HTMLElement))throw Error(`Expected a legend item to be an HTMLElement.`);let t=e.dataset.key;e.setAttribute(`aria-pressed`,String(t===void 0||!this._hidden.has(t)))}}_renderTable(e){if(this._tableSpec===e||!this._parts)return;this._tableSpec=e;let t=Wq(e),n=JY(`table`,`wui-chart-table`);n.append(JY(`caption`,`visually-hidden`,t.caption));let r=JY(`tr`);t.head.forEach((e,t)=>{let n=JY(`th`,t?`wui-chart-num`:null,e);n.scope=`col`,r.append(n)});let i=JY(`thead`);i.append(r),n.append(i);let a=JY(`tbody`);for(let e of t.rows){let t=JY(`tr`),n=JY(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>JY(`td`,`wui-chart-num`,e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(JY(`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();if(!e||!this._parts||!this._theme)return;let t=_q(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=jY(this._parts.canvas,{renderer:t}),this._engine.onSelect(({seriesIndex:e,dataIndex:t})=>this._select(e,t)),this._engine.onFinished(()=>{this.setAttribute(`data-ready`,``),this._announcedReady||(this._announcedReady=!0,this.dispatchEvent(new CustomEvent(IY,{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=HY(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&&(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(vq(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(FY,{bubbles:!0,detail:{visible:n}}))}_onKey(e){let{spec:t}=this._normalized();if(!t||!this._engine||!this._theme||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(!LY.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=aJ(t,this._focus,e.key,this._hidden);n?(this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(Hq(Rq(t,n.index,this._hidden,this._theme)))):this._clearFocus()}_announce(e){let t=this._parts?.live;t&&(t.textContent=e===t.textContent?`${e} `:e)}_clearFocus(){this._focus&&(this._focus=null,this._engine?.clearFocus(),this._parts&&(this._parts.live.textContent=``))}_select(e,t){let{spec:n}=this._normalized();if(!n)return;let r=n.series[TK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(PY,{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}}))}};return r(`wui-chart`,XY),e.CHART_STATES=pK,e.CHART_TYPES=lK,e.CHART_VIEWS=mK,e.MAX_SERIES=hK,e.MAX_SLICES=gK,e.RENDERERS=fK,e.STACK_MODES=uK,e.WuiChart=XY,e.X_KINDS=dK,e.formatValue=Z,e.normalizeSpec=iq,e})({});
|