@webority/ui-elements 0.190.1 → 0.191.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/{WuiCarousel-B0yPDH5I.js → WuiCarousel-UTqrn7Nx.js} +1 -1
  2. package/dist/{WuiCodeBlock-BWYZ1S70.js → WuiCodeBlock-C4GqrGyO.js} +1 -1
  3. package/dist/{WuiCommandPalette-CpmlKjzH.js → WuiCommandPalette-CNwakljH.js} +1 -1
  4. package/dist/{WuiCommentThread-Cp7AVHvt.js → WuiCommentThread-BGoAONw2.js} +1 -1
  5. package/dist/{WuiConsentBanner-nTua-kEd.js → WuiConsentBanner-B8D2lE8q.js} +1 -1
  6. package/dist/{WuiDashboardGrid-DFpX8Vx0.js → WuiDashboardGrid-5rXZvTsm.js} +1 -1
  7. package/dist/{WuiDataTable-CSgcwxU5.js → WuiDataTable-DKfTPdsn.js} +1 -1
  8. package/dist/{WuiDatePicker-DqFAl1Iq.js → WuiDatePicker-gZUfaTkZ.js} +1 -1
  9. package/dist/{WuiDateRange-CJl2GJIT.js → WuiDateRange-CNDyrPUT.js} +1 -1
  10. package/dist/{WuiDateTime-Vimu6grS.js → WuiDateTime-NTZCa0dZ.js} +1 -1
  11. package/dist/{WuiDrawer-BsY0fs_u.js → WuiDrawer-Dj7lXuGm.js} +1 -1
  12. package/dist/{WuiGantt-DvmVKJX2.js → WuiGantt-iEbrAdTQ.js} +1 -1
  13. package/dist/{WuiImageCrop-UakcSM2k.js → WuiImageCrop-97d50aEw.js} +1 -1
  14. package/dist/{WuiInlineEdit-JT83k3Nk.js → WuiInlineEdit-D0a_5oAM.js} +1 -1
  15. package/dist/{WuiLeadPopup-DaYZ2zCJ.js → WuiLeadPopup-tkt78XlW.js} +1 -1
  16. package/dist/{WuiLightbox-DpHJAMO3.js → WuiLightbox-DqAm2n8s.js} +1 -1
  17. package/dist/{WuiMentionInput-DPCCSQRZ.js → WuiMentionInput-Dcm3F-e-.js} +1 -1
  18. package/dist/{WuiNotificationCenter-D5bBM8Lp.js → WuiNotificationCenter-DWFg3H-C.js} +1 -1
  19. package/dist/{WuiOrgTree-DWSk_LHd.js → WuiOrgTree-Be7gK2ls.js} +1 -1
  20. package/dist/{WuiOverflow-fZKqdsr-.js → WuiOverflow-DCNivxjH.js} +1 -1
  21. package/dist/{WuiPhone-DjRBSXkX.js → WuiPhone-9dBrkfZf.js} +1 -1
  22. package/dist/{WuiRecordPager-BXoe4KfU.js → WuiRecordPager-DLO5IWE9.js} +1 -1
  23. package/dist/{WuiRelativeTime-CSg9vzfk.js → WuiRelativeTime-BGeb8bNG.js} +1 -1
  24. package/dist/{WuiSavedViews-CH7IvwgZ.js → WuiSavedViews-NAZArw5y.js} +1 -1
  25. package/dist/{WuiSelect-BlwwrAxZ.js → WuiSelect-bvcpSY50.js} +1 -1
  26. package/dist/{WuiShortcuts-CRCctX82.js → WuiShortcuts-CHOfUeFx.js} +1 -1
  27. package/dist/{WuiShowMore-BoYCrYYf.js → WuiShowMore-B73_umah.js} +1 -1
  28. package/dist/{WuiSlider-CK7_l_R5.js → WuiSlider-BjzqYCFt.js} +1 -1
  29. package/dist/{WuiSortable-x8Mg0tOv.js → WuiSortable-DjhJiH0o.js} +1 -1
  30. package/dist/{WuiTimePicker-22K1_FhW.js → WuiTimePicker-BIuLkZqU.js} +1 -1
  31. package/dist/{WuiTour-BgpMa8J5.js → WuiTour-CFRs1xE-.js} +1 -1
  32. package/dist/{WuiTree-Db83Uztv.js → WuiTree-MMiIcWOJ.js} +1 -1
  33. package/dist/{WuiTreePicker-lqC1h9wU.js → WuiTreePicker-CCkoPctd.js} +1 -1
  34. package/dist/{WuiWizardStep-BBkw94dD.js → WuiWizardStep-Cnc0DYg1.js} +1 -1
  35. package/dist/{calendarMath-CT99RyhR.js → calendarMath-CeawKuZQ.js} +1 -1
  36. package/dist/{chips-DwE4Op1f.js → chips-DZpPt2SC.js} +1 -1
  37. package/dist/{country-BySxiqti.js → country-CX7Ok3Md.js} +1 -1
  38. package/dist/{customRule-BpwcjVLb.js → customRule-vAOiOqYH.js} +1 -1
  39. package/dist/{dataTable-C0q14bkP.js → dataTable-D48Rwq1a.js} +1 -1
  40. package/dist/{drawerDiscard-CBUOklnA.js → drawerDiscard-BsVbaCgB.js} +1 -1
  41. package/dist/elements/carousel.js +1 -1
  42. package/dist/elements/code-block.js +1 -1
  43. package/dist/elements/command-palette.js +1 -1
  44. package/dist/elements/comment-thread.js +1 -1
  45. package/dist/elements/consent-banner.js +1 -1
  46. package/dist/elements/dashboard-grid.js +1 -1
  47. package/dist/elements/data-table.js +1 -1
  48. package/dist/elements/date-range.js +1 -1
  49. package/dist/elements/date-time.js +1 -1
  50. package/dist/elements/datepicker.js +1 -1
  51. package/dist/elements/drawer.js +1 -1
  52. package/dist/elements/filter-popover.js +1 -1
  53. package/dist/elements/gantt.js +1 -1
  54. package/dist/elements/image-crop.js +1 -1
  55. package/dist/elements/inline-edit.js +1 -1
  56. package/dist/elements/kanban.js +1 -1
  57. package/dist/elements/lead-popup.js +1 -1
  58. package/dist/elements/lightbox.js +1 -1
  59. package/dist/elements/mention-input.js +1 -1
  60. package/dist/elements/notification-center.js +1 -1
  61. package/dist/elements/org-tree.js +1 -1
  62. package/dist/elements/overflow.js +1 -1
  63. package/dist/elements/phone.js +1 -1
  64. package/dist/elements/record-pager.js +1 -1
  65. package/dist/elements/relative-time.js +1 -1
  66. package/dist/elements/saved-views.js +1 -1
  67. package/dist/elements/select.js +1 -1
  68. package/dist/elements/shortcuts.js +1 -1
  69. package/dist/elements/show-more.js +1 -1
  70. package/dist/elements/slider.js +1 -1
  71. package/dist/elements/sortable.js +1 -1
  72. package/dist/elements/timepicker.js +1 -1
  73. package/dist/elements/tour.js +1 -1
  74. package/dist/elements/tree-picker.js +1 -1
  75. package/dist/elements/tree.js +1 -1
  76. package/dist/elements/wizard.js +1 -1
  77. package/dist/{filterPopover-DskHFNLi.js → filterPopover-DopUJ22D.js} +1 -1
  78. package/dist/{formatters-DTW53DjY.js → formatters-CXMylefd.js} +1 -1
  79. package/dist/helpers.js +1 -1
  80. package/dist/{inlineEditText-DRBhMnam.js → inlineEditText-B35MKEul.js} +1 -1
  81. package/dist/{kanban-Dayig7ic.js → kanban-BkovNHsk.js} +1 -1
  82. package/dist/{kanbanModel-BzXK4SkM.js → kanbanModel-BQWAC9vs.js} +1 -1
  83. package/dist/{notificationDays-B1R0RFAY.js → notificationDays-CZxUShyr.js} +1 -1
  84. package/dist/{recents-Da5C5_lV.js → recents-DTddcnaM.js} +1 -1
  85. package/dist/{relativeTime-CNgauvqB.js → relativeTime-wpijOw5j.js} +1 -1
  86. package/dist/{search-BXL4B5QD.js → search-BtwgxJ0e.js} +1 -1
  87. package/dist/server.js +1 -1
  88. package/dist/{shortcutKeys-BMTWgV2g.js → shortcutKeys-CoZBxKsS.js} +1 -1
  89. package/dist/{tableSelect-juA3KcQh.js → tableSelect-B2lLTEj1.js} +1 -1
  90. package/dist/text.js +1 -1
  91. package/dist/textStore-Dh5iyZSR.js +1 -0
  92. package/dist/{themeTransition-C5nAlClG.js → themeTransition-DowOV08f.js} +1 -1
  93. package/dist/ui-chart.global.js +9 -9
  94. package/dist/ui-chart.js +2 -2
  95. package/dist/ui-elements/calendar-views.global.js +1 -1
  96. package/dist/ui-elements/carousel.global.js +1 -1
  97. package/dist/ui-elements/code-block.global.js +1 -1
  98. package/dist/ui-elements/command-palette.global.js +1 -1
  99. package/dist/ui-elements/comment-thread.global.js +1 -1
  100. package/dist/ui-elements/consent-banner.global.js +1 -1
  101. package/dist/ui-elements/context-menu.global.js +1 -1
  102. package/dist/ui-elements/dashboard-grid.global.js +1 -1
  103. package/dist/ui-elements/data-table.global.js +1 -1
  104. package/dist/ui-elements/date-range.global.js +1 -1
  105. package/dist/ui-elements/date-time.global.js +1 -1
  106. package/dist/ui-elements/datepicker.global.js +1 -1
  107. package/dist/ui-elements/dock.global.js +1 -1
  108. package/dist/ui-elements/drawer.global.js +1 -1
  109. package/dist/ui-elements/dropdown.global.js +1 -1
  110. package/dist/ui-elements/entry-grid.global.js +1 -1
  111. package/dist/ui-elements/gantt.global.js +1 -1
  112. package/dist/ui-elements/glyphs.global.js +1 -1
  113. package/dist/ui-elements/hover-card.global.js +1 -1
  114. package/dist/ui-elements/image-crop.global.js +1 -1
  115. package/dist/ui-elements/inline-edit.global.js +1 -1
  116. package/dist/ui-elements/kanban.global.js +1 -1
  117. package/dist/ui-elements/lead-popup.global.js +1 -1
  118. package/dist/ui-elements/lightbox.global.js +1 -1
  119. package/dist/ui-elements/markdown.global.js +1 -1
  120. package/dist/ui-elements/mini-calendar.global.js +1 -1
  121. package/dist/ui-elements/navigation-menu.global.js +1 -1
  122. package/dist/ui-elements/notification-center.global.js +1 -1
  123. package/dist/ui-elements/offline-banner.global.js +1 -1
  124. package/dist/ui-elements/onboarding-checklist.global.js +1 -1
  125. package/dist/ui-elements/org-tree.global.js +1 -1
  126. package/dist/ui-elements/otp.global.js +1 -1
  127. package/dist/ui-elements/overflow.global.js +1 -1
  128. package/dist/ui-elements/phone.global.js +1 -1
  129. package/dist/ui-elements/popover.global.js +1 -1
  130. package/dist/ui-elements/rating.global.js +1 -1
  131. package/dist/ui-elements/record-pager.global.js +1 -1
  132. package/dist/ui-elements/relative-time.global.js +1 -1
  133. package/dist/ui-elements/saved-views.global.js +1 -1
  134. package/dist/ui-elements/select-chips.global.js +1 -1
  135. package/dist/ui-elements/select-recents.global.js +1 -1
  136. package/dist/ui-elements/select-search.global.js +1 -1
  137. package/dist/ui-elements/select-window.global.js +1 -1
  138. package/dist/ui-elements/server.global.js +1 -1
  139. package/dist/ui-elements/shell.global.js +1 -1
  140. package/dist/ui-elements/shortcuts.global.js +1 -1
  141. package/dist/ui-elements/show-more.global.js +1 -1
  142. package/dist/ui-elements/slider.global.js +1 -1
  143. package/dist/ui-elements/sortable.global.js +1 -1
  144. package/dist/ui-elements/status-icon.global.js +1 -1
  145. package/dist/ui-elements/table-export.global.js +1 -1
  146. package/dist/ui-elements/timepicker.global.js +1 -1
  147. package/dist/ui-elements/tour.global.js +1 -1
  148. package/dist/ui-elements/tree-picker.global.js +1 -1
  149. package/dist/ui-elements/tree.global.js +1 -1
  150. package/dist/ui-elements/truncate.global.js +1 -1
  151. package/dist/ui-elements/whats-new.global.js +1 -1
  152. package/dist/ui-elements/wizard.global.js +1 -1
  153. package/dist/ui-elements.global.js +1 -1
  154. package/dist/ui-elements.js +1 -1
  155. package/package.json +5 -5
  156. package/types/text/textStore.d.ts +2 -0
  157. package/dist/textStore-DBplASiZ.js +0 -1
package/dist/ui-chart.js CHANGED
@@ -17,5 +17,5 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
17
17
  `)){var p=new rV;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`,tV(sV,f,null,r,d)).on(`mouseover`,tV(cV,m.name,null,r,d)).on(`mouseout`,tV(lV,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=Xc(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`),_=zr(h.fill);_&&_[3]===0&&(_[3]=.2,h=k(k({},h),{fill:qr(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,tV(sV,null,f,r,d)).on(`mouseover`,tV(cV,null,f,r,d)).on(`mouseout`,tV(lV,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=Xc(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};Xc(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();nV(e,function(e){var r=e.type,i=new Uo({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),Jf(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),au(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=aV(c,r,o,s,d,m,u),y=new rV,b=r.getModel(`textStyle`);if(H(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(oV({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;U(w)&&w?T=w.replace(`{name}`,t??``):H(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new Uo({style:Xf(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new Ro({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&Af({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),au(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();r_(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){r_(`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}(_O);function aV(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),nV(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:Qk(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 oV(e){var t=e.icon||`roundRect`,n=Fv(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 sV(e,t,n,r){lV(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),cV(e,t,n,r)}function cV(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function lV(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function uV(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),dV(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){F(i,function(t,n){e[t?`select`:`unSelect`](n)}),dV(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function dV(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]=Oe(n,r)?n[r]&&i:i}}),n}function fV(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,B(uV,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,B(uV,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,B(uV,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,B(uV,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,B(uV,`unSelect`))}var pV=Yc(mV);function mV(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 hV(e){e.registerComponentModel(eV),e.registerComponentView(iV),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,pV),e.registerSubTypeDefaulter(`legend`,function(){return`plain`}),fV(e)}var gV=function(e){i(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=m_(t);e.prototype.init.call(this,t,n,r),_V(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),_V(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=Dh(eV.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}(eV);function _V(e,t,n){var r=e.getOrient(),i=[1,1];i[r.index]=0,p_(t,n,{type:`box`,ignoreSize:!!i})}var vV=Bu,yV=[`width`,`height`],bV=[`x`,`y`],xV=function(e){i(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 vV),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new vV)},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=V(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new Uo({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=Sf(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:z(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=yV[s],l=bV[s],u=yV[1-s],d=bV[1-s];i&&r_(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=D(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;r_(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),r_(`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],_=G(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new Ro({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&Ud(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`,U(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=yV[i],o=bV[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}(iV);function SV(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 CV(e){Rj(hV),e.registerComponentModel(gV),e.registerComponentView(xV),SV(e)}function wV(e){Rj(hV),Rj(CV)}var TV=function(e){i(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=Dh(jz.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(jz),EV=yc();function DV(e,t,n){EV(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function OV(e,t){for(var n=EV(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||kV(n,o))}}}function kV(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function AV(e,t){var n={model:t,containsPoint:B(MV,t),dispatchAction:B(jV,e),dataZoomInfoMap:null,controller:null},r=n.controller=new rN(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 jV(e,t){e.isDisposed()||e.dispatchAction({type:`dataZoom`,animation:{easing:`cubicOut`,duration:100},batch:t})}function MV(e,t,n,r){return e.coordinateSystem.containPoint([n,r])}function NV(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=G(t.get(`cursorGrab`,!0),s),c=G(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 PV(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=EV(t),r=n.coordSysRecordMap||=K();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){F(Tz(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,AV(t,n.model));(a.dataZoomInfoMap||=K()).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)kV(r,e);else{var s=NV(a,e,t);n.enable(s.controlType,s.opt),Sw(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)}})})}var FV=function(e){i(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(),DV(r,t,{pan:z(IV.pan,this),zoom:z(IV.zoom,this),scrollMove:z(IV.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){OV(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(Nz),IV={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=RV[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(zI(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:LV(function(e,t,n,r,i,a){var o=RV[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:LV(function(e,t,n,r,i,a){return RV[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function LV(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(zI(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 RV={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 zV(e){Rz(e),e.registerComponentModel(TV),e.registerComponentView(FV),PV(e)}var BV=function(e){i(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=Dh(jz.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}(jz),VV=Ro,HV=1,UV=30,WV=7,GV=`horizontal`,KV=`vertical`,qV=5,JV=[`line`,`bar`,`candlestick`,`scatter`],YV={easing:`cubicOut`,duration:100,delay:0},XV=function(e){i(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=z(this._onBrush,this),this._onBrushEnd=z(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){e.prototype.render.apply(this,arguments),Sw(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(){Cw(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 Bu;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`)?WV:0,r=l_(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===GV?{right:r.width-i.x-i.width,top:r.height-UV-a-n,width:i.width,height:UV}:{right:a,top:i.y,width:UV,height:i.height},s=m_(e.option);F([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=s_(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===KV&&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===GV&&!i?{scaleY:o?1:-1,scaleX:1}:n===GV&&i?{scaleY:o?1:-1,scaleX:-1}:n===KV&&!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 VV({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new VV({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:z(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:_s(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new Bu,r=new pd({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new hd({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&&M(JV,e.get(`type`))<0)){var o=r.getComponent(Cz(i),a).axis,s=QV(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 VV({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new VV({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:HV,fill:Y.color.transparent}})),F([0,1],function(t){var a=o.get(`handleIcon`);!Mv[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=Fv(a,-1,0,2,2,null,!0);s.attr({cursor:$V(this._orient),draggable:!0,drift:z(this._onDragMove,this,t),ondragend:z(this._onDragEnd,this),onmouseover:z(this._onOverDataInfoTriggerArea,this,!0),onmouseout:z(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(),au(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new Uo({silent:!0,invisible:!f,style:Xf(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 Ro({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=Fv(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,Y.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new Ro({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:z(this._onActualMoveZoneDrift,this),ondragstart:z(this._onActualMoveZoneDragStart,this),ondragend:z(this._onActualMoveZoneDragEnd,this),onmouseover:z(this._onOverDataInfoTriggerArea,this,!0),onmouseout:z(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[_s(e[0],[0,100],t,!0),_s(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];zI(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:_s(a.minSpan,o,i,!0),a.maxSpan==null?null:_s(a.maxSpan,o,i,!0));var s=this._range,c=this._range=Cs([_s(r[0],i,o,!0),_s(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=Cs(n.slice()),i=this._size;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 Ro,l.setClipPath(u)),u.setShape({x:s[c],y:0,width:s[c+1]-s[c],height:i[1]})}this._updateDataInfo(e)},t.prototype._updateDataInfo=function(e){var t=this.dataZoomModel,n=this._displayables,r=n.handleLabels,i=this._orient,a=[``,``];if(t.get(`showDetail`)){var o=t.findRepresentativeAxisProxy(),s=o.getAxisModel().axis.scale;if(o){var c=this._range,l;if(e){var u={start:c[0],end:c[1]},d=kz(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=[ZV(t,0,l,s),ZV(t,1,l,s)]}}var p=Cs(this._handleEnds.slice());m.call(this,0),m.call(this,1);function m(e){var t=mf(n.handles[e].parent,this.group),o=gf(e===0?`right`:`left`,t),s=this._handleWidth/2+qV,c=hf([p[e]+(e===0?-s:s),this._size[1]/2],t);r[e].setStyle({x:c[0],y:c[1],verticalAlign:i===GV?`middle`:o,align:i===GV?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,dE(r.event);var i=this._displayables.sliderGroup.getLocalTransform(),a=hf([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 jt(t,n),this._brushing=!0,this._brushStartTime=+/* @__PURE__ */ 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(!(+/* @__PURE__ */ 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();zI(0,a,r,0,o.minSpan==null?null:_s(o.minSpan,i,r,!0),o.maxSpan==null?null:_s(o.maxSpan,i,r,!0)),this._range=Cs([_s(a[0],r,i,!0),_s(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(dE(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 VV({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?YV:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=Tz(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}(Nz);function ZV(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)?``:Jy(r)||Ky(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?Ss(o,a,!0):o+``;return H(i)?i(o,s):U(i)?i.replace(`{value}`,s):s}function QV(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function $V(e){return e===`vertical`?`ns-resize`:`ew-resize`}function eH(e){e.registerComponentModel(BV),e.registerComponentView(XV),Rz(e)}function tH(e){Rj(zV),Rj(eH)}var nH={get:function(e,t,n){var r=D((rH[e]||{})[t]);return n&&V(r)?r[r.length-1]:r}},rH={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]}},iH=EF.mapVisual,aH=EF.eachVisual,oH=V,sH=F,cH=Cs,lH=_s,uH=function(e){i(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&&xB(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=z(e,this),this.controllerVisuals=bB(this.option.controller,t,e),this.targetVisuals=bB(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 sH(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=Tc(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return 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||=[`<`,`>`],V(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return U(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):H(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=cH([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=ne(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||={};O(r,n),O(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){oH(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]={},sH(r,function(e,t){if(EF.isValidType(t)){var n=nH.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`;sH(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&D(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&D(n)||(a?s[0]:[s[0],s[0]])),c.symbol=iH(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;aH(l,function(e){e>u&&(u=e)}),c.symbolSize=iH(l,function(e){return lH(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}(__),dH=function(e){i(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=Wg(t.get(`padding`)||0),r=e.getBoundingRect();e.add(new Ro({z2:-1,silent:!0,shape:{x:r.x-n[3],y:r.y-n[0],width:r.width+n[3]+n[1],height:r.height+n[0]+n[2]},style:{fill:t.get(`backgroundColor`),stroke:t.get(`borderColor`),lineWidth:t.get(`borderWidth`)}}))},t.prototype.getControllerVisual=function(e,t,n){n||={};var r=n.forceState,i=this.visualMapModel,a={};t===`color`&&(a.color=i.get(`contentColor`));function o(e){return a[e]}function s(e,t){a[e]=t}var c=i.controllerVisuals[r||i.getValueState(e)];return F(EF.prepareVisualTypes(c),function(r){var i=c[r];n.convertOpacityToAlpha&&r===`opacity`&&(r=`colorAlpha`,i=c.__alphaForOpacity),EF.dependsOn(r,t)&&i&&i.applyVisual(e,o,s)}),a[t]},t.prototype.positionGroup=function(e){var t=this.visualMapModel,n=this.api,r=l_(t,n).refContainer;u_(e,t.getBoxLayoutParams(),r)},t.prototype.doRender=function(e,t,n,r){},t.type=`visualMap`,t}(_O),fH=[[`left`,`right`,`width`],[`top`,`bottom`,`height`]];function pH(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=fH[o],c=[0,null,10],l={},u=0;u<3;u++)l[fH[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=s_(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 mH(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 hH={type:`selectDataRange`,event:`dataRangeSelected`,update:`update`},gH=function(e,t){t.eachComponent({mainType:`visualMap`,query:e},function(t){t.setSelected(e.selected)})},_H=[{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(SB(t.stateList,t.targetVisuals,z(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(z(vH,null,e,t))||{stops:[],outerColors:[]},a=t.getDataDimensionIndex(n);a>=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function vH(e,t,n,r){for(var i=t.targetVisuals[r],a=EF.prepareVisualTypes(i),o={color:ek(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 yH=F;function bH(e){var t=e&&e.visualMap;V(t)||(t=t?[t]:[]),yH(t,function(e){if(e){xH(e,`splitList`)&&!xH(e,`pieces`)&&(e.pieces=e.splitList,delete e.splitList);var t=e.pieces;t&&V(t)&&yH(t,function(e){W(e)&&(xH(e,`start`)&&!xH(e,`min`)&&(e.min=e.start),xH(e,`end`)&&!xH(e,`max`)&&(e.max=e.end))})}})}function xH(e,t){return e&&e.hasOwnProperty&&e.hasOwnProperty(t)}var SH=!1;function CH(e){SH||(SH=!0,e.registerSubTypeDefaulter(`visualMap`,function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(hH,gH),F(_H,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(bH))}var wH=function(e){i(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=[],TH[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=D(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=I(this._pieceList,function(e){return e=D(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=EF.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]=nH.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=D(e)},t.prototype.getValueState=function(e){var t=EF.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){EF.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=Dh(uH.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}(uH),TH={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o<i;s+=a,o++){var c=o===i-1?r[1]:s+a;e.push({interval:[s,c],close:[1,1]})}t.maxOpen&&e.push({interval:[r[1],1/0],close:[0,0]}),Ls(e),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),EH(t,e)},pieces:function(e){var t=this.option;F(t.pieces,function(t,n){W(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=EF.retrieveVisuals(t),e.push(r)},this),EH(t,e),Ls(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 EH(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var DH=function(e){i(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=fe(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 Bu;u.onclick=z(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new Uo({style:Xf(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:G(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),r_(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:mH(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return pH(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 Bu,o=this.visualMapModel.textStyleModel;a.add(new Uo({style:Xf(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=Fv(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=D(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}(dH);function OH(e){e.registerComponentModel(wH),e.registerComponentView(DH),CH(e)}function kH(e){if(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].slice());return t}}function AH(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:kH(r&&r.shape.points)}}var jH=[`align`,`verticalAlign`,`width`,`height`,`fontSize`],MH=new Kn,NH=yc(),PH=yc();function FH(e,t,n){for(var r=0;r<n.length;r++){var i=n[r];t[i]!=null&&(e[i]=t[i])}}var IH=[`x`,`y`,`rotation`],LH=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?MH.setLocalTransform(s):(MH.x=MH.y=MH.rotation=MH.originX=MH.originY=0,MH.scaleX=MH.scaleY=1),MH.rotation=ro(MH.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:MH.x,y:MH.y,scaleX:MH.scaleX,scaleY:MH.scaleY,rotation:MH.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`);(H(r)||R(r).length)&&e.group.traverse(function(e){if(e.ignore)return!0;var i=e.getTextContent(),a=Xc(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(){ET(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=H(a.layoutOptionOrCb)?a.layoutOptionOrCb(AH(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=NH(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<jH.length;m++){var h=jH[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(DS({},e))});var i=L(r,function(e){return e.layoutOption.moveOverlap===`shiftX`}),a=L(r,function(e){return e.layoutOption.moveOverlap===`shiftY`});kS(i,0,0,t),kS(a,1,0,n);var o=L(r,function(e){return e.layoutOption.hideOverlap});AS(o),jS(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=NH(o).needsUpdateLabelLine),a&&e._updateLabelLine(t,n),i&&e._animateLabels(t,n)})})},e.prototype._updateLabelLine=function(e,t){var n=e.getTextContent(),r=Xc(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`);NT(e,PT(o),s),ET(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&&!Gd(e))){var i=NH(n),a=i.oldLayout,o=Xc(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&&(M(u,`select`)>=0&&n.attr(i.oldLayoutSelect),M(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),Ud(n,c,t,s)}else if(n.attr(c),!ap(n).valueAnimation){var d=G(n.style.opacity,1);n.style.opacity=0,Wd(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};FH(f,c,IH),FH(f,n.states.select,IH)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};FH(p,c,IH),FH(p,n.states.emphasis,IH)}sp(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=PH(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),Ud(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,Wd(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),RH=yc();function zH(e){e.registerUpdateLifecycle(`series:beforeupdate`,function(e,t,n){var r=RH(t).labelManager;r||=RH(t).labelManager=new LH,r.clearLabels()}),e.registerUpdateLifecycle(`series:layoutlabels`,function(e,t,n){var r=RH(t).labelManager;F(n.updatedSeries,function(e){r.addLabelsOfSeries(t.getViewOfSeriesModel(e))}),r.updateLayoutConfig(t),r.layout(t),r.processLabelsOverall()})}var BH=function(){function e(t,n){Fy(this,e.decoratedMethods),this._outOfBrk=Vy(null,n);var r=this._linear=Vy(null,n);Iy(this,r),this.breaks=t&&t.breaks||[]}return e.prototype.hasBreaks=function(){return!!this.breaks.length},e.prototype.calcNiceTickMultiple=function(e,t){for(var n=0;n<this.breaks.length;n++){var r=this.breaks[n];if(r.vmin<e&&e<r.vmax)return t(e,r.vmax)}return 0},e.decoratedMethods={needTransform:function(){return!this.breaks.length},getExtent:function(){return this._outOfBrk.getExtent()},getExtentUnsafe:function(e,t){return t==null||t===2?this._outOfBrk.getExtentUnsafe(e,null):this._linear.getExtentUnsafe(e,null)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){Rc(t,n)&&(e===0&&WH(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=HH,r=UH,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=HH,r=UH,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 VH(e,t){return new BH(e,t)}var HH=0,UH=0;function WH(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=qH(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:ss(o,0)*t.val/n),t.type===`tpAbs`&&(e.gapReal=t.val),e.gapReal??=0})}function GH(e,t,n,r,i,a){e!==`no`&&F(n,function(n){var o=qH(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 KH(e,t,n,r){F(t,function(t){var i=qH(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 qH(e,t){var n=ss(e.vmin,t[0]),r=os(e.vmax,t[1]);return n<r||n===r&&n>t[0]&&n<t[1]?{vmin:n,vmax:r,breakOption:e.breakOption,gapParsed:e.gapParsed,gapReal:e.gapReal}:null}function JH(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:D(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(U(e.gap)){var s=_e(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:L(r,function(e){return!!e})}}function YH(e,t){return XH(t)===XH(e)}function XH(e){return e.start+`_\0_`+e.end}function ZH(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=ne(r,function(n){return YH(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 QH(e,t,n,r){if(t.break){var i=t.break.parsedBreak,a=ne(n,function(e){return YH(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:D(a.gapParsed),gapReal:i.gapReal};return{tickVal:s[t.break.type],vBreak:{type:t.break.type,parsedBreak:s}}}}function $H(e,t,n,r,i){i.original=JH(e,t,n);var a=i.transformed=JH(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 eU={vmin:`start`,vmax:`end`};function tU(e,t){return t&&(e||={},e.break={type:eU[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function nU(){tg({createBreakScaleMapper:VH,pruneTicksByBreak:GH,addBreaksToTicks:KH,parseAxisBreakOption:JH,identifyAxisBreak:YH,serializeAxisBreakIdentifier:XH,retrieveAxisBreakPairs:ZH,getTicksBreakOutwardTransform:QH,parseAxisBreakOptionInwardTransform:$H,makeAxisLabelFormatterParamBreak:tU})}var rU=yc();function iU(e,t){var n=ne(e,function(e){return ng().identifyAxisBreak(e.parsedBreak.breakOption,t.breakOption)});return n||e.push(n={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),n}function aU(e){F(e,function(e){return e.shouldRemove=!0})}function oU(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function sU(e,t,n,r,i){var a=n.axis;if(a.scale.isBlank()||!ng())return;var o=ng().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 Bu({ignoreModelZ:!0}),y=a.isHorizontal(),b=rU(t).visualList||(rU(t).visualList=[]);aU(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=iU(b,t);s.shouldRemove=!1;var c=new Bu;C(s.zigzagRandomList,c,r[0],r[1],y,t),d&&c.on(`click`,function(){var e={type:IS,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),oU(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[Qd[v]]+r[$d[v]];function b(e){var t=[],n=[];t[d]=n[d]=e,t[v]=r[Qd[v]],n[v]=y;var i={x1:t[0],y1:t[1],x2:n[0],y2:n[1]};return No(i,i,{lineWidth:1}),t[0]=i.x1,t[1]=i.y1,t[d]}n=b(n),i=b(i);for(var x=[],S=[],C=!0,w=r[Qd[v]],T=0;;T++){var E=w===r[Qd[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=ng().serializeAxisBreakIdentifier(o.breakOption);if(t.add(new hd({anid:`break_a_`+j,shape:{points:x},style:s,z:f})),o.gapReal!==0){t.add(new hd({anid:`break_b_`+j,shape:{points:S},style:s,z:f}));var M=S.slice();M.reverse();var ee=x.concat(M);t.add(new pd({anid:`break_c_`+j,shape:{points:ee},style:{fill:_,opacity:p.opacity},z:f}))}}}function cU(e,t,n,r){var i=e.axis,a=n.transform;ge(r.style);var o=i.getExtent();i.inverse&&(o=o.slice(),o.reverse());var s=I(ng().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:ng().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&&(Ot(e,e,a),Ot(t,t,a))}function c(e,t){var n={x1:e[0],y1:e[1],x2:t[0],y2:t[1]};No(n,n,r.style),e[0]=n.x1,e[1]=n.y1,t[0]=n.x2,t[1]=n.y2}var l=[e,0],u=[n,0],d=[e,5],f=[n,5];s(l,d),c(l,d),s(u,f),c(u,f),c(l,u);var p=new vd(k({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 lU(e,t,n){if(ne(n,function(e){return!e}))return;var r=new jt;if(!MS(n[0],n[1],r,{direction:-(e?t+Math.PI:t),touchThreshold:0,bidirectional:!1}))return;var i=at();ut(i,i,-t);var a=I(n,function(e){return e.transform?ct(at(),i,e.transform):i});function o(e){var t=n[0].localRect,r=new jt(t[$d[e]]*a[0][0],t[$d[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 jt;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 jt,h=new jt;jt.scale(m,r,-s),jt.scale(h,r,1-s),ES(n[0],m),ES(n[1],h)}function uU(e,t){var n={breaks:[]};return F(t.breaks,function(r){if(r){var i=ne(e.get(`breaks`,!0),function(e){return ng().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 dU(){PS({adjustBreakLabelPair:lU,buildAxisBreakLine:cU,rectCoordBuildBreakAxis:sU,updateModelAxisBreak:uU})}function fU(e){WS(e),nU(),dU()}var pU=Math.sin,mU=Math.cos,hU=Math.PI,gU=Math.PI*2,_U=180/hU,vU=function(){function e(){}return e.prototype.reset=function(e){this._start=!0,this._d=[],this._str=``,this._p=10**(e||4)},e.prototype.moveTo=function(e,t){this._add(`M`,e,t)},e.prototype.lineTo=function(e,t){this._add(`L`,e,t)},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){this._add(`C`,e,t,n,r,i,a)},e.prototype.quadraticCurveTo=function(e,t,n,r){this._add(`Q`,e,t,n,r)},e.prototype.arc=function(e,t,n,r,i,a){this.ellipse(e,t,n,n,0,r,i,a)},e.prototype.ellipse=function(e,t,n,r,i,a,o,s){var c=o-a,l=!s,u=Math.abs(c),d=ei(u-gU)||(l?c>=gU:-c>=gU),f=c>0?c%gU:c%gU+gU,p=!1;p=d?!0:!ei(u)&&f>=hU==!!l;var m=e+n*mU(a),h=t+r*pU(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*_U);if(d){var _=1/this._p,v=(l?1:-1)*(gU-_);this._add(`A`,n,r,g,1,+l,e+n*mU(a+v),t+r*pU(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*mU(o),b=t+r*pU(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}(),yU=`none`,bU=Math.round;function xU(e){var t=e.fill;return t!=null&&t!==yU}function SU(e){var t=e.stroke;return t!=null&&t!==yU}var CU=[`lineCap`,`miterLimit`,`lineJoin`],wU=I(CU,function(e){return`stroke-`+e.toLowerCase()});function TU(e,t,n,r){var i=t.opacity==null?1:t.opacity;if(n instanceof Ao)e(`opacity`,i);else{if(xU(t)){var a=Qr(t.fill);e(`fill`,a.color);var o=t.fillOpacity==null?a.opacity*i:t.fillOpacity*a.opacity*i;(r||o<1)&&e(`fill-opacity`,o)}else e(`fill`,yU);if(SU(t)){var s=Qr(t.stroke);e(`stroke`,s.color);var c=t.strokeNoScale?n.getLineScale():1,l=c?(t.lineWidth||0)/c:0,u=t.strokeOpacity==null?s.opacity*i:t.strokeOpacity*s.opacity*i,d=t.strokeFirst;if((r||l!==1)&&e(`stroke-width`,l),(r||d)&&e(`paint-order`,d?`stroke`:`fill`),(r||u<1)&&e(`stroke-opacity`,u),t.lineDash){var f=bk(n),p=f[0],m=f[1];p&&(m=bU(m||0),e(`stroke-dasharray`,p.join(`,`)),(m||r)&&e(`stroke-dashoffset`,m))}else r&&e(`stroke-dasharray`,yU);for(var h=0;h<CU.length;h++){var g=CU[h];if(r||t[g]!==xo[g]){var _=t[g]||xo[g];_&&e(wU[h],_)}}}else r&&e(`stroke`,yU)}}var EU=`http://www.w3.org/2000/svg`,DU=`http://www.w3.org/1999/xlink`,OU=`http://www.w3.org/2000/xmlns/`,kU=`http://www.w3.org/XML/1998/namespace`,AU=`ecmeta_`;function jU(e){return document.createElementNS(EU,e)}function MU(e,t,n,r,i){return{tag:e,attrs:n||{},children:r,text:i,key:t}}function NU(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 PU(e){return`</`+e+`>`}function FU(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 NU(i,a)+(i===`style`?o||``:Vh(o))+(t?``+n+I(t,function(e){return r(e)}).join(n)+n:``)+PU(i)}return r(e)}function IU(e,t,n){n||={};var r=n.newline?`
20
- `:``,i=` {`+r,a=r+`}`,o=I(R(e),function(t){return t+i+I(R(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=I(R(t),function(e){return`@keyframes `+e+i+I(R(t[e]),function(n){return n+i+I(R(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 LU(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function RU(e,t,n,r){return MU(`svg`,`root`,{width:e,height:t,xmlns:EU,"xmlns:xlink":DU,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var zU=0;function BU(){return zU++}var VU={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`},HU=`transform-origin`;function UU(e,t,n){var r=k({},e.shape);k(r,t),e.buildPath(n,r);var i=new vU;return i.reset(hi(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function WU(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[HU]=n+`px `+r+`px`)}var GU={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function KU(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function qU(e,t,n){var r=e.shape.paths,i={},a,o;if(F(r,function(e){var t=LU(n.zrId);t.animation=!0,YU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=R(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=KU(i,n);return a.replace(o,s)}}function JU(e){return U(e)?VU[e]?`cubic-bezier(`+VU[e]+`)`:wr(e)?e:``:``}function YU(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof Td){var s=qU(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=JU(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=JU(d.easing),m=d.rawValue;(U(m)||ae(m))&&(t[f]=t[f]||{},t[f][c]=d.rawValue,p&&(t[f][u]=p))}}}}for(var f=0;f<o;f++){var p=a[f],m=p.targetName;m?m===`shape`&&d(p,c):!r&&d(p,s)}for(var h in s){var g={};Xn(g,e),k(g,s[h]);var _=gi(g),v=s[h][u];l[h]=_?{transform:_}:{},WU(l[h],g),v&&(l[h][u]=v)}var y,b=!0;for(var h in c){l[h]=l[h]||{};var x=!y,v=c[h][u];x&&(y=new Qa);var S=y.len();y.reset(),l[h].d=UU(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 GU[e]})}for(var w=R(l),T=!0,E,f=1;f<w.length;f++){var D=w[f-1],O=w[f];if(l[D][HU]!==l[O][HU]){T=!1;break}E=l[D][HU]}if(T&&E){for(var h in l)l[h][HU]&&delete l[h][HU];t[HU]=E}if(L(w,function(e){return R(l[e]).length>0}).length)return KU(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-`+BU();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function XU(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};ZU(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=Xr(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),ZU(r,t,n,!0)}}}function ZU(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+BU(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var QU=Math.round;function $U(e){return e&&U(e.src)}function eW(e){return e&&H(e.toDataURL)}function tW(e,t,n,r){TU(function(i,a){var o=i===`fill`||i===`stroke`;o&&pi(a)?gW(t,e,i,r):o&&ui(a)?_W(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),hW(n,e,r)}function nW(e,t){var n=vD(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[AU+`silent`]=`true`))}function rW(e){return ei(e[0]-1)&&ei(e[1])&&ei(e[2])&&ei(e[3]-1)}function iW(e){return ei(e[4])&&ei(e[5])}function aW(e,t,n){if(t&&!(iW(t)&&rW(t))){var r=n?10:1e4;e.transform=rW(t)?`translate(`+QU(t[4]*r)/r+` `+QU(t[5]*r)/r+`)`:ri(t)}}function oW(e,t,n){for(var r=e.points,i=[],a=0;a<r.length;a++)i.push(QU(r[a][0]*n)/n),i.push(QU(r[a][1]*n)/n);t.points=i.join(` `)}function sW(e){return!e.smooth}function cW(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]]=QU(o*r)/r)}}}var lW={circle:[cW([`cx`,`cy`,`r`])],polyline:[oW,sW],polygon:[oW,sW]};function uW(e){for(var t=e.animators,n=0;n<t.length;n++)if(t[n].targetName===`shape`)return!0;return!1}function dW(e,t){var n=e.style,r=e.shape,i=lW[e.type],a={},o=t.animation,s=`path`,c=e.style.strokePercent,l=t.compress&&hi(e)||4;if(i&&!t.willUpdate&&(!i[1]||i[1](r))&&!(o&&uW(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 vU,h.reset(l),f.rebuildPath(h,c),h.generateStr(),m.__svgPathVersion=p,m.__svgPathStrokePercent=c),a.d=h.getStr()}return aW(a,e.transform),tW(a,n,e,t),nW(a,e),t.animation&&YU(e,a,t),t.emphasis&&XU(e,a,t),MU(s,e.id+``,a)}function fW(e,t){var n=e.style,r=n.image;if(r&&!U(r)&&($U(r)?r=r.src:eW(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),aW(c,e.transform),tW(c,n,e,t),nW(c,e),t.animation&&YU(e,c,t),MU(`image`,e.id+``,c)}}function pW(e,t){var n=e.style,r=n.text;if(r!=null&&(r+=``),!(!r||isNaN(n.x)||isNaN(n.y))){var i=n.font||`12px sans-serif`,a=n.x||0,o=ai(n.y||0,mn(i),n.textBaseline),s={"dominant-baseline":`central`,"text-anchor":ii[n.textAlign]||n.textAlign};if(Yo(n)){var c=``,l=n.fontStyle,u=qo(n.fontSize);if(!parseFloat(u))return;var d=n.fontFamily||`sans-serif`,f=n.fontWeight;c+=`font-size:`+u+`;font-family:`+d+`;`,l&&l!==`normal`&&(c+=`font-style:`+l+`;`),f&&f!==`normal`&&(c+=`font-weight:`+f+`;`),s.style=c}else s.style=`font: `+i;return r.match(/\s/)&&(s[`xml:space`]=`preserve`),a&&(s.x=a),o&&(s.y=o),aW(s,e.transform),tW(s,n,e,t),nW(s,e),t.animation&&YU(e,s,t),MU(`text`,e.id+``,s,void 0,r)}}function mW(e,t){if(e instanceof wo)return dW(e,t);if(e instanceof Ao)return fW(e,t);if(e instanceof Eo)return pW(e,t)}function hW(e,t,n){var r=e.style;if(oi(r)){var i=si(e),a=n.shadowCache,o=a[i];if(!o){var s=e.getGlobalScale(),c=s[0],l=s[1];if(!c||!l)return;var u=r.shadowOffsetX||0,d=r.shadowOffsetY||0,f=r.shadowBlur,p=Qr(r.shadowColor),m=p.opacity,h=p.color,g=f/2/c,_=f/2/l,v=g+` `+_;o=n.zrId+`-s`+n.shadowIdx++,n.defs[o]=MU(`filter`,o,{id:o,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`},[MU(`feDropShadow`,``,{dx:u/c,dy:d/l,stdDeviation:v,"flood-color":h,"flood-opacity":m})]),a[i]=o}t.filter=mi(o)}}function gW(e,t,n,r){var i=e[n],a,o={gradientUnits:i.global?`userSpaceOnUse`:`objectBoundingBox`};if(di(i))a=`linearGradient`,o.x1=i.x,o.y1=i.y,o.x2=i.x2,o.y2=i.y2;else if(fi(i))a=`radialGradient`,o.cx=G(i.x,.5),o.cy=G(i.y,.5),o.r=G(i.r,.5);else return;for(var s=i.colorStops,c=[],l=0,u=s.length;l<u;++l){var d=ni(s[l].offset)*100+`%`,f=s[l].color,p=Qr(f),m=p.color,h=p.opacity,g={offset:d};g[`stop-color`]=m,h<1&&(g[`stop-opacity`]=h),c.push(MU(`stop`,l+``,g))}var _=FU(MU(a,``,o,c)),v=r.gradientCache,y=v[_];y||(y=r.zrId+`-g`+r.gradientIdx++,v[_]=y,o.id=y,r.defs[y]=MU(a,y,o,c)),t[n]=mi(y)}function _W(e,t,n,r){var i=e.style[n],a=e.getBoundingRect(),o={},s=i.repeat,c=s===`no-repeat`,l=s===`repeat-x`,u=s===`repeat-y`,d;if(ci(i)){var f=i.imageWidth,p=i.imageHeight,m=void 0,h=i.image;if(U(h)?m=h:$U(h)?m=h.src:eW(h)&&(m=h.toDataURL()),typeof Image>`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;ge(f,g),ge(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=nt(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=MU(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=D(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=gi(i);x&&(o.patternTransform=x);var S=MU(`pattern`,``,o,[d]),C=FU(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=MU(`pattern`,T,o,[d])),t[n]=mi(T)}}function vW(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]=MU(`clipPath`,a,o,[dW(e,n)])}t[`clip-path`]=mi(a)}function yW(e){return document.createTextNode(e)}function bW(e,t,n){e.insertBefore(t,n)}function xW(e,t){e.removeChild(t)}function SW(e,t){e.appendChild(t)}function CW(e){return e.parentNode}function wW(e){return e.nextSibling}function TW(e,t){e.textContent=t}var EW=58,DW=120,OW=MU(``,``);function kW(e){return e===void 0}function AW(e){return e!==void 0}function jW(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 MW(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function NW(e){var t,n=e.children,r=e.tag;if(AW(r)){var i=e.elm=jU(r);if(IW(OW,e),V(n))for(t=0;t<n.length;++t){var a=n[t];a!=null&&SW(i,NW(a))}else AW(e.text)&&!W(e.text)&&SW(i,yW(e.text))}else e.elm=yW(e.text);return e.elm}function PW(e,t,n,r,i){for(;r<=i;++r){var a=n[r];a!=null&&bW(e,NW(a),t)}}function FW(e,t,n,r){for(;n<=r;++n){var i=t[n];i!=null&&(AW(i.tag)?xW(CW(i.elm),i.elm):xW(e,i.elm))}}function IW(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)===DW?n===`xmlns:xlink`||n===`xmlns`?r.setAttributeNS(OU,n,o):n.charCodeAt(3)===EW?r.setAttributeNS(kU,n,o):n.charCodeAt(5)===EW?r.setAttributeNS(DU,n,o):r.setAttribute(n,o):r.setAttribute(n,o))}for(n in i)n in a||r.removeAttribute(n)}}function LW(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]:MW(o,l)?(RW(o,l),o=t[++r],l=n[++i]):MW(s,u)?(RW(s,u),s=t[--a],u=n[--c]):MW(o,u)?(RW(o,u),bW(e,o.elm,wW(s.elm)),o=t[++r],u=n[--c]):MW(s,l)?(RW(s,l),bW(e,s.elm,o.elm),s=t[--a],l=n[++i]):(kW(d)&&(d=jW(t,r,a)),f=d[l.key],kW(f)?bW(e,NW(l),o.elm):(p=t[f],p.tag===l.tag?(RW(p,l),t[f]=void 0,bW(e,p.elm,o.elm)):bW(e,NW(l),o.elm)),l=n[++i]);(r<=a||i<=c)&&(r>a?(m=n[c+1]==null?null:n[c+1].elm,PW(e,m,n,i,c)):FW(e,t,r,a))}function RW(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(IW(e,t),kW(t.text)?AW(r)&&AW(i)?r!==i&&LW(n,r,i):AW(i)?(AW(e.text)&&TW(n,``),PW(n,null,i,0,i.length-1)):AW(r)?FW(n,r,0,r.length-1):AW(e.text)&&TW(n,``):e.text!==t.text&&(AW(r)&&FW(n,r,0,r.length-1),TW(n,t.text)))}function zW(e,t){if(MW(e,t))RW(e,t);else{var n=e.elm,r=CW(n);NW(t),r!==null&&(bW(r,t.elm,wW(n)),FW(r,[e],0,0))}return t}var BW=0,VW=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=HW(`configLayer`),this.storage=t,this._opts=n=k({},n),this.root=e,this._id=`zr`+BW++,this._oldVNode=RU(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=jU(`svg`);IW(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`,zW(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return mW(e,LU(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=LU(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=UW(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=MU(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=I(R(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(MU(`defs`,`defs`,{},c)),e.animation){var l=IU(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=MU(`style`,`stl`,{},[],l);a.push(u)}}return RU(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},FU(this.renderToVNode({animation:G(e.cssAnimation,!0),emphasis:G(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:G(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 _={};vW(d[g],_,t);var v=MU(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=mW(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=vk(r,0,n),t=vk(r,1,n),i.style.display=``),this._width!==e||this._height!==t){if(this._width=e,this._height=t,i){var a=i.style;a.width=e+`px`,a.height=t+`px`}if(ui(this._backgroundColor))this.refresh();else{var o=this._svgDom;o&&(o.setAttribute(`width`,e),o.setAttribute(`height`,t));var s=this._bgVNode&&this._bgVNode.elm;s&&(s.setAttribute(`width`,e),s.setAttribute(`height`,t))}}},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e.prototype.dispose=function(){this.root&&(this.root.innerHTML=``),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},e.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},e.prototype.toDataURL=function(e){var t=this.renderToString(),n=`data:image/svg+xml;`;return e?(t=_i(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}();function HW(e){return function(){}}function UW(e,t,n,r){var i;if(n&&n!==`none`){if(i=MU(`rect`,`bg`,{width:e,height:t,x:`0`,y:`0`}),pi(n))gW({fill:n},i.attrs,`fill`,r);else if(ui(n))_W({style:{fill:n},dirty:ke,getBoundingRect:function(){return{width:e,height:t}}},i.attrs,`fill`,r);else{var a=Qr(n),o=a.color,s=a.opacity;i.attrs.fill=o,s<1&&(i.attrs[`fill-opacity`]=s)}}return i}function WW(e){e.registerPainter(`svg`,VW)}function GW(e,t,n){var r=d.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 KW(e){return!e.__cursors.get(0)}function qW(e){var t=e.__cursors.get(0);return{startIdx:t?t.startIdx:0,endIdx:t?t.endIdx:0}}var JW=function(e){i(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.zlevel=0,i.zlevel2=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__prevIdx={startIdx:0,endIdx:0};var a;r||=Ui,typeof t==`string`?a=GW(t,n,r):W(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(De(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=qW(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=GW(`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=qW(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;le(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||hk(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):ue(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=Dk(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}(Vi),YW=1e5,XW=314159,ZW=void 0,QW=1,$W=2;function eG(e){return e?e.__builtin__?!0:typeof e.resize==`function`&&typeof e.refresh==`function`:!1}function tG(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 nG(e,t,n,r){var i=new JW(e,t,t.dpr);return i.zlevel=n,i.zlevel2=r,i.__builtin__=!0,rG(i),i}function rG(e){e.__cursorStack=[],e.__cursors=K()}function iG(e){return e.startIdx=e.drawIdx=e.endIdx=e.endIdxNew=0,e.used=!1,e.first=e.last=NaN,e.notClearIdx=-1,e}function aG(e,t){var n=e.__cursors,r=+t;return n.get(r)||(e.__cursorStack.push(r),n.set(r,iG({key:r})))}function oG(e,t){for(var n=e.__cursorStack,r=0;r<n.length;r++)t(e.__cursors.get(n[r]))}function sG(e,t){var n=e.layers;return n[t]||(n[t]=[,,,])}function cG(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&lG&&!s.__builtin__||n&uG&&s.__builtin__||n&dG&&s===e.hoverlayer)||t(s,a,o,i)}}var lG=1,uG=2,dG=4,fG=lG|dG,pG=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=k({},n||{}),this.dpr=n.devicePixelRatio||Ui,this._singleCanvas=i,this.root=e,e.style&&(De(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=nG(a,this,XW,0);c.initContext(),this._insertLayer(c,XW,0,!0),this._domRoot=e}else{this._width=vk(e,0,n),this._height=vk(e,1,n);var l=this._domRoot=tG(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&&!W(e)?{paintAll:!!e}:e||{},n=G(t.refresh,!0),r=G(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=$W),!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 cG(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},uG),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=ZW,n!==ZW&&(!t&&n===$W&&(t=this._i.hoverlayer=this._ensureLayer(YW)),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),Kk(i,s,r),c&&(s.style=l)}}i&&(qk(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(YW)},e.prototype.paintOne=function(e,t){Gk(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)cG(this._i,function(e){e.afterBrush&&e.afterBrush()},fG),this._paintHoverList(e);else{var i=this;HE(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(XW).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),cG(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},lG)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return cG(this._i,function(i){var a=!1;if(oG(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!KW(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)}oG(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},fG),Me.wxa&&cG(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=KW(e),c=s&&d.getTime(),l=t.drawIdx,u=t.notClearIdx,f=u>=0?Math.min(u,l):l;f<t.endIdx;f++){var p=n[f];if(!(f<l&&!p.notClear)){if(p.__inHover&&(this._hoverLayerDirty=$W),r!=null){var m=p.getPaintRect();m&&m.intersect(r)&&(Kk(o,p,a),p.setPrevPaintRect(m))}else Kk(o,p,a);if(s&&d.getTime()-c>15){f++;break}}}qk(o,a),t.drawIdx=Math.max(f,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=XW,t=0);var i=sG(this._i,e)[t];return i||(i=nG(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&O(i,this._layerConfig[e],!0),(n||r&&e!==XW)&&(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])&&eG(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=sG(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),sG(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 cG(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return cG(this._i,function(n,r){e.call(t,n,r)},lG)},e.prototype.eachOtherLayer=function(e,t){return cG(this._i,function(n,r){e.call(t,n,r)},uG)},e.prototype.getLayers=function(){var e={};return cG(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}}cG(n._i,function(e){e.__dirty=!1,oG(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},fG);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__))E(`ZLevel `+d+` has been used by unknown layer `+o.id);else{if((!s||f!==s.key)&&(s=aG(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))}}cG(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;(KW(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&&(oG(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===ZW&&(n._hoverLayerDirty=QW))},fG)},e.prototype.clear=function(){return cG(this._i,function(e){e.clear(),rG(e)},lG),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,cG(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?O(n[e],t,!0):n[e]=t,cG(this._i,function(e,t){O(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=vk(i,0,r),t=vk(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,cG(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(XW).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[XW][0].dom;var t=new JW(`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;cG(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];Kk(n,l,a)}qk(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function mG(e){e.registerPainter(`canvas`,pG)}var hG=Object.freeze({INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`,JPY:`¥`}),gG=e=>typeof e==`string`&&/^[A-Z]{3}$/.test(e),_G=(e=`INR`)=>hG[e]??`${e} `;function vG(e,...t){console.warn(e,...t)}function yG(e,...t){console.error(e,...t)}function bG(e,t){if(e==null)throw Error(t);return e}function xG(e,t,...n){if(e.toLowerCase()===`svg`)throw Error(`make() builds HTML elements; use svgRoot for svg`);let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))n===!0?r.setAttribute(e,``):(typeof n==`string`||typeof n==`number`)&&r.setAttribute(e,String(n));let i=[];for(let e of n)e instanceof Node?i.push(e):(typeof e==`string`||typeof e==`number`)&&i.push(document.createTextNode(String(e)));return r.append(...i),r}var SG=`en-IN`,CG=/\{([A-Za-z0-9_]+)\}/g,wG=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0,TG=/* @__PURE__ */ new Map,EG=0,DG=/* @__PURE__ */ new Map;function OG(e,t){let n=TG.get(e);if(n===void 0)return t;let r=DG.get(e);if(r!==void 0&&r.version===EG&&r.english===t&&NG(r.merged,t))return r.merged;let i=MG(e,n,t);return DG.set(e,{version:EG,english:t,merged:i}),i}function kG(){return SG}function AG(e,t){return e.replace(CG,(e,n)=>wG(t,n)?String(t[n]):e)}function jG(e,t,n,r){let i=`${t}Other`;if(!wG(e,i))throw RangeError(`Plural text ${t} has no ${i} key; every plural needs its Other form.`);let a=new Intl.PluralRules(kG()).select(n),o=`${t}${a.charAt(0).toUpperCase()}${a.slice(1)}`,s=e[wG(e,o)?o:i];if(s===void 0)throw RangeError(`Plural text ${t} has no ${o} key.`);return AG(s,{count:n,...r})}function MG(e,t,n){let r={};for(let[i,a]of Object.entries(t)){let t=wG(n,i)?n[i]:void 0;if(t===void 0)throw RangeError(`Text ${e}.${i} is not a key of the English text. Allowed keys: ${Object.keys(n).join(`, `)}.`);let o=PG(t);for(let t of PG(a))if(!o.includes(t))throw RangeError(`Text ${e}.${i} uses {${t}}, which the English text does not have. Allowed placeholders: ${o.length===0?`none`:o.map(e=>`{${e}}`).join(`, `)}.`);r[i]=a}return Object.assign({},n,r)}function NG(e,t){let n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(t=>wG(e,t))}function PG(e){return Array.from(e.matchAll(CG),e=>e[1]??``)}var FG={aprShortLabel:`Apr`,aprilLabel:`April`,augShortLabel:`Aug`,augustLabel:`August`,decShortLabel:`Dec`,decemberLabel:`December`,emptyValueLabel:`-`,febShortLabel:`Feb`,februaryLabel:`February`,friMinLabel:`Fr`,friShortLabel:`Fri`,fridayLabel:`Friday`,janShortLabel:`Jan`,januaryLabel:`January`,julShortLabel:`Jul`,julyLabel:`July`,junShortLabel:`Jun`,juneLabel:`June`,marShortLabel:`Mar`,marchLabel:`March`,mayLabel:`May`,mayShortLabel:`May`,monMinLabel:`Mo`,monShortLabel:`Mon`,mondayLabel:`Monday`,novShortLabel:`Nov`,novemberLabel:`November`,octShortLabel:`Oct`,octoberLabel:`October`,satMinLabel:`Sa`,satShortLabel:`Sat`,saturdayLabel:`Saturday`,sepShortLabel:`Sep`,septemberLabel:`September`,sunMinLabel:`Su`,sunShortLabel:`Sun`,sundayLabel:`Sunday`,thuMinLabel:`Th`,thuShortLabel:`Thu`,thursdayLabel:`Thursday`,tueMinLabel:`Tu`,tueShortLabel:`Tue`,tuesdayLabel:`Tuesday`,wedMinLabel:`We`,wedShortLabel:`Wed`,wednesdayLabel:`Wednesday`},IG=`Asia/Kolkata`,LG=198e5,RG=/* @__PURE__ */ new Map;function zG(e){let t=RG.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`}),RG.set(e,t)),t}function BG(e){if(typeof e!=`string`||e===``)return!1;try{return zG(e),!0}catch{return!1}}function VG(e,t=IG){if(t===`Asia/Kolkata`){let t=new Date(e+LG);return{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}let n=Object.fromEntries(zG(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 HG(e,t=IG){if(t===`Asia/Kolkata`)return LG;let n=VG(e,t),r=/* @__PURE__ */ 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 UG(e,t=IG){let n=e-HG(e,t);return n=e-HG(n,t),n}var WG=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],GG=[`rupees`,`paise`],KG=[`ms`,`s`,`min`,`h`],qG=[`day`,`month`,`year`,`datetime`,`time`],JG=()=>OG(`formatters`,FG),YG=()=>JG().emptyValueLabel,XG=`−`,ZG=[`janShortLabel`,`febShortLabel`,`marShortLabel`,`aprShortLabel`,`mayShortLabel`,`junShortLabel`,`julShortLabel`,`augShortLabel`,`sepShortLabel`,`octShortLabel`,`novShortLabel`,`decShortLabel`],QG={short:[`sunShortLabel`,`monShortLabel`,`tueShortLabel`,`wedShortLabel`,`thuShortLabel`,`friShortLabel`,`satShortLabel`],long:[`sundayLabel`,`mondayLabel`,`tuesdayLabel`,`wednesdayLabel`,`thursdayLabel`,`fridayLabel`,`saturdayLabel`],min:[`sunMinLabel`,`monMinLabel`,`tueMinLabel`,`wedMinLabel`,`thuMinLabel`,`friMinLabel`,`satMinLabel`]},$G=(e,t)=>JG()[bG(e[t],`no date name at index ${t}`)],eK=e=>$G(ZG,e);function tK(e,t){return $G(QG[t],e)}var nK=(e,t)=>bG(e[t],`no compact unit at index ${t}`),rK=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],iK=[[1e9,`B`],[1e6,`M`],[1e3,`K`]],aK=e=>!e||e===`INR`?`en-IN`:`en-US`,oK=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=20?e:t,sK=/* @__PURE__ */ new Map,cK=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=sK.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:e}),sK.set(n,r)),r},lK=/* @__PURE__ */ new Map,uK=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=lK.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e}),lK.set(n,r)),r},dK=e=>typeof e==`number`&&Number.isFinite(e),fK=e=>e<0&&!Object.is(Math.abs(e),0)?XG:``;function pK(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 mK=(e,t)=>t===`paise`?Number(pK(e)):e,hK=2,gK=(e,t,n)=>{let r=Math.min(t,hK),i=10n**BigInt(hK-r),a=(BigInt(pK(e).replace(`.`,``))+i/2n)/i,o=10n**BigInt(r),s=uK(0,n).format(a/o);return t===0?s:`${s}.${(a%o).toString().padStart(r,`0`)}${`0`.repeat(t-r)}`};function _K(e,{decimals:t}={}){if(!dK(e))return YG();let n=cK(oK(t,2)).format(Math.abs(e));return n===`0`?`0`:fK(e)+n}function vK(e,t){if(!t?.currency)throw TypeError(`[@webority/ui-elements] formatCurrency needs options.currency, an ISO 4217 code such as "INR".`);if(!dK(e))return YG();let{unit:n=`rupees`,decimals:r,currency:i}=t,a=oK(r,0),o=aK(i),s=n===`paise`?gK(Math.abs(e),a,o):uK(a,o).format(Math.abs(e));return(Number(s.replace(/,/g,``))===0?``:fK(e))+_G(i)+s}var yK=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2;function bK(e,{currency:t,unit:n=`rupees`}={}){if(!dK(e))return YG();let r=t?mK(e,n):e,i=t?_G(t):``,a=t?aK(t):`en-IN`,o=a===`en-IN`?rK:iK,s=Math.abs(r),c=o.findIndex(([e])=>s>=e);if(c===-1){let e=cK(yK(s),a).format(s);if(e!==`1,000`)return(e===`0`?``:fK(r))+i+e;c=o.length-1}let[l,u]=nK(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]=nK(o,c),d=s/l,f=d>=100?0:d>=10?1:2,p=Number(d.toFixed(f))),`${fK(r)}${i}${cK(f,a).format(p)} ${u}`}function xK(e,{decimals:t}={}){return dK(e)?`${_K(e*100,{decimals:oK(t,1)})}%`:YG()}var SK={ms:1,s:1e3,min:6e4,h:36e5};function CK(e,{unit:t=`s`}={}){if(!dK(e))return YG();let n=SK[t]??1e3,r=Math.abs(e*n),i=fK(e);if(Math.round(r)<1e3)return`${i}${cK(0).format(r)} ms`;let a=r/1e3;if(a<10)return`${i}${cK(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}${cK(0).format(l)}h ${s(c%60)}m`}function wK(e,t=IG){if(e instanceof Date)return e.getTime();if(dK(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?UG(a.getTime(),t):NaN}return Date.parse(e)}function TK(e,t=IG){let{year:n,month:r,day:i,hour:a,minute:o}=VG(e,t);return{year:n,month:r,day:i,hour:a,minute:o}}function EK(e,{pattern:t=`day`,timeZone:n=IG}={}){let r=wK(e,n);if(!Number.isFinite(r))return YG();let i=TK(r,n),a=e=>String(e).padStart(2,`0`),o=`${a(i.day)}-${eK(i.month)}-${i.year}`,s=`${a(i.hour)}:${a(i.minute)}`;switch(t){case`month`:return`${eK(i.month)}-${i.year}`;case`year`:return String(i.year);case`datetime`:return`${o} ${s}`;case`time`:return s;default:return o}}function DK(e,{timeZone:t=IG}={}){let n=wK(e,t);if(!Number.isFinite(n))return YG();let r=TK(n,t);return`${String(r.day).padStart(2,`0`)}-${eK(r.month)}`}function Z(e,t){if(e==null||e===``)return YG();let n=t?.style;if(n===`date`)return EK(e,t);if(typeof e!=`number`)return String(e);switch(n){case`currency`:return vK(e,{...t,currency:t?.currency??``});case`percent`:return xK(e,t);case`compact`:return bK(e,t);case`duration`:return CK(e,t);default:return _K(e,t)}}function OK(e){let t=e?.style;if(t===`currency`){if(!e?.currency)throw TypeError(`[@webority/ui-elements] a currency format needs a currency, an ISO 4217 code such as "INR".`);return{style:`compact`,currency:e.currency,unit:e.unit}}return!t||t===`number`?{style:`compact`}:e??{}}var kK={aboveLabel:`Above`,areaChartLabel:`Area chart`,arrowKeysText:`{title}: use the arrow keys to read the values`,bandLabel:`Band`,barChartLabel:`Bar chart`,belowLabel:`Below`,bubbleChartLabel:`Bubble chart`,calendarHeatmapLabel:`Calendar heatmap`,calendarRangeText:`, from {first} to {last}`,calendarSummaryTextOne:`Calendar heatmap of {label}, {n} day.`,calendarSummaryTextOther:`Calendar heatmap of {label}, {n} days{range}.`,categoryLabel:`Category`,centerLabel:`Total`,changeLabel:`Change`,chartLabel:`chart`,columnChartLabel:`Column chart`,columnFallbackLabel:`column`,columnXLabel:`X`,constantSpanText:`{label} is {lo}.`,currencyFormatText:`This chart's currency format needs a currency code, such as "INR", in its currency field.`,dataSuffixLabel:`data`,dateLabel:`Date`,donutChartLabel:`Donut chart`,donutLargestText:`{top} is the largest, at {share}.`,donutSummaryTextOne:`Donut chart of {label} in {rows} part, {total} in all.`,donutSummaryTextOther:`Donut chart of {label} in {rows} parts, {total} in all.`,emptyText:`No data to show for this chart.`,errorText:`This chart couldn't load. Try again in a moment.`,everySeriesHiddenText:`Every series is hidden.`,firstStageLabel:`first stage`,fromLabel:`From`,funnelChartLabel:`Funnel chart`,funnelPreviousStepText:`{share} of previous step`,funnelStartText:`{first} is {firstValue} and {last} is {lastValue}, {share} of the start.`,funnelSummaryText:`Funnel chart of {label} in {n} stages.`,gaugeBandText:`, in the {band} band`,gaugeLabel:`Gauge`,gaugeSummaryText:`{type}: {label} is {value} on a scale from {min} to {max}{band}.`,groupLabel:`Group`,groupsTextOne:` in {count} group: {groups}`,groupsTextOther:` in {count} groups: {groups}`,heatmapLabel:`Heatmap`,heatmapSummaryText:`Heatmap of {label} by {group} and {x}, {n} cells.`,highestAtLowestAtText:`Highest is {highValue} at {highGroup}, {high}; lowest is {lowValue} at {lowGroup}, {low}.`,highestLowestText:`Highest is {maxValue} on {max}; lowest is {minValue} on {min}.`,itemLabel:`Item`,largestFallText:`The largest fall is {xText}, {signed}.`,largestFlowText:`The largest flow is {xText} to {toText}, {fmtAt}.`,largestRiseText:`The largest rise is {xText}, {signed}.`,latestText:`Latest {latest}`,legendLabel:`Legend`,lessLabel:`Less`,lineChartLabel:`Line chart`,loadingText:`Loading chart`,measureLabel:`Measure`,moreLabel:`More`,ofFirstStepText:`Of {first}`,ofPreviousStepLabel:`Of previous step`,openingShareText:`{share} of opening`,opensAtClosesAtText:`It opens at {opening} and closes at {closing}.`,otherLabel:`Other`,pointsSummaryTextOne:`{n} point, {first}.`,pointsSummaryTextOther:`{n} points, from {first} to {last}.`,rangeSpanText:`{label} runs from {lo} to {hi}.`,rowFallbackLabel:`row`,rowLabel:`Row`,runningTotalLabel:`Running total`,sankeyLabel:`Sankey diagram`,sankeySummaryText:`Sankey diagram of {label}: {n} flows between {nodes} places.`,scaleLabel:`Scale`,scaleRangeText:`{min} to {max}`,scatterPlotLabel:`Scatter plot`,scatterSummaryText:`{type} of {label} against {xLabel}, {count} points{groups}.`,shareLabel:`Share`,shareOfAllLabel:`Share of all`,shareOfGroupLabel:`Share of group`,shareOfParentText:`Share of {parent}`,shareOfStepText:`{share} of {first}`,sharedAxisText:`, sharing one x axis`,showingFirstRowsDownloadText:`Showing the first {rows} of {total} rows. Download the CSV for all of them.`,smallMultiplesLabel:`Small multiples`,soFarText:`so far`,stackedPercentText:`, stacked to 100%`,stackedText:`, stacked`,stageLabel:`Stage`,stepLabel:`Step`,summaryText:`{type} of {series}{stacked}{sharedAxis}.`,targetGapText:`{direction} {label} by {gap}`,targetLabel:`target`,toLabel:`To`,tooManyGroupsText:`This chart has more groups than it can show clearly.`,tooManySeriesText:`This chart has more series than it can show clearly.`,totalText:`Total {total}`,treemapEmptyText:`Treemap of {label}: no items.`,treemapLabel:`Treemap`,treemapLargestGroupText:`{name} is the largest group, at {share}.`,treemapSummaryText:`Treemap of {label}: {n} items in {totals} groups, {total} in all.`,trendLabel:`Trend`,untitledLabel:`Chart`,waterfallLabel:`Waterfall chart`,waterfallSummaryText:`Waterfall chart of {label}.`},AK={applyLabel:`Apply`,dayCountOne:`1 day`,dayCountOther:`{count} days`,financialYearText:`FY {startYear}-{endYear}`,label:`Period`,nextMonthLabel:`Next month`,previousMonthLabel:`Previous month`,quarterPrefixText:`Q`,shortDaySuffixText:`d`,startEndPlaceholder:`Start to End`},Q=()=>OG(`chart`,kK),jK=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],MK=[`none`,`stacked`,`percent`],NK=[`category`,`time`,`value`],PK=[`auto`,`svg`,`canvas`],FK=[`ready`,`loading`,`empty`,`error`],IK=[`chart`,`table`],LK=[`chart-1`,`chart-2`,`chart-3`,`chart-4`,`chart-5`,`chart-6`,`chart-7`,`chart-8`],RK=8,zK=6,BK={line:`lineChartLabel`,area:`areaChartLabel`,column:`columnChartLabel`,bar:`barChartLabel`,donut:`donutChartLabel`,heatmap:`heatmapLabel`,calendar:`calendarHeatmapLabel`,funnel:`funnelChartLabel`,gauge:`gaugeLabel`,waterfall:`waterfallLabel`,treemap:`treemapLabel`,sankey:`sankeyLabel`,scatter:`scatterPlotLabel`,bubble:`bubbleChartLabel`,multiples:`smallMultiplesLabel`},VK=e=>Q()[BK[e]],HK=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],UK=e=>HK.includes(e),WK=[`area`,`column`,`bar`],GK=[`line`,`area`,`column`,`bar`,`multiples`],KK={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},qK={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`],centerLabel:[`donut`],sliceValues:[`donut`],valueLabels:[`line`,`column`,`bar`],incompleteLast:[`line`,`area`,`column`,`bar`]},JK={gauge:240,calendar:200,treemap:340,sankey:340},YK=100,XK=72,ZK=32,QK=/* @__PURE__ */ `type.title.description.data.x.series.group.to.size.trend.zoom.bands.stack.y.target.centerLabel.sliceValues.valueLabels.incompleteLast.height.state.emptyText.errorText.loadingText.renderer.timeZone.financialYearStart`.split(`.`),$K=[`key`,`kind`,`format`,`label`,`labelFit`],eq=[`auto`,`all`,`rotate`,`ellipsis`],tq=[`key`,`label`,`format`,`colour`],nq=[`key`,`label`],rq=[`key`,`label`,`format`],iq=[`upTo`,`label`],aq=[`label`,`format`,`min`,`max`,`wholeNumbers`],oq=[`value`,`label`],sq=[`style`,`currency`,`unit`,`decimals`,`pattern`],cq=[...GG,...KG],lq=/* @__PURE__ */ new Set;function uq(e){lq.has(e)||(lq.add(e),vG(`[@webority/ui-elements] <wui-chart> ${e}`))}var dq=e=>e.map(e=>`"${e}"`).join(` | `),fq=e=>typeof e==`number`&&Number.isFinite(e),pq=e=>typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=12,mq=e=>typeof e==`object`&&!!e&&!Array.isArray(e),hq=(e,t)=>Reflect.get(e,t),gq=e=>e===null||typeof e==`string`||typeof e==`number`,_q=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,gq(t)?t:null]));function vq(e,t){if(e==null)throw Error(`${t} missing`);return e}var yq=(e,t)=>e.some(e=>e===t);function bq(e,t,n){t==null||n.includes(t)||uq(`received ${e}="${String(t)}", which is not one of ${dq(n)}. The chart uses its default instead.`)}function xq(e,t,n){for(let r of Object.keys(t))n.includes(r)||(/^(y2|secondary)/i.test(r)?uq(`ignores ${e}.${r}: a chart has one value axis by design. Show the second measure as its own chart.`):uq(`ignores the unknown key ${e}.${r}. Known keys: ${n.join(`, `)}.`))}function Sq(e,t){if(t==null)return;if(typeof t!=`object`){uq(`expects ${e} to be an object such as { style: "currency" }.`);return}xq(e,t,sq);let n=hq(t,`style`);bq(`${e}.style`,n,WG);let r=hq(t,`currency`);r!=null&&!gG(r)&&uq(`received ${e}.currency="${String(r)}", which is not an ISO 4217 code such as "INR", so the format has no currency.`);let i=hq(t,`unit`);i!=null&&bq(`${e}.unit`,i,n===`duration`?KG:GG);let a=hq(t,`pattern`);bq(`${e}.pattern`,a,qG);let o=hq(t,`decimals`);o!=null&&!(typeof o==`number`&&Number.isInteger(o)&&o>=0&&o<=20)&&uq(`received ${e}.decimals=${String(o)}, which is not a whole number from 0 to 20. The chart uses its default instead.`);let s={style:yq(WG,n)?n:`number`};return typeof r==`string`&&gG(r)&&(s.currency=r),yq(cq,i)&&(s.unit=i),typeof o==`number`&&(s.decimals=o),yq(qG,a)&&(s.pattern=a),s}function Cq(e,t){return t?.style!==`currency`||t.currency?null:`${e} is a currency format with no valid currency: set ${e}.currency to an ISO 4217 code such as "INR".`}function wq(e){let t=(e,t=Q().errorText)=>(yG(`[@webority/ui-elements] <wui-chart> ${e}`),{spec:null,problem:t});if(!mq(e))return t('has no spec: set the `spec` property or add a <script type="application/json"> child.');let n=e;xq(`spec`,n,QK);let r=hq(n,`type`);if(bq(`type`,r,jK),!yq(jK,r))return t(`cannot draw type "${String(r)}".`);let i=r,a=hq(n,`title`);typeof a==`string`&&a.trim()||uq("needs a `title`: it names the chart for screen readers and names exported files.");for(let[e,t]of Object.entries(qK))hq(n,e)!=null&&!t.includes(i)&&uq(`ignores spec.${e} on a ${i} chart: it applies to ${t.join(`, `)}.`);let o=hq(n,`x`),s=mq(o)?o:{};xq(`spec.x`,s,$K);let c=KK[i]??[`category`],l=hq(s,`kind`);bq(`x.kind`,l,NK),yq(NK,l)&&!c.includes(l)&&uq(`ignores x.kind="${l}" on a ${i} chart: it takes ${dq(c)}.`);let u=hq(s,`labelFit`);bq(`x.labelFit`,u,eq);let d=Sq(`x.format`,hq(s,`format`)),f=hq(s,`key`);typeof f!=`string`&&i!==`gauge`&&uq("needs `x.key`, the column holding each row's x value or slice name.");let p=typeof f==`string`?f:``,m=hq(n,`y`),h=mq(m)?m:{};xq(`spec.y`,h,aq);let g=Sq(`y.format`,hq(h,`format`)),_=Cq(`x.format`,d);if(_)return t(_,Q().currencyFormatText);let v=Cq(`y.format`,g);if(v)return t(v,Q().currencyFormatText);let y=hq(n,`series`),b=Array.isArray(y)?y.filter(mq):[],x=[];for(let[e,n]of b.entries()){xq(`spec.series[${e}]`,n,tq);let r=Sq(`series[${e}].format`,hq(n,`format`)),i=Cq(`series[${e}].format`,r);if(i)return t(i,Q().currencyFormatText);let a=hq(n,`key`);typeof a!=`string`&&uq(`needs series[${e}].key, the column holding that series' values.`);let o=hq(n,`label`),s=hq(n,`colour`);bq(`series[${e}].colour`,s,LK),x.push({key:String(a),named:typeof a==`string`,label:typeof o==`string`&&o?o:String(a),format:r,colour:yq(LK,s)?s:void 0})}let S=x[0];if(!S)return t(`has no series to draw.`);let C=x.filter(e=>e.named).map(e=>e.key),w=C.find((e,t)=>C.indexOf(e)!==t);if(w!==void 0)return t(`has two series with the key "${w}": each series needs its own key.`);if(x.length>8)return t(`refuses ${x.length} series: 8 is the most that stay distinguishable. Fold the smallest into an Other series, or split the chart.`,Q().tooManySeriesText);let T=UK(i);if(T&&x.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.`;uq(`draws one series as a ${i}; it got ${x.length} and shows the first. ${e}`)}let E=(e,t,n,r)=>{if(t==null)return null;if(!mq(t))return uq(`expects ${e} to be an object such as { key: "column" }.`),null;xq(e,t,n);let i=hq(t,`key`);if(typeof i!=`string`)return uq(`needs ${e}.key, the column holding ${r}.`),null;let a=Sq(`${e}.format`,hq(t,`format`)),o=hq(t,`label`);return{key:i,label:typeof o==`string`?o:``,format:a}},D=qK.group.includes(i)?E(`spec.group`,hq(n,`group`),nq,`each row's group`):null,O=i===`sankey`?E(`spec.to`,hq(n,`to`),nq,`where each flow ends`):null,k=i===`bubble`?E(`spec.size`,hq(n,`size`),rq,`each bubble's size`):null,A=Cq(`group.format`,D?.format)??Cq(`to.format`,O?.format)??Cq(`size.format`,k?.format);if(A)return t(A,Q().currencyFormatText);if((i===`heatmap`||i===`treemap`)&&!D)return t(`needs \`group.key\` to draw a ${i}: the column holding each ${i===`heatmap`?`row`:`parent`}.`);if(i===`sankey`&&!O)return t("needs `to.key` to draw a sankey: the column holding where each flow ends.");if(i===`bubble`&&!k)return t("needs `size.key` to draw a bubble chart: the column holding each bubble's size.");let j=WK.includes(i)?MK:[`none`],M=hq(n,`stack`);bq(`stack`,M,j);let ee=hq(n,`state`);bq(`state`,ee,FK);let N=hq(n,`renderer`);bq(`renderer`,N,PK);let P=hq(n,`timeZone`);P!=null&&!BG(P)&&uq(`received timeZone="${String(P)}", which is not a time zone this browser knows. The chart uses Asia/Kolkata instead.`);let F=BG(P)?P:IG,I=hq(n,`financialYearStart`);I!=null&&!pq(I)&&uq(`received financialYearStart="${String(I)}", which is not a month from 1 to 12. The chart uses calendar years instead.`);let te=pq(I)?I:1,L=hq(n,`target`),ne=mq(L)?hq(L,`value`):void 0;L!=null&&(mq(L)&&xq(`spec.target`,L,oq),mq(L)&&fq(ne)||uq("ignores a `target` without a numeric `value`."));let R=hq(n,`trend`);R!=null&&typeof R!=`boolean`&&uq("expects `trend` to be true or false.");let re=hq(n,`zoom`);re!=null&&typeof re!=`boolean`&&uq("expects `zoom` to be true or false.");let z=[],B=hq(n,`bands`);if(i===`gauge`&&B!=null){let e=Array.isArray(B)?B.filter(mq):[];for(let t of e)xq(`spec.bands[]`,t,iq);z=e.map(e=>({upTo:hq(e,`upTo`),label:hq(e,`label`)})).filter(e=>fq(e.upTo)&&typeof e.label==`string`&&e.label!==``).sort((e,t)=>e.upTo-t.upTo),Array.isArray(B)&&z.length===e.length||uq("ignores a gauge band without a numeric `upTo` and a `label`.")}let V=g??S.format,H=(T?x.slice(0,1):x).map(e=>({key:e.key,label:e.label,format:e.format??V,colour:e.colour})),U=yq(c,l)?l:c[0],ie=hq(n,`data`),ae=Array.isArray(ie)?ie:[],W=ae.filter(mq).map(_q),oe=-1,se=null,ce=S.key;i===`donut`&&W.length>6&&(se=W,{data:W,otherIndex:oe}=Dq(W,p,ce),uq(`draws at most 6 donut slices; the smallest ${ae.length-5} are shown as "${Q().otherLabel}". Send fewer rows, or use a bar chart for many parts.`));let le=(e,t)=>{let n=W.filter(e);n.length!==W.length&&uq(`leaves out ${W.length-n.length} row(s) ${t}.`),W=n},ue=e=>e!=null&&e!==``,de=e=>fq(e)&&e>0;if(U===`time`&&GK.includes(i)&&le(e=>Number.isFinite(wK(e[p],F)),`without a readable date`),i===`gauge`&&W.length>1)uq(`draws one value as a gauge; it got ${W.length} rows and shows the first.`),W=W.slice(0,1);else if(i===`scatter`||i===`bubble`){le(e=>fq(e[p])&&fq(e[ce])&&(i!==`bubble`||k!=null&&de(e[k.key])),`without a number for x and y (and a positive size)`);let e=new Set(D?W.map(e=>String(e[D.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.`,Q().tooManyGroupsText)}else if(i===`calendar`)le(e=>Number.isFinite(wK(e[p],F)),`without a readable date`);else if(i===`heatmap`&&D)le(e=>ue(e[p])&&ue(e[D.key]),`without a column or a row`);else if(i===`treemap`&&D){le(e=>ue(e[p])&&ue(e[D.key])&&de(e[ce]),`without a name, a parent and a positive size`);let e=new Set(W.map(e=>String(e[D.key])));if(e.size>8)return t(`refuses ${e.size} parents in a treemap: 8 is the most that keep their own colour. Fold the smallest into one, or split the chart.`,Q().tooManyGroupsText)}else if(i===`sankey`&&O){le(e=>ue(e[p])&&ue(e[O.key])&&de(e[ce]),`without a start, an end and a positive size`);let e=Tq(W,p,O.key);if(e)return t(e.reason,e.text)}else if(i===`waterfall`){let e=Eq(W,ce);if(e?.refuse)return t(e.refuse);e?.warn&&uq(e.warn)}let fe=hq(n,`height`),G=fq(fe)&&fe>0?fe:null;if(i===`multiples`){let e=XK*H.length+ZK;G!=null&&G<e&&(uq(`needs at least ${e}px of height for ${H.length} small charts; it got ${G}px and draws at ${e}px.`),G=e),G??=YK*H.length+40}G??=JK[i]??320;let pe=yq(j,M)?M:`none`,me=qK.valueLabels.includes(i)&&(hq(n,`valueLabels`)??i===`line`)===!0;me&&pe!==`none`&&uq(`ignores valueLabels on a stacked chart.`);let he=me&&pe===`none`,ge=hq(n,`incompleteLast`);ge!=null&&typeof ge!=`boolean`&&uq(`expects incompleteLast to be true or false.`);let _e=qK.incompleteLast.includes(i)&&ge===!0,ve=i===`line`||i===`area`;_e&&ve&&pe!==`none`&&uq(`ignores incompleteLast on a stacked line or area.`);let ye=_e&&!(ve&&pe!==`none`),be=qK.sliceValues.includes(i)&&(hq(n,`sliceValues`)??!0)===!0,xe=hq(n,`description`),Se=hq(s,`label`),Ce=hq(h,`label`),we=hq(h,`min`),K=hq(h,`max`),Te=hq(n,`centerLabel`),Ee=(e,t)=>typeof e==`string`&&e?e:t;return{problem:null,spec:{type:i,title:typeof a==`string`?a.trim():``,description:typeof xe==`string`?xe:``,data:W,allData:se??W,x:{key:p,kind:U,format:d??(U===`time`?{style:`date`}:U===`value`?{style:`number`}:void 0),label:typeof Se==`string`?Se:``,labelFit:yq(eq,u)?u:`auto`},series:H,group:D,to:O,size:k,trend:qK.trend.includes(i)&&R===!0,zoom:qK.zoom.includes(i)?(re??W.length>5e3)===!0:!1,bands:z,stack:pe,y:{label:typeof Ce==`string`?Ce:``,format:V,min:fq(we)?we:void 0,max:fq(K)?K:void 0,wholeNumbers:hq(h,`wholeNumbers`)===!0},target:mq(L)&&fq(ne)?{value:ne,label:String(hq(L,`label`)??``)}:null,centerLabel:i===`donut`&&typeof Te==`string`&&Te.trim()?Te.trim():``,sliceValues:be,valueLabels:he,incompleteLast:ye,height:G,state:yq(FK,ee)?ee:`ready`,emptyText:Ee(hq(n,`emptyText`),Q().emptyText),errorText:Ee(hq(n,`errorText`),Q().errorText),loadingText:Ee(hq(n,`loadingText`),Q().loadingText),renderer:yq(PK,N)?N:`auto`,timeZone:F,financialYearStart:te,otherIndex:oe}}}function Tq(e,t,n){let r=e.map(e=>[String(e[t]),String(e[n])]),i=/* @__PURE__ */ 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:Q().tooManyGroupsText};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:Q().errorText}:null}function Eq(e,t){let n=e.map(e=>fq(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 Dq(e,t,n){let r=new Set(e.map((e,t)=>({i:t,v:fq(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)||!fq(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=Q().otherLabel;for(let e=2;o.has(s);e+=1)s=`${Q().otherLabel} (${e})`;return a.push({[t]:s,[n]:i}),{data:a,otherIndex:a.length-1}}function Oq(e){return vq(e.series[0],`series`)}function kq(e,t){return vq(e.data[t],`row ${t}`)}function $(e,t,n){let r=e.data[n]?.[t];return fq(r)?r:null}function Aq(e){return e.type===`gauge`||e.series.some(t=>e.data.some((n,r)=>$(e,t.key,r)!=null))}function jq(e,t,n){if(n===1)return EK(e,{pattern:`year`,timeZone:t});if(!Number.isFinite(e))return YG();let r=VG(e,t),i=r.month+1>=n?r.year:r.year-1;return AG(OG(`periodPicker`,AK).financialYearText,{startYear:String(i),endYear:String((i+1)%100).padStart(2,`0`)})}function Mq(e,t){let n=e.data[t]?.[e.x.key];return n==null||n===``?YG():e.x.format?.pattern===`year`&&e.x.format.style===`date`?jq(Nq(e,t),e.timeZone,e.financialYearStart):e.x.format?Z(n,{...e.x.format,timeZone:e.timeZone}):String(n)}function Nq(e,t){return wK(e.data[t]?.[e.x.key],e.timeZone)}function Pq(e,t){let n=e.group?e.data[t]?.[e.group.key]:null;return n==null||n===``?YG():String(n)}function Fq(e,t){let n=e.to?e.data[t]?.[e.to.key]:null;return n==null||n===``?YG():String(n)}var Iq=e=>[...new Set(e)];function Lq(e){return e.group?Iq(e.data.map((t,n)=>Pq(e,n))):[]}function Rq(e){return UK(e.type)?e.data.length:e.data.length*e.series.length}function zq(e){return e.renderer===`auto`?Rq(e)>5e3?`canvas`:`svg`:e.renderer}function Bq(e){switch(e.type){case`donut`:return e.data.map((t,n)=>Mq(e,n));case`scatter`:case`bubble`:return Lq(e);case`line`:case`area`:case`column`:case`bar`:return e.series.map(e=>e.key);default:return[]}}function Vq(e){return[`line`,`area`,`column`,`bar`].includes(e.type)?e.series.map(e=>e.label):Bq(e)}function Hq(e,t,n){return e.type===`donut`?n.has(Mq(e,t)):(e.type===`scatter`||e.type===`bubble`)&&e.group?n.has(Pq(e,t)):!1}function Uq(e,t){return e.data.map((n,r)=>{let i=e.series.filter(e=>!t.has(e.key)).reduce((t,n)=>t+Math.abs($(e,n.key,r)??0),0);return Object.fromEntries(e.series.map(t=>{let n=$(e,t.key,r);return[t.key,i&&n!=null?n/i:null]}))})}function Wq(e,t=IG){return`${tK(new Date(e+HG(e,t)).getUTCDay(),`short`)}, ${EK(e,{timeZone:t})}`}var Gq=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(e,t),1/0),Kq=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(e,t),-1/0),qq=(e,t)=>e.data.map((n,r)=>$(e,t,r)).filter(e=>e!=null),Jq=(e,t)=>t?Z((e??0)/t,{style:`percent`}):YG();function Yq(e,t){let n=e.filter(fq);if(!n.length)return[];let r=Gq(n),i=Kq(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 Xq(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 Zq(e,t){return Array.from({length:e},(n,r)=>t[e===1?6:Math.round(6-r*4/(e-1))])}function Qq(e,t){return e.bands.find(e=>t<=e.upTo)??e.bands[e.bands.length-1]??null}var $q=(e,t)=>t==null?YG():vq(Qq(e,t),`gauge band`).label;function eJ(e){return{min:e.y.min??0,max:e.y.max??100}}function tJ(e){let t=Oq(e).key,n=e.data.length-1,r=0;return e.data.map((i,a)=>{let o=$(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 nJ(e,t){let n=Oq(e).key,r=vq(e.to,`to column`).key,i=e.data.map((t,i)=>({from:String(t[e.x.key]),to:String(t[r]),value:$(e,n,i)??0})),a=/* @__PURE__ */ 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=/* @__PURE__ */ 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=vq((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 rJ(e){let t=Oq(e).key,n=new Map(Lq(e).map(e=>[e,0]));return e.data.forEach((r,i)=>{n.set(Pq(e,i),(n.get(Pq(e,i))??0)+($(e,t,i)??0))}),n}function iJ(e,t,n){let{palette:r,neutral:i,seq:a,rise:o,fall:s}=n,c=Oq(e).key;switch(e.type){case`donut`:return cJ(e,t,n);case`funnel`:return Zq(e.data.length,vq(a,`sequential colours`))[t];case`heatmap`:case`calendar`:return Xq(Yq(qq(e,c),vq(a,`sequential colours`)),$(e,c,t));case`gauge`:return r[0];case`waterfall`:{let n=vq(tJ(e)[t],`waterfall bar ${t}`);return n.total?r[0]:n.value>=0?o:s}case`treemap`:return r[[...rJ(e).keys()].indexOf(Pq(e,t))%r.length];case`sankey`:return nJ(e,r).get(String(kq(e,t)[e.x.key]));case`scatter`:case`bubble`:return r[Math.max(0,Lq(e).indexOf(Pq(e,t)))];default:return r[lJ(Oq(e),0)]??i}}function aJ(e,t,n,r){let i=oJ(e,t,n,r);return!e.incompleteLast||t!==e.data.length-1?i:{...i,title:`${i.title}, ${Q().soFarText}`}}function oJ(e,t,n,r){let i=Oq(e),a=$(e,i.key,t),o=()=>iJ(e,t,r);switch(e.type){case`donut`:{let r=e.data.reduce((t,r,a)=>t+(n.has(Mq(e,a))?0:$(e,i.key,a)??0),0);return{title:Mq(e,t),rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:Q().shareLabel,value:r&&a!=null?Z(a/r,{style:`percent`}):YG()}],foot:``}}case`heatmap`:return{title:`${Pq(e,t)}, ${Mq(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`calendar`:return{title:Wq(Nq(e,t),e.timeZone),rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`funnel`:{let n=$(e,i.key,0),r=t?$(e,i.key,t-1):null,s=[{color:o(),label:i.label,value:Z(a,i.format)}];return t&&s.push({label:Q().ofPreviousStepLabel,value:Jq(a,r)}),s.push({label:AG(Q().ofFirstStepText,{first:Mq(e,0)}),value:Jq(a,n)}),{title:Mq(e,t),rows:s,foot:``}}case`gauge`:{let{min:n,max:r}=eJ(e),s=a==null?null:Qq(e,a),c=[{color:o(),label:i.label,value:Z(a,i.format)}];return c.push({label:Q().scaleLabel,value:AG(Q().scaleRangeText,{min:Z(n,i.format),max:Z(r,i.format)})}),s&&c.push({label:Q().bandLabel,value:s.label}),{title:e.data[t]?.[e.x.key]==null?i.label:Mq(e,t),rows:c,foot:``}}case`waterfall`:{let n=tJ(e),r=vq(n[t],`waterfall bar ${t}`),a=vq(n[0],`waterfall opening bar`).value,s=r.total?[{color:o(),label:i.label,value:Z(r.value,i.format)}]:[{color:o(),label:Q().changeLabel,value:sJ(r.value,i.format)},{label:Q().runningTotalLabel,value:Z(r.level,i.format)}],c=!r.total&&a?AG(Q().openingShareText,{share:sJ(r.value/a*100,{style:`number`,decimals:2},`%`)}):``;return{title:Mq(e,t),rows:s,foot:c}}case`treemap`:{let n=Pq(e,t),r=rJ(e).get(n);return{title:`${n} / ${Mq(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:AG(Q().shareOfParentText,{parent:n}),value:Jq(a,r)}],foot:``}}case`sankey`:{let n=String(kq(e,t)[e.x.key]),r=e.data.reduce((t,r,a)=>String(r[e.x.key])===n?t+($(e,i.key,a)??0):t,0);return{title:AG(Q().scaleRangeText,{min:n,max:Fq(e,t)}),rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:AG(Q().shareOfParentText,{parent:n}),value:Jq(a,r)}],foot:``}}case`scatter`:case`bubble`:{let n=[{color:o(),label:e.x.label||String(e.x.key),value:Mq(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(kq(e,t)[e.size.key],e.size.format)}),{title:e.group?Pq(e,t):i.label,rows:n,foot:``}}}let s=e.stack===`percent`?Uq(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=$(e,n.key,t),o=Z(a,n.format);return{color:e.type===`multiples`?r.palette[0]:r.palette[lJ(n,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){let n=c.reduce((n,{s:r})=>n+($(e,r.key,t)??0),0);u=AG(Q().totalText,{total:Z(n,d.s.format)})}if(e.target&&d&&c.length===1){let n=$(e,d.s.key,t);if(n!=null){let t=n-e.target.value,r=e.target.label||Q().targetLabel;u=AG(Q().targetGapText,{direction:t>=0?Q().aboveLabel:Q().belowLabel,label:r,gap:Z(Math.abs(t),d.s.format)})}}return{title:Mq(e,t),rows:l,foot:u}}function sJ(e,t,n=``){let r=`${Z(Math.abs(e),t)}${n}`;return e>0?`+${r}`:e<0?`−${r}`:r}function cJ(e,t,n){return t===e.otherIndex?n.neutral:n.palette[t%n.palette.length]}function lJ(e,t){return e.colour?Number(e.colour.slice(6))-1:t}function uJ(e){let t=xG(`div`,{class:`wui-chart-tooltip-body`});e.title&&t.append(xG(`div`,{class:`wui-chart-tooltip-title`},e.title));for(let n of e.rows){let e=xG(`div`,{class:`wui-chart-tooltip-row`});if(n.color){let t=document.createElement(`span`);t.className=n.line?`wui-chart-tooltip-swatch wui-chart-tooltip-swatch-line`:`wui-chart-tooltip-swatch`,t.style.background=n.color,e.append(t)}let r=document.createElement(`span`);r.className=`wui-chart-tooltip-label`,r.textContent=n.label;let i=document.createElement(`span`);i.className=`wui-chart-tooltip-value`,i.textContent=n.value,e.append(r,i),t.append(e)}return e.foot&&t.append(xG(`div`,{class:`wui-chart-tooltip-foot`},e.foot)),t}function dJ(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 fJ(e){return e.x.label?e.x.label:{gauge:Q().measureLabel,funnel:Q().stageLabel,waterfall:Q().stepLabel,sankey:Q().fromLabel,scatter:Q().columnXLabel,bubble:Q().columnXLabel}[e.type]??(e.x.kind===`time`?Q().dateLabel:Q().categoryLabel)}function pJ(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=Oq(t),r=(e,r=n)=>Z($(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=Iq(a.map(e=>Mq(t,e))),n=Lq(t),o=new Map(a.map(e=>[`${Pq(t,e)}\u0000${Mq(t,e)}`,r(e)]));return i([vq(t.group,`group column`).label||Q().rowLabel,...e],n.map(t=>({head:t,cells:e.map(e=>o.get(`${t}\u0000${e}`)??YG())})))}case`funnel`:{let e=$(t,n.key,0);return i([fJ(t),n.label,Q().ofPreviousStepLabel,AG(Q().ofFirstStepText,{first:Mq(t,0)})],a.map(i=>({head:Mq(t,i),cells:[r(i),i?Jq($(t,n.key,i),$(t,n.key,i-1)):YG(),Jq($(t,n.key,i),e)]})))}case`gauge`:return i([fJ(t),n.label,...t.bands.length?[Q().bandLabel]:[]],a.map(e=>({head:kq(t,e)[t.x.key]==null?n.label:Mq(t,e),cells:[r(e),...t.bands.length?[$q(t,$(t,n.key,e))]:[]]})));case`waterfall`:return i([fJ(t),Q().changeLabel,Q().runningTotalLabel],tJ(t).map(e=>({head:Mq(t,e.index),cells:[e.total?YG():sJ(e.value,n.format),Z(e.level,n.format)]})));case`treemap`:{let e=rJ(t);return i([vq(t.group,`group column`).label||Q().groupLabel,t.x.label||Q().itemLabel,n.label,Q().shareOfGroupLabel],a.map(i=>({head:Pq(t,i),cells:[Mq(t,i),r(i),Jq($(t,n.key,i),e.get(Pq(t,i)))]})))}case`sankey`:return i([fJ(t),vq(t.to,`to column`).label||Q().toLabel,n.label],a.map(e=>({head:Mq(t,e),cells:[Fq(t,e),r(e)]})));case`scatter`:case`bubble`:return i([fJ(t),n.label,...t.size?[t.size.label||t.size.key]:[],...t.group?[t.group.label||Q().groupLabel]:[]],a.map(e=>({head:Mq(t,e),cells:[r(e),...t.size?[Z(kq(t,e)[t.size.key],t.size.format)]:[],...t.group?[Pq(t,e)]:[]]})))}let o=t.type===`donut`,s=o?t.data.reduce((e,r,i)=>e+($(t,n.key,i)??0),0):0,c=[fJ(t),...t.series.map(e=>e.label)];return o&&c.push(Q().shareLabel),i(c,a.slice(0,500).map(e=>{let i=t.series.map(t=>r(e,t));if(o){let r=$(t,n.key,e);i.push(s&&r!=null?Z(r/s,{style:`percent`}):YG())}return{head:Mq(t,e),cells:i}}),t.data.length)}function mJ(e){switch(e?.style){case`currency`:case`compact`:return e.currency?` (${e.currency})`:``;case`percent`:return` (%)`;case`duration`:return` (${e.unit??`s`})`;default:return``}}function hJ(e,t){return e==null?e:t?.unit===`paise`?Number(pK(e)):t?.style===`percent`?Number((e*100).toPrecision(12)):e}function gJ(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];if(t.x.kind!==`time`)return n;let r=t.x.format?.pattern??`day`;return r===`year`?jq(wK(n,t.timeZone),t.timeZone,t.financialYearStart):EK(n,{pattern:r,timeZone:t.timeZone})}},i=t.series.map(e=>({head:`${e.label}${mJ(e.format)}`,value:t=>{let n=t[e.key];return hJ(fq(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,vq(o,`group column`),...i];break;case`treemap`:s=[vq(o,`group column`),r,...i];break;case`sankey`:{let e=vq(t.to,`to column`);s=[r,{head:e.label||e.key,value:t=>t[e.key]},...i];break}case`bubble`:{let e=vq(t.size,`size column`);s=[r,...i,{head:`${e.label||e.key}${mJ(e.format)}`,value:t=>{let n=t[e.key];return hJ(fq(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 _J(e){return(e?.title??``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)||`chart`}var vJ=(e,t,n)=>{if(!t.length)return null;let r=Gq(t),i=Kq(t);return r===i?AG(Q().constantSpanText,{label:e,lo:Z(r,n)}):AG(Q().rangeSpanText,{label:e,lo:Z(r,n),hi:Z(i,n)})};function yJ(e,t=/* @__PURE__ */ new Set){let n=[];e.description&&n.push(e.description.replace(/\.?\s*$/,`.`));let r=Bq(e);if(r.length&&r.every(e=>t.has(e)))return n.push(Q().everySeriesHiddenText),n.join(` `);let i=e.data.length,a=e.data.map((e,t)=>t).filter(n=>!Hq(e,n,t)),o=Oq(e),s=qq(e,o.key),c=s.reduce((e,t)=>e+t,0),l=()=>e.data.reduce((t,n,r)=>($(e,o.key,r)??-1/0)>($(e,o.key,t)??-1/0)?r:t,0),u=()=>e.data.reduce((t,n,r)=>($(e,o.key,r)??1/0)<($(e,o.key,t)??1/0)?r:t,0);switch(e.type){case`donut`:{let t=a.reduce((t,n)=>t+($(e,o.key,n)??0),0);if(n.push(jG(Q(),`donutSummaryText`,a.length,{rows:a.length,label:o.label,total:Z(t,o.format)})),a.length&&t){let r=a.reduce((t,n)=>($(e,o.key,n)??-1/0)>($(e,o.key,t)??-1/0)?n:t,vq(a[0],`first slice`));n.push(AG(Q().donutLargestText,{top:Mq(e,r),share:Z(($(e,o.key,r)??0)/t,{style:`percent`})}))}return n.join(` `)}case`heatmap`:if(n.push(AG(Q().heatmapSummaryText,{label:o.label,group:vq(e.group,`group column`).label||Q().rowFallbackLabel,x:e.x.label||Q().columnFallbackLabel,n:i})),s.length){let t=l(),r=u();n.push(AG(Q().highestAtLowestAtText,{highValue:bJ(e,t),highGroup:Pq(e,t),high:Mq(e,t),lowValue:bJ(e,r),lowGroup:Pq(e,r),low:Mq(e,r)}))}return n.join(` `);case`calendar`:return n.push(i===1?AG(Q().calendarSummaryTextOne,{label:o.label,n:i}):AG(Q().calendarSummaryTextOther,{label:o.label,n:i,range:i>1?AG(Q().calendarRangeText,{first:Mq(e,0),last:Mq(e,i-1)}):``})),s.length&&n.push(AG(Q().highestLowestText,{maxValue:bJ(e,l()),max:Mq(e,l()),minValue:bJ(e,u()),min:Mq(e,u())})),n.join(` `);case`funnel`:return n.push(AG(Q().funnelSummaryText,{label:o.label,n:i})),i>1&&n.push(AG(Q().funnelStartText,{first:Mq(e,0),firstValue:bJ(e,0),last:Mq(e,i-1),lastValue:bJ(e,i-1),share:Jq($(e,o.key,i-1),$(e,o.key,0))})),n.join(` `);case`gauge`:{let t=$(e,o.key,0),{min:r,max:i}=eJ(e),a=t==null?null:Qq(e,t);return n.push(AG(Q().gaugeSummaryText,{type:VK(`gauge`),label:o.label,value:Z(t,o.format),min:Z(r,o.format),max:Z(i,o.format),band:a?AG(Q().gaugeBandText,{band:a.label}):``})),n.join(` `)}case`waterfall`:{let t=tJ(e);if(n.push(AG(Q().waterfallSummaryText,{label:o.label})),i>1){let r=t.filter(e=>!e.total);n.push(AG(Q().opensAtClosesAtText,{opening:Z(vq(t[0],`waterfall opening bar`).value,o.format),closing:Z(vq(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(AG(Q().largestRiseText,{xText:Mq(e,a.index),signed:sJ(a.value,o.format)})),s&&n.push(AG(Q().largestFallText,{xText:Mq(e,s.index),signed:sJ(s.value,o.format)}))}return n.join(` `)}case`treemap`:{let t=rJ(e);if(!t.size)return AG(Q().treemapEmptyText,{label:o.label});let[r,a]=[...t].reduce((e,t)=>t[1]>e[1]?t:e);return n.push(AG(Q().treemapSummaryText,{label:o.label,n:i,totals:t.size,total:Z(c,o.format)})),n.push(AG(Q().treemapLargestGroupText,{name:r,share:Jq(a,c)})),n.join(` `)}case`sankey`:{let t=vq(e.to,`to column`).key,r=Iq(e.data.flatMap(n=>[String(n[e.x.key]),String(n[t])])),a=l();return n.push(AG(Q().sankeySummaryText,{label:o.label,n:i,nodes:r.length})),n.push(AG(Q().largestFlowText,{xText:Mq(e,a),toText:Fq(e,a),fmtAt:bJ(e,a)})),n.join(` `)}case`scatter`:case`bubble`:{let r=Lq(e).filter(e=>!t.has(e));n.push(AG(Q().scatterSummaryText,{type:VK(e.type),label:o.label,xLabel:e.x.label||e.x.key,count:a.length,groups:r.length?jG(Q(),`groupsText`,r.length,{groups:r.join(`, `)}):``}));let i=a.map(t=>kq(e,t)[e.x.key]).filter(fq),s=a.map(t=>$(e,o.key,t)).filter(e=>e!=null);for(let t of[vJ(e.x.label||String(e.x.key),i,e.x.format),vJ(o.label,s,o.format)])t&&n.push(t);return n.join(` `)}}let d=e.stack===`percent`?Q().stackedPercentText:e.stack===`stacked`?Q().stackedText:``,f=e.series.filter(e=>!t.has(e.key));n.push(AG(Q().summaryText,{type:VK(e.type),series:f.map(e=>e.label).join(`, `),stacked:d,sharedAxis:e.type===`multiples`?Q().sharedAxisText:``})),i&&n.push(i===1?AG(Q().pointsSummaryTextOne,{n:i,first:Mq(e,0)}):AG(Q().pointsSummaryTextOther,{n:i,first:Mq(e,0),last:Mq(e,i-1)}));for(let t of f){let r=vJ(t.label,qq(e,t.key),t.format);r&&n.push(r)}return n.join(` `)}var bJ=(e,t)=>{let n=Oq(e);return Z($(e,n.key,t),n.format)};function xJ(e){return e.stack===`percent`?{style:`percent`,decimals:0}:OK(e.y.format)}var SJ=864e5,CJ={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},wJ=e=>CJ[e]??0,TJ=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function EJ(e,t){let n=e.data.map((e,t)=>t).filter(n=>!Hq(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>$(e,e.x.key,t)??0;return n.sort((e,t)=>r(e)-r(t)||e-t)}function DJ(e){let t=Iq(e.data.map((t,n)=>Mq(e,n))),n=Lq(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf(Mq(e,i))},${n.indexOf(Pq(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf(Mq(e,r)),n.indexOf(Pq(e,r))]}}function OJ(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 CJ||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return kJ(e,t,n);let a=TJ.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?EJ(e,r):[];if(a?!s.length:!o.length)return t;let c=t??{index:a?vq(s[0],`first mark`):0,series:a?0:vq(o[0],`first visible series`)};if(t==null&&n in CJ)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:vq(s[0],`first mark`),series:0}:n===`End`?{index:vq(s[s.length-1],`last mark`),series:0}:n in CJ?{index:vq(s[(e+wJ(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 CJ))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+wJ(n)))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?wJ(n):-wJ(n);return{...c,series:vq(o[Math.min(o.length-1,Math.max(0,l+u))],`series`)}}function kJ(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>Nq(e,t)-Nq(e,n)):[],o=i?null:DJ(e),s=t??{index:i?vq(a[0],`first day`):0,series:0};if(t==null&&n in CJ)return s;if(n===`Home`)return{index:i?vq(a[0],`first day`):0,series:0};if(n===`End`)return{index:i?vq(a[r-1],`last day`):r-1,series:0};if(!(n in CJ))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?wJ(n):wJ(n)*7,r=t=>{let n=Nq(e,t);return Math.floor((n+HG(n,e.timeZone))/SJ)},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`?[wJ(n),0]:[0,wJ(n)];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}var AJ=()=>OG(`chart`,kK);Rj([fx,nT,QT,DL,RI,DI,ZF,bL,QM,qR,_B,wV,QB,vz,ez,OH,tH,TB,fU,zH,WW,mG]);function jJ(e){let t=e.series[0];if(!t)throw Error(`chart spec has no series`);return t}var MJ=e=>typeof e==`number`;function NJ(e,t){let n=e.data[t];if(!n)throw Error(`chart row ${t} missing`);return n}function PJ(e){if(!e.to)throw Error("chart spec has no `to` column");return e.to.key}function FJ(e){if(!e.size)throw Error("chart spec has no `size` column");return e.size.key}function IJ(e,t,n){let r=e[t];if(!r)throw Error(`percent shares for row ${t} missing`);return r[n]??null}function LJ(e,t,n){let r=e?.[t];if(!r)throw Error(`bar radii for row ${t} missing`);return r[n]}var RJ=e=>MJ(e)?e:null;function zJ(e){return typeof e==`object`&&e&&`row`in e?RJ(e.row):null}function BJ(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 MJ(n)&&Number.isFinite(n)&&MJ(r)&&Number.isFinite(r)?{start:n,end:r}:null}function VJ(e){if(!e)throw Error(`chart has not been drawn`);return e}var HJ=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],UJ=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function WJ(e){return e.wholeNumbers===!0||e.format?.style===`currency`&&e.format.unit===`paise`}function GJ(e,t,n,r,i=!1){let a=OK(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 KJ=(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)]},qJ=24,JJ=4,YJ=.6,XJ=(e,t)=>String(e).length*t*YJ,ZJ=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`chart palette has no colour at slot ${t}`);return n};function QJ(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 $J(e,t){let n=QJ(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function eY(e,t,n){let r=QJ(e),i=QJ(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+((i[t]??0)-e)*n)).join(`,`)})`:e}var tY=[.2126,.7152,.0722],nY=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*(tY[n]??0),0),rY=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function iY(e,t){let n=QJ(e),r=QJ(t.text),i=QJ(t.surface);return!n||!r||!i||rY(nY(n),nY(r))>=rY(nY(n),nY(i))?t.text:t.surface}var aY=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:$J(e,t)},{offset:1,color:$J(e,0)}]}),oY=(e,t)=>e+HG(e,t);function sY(e){let t=e.x.format?.pattern;return n=>{let r=UG(n,e.timeZone);if(t===`month`)return EK(r,{pattern:t,timeZone:e.timeZone});if(t===`year`)return jq(r,e.timeZone,e.financialYearStart);let i=VG(r,e.timeZone);return i.hour||i.minute?EK(r,{pattern:`time`,timeZone:e.timeZone}):DK(r,{timeZone:e.timeZone})}}function cY(e,t,n){let r=JJ,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(($(e,t.key,r)??0)<0);return a}let o=null,s=null;for(let n of e.series){let i=$(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 lY(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&Rq(e)<=5e3,o=Bq(e),s=Object.fromEntries(o.map(e=>[e,!r.hidden.has(e)])),c={palette:t.palette,neutral:t.neutral,rise:t.rise,fall:t.fall,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=nX[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`?Uq(e,r.hidden):null,g=p||e.type===`column`?cY(e,r.hidden,p):null,_=e.series.length===1,v=r.renderer===`canvas`,[y,b]=KJ(e.series.flatMap(t=>e.data.map((n,r)=>$(e,t.key,r))),!0),x=e.stack===`percent`?xJ(e):GJ(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)=>Mq(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=>XJ(Z(e,x),12)))-20},D=!1;if(e.valueLabels){let t=e.data.length>PY?E():NY(T.length,E()),r=p?n.width-CY(T.map(e=>XJ(e,12)))-20:e.type===`line`?t:NY(T.length,E())/Math.max(1,w.length);D=w.flatMap(t=>e.type===`line`?[...FY(e,t.key)].map(n=>$(e,t.key,n)):e.data.map((n,r)=>$(e,t.key,r))).filter(e=>e!=null).every(e=>XJ(Z(e,x),12)<=r)}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}:LY(e.x.labelFit,T,E()),...m?{formatter:sY(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:WJ(e.y)?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&&!e.valueLabels,M=e.series.map((n,r)=>{let o=ZJ(t.palette,lJ(n,r)%t.palette.length),s=e.data.some((t,r)=>$(e,n.key,r)!=null&&$(e,n.key,r-1)==null&&$(e,n.key,r+1)==null),c=t=>{let r=$(e,n.key,t),i=h?IJ(h,t,n.key):r;return m?[oY(Nq(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 i=e.type===`area`?_||e.stack!==`none`?t.dark?.34:.22:.1:0,u=e.valueLabels?FY(e,n.key):null;return{...l,type:`line`,data:e.data.map((e,t)=>c(t)),smooth:.35,smoothMonotone:`x`,connectNulls:!1,symbol:`circle`,showSymbol:s||e.valueLabels,label:e.valueLabels?{show:D,position:`top`,distance:6,fontFamily:t.font,fontSize:12,fontWeight:600,color:t.text,formatter:e=>e.value==null||!u?.has(e.dataIndex)?``:Z(Array.isArray(e.value)?e.value[1]:e.value,x)}:void 0,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:$J(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:i?{color:aY(o,i)}: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?uY(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:qJ,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((t,r)=>({value:c(r),itemStyle:{borderRadius:LJ(g,r,n.key),...e.incompleteLast&&r===e.data.length-1?{opacity:.45,borderType:`dashed`,borderWidth:1.5,borderColor:o}:{}}})),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?uY(e,t,p,a):void 0}}),ee=e.data.length-1;if(e.incompleteLast&&e.stack===`none`&&ee>=1&&(e.type===`line`||e.type===`area`))for(let n of e.series){let r=t=>m?[oY(Nq(e,t),e.timeZone),$(e,n.key,t)]:$(e,n.key,t);M.push({id:`${n.key}:so-far`,name:`${n.key}:so-far`,type:`line`,silent:!0,tooltip:{show:!1},symbol:`none`,smooth:.35,smoothMonotone:`x`,connectNulls:!1,data:e.data.map((e,t)=>t>=ee-1?r(t):null),lineStyle:{width:2.5,color:t.surface,type:`dashed`}})}return{...u,useUTC:m,grid:{left:4,right:j?64:i?8:16,top:e.y.label?28:D&&(e.type===`column`||e.type===`line`)?24:12,bottom:A?44:4,outerBoundsMode:`same`},dataZoom:A?$Y(e,t,ZJ(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:$J(t.neutral,t.dark?.12:.1)}},formatter:t=>uJ(aJ(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?k:O,yAxis:p?O:k,series:M}}function uY(e,t,n,r){if(!e.target)return;let i=jJ(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 dY(e,t,n,r,i){let{base:a,tooltipBase:o,colours:s,compact:c}=i,l=jJ(e),u=e.data.map((t,n)=>Mq(e,n)),d=e.data.reduce((t,n,i)=>t+(r.hidden.has(Mq(e,i))?0:$(e,l.key,i)??0),0);return{...a,tooltip:{...o,trigger:`item`,formatter:t=>uJ(aJ(e,t.dataIndex,r.hidden,s))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(d,OK(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||AJ().centerLabel,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:e.sliceValues?{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:12,lineHeight:16,formatter:e=>`${e.name}\n${Z(Number(e.value),l.format)} (${Z(e.percent/100,{style:`percent`,decimals:0})})`}: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:!e.sliceValues},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:$(e,l.key,n)??0,itemStyle:{color:cJ(e,n,s)}}))}]}}var fY=e=>[...new Set(e)],pY=(e,t)=>e.data.map((n,r)=>$(e,t,r));function mY(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var hY=(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}),gY=(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 _Y(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:[AJ().moreLabel,AJ().lessLabel],textGap:8,selectedMode:!1,textStyle:{color:e.label,fontSize:12,fontFamily:e.font},...n}}function vY(e,t,n,r,i){let a=jJ(e),o=fY(e.data.map((t,n)=>Mq(e,n))),s=Lq(e),c=Yq(pY(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:mY(i.tooltipBase,t=>uJ(aJ(e,t.dataIndex,r.hidden,i.colours))),xAxis:hY(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:hY(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:_Y(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf(Mq(e,n)),s.indexOf(Pq(e,n)),$(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 yY=6048e5,bY=(e,t)=>{let n=VG(e,t);return`${n.year}-${String(n.month+1).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`};function xY(e,t){let n=e.data.map((t,n)=>Nq(e,n)).filter(Number.isFinite),r=SY(n),i=CY(n),a=Math.ceil((i-r)/yY)+1,o=Math.floor((t.height-62)/7),s=Math.max(wY,Math.min(TY,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)*yY:r,to:i}}var SY=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(t,e),1/0),CY=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(t,e),-1/0),wY=9,TY=24;function EY(e,t,n,r,i){let a=jJ(e),{cell:o,from:s,to:c}=xY(e,n),l=Yq(pY(e,a.key),t.seq);return{...i.base,tooltip:mY(i.tooltipBase,t=>uJ(aJ(e,t.dataIndex,r.hidden,i.colours))),visualMap:_Y(t,l,{right:4}),calendar:{range:[bY(s,e.timeZone),bY(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:[``,tK(1,`short`),``,tK(3,`short`),``,tK(5,`short`),``],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)=>[bY(Nq(e,n),e.timeZone),$(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function DY(e,t,n,r,i){let a=jJ(e),o=Zq(e.data.length,t.seq),s=$(e,a.key,0);return{...i.base,tooltip:mY(i.tooltipBase,t=>uJ(aJ(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=iY(o[r],t),c=$(e,a.key,r),l=r?AG(AJ().funnelPreviousStepText,{share:Jq(c,$(e,a.key,r-1))}):AG(AJ().shareOfStepText,{share:Jq(c,s),first:UJ(Mq(e,0))});return{name:Mq(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${UJ(Mq(e,r))}} {v|${UJ(Z(c,a.format))}}\n{p|${r?l:AJ().firstStageLabel}}`,rich:{n:{color:i,fontSize:12.5,fontWeight:500,fontFamily:t.font},v:{color:i,fontSize:13,fontWeight:700,fontFamily:t.font},p:{color:$J(i,.78),fontSize:12,fontFamily:t.font}}}}})}]}}function OY(e,t,n,r,i){let a=jJ(e),{min:o,max:s}=eJ(e),c=$(e,a.key,0),l=c??o,u=c==null?null:Qq(e,c),d=ZJ(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:mY(i.tooltipBase,()=>uJ(aJ(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:$J(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|${UJ(c==null?Z(null):Z(e,a.format))}}{u|/${UJ(Z(s,a.format))}}${u?`\n{s|${UJ(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:Mq(e,0)}]}]}}function kY(e){let t=CY(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=SY(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=CY(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,jY=72,MY=12,NY=(e,t)=>Math.floor(t/Math.max(1,e)-AY),PY=12;function FY(e,t){let n=e.data.map((e,t)=>t).filter(n=>$(e,t,n)!=null);if(e.data.length<=PY||!n.length)return new Set(n);let r=n=>$(e,t,n)??0,i=n.reduce((e,t)=>r(t)>r(e)?t:e),a=n.reduce((e,t)=>r(t)<r(e)?t:e);return new Set([n[0],n[n.length-1],i,a].filter(MJ))}function IY(e,t){return CY(e.flatMap(e=>String(e).split(/\s+/)).map(e=>XJ(e,MY)))<=t?{interval:0,width:t,overflow:`break`}:{interval:0,rotate:45,width:jY,overflow:`truncate`}}function LY(e,t,n){let r=NY(t.length,n);return e===`all`?{...IY(t,r),hideOverlap:!1}:e===`rotate`?{interval:0,rotate:45,width:jY,overflow:`truncate`,hideOverlap:!1}:e===`ellipsis`?{interval:0,rotate:0,width:Math.max(1,r),overflow:`truncate`,hideOverlap:!1}:{hideOverlap:!0}}function RY(e,t,n){let r=NY(e.length,n),i=IY(e,r);return{nameSize:MY,valueSize:12,category:`rotate`in i?{...i,hideOverlap:!0}:i,showValues:t.every(e=>XJ(e,12)<=r)}}function zY(e,t,n,r,i){let a=jJ(e),o=tJ(e),s=xJ(e),c=kY(o),l=t=>iJ(e,t.index,i.colours),u=o.map(t=>Mq(e,t.index)),d=o.map(e=>e.total?Z(e.value,s):sJ(e.value,s)),f=o.flatMap(e=>[e.from,e.to]),p=Math.max(XJ(Z(CY(f),s),11),XJ(Z(SY(f),s),11))+8,m=RY(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:$J(t.neutral,.1)}},formatter:t=>uJ(aJ(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:hY(t,u,{axisLabel:{color:t.label,fontSize:m.nameSize,margin:12,...m.category}}),yAxis:gY(t,e=>Z(e,s),{min:0,minInterval:WJ(e.y)?1:void 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 BY(e){let t=jJ(e).key;return Lq(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>Pq(e,t)===n).sort((n,r)=>($(e,t,r)??0)-($(e,t,n)??0)||n-r)}))}function VY(e,t,n,r,i){let a=jJ(e),o=rJ(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(XJ(t[0],12),XJ(t[1],11.5))+20<=Math.sqrt(r)},l=BY(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=ZJ(t.palette,i%t.palette.length),u=iY(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${UJ(n)}} {v|${UJ(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:$J(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=eY(l,t.surface,Math.min(.55,r*.14)),o=iY(i,t),s=$(e,a.key,n);return{name:Mq(e,n),value:s,row:n,itemStyle:{color:i},label:{show:c(s,[Mq(e,n),Z(s,a.format)]),formatter:`{n|${UJ(Mq(e,n))}}\n{v|${UJ(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:$J(o,.82),fontSize:12,fontFamily:t.font}}}}})}});return{...i.base,tooltip:mY(i.tooltipBase,t=>t.data?.row==null?uJ({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:AJ().shareOfAllLabel,value:Jq(RJ(t.value),s)}],foot:``}):uJ(aJ(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=PJ(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 UY(e,t,n,r,i){let a=jJ(e),o=PJ(e),s=nJ(e,t.palette),c=HY(e),l=CY([...c.values()]),u=/* @__PURE__ */ new Map,d=/* @__PURE__ */ new Map;e.data.forEach((t,n)=>{let r=$(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|${UJ(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:mY(i.tooltipBase,t=>uJ(t.dataType===`edge`?aJ(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 WY(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=SY(e.map(e=>e[1])),s=CY(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(SY(e.map(e=>e[0]))),c(CY(e.map(e=>e[0])))]}var GY=44,KY=28,qY=8;function JY(e,t,n,r,i){let a=jJ(e),o=Lq(e),s=e.type===`bubble`,c=CY(s?e.data.map(t=>t[FJ(e)]).filter(MJ):[]),l=e=>Math.max(qY,(i.compact?KY:GY)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||Pq(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?WY(d.flatMap(t=>{let n=NJ(e,t)[e.x.key],r=$(e,a.key,t);return MJ(n)&&r!=null?[[n,r]]:[]})):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>$(e,a.key,n)),[h,g]=KJ(p,!1),[_,v]=KJ(m,!1),y=GJ(e.y.format,e.y.min??_,e.y.max??v,4),b=GJ(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:$J(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:[NJ(e,t)[e.x.key],$(e,a.key,t),...s?[NJ(e,t)[FJ(e)]]:[]],row:t}))}));return f&&x.push({name:AJ().trendLabel,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:AJ().trendLabel,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:mY(i.tooltipBase,t=>t.data?.row==null?``:uJ(aJ(e,t.data.row,r.hidden,i.colours))),xAxis:gY(t,e=>Z(e,b),{scale:!0,minInterval:WJ(e.x)?1:void 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:gY(t,e=>Z(e,y),{min:e.y.min,max:e.y.max,minInterval:WJ(e.y)?1:void 0,...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 YY=32,XY=8,ZY=26;function QY(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-ZY)/o,c=s-YY-XY,l=ZJ(t.palette,0),u=e.data.map((t,n)=>Mq(e,n)),d=e.series.flatMap((n,r)=>{let i=pY(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:AG(AJ().latestText,{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=$(e,t.key,n);return a?[oY(Nq(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+YY,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=>uJ(aJ(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:hY(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:sY(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=KJ(pY(e,n.key),!1),o=GJ(n.format,e.y.min??i,e.y.max??a,2);return gY(t,e=>Z(e,o),{gridIndex:r,splitNumber:2,scale:e.y.min==null,min:e.y.min,max:e.y.max,minInterval:WJ(n)?1:void 0,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:aY(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function $Y(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:$J(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:$J(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:$J(n,.18)}},textStyle:{color:t.label,fontSize:12,fontFamily:t.font}}]}function eX(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=Pq(e,n),r=e.data.map((e,t)=>t).filter(n=>Pq(e,n)===t);return{seriesIndex:Lq(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 BY(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 tX(e,t){switch(e.type){case`scatter`:case`bubble`:case`treemap`:{let e=zJ(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 nX={donut:dY,heatmap:vY,calendar:EY,funnel:DY,gauge:OY,waterfall:zY,treemap:VY,sankey:UY,scatter:JY,bubble:JY,multiples:QY};function rX(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=vj(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(lY(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function iX(e,{renderer:t}){let n=vj(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?BJ(n.getOption()):null,l=lY(e,t,a,{...o,zoom:c});i=e,n.setOption(l,s||!r?{notMerge:!0}:{replaceMerge:HJ}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=eX(VJ(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()},flush(){n.getZr().flush()},onSelect(e){n.on(`click`,t=>{if(t.componentType!==`series`)return;let n=tX(VJ(i),t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var aX=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(aX);var oX=HTMLElement,sX=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0;function cX(e){return e.isComposing||e.keyCode===229}function lX(e){return e.key===`Enter`&&!cX(e)}function uX(e){return getComputedStyle(e).direction===`rtl`}function dX(e,t){return t?e===`ArrowRight`?`ArrowLeft`:e===`ArrowLeft`?`ArrowRight`:e:e}function fX(e){"@babel/helpers - typeof";return fX=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fX(e)}function pX(e,t){if(fX(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(fX(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function mX(e){var t=pX(e,`string`);return fX(t)==`symbol`?t:t+``}function hX(e,t,n){return(t=mX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var gX=()=>OG(`chart`,kK),_X=`wui-chart:select`,vX=`wui-chart:legend-change`,yX=`wui-chart:ready`,bX=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],xX=`(prefers-color-scheme: dark)`,SX=`(prefers-reduced-motion: reduce)`,CX=`(forced-colors: active)`,wX=`(prefers-contrast: more)`,TX=`print`,EX=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,DX=!1,OX=/* @__PURE__ */ new Map;function kX(e,t){let n=[...new Set(t)].filter(e=>e&&!OX.has(e));if(!n.length)return;let r=document.createElement(`span`);r.hidden=!0;let i=n.map(e=>{let t=document.createElement(`span`);return t.style.setProperty(`forced-color-adjust`,`none`),t.style.color=e,r.append(t),[e,t]});e.append(r);for(let[e,t]of i)OX.set(e,getComputedStyle(t).color);r.remove()}var AX=[...[1,2,3,4,5,6,7,8].map(e=>`--color-chart-${e}`),...[0,1,2,3,4,5,6].map(e=>`--color-chart-seq-${e}`),`--color-chart-neutral`,`--wui-chart-rise`,`--wui-chart-fall`,`--color-chart-grid`,`--color-chart-axis`,`--color-chart-label`,`--color-surface`,`--color-text`,`--color-text-body`,`--color-text-muted`];function jX(e){let t=getComputedStyle(e),n=!!EX(CX)?.matches,r=e=>t.getPropertyValue(e).trim();n&&kX(e,AX.map(r));let i=e=>n?OX.get(r(e))??r(e):r(e),a=e.closest(`[data-bs-theme], [data-theme]`)??document.documentElement,o=a.getAttribute(`data-bs-theme`)||a.getAttribute(`data-theme`),s={palette:[1,2,3,4,5,6,7,8].map(e=>i(`--color-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>i(`--color-chart-seq-${e}`)),neutral:i(`--color-chart-neutral`),rise:i(`--wui-chart-rise`),fall:i(`--wui-chart-fall`),grid:i(`--color-chart-grid`),axis:i(`--color-chart-axis`),label:i(`--color-chart-label`),surface:i(`--color-surface`),text:i(`--color-text`),textBody:i(`--color-text-body`),textMuted:i(`--color-text-muted`),shadow:r(`--wui-shadow-popover`),font:t.fontFamily,dark:o===`dark`||o===`auto`&&!!EX(xX)?.matches,reducedMotion:!!EX(SX)?.matches};return!s.palette[0]&&!DX&&(DX=!0,vG(`[@webority/ui-elements] <wui-chart> found no --color-chart-* colours: load @webority/theme on the page.`)),s}var MX=/* @__PURE__ */ new Set,NX=null;function PX(e){if(MX.add(e),NX)return;let t=()=>{OX.clear();for(let e of MX)e._themeChanged()},n=()=>{OX.clear();for(let e of MX)e._themeChanged(!0)},r=new MutationObserver(t);r.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-bs-theme`,`class`]});let i=new MutationObserver(t);i.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:[`data-theme`,`data-bs-theme`]});let a=[[xX,t],[SX,t],[CX,t],[wX,t],[TX,n]],o=[];for(let[e,t]of a){let n=EX(e);n&&o.push([n,t])}for(let[e,t]of o)e.addEventListener?.(`change`,t);window.addEventListener(`beforeprint`,n),window.addEventListener(`afterprint`,t),NX=()=>{r.disconnect(),i.disconnect();for(let[e,t]of o)e.removeEventListener?.(`change`,t);window.removeEventListener(`beforeprint`,n),window.removeEventListener(`afterprint`,t),NX=null}}function FX(e){MX.delete(e),MX.size||NX?.()}function IX(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var LX=0,RX=class extends oX{static get observedAttributes(){return[`view`]}constructor(){super(),hX(this,`uid`,void 0),hX(this,`_spec`,void 0),hX(this,`_normal`,void 0),hX(this,`_hidden`,void 0),hX(this,`_focus`,void 0),hX(this,`_awaitingSpec`,!1),hX(this,`_parts`,null),hX(this,`_theme`,null),hX(this,`_width`,null),hX(this,`_visible`,!1),hX(this,`_resizeObserver`,null),hX(this,`_intersection`,null),hX(this,`_engine`,null),hX(this,`_drawn`,!1),hX(this,`_drawnType`,null),hX(this,`_announcedReady`,!1),hX(this,`_legendSignature`,null),hX(this,`_tableSpec`,null),LX+=1,this.uid=`wui-chart-${LX}`,this._spec=null,this._normal=null,this._hidden=/* @__PURE__ */ 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(sX(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(),PX(this),this._theme=jX(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(){FX(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&&(bq(`view`,n,IK),this._update())}toCsv(){let{spec:e}=this._normalized();return e?gJ(e):``}toPng(){let{spec:e}=this._normalized();return e?rX(e,this._theme??jX(this),this._size(e),{hidden:this._hidden,renderer:zq(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));IX(t,e??`${_J(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&IX(t,e??`${_J(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 yG(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e instanceof Error?e.message:void 0),null}}_normalized(){return this._normal??=wq(this._spec),this._normal}_build(){let e=xG(`div`,{class:`wui-chart-legend`});e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,gX().legendLabel),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=xG(`div`,{class:`wui-chart-surface`});t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,gX().chartLabel),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=xG(`div`,{class:`wui-chart-canvas`});n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=xG(`div`,{class:`wui-chart-state`});r.setAttribute(`role`,`status`),r.hidden=!0;let i=xG(`div`,{class:`wui-chart-table-wrap visually-hidden`}),a=xG(`p`,{class:`visually-hidden`});a.id=`${this.uid}-summary`;let o=xG(`div`,{class:`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||!Aq(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||gX().untitledLabel),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,AG(gX().arrowKeysText,{title:e?.title||gX().untitledLabel})),n.summary.textContent=e?yJ(e,this._hidden):``,e){if(!s){let t=new Set(Bq(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??gX().loadingText: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||gX().untitledLabel} ${gX().dataSuffixLabel}`)):(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(xG(`div`,{class:`skeleton wui-chart-skeleton`}),xG(`span`,{class:`visually-hidden`},t)):i.replaceChildren(xG(`p`,{class:`wui-chart-state-text`},t))):i.replaceChildren()}_colour(e,t){let n=this._theme;if(!n)return;if(e.type===`donut`)return iJ(e,t,n);let r=e.series[t],i=e.type===`line`||e.type===`area`||e.type===`column`||e.type===`bar`;return n.palette[r&&i?lJ(r,t):t]}_renderLegend(e,t){let n=this._parts?.legend;if(!n)return;let r=e?Bq(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!e||!i)return;let a=Vq(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=xG(`button`,{class:`wui-chart-legend-item`});r.type=`button`,r.dataset.key=t;let i=xG(`span`,{class: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,xG(`span`,{class:`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=pJ(e),n=xG(`table`,{class:`wui-chart-table`});n.append(xG(`caption`,{class:`visually-hidden`},t.caption));let r=xG(`tr`);t.head.forEach((e,t)=>{let n=xG(`th`,t?{class:`wui-chart-num`}:null,e);n.scope=`col`,r.append(n)});let i=xG(`thead`);i.append(r),n.append(i);let a=xG(`tbody`);for(let e of t.rows){let t=xG(`tr`),n=xG(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>xG(`td`,{class:`wui-chart-num`},e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(xG(`p`,{class:`wui-chart-table-note`},AG(gX().showingFirstRowsDownloadText,{rows:t.rows.length,total:t.total}))),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized();if(!e||!this._parts||!this._theme)return;let t=zq(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=iX(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(yX,{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(e=!1){if(!this._parts)return;let t=jX(this);JSON.stringify(t)!==JSON.stringify(this._theme)&&(this._theme=t,this._update(),e&&this._engine?.flush())}_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(Bq(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(vX,{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(lX(e)){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!bX.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=OJ(t,this._focus,dX(e.key,uX(this)),this._hidden);n?(this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(dJ(aJ(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[UK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(_X,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:$(n,r.key,t),row:i,index:t}}))}};n(`wui-chart`,RX);export{FK as CHART_STATES,jK as CHART_TYPES,IK as CHART_VIEWS,RK as MAX_SERIES,zK as MAX_SLICES,PK as RENDERERS,MK as STACK_MODES,RX as WuiChart,NK as X_KINDS,Z as formatValue,wq as normalizeSpec};
20
+ `:``,i=` {`+r,a=r+`}`,o=I(R(e),function(t){return t+i+I(R(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=I(R(t),function(e){return`@keyframes `+e+i+I(R(t[e]),function(n){return n+i+I(R(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 LU(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function RU(e,t,n,r){return MU(`svg`,`root`,{width:e,height:t,xmlns:EU,"xmlns:xlink":DU,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var zU=0;function BU(){return zU++}var VU={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`},HU=`transform-origin`;function UU(e,t,n){var r=k({},e.shape);k(r,t),e.buildPath(n,r);var i=new vU;return i.reset(hi(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function WU(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[HU]=n+`px `+r+`px`)}var GU={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function KU(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function qU(e,t,n){var r=e.shape.paths,i={},a,o;if(F(r,function(e){var t=LU(n.zrId);t.animation=!0,YU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=R(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=KU(i,n);return a.replace(o,s)}}function JU(e){return U(e)?VU[e]?`cubic-bezier(`+VU[e]+`)`:wr(e)?e:``:``}function YU(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof Td){var s=qU(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=JU(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=JU(d.easing),m=d.rawValue;(U(m)||ae(m))&&(t[f]=t[f]||{},t[f][c]=d.rawValue,p&&(t[f][u]=p))}}}}for(var f=0;f<o;f++){var p=a[f],m=p.targetName;m?m===`shape`&&d(p,c):!r&&d(p,s)}for(var h in s){var g={};Xn(g,e),k(g,s[h]);var _=gi(g),v=s[h][u];l[h]=_?{transform:_}:{},WU(l[h],g),v&&(l[h][u]=v)}var y,b=!0;for(var h in c){l[h]=l[h]||{};var x=!y,v=c[h][u];x&&(y=new Qa);var S=y.len();y.reset(),l[h].d=UU(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 GU[e]})}for(var w=R(l),T=!0,E,f=1;f<w.length;f++){var D=w[f-1],O=w[f];if(l[D][HU]!==l[O][HU]){T=!1;break}E=l[D][HU]}if(T&&E){for(var h in l)l[h][HU]&&delete l[h][HU];t[HU]=E}if(L(w,function(e){return R(l[e]).length>0}).length)return KU(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-`+BU();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function XU(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};ZU(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=Xr(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),ZU(r,t,n,!0)}}}function ZU(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+BU(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var QU=Math.round;function $U(e){return e&&U(e.src)}function eW(e){return e&&H(e.toDataURL)}function tW(e,t,n,r){TU(function(i,a){var o=i===`fill`||i===`stroke`;o&&pi(a)?gW(t,e,i,r):o&&ui(a)?_W(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),hW(n,e,r)}function nW(e,t){var n=vD(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[AU+`silent`]=`true`))}function rW(e){return ei(e[0]-1)&&ei(e[1])&&ei(e[2])&&ei(e[3]-1)}function iW(e){return ei(e[4])&&ei(e[5])}function aW(e,t,n){if(t&&!(iW(t)&&rW(t))){var r=n?10:1e4;e.transform=rW(t)?`translate(`+QU(t[4]*r)/r+` `+QU(t[5]*r)/r+`)`:ri(t)}}function oW(e,t,n){for(var r=e.points,i=[],a=0;a<r.length;a++)i.push(QU(r[a][0]*n)/n),i.push(QU(r[a][1]*n)/n);t.points=i.join(` `)}function sW(e){return!e.smooth}function cW(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]]=QU(o*r)/r)}}}var lW={circle:[cW([`cx`,`cy`,`r`])],polyline:[oW,sW],polygon:[oW,sW]};function uW(e){for(var t=e.animators,n=0;n<t.length;n++)if(t[n].targetName===`shape`)return!0;return!1}function dW(e,t){var n=e.style,r=e.shape,i=lW[e.type],a={},o=t.animation,s=`path`,c=e.style.strokePercent,l=t.compress&&hi(e)||4;if(i&&!t.willUpdate&&(!i[1]||i[1](r))&&!(o&&uW(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 vU,h.reset(l),f.rebuildPath(h,c),h.generateStr(),m.__svgPathVersion=p,m.__svgPathStrokePercent=c),a.d=h.getStr()}return aW(a,e.transform),tW(a,n,e,t),nW(a,e),t.animation&&YU(e,a,t),t.emphasis&&XU(e,a,t),MU(s,e.id+``,a)}function fW(e,t){var n=e.style,r=n.image;if(r&&!U(r)&&($U(r)?r=r.src:eW(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),aW(c,e.transform),tW(c,n,e,t),nW(c,e),t.animation&&YU(e,c,t),MU(`image`,e.id+``,c)}}function pW(e,t){var n=e.style,r=n.text;if(r!=null&&(r+=``),!(!r||isNaN(n.x)||isNaN(n.y))){var i=n.font||`12px sans-serif`,a=n.x||0,o=ai(n.y||0,mn(i),n.textBaseline),s={"dominant-baseline":`central`,"text-anchor":ii[n.textAlign]||n.textAlign};if(Yo(n)){var c=``,l=n.fontStyle,u=qo(n.fontSize);if(!parseFloat(u))return;var d=n.fontFamily||`sans-serif`,f=n.fontWeight;c+=`font-size:`+u+`;font-family:`+d+`;`,l&&l!==`normal`&&(c+=`font-style:`+l+`;`),f&&f!==`normal`&&(c+=`font-weight:`+f+`;`),s.style=c}else s.style=`font: `+i;return r.match(/\s/)&&(s[`xml:space`]=`preserve`),a&&(s.x=a),o&&(s.y=o),aW(s,e.transform),tW(s,n,e,t),nW(s,e),t.animation&&YU(e,s,t),MU(`text`,e.id+``,s,void 0,r)}}function mW(e,t){if(e instanceof wo)return dW(e,t);if(e instanceof Ao)return fW(e,t);if(e instanceof Eo)return pW(e,t)}function hW(e,t,n){var r=e.style;if(oi(r)){var i=si(e),a=n.shadowCache,o=a[i];if(!o){var s=e.getGlobalScale(),c=s[0],l=s[1];if(!c||!l)return;var u=r.shadowOffsetX||0,d=r.shadowOffsetY||0,f=r.shadowBlur,p=Qr(r.shadowColor),m=p.opacity,h=p.color,g=f/2/c,_=f/2/l,v=g+` `+_;o=n.zrId+`-s`+n.shadowIdx++,n.defs[o]=MU(`filter`,o,{id:o,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`},[MU(`feDropShadow`,``,{dx:u/c,dy:d/l,stdDeviation:v,"flood-color":h,"flood-opacity":m})]),a[i]=o}t.filter=mi(o)}}function gW(e,t,n,r){var i=e[n],a,o={gradientUnits:i.global?`userSpaceOnUse`:`objectBoundingBox`};if(di(i))a=`linearGradient`,o.x1=i.x,o.y1=i.y,o.x2=i.x2,o.y2=i.y2;else if(fi(i))a=`radialGradient`,o.cx=G(i.x,.5),o.cy=G(i.y,.5),o.r=G(i.r,.5);else return;for(var s=i.colorStops,c=[],l=0,u=s.length;l<u;++l){var d=ni(s[l].offset)*100+`%`,f=s[l].color,p=Qr(f),m=p.color,h=p.opacity,g={offset:d};g[`stop-color`]=m,h<1&&(g[`stop-opacity`]=h),c.push(MU(`stop`,l+``,g))}var _=FU(MU(a,``,o,c)),v=r.gradientCache,y=v[_];y||(y=r.zrId+`-g`+r.gradientIdx++,v[_]=y,o.id=y,r.defs[y]=MU(a,y,o,c)),t[n]=mi(y)}function _W(e,t,n,r){var i=e.style[n],a=e.getBoundingRect(),o={},s=i.repeat,c=s===`no-repeat`,l=s===`repeat-x`,u=s===`repeat-y`,d;if(ci(i)){var f=i.imageWidth,p=i.imageHeight,m=void 0,h=i.image;if(U(h)?m=h:$U(h)?m=h.src:eW(h)&&(m=h.toDataURL()),typeof Image>`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;ge(f,g),ge(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=nt(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=MU(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=D(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=gi(i);x&&(o.patternTransform=x);var S=MU(`pattern`,``,o,[d]),C=FU(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=MU(`pattern`,T,o,[d])),t[n]=mi(T)}}function vW(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]=MU(`clipPath`,a,o,[dW(e,n)])}t[`clip-path`]=mi(a)}function yW(e){return document.createTextNode(e)}function bW(e,t,n){e.insertBefore(t,n)}function xW(e,t){e.removeChild(t)}function SW(e,t){e.appendChild(t)}function CW(e){return e.parentNode}function wW(e){return e.nextSibling}function TW(e,t){e.textContent=t}var EW=58,DW=120,OW=MU(``,``);function kW(e){return e===void 0}function AW(e){return e!==void 0}function jW(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 MW(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function NW(e){var t,n=e.children,r=e.tag;if(AW(r)){var i=e.elm=jU(r);if(IW(OW,e),V(n))for(t=0;t<n.length;++t){var a=n[t];a!=null&&SW(i,NW(a))}else AW(e.text)&&!W(e.text)&&SW(i,yW(e.text))}else e.elm=yW(e.text);return e.elm}function PW(e,t,n,r,i){for(;r<=i;++r){var a=n[r];a!=null&&bW(e,NW(a),t)}}function FW(e,t,n,r){for(;n<=r;++n){var i=t[n];i!=null&&(AW(i.tag)?xW(CW(i.elm),i.elm):xW(e,i.elm))}}function IW(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)===DW?n===`xmlns:xlink`||n===`xmlns`?r.setAttributeNS(OU,n,o):n.charCodeAt(3)===EW?r.setAttributeNS(kU,n,o):n.charCodeAt(5)===EW?r.setAttributeNS(DU,n,o):r.setAttribute(n,o):r.setAttribute(n,o))}for(n in i)n in a||r.removeAttribute(n)}}function LW(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]:MW(o,l)?(RW(o,l),o=t[++r],l=n[++i]):MW(s,u)?(RW(s,u),s=t[--a],u=n[--c]):MW(o,u)?(RW(o,u),bW(e,o.elm,wW(s.elm)),o=t[++r],u=n[--c]):MW(s,l)?(RW(s,l),bW(e,s.elm,o.elm),s=t[--a],l=n[++i]):(kW(d)&&(d=jW(t,r,a)),f=d[l.key],kW(f)?bW(e,NW(l),o.elm):(p=t[f],p.tag===l.tag?(RW(p,l),t[f]=void 0,bW(e,p.elm,o.elm)):bW(e,NW(l),o.elm)),l=n[++i]);(r<=a||i<=c)&&(r>a?(m=n[c+1]==null?null:n[c+1].elm,PW(e,m,n,i,c)):FW(e,t,r,a))}function RW(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(IW(e,t),kW(t.text)?AW(r)&&AW(i)?r!==i&&LW(n,r,i):AW(i)?(AW(e.text)&&TW(n,``),PW(n,null,i,0,i.length-1)):AW(r)?FW(n,r,0,r.length-1):AW(e.text)&&TW(n,``):e.text!==t.text&&(AW(r)&&FW(n,r,0,r.length-1),TW(n,t.text)))}function zW(e,t){if(MW(e,t))RW(e,t);else{var n=e.elm,r=CW(n);NW(t),r!==null&&(bW(r,t.elm,wW(n)),FW(r,[e],0,0))}return t}var BW=0,VW=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=HW(`configLayer`),this.storage=t,this._opts=n=k({},n),this.root=e,this._id=`zr`+BW++,this._oldVNode=RU(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=jU(`svg`);IW(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`,zW(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return mW(e,LU(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=LU(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=UW(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=MU(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=I(R(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(MU(`defs`,`defs`,{},c)),e.animation){var l=IU(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=MU(`style`,`stl`,{},[],l);a.push(u)}}return RU(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},FU(this.renderToVNode({animation:G(e.cssAnimation,!0),emphasis:G(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:G(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 _={};vW(d[g],_,t);var v=MU(`g`,`clip-g-`+c++,_,[]);(o?o.children:n).push(v),i[a++]=v,o=v}s=d;var y=mW(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=vk(r,0,n),t=vk(r,1,n),i.style.display=``),this._width!==e||this._height!==t){if(this._width=e,this._height=t,i){var a=i.style;a.width=e+`px`,a.height=t+`px`}if(ui(this._backgroundColor))this.refresh();else{var o=this._svgDom;o&&(o.setAttribute(`width`,e),o.setAttribute(`height`,t));var s=this._bgVNode&&this._bgVNode.elm;s&&(s.setAttribute(`width`,e),s.setAttribute(`height`,t))}}},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e.prototype.dispose=function(){this.root&&(this.root.innerHTML=``),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},e.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},e.prototype.toDataURL=function(e){var t=this.renderToString(),n=`data:image/svg+xml;`;return e?(t=_i(t),t&&n+`base64,`+t):n+`charset=UTF-8,`+encodeURIComponent(t)},e}();function HW(e){return function(){}}function UW(e,t,n,r){var i;if(n&&n!==`none`){if(i=MU(`rect`,`bg`,{width:e,height:t,x:`0`,y:`0`}),pi(n))gW({fill:n},i.attrs,`fill`,r);else if(ui(n))_W({style:{fill:n},dirty:ke,getBoundingRect:function(){return{width:e,height:t}}},i.attrs,`fill`,r);else{var a=Qr(n),o=a.color,s=a.opacity;i.attrs.fill=o,s<1&&(i.attrs[`fill-opacity`]=s)}}return i}function WW(e){e.registerPainter(`svg`,VW)}function GW(e,t,n){var r=d.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 KW(e){return!e.__cursors.get(0)}function qW(e){var t=e.__cursors.get(0);return{startIdx:t?t.startIdx:0,endIdx:t?t.endIdx:0}}var JW=function(e){i(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.zlevel=0,i.zlevel2=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__prevIdx={startIdx:0,endIdx:0};var a;r||=Ui,typeof t==`string`?a=GW(t,n,r):W(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(De(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=qW(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=GW(`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=qW(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;le(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||hk(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):ue(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=Dk(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}(Vi),YW=1e5,XW=314159,ZW=void 0,QW=1,$W=2;function eG(e){return e?e.__builtin__?!0:typeof e.resize==`function`&&typeof e.refresh==`function`:!1}function tG(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 nG(e,t,n,r){var i=new JW(e,t,t.dpr);return i.zlevel=n,i.zlevel2=r,i.__builtin__=!0,rG(i),i}function rG(e){e.__cursorStack=[],e.__cursors=K()}function iG(e){return e.startIdx=e.drawIdx=e.endIdx=e.endIdxNew=0,e.used=!1,e.first=e.last=NaN,e.notClearIdx=-1,e}function aG(e,t){var n=e.__cursors,r=+t;return n.get(r)||(e.__cursorStack.push(r),n.set(r,iG({key:r})))}function oG(e,t){for(var n=e.__cursorStack,r=0;r<n.length;r++)t(e.__cursors.get(n[r]))}function sG(e,t){var n=e.layers;return n[t]||(n[t]=[,,,])}function cG(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&lG&&!s.__builtin__||n&uG&&s.__builtin__||n&dG&&s===e.hoverlayer)||t(s,a,o,i)}}var lG=1,uG=2,dG=4,fG=lG|dG,pG=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=k({},n||{}),this.dpr=n.devicePixelRatio||Ui,this._singleCanvas=i,this.root=e,e.style&&(De(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=nG(a,this,XW,0);c.initContext(),this._insertLayer(c,XW,0,!0),this._domRoot=e}else{this._width=vk(e,0,n),this._height=vk(e,1,n);var l=this._domRoot=tG(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&&!W(e)?{paintAll:!!e}:e||{},n=G(t.refresh,!0),r=G(t.refreshHover,!1);if(r&&(this._hoverLayerDirty=$W),!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 cG(this._i,function(e,t,n,r){e.refresh&&e.refresh(r===0?o:null)},uG),this._opts.useDirtyRect&&(this._prevDisplayList=i.slice()),this},e.prototype._paintHoverList=function(e){var t=this._i.hoverlayer,n=this._hoverLayerDirty;if(this._hoverLayerDirty=ZW,n!==ZW&&(!t&&n===$W&&(t=this._i.hoverlayer=this._ensureLayer(YW)),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),Kk(i,s,r),c&&(s.style=l)}}i&&(qk(i,r),i.restore())}},e.prototype.getHoverLayer=function(){return this._ensureLayer(YW)},e.prototype.paintOne=function(e,t){Gk(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)cG(this._i,function(e){e.afterBrush&&e.afterBrush()},fG),this._paintHoverList(e);else{var i=this;HE(function(){i._paintList(e,t,n)})}}},e.prototype._compositeManually=function(){var e=this._ensureLayer(XW).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),cG(this._i,function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)},lG)},e.prototype._doPaintList=function(e,t){var n=this,r=!0;return cG(this._i,function(i){var a=!1;if(oG(i,function(e){(e.drawIdx<e.endIdx||e.notClearIdx>=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!KW(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)}oG(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},fG),Me.wxa&&cG(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=KW(e),c=s&&d.getTime(),l=t.drawIdx,u=t.notClearIdx,f=u>=0?Math.min(u,l):l;f<t.endIdx;f++){var p=n[f];if(!(f<l&&!p.notClear)){if(p.__inHover&&(this._hoverLayerDirty=$W),r!=null){var m=p.getPaintRect();m&&m.intersect(r)&&(Kk(o,p,a),p.setPrevPaintRect(m))}else Kk(o,p,a);if(s&&d.getTime()-c>15){f++;break}}}qk(o,a),t.drawIdx=Math.max(f,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=XW,t=0);var i=sG(this._i,e)[t];return i||(i=nG(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&O(i,this._layerConfig[e],!0),(n||r&&e!==XW)&&(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])&&eG(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=sG(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),sG(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 cG(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return cG(this._i,function(n,r){e.call(t,n,r)},lG)},e.prototype.eachOtherLayer=function(e,t){return cG(this._i,function(n,r){e.call(t,n,r)},uG)},e.prototype.getLayers=function(){var e={};return cG(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}}cG(n._i,function(e){e.__dirty=!1,oG(e,function(e){e.used=!1,e.endIdxNew=0,e.notClearIdx=-1})},fG);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__))E(`ZLevel `+d+` has been used by unknown layer `+o.id);else{if((!s||f!==s.key)&&(s=aG(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))}}cG(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;(KW(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&&(oG(t,function(e){e.drawIdx=e.startIdx}),n._hoverLayerDirty===ZW&&(n._hoverLayerDirty=QW))},fG)},e.prototype.clear=function(){return cG(this._i,function(e){e.clear(),rG(e)},lG),this},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,cG(this._i,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?O(n[e],t,!0):n[e]=t,cG(this._i,function(e,t){O(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=vk(i,0,r),t=vk(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,cG(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(XW).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[XW][0].dom;var t=new JW(`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;cG(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];Kk(n,l,a)}qk(n,a)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}();function mG(e){e.registerPainter(`canvas`,pG)}var hG=Object.freeze({INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`,JPY:`¥`}),gG=e=>typeof e==`string`&&/^[A-Z]{3}$/.test(e),_G=(e=`INR`)=>hG[e]??`${e} `;function vG(e,...t){console.warn(e,...t)}function yG(e,...t){console.error(e,...t)}function bG(e,t){if(e==null)throw Error(t);return e}function xG(e,t,...n){if(e.toLowerCase()===`svg`)throw Error(`make() builds HTML elements; use svgRoot for svg`);let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))n===!0?r.setAttribute(e,``):(typeof n==`string`||typeof n==`number`)&&r.setAttribute(e,String(n));let i=[];for(let e of n)e instanceof Node?i.push(e):(typeof e==`string`||typeof e==`number`)&&i.push(document.createTextNode(String(e)));return r.append(...i),r}var SG=`en-IN`,CG=/\{([A-Za-z0-9_]+)\}/g,wG=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0,TG=/* @__PURE__ */ new Map,EG=0,DG=/* @__PURE__ */ new Map;function OG(e,t){let n=TG.get(e);if(n===void 0)return t;let r=DG.get(e);if(r!==void 0&&r.version===EG&&r.english===t&&LG(r.merged,t))return r.merged;let i=IG(e,n,t);return DG.set(e,{version:EG,english:t,merged:i}),i}function kG(){return SG}var AG=e=>e===1?`one`:`other`,jG=e=>Math.trunc(Math.abs(e))===0||e===1?`one`:`other`,MG={en:AG,ta:AG,te:AG,ml:AG,mr:AG,ne:AG,or:AG,ur:AG,hi:jG,bn:jG,gu:jG,kn:jG,as:jG,pa:jG};function NG(e,t){let n=e.split(/[-_]/)[0]?.toLowerCase()??``,r=wG(MG,n)?MG[n]:void 0;if(r===void 0)throw RangeError(`No plural rule for locale "${e}". Supported languages: ${Object.keys(MG).join(`, `)}.`);return r(t)}function PG(e,t){return e.replace(CG,(e,n)=>wG(t,n)?String(t[n]):e)}function FG(e,t,n,r){let i=`${t}Other`;if(!wG(e,i))throw RangeError(`Plural text ${t} has no ${i} key; every plural needs its Other form.`);let a=NG(kG(),n),o=`${t}${a.charAt(0).toUpperCase()}${a.slice(1)}`,s=e[wG(e,o)?o:i];if(s===void 0)throw RangeError(`Plural text ${t} has no ${o} key.`);return PG(s,{count:n,...r})}function IG(e,t,n){let r={};for(let[i,a]of Object.entries(t)){let t=wG(n,i)?n[i]:void 0;if(t===void 0)throw RangeError(`Text ${e}.${i} is not a key of the English text. Allowed keys: ${Object.keys(n).join(`, `)}.`);let o=RG(t);for(let t of RG(a))if(!o.includes(t))throw RangeError(`Text ${e}.${i} uses {${t}}, which the English text does not have. Allowed placeholders: ${o.length===0?`none`:o.map(e=>`{${e}}`).join(`, `)}.`);r[i]=a}return Object.assign({},n,r)}function LG(e,t){let n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(t=>wG(e,t))}function RG(e){return Array.from(e.matchAll(CG),e=>e[1]??``)}var zG={aprShortLabel:`Apr`,aprilLabel:`April`,augShortLabel:`Aug`,augustLabel:`August`,decShortLabel:`Dec`,decemberLabel:`December`,emptyValueLabel:`-`,febShortLabel:`Feb`,februaryLabel:`February`,friMinLabel:`Fr`,friShortLabel:`Fri`,fridayLabel:`Friday`,janShortLabel:`Jan`,januaryLabel:`January`,julShortLabel:`Jul`,julyLabel:`July`,junShortLabel:`Jun`,juneLabel:`June`,marShortLabel:`Mar`,marchLabel:`March`,mayLabel:`May`,mayShortLabel:`May`,monMinLabel:`Mo`,monShortLabel:`Mon`,mondayLabel:`Monday`,novShortLabel:`Nov`,novemberLabel:`November`,octShortLabel:`Oct`,octoberLabel:`October`,satMinLabel:`Sa`,satShortLabel:`Sat`,saturdayLabel:`Saturday`,sepShortLabel:`Sep`,septemberLabel:`September`,sunMinLabel:`Su`,sunShortLabel:`Sun`,sundayLabel:`Sunday`,thuMinLabel:`Th`,thuShortLabel:`Thu`,thursdayLabel:`Thursday`,tueMinLabel:`Tu`,tueShortLabel:`Tue`,tuesdayLabel:`Tuesday`,wedMinLabel:`We`,wedShortLabel:`Wed`,wednesdayLabel:`Wednesday`},BG=`Asia/Kolkata`,VG=198e5,HG=/* @__PURE__ */ new Map;function UG(e){let t=HG.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`}),HG.set(e,t)),t}function WG(e){if(typeof e!=`string`||e===``)return!1;try{return UG(e),!0}catch{return!1}}function GG(e,t=BG){if(t===`Asia/Kolkata`){let t=new Date(e+VG);return{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}let n=Object.fromEntries(UG(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 KG(e,t=BG){if(t===`Asia/Kolkata`)return VG;let n=GG(e,t),r=/* @__PURE__ */ 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 qG(e,t=BG){let n=e-KG(e,t);return n=e-KG(n,t),n}var JG=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],YG=[`rupees`,`paise`],XG=[`ms`,`s`,`min`,`h`],ZG=[`day`,`month`,`year`,`datetime`,`time`],QG=()=>OG(`formatters`,zG),$G=()=>QG().emptyValueLabel,eK=`−`,tK=[`janShortLabel`,`febShortLabel`,`marShortLabel`,`aprShortLabel`,`mayShortLabel`,`junShortLabel`,`julShortLabel`,`augShortLabel`,`sepShortLabel`,`octShortLabel`,`novShortLabel`,`decShortLabel`],nK={short:[`sunShortLabel`,`monShortLabel`,`tueShortLabel`,`wedShortLabel`,`thuShortLabel`,`friShortLabel`,`satShortLabel`],long:[`sundayLabel`,`mondayLabel`,`tuesdayLabel`,`wednesdayLabel`,`thursdayLabel`,`fridayLabel`,`saturdayLabel`],min:[`sunMinLabel`,`monMinLabel`,`tueMinLabel`,`wedMinLabel`,`thuMinLabel`,`friMinLabel`,`satMinLabel`]},rK=(e,t)=>QG()[bG(e[t],`no date name at index ${t}`)],iK=e=>rK(tK,e);function aK(e,t){return rK(nK[t],e)}var oK=(e,t)=>bG(e[t],`no compact unit at index ${t}`),sK=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],cK=[[1e9,`B`],[1e6,`M`],[1e3,`K`]],lK=e=>!e||e===`INR`?`en-IN`:`en-US`,uK=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=20?e:t,dK=/* @__PURE__ */ new Map,fK=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=dK.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:e}),dK.set(n,r)),r},pK=/* @__PURE__ */ new Map,mK=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=pK.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e}),pK.set(n,r)),r},hK=e=>typeof e==`number`&&Number.isFinite(e),gK=e=>e<0&&!Object.is(Math.abs(e),0)?eK:``;function _K(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 vK=(e,t)=>t===`paise`?Number(_K(e)):e,yK=2,bK=(e,t,n)=>{let r=Math.min(t,yK),i=10n**BigInt(yK-r),a=(BigInt(_K(e).replace(`.`,``))+i/2n)/i,o=10n**BigInt(r),s=mK(0,n).format(a/o);return t===0?s:`${s}.${(a%o).toString().padStart(r,`0`)}${`0`.repeat(t-r)}`};function xK(e,{decimals:t}={}){if(!hK(e))return $G();let n=fK(uK(t,2)).format(Math.abs(e));return n===`0`?`0`:gK(e)+n}function SK(e,t){if(!t?.currency)throw TypeError(`[@webority/ui-elements] formatCurrency needs options.currency, an ISO 4217 code such as "INR".`);if(!hK(e))return $G();let{unit:n=`rupees`,decimals:r,currency:i}=t,a=uK(r,0),o=lK(i),s=n===`paise`?bK(Math.abs(e),a,o):mK(a,o).format(Math.abs(e));return(Number(s.replace(/,/g,``))===0?``:gK(e))+_G(i)+s}var CK=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2;function wK(e,{currency:t,unit:n=`rupees`}={}){if(!hK(e))return $G();let r=t?vK(e,n):e,i=t?_G(t):``,a=t?lK(t):`en-IN`,o=a===`en-IN`?sK:cK,s=Math.abs(r),c=o.findIndex(([e])=>s>=e);if(c===-1){let e=fK(CK(s),a).format(s);if(e!==`1,000`)return(e===`0`?``:gK(r))+i+e;c=o.length-1}let[l,u]=oK(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]=oK(o,c),d=s/l,f=d>=100?0:d>=10?1:2,p=Number(d.toFixed(f))),`${gK(r)}${i}${fK(f,a).format(p)} ${u}`}function TK(e,{decimals:t}={}){return hK(e)?`${xK(e*100,{decimals:uK(t,1)})}%`:$G()}var EK={ms:1,s:1e3,min:6e4,h:36e5};function DK(e,{unit:t=`s`}={}){if(!hK(e))return $G();let n=EK[t]??1e3,r=Math.abs(e*n),i=gK(e);if(Math.round(r)<1e3)return`${i}${fK(0).format(r)} ms`;let a=r/1e3;if(a<10)return`${i}${fK(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}${fK(0).format(l)}h ${s(c%60)}m`}function OK(e,t=BG){if(e instanceof Date)return e.getTime();if(hK(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?qG(a.getTime(),t):NaN}return Date.parse(e)}function kK(e,t=BG){let{year:n,month:r,day:i,hour:a,minute:o}=GG(e,t);return{year:n,month:r,day:i,hour:a,minute:o}}function AK(e,{pattern:t=`day`,timeZone:n=BG}={}){let r=OK(e,n);if(!Number.isFinite(r))return $G();let i=kK(r,n),a=e=>String(e).padStart(2,`0`),o=`${a(i.day)}-${iK(i.month)}-${i.year}`,s=`${a(i.hour)}:${a(i.minute)}`;switch(t){case`month`:return`${iK(i.month)}-${i.year}`;case`year`:return String(i.year);case`datetime`:return`${o} ${s}`;case`time`:return s;default:return o}}function jK(e,{timeZone:t=BG}={}){let n=OK(e,t);if(!Number.isFinite(n))return $G();let r=kK(n,t);return`${String(r.day).padStart(2,`0`)}-${iK(r.month)}`}function Z(e,t){if(e==null||e===``)return $G();let n=t?.style;if(n===`date`)return AK(e,t);if(typeof e!=`number`)return String(e);switch(n){case`currency`:return SK(e,{...t,currency:t?.currency??``});case`percent`:return TK(e,t);case`compact`:return wK(e,t);case`duration`:return DK(e,t);default:return xK(e,t)}}function MK(e){let t=e?.style;if(t===`currency`){if(!e?.currency)throw TypeError(`[@webority/ui-elements] a currency format needs a currency, an ISO 4217 code such as "INR".`);return{style:`compact`,currency:e.currency,unit:e.unit}}return!t||t===`number`?{style:`compact`}:e??{}}var NK={aboveLabel:`Above`,areaChartLabel:`Area chart`,arrowKeysText:`{title}: use the arrow keys to read the values`,bandLabel:`Band`,barChartLabel:`Bar chart`,belowLabel:`Below`,bubbleChartLabel:`Bubble chart`,calendarHeatmapLabel:`Calendar heatmap`,calendarRangeText:`, from {first} to {last}`,calendarSummaryTextOne:`Calendar heatmap of {label}, {n} day.`,calendarSummaryTextOther:`Calendar heatmap of {label}, {n} days{range}.`,categoryLabel:`Category`,centerLabel:`Total`,changeLabel:`Change`,chartLabel:`chart`,columnChartLabel:`Column chart`,columnFallbackLabel:`column`,columnXLabel:`X`,constantSpanText:`{label} is {lo}.`,currencyFormatText:`This chart's currency format needs a currency code, such as "INR", in its currency field.`,dataSuffixLabel:`data`,dateLabel:`Date`,donutChartLabel:`Donut chart`,donutLargestText:`{top} is the largest, at {share}.`,donutSummaryTextOne:`Donut chart of {label} in {rows} part, {total} in all.`,donutSummaryTextOther:`Donut chart of {label} in {rows} parts, {total} in all.`,emptyText:`No data to show for this chart.`,errorText:`This chart couldn't load. Try again in a moment.`,everySeriesHiddenText:`Every series is hidden.`,firstStageLabel:`first stage`,fromLabel:`From`,funnelChartLabel:`Funnel chart`,funnelPreviousStepText:`{share} of previous step`,funnelStartText:`{first} is {firstValue} and {last} is {lastValue}, {share} of the start.`,funnelSummaryText:`Funnel chart of {label} in {n} stages.`,gaugeBandText:`, in the {band} band`,gaugeLabel:`Gauge`,gaugeSummaryText:`{type}: {label} is {value} on a scale from {min} to {max}{band}.`,groupLabel:`Group`,groupsTextOne:` in {count} group: {groups}`,groupsTextOther:` in {count} groups: {groups}`,heatmapLabel:`Heatmap`,heatmapSummaryText:`Heatmap of {label} by {group} and {x}, {n} cells.`,highestAtLowestAtText:`Highest is {highValue} at {highGroup}, {high}; lowest is {lowValue} at {lowGroup}, {low}.`,highestLowestText:`Highest is {maxValue} on {max}; lowest is {minValue} on {min}.`,itemLabel:`Item`,largestFallText:`The largest fall is {xText}, {signed}.`,largestFlowText:`The largest flow is {xText} to {toText}, {fmtAt}.`,largestRiseText:`The largest rise is {xText}, {signed}.`,latestText:`Latest {latest}`,legendLabel:`Legend`,lessLabel:`Less`,lineChartLabel:`Line chart`,loadingText:`Loading chart`,measureLabel:`Measure`,moreLabel:`More`,ofFirstStepText:`Of {first}`,ofPreviousStepLabel:`Of previous step`,openingShareText:`{share} of opening`,opensAtClosesAtText:`It opens at {opening} and closes at {closing}.`,otherLabel:`Other`,pointsSummaryTextOne:`{n} point, {first}.`,pointsSummaryTextOther:`{n} points, from {first} to {last}.`,rangeSpanText:`{label} runs from {lo} to {hi}.`,rowFallbackLabel:`row`,rowLabel:`Row`,runningTotalLabel:`Running total`,sankeyLabel:`Sankey diagram`,sankeySummaryText:`Sankey diagram of {label}: {n} flows between {nodes} places.`,scaleLabel:`Scale`,scaleRangeText:`{min} to {max}`,scatterPlotLabel:`Scatter plot`,scatterSummaryText:`{type} of {label} against {xLabel}, {count} points{groups}.`,shareLabel:`Share`,shareOfAllLabel:`Share of all`,shareOfGroupLabel:`Share of group`,shareOfParentText:`Share of {parent}`,shareOfStepText:`{share} of {first}`,sharedAxisText:`, sharing one x axis`,showingFirstRowsDownloadText:`Showing the first {rows} of {total} rows. Download the CSV for all of them.`,smallMultiplesLabel:`Small multiples`,soFarText:`so far`,stackedPercentText:`, stacked to 100%`,stackedText:`, stacked`,stageLabel:`Stage`,stepLabel:`Step`,summaryText:`{type} of {series}{stacked}{sharedAxis}.`,targetGapText:`{direction} {label} by {gap}`,targetLabel:`target`,toLabel:`To`,tooManyGroupsText:`This chart has more groups than it can show clearly.`,tooManySeriesText:`This chart has more series than it can show clearly.`,totalText:`Total {total}`,treemapEmptyText:`Treemap of {label}: no items.`,treemapLabel:`Treemap`,treemapLargestGroupText:`{name} is the largest group, at {share}.`,treemapSummaryText:`Treemap of {label}: {n} items in {totals} groups, {total} in all.`,trendLabel:`Trend`,untitledLabel:`Chart`,waterfallLabel:`Waterfall chart`,waterfallSummaryText:`Waterfall chart of {label}.`},PK={applyLabel:`Apply`,dayCountOne:`1 day`,dayCountOther:`{count} days`,financialYearText:`FY {startYear}-{endYear}`,label:`Period`,nextMonthLabel:`Next month`,previousMonthLabel:`Previous month`,quarterPrefixText:`Q`,shortDaySuffixText:`d`,startEndPlaceholder:`Start to End`},Q=()=>OG(`chart`,NK),FK=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],IK=[`none`,`stacked`,`percent`],LK=[`category`,`time`,`value`],RK=[`auto`,`svg`,`canvas`],zK=[`ready`,`loading`,`empty`,`error`],BK=[`chart`,`table`],VK=[`chart-1`,`chart-2`,`chart-3`,`chart-4`,`chart-5`,`chart-6`,`chart-7`,`chart-8`],HK=8,UK=6,WK={line:`lineChartLabel`,area:`areaChartLabel`,column:`columnChartLabel`,bar:`barChartLabel`,donut:`donutChartLabel`,heatmap:`heatmapLabel`,calendar:`calendarHeatmapLabel`,funnel:`funnelChartLabel`,gauge:`gaugeLabel`,waterfall:`waterfallLabel`,treemap:`treemapLabel`,sankey:`sankeyLabel`,scatter:`scatterPlotLabel`,bubble:`bubbleChartLabel`,multiples:`smallMultiplesLabel`},GK=e=>Q()[WK[e]],KK=[`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`],qK=e=>KK.includes(e),JK=[`area`,`column`,`bar`],YK=[`line`,`area`,`column`,`bar`,`multiples`],XK={line:[`category`,`time`],area:[`category`,`time`],column:[`category`,`time`],bar:[`category`,`time`],multiples:[`category`,`time`],calendar:[`time`],scatter:[`value`],bubble:[`value`]},ZK={group:[`heatmap`,`treemap`,`scatter`,`bubble`],to:[`sankey`],size:[`bubble`],trend:[`scatter`,`bubble`],zoom:[`line`,`area`],bands:[`gauge`],centerLabel:[`donut`],sliceValues:[`donut`],valueLabels:[`line`,`column`,`bar`],incompleteLast:[`line`,`area`,`column`,`bar`]},QK={gauge:240,calendar:200,treemap:340,sankey:340},$K=100,eq=72,tq=32,nq=/* @__PURE__ */ `type.title.description.data.x.series.group.to.size.trend.zoom.bands.stack.y.target.centerLabel.sliceValues.valueLabels.incompleteLast.height.state.emptyText.errorText.loadingText.renderer.timeZone.financialYearStart`.split(`.`),rq=[`key`,`kind`,`format`,`label`,`labelFit`],iq=[`auto`,`all`,`rotate`,`ellipsis`],aq=[`key`,`label`,`format`,`colour`],oq=[`key`,`label`],sq=[`key`,`label`,`format`],cq=[`upTo`,`label`],lq=[`label`,`format`,`min`,`max`,`wholeNumbers`],uq=[`value`,`label`],dq=[`style`,`currency`,`unit`,`decimals`,`pattern`],fq=[...YG,...XG],pq=/* @__PURE__ */ new Set;function mq(e){pq.has(e)||(pq.add(e),vG(`[@webority/ui-elements] <wui-chart> ${e}`))}var hq=e=>e.map(e=>`"${e}"`).join(` | `),gq=e=>typeof e==`number`&&Number.isFinite(e),_q=e=>typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=12,vq=e=>typeof e==`object`&&!!e&&!Array.isArray(e),yq=(e,t)=>Reflect.get(e,t),bq=e=>e===null||typeof e==`string`||typeof e==`number`,xq=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,bq(t)?t:null]));function Sq(e,t){if(e==null)throw Error(`${t} missing`);return e}var Cq=(e,t)=>e.some(e=>e===t);function wq(e,t,n){t==null||n.includes(t)||mq(`received ${e}="${String(t)}", which is not one of ${hq(n)}. The chart uses its default instead.`)}function Tq(e,t,n){for(let r of Object.keys(t))n.includes(r)||(/^(y2|secondary)/i.test(r)?mq(`ignores ${e}.${r}: a chart has one value axis by design. Show the second measure as its own chart.`):mq(`ignores the unknown key ${e}.${r}. Known keys: ${n.join(`, `)}.`))}function Eq(e,t){if(t==null)return;if(typeof t!=`object`){mq(`expects ${e} to be an object such as { style: "currency" }.`);return}Tq(e,t,dq);let n=yq(t,`style`);wq(`${e}.style`,n,JG);let r=yq(t,`currency`);r!=null&&!gG(r)&&mq(`received ${e}.currency="${String(r)}", which is not an ISO 4217 code such as "INR", so the format has no currency.`);let i=yq(t,`unit`);i!=null&&wq(`${e}.unit`,i,n===`duration`?XG:YG);let a=yq(t,`pattern`);wq(`${e}.pattern`,a,ZG);let o=yq(t,`decimals`);o!=null&&!(typeof o==`number`&&Number.isInteger(o)&&o>=0&&o<=20)&&mq(`received ${e}.decimals=${String(o)}, which is not a whole number from 0 to 20. The chart uses its default instead.`);let s={style:Cq(JG,n)?n:`number`};return typeof r==`string`&&gG(r)&&(s.currency=r),Cq(fq,i)&&(s.unit=i),typeof o==`number`&&(s.decimals=o),Cq(ZG,a)&&(s.pattern=a),s}function Dq(e,t){return t?.style!==`currency`||t.currency?null:`${e} is a currency format with no valid currency: set ${e}.currency to an ISO 4217 code such as "INR".`}function Oq(e){let t=(e,t=Q().errorText)=>(yG(`[@webority/ui-elements] <wui-chart> ${e}`),{spec:null,problem:t});if(!vq(e))return t('has no spec: set the `spec` property or add a <script type="application/json"> child.');let n=e;Tq(`spec`,n,nq);let r=yq(n,`type`);if(wq(`type`,r,FK),!Cq(FK,r))return t(`cannot draw type "${String(r)}".`);let i=r,a=yq(n,`title`);typeof a==`string`&&a.trim()||mq("needs a `title`: it names the chart for screen readers and names exported files.");for(let[e,t]of Object.entries(ZK))yq(n,e)!=null&&!t.includes(i)&&mq(`ignores spec.${e} on a ${i} chart: it applies to ${t.join(`, `)}.`);let o=yq(n,`x`),s=vq(o)?o:{};Tq(`spec.x`,s,rq);let c=XK[i]??[`category`],l=yq(s,`kind`);wq(`x.kind`,l,LK),Cq(LK,l)&&!c.includes(l)&&mq(`ignores x.kind="${l}" on a ${i} chart: it takes ${hq(c)}.`);let u=yq(s,`labelFit`);wq(`x.labelFit`,u,iq);let d=Eq(`x.format`,yq(s,`format`)),f=yq(s,`key`);typeof f!=`string`&&i!==`gauge`&&mq("needs `x.key`, the column holding each row's x value or slice name.");let p=typeof f==`string`?f:``,m=yq(n,`y`),h=vq(m)?m:{};Tq(`spec.y`,h,lq);let g=Eq(`y.format`,yq(h,`format`)),_=Dq(`x.format`,d);if(_)return t(_,Q().currencyFormatText);let v=Dq(`y.format`,g);if(v)return t(v,Q().currencyFormatText);let y=yq(n,`series`),b=Array.isArray(y)?y.filter(vq):[],x=[];for(let[e,n]of b.entries()){Tq(`spec.series[${e}]`,n,aq);let r=Eq(`series[${e}].format`,yq(n,`format`)),i=Dq(`series[${e}].format`,r);if(i)return t(i,Q().currencyFormatText);let a=yq(n,`key`);typeof a!=`string`&&mq(`needs series[${e}].key, the column holding that series' values.`);let o=yq(n,`label`),s=yq(n,`colour`);wq(`series[${e}].colour`,s,VK),x.push({key:String(a),named:typeof a==`string`,label:typeof o==`string`&&o?o:String(a),format:r,colour:Cq(VK,s)?s:void 0})}let S=x[0];if(!S)return t(`has no series to draw.`);let C=x.filter(e=>e.named).map(e=>e.key),w=C.find((e,t)=>C.indexOf(e)!==t);if(w!==void 0)return t(`has two series with the key "${w}": each series needs its own key.`);if(x.length>8)return t(`refuses ${x.length} series: 8 is the most that stay distinguishable. Fold the smallest into an Other series, or split the chart.`,Q().tooManySeriesText);let T=qK(i);if(T&&x.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.`;mq(`draws one series as a ${i}; it got ${x.length} and shows the first. ${e}`)}let E=(e,t,n,r)=>{if(t==null)return null;if(!vq(t))return mq(`expects ${e} to be an object such as { key: "column" }.`),null;Tq(e,t,n);let i=yq(t,`key`);if(typeof i!=`string`)return mq(`needs ${e}.key, the column holding ${r}.`),null;let a=Eq(`${e}.format`,yq(t,`format`)),o=yq(t,`label`);return{key:i,label:typeof o==`string`?o:``,format:a}},D=ZK.group.includes(i)?E(`spec.group`,yq(n,`group`),oq,`each row's group`):null,O=i===`sankey`?E(`spec.to`,yq(n,`to`),oq,`where each flow ends`):null,k=i===`bubble`?E(`spec.size`,yq(n,`size`),sq,`each bubble's size`):null,A=Dq(`group.format`,D?.format)??Dq(`to.format`,O?.format)??Dq(`size.format`,k?.format);if(A)return t(A,Q().currencyFormatText);if((i===`heatmap`||i===`treemap`)&&!D)return t(`needs \`group.key\` to draw a ${i}: the column holding each ${i===`heatmap`?`row`:`parent`}.`);if(i===`sankey`&&!O)return t("needs `to.key` to draw a sankey: the column holding where each flow ends.");if(i===`bubble`&&!k)return t("needs `size.key` to draw a bubble chart: the column holding each bubble's size.");let j=JK.includes(i)?IK:[`none`],M=yq(n,`stack`);wq(`stack`,M,j);let ee=yq(n,`state`);wq(`state`,ee,zK);let N=yq(n,`renderer`);wq(`renderer`,N,RK);let P=yq(n,`timeZone`);P!=null&&!WG(P)&&mq(`received timeZone="${String(P)}", which is not a time zone this browser knows. The chart uses Asia/Kolkata instead.`);let F=WG(P)?P:BG,I=yq(n,`financialYearStart`);I!=null&&!_q(I)&&mq(`received financialYearStart="${String(I)}", which is not a month from 1 to 12. The chart uses calendar years instead.`);let te=_q(I)?I:1,L=yq(n,`target`),ne=vq(L)?yq(L,`value`):void 0;L!=null&&(vq(L)&&Tq(`spec.target`,L,uq),vq(L)&&gq(ne)||mq("ignores a `target` without a numeric `value`."));let R=yq(n,`trend`);R!=null&&typeof R!=`boolean`&&mq("expects `trend` to be true or false.");let re=yq(n,`zoom`);re!=null&&typeof re!=`boolean`&&mq("expects `zoom` to be true or false.");let z=[],B=yq(n,`bands`);if(i===`gauge`&&B!=null){let e=Array.isArray(B)?B.filter(vq):[];for(let t of e)Tq(`spec.bands[]`,t,cq);z=e.map(e=>({upTo:yq(e,`upTo`),label:yq(e,`label`)})).filter(e=>gq(e.upTo)&&typeof e.label==`string`&&e.label!==``).sort((e,t)=>e.upTo-t.upTo),Array.isArray(B)&&z.length===e.length||mq("ignores a gauge band without a numeric `upTo` and a `label`.")}let V=g??S.format,H=(T?x.slice(0,1):x).map(e=>({key:e.key,label:e.label,format:e.format??V,colour:e.colour})),U=Cq(c,l)?l:c[0],ie=yq(n,`data`),ae=Array.isArray(ie)?ie:[],W=ae.filter(vq).map(xq),oe=-1,se=null,ce=S.key;i===`donut`&&W.length>6&&(se=W,{data:W,otherIndex:oe}=jq(W,p,ce),mq(`draws at most 6 donut slices; the smallest ${ae.length-5} are shown as "${Q().otherLabel}". Send fewer rows, or use a bar chart for many parts.`));let le=(e,t)=>{let n=W.filter(e);n.length!==W.length&&mq(`leaves out ${W.length-n.length} row(s) ${t}.`),W=n},ue=e=>e!=null&&e!==``,de=e=>gq(e)&&e>0;if(U===`time`&&YK.includes(i)&&le(e=>Number.isFinite(OK(e[p],F)),`without a readable date`),i===`gauge`&&W.length>1)mq(`draws one value as a gauge; it got ${W.length} rows and shows the first.`),W=W.slice(0,1);else if(i===`scatter`||i===`bubble`){le(e=>gq(e[p])&&gq(e[ce])&&(i!==`bubble`||k!=null&&de(e[k.key])),`without a number for x and y (and a positive size)`);let e=new Set(D?W.map(e=>String(e[D.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.`,Q().tooManyGroupsText)}else if(i===`calendar`)le(e=>Number.isFinite(OK(e[p],F)),`without a readable date`);else if(i===`heatmap`&&D)le(e=>ue(e[p])&&ue(e[D.key]),`without a column or a row`);else if(i===`treemap`&&D){le(e=>ue(e[p])&&ue(e[D.key])&&de(e[ce]),`without a name, a parent and a positive size`);let e=new Set(W.map(e=>String(e[D.key])));if(e.size>8)return t(`refuses ${e.size} parents in a treemap: 8 is the most that keep their own colour. Fold the smallest into one, or split the chart.`,Q().tooManyGroupsText)}else if(i===`sankey`&&O){le(e=>ue(e[p])&&ue(e[O.key])&&de(e[ce]),`without a start, an end and a positive size`);let e=kq(W,p,O.key);if(e)return t(e.reason,e.text)}else if(i===`waterfall`){let e=Aq(W,ce);if(e?.refuse)return t(e.refuse);e?.warn&&mq(e.warn)}let fe=yq(n,`height`),G=gq(fe)&&fe>0?fe:null;if(i===`multiples`){let e=eq*H.length+tq;G!=null&&G<e&&(mq(`needs at least ${e}px of height for ${H.length} small charts; it got ${G}px and draws at ${e}px.`),G=e),G??=$K*H.length+40}G??=QK[i]??320;let pe=Cq(j,M)?M:`none`,me=ZK.valueLabels.includes(i)&&(yq(n,`valueLabels`)??i===`line`)===!0;me&&pe!==`none`&&mq(`ignores valueLabels on a stacked chart.`);let he=me&&pe===`none`,ge=yq(n,`incompleteLast`);ge!=null&&typeof ge!=`boolean`&&mq(`expects incompleteLast to be true or false.`);let _e=ZK.incompleteLast.includes(i)&&ge===!0,ve=i===`line`||i===`area`;_e&&ve&&pe!==`none`&&mq(`ignores incompleteLast on a stacked line or area.`);let ye=_e&&!(ve&&pe!==`none`),be=ZK.sliceValues.includes(i)&&(yq(n,`sliceValues`)??!0)===!0,xe=yq(n,`description`),Se=yq(s,`label`),Ce=yq(h,`label`),we=yq(h,`min`),K=yq(h,`max`),Te=yq(n,`centerLabel`),Ee=(e,t)=>typeof e==`string`&&e?e:t;return{problem:null,spec:{type:i,title:typeof a==`string`?a.trim():``,description:typeof xe==`string`?xe:``,data:W,allData:se??W,x:{key:p,kind:U,format:d??(U===`time`?{style:`date`}:U===`value`?{style:`number`}:void 0),label:typeof Se==`string`?Se:``,labelFit:Cq(iq,u)?u:`auto`},series:H,group:D,to:O,size:k,trend:ZK.trend.includes(i)&&R===!0,zoom:ZK.zoom.includes(i)?(re??W.length>5e3)===!0:!1,bands:z,stack:pe,y:{label:typeof Ce==`string`?Ce:``,format:V,min:gq(we)?we:void 0,max:gq(K)?K:void 0,wholeNumbers:yq(h,`wholeNumbers`)===!0},target:vq(L)&&gq(ne)?{value:ne,label:String(yq(L,`label`)??``)}:null,centerLabel:i===`donut`&&typeof Te==`string`&&Te.trim()?Te.trim():``,sliceValues:be,valueLabels:he,incompleteLast:ye,height:G,state:Cq(zK,ee)?ee:`ready`,emptyText:Ee(yq(n,`emptyText`),Q().emptyText),errorText:Ee(yq(n,`errorText`),Q().errorText),loadingText:Ee(yq(n,`loadingText`),Q().loadingText),renderer:Cq(RK,N)?N:`auto`,timeZone:F,financialYearStart:te,otherIndex:oe}}}function kq(e,t,n){let r=e.map(e=>[String(e[t]),String(e[n])]),i=/* @__PURE__ */ 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:Q().tooManyGroupsText};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:Q().errorText}:null}function Aq(e,t){let n=e.map(e=>gq(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 jq(e,t,n){let r=new Set(e.map((e,t)=>({i:t,v:gq(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)||!gq(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=Q().otherLabel;for(let e=2;o.has(s);e+=1)s=`${Q().otherLabel} (${e})`;return a.push({[t]:s,[n]:i}),{data:a,otherIndex:a.length-1}}function Mq(e){return Sq(e.series[0],`series`)}function Nq(e,t){return Sq(e.data[t],`row ${t}`)}function $(e,t,n){let r=e.data[n]?.[t];return gq(r)?r:null}function Pq(e){return e.type===`gauge`||e.series.some(t=>e.data.some((n,r)=>$(e,t.key,r)!=null))}function Fq(e,t,n){if(n===1)return AK(e,{pattern:`year`,timeZone:t});if(!Number.isFinite(e))return $G();let r=GG(e,t),i=r.month+1>=n?r.year:r.year-1;return PG(OG(`periodPicker`,PK).financialYearText,{startYear:String(i),endYear:String((i+1)%100).padStart(2,`0`)})}function Iq(e,t){let n=e.data[t]?.[e.x.key];return n==null||n===``?$G():e.x.format?.pattern===`year`&&e.x.format.style===`date`?Fq(Lq(e,t),e.timeZone,e.financialYearStart):e.x.format?Z(n,{...e.x.format,timeZone:e.timeZone}):String(n)}function Lq(e,t){return OK(e.data[t]?.[e.x.key],e.timeZone)}function Rq(e,t){let n=e.group?e.data[t]?.[e.group.key]:null;return n==null||n===``?$G():String(n)}function zq(e,t){let n=e.to?e.data[t]?.[e.to.key]:null;return n==null||n===``?$G():String(n)}var Bq=e=>[...new Set(e)];function Vq(e){return e.group?Bq(e.data.map((t,n)=>Rq(e,n))):[]}function Hq(e){return qK(e.type)?e.data.length:e.data.length*e.series.length}function Uq(e){return e.renderer===`auto`?Hq(e)>5e3?`canvas`:`svg`:e.renderer}function Wq(e){switch(e.type){case`donut`:return e.data.map((t,n)=>Iq(e,n));case`scatter`:case`bubble`:return Vq(e);case`line`:case`area`:case`column`:case`bar`:return e.series.map(e=>e.key);default:return[]}}function Gq(e){return[`line`,`area`,`column`,`bar`].includes(e.type)?e.series.map(e=>e.label):Wq(e)}function Kq(e,t,n){return e.type===`donut`?n.has(Iq(e,t)):(e.type===`scatter`||e.type===`bubble`)&&e.group?n.has(Rq(e,t)):!1}function qq(e,t){return e.data.map((n,r)=>{let i=e.series.filter(e=>!t.has(e.key)).reduce((t,n)=>t+Math.abs($(e,n.key,r)??0),0);return Object.fromEntries(e.series.map(t=>{let n=$(e,t.key,r);return[t.key,i&&n!=null?n/i:null]}))})}function Jq(e,t=BG){return`${aK(new Date(e+KG(e,t)).getUTCDay(),`short`)}, ${AK(e,{timeZone:t})}`}var Yq=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(e,t),1/0),Xq=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(e,t),-1/0),Zq=(e,t)=>e.data.map((n,r)=>$(e,t,r)).filter(e=>e!=null),Qq=(e,t)=>t?Z((e??0)/t,{style:`percent`}):$G();function $q(e,t){let n=e.filter(gq);if(!n.length)return[];let r=Yq(n),i=Xq(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 eJ(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 tJ(e,t){return Array.from({length:e},(n,r)=>t[e===1?6:Math.round(6-r*4/(e-1))])}function nJ(e,t){return e.bands.find(e=>t<=e.upTo)??e.bands[e.bands.length-1]??null}var rJ=(e,t)=>t==null?$G():Sq(nJ(e,t),`gauge band`).label;function iJ(e){return{min:e.y.min??0,max:e.y.max??100}}function aJ(e){let t=Mq(e).key,n=e.data.length-1,r=0;return e.data.map((i,a)=>{let o=$(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 oJ(e,t){let n=Mq(e).key,r=Sq(e.to,`to column`).key,i=e.data.map((t,i)=>({from:String(t[e.x.key]),to:String(t[r]),value:$(e,n,i)??0})),a=/* @__PURE__ */ 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=/* @__PURE__ */ 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=Sq((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 sJ(e){let t=Mq(e).key,n=new Map(Vq(e).map(e=>[e,0]));return e.data.forEach((r,i)=>{n.set(Rq(e,i),(n.get(Rq(e,i))??0)+($(e,t,i)??0))}),n}function cJ(e,t,n){let{palette:r,neutral:i,seq:a,rise:o,fall:s}=n,c=Mq(e).key;switch(e.type){case`donut`:return fJ(e,t,n);case`funnel`:return tJ(e.data.length,Sq(a,`sequential colours`))[t];case`heatmap`:case`calendar`:return eJ($q(Zq(e,c),Sq(a,`sequential colours`)),$(e,c,t));case`gauge`:return r[0];case`waterfall`:{let n=Sq(aJ(e)[t],`waterfall bar ${t}`);return n.total?r[0]:n.value>=0?o:s}case`treemap`:return r[[...sJ(e).keys()].indexOf(Rq(e,t))%r.length];case`sankey`:return oJ(e,r).get(String(Nq(e,t)[e.x.key]));case`scatter`:case`bubble`:return r[Math.max(0,Vq(e).indexOf(Rq(e,t)))];default:return r[pJ(Mq(e),0)]??i}}function lJ(e,t,n,r){let i=uJ(e,t,n,r);return!e.incompleteLast||t!==e.data.length-1?i:{...i,title:`${i.title}, ${Q().soFarText}`}}function uJ(e,t,n,r){let i=Mq(e),a=$(e,i.key,t),o=()=>cJ(e,t,r);switch(e.type){case`donut`:{let r=e.data.reduce((t,r,a)=>t+(n.has(Iq(e,a))?0:$(e,i.key,a)??0),0);return{title:Iq(e,t),rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:Q().shareLabel,value:r&&a!=null?Z(a/r,{style:`percent`}):$G()}],foot:``}}case`heatmap`:return{title:`${Rq(e,t)}, ${Iq(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`calendar`:return{title:Jq(Lq(e,t),e.timeZone),rows:[{color:o(),label:i.label,value:Z(a,i.format)}],foot:``};case`funnel`:{let n=$(e,i.key,0),r=t?$(e,i.key,t-1):null,s=[{color:o(),label:i.label,value:Z(a,i.format)}];return t&&s.push({label:Q().ofPreviousStepLabel,value:Qq(a,r)}),s.push({label:PG(Q().ofFirstStepText,{first:Iq(e,0)}),value:Qq(a,n)}),{title:Iq(e,t),rows:s,foot:``}}case`gauge`:{let{min:n,max:r}=iJ(e),s=a==null?null:nJ(e,a),c=[{color:o(),label:i.label,value:Z(a,i.format)}];return c.push({label:Q().scaleLabel,value:PG(Q().scaleRangeText,{min:Z(n,i.format),max:Z(r,i.format)})}),s&&c.push({label:Q().bandLabel,value:s.label}),{title:e.data[t]?.[e.x.key]==null?i.label:Iq(e,t),rows:c,foot:``}}case`waterfall`:{let n=aJ(e),r=Sq(n[t],`waterfall bar ${t}`),a=Sq(n[0],`waterfall opening bar`).value,s=r.total?[{color:o(),label:i.label,value:Z(r.value,i.format)}]:[{color:o(),label:Q().changeLabel,value:dJ(r.value,i.format)},{label:Q().runningTotalLabel,value:Z(r.level,i.format)}],c=!r.total&&a?PG(Q().openingShareText,{share:dJ(r.value/a*100,{style:`number`,decimals:2},`%`)}):``;return{title:Iq(e,t),rows:s,foot:c}}case`treemap`:{let n=Rq(e,t),r=sJ(e).get(n);return{title:`${n} / ${Iq(e,t)}`,rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:PG(Q().shareOfParentText,{parent:n}),value:Qq(a,r)}],foot:``}}case`sankey`:{let n=String(Nq(e,t)[e.x.key]),r=e.data.reduce((t,r,a)=>String(r[e.x.key])===n?t+($(e,i.key,a)??0):t,0);return{title:PG(Q().scaleRangeText,{min:n,max:zq(e,t)}),rows:[{color:o(),label:i.label,value:Z(a,i.format)},{label:PG(Q().shareOfParentText,{parent:n}),value:Qq(a,r)}],foot:``}}case`scatter`:case`bubble`:{let n=[{color:o(),label:e.x.label||String(e.x.key),value:Iq(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(Nq(e,t)[e.size.key],e.size.format)}),{title:e.group?Rq(e,t):i.label,rows:n,foot:``}}}let s=e.stack===`percent`?qq(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=$(e,n.key,t),o=Z(a,n.format);return{color:e.type===`multiples`?r.palette[0]:r.palette[pJ(n,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){let n=c.reduce((n,{s:r})=>n+($(e,r.key,t)??0),0);u=PG(Q().totalText,{total:Z(n,d.s.format)})}if(e.target&&d&&c.length===1){let n=$(e,d.s.key,t);if(n!=null){let t=n-e.target.value,r=e.target.label||Q().targetLabel;u=PG(Q().targetGapText,{direction:t>=0?Q().aboveLabel:Q().belowLabel,label:r,gap:Z(Math.abs(t),d.s.format)})}}return{title:Iq(e,t),rows:l,foot:u}}function dJ(e,t,n=``){let r=`${Z(Math.abs(e),t)}${n}`;return e>0?`+${r}`:e<0?`−${r}`:r}function fJ(e,t,n){return t===e.otherIndex?n.neutral:n.palette[t%n.palette.length]}function pJ(e,t){return e.colour?Number(e.colour.slice(6))-1:t}function mJ(e){let t=xG(`div`,{class:`wui-chart-tooltip-body`});e.title&&t.append(xG(`div`,{class:`wui-chart-tooltip-title`},e.title));for(let n of e.rows){let e=xG(`div`,{class:`wui-chart-tooltip-row`});if(n.color){let t=document.createElement(`span`);t.className=n.line?`wui-chart-tooltip-swatch wui-chart-tooltip-swatch-line`:`wui-chart-tooltip-swatch`,t.style.background=n.color,e.append(t)}let r=document.createElement(`span`);r.className=`wui-chart-tooltip-label`,r.textContent=n.label;let i=document.createElement(`span`);i.className=`wui-chart-tooltip-value`,i.textContent=n.value,e.append(r,i),t.append(e)}return e.foot&&t.append(xG(`div`,{class:`wui-chart-tooltip-foot`},e.foot)),t}function hJ(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 gJ(e){return e.x.label?e.x.label:{gauge:Q().measureLabel,funnel:Q().stageLabel,waterfall:Q().stepLabel,sankey:Q().fromLabel,scatter:Q().columnXLabel,bubble:Q().columnXLabel}[e.type]??(e.x.kind===`time`?Q().dateLabel:Q().categoryLabel)}function _J(e){let t=e.allData&&e.allData!==e.data?{...e,data:e.allData}:e,n=Mq(t),r=(e,r=n)=>Z($(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=Bq(a.map(e=>Iq(t,e))),n=Vq(t),o=new Map(a.map(e=>[`${Rq(t,e)}\u0000${Iq(t,e)}`,r(e)]));return i([Sq(t.group,`group column`).label||Q().rowLabel,...e],n.map(t=>({head:t,cells:e.map(e=>o.get(`${t}\u0000${e}`)??$G())})))}case`funnel`:{let e=$(t,n.key,0);return i([gJ(t),n.label,Q().ofPreviousStepLabel,PG(Q().ofFirstStepText,{first:Iq(t,0)})],a.map(i=>({head:Iq(t,i),cells:[r(i),i?Qq($(t,n.key,i),$(t,n.key,i-1)):$G(),Qq($(t,n.key,i),e)]})))}case`gauge`:return i([gJ(t),n.label,...t.bands.length?[Q().bandLabel]:[]],a.map(e=>({head:Nq(t,e)[t.x.key]==null?n.label:Iq(t,e),cells:[r(e),...t.bands.length?[rJ(t,$(t,n.key,e))]:[]]})));case`waterfall`:return i([gJ(t),Q().changeLabel,Q().runningTotalLabel],aJ(t).map(e=>({head:Iq(t,e.index),cells:[e.total?$G():dJ(e.value,n.format),Z(e.level,n.format)]})));case`treemap`:{let e=sJ(t);return i([Sq(t.group,`group column`).label||Q().groupLabel,t.x.label||Q().itemLabel,n.label,Q().shareOfGroupLabel],a.map(i=>({head:Rq(t,i),cells:[Iq(t,i),r(i),Qq($(t,n.key,i),e.get(Rq(t,i)))]})))}case`sankey`:return i([gJ(t),Sq(t.to,`to column`).label||Q().toLabel,n.label],a.map(e=>({head:Iq(t,e),cells:[zq(t,e),r(e)]})));case`scatter`:case`bubble`:return i([gJ(t),n.label,...t.size?[t.size.label||t.size.key]:[],...t.group?[t.group.label||Q().groupLabel]:[]],a.map(e=>({head:Iq(t,e),cells:[r(e),...t.size?[Z(Nq(t,e)[t.size.key],t.size.format)]:[],...t.group?[Rq(t,e)]:[]]})))}let o=t.type===`donut`,s=o?t.data.reduce((e,r,i)=>e+($(t,n.key,i)??0),0):0,c=[gJ(t),...t.series.map(e=>e.label)];return o&&c.push(Q().shareLabel),i(c,a.slice(0,500).map(e=>{let i=t.series.map(t=>r(e,t));if(o){let r=$(t,n.key,e);i.push(s&&r!=null?Z(r/s,{style:`percent`}):$G())}return{head:Iq(t,e),cells:i}}),t.data.length)}function vJ(e){switch(e?.style){case`currency`:case`compact`:return e.currency?` (${e.currency})`:``;case`percent`:return` (%)`;case`duration`:return` (${e.unit??`s`})`;default:return``}}function yJ(e,t){return e==null?e:t?.unit===`paise`?Number(_K(e)):t?.style===`percent`?Number((e*100).toPrecision(12)):e}function bJ(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];if(t.x.kind!==`time`)return n;let r=t.x.format?.pattern??`day`;return r===`year`?Fq(OK(n,t.timeZone),t.timeZone,t.financialYearStart):AK(n,{pattern:r,timeZone:t.timeZone})}},i=t.series.map(e=>({head:`${e.label}${vJ(e.format)}`,value:t=>{let n=t[e.key];return yJ(gq(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,Sq(o,`group column`),...i];break;case`treemap`:s=[Sq(o,`group column`),r,...i];break;case`sankey`:{let e=Sq(t.to,`to column`);s=[r,{head:e.label||e.key,value:t=>t[e.key]},...i];break}case`bubble`:{let e=Sq(t.size,`size column`);s=[r,...i,{head:`${e.label||e.key}${vJ(e.format)}`,value:t=>{let n=t[e.key];return yJ(gq(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 xJ(e){return(e?.title??``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)||`chart`}var SJ=(e,t,n)=>{if(!t.length)return null;let r=Yq(t),i=Xq(t);return r===i?PG(Q().constantSpanText,{label:e,lo:Z(r,n)}):PG(Q().rangeSpanText,{label:e,lo:Z(r,n),hi:Z(i,n)})};function CJ(e,t=/* @__PURE__ */ new Set){let n=[];e.description&&n.push(e.description.replace(/\.?\s*$/,`.`));let r=Wq(e);if(r.length&&r.every(e=>t.has(e)))return n.push(Q().everySeriesHiddenText),n.join(` `);let i=e.data.length,a=e.data.map((e,t)=>t).filter(n=>!Kq(e,n,t)),o=Mq(e),s=Zq(e,o.key),c=s.reduce((e,t)=>e+t,0),l=()=>e.data.reduce((t,n,r)=>($(e,o.key,r)??-1/0)>($(e,o.key,t)??-1/0)?r:t,0),u=()=>e.data.reduce((t,n,r)=>($(e,o.key,r)??1/0)<($(e,o.key,t)??1/0)?r:t,0);switch(e.type){case`donut`:{let t=a.reduce((t,n)=>t+($(e,o.key,n)??0),0);if(n.push(FG(Q(),`donutSummaryText`,a.length,{rows:a.length,label:o.label,total:Z(t,o.format)})),a.length&&t){let r=a.reduce((t,n)=>($(e,o.key,n)??-1/0)>($(e,o.key,t)??-1/0)?n:t,Sq(a[0],`first slice`));n.push(PG(Q().donutLargestText,{top:Iq(e,r),share:Z(($(e,o.key,r)??0)/t,{style:`percent`})}))}return n.join(` `)}case`heatmap`:if(n.push(PG(Q().heatmapSummaryText,{label:o.label,group:Sq(e.group,`group column`).label||Q().rowFallbackLabel,x:e.x.label||Q().columnFallbackLabel,n:i})),s.length){let t=l(),r=u();n.push(PG(Q().highestAtLowestAtText,{highValue:wJ(e,t),highGroup:Rq(e,t),high:Iq(e,t),lowValue:wJ(e,r),lowGroup:Rq(e,r),low:Iq(e,r)}))}return n.join(` `);case`calendar`:return n.push(i===1?PG(Q().calendarSummaryTextOne,{label:o.label,n:i}):PG(Q().calendarSummaryTextOther,{label:o.label,n:i,range:i>1?PG(Q().calendarRangeText,{first:Iq(e,0),last:Iq(e,i-1)}):``})),s.length&&n.push(PG(Q().highestLowestText,{maxValue:wJ(e,l()),max:Iq(e,l()),minValue:wJ(e,u()),min:Iq(e,u())})),n.join(` `);case`funnel`:return n.push(PG(Q().funnelSummaryText,{label:o.label,n:i})),i>1&&n.push(PG(Q().funnelStartText,{first:Iq(e,0),firstValue:wJ(e,0),last:Iq(e,i-1),lastValue:wJ(e,i-1),share:Qq($(e,o.key,i-1),$(e,o.key,0))})),n.join(` `);case`gauge`:{let t=$(e,o.key,0),{min:r,max:i}=iJ(e),a=t==null?null:nJ(e,t);return n.push(PG(Q().gaugeSummaryText,{type:GK(`gauge`),label:o.label,value:Z(t,o.format),min:Z(r,o.format),max:Z(i,o.format),band:a?PG(Q().gaugeBandText,{band:a.label}):``})),n.join(` `)}case`waterfall`:{let t=aJ(e);if(n.push(PG(Q().waterfallSummaryText,{label:o.label})),i>1){let r=t.filter(e=>!e.total);n.push(PG(Q().opensAtClosesAtText,{opening:Z(Sq(t[0],`waterfall opening bar`).value,o.format),closing:Z(Sq(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(PG(Q().largestRiseText,{xText:Iq(e,a.index),signed:dJ(a.value,o.format)})),s&&n.push(PG(Q().largestFallText,{xText:Iq(e,s.index),signed:dJ(s.value,o.format)}))}return n.join(` `)}case`treemap`:{let t=sJ(e);if(!t.size)return PG(Q().treemapEmptyText,{label:o.label});let[r,a]=[...t].reduce((e,t)=>t[1]>e[1]?t:e);return n.push(PG(Q().treemapSummaryText,{label:o.label,n:i,totals:t.size,total:Z(c,o.format)})),n.push(PG(Q().treemapLargestGroupText,{name:r,share:Qq(a,c)})),n.join(` `)}case`sankey`:{let t=Sq(e.to,`to column`).key,r=Bq(e.data.flatMap(n=>[String(n[e.x.key]),String(n[t])])),a=l();return n.push(PG(Q().sankeySummaryText,{label:o.label,n:i,nodes:r.length})),n.push(PG(Q().largestFlowText,{xText:Iq(e,a),toText:zq(e,a),fmtAt:wJ(e,a)})),n.join(` `)}case`scatter`:case`bubble`:{let r=Vq(e).filter(e=>!t.has(e));n.push(PG(Q().scatterSummaryText,{type:GK(e.type),label:o.label,xLabel:e.x.label||e.x.key,count:a.length,groups:r.length?FG(Q(),`groupsText`,r.length,{groups:r.join(`, `)}):``}));let i=a.map(t=>Nq(e,t)[e.x.key]).filter(gq),s=a.map(t=>$(e,o.key,t)).filter(e=>e!=null);for(let t of[SJ(e.x.label||String(e.x.key),i,e.x.format),SJ(o.label,s,o.format)])t&&n.push(t);return n.join(` `)}}let d=e.stack===`percent`?Q().stackedPercentText:e.stack===`stacked`?Q().stackedText:``,f=e.series.filter(e=>!t.has(e.key));n.push(PG(Q().summaryText,{type:GK(e.type),series:f.map(e=>e.label).join(`, `),stacked:d,sharedAxis:e.type===`multiples`?Q().sharedAxisText:``})),i&&n.push(i===1?PG(Q().pointsSummaryTextOne,{n:i,first:Iq(e,0)}):PG(Q().pointsSummaryTextOther,{n:i,first:Iq(e,0),last:Iq(e,i-1)}));for(let t of f){let r=SJ(t.label,Zq(e,t.key),t.format);r&&n.push(r)}return n.join(` `)}var wJ=(e,t)=>{let n=Mq(e);return Z($(e,n.key,t),n.format)};function TJ(e){return e.stack===`percent`?{style:`percent`,decimals:0}:MK(e.y.format)}var EJ=864e5,DJ={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},OJ=e=>DJ[e]??0,kJ=[`donut`,`funnel`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`];function AJ(e,t){let n=e.data.map((e,t)=>t).filter(n=>!Kq(e,n,t));if(e.type!==`scatter`&&e.type!==`bubble`)return n;let r=t=>$(e,e.x.key,t)??0;return n.sort((e,t)=>r(e)-r(t)||e-t)}function jJ(e){let t=Bq(e.data.map((t,n)=>Iq(e,n))),n=Vq(e),r=new Map(e.data.map((r,i)=>[`${t.indexOf(Iq(e,i))},${n.indexOf(Rq(e,i))}`,i]));return{columns:t.length,rows:n.length,at:r,position:r=>[t.indexOf(Iq(e,r)),n.indexOf(Rq(e,r))]}}function MJ(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 DJ||n===`Home`||n===`End`?{index:0,series:0}:t;if(e.type===`heatmap`||e.type===`calendar`)return NJ(e,t,n);let a=kJ.includes(e.type),o=e.series.map((e,t)=>r.has(e.key)?-1:t).filter(e=>e>=0),s=a?AJ(e,r):[];if(a?!s.length:!o.length)return t;let c=t??{index:a?Sq(s[0],`first mark`):0,series:a?0:Sq(o[0],`first visible series`)};if(t==null&&n in DJ)return c;if(a){let e=Math.max(0,s.indexOf(c.index));return n===`Home`?{index:Sq(s[0],`first mark`),series:0}:n===`End`?{index:Sq(s[s.length-1],`last mark`),series:0}:n in DJ?{index:Sq(s[(e+OJ(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 DJ))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+OJ(n)))};let l=Math.max(0,o.indexOf(c.series)),u=e.type===`bar`?OJ(n):-OJ(n);return{...c,series:Sq(o[Math.min(o.length-1,Math.max(0,l+u))],`series`)}}function NJ(e,t,n){let r=e.data.length,i=e.type===`calendar`,a=i?e.data.map((e,t)=>t).sort((t,n)=>Lq(e,t)-Lq(e,n)):[],o=i?null:jJ(e),s=t??{index:i?Sq(a[0],`first day`):0,series:0};if(t==null&&n in DJ)return s;if(n===`Home`)return{index:i?Sq(a[0],`first day`):0,series:0};if(n===`End`)return{index:i?Sq(a[r-1],`last day`):r-1,series:0};if(!(n in DJ))return t;if(i){let t=n===`ArrowDown`||n===`ArrowUp`?OJ(n):OJ(n)*7,r=t=>{let n=Lq(e,t);return Math.floor((n+KG(n,e.timeZone))/EJ)},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`?[OJ(n),0]:[0,OJ(n)];return{index:o.at.get(`${c+u},${l+d}`)??s.index,series:0}}var PJ=()=>OG(`chart`,NK);Rj([fx,nT,QT,DL,RI,DI,ZF,bL,QM,qR,_B,wV,QB,vz,ez,OH,tH,TB,fU,zH,WW,mG]);function FJ(e){let t=e.series[0];if(!t)throw Error(`chart spec has no series`);return t}var IJ=e=>typeof e==`number`;function LJ(e,t){let n=e.data[t];if(!n)throw Error(`chart row ${t} missing`);return n}function RJ(e){if(!e.to)throw Error("chart spec has no `to` column");return e.to.key}function zJ(e){if(!e.size)throw Error("chart spec has no `size` column");return e.size.key}function BJ(e,t,n){let r=e[t];if(!r)throw Error(`percent shares for row ${t} missing`);return r[n]??null}function VJ(e,t,n){let r=e?.[t];if(!r)throw Error(`bar radii for row ${t} missing`);return r[n]}var HJ=e=>IJ(e)?e:null;function UJ(e){return typeof e==`object`&&e&&`row`in e?HJ(e.row):null}function WJ(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 IJ(n)&&Number.isFinite(n)&&IJ(r)&&Number.isFinite(r)?{start:n,end:r}:null}function GJ(e){if(!e)throw Error(`chart has not been drawn`);return e}var KJ=[`series`,`graphic`,`grid`,`xAxis`,`yAxis`,`title`,`visualMap`,`calendar`,`dataZoom`],qJ=e=>String(e).replace(/[{}]/g,e=>e===`{`?`{`:`}`);function JJ(e){return e.wholeNumbers===!0||e.format?.style===`currency`&&e.format.unit===`paise`}function YJ(e,t,n,r,i=!1){let a=MK(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)]},ZJ=24,QJ=4,$J=.6,eY=(e,t)=>String(e).length*t*$J,tY=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`chart palette has no colour at slot ${t}`);return n};function nY(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 rY(e,t){let n=nY(e);return n?`rgba(${n.join(`,`)},${t})`:String(e??``).trim()}function iY(e,t,n){let r=nY(e),i=nY(t);return r&&i?`rgb(${r.map((e,t)=>Math.round(e+((i[t]??0)-e)*n)).join(`,`)})`:e}var aY=[.2126,.7152,.0722],oY=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*(aY[n]??0),0),sY=(e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05);function cY(e,t){let n=nY(e),r=nY(t.text),i=nY(t.surface);return!n||!r||!i||sY(oY(n),oY(r))>=sY(oY(n),oY(i))?t.text:t.surface}var lY=(e,t)=>({type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:rY(e,t)},{offset:1,color:rY(e,0)}]}),uY=(e,t)=>e+KG(e,t);function dY(e){let t=e.x.format?.pattern;return n=>{let r=qG(n,e.timeZone);if(t===`month`)return AK(r,{pattern:t,timeZone:e.timeZone});if(t===`year`)return Fq(r,e.timeZone,e.financialYearStart);let i=GG(r,e.timeZone);return i.hour||i.minute?AK(r,{pattern:`time`,timeZone:e.timeZone}):jK(r,{timeZone:e.timeZone})}}function fY(e,t,n){let r=QJ,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(($(e,t.key,r)??0)<0);return a}let o=null,s=null;for(let n of e.series){let i=$(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 pY(e,t,n,r){let i=n.width<576,a=r.animation!==!1&&!t.reducedMotion&&Hq(e)<=5e3,o=Wq(e),s=Object.fromEntries(o.map(e=>[e,!r.hidden.has(e)])),c={palette:t.palette,neutral:t.neutral,rise:t.rise,fall:t.fall,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=oX[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`?qq(e,r.hidden):null,g=p||e.type===`column`?fY(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)=>$(e,t.key,r))),!0),x=e.stack===`percent`?TJ(e):YJ(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)=>Iq(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=>eY(Z(e,x),12)))-20},D=!1;if(e.valueLabels){let t=e.data.length>RY?E():LY(T.length,E()),r=p?n.width-DY(T.map(e=>eY(e,12)))-20:e.type===`line`?t:LY(T.length,E())/Math.max(1,w.length);D=w.flatMap(t=>e.type===`line`?[...zY(e,t.key)].map(n=>$(e,t.key,n)):e.data.map((n,r)=>$(e,t.key,r))).filter(e=>e!=null).every(e=>eY(Z(e,x),12)<=r)}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}:VY(e.x.labelFit,T,E()),...m?{formatter:dY(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:JJ(e.y)?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&&!e.valueLabels,M=e.series.map((n,r)=>{let o=tY(t.palette,pJ(n,r)%t.palette.length),s=e.data.some((t,r)=>$(e,n.key,r)!=null&&$(e,n.key,r-1)==null&&$(e,n.key,r+1)==null),c=t=>{let r=$(e,n.key,t),i=h?BJ(h,t,n.key):r;return m?[uY(Lq(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 i=e.type===`area`?_||e.stack!==`none`?t.dark?.34:.22:.1:0,u=e.valueLabels?zY(e,n.key):null;return{...l,type:`line`,data:e.data.map((e,t)=>c(t)),smooth:.35,smoothMonotone:`x`,connectNulls:!1,symbol:`circle`,showSymbol:s||e.valueLabels,label:e.valueLabels?{show:D,position:`top`,distance:6,fontFamily:t.font,fontSize:12,fontWeight:600,color:t.text,formatter:e=>e.value==null||!u?.has(e.dataIndex)?``:Z(Array.isArray(e.value)?e.value[1]:e.value,x)}:void 0,symbolSize:8,sampling:v?`lttb`:void 0,lineStyle:{width:2,color:o,..._&&!v?{shadowColor:rY(o,.35),shadowBlur:10,shadowOffsetY:6}:{}},itemStyle:{color:o,borderColor:t.surface,borderWidth:2},areaStyle:i?{color:lY(o,i)}: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?mY(e,t,!1,a):void 0}}return{...l,type:`bar`,barMaxWidth:ZJ,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((t,r)=>({value:c(r),itemStyle:{borderRadius:VJ(g,r,n.key),...e.incompleteLast&&r===e.data.length-1?{opacity:.45,borderType:`dashed`,borderWidth:1.5,borderColor:o}:{}}})),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?mY(e,t,p,a):void 0}}),ee=e.data.length-1;if(e.incompleteLast&&e.stack===`none`&&ee>=1&&(e.type===`line`||e.type===`area`))for(let n of e.series){let r=t=>m?[uY(Lq(e,t),e.timeZone),$(e,n.key,t)]:$(e,n.key,t);M.push({id:`${n.key}:so-far`,name:`${n.key}:so-far`,type:`line`,silent:!0,tooltip:{show:!1},symbol:`none`,smooth:.35,smoothMonotone:`x`,connectNulls:!1,data:e.data.map((e,t)=>t>=ee-1?r(t):null),lineStyle:{width:2.5,color:t.surface,type:`dashed`}})}return{...u,useUTC:m,grid:{left:4,right:j?64:i?8:16,top:e.y.label?28:D&&(e.type===`column`||e.type===`line`)?24:12,bottom:A?44:4,outerBoundsMode:`same`},dataZoom:A?rX(e,t,tY(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:rY(t.neutral,t.dark?.12:.1)}},formatter:t=>mJ(lJ(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,c))},xAxis:p?k:O,yAxis:p?O:k,series:M}}function mY(e,t,n,r){if(!e.target)return;let i=FJ(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 hY(e,t,n,r,i){let{base:a,tooltipBase:o,colours:s,compact:c}=i,l=FJ(e),u=e.data.map((t,n)=>Iq(e,n)),d=e.data.reduce((t,n,i)=>t+(r.hidden.has(Iq(e,i))?0:$(e,l.key,i)??0),0);return{...a,tooltip:{...o,trigger:`item`,formatter:t=>mJ(lJ(e,t.dataIndex,r.hidden,s))},graphic:[{type:`group`,left:`center`,top:`middle`,silent:!0,children:[{type:`text`,style:{text:Z(d,MK(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||PJ().centerLabel,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:e.sliceValues?{show:!0,position:`outside`,color:t.label,fontFamily:t.font,fontSize:12,lineHeight:16,formatter:e=>`${e.name}\n${Z(Number(e.value),l.format)} (${Z(e.percent/100,{style:`percent`,decimals:0})})`}: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:!e.sliceValues},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:$(e,l.key,n)??0,itemStyle:{color:fJ(e,n,s)}}))}]}}var gY=e=>[...new Set(e)],_Y=(e,t)=>e.data.map((n,r)=>$(e,t,r));function vY(e,t){return{...e,trigger:`item`,formatter:e=>t(e)}}var yY=(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}),bY=(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 xY(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:[PJ().moreLabel,PJ().lessLabel],textGap:8,selectedMode:!1,textStyle:{color:e.label,fontSize:12,fontFamily:e.font},...n}}function SY(e,t,n,r,i){let a=FJ(e),o=gY(e.data.map((t,n)=>Iq(e,n))),s=Vq(e),c=$q(_Y(e,a.key),t.seq);return{...i.base,grid:{left:4,right:4,top:8,bottom:40,outerBoundsMode:`same`},tooltip:vY(i.tooltipBase,t=>mJ(lJ(e,t.dataIndex,r.hidden,i.colours))),xAxis:yY(t,o,{axisLine:{show:!1},splitArea:{show:!1}}),yAxis:yY(t,s,{inverse:!0,axisLine:{show:!1}}),visualMap:xY(t,c),series:[{type:`heatmap`,data:e.data.map((t,n)=>[o.indexOf(Iq(e,n)),s.indexOf(Rq(e,n)),$(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 CY=6048e5,wY=(e,t)=>{let n=GG(e,t);return`${n.year}-${String(n.month+1).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`};function TY(e,t){let n=e.data.map((t,n)=>Lq(e,n)).filter(Number.isFinite),r=EY(n),i=DY(n),a=Math.ceil((i-r)/CY)+1,o=Math.floor((t.height-62)/7),s=Math.max(OY,Math.min(kY,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)*CY:r,to:i}}var EY=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.min(t,e),1/0),DY=e=>e.reduce((e,t)=>Number.isNaN(t)?e:Math.max(t,e),-1/0),OY=9,kY=24;function AY(e,t,n,r,i){let a=FJ(e),{cell:o,from:s,to:c}=TY(e,n),l=$q(_Y(e,a.key),t.seq);return{...i.base,tooltip:vY(i.tooltipBase,t=>mJ(lJ(e,t.dataIndex,r.hidden,i.colours))),visualMap:xY(t,l,{right:4}),calendar:{range:[wY(s,e.timeZone),wY(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:[``,aK(1,`short`),``,aK(3,`short`),``,aK(5,`short`),``],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)=>[wY(Lq(e,n),e.timeZone),$(e,a.key,n)??`-`]),itemStyle:{borderRadius:3,borderColor:t.surface,borderWidth:2},emphasis:{itemStyle:{borderColor:t.text,borderWidth:1.5}}}]}}function jY(e,t,n,r,i){let a=FJ(e),o=tJ(e.data.length,t.seq),s=$(e,a.key,0);return{...i.base,tooltip:vY(i.tooltipBase,t=>mJ(lJ(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=cY(o[r],t),c=$(e,a.key,r),l=r?PG(PJ().funnelPreviousStepText,{share:Qq(c,$(e,a.key,r-1))}):PG(PJ().shareOfStepText,{share:Qq(c,s),first:qJ(Iq(e,0))});return{name:Iq(e,r),value:c??0,itemStyle:{color:o[r]},label:{formatter:`{n|${qJ(Iq(e,r))}} {v|${qJ(Z(c,a.format))}}\n{p|${r?l:PJ().firstStageLabel}}`,rich:{n:{color:i,fontSize:12.5,fontWeight:500,fontFamily:t.font},v:{color:i,fontSize:13,fontWeight:700,fontFamily:t.font},p:{color:rY(i,.78),fontSize:12,fontFamily:t.font}}}}})}]}}function MY(e,t,n,r,i){let a=FJ(e),{min:o,max:s}=iJ(e),c=$(e,a.key,0),l=c??o,u=c==null?null:nJ(e,c),d=tY(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:vY(i.tooltipBase,()=>mJ(lJ(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:rY(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|${qJ(c==null?Z(null):Z(e,a.format))}}{u|/${qJ(Z(s,a.format))}}${u?`\n{s|${qJ(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:Iq(e,0)}]}]}}function NY(e){let t=DY(e.map(e=>e.level).concat(e.map(e=>e.from),e.map(e=>e.to))),n=EY(e.filter(e=>!e.total).map(e=>Math.min(e.from,e.to)).concat(e.filter(e=>e.total).map(e=>e.value))),r=DY(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 PY=4,FY=72,IY=12,LY=(e,t)=>Math.floor(t/Math.max(1,e)-PY),RY=12;function zY(e,t){let n=e.data.map((e,t)=>t).filter(n=>$(e,t,n)!=null);if(e.data.length<=RY||!n.length)return new Set(n);let r=n=>$(e,t,n)??0,i=n.reduce((e,t)=>r(t)>r(e)?t:e),a=n.reduce((e,t)=>r(t)<r(e)?t:e);return new Set([n[0],n[n.length-1],i,a].filter(IJ))}function BY(e,t){return DY(e.flatMap(e=>String(e).split(/\s+/)).map(e=>eY(e,IY)))<=t?{interval:0,width:t,overflow:`break`}:{interval:0,rotate:45,width:FY,overflow:`truncate`}}function VY(e,t,n){let r=LY(t.length,n);return e===`all`?{...BY(t,r),hideOverlap:!1}:e===`rotate`?{interval:0,rotate:45,width:FY,overflow:`truncate`,hideOverlap:!1}:e===`ellipsis`?{interval:0,rotate:0,width:Math.max(1,r),overflow:`truncate`,hideOverlap:!1}:{hideOverlap:!0}}function HY(e,t,n){let r=LY(e.length,n),i=BY(e,r);return{nameSize:IY,valueSize:12,category:`rotate`in i?{...i,hideOverlap:!0}:i,showValues:t.every(e=>eY(e,12)<=r)}}function UY(e,t,n,r,i){let a=FJ(e),o=aJ(e),s=TJ(e),c=NY(o),l=t=>cJ(e,t.index,i.colours),u=o.map(t=>Iq(e,t.index)),d=o.map(e=>e.total?Z(e.value,s):dJ(e.value,s)),f=o.flatMap(e=>[e.from,e.to]),p=Math.max(eY(Z(DY(f),s),11),eY(Z(EY(f),s),11))+8,m=HY(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:rY(t.neutral,.1)}},formatter:t=>mJ(lJ(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:yY(t,u,{axisLabel:{color:t.label,fontSize:m.nameSize,margin:12,...m.category}}),yAxis:bY(t,e=>Z(e,s),{min:0,minInterval:JJ(e.y)?1:void 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 WY(e){let t=FJ(e).key;return Vq(e).map(n=>({name:n,rows:e.data.map((e,t)=>t).filter(t=>Rq(e,t)===n).sort((n,r)=>($(e,t,r)??0)-($(e,t,n)??0)||n-r)}))}function GY(e,t,n,r,i){let a=FJ(e),o=sJ(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(eY(t[0],12),eY(t[1],11.5))+20<=Math.sqrt(r)},l=WY(e).map(({name:n,rows:r},i)=>{let s=o.get(n),l=tY(t.palette,i%t.palette.length),u=cY(l,t);return{name:n,value:s,itemStyle:{color:l,borderColor:l},upperLabel:{color:u,formatter:`{n|${qJ(n)}} {v|${qJ(Z(s,a.format))}}`,rich:{n:{fontWeight:600,fontSize:12,color:u,fontFamily:t.font},v:{fontSize:12,color:rY(u,.8),fontFamily:t.font}}},children:r.map((n,r)=>{let i=iY(l,t.surface,Math.min(.55,r*.14)),o=cY(i,t),s=$(e,a.key,n);return{name:Iq(e,n),value:s,row:n,itemStyle:{color:i},label:{show:c(s,[Iq(e,n),Z(s,a.format)]),formatter:`{n|${qJ(Iq(e,n))}}\n{v|${qJ(Z(s,a.format))}}`,rich:{n:{color:o,fontSize:12,fontWeight:500,fontFamily:t.font,lineHeight:16},v:{color:rY(o,.82),fontSize:12,fontFamily:t.font}}}}})}});return{...i.base,tooltip:vY(i.tooltipBase,t=>t.data?.row==null?mJ({title:t.name,rows:[{color:t.color,label:a.label,value:Z(t.value,a.format)},{label:PJ().shareOfAllLabel,value:Qq(HJ(t.value),s)}],foot:``}):mJ(lJ(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 KY(e){let t=RJ(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 qY(e,t,n,r,i){let a=FJ(e),o=RJ(e),s=oJ(e,t.palette),c=KY(e),l=DY([...c.values()]),u=/* @__PURE__ */ new Map,d=/* @__PURE__ */ new Map;e.data.forEach((t,n)=>{let r=$(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|${qJ(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:vY(i.tooltipBase,t=>mJ(t.dataType===`edge`?lJ(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 JY(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=EY(e.map(e=>e[1])),s=DY(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(EY(e.map(e=>e[0]))),c(DY(e.map(e=>e[0])))]}var YY=44,XY=28,ZY=8;function QY(e,t,n,r,i){let a=FJ(e),o=Vq(e),s=e.type===`bubble`,c=DY(s?e.data.map(t=>t[zJ(e)]).filter(IJ):[]),l=e=>Math.max(ZY,(i.compact?XY:YY)*Math.sqrt(e/c)),u=t=>e.data.map((e,t)=>t).filter(n=>!e.group||Rq(e,n)===t),d=(e.group?o:[null]).filter(e=>e==null||!r.hidden.has(e)).flatMap(e=>u(e)),f=e.trend?JY(d.flatMap(t=>{let n=LJ(e,t)[e.x.key],r=$(e,a.key,t);return IJ(n)&&r!=null?[[n,r]]:[]})):null,p=e.data.map(t=>t[e.x.key]),m=e.data.map((t,n)=>$(e,a.key,n)),[h,g]=XJ(p,!1),[_,v]=XJ(m,!1),y=YJ(e.y.format,e.y.min??_,e.y.max??v,4),b=YJ(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:rY(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],$(e,a.key,t),...s?[LJ(e,t)[zJ(e)]]:[]],row:t}))}));return f&&x.push({name:PJ().trendLabel,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:PJ().trendLabel,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:vY(i.tooltipBase,t=>t.data?.row==null?``:mJ(lJ(e,t.data.row,r.hidden,i.colours))),xAxis:bY(t,e=>Z(e,b),{scale:!0,minInterval:JJ(e.x)?1:void 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:bY(t,e=>Z(e,y),{min:e.y.min,max:e.y.max,minInterval:JJ(e.y)?1:void 0,...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 $Y=32,eX=8,tX=26;function nX(e,t,n,r,i){let a=e.x.kind===`time`,o=e.series.length,s=(n.height-6-tX)/o,c=s-$Y-eX,l=tY(t.palette,0),u=e.data.map((t,n)=>Iq(e,n)),d=e.series.flatMap((n,r)=>{let i=_Y(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:PG(PJ().latestText,{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=$(e,t.key,n);return a?[uY(Lq(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+$Y,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=>mJ(lJ(e,(Array.isArray(t)?t:[t])[0]?.dataIndex??0,r.hidden,i.colours))},xAxis:e.series.map((n,r)=>({...a?{type:`time`}:yY(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:dY(e)}:{}}})),yAxis:e.series.map((n,r)=>{let[i,a]=XJ(_Y(e,n.key),!1),o=YJ(n.format,e.y.min??i,e.y.max??a,2);return bY(t,e=>Z(e,o),{gridIndex:r,splitNumber:2,scale:e.y.min==null,min:e.y.min,max:e.y.max,minInterval:JJ(n)?1:void 0,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:lY(l,t.dark?.26:.16)},animationDelay:i.animate?r*160:0,emphasis:{disabled:!0}}))}}function rX(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:rY(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:rY(t.neutral,.15)}},selectedDataBackground:{lineStyle:{color:n,width:.75},areaStyle:{color:rY(n,.18)}},textStyle:{color:t.label,fontSize:12,fontFamily:t.font}}]}function iX(e,t,n){switch(e.type){case`scatter`:case`bubble`:{if(!e.group)return{seriesIndex:0,dataIndex:n};let t=Rq(e,n),r=e.data.map((e,t)=>t).filter(n=>Rq(e,n)===t);return{seriesIndex:Vq(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 WY(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 aX(e,t){switch(e.type){case`scatter`:case`bubble`:case`treemap`:{let e=UJ(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 oX={donut:hY,heatmap:SY,calendar:AY,funnel:jY,gauge:MY,waterfall:UY,treemap:GY,sankey:qY,scatter:QY,bubble:QY,multiples:nX};function sX(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=vj(a,null,{renderer:`canvas`,devicePixelRatio:i,width:n.width,height:n.height});try{return o.setOption(pY(e,t,n,{...r,renderer:`canvas`,animation:!1})),o.getDataURL({type:`png`,pixelRatio:i,backgroundColor:t.surface})}finally{o.dispose(),a.remove()}}function cX(e,{renderer:t}){let n=vj(e,null,{renderer:t}),r=!1,i=null;return{renderer:t,render(e,t,a,o,{replace:s=!1}={}){let c=r&&!s?WJ(n.getOption()):null,l=pY(e,t,a,{...o,zoom:c});i=e,n.setOption(l,s||!r?{notMerge:!0}:{replaceMerge:KJ}),r=!0},focusPoint(e,t){let{tip:r=!0,...a}=iX(GJ(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()},flush(){n.getZr().flush()},onSelect(e){n.on(`click`,t=>{if(t.componentType!==`series`)return;let n=aX(GJ(i),t);n&&e({seriesIndex:n.series,dataIndex:n.row})})},onFinished(e){n.on(`finished`,e)},dispose(){n.dispose()}}}var lX=`@webority/ui-elements needs a browser DOM; import its types or helpers entry on the server`;if(typeof HTMLElement>`u`)throw Error(lX);var uX=HTMLElement,dX=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0;function fX(e){return e.isComposing||e.keyCode===229}function pX(e){return e.key===`Enter`&&!fX(e)}function mX(e){return getComputedStyle(e).direction===`rtl`}function hX(e,t){return t?e===`ArrowRight`?`ArrowLeft`:e===`ArrowLeft`?`ArrowRight`:e:e}function gX(e){"@babel/helpers - typeof";return gX=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},gX(e)}function _X(e,t){if(gX(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(gX(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function vX(e){var t=_X(e,`string`);return gX(t)==`symbol`?t:t+``}function yX(e,t,n){return(t=vX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var bX=()=>OG(`chart`,NK),xX=`wui-chart:select`,SX=`wui-chart:legend-change`,CX=`wui-chart:ready`,wX=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`Escape`],TX=`(prefers-color-scheme: dark)`,EX=`(prefers-reduced-motion: reduce)`,DX=`(forced-colors: active)`,OX=`(prefers-contrast: more)`,kX=`print`,AX=e=>typeof window.matchMedia==`function`?window.matchMedia(e):null,jX=!1,MX=/* @__PURE__ */ new Map;function NX(e,t){let n=[...new Set(t)].filter(e=>e&&!MX.has(e));if(!n.length)return;let r=document.createElement(`span`);r.hidden=!0;let i=n.map(e=>{let t=document.createElement(`span`);return t.style.setProperty(`forced-color-adjust`,`none`),t.style.color=e,r.append(t),[e,t]});e.append(r);for(let[e,t]of i)MX.set(e,getComputedStyle(t).color);r.remove()}var PX=[...[1,2,3,4,5,6,7,8].map(e=>`--color-chart-${e}`),...[0,1,2,3,4,5,6].map(e=>`--color-chart-seq-${e}`),`--color-chart-neutral`,`--wui-chart-rise`,`--wui-chart-fall`,`--color-chart-grid`,`--color-chart-axis`,`--color-chart-label`,`--color-surface`,`--color-text`,`--color-text-body`,`--color-text-muted`];function FX(e){let t=getComputedStyle(e),n=!!AX(DX)?.matches,r=e=>t.getPropertyValue(e).trim();n&&NX(e,PX.map(r));let i=e=>n?MX.get(r(e))??r(e):r(e),a=e.closest(`[data-bs-theme], [data-theme]`)??document.documentElement,o=a.getAttribute(`data-bs-theme`)||a.getAttribute(`data-theme`),s={palette:[1,2,3,4,5,6,7,8].map(e=>i(`--color-chart-${e}`)),seq:[0,1,2,3,4,5,6].map(e=>i(`--color-chart-seq-${e}`)),neutral:i(`--color-chart-neutral`),rise:i(`--wui-chart-rise`),fall:i(`--wui-chart-fall`),grid:i(`--color-chart-grid`),axis:i(`--color-chart-axis`),label:i(`--color-chart-label`),surface:i(`--color-surface`),text:i(`--color-text`),textBody:i(`--color-text-body`),textMuted:i(`--color-text-muted`),shadow:r(`--wui-shadow-popover`),font:t.fontFamily,dark:o===`dark`||o===`auto`&&!!AX(TX)?.matches,reducedMotion:!!AX(EX)?.matches};return!s.palette[0]&&!jX&&(jX=!0,vG(`[@webority/ui-elements] <wui-chart> found no --color-chart-* colours: load @webority/theme on the page.`)),s}var IX=/* @__PURE__ */ new Set,LX=null;function RX(e){if(IX.add(e),LX)return;let t=()=>{MX.clear();for(let e of IX)e._themeChanged()},n=()=>{MX.clear();for(let e of IX)e._themeChanged(!0)},r=new MutationObserver(t);r.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-bs-theme`,`class`]});let i=new MutationObserver(t);i.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:[`data-theme`,`data-bs-theme`]});let a=[[TX,t],[EX,t],[DX,t],[OX,t],[kX,n]],o=[];for(let[e,t]of a){let n=AX(e);n&&o.push([n,t])}for(let[e,t]of o)e.addEventListener?.(`change`,t);window.addEventListener(`beforeprint`,n),window.addEventListener(`afterprint`,t),LX=()=>{r.disconnect(),i.disconnect();for(let[e,t]of o)e.removeEventListener?.(`change`,t);window.removeEventListener(`beforeprint`,n),window.removeEventListener(`afterprint`,t),LX=null}}function zX(e){IX.delete(e),IX.size||LX?.()}function BX(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.append(n),n.click(),n.remove()}var VX=0,HX=class extends uX{static get observedAttributes(){return[`view`]}constructor(){super(),yX(this,`uid`,void 0),yX(this,`_spec`,void 0),yX(this,`_normal`,void 0),yX(this,`_hidden`,void 0),yX(this,`_focus`,void 0),yX(this,`_awaitingSpec`,!1),yX(this,`_parts`,null),yX(this,`_theme`,null),yX(this,`_width`,null),yX(this,`_visible`,!1),yX(this,`_resizeObserver`,null),yX(this,`_intersection`,null),yX(this,`_engine`,null),yX(this,`_drawn`,!1),yX(this,`_drawnType`,null),yX(this,`_announcedReady`,!1),yX(this,`_legendSignature`,null),yX(this,`_tableSpec`,null),VX+=1,this.uid=`wui-chart-${VX}`,this._spec=null,this._normal=null,this._hidden=/* @__PURE__ */ 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(dX(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(),RX(this),this._theme=FX(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(){zX(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&&(wq(`view`,n,BK),this._update())}toCsv(){let{spec:e}=this._normalized();return e?bJ(e):``}toPng(){let{spec:e}=this._normalized();return e?sX(e,this._theme??FX(this),this._size(e),{hidden:this._hidden,renderer:Uq(e)}):``}exportCsv(e){let t=URL.createObjectURL(new Blob([this.toCsv()],{type:`text/csv;charset=utf-8`}));BX(t,e??`${xJ(this._normalized().spec)}.csv`),setTimeout(()=>URL.revokeObjectURL(t),2e3)}exportPng(e){let t=this.toPng();t&&BX(t,e??`${xJ(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 yG(`[@webority/ui-elements] <wui-chart> could not read its JSON spec:`,e instanceof Error?e.message:void 0),null}}_normalized(){return this._normal??=Oq(this._spec),this._normal}_build(){let e=xG(`div`,{class:`wui-chart-legend`});e.setAttribute(`role`,`group`),e.setAttribute(`aria-label`,bX().legendLabel),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=xG(`div`,{class:`wui-chart-surface`});t.tabIndex=0,t.setAttribute(`role`,`group`),t.setAttribute(`aria-roledescription`,bX().chartLabel),t.addEventListener(`keydown`,e=>this._onKey(e)),t.addEventListener(`blur`,()=>this._clearFocus());let n=xG(`div`,{class:`wui-chart-canvas`});n.setAttribute(`aria-hidden`,`true`),t.append(n);let r=xG(`div`,{class:`wui-chart-state`});r.setAttribute(`role`,`status`),r.hidden=!0;let i=xG(`div`,{class:`wui-chart-table-wrap visually-hidden`}),a=xG(`p`,{class:`visually-hidden`});a.id=`${this.uid}-summary`;let o=xG(`div`,{class:`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||!Pq(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||bX().untitledLabel),r===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`),this.setAttribute(`data-state`,r),n.surface.setAttribute(`aria-label`,PG(bX().arrowKeysText,{title:e?.title||bX().untitledLabel})),n.summary.textContent=e?CJ(e,this._hidden):``,e){if(!s){let t=new Set(Wq(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??bX().loadingText: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||bX().untitledLabel} ${bX().dataSuffixLabel}`)):(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(xG(`div`,{class:`skeleton wui-chart-skeleton`}),xG(`span`,{class:`visually-hidden`},t)):i.replaceChildren(xG(`p`,{class:`wui-chart-state-text`},t))):i.replaceChildren()}_colour(e,t){let n=this._theme;if(!n)return;if(e.type===`donut`)return cJ(e,t,n);let r=e.series[t],i=e.type===`line`||e.type===`area`||e.type===`column`||e.type===`bar`;return n.palette[r&&i?pJ(r,t):t]}_renderLegend(e,t){let n=this._parts?.legend;if(!n)return;let r=e?Wq(e):[],i=!!e&&t&&r.length>=2;if(n.hidden=!i,!e||!i)return;let a=Gq(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=xG(`button`,{class:`wui-chart-legend-item`});r.type=`button`,r.dataset.key=t;let i=xG(`span`,{class: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,xG(`span`,{class:`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=_J(e),n=xG(`table`,{class:`wui-chart-table`});n.append(xG(`caption`,{class:`visually-hidden`},t.caption));let r=xG(`tr`);t.head.forEach((e,t)=>{let n=xG(`th`,t?{class:`wui-chart-num`}:null,e);n.scope=`col`,r.append(n)});let i=xG(`thead`);i.append(r),n.append(i);let a=xG(`tbody`);for(let e of t.rows){let t=xG(`tr`),n=xG(`th`,null,e.head);n.scope=`row`,t.append(n,...e.cells.map(e=>xG(`td`,{class:`wui-chart-num`},e))),a.append(t)}n.append(a);let o=[n];t.truncated&&o.push(xG(`p`,{class:`wui-chart-table-note`},PG(bX().showingFirstRowsDownloadText,{rows:t.rows.length,total:t.total}))),this._parts.tableWrap.replaceChildren(...o)}_draw(){let{spec:e}=this._normalized();if(!e||!this._parts||!this._theme)return;let t=Uq(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=cX(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(CX,{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(e=!1){if(!this._parts)return;let t=FX(this);JSON.stringify(t)!==JSON.stringify(this._theme)&&(this._theme=t,this._update(),e&&this._engine?.flush())}_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(Wq(t).map(e=>[e,!this._hidden.has(e)]));this.dispatchEvent(new CustomEvent(SX,{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(pX(e)){if(!this._focus)return;e.preventDefault(),this._select(this._focus.series,this._focus.index);return}if(!wX.includes(e.key)||e.key===`Escape`&&!this._focus)return;e.preventDefault();let n=MJ(t,this._focus,hX(e.key,mX(this)),this._hidden);n?(this._focus=n,this._engine.focusPoint(n.series,n.index),this._announce(hJ(lJ(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[qK(n.type)?0:e];if(!r)return;let i=n.data[t]??null;this.dispatchEvent(new CustomEvent(xX,{bubbles:!0,detail:{series:r.key,label:r.label,x:i?.[n.x.key]??null,value:$(n,r.key,t),row:i,index:t}}))}};n(`wui-chart`,HX);export{zK as CHART_STATES,FK as CHART_TYPES,BK as CHART_VIEWS,HK as MAX_SERIES,UK as MAX_SLICES,RK as RENDERERS,IK as STACK_MODES,HX as WuiChart,LK as X_KINDS,Z as formatValue,Oq as normalizeSpec};