billboard.js 4.1.1 → 4.1.2

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 (220) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +4 -3
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +3 -3
  5. package/dist/billboard.pkgd.js +4 -3
  6. package/dist/billboard.pkgd.min.js +3 -3
  7. package/dist/billboard.react.js +1 -1
  8. package/dist/billboard.react.min.js +1 -1
  9. package/dist/billboard.worker.js +1 -1
  10. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  17. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  18. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  19. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2 -2
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2 -2
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  30. package/dist/theme/dark.css +1 -1
  31. package/dist/theme/dark.min.css +1 -1
  32. package/dist/theme/datalab.css +1 -1
  33. package/dist/theme/datalab.min.css +1 -1
  34. package/dist/theme/graph.css +1 -1
  35. package/dist/theme/graph.min.css +1 -1
  36. package/dist/theme/insight.css +1 -1
  37. package/dist/theme/insight.min.css +1 -1
  38. package/dist/theme/modern.css +1 -1
  39. package/dist/theme/modern.min.css +1 -1
  40. package/dist-esm/Chart/Chart.js +1 -1
  41. package/dist-esm/Chart/api/axis.js +1 -1
  42. package/dist-esm/Chart/api/category.js +1 -1
  43. package/dist-esm/Chart/api/chart.js +1 -1
  44. package/dist-esm/Chart/api/color.js +1 -1
  45. package/dist-esm/Chart/api/data.js +1 -1
  46. package/dist-esm/Chart/api/export.js +1 -1
  47. package/dist-esm/Chart/api/flow.js +1 -1
  48. package/dist-esm/Chart/api/focus.js +1 -1
  49. package/dist-esm/Chart/api/grid.js +1 -1
  50. package/dist-esm/Chart/api/group.js +1 -1
  51. package/dist-esm/Chart/api/legend.js +1 -1
  52. package/dist-esm/Chart/api/load.js +1 -1
  53. package/dist-esm/Chart/api/regions.js +1 -1
  54. package/dist-esm/Chart/api/selection.js +1 -1
  55. package/dist-esm/Chart/api/show.js +1 -1
  56. package/dist-esm/Chart/api/stubs.js +1 -1
  57. package/dist-esm/Chart/api/subchart.js +1 -1
  58. package/dist-esm/Chart/api/tooltip.js +1 -1
  59. package/dist-esm/Chart/api/x.js +1 -1
  60. package/dist-esm/Chart/api/zoom.js +1 -1
  61. package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
  62. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
  63. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
  64. package/dist-esm/ChartInternal/ChartInternal.js +1 -1
  65. package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
  66. package/dist-esm/ChartInternal/data/convert.js +1 -1
  67. package/dist-esm/ChartInternal/data/data.js +1 -1
  68. package/dist-esm/ChartInternal/data/load.js +1 -1
  69. package/dist-esm/ChartInternal/interactions/drag.js +1 -1
  70. package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
  71. package/dist-esm/ChartInternal/interactions/flow.js +1 -1
  72. package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
  73. package/dist-esm/ChartInternal/interactions/subchart.js +1 -1
  74. package/dist-esm/ChartInternal/interactions/zoom.js +1 -1
  75. package/dist-esm/ChartInternal/internals/category.js +1 -1
  76. package/dist-esm/ChartInternal/internals/class.js +1 -1
  77. package/dist-esm/ChartInternal/internals/clip.js +1 -1
  78. package/dist-esm/ChartInternal/internals/color.js +1 -1
  79. package/dist-esm/ChartInternal/internals/domain.js +1 -1
  80. package/dist-esm/ChartInternal/internals/format.js +1 -1
  81. package/dist-esm/ChartInternal/internals/grid.js +1 -1
  82. package/dist-esm/ChartInternal/internals/legend.js +1 -1
  83. package/dist-esm/ChartInternal/internals/redraw.js +1 -1
  84. package/dist-esm/ChartInternal/internals/region.js +1 -1
  85. package/dist-esm/ChartInternal/internals/scale.js +1 -1
  86. package/dist-esm/ChartInternal/internals/selection.js +1 -1
  87. package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
  88. package/dist-esm/ChartInternal/internals/size.js +1 -1
  89. package/dist-esm/ChartInternal/internals/style.js +1 -1
  90. package/dist-esm/ChartInternal/internals/subchart.util.js +1 -1
  91. package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
  92. package/dist-esm/ChartInternal/internals/text.js +5 -2
  93. package/dist-esm/ChartInternal/internals/text.util.js +1 -1
  94. package/dist-esm/ChartInternal/internals/title.js +1 -1
  95. package/dist-esm/ChartInternal/internals/tooltip.js +1 -1
  96. package/dist-esm/ChartInternal/internals/transform.js +1 -1
  97. package/dist-esm/ChartInternal/internals/type.js +1 -1
  98. package/dist-esm/ChartInternal/shape/arc.js +1 -1
  99. package/dist-esm/ChartInternal/shape/area.js +1 -1
  100. package/dist-esm/ChartInternal/shape/bar.js +1 -1
  101. package/dist-esm/ChartInternal/shape/bubble.js +1 -1
  102. package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
  103. package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
  104. package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
  105. package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
  106. package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
  107. package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
  108. package/dist-esm/ChartInternal/shape/core/path.js +1 -1
  109. package/dist-esm/ChartInternal/shape/core/point.js +1 -1
  110. package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
  111. package/dist-esm/ChartInternal/shape/funnel.js +1 -1
  112. package/dist-esm/ChartInternal/shape/gauge.js +1 -1
  113. package/dist-esm/ChartInternal/shape/line.js +1 -1
  114. package/dist-esm/ChartInternal/shape/point.js +1 -1
  115. package/dist-esm/ChartInternal/shape/polar.js +1 -1
  116. package/dist-esm/ChartInternal/shape/radar.js +1 -1
  117. package/dist-esm/ChartInternal/shape/shape.js +1 -1
  118. package/dist-esm/ChartInternal/shape/treemap.js +1 -1
  119. package/dist-esm/canvas/CanvasAxisRenderer.js +1 -1
  120. package/dist-esm/canvas/CanvasEngine.js +1 -1
  121. package/dist-esm/canvas/CanvasPainter.js +1 -1
  122. package/dist-esm/canvas/CanvasRenderer.js +1 -1
  123. package/dist-esm/canvas/CanvasTheme.js +1 -1
  124. package/dist-esm/canvas/HitDetector.js +1 -1
  125. package/dist-esm/canvas/axisTicks.js +1 -1
  126. package/dist-esm/canvas/classes.js +1 -1
  127. package/dist-esm/canvas/color.js +1 -1
  128. package/dist-esm/canvas/geometry.js +1 -1
  129. package/dist-esm/canvas/labels.js +1 -1
  130. package/dist-esm/canvas/pointPattern.js +1 -1
  131. package/dist-esm/canvas/util.js +1 -1
  132. package/dist-esm/config/Options/Options.js +1 -1
  133. package/dist-esm/config/Options/axis/axis.js +1 -1
  134. package/dist-esm/config/Options/axis/x.js +1 -1
  135. package/dist-esm/config/Options/axis/y.js +1 -1
  136. package/dist-esm/config/Options/axis/y2.js +1 -1
  137. package/dist-esm/config/Options/common/boost.js +1 -1
  138. package/dist-esm/config/Options/common/color.js +1 -1
  139. package/dist-esm/config/Options/common/grid.js +1 -1
  140. package/dist-esm/config/Options/common/legend.js +1 -1
  141. package/dist-esm/config/Options/common/main.js +1 -1
  142. package/dist-esm/config/Options/common/point.js +1 -1
  143. package/dist-esm/config/Options/common/title.js +1 -1
  144. package/dist-esm/config/Options/common/tooltip.js +1 -1
  145. package/dist-esm/config/Options/data/axis.js +1 -1
  146. package/dist-esm/config/Options/data/data.js +1 -1
  147. package/dist-esm/config/Options/data/selection.js +1 -1
  148. package/dist-esm/config/Options/interaction/interaction.js +1 -1
  149. package/dist-esm/config/Options/interaction/subchart.js +1 -1
  150. package/dist-esm/config/Options/interaction/zoom.js +1 -1
  151. package/dist-esm/config/Options/shape/arc.js +1 -1
  152. package/dist-esm/config/Options/shape/area.js +1 -1
  153. package/dist-esm/config/Options/shape/bar.js +1 -1
  154. package/dist-esm/config/Options/shape/bubble.js +1 -1
  155. package/dist-esm/config/Options/shape/candlestick.js +1 -1
  156. package/dist-esm/config/Options/shape/donut.js +1 -1
  157. package/dist-esm/config/Options/shape/funnel.js +1 -1
  158. package/dist-esm/config/Options/shape/gauge.js +1 -1
  159. package/dist-esm/config/Options/shape/line.js +1 -1
  160. package/dist-esm/config/Options/shape/pie.js +1 -1
  161. package/dist-esm/config/Options/shape/polar.js +1 -1
  162. package/dist-esm/config/Options/shape/radar.js +1 -1
  163. package/dist-esm/config/Options/shape/scatter.js +1 -1
  164. package/dist-esm/config/Options/shape/spline.js +1 -1
  165. package/dist-esm/config/Options/shape/treemap.js +1 -1
  166. package/dist-esm/config/Store/Element.js +1 -1
  167. package/dist-esm/config/Store/State.js +1 -1
  168. package/dist-esm/config/Store/Store.js +1 -1
  169. package/dist-esm/config/classes.js +1 -1
  170. package/dist-esm/config/config.js +1 -1
  171. package/dist-esm/config/const.js +1 -1
  172. package/dist-esm/config/resolver/axis.core.js +1 -1
  173. package/dist-esm/config/resolver/axis.js +1 -1
  174. package/dist-esm/config/resolver/canvas.js +1 -1
  175. package/dist-esm/config/resolver/canvasShape.js +1 -1
  176. package/dist-esm/config/resolver/category.js +1 -1
  177. package/dist-esm/config/resolver/export.js +1 -1
  178. package/dist-esm/config/resolver/flow.js +1 -1
  179. package/dist-esm/config/resolver/grid.js +1 -1
  180. package/dist-esm/config/resolver/interaction/selection.js +1 -1
  181. package/dist-esm/config/resolver/interaction/subchart.js +1 -1
  182. package/dist-esm/config/resolver/interaction/zoom.js +1 -1
  183. package/dist-esm/config/resolver/regions.js +1 -1
  184. package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
  185. package/dist-esm/config/resolver/shape/area.js +1 -1
  186. package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
  187. package/dist-esm/config/resolver/shape/bar.js +1 -1
  188. package/dist-esm/config/resolver/shape/bubble.js +1 -1
  189. package/dist-esm/config/resolver/shape/candlestick.js +1 -1
  190. package/dist-esm/config/resolver/shape/donut.js +1 -1
  191. package/dist-esm/config/resolver/shape/funnel.js +1 -1
  192. package/dist-esm/config/resolver/shape/gauge.js +1 -1
  193. package/dist-esm/config/resolver/shape/line.js +1 -1
  194. package/dist-esm/config/resolver/shape/pie.js +1 -1
  195. package/dist-esm/config/resolver/shape/polar.js +1 -1
  196. package/dist-esm/config/resolver/shape/radar.js +1 -1
  197. package/dist-esm/config/resolver/shape/scatter.js +1 -1
  198. package/dist-esm/config/resolver/shape/treemap.js +1 -1
  199. package/dist-esm/core.js +3 -3
  200. package/dist-esm/index.canvas.js +1 -1
  201. package/dist-esm/index.esm.js +1 -1
  202. package/dist-esm/module/Cache.js +1 -1
  203. package/dist-esm/module/browser.js +1 -1
  204. package/dist-esm/module/dsv.js +1 -1
  205. package/dist-esm/module/error.js +1 -1
  206. package/dist-esm/module/generator.js +1 -1
  207. package/dist-esm/module/sanitize.js +1 -1
  208. package/dist-esm/module/util/brush.js +1 -1
  209. package/dist-esm/module/util/dom.js +1 -1
  210. package/dist-esm/module/util/object.js +1 -1
  211. package/dist-esm/module/util/type-checks.js +1 -1
  212. package/dist-esm/module/worker.js +1 -1
  213. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  214. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  215. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  216. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  217. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  218. package/dist-esm/react/index.js +1 -1
  219. package/package.json +1 -1
  220. package/src/ChartInternal/internals/text.ts +6 -1
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.1
8
+ * @version 4.1.2
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.12
@@ -42,7 +42,7 @@ ${(l*100).toFixed(2)}%`;return u==null?null:String(u)}var Ew=Array.prototype.sli
42
42
  }
43
43
  `,Ye.head.appendChild(Hn);try{return d("bb-shapes bb-shapes-canvas-probe","circle",wn,Xn)}finally{Hn.remove()}},C=d("bb-axis bb-axis-x","path","domain",["stroke","stroke-width"]),w=m("bb-axis-x","line",["stroke","stroke-width"]),$=m("bb-axis-x","text",["fill","font"]),z=m("bb-axis-x","text",["fill"],"_active_"),B=m("bb-axis-y","text",["fill","font"]),W=m("bb-axis-y2","text",["fill","font"]),H=d("bb-axis bb-axis-x","text","bb-axis-x-label",["fill","font"]),_=d("bb-axis bb-axis-y","text","bb-axis-y-label",["fill","font"]),q=d("bb-axis bb-axis-y2","text","bb-axis-y2-label",["fill","font"]),st=f("circle","",["fill","stroke","stroke-width"]),it=d("bb-grid","line","bb-ygrid",["stroke","stroke-width","stroke-dasharray"]),ot=d("bb-grid","text","",["fill","font"]),ct=h("bb-grid","bb-xgrid-focus","line","bb-xgrid-focus",["stroke","stroke-width","stroke-dasharray"]),gt=f("text","bb-text bb-empty",["fill","font"]),tt=d("bb-region","rect","",["fill","fill-opacity"]),ft=d("bb-region","text","",["fill","font"]),lt=f("path","bb-bar",["opacity","fill-opacity","stroke","stroke-width"]),bt=f("path","bb-bar _expanded_",["opacity","fill-opacity"]),St=f("path","bb-candlestick",["stroke","stroke-width"]),Mt=f("path","bb-candlestick _expanded_",["opacity","fill-opacity"]),Ot=f("path","bb-line",["stroke-width"]),Kt=d("bb-target bb-focused","path","bb-line",["stroke-width"]),ee=f("g","bb-target bb-defocused",["opacity"]),Ae=f("path","bb-area",["opacity","fill-opacity"]),Ee=f("circle","bb-circle",["fill","stroke","stroke-width"]),Te=f("circle","bb-selected-circle",["fill","stroke","stroke-width"]),De=E("bb-circle _expanded_",["fill","stroke","stroke-width"]),me=f("rect","bb-zoom-brush",["fill","fill-opacity","opacity"]),Pe=d("bb-brush","rect","extent",["fill","fill-opacity","opacity"]),Zt=d("bb-brush","rect","selection",["fill","fill-opacity","opacity"]),he=d("bb-brush","path","handle--custom",["fill","fill-opacity","opacity","stroke","stroke-width"]),ge=d("bb-chart-treemaps","rect","",["stroke","stroke-width"]),Wt=f("text","bb-text",["fill","font"]),We=d("","text","bb-title",["fill","font"]),Xe=ke(me.fill,"#000"),pn=Le(me["fill-opacity"]||me.opacity,.1),Cn=ke(Zt.fill,ke(Pe.fill,Xe)),be=(l=(o=(s=(i=oi(Zt["fill-opacity"],1))!=null?i:oi(Zt.opacity,1))!=null?s:oi(Pe["fill-opacity"],1))!=null?o:oi(Pe.opacity,1))!=null?l:pn,un=ke(he.stroke,"transparent"),an={axis:{lineColor:ke(C.stroke,"#000"),lineWidth:Le(C["stroke-width"],1),tickColor:ke(w.stroke,ke(C.stroke,"#000")),tickWidth:Le(w["stroke-width"],Le(C["stroke-width"],1)),labelFont:_.font||B.font||"10px sans-serif",xTickFont:$.font||B.font||"10px sans-serif",yTickFont:B.font||"10px sans-serif",y2TickFont:W.font||B.font||"10px sans-serif",labelColor:ke(B.fill,"#000"),xLabelColor:ke(H.fill,ke($.fill,"#000")),yLabelColor:ke(_.fill,ke(B.fill,"#000")),y2LabelColor:ke(q.fill,ke(_.fill,ke(B.fill,"#000"))),activeLabelColor:si(z.fill,$.fill)||ke(B.fill,"#000")},grid:{lineColor:ke(it.stroke,"#aaa"),lineWidth:Le(it["stroke-width"],1),dashArray:as(it["stroke-dasharray"]),labelFont:ot.font||B.font||"10px sans-serif",labelColor:ke(ot.fill,"#aaa")},focusGrid:{lineColor:ke(ct.stroke,ke(it.stroke,"#aaa")),lineWidth:Le(ct["stroke-width"],Le(it["stroke-width"],1)),dashArray:as(ct["stroke-dasharray"]||it["stroke-dasharray"])},emptyLabel:{font:gt.font||Wt.font||B.font||"20px sans-serif",color:ke(gt.fill,"#808080")},region:{fill:ke(tt.fill,"steelblue"),opacity:Le(tt["fill-opacity"],.1),labelFont:ft.font||B.font||"10px sans-serif",labelColor:ke(ft.fill,"#000")},shape:{barOpacity:Da(lt,1),barExpandedOpacity:Le(Da(bt,Da(lt,1)),Da(lt,1)),barStrokeColor:ke(lt.stroke,"#000"),barLineWidth:Le(lt["stroke-width"],0),barConnectLineColor:ke(Ot.stroke,"#000"),barConnectLineWidth:Le(Ot["stroke-width"],1),candlestickStrokeColor:ke(St.stroke,"#000"),candlestickLineWidth:Le(St["stroke-width"],1),candlestickExpandedOpacity:Le(Da(Mt,1),1),lineWidth:Le(Ot["stroke-width"],1),lineFocusedWidth:Le(Kt["stroke-width"],2),areaOpacity:Da(Ae,.2),targetDefocusedOpacity:Le(ee.opacity,.3),pointFillColor:si(Ee.fill,st.fill),pointStrokeColor:si(Ee.stroke,st.stroke),pointLineWidth:oi(Ee["stroke-width"],st["stroke-width"])},selectedPoint:{fill:ke(Te.fill,"#fff"),stroke:si(Te.stroke),lineWidth:Le(Te["stroke-width"],2)},focusPoint:{fill:si(De.fill,S),stroke:si(De.stroke,S),lineWidth:Le(De["stroke-width"],1)},zoomBrush:{fill:Xe,opacity:pn},subchartBrush:{fill:Cn,opacity:be,handleFill:ke(he.fill,"transparent"),handleOpacity:Da(he,1),handleStroke:un,handleLineWidth:Le(he["stroke-width"],un==="transparent"?0:1)},treemap:{stroke:ke(ge.stroke,"#fff"),lineWidth:Le(ge["stroke-width"],1)},label:{font:Wt.font||B.font||"10px sans-serif",color:ke(Wt.fill,"#000")},title:{font:We.font||Wt.font||B.font||"14px sans-serif",color:ke(We.fill,"#000")}},Nr=u1(n),te=Xr(an,Nr),ma=n==null?void 0:n.axis,zR=!!ma&&Object.prototype.hasOwnProperty.call(ma,"labelColor"),UR=!!ma&&Object.prototype.hasOwnProperty.call(ma,"labelFont");if(te.axis.lineWidth=Le(te.axis.lineWidth,an.axis.lineWidth),te.axis.tickWidth=Le(te.axis.tickWidth,te.axis.lineWidth),UR){const wn=ma,Xn=te.axis.labelFont;wn.xTickFont===void 0&&(te.axis.xTickFont=Xn),wn.yTickFont===void 0&&(te.axis.yTickFont=Xn),wn.y2TickFont===void 0&&(te.axis.y2TickFont=Xn)}if(te.axis.labelFont=te.axis.labelFont||an.axis.labelFont,te.axis.xTickFont=te.axis.xTickFont||te.axis.labelFont,te.axis.yTickFont=te.axis.yTickFont||te.axis.labelFont,te.axis.y2TickFont=te.axis.y2TickFont||te.axis.yTickFont,te.axis.labelColor=ke(te.axis.labelColor,an.axis.labelColor),zR){const wn=te.axis.labelColor;ma.xLabelColor===void 0&&(te.axis.xLabelColor=wn),ma.yLabelColor===void 0&&(te.axis.yLabelColor=wn),ma.y2LabelColor===void 0&&(te.axis.y2LabelColor=wn)}te.axis.xLabelColor=ke(te.axis.xLabelColor,te.axis.labelColor),te.axis.yLabelColor=ke(te.axis.yLabelColor,te.axis.labelColor),te.axis.y2LabelColor=ke(te.axis.y2LabelColor,te.axis.yLabelColor),te.axis.activeLabelColor=ke(te.axis.activeLabelColor,te.axis.labelColor),te.grid.lineWidth=Le(te.grid.lineWidth,an.grid.lineWidth),te.grid.dashArray=as(te.grid.dashArray),te.focusGrid.lineWidth=Le(te.focusGrid.lineWidth,an.focusGrid.lineWidth),te.focusGrid.dashArray=as(te.focusGrid.dashArray),te.region.opacity=Le(te.region.opacity,an.region.opacity),te.shape.barOpacity=Le(te.shape.barOpacity,an.shape.barOpacity),te.shape.barExpandedOpacity=Le(te.shape.barExpandedOpacity,te.shape.barOpacity),te.shape.barLineWidth=Le(te.shape.barLineWidth,an.shape.barLineWidth),te.shape.barConnectLineWidth=Le(te.shape.barConnectLineWidth,an.shape.barConnectLineWidth),te.shape.candlestickLineWidth=Le(te.shape.candlestickLineWidth,an.shape.candlestickLineWidth),te.shape.candlestickStrokeColor=ke(te.shape.candlestickStrokeColor,an.shape.candlestickStrokeColor),te.shape.candlestickExpandedOpacity=Le(te.shape.candlestickExpandedOpacity,an.shape.candlestickExpandedOpacity),te.shape.lineWidth=Le(te.shape.lineWidth,an.shape.lineWidth),te.shape.lineFocusedWidth=Le(te.shape.lineFocusedWidth,an.shape.lineFocusedWidth),te.shape.areaOpacity=Le(te.shape.areaOpacity,an.shape.areaOpacity),te.shape.targetDefocusedOpacity=Le(te.shape.targetDefocusedOpacity,an.shape.targetDefocusedOpacity),te.shape.pointLineWidth=oi(te.shape.pointLineWidth),te.selectedPoint.lineWidth=Le(te.selectedPoint.lineWidth,an.selectedPoint.lineWidth),te.focusPoint.lineWidth=Le(te.focusPoint.lineWidth,an.focusPoint.lineWidth),te.zoomBrush.opacity=Le(te.zoomBrush.opacity,an.zoomBrush.opacity),te.subchartBrush.opacity=Le(te.subchartBrush.opacity,an.subchartBrush.opacity),te.subchartBrush.handleOpacity=Le(te.subchartBrush.handleOpacity,an.subchartBrush.handleOpacity),te.subchartBrush.handleLineWidth=Le(te.subchartBrush.handleLineWidth,an.subchartBrush.handleLineWidth),te.treemap.lineWidth=Le(te.treemap.lineWidth,an.treemap.lineWidth),this.style=te,this.cacheContainer=e,this.cacheKey=hh(e,n),c.remove()}reload(e,n){const r=hh(e,n);r!==null&&this.style&&this.cacheContainer===e&&this.cacheKey===r||this.load(e,n)}getGridLineStyle(e,n={},r="line"){const i={};for(const s of this.gridLineSelectorOverrides)o1(s.selector,e,n.class,r)&&uh(i,s.style,this.directGridOverrideKeys);return bc(i).length?i:void 0}}var d1=Object.defineProperty,h1=(t,e,n)=>e in t?d1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yr=(t,e,n)=>h1(t,typeof e!="symbol"?e+"":e,n);const Fa=24,vh=64,Sc=[xr,er,Vn];function li(t,e){return Math.floor(t/e)}function gh(t,e,n){var r,i;const s=li(e.x,n),o=li(e.x+((r=e.w)!=null?r:0),n),l=li(e.y,n),c=li(e.y+((i=e.h)!=null?i:0),n);for(let u=s;u<=o;u++)for(let f=l;f<=c;f++){const d=`${u}:${f}`,h=t.get(d);h?h.push(e):t.set(d,[e])}}function ph(t,e,n,r,i=0){const s=li(e,r),o=li(n,r),l=[];for(let c=-i;c<=i;c++)for(let u=-i;u<=i;u++){const f=t.get(`${s+c}:${o+u}`);if(f!=null&&f.length)for(let d=0;d<f.length;d++)l.push(f[d])}return l}function v1(t,e){var n,r,i;const s=t.config.point_sensitivity;if(Number.isFinite(s))return s;(n=t.pointR)==null||n.call(t,e);const o=(i=(r=t.getPointSensitivity)==null?void 0:r.call(t,e))!=null?i:Fa;return Number.isFinite(o)?o:Fa}function g1(t,e){return la(t,e)&&e.values.length>Zf&&!t.config.data_selection_enabled&&Number.isFinite(t.config.point_sensitivity)&&Number.isFinite(t.config.point_r)}class p1{constructor(){yr(this,"bars",[]),yr(this,"points",[]),yr(this,"indices",[]),yr(this,"barGrid",new Map),yr(this,"pointGrid",new Map),yr(this,"plot",{x:0,y:0,w:0,h:0}),yr(this,"pointCellSize",Fa),yr(this,"maxPointSensitivity",Fa),yr(this,"grouped",!1),yr(this,"pointBased",!1),yr(this,"indexAxis","x")}rebuild(e,n){var r,i,s;const{current:o,margin:l,width:c,height:u}=e.state,f=e.filterTargetsToShow();this.bars=[],this.points=[],this.indices=[],this.barGrid=new Map,this.pointGrid=new Map,this.maxPointSensitivity=Fa,this.indexAxis=e.config.axis_rotated?"y":"x",this.plot=e.state.hasTreemap?{x:0,y:0,w:o.width,h:o.height}:{x:l.left,y:l.top,w:c,h:u},this.grouped=!!e.config.tooltip_grouped&&!e.state.hasTreemap,this.pointBased=!(e.config.axis_x_forceAsSingle&&this.grouped)&&(!!((r=e.isMultipleX)!=null&&r.call(e))||f.some(C=>la(e,C)||ca(e,C)));const h=this.grouped&&(!this.pointBased||e.config.data_selection_enabled&&e.config.data_selection_grouped)?new Map:null,m=(C,w,$)=>{var z,B;if(!h)return;const W=(B=(z=e.getXCacheKey)==null?void 0:z.call(e,$.x))!=null?B:$.index;Number.isFinite($.index)&&!h.has(W)&&gn(C,w)&&h.set(W,{x:C,y:w,data:$})};if(e.state.hasTreemap){const C=(i=e.getTreemapRoot)==null?void 0:i.call(e,e.data.targets),w=(C==null?void 0:C.children)||[];for(const $ of w){const{data:z}=$;if(!kl(e,z))continue;const{x:B,y:W,w:H,h:_}=ai(e,$,C,!0);!gn(B,W)||!gn(B+H,W+_)||this.addBar({x:B,y:W,w:H,h:_,data:z})}this.indices=[];return}if(n.indices[qt.BAR]||f.some(er.bind(null,e))){const C=er.bind(null,e),w=tr(e,n,qt.BAR,C),$=e.generateGetBarPoints(w,!1);f.filter(C).filter(z=>ei(e,z,Sc)).forEach(z=>{const B=Wr(e,z);for(let W=B.start;W<B.end;W++){const H=z.values[W];if(!An(e,H))continue;const _=Qi(e,$,H,W);if(!_)continue;const{rect:q}=_,st=l.left+q.x,it=l.top+q.y,{w:ot,h:ct}=q;this.addBar({x:st,y:it,w:ot,h:ct,data:H}),m(st+ot/2,it+ct/2,H)}})}if(n.indices[qt.CANDLESTICK]||f.some(Vn.bind(null,e))){const C=Vn.bind(null,e),w=tr(e,n,qt.CANDLESTICK,C),$=(s=e.generateGetCandlestickPoints)==null?void 0:s.call(e,w,!1);$&&f.filter(C).filter(z=>ei(e,z,Sc)).forEach(z=>{var B;const W=Wr(e,z);for(let H=W.start;H<W.end;H++){const _=z.values[H];if(!((B=e.getCandlestickData)==null?void 0:B.call(e,_)))continue;const st=_i(e,$,_,H);if(!st)continue;const{body:it}=st,ot=l.left+it.x,ct=l.top+it.y,{w:gt,h:tt}=it;this.addBar({x:ot,y:ct,w:Math.max(1,gt),h:Math.max(1,tt),data:_}),m(ot+gt/2,ct+tt/2,_)}})}const{cx:S,cy:E}=n.pos;S&&E&&f.filter(xr.bind(null,e)).filter(C=>ei(e,C,Sc)).forEach(C=>{const w=Wr(e,C),$=g1(e,C)?Qf(c,u,e.config.point_r):null;for(let z=w.start;z<w.end;z++){const B=C.values[z];if(!An(e,B))continue;const W=l.left+S(B,z),H=l.top+E(B,z),_=v1(e,B);gn(W,H)&&($&&!_f($,W-l.left,H-l.top)||(this.addPoint({x:W,y:H,sensitivity:_,data:B}),m(W,H,B)))}}),this.buildPointGrid(),this.indices=h?Array.from(h.values()).sort((C,w)=>C[this.indexAxis]-w[this.indexAxis]):[]}hitBar(e,n){for(const r of ph(this.barGrid,e,n,vh)){const{w:i=0,h:s=0}=r;if(e>=r.x&&e<=r.x+i&&n>=r.y&&n<=r.y+s)return r.data}return null}hitPoint(e,n){var r,i;let s=null,o=Number.POSITIVE_INFINITY;for(const l of ph(this.pointGrid,e,n,this.pointCellSize,1)){const c=l.x-e,u=l.y-n,f=Math.sqrt(c*c+u*u),d=(r=l.sensitivity)!=null?r:Fa;f<=d&&f<o&&(o=f,s=l)}return(i=s==null?void 0:s.data)!=null?i:null}findNearest(e,n){const r=this.hitBar(e,n);if(r)return r;if(!this.pointBased&&this.grouped&&this.isWithinPlot(e,n)){const i=this.findNearestIndexItem(e,n);if(i)return i.data}return this.hitPoint(e,n)}findNearestShape(e,n){var r;return(r=this.hitBar(e,n))!=null?r:this.hitPoint(e,n)}findNearestIndexByCoord(e,n){var r,i;return(i=(r=this.findNearestIndexItem(e,n))==null?void 0:r.data)!=null?i:null}findInRect(e,n=!1){const r=Math.min(e.x,e.x+e.w),i=Math.max(e.x,e.x+e.w),s=Math.min(e.y,e.y+e.h),o=Math.max(e.y,e.y+e.h),l=new Set,c=[],u=f=>{const d=f.data,h=`${d.id}:${d.index}`;l.has(h)||(l.add(h),c.push(d))};if(n){const f=this.indexAxis,d=f==="y"?s:r,h=f==="y"?o:i;return this.indices.filter(m=>m[f]>=d&&m[f]<=h).forEach(u),c}return this.bars.filter(f=>{var d,h;const m=(d=f.w)!=null?d:0,S=(h=f.h)!=null?h:0;return!(i<f.x||f.x+m<r)&&!(o<f.y||f.y+S<s)}).forEach(u),this.points.filter(f=>f.x>=r&&f.x<=i&&f.y>=s&&f.y<=o).forEach(u),c}addBar(e){this.bars.push(e),gh(this.barGrid,e,vh)}addPoint(e){var n;const r=(n=e.sensitivity)!=null?n:Fa;this.maxPointSensitivity=Math.max(this.maxPointSensitivity,r),this.points.push(e)}buildPointGrid(){this.pointCellSize=Math.max(1,this.maxPointSensitivity),this.pointGrid=new Map;for(const e of this.points)gh(this.pointGrid,e,this.pointCellSize)}isWithinPlot(e,n){const{plot:r}=this;return e>=r.x&&e<=r.x+r.w&&n>=r.y&&n<=r.y+r.h}findNearestIndexItem(e,n){const{indexAxis:r,indices:i}=this,s=r==="y"?n:e;if(!i.length)return null;let o=0,l=i.length-1;for(;o<l;){const f=o+l>>1;i[f][r]<s?o=f+1:l=f}const c=i[o],u=i[o-1];return u&&Math.abs(u[r]-s)<Math.abs(c[r]-s)?u:c}}var m1=Object.defineProperty,mh=Object.getOwnPropertySymbols,x1=Object.prototype.hasOwnProperty,y1=Object.prototype.propertyIsEnumerable,xh=(t,e,n)=>e in t?m1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,cn=(t,e)=>{for(var n in e||(e={}))x1.call(e,n)&&xh(t,n,e[n]);if(mh)for(var n of mh(e))y1.call(e,n)&&xh(t,n,e[n]);return t};const ze={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},Ze={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},To={area:"bb-area",areas:"bb-areas"},Rn={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},rr={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},Kr={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},$n={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Ac={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Na={dragarea:"bb-dragarea",INCLUDED:"_included_"},is={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},ar={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},$e={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},Mr={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},Zr={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},nn={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",xgridFocusContinuous:"bb-xgrid-focus-continuous",ygridFocus:"bb-ygrid-focus"},yn={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},Jr={level:"bb-level",levels:"bb-levels"},yh={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},ss={region:"bb-region",regions:"bb-regions"},on={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},Tn={shape:"bb-shape",shapes:"bb-shapes"},Th={brush:"bb-brush",subchart:"bb-subchart"},En={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},bo={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},bh={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Ec={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var Re=cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn(cn({},ze),Ze),To),Rn),rr),Kr),$n),Ac),Na),ar),$e),Mr),Zr),nn),is),yn),Jr),yh),ss),on),Tn),Th),En),bo),bh),Ec),T1={boost_useCssRule:!1,boost_useWorker:!1,boost_workerUrl:void 0},b1={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},S1={legend_contents_bindto:void 0,legend_contents_template:"<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_format:void 0,legend_padding:0,legend_position:"bottom",legend_show:!0,legend_tooltip:!1,legend_usePoint:!1},A1={bindto:"#chart",background:{},clipPath:!0,svg_classname:void 0,size_width:void 0,size_height:void 0,padding:!0,padding_mode:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,resize_auto:!0,resize_timer:!0,resize_live:!1,onclick:void 0,onover:void 0,onout:void 0,onresize:void 0,onresized:void 0,onbeforeinit:void 0,oninit:void 0,onafterinit:void 0,onrendered:void 0,transition_duration:250,plugins:[],render:{},render_mode:"svg",canvas_theme:{},regions:[]},E1={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},C1={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:void 0,tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:()=>{},tooltip_onhide:()=>{},tooltip_onshown:()=>{},tooltip_onhidden:()=>{},tooltip_order:null},I1={data_x:void 0,data_idConverter:t=>t,data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_groupsZeroAs:"positive",data_color:void 0,data_colors:{},data_labels:{},data_labels_backgroundColors:void 0,data_labels_colors:void 0,data_labels_position:{},data_labels_imgUrl:void 0,data_hide:!1,data_filter:void 0,data_onclick:()=>{},data_onover:()=>{},data_onout:()=>{},data_onshown:void 0,data_onhidden:void 0,data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},R1={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},w1=Object.defineProperty,O1=(t,e,n)=>e in t?w1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,P1=(t,e,n)=>O1(t,typeof e!="symbol"?e+"":e,n);const Sh=class rm{static setOptions(e){for(let n=0;n<e.length;n++)Object.assign(this.data,e[n])}constructor(){return Xy(A1,T1,I1,b1,R1,S1,E1,C1,rm.data)}};P1(Sh,"data",{});let $a=Sh;class M1{constructor(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX:null,subY:null,subY2:null},axisTooltip:{x:null,y:null,y2:null},defs:null,tooltip:null,legend:null,title:null,subchart:{main:null,bar:null,line:null,area:null},arcs:null,bar:null,candlestick:null,line:null,area:null,circle:null,radar:null,text:null,grid:{main:null,x:null,y:null},gridLines:{main:null,x:null,y:null},region:{main:null,list:null},eventRect:null,zoomResetBtn:null}}}class L1{constructor(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasFunnel:!1,hasRadar:!1,hasTreemap:!1,isCanvasMode:!1,canvasShape:null,canvasFocusKey:null,canvasSubchartBrushDragging:!1,canvasSubchartBrushMode:null,canvasSubchartBrushStart:null,canvasSubchartBrushOrigin:null,canvasSubchartBrushMoved:!1,canvasFlowFrame:null,canvasFlowFinish:null,canvasFocusMainRedraw:!1,cssRule:{},loading:void 0,domain:void 0,subchartSourceTypes:void 0,current:{domain:void 0,width:0,height:0,dataMax:0,maxTickSize:{x:{width:0,height:0,ticks:[],clipPath:0,domain:""},y:{width:0,height:0,domain:""},y2:{width:0,height:0,domain:""}},types:[],needle:void 0,zoomDomain:null},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,canvasInlineStyle:{minHeight:""},canvasSelection:new Set,canvasSelectionDragStart:null,canvasSelectionDragIncluded:new Set,canvasSelectionDragging:!1,canvasSelectionDragMoved:!1,canvasSelectionDragMoveHandler:null,canvasSelectionDragEndHandler:null,eventReceiver:{currentIdx:-1,rect:{},data:[],coords:[]},axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},event:null,dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,redrawing:!1,resizing:!1,resizePreview:!1,resizeRedrawTime:0,resizeLiveScale:null,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:new Set,hiddenLegendIds:new Set,focusedTargetIds:new Set,defocusedTargetIds:new Set,radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null},pendingRaf:null,rafBatchQueue:[],dirty:{data:!1,visibility:!1,size:!1},redrawGeneration:0,dataGeneration:0,_targetsToShow:null,_cachedDrawShape:null,_canvasVisibleRangeCache:null,_canvasXDataTickCache:null,_canvasXTickValuesCache:null,_eventRectFingerprint:null,_lastTooltipMouse:null,_gridFocusEl:null,generateClassCache:new Map}}}const Ah={element:M1,state:L1};class D1{constructor(){Object.keys(Ah).forEach(e=>{this[e]=new Ah[e]})}getStore(e){return this[e]}}var F1=Object.defineProperty,N1=(t,e,n)=>e in t?F1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$1=(t,e,n)=>N1(t,typeof e!="symbol"?e+"":e,n);const Oe={bubbleBaseLength:"$baseLength",bubbleMaxValue:"$bubbleMaxValue",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",visibleTotalPerIndex:"$visibleTotalPerIndex",domainMinMax:"$domainMinMax",filteredTargets:"$filteredTargets",svgLeft:"$svgLeft",valuesByX:"$valuesByX",legendItemTextBox:"legendItemTextBox",legendItemMap:"$legendItemMap",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect",shapeOffset:"$shapeOffset",maxTickSize:"$maxTickSize",maxDataCountTarget:"$maxDataCountTarget",valuesXIndexMap:"$valuesXIndexMap"};class B1{constructor(){$1(this,"cache",new Map)}add(e,n,r=!1){const i=r?this.cloneTarget(n):n;return this.cache.set(e,i),i}remove(e){const n=je(e)?[e]:e;for(let r=0;r<n.length;r++)this.cache.delete(n[r])}get(e,n=!1){if(n&&Array.isArray(e)){const r=[];for(let i=0,s;s=e[i];i++)this.cache.has(s)&&r.push(this.cache.get(s));return r}else return this.cache.has(e)?this.cache.get(e):null}has(e){return this.cache.has(e)}getKeys(){return Array.from(this.cache.keys())}reset(e,n){e?this.cache.clear():this.cache.forEach((r,i)=>{/^\$/.test(i)&&(n!=null&&n.some(s=>i.startsWith(s))||this.cache.delete(i))})}cloneTarget(e){return{id:e.id,id_org:e.id_org,values:e.values.map(n=>({x:n.x,value:n.value,id:n.id}))}}}const Eh="https://github.com/naver/billboard.js/blob/master/MODULE_IMPORTS.md";function z1(t){const e=t,{config:n}=e;let r="";if(lr(n.data_type||n.data_types)&&!e[dn.LINE])r="line";else for(const i in dn){const s=qt[i];if(e.hasType(s)&&!e[dn[i]]){r=s;break}}r&&Ch(`Please, make sure if %c${Gy(r)}`,"module has been imported and specified correctly.",Eh)}function Iw(t){const e=Fs[t];e&&Ch(`Please, make sure if %c${e}`,"module has been imported and specified correctly.",Eh)}function Ch(t,e,n){var r;const i="[billboard.js]";if((r=se.console)==null?void 0:r.error){const o=e?["background:red;color:white;display:block;font-size:15px",e]:[];console.error(`\u274C ${i} ${t}`,"background:red;color:white;display:block;font-size:15px",...o),n&&console.info("%c\u2139\uFE0F","font-size:15px",n)}throw Error(`${i} ${t.replace(/\%c([a-z-]+)/i,"'$1' ")} ${e!=null?e:""}`)}function U1(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ur(t,e){if(t=U1(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const k1=/\s?(bb-)/g,G1=/\.+/g;function X1(t){return t.replace(k1,".$1").replace(G1,".")}function Ih(t,e,n=!1){const r=s=>s[t?"getBoundingClientRect":"getBBox"](),i=t?"rectClient":"rectBBox";return n?r(e):!(i in e)||e.hasAttribute("width")&&e[i].width!==+(e.getAttribute("width")||0)?e[i]=r(e):e[i]}function ci(t,e,n=[-1,1],r=!1){if(!(!t||!je(e)))if(e.indexOf(`
44
44
  `)===-1)t.text(e);else{const i=[t.text(),e].map(s=>s.replace(/[\s\n]/g,""));if(i[0]!==i[1]){const s=e.split(`
45
- `),o=r?s.length-1:1;t.html(""),s.forEach((l,c)=>{t.append("tspan").attr("x",0).attr("dy",`${c===0?n[0]*o:n[1]}em`).text(l)})}}}function Rh(t){const{x:e,y:n,width:r,height:i}=ha(t,!0);return[{x:e,y:n+i},{x:e,y:n},{x:e+r,y:n},{x:e+r,y:n+i}]}function wh(t){const{width:e,height:n}=ln(t),r=Rh(t),i=r[0].x,s=Math.min(r[0].y,r[1].y);return{x:i,y:s,width:e,height:n}}function Jn(t,e){var n;const r=t&&((n=t.touches||t.sourceEvent&&t.sourceEvent.touches)==null?void 0:n[0]);let i=[0,0];try{i=ur(r||t,e)}catch(s){}return i.map(s=>isNaN(s)?0:s)}function ln(t,e=!1){return Ih(!0,t,e)}function ha(t,e=!1){return Ih(!1,t,e)}function W1(t,e,n){const{rootSelector:r="",sheet:i}=t,s=`${r} ${X1(e)} {${n.join(";")}}`;return i[i.insertRule?"insertRule":"addRule"](s,i.cssRules.length)}function V1(t){let e=[];return t.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(e=e.concat(Oa(n.cssRules)))}catch(i){(r=se.console)==null||r.warn(`Error while reading rules from ${n.href}: ${String(i)}`)}}),e}function Oh(t){var e,n,r,i,s,o;return{x:((n=(e=se.pageXOffset)!=null?e:se.scrollX)!=null?n:0)+((r=t.scrollLeft)!=null?r:0),y:((s=(i=se.pageYOffset)!=null?i:se.scrollY)!=null?s:0)+((o=t.scrollTop)!=null?o:0)}}function So(t,e=0,n=0,r=!0){const i=new DOMPoint(e,n),s=t.getScreenCTM(),o=i.matrixTransform(r?s==null?void 0:s.inverse():s);if(r===!1){const l=ln(t);o.x-=l.x,o.y-=l.y}return o}function Cc(t){const e=t?t.transform:null,n=e&&e.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Ic(t,e){var n;const r=(n=t==null?void 0:t.getAttribute)==null?void 0:n.call(t,e);if(r)return parseFloat(r);const i=Cc(t);return e==="x"?i.e:i.f}function Rc(t){const e=t.attr("viewBox");return e?e.trim().split(/[\s,]+/).length===4:!1}function j1(t,e,n=!1){const r=!!t.node;let i=!1;for(const[s,o]of Object.entries(e))if(i=r?t.style(s)===o:t.style[s]===o,n?!i:i)break;return i}function os(){var t,e;return((t=Ye)==null?void 0:t.hidden)===!1||((e=Ye)==null?void 0:e.visibilityState)==="visible"}function H1(t,e){const{DocumentTouch:n,matchMedia:r,navigator:i}=se,s=r==null?void 0:r("(pointer:coarse)").matches;let o=!1;if(e)if(i&&"maxTouchPoints"in i)o=i.maxTouchPoints>0;else if("ontouchmove"in se||n&&Ye instanceof n)o=!0;else if(s)o=!0;else{const c=i.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(c)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(c)}return t&&!s&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function Ph(t,e){t.pendingRaf!==null?(se.cancelAnimationFrame(t.pendingRaf),t.pendingRaf=se.requestAnimationFrame(()=>{t.pendingRaf=null,e()})):(t.pendingRaf=se.requestAnimationFrame(()=>{t.pendingRaf=null}),e())}const wc={mouse:(()=>{const t=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(e,n,r=t())=>{e.dispatchEvent(new MouseEvent(n,r))}}catch(e){return(n,r,i=t())=>{const s=Ye.createEvent("MouseEvent");s.initMouseEvent(r,i.bubbles,i.cancelable,se,0,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(t,e,n)=>{const r=new Touch(Xr({identifier:Date.now(),target:t,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));t.dispatchEvent(new TouchEvent(e,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[r],targetTouches:[],changedTouches:[r]}))}},{setTimeout:Y1,clearTimeout:K1}=se;function Z1(t,e){const n=[];let r,i=null;const s=function(){s.clear(),e&&i===null&&(i=$f(()=>{i=null,e()})),t===!1?r=Bf(()=>{r=null,n.forEach(o=>o())},{timeout:200}):r=Y1(()=>{r=null,n.forEach(o=>o())},ae(t)?t:200)};return s.clear=()=>{r&&((t===!1?by:K1)(r),r=null)},s.clearLive=()=>{i!==null&&(Ty(i),i=null)},s.add=o=>n.push(o),s.remove=o=>{const l=n.indexOf(o);l!==-1&&n.splice(l,1)},s}function Mh(){let t=[];const e=function(n,r){function i(){var s;let o=0;for(let l=0,c;c=t[l];l++){if(c===!0||(s=c.empty)!=null&&s.call(c)){o++;continue}if(os()===!1){o=t.length;break}try{c.transition()}catch(u){o++}}return o===t.length}Hf(()=>{r==null||r()},i)};return e.add=function(n){qe(n)?t=t.concat(n):t.push(n)},e}const Lr={},Ao=new Set,Ba=new Map,J1=5e3,Lh=3;let Q1=0;function _1(){try{return"var bbWorker=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=[];return e.forEach(function(e,n){let r=e[0];e.forEach(function(e,i){if(i>0){if(t[i-1]===void 0&&(t[i-1]={}),e===void 0)throw Error(`Source data is missing a component at (${n}, ${i})!`);t[i-1][r]=e}})}),t}function n(e){let t=e[0],n=[];return e.forEach(function(e,r){if(r>0){let i={};e.forEach(function(e,n){if(e===void 0)throw Error(`Source data is missing a component at (${r}, ${n})!`);i[t[n]]=e}),n.push(i)}}),n}function r(e,r){let i=[],a,o;if(Array.isArray(e)){let t=function(e,t){if(e[t]!==void 0)return e[t];let n=t.replace(/\\[(\\w+)\\]/g,`.$1`).replace(/^\\./,``).split(`.`),r=e;return n.some(function(e){return!(r=r&&typeof r==`object`&&e in r?r[e]:void 0)}),r};a=r.x?r.value.concat(r.x):r.value,i.push(a),e.forEach(function(e){let n=a.map(function(n){let r=t(e,n);return r===void 0&&(r=null),r});i.push(n)}),o=n(i)}else Object.keys(e).forEach(function(t){let n=[].concat(e[t]);n.unshift?.(t),i.push(n)}),o=t(i);return o}let i={columns:t,json:r,rows:n},a=self;function o({data:e}){let{args:t,id:n,op:r}=e;try{let e=i[r];if(!e)throw Error(`Unknown worker op: ${r}`);a.postMessage({id:n,result:e(...t)})}catch(e){a.postMessage({id:n,error:e&&(e.message||e.name)||String(e)})}}return typeof window>`u`&&(a.onmessage=o),e.handleMessage=o,e.ops=i,e})({});"}catch(t){return""}}function Oc(){const{Blob:t,Worker:e,URL:n}=se;return e&&t&&(n!=null&&n.createObjectURL)&&(n!=null&&n.revokeObjectURL)?{Blob:t,Worker:e,URL:n}:null}function Dh(){return se.Worker||null}function q1(t){var e,n;return typeof t=="number"?{timeout:t,workerUrl:""}:{timeout:(e=t==null?void 0:t.timeout)!=null?e:J1,workerUrl:(n=t==null?void 0:t.workerUrl)!=null?n:""}}function Fh(t,e=!1){var n,r;const i=Lr[t];e&&Ao.add(t),i&&((n=i.worker)==null||n.terminate(),i.revoke&&((r=Oc())==null||r.URL.revokeObjectURL(i.src)),delete Lr[t]);for(const s of Ba.keys())s.startsWith(`${t}:`)&&Ba.delete(s)}function tb(t,e){if(t===e)return!0;try{return JSON.stringify(t)===JSON.stringify(e)}catch(n){return!0}}function eb(t){const[e,...n]=t;return Array.isArray(e)?[e.slice(0,Lh).map(r=>Array.isArray(r)?r.slice(0,Lh+1):r),...n]:t}function Nh(t,e,n,r){const i=++Q1;let s=!1,o;const l=new Promise((c,u)=>{const f=(S,E)=>{s||(s=!0,o(),S(E))},d=function(S){var E;((E=S.data)==null?void 0:E.id)===i&&(S.data.error?f(u,new Error(S.data.error)):f(c,S.data.result))},h=function(){f(u,new Error("worker error"))},m=setTimeout(()=>f(u,new Error("worker timeout")),r);o=()=>{clearTimeout(m),t.removeEventListener("message",d),t.removeEventListener("error",h)},t.addEventListener("message",d),t.addEventListener("error",h)});try{t.postMessage({args:n,id:i,op:e})}catch(c){throw s=!0,o(),c}return l}function nb(t,e,n,r,i,s){const o=eb(i),l=Nh(t,n,o,s).then(c=>tb(c,r(...o)),()=>!1).then(c=>(c?Ba.set(e,!0):Ba.delete(e),c));return Ba.set(e,l),l}function rb(t,e=""){const n=!!Dh(),r=e?null:Oc(),i=e?"":_1(),s=e||"blob";if(!n||!e&&(!r||!i)||Ao.has(s))return null;if(!(s in Lr))try{if(e)Lr[s]={revoke:!1,src:e,worker:null};else if(r){const o=new r.Blob([i],{type:"text/javascript"});Lr[s]={revoke:!0,src:r.URL.createObjectURL(o),worker:null}}}catch(o){return null}return{key:s,src:Lr[s].src}}function ab(t,e){const n=Lr[t],r=Dh();if(!n||!r||Ao.has(t))return null;if(!n.worker)try{n.worker=new r(e)}catch(i){return Fh(t,!0),null}return n.worker}function Pc(t=!0,e,n,r,i){const{timeout:s,workerUrl:o}=q1(i),l=function(...u){const f=n(...u);r(f)};let c=l;if(t){const u=rb(e,o),f=u?ab(u.key,u.src):null;if(f&&u){const{key:d}=u;c=function(...h){var m;const S=()=>{Fh(d,!0),c=l,l(...h)};try{const E=`${d}:${e}`,C=(m=Ba.get(E))!=null?m:nb(f,E,e,n,h,s);Nh(f,e,h,s).then(w=>{C===!0?r(w):C.then($=>$?r(w):S())},S)}catch(E){S()}}}}return c}function ib(){const t=Oc();for(const e in Lr){const n=Lr[e];n.worker&&n.worker.terminate(),n.src&&n.revoke&&(t==null||t.URL.revokeObjectURL(n.src)),delete Lr[e]}Ao.clear(),Ba.clear()}const Mc=34,ls=10,Lc=13;function $h(t){const e=t.charCodeAt(0);function n(i,s){const o=[];let l=i.length,c=0,u=0,f=l<=0,d=!1;i.charCodeAt(0)===65279&&c++,i.charCodeAt(l-1)===ls&&--l,i.charCodeAt(l-1)===Lc&&--l;function h(){if(f)return null;if(d)return d=!1,null;const S=c;let E,C;if(i.charCodeAt(S)===Mc){for(;++c<l;)if(i.charCodeAt(c)===Mc){if(i.charCodeAt(c+1)!==Mc)break;c++}return(C=c++)>=l?f=!0:(E=i.charCodeAt(c++))===ls?d=!0:E===Lc&&(d=!0,i.charCodeAt(c)===ls&&++c),i.slice(S+1,C).replace(/""/g,'"')}for(;c<l;){if((E=i.charCodeAt(C=c++))===ls)d=!0;else if(E===Lc)d=!0,i.charCodeAt(c)===ls&&++c;else if(E!==e)continue;return i.slice(S,C)}return f=!0,i.slice(S,l)}let m;for(;(m=h())!==null;){const S=[];for(;m!==null;)S.push(m),m=h();if(s){const E=s(S,u++);E!=null&&o.push(E)}else o.push(S)}return o}function r(i,s){let o=[];return n(i,(l,c)=>{var u;if(c===0)return o=l,null;const f={};for(let d=0;d<o.length;d++)f[o[d]]=(u=l[d])!=null?u:"";return s?s(f,c-1,o):f})}return{parse:r,parseRows:n}}const Bh=$h(","),zh=$h(" "),sb=Bh.parse,ob=Bh.parseRows,lb=zh.parse,cb=zh.parseRows;function Uh(t){const e=[];return t.forEach(function(n,r){const i=n[0];n.forEach(function(s,o){if(o>0){if(typeof e[o-1]=="undefined"&&(e[o-1]={}),typeof s=="undefined")throw new Error(`Source data is missing a component at (${r}, ${o})!`);e[o-1][i]=s}})}),e}function kh(t){const e=t[0],n=[];return t.forEach(function(r,i){if(i>0){const s={};r.forEach(function(o,l){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${i}, ${l})!`);s[e[l]]=o}),n.push(s)}}),n}function Gh(t,e){const n=[];let r,i;if(Array.isArray(t)){const s=function(o,l){if(o[l]!==void 0)return o[l];const u=l.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let f=o;return u.some(function(d){return!(f=f&&typeof f=="object"&&d in f?f[d]:void 0)}),f};e.x?r=e.value.concat(e.x):r=e.value,n.push(r),t.forEach(function(o){const l=r.map(function(c){let u=s(o,c);return typeof u=="undefined"&&(u=null),u});n.push(l)}),i=kh(n)}else Object.keys(t).forEach(function(s){var o;const l=[].concat(t[s]);(o=l.unshift)==null||o.call(l,s),n.push(l)}),i=Uh(n);return i}function ub(t,e="csv",n,r,i){const s=new XMLHttpRequest,o={csv:fb,tsv:db,json:Gh};s.open("GET",t),n&&Object.keys(n).forEach(function(l){s.setRequestHeader(l,n[l])}),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){const l=s.responseText;l&&i.call(this,o[e](e==="json"?JSON.parse(l):l,r))}else throw new Error(`${t}: Something went wrong loading!`)},s.send()}function Xh(t,e){const n=t.rows(e);let r;return n.length===1?(r=[{}],n[0].forEach(i=>{r[0][i]=null})):r=t.parse(e),r}function fb(t){return Xh({rows:ob,parse:sb},t)}function db(t){return Xh({rows:cb,parse:lb},t)}const hb=5e3;function vb(t){var e,n;const r=t[0];if(qe(r)){let i=0;for(let s=0,o=t.length;s<o;s++)i+=(n=(e=t[s])==null?void 0:e.length)!=null?n:0;return i}return t.length*Object.keys(r!=null?r:{}).length}function Wh(t,e){const n=t||(e==null?void 0:e.data_keys);return n!=null&&n.x&&(e.data_x=n.x),n}function gb(t,e,n){const r=this,{config:i}=r;let s;t.forEach(o=>{const l=r.getXKey(o);if(n.customX||n.timeSeries?n.xs.indexOf(l)>=0?s=(n.appendXs&&r.data.xs[o]||[]).concat(e.map((c,u)=>{const f=c[l];return Ge(f)?r.generateTargetX(f,o,u):!1}).filter(c=>c!==!1)):i.data_x?s=this.getOtherTargetXs():vn(i.data_xs)&&(s=r.getXValuesOfXKey(l,r.data.targets)):s=e.map((c,u)=>u),s)r.data.xs[o]=s;else throw new Error(`x is not defined for id = "${o}".`)})}var pb={convertData(t,e){const{config:n}=this,r=o=>!(o!=null&&o.length)||lr(o[0])?!1:n.boost_useWorker==="auto"?vb(o)>=hb:!!n.boost_useWorker,i=n.boost_workerUrl?{workerUrl:n.boost_workerUrl}:void 0;let s=t;if(t.bindto&&(s={},["url","mimeType","headers","keys","json","rows","columns"].forEach(o=>{const l=`data_${o}`;l in t&&(s[o]=t[l])})),s.url&&e)ub(s.url,s.mimeType,s.headers,Wh(s.keys,n),e);else if(s.json)Pc(r(s.json),"json",Gh,e,i)(s.json,Wh(s.keys,n));else if(s.rows)Pc(r(s.rows),"rows",kh,e,i)(s.rows);else if(s.columns)Pc(r(s.columns),"columns",Uh,e,i)(s.columns);else if(t.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(t,e){const n=this,{axis:r,config:i,state:s}=n,o=i.data_type,l=Object.keys(t[0]||{}),{ids:c,xs:u}=l.length?l.reduce((S,E)=>(n.isX.call(n,E)?S.xs.push(E):S.ids.push(E),S),{ids:[],xs:[]}):{ids:[],xs:[]},f={appendXs:e,xs:u,categorized:r==null?void 0:r.isCategorized(),timeSeries:r==null?void 0:r.isTimeSeries(),customX:r==null?void 0:r.isCustomX()};gb.bind(n)(c,t,f);const d=f.customX&&f.categorized&&i.axis_x_categories.length?new Map(i.axis_x_categories.map((S,E)=>[S,E])):null,h=i.data_idConverter.bind(n.api),m=c.map((S,E)=>{const C=h(S),w=n.getXKey(S),$=f.customX&&f.categorized,z=$&&E===0&&(()=>{const H=Yf(i.axis_x_categories);return t.every(_=>H.has(_[w]))})(),B=t.__append__,W=w===null&&B?n.api.data.values(S).length:0;return{id:C,id_org:S,values:t.map((H,_)=>{var q;const st=H[w];let it=H[S],ot;if(it=it!==null&&!isNaN(it)&&!He(it)?+it:qe(it)||He(it)?it:null,($||s.hasRadar)&&E===0&&!mn(st)){!z&&_===0&&!B&&(i.axis_x_categories=[],d&&d.clear());const ct=String(st);ot=(q=d==null?void 0:d.get(ct))!=null?q:-1,ot===-1&&(ot=i.axis_x_categories.length,i.axis_x_categories.push(st),d==null||d.set(ct,ot))}else ot=n.generateTargetX(st,S,W+_);return(mn(it)||n.data.xs[S].length<=_)&&(ot=void 0),{x:ot,value:it,id:C,index:-1}}).filter(H=>sn(H.x))}});if(m.forEach(S=>{var E;i.data_xSort&&(S.values=S.values.sort((C,w)=>{const $=C.x||C.x===0?C.x:1/0,z=w.x||w.x===0?w.x:1/0;return $-z})),S.values.forEach((C,w)=>C.index=w),(E=n.data.xs[S.id])==null||E.sort((C,w)=>C-w)}),s.hasNegativeValue=m.some(S=>S.values.some(E=>E.value!==null&&E.value<0)),s.hasPositiveValue=m.some(S=>S.values.some(E=>E.value!==null&&E.value>0)),o&&n.isValidChartType(o)){const S=n.mapToIds(m).filter(E=>!(E in i.data_types)||!n.isValidChartType(i.data_types[E]));n.setTargetType(S,o)}return m.forEach(S=>n.cache.add(S.id_org,S,!0)),m}};const mb={areaRange:{high:0,mid:1,low:2},candlestick:{open:0,high:1,low:2,close:3,volume:4}};function Vh(t){return qe(t)?t:[t]}var xb={isX(t){const e=this,{config:n}=e,r=n.data_x&&t===n.data_x,i=vn(n.data_xs)&&ky(n.data_xs,t);return r||i},isStackNormalized(){const{config:t}=this;return!!((t.data_stack_normalize===!0||Kn(t.data_stack_normalize))&&t.data_groups.length)},isStackNormalizedPerGroup(){var t;const{config:e}=this;return!!(Kn(e.data_stack_normalize)&&((t=e.data_stack_normalize)!=null&&t.perGroup)&&e.data_groups.length)},isGrouped(t){const e=this.config.data_groups;return t?e.some(n=>n.indexOf(t)>=0&&n.length>1):e.length>0},hasAxisGroupedData(t){const e=this,{axis:n}=e;return e.data.targets.filter(s=>n.getId(s.id)===t).map(s=>s.id).some(s=>e.isGrouped(s))},getXKey(t){const e=this,{config:n}=e;return n.data_x?n.data_x:vn(n.data_xs)?n.data_xs[t]:null},getXValuesOfXKey(t,e){const n=this,r=e&&vn(e)?n.mapToIds(e):[];let i;return r.forEach(s=>{n.getXKey(s)===t&&(i=n.data.xs[s])}),i},getIndexByX(t,e){const n=this;return e?e.indexOf(je(t)?t:+t):(n.filterByX(n.data.targets,t)[0]||{index:null}).index},getXValue(t,e){const n=this;return t in n.data.xs&&n.data.xs[t]&&Ge(n.data.xs[t][e])?n.data.xs[t][e]:e},getOtherTargetXs(){const t=this,e=Object.keys(t.data.xs);return e.length?t.data.xs[e[0]]:null},getOtherTargetX(t){const e=this.getOtherTargetXs();return e&&t<e.length?e[t]:null},addXs(t){const e=this,{config:n}=e;Object.keys(t).forEach(r=>{n.data_xs[r]=t[r]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(vn(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(t){const e=this,{config:n}=e;let r;return t&&(r=n.data_names[t.id],t.name=r!==void 0?r:t.id),t},getAllValuesOnIndex(t,e=!1){const n=this;let r=n.filterTargetsToShow(n.data.targets).map(i=>n.addName(n.getValueOnIndex(i.values,t)));return e&&(r=r.filter(i=>i&&"value"in i&&Ge(i.value))),r},getValueOnIndex(t,e){var n;if(((n=t[e])==null?void 0:n.index)===e)return t[e];const r=t.filter(i=>i.index===e);return r.length?r[0]:null},updateTargetX(t,e){const n=this;t.forEach(r=>{r.values.forEach((i,s)=>{i.x=n.generateTargetX(e[s],r.id,s)}),n.data.xs[r.id]=e})},updateTargetXs(t,e){const n=this;t.forEach(r=>{e[r.id]&&n.updateTargetX([r],e[r.id])})},generateTargetX(t,e,n){const r=this,{axis:i}=r;let s=i!=null&&i.isCategorized()?n:t||n;if(i!=null&&i.isTimeSeries()){const o=Wn.bind(r);s=o(t||r.getXValue(e,n))}else i!=null&&i.isCustomX()&&!(i!=null&&i.isCategorized())&&(s=Ge(t)?+t:r.getXValue(e,n));return s},updateXs(t){t.length&&(this.axis.xs=t.map(e=>e.x))},getPrevX(t){const e=this.axis.xs[t-1];return sn(e)?e:null},getNextX(t){const e=this.axis.xs[t+1];return sn(e)?e:null},getBaseValue(t){const e=this,{hasAxis:n}=e.state;let{value:r}=t;return r&&n&&(e.isAreaRangeType(t)?r=e.getRangedData(t,"mid"):e.isBubbleZType(t)&&(r=e.getBubbleZData(r,"y"))),r},getMinMaxValue(t){const e=this.getBaseValue.bind(this);let n=1/0,r=-1/0;const i=t||this.data.targets.map(s=>s.values);for(let s=0;s<i.length;s++){const o=i[s];for(let l=0;l<o.length;l++){const c=e(o[l]);ae(c)&&(c<n&&(n=c),c>r&&(r=c))}}return{min:n,max:r}},getMinMaxData(){const t=this,e=Oe.dataMinMax;let n=t.cache.get(e);if(!n){const r=t.data.targets.map(u=>u.values),i=t.getMinMaxValue(r),s=[],o=[],{min:l,max:c}=i;r.forEach(u=>{const f=t.getFilteredDataByValue(u,l),d=t.getFilteredDataByValue(u,c);if(f.length)for(let h=0;h<f.length;h++)s.push(f[h]);if(d.length)for(let h=0;h<d.length;h++)o.push(d[h])}),t.cache.add(e,n={min:s,max:o})}return n},getTotalPerIndex(t){const e=this,{config:n}=e,r=t?`${Oe.dataTotalPerIndex}-${t}`:Oe.dataTotalPerIndex,i=e.cache.get(r);let s=(i==null?void 0:i.generation)===e.state.dataGeneration?i.value:null;if((e.config.data_groups.length||e.isStackNormalized())&&!s){s=[];let{targets:o}=e.data;if(e.isStackNormalizedPerGroup()&&t){const l=n.data_groups.find(c=>c.indexOf(t)>=0);if(l)o=o.filter(c=>l.indexOf(c.id)>=0);else return null}o.forEach(l=>{l.values.forEach((c,u)=>{s[u]||(s[u]=0),s[u]+=ae(c.value)?c.value:0})}),e.cache.add(r,{generation:e.state.dataGeneration,value:s})}return s},getVisibleTotalPerIndex(t){const e=this,{api:n,config:r,state:i,cache:s}=e;let o=s.get(Oe.visibleTotalPerIndex);if((!o||o.generation!==i.dataGeneration)&&(o=s.add(Oe.visibleTotalPerIndex,{generation:i.dataGeneration,values:new Map})),o.values.has(t))return o.values.get(t);const l=n.data.values.bind(n),{hiddenTargetIds:c}=i;let u=e.getTotalPerIndex(t);if(u===null)return o.values.set(t,u),u;if(c.size){let f=[...c];if(t){const d=r.data_groups.find(h=>h.indexOf(t)>=0);d&&(f=f.filter(h=>d.indexOf(h)>=0))}if(f.length){let d=l(f,!1);d.length&&(d=d.reduce((h,m)=>h.map((S,E)=>(ae(S)?S:0)+m[E])),u=u.map((h,m)=>h-d[m]))}}return o.values.set(t,u),u},getTotalDataSum(t){const e=this,n=Oe.dataTotalSum;let r=e.cache.get(n);return ae(r)||(r=e.data.targets.reduce((i,s)=>i+s.values.reduce((o,l)=>{var c;return o+((c=l.value)!=null?c:0)},0),0),e.cache.add(n,r)),t&&(r-=e.getHiddenTotalDataSum()),r},getHiddenTotalDataSum(){const t=this,{api:e,state:{hiddenTargetIds:n}}=t;let r=0;return n.size&&(r=e.data.values.bind(e)([...n]).reduce((i,s)=>i+s,0)),r},getFilteredDataByValue(t,e){return t.filter(n=>this.getBaseValue(n)===e)},getMaxDataCount(){const{targets:t}=this.data;let e=0;for(let n=0;n<t.length;n++)t[n].values.length>e&&(e=t[n].values.length);return e},getMaxDataCountTarget(){const t=this,{cache:e,state:n}=t,r=e.get(Oe.maxDataCountTarget);if(r&&r.generation===n.dataGeneration)return r.value;let i=t.filterTargetsToShow()||[];const s=i.length,o=t.config.axis_x_inverted;if(s>1){const l=[];for(let c=0;c<i.length;c++){const u=i[c].values;for(let f=0;f<u.length;f++)l.push(u[f].x)}i=l,i=ti(zl(i)).map((c,u,f)=>({x:c,index:o?f.length-u-1:u}))}else s&&(i=i[0].values.concat());return e.add(Oe.maxDataCountTarget,{value:i,generation:n.dataGeneration}),i},mapToIds(t){return t.map(e=>e.id)},mapToTargetIds(t){const e=this;return t?qe(t)?t.concat():[t]:e.mapToIds(e.data.targets)},hasTarget(t,e){const n=this.mapToIds(t);for(let r=0,i;i=n[r];r++)if(i===e)return!0;return!1},isTargetToShow(t){return!this.state.hiddenTargetIds.has(t)},isLegendToShow(t){return!this.state.hiddenLegendIds.has(t)},getTargetsToShow(){var t;const{state:e}=this;return(t=e._targetsToShow)!=null?t:this.filterTargetsToShow()},filterTargetsToShow(t){const e=this;if(!t){const{cache:n,data:r,state:i}=e,s=Oe.filteredTargets,o=n.get(s);if(o&&o.generation===i.dataGeneration)return o.value;const l=r.targets.filter(c=>e.isTargetToShow(c.id));return n.add(s,{value:l,generation:i.dataGeneration}),l}return t.filter(n=>e.isTargetToShow(n.id))},mapTargetsToUniqueXs(t){const e=this,{axis:n}=e;let r=[];return t!=null&&t.length&&(r=zl(Wy(t.map(i=>i.values.map(s=>+s.x)))),r=n!=null&&n.isTimeSeries()?r.map(i=>new Date(+i)):r.map(Number)),ti(r)},addTargetIds(t,e){const{state:n}=this;Vh(e).forEach(r=>n[t].add(r))},removeTargetIds(t,e){const{state:n}=this;Vh(e).forEach(r=>n[t].delete(r))},addHiddenTargetIds(t){this.addTargetIds("hiddenTargetIds",t),this.cache.remove(Oe.visibleTotalPerIndex)},removeHiddenTargetIds(t){this.removeTargetIds("hiddenTargetIds",t),this.cache.remove(Oe.visibleTotalPerIndex)},addHiddenLegendIds(t){this.addTargetIds("hiddenLegendIds",t)},removeHiddenLegendIds(t){this.removeTargetIds("hiddenLegendIds",t)},getValuesAsIdKeyed(t){const e=this,{hasAxis:n}=e.state,r={},i=e.isMultipleX();let s=null;if(i){const o=e.cache.get(Oe.valuesXIndexMap);if(o&&o.generation===e.state.dataGeneration)s=o.value;else{const l=e.mapTargetsToUniqueXs(e.data.targets).map(c=>je(c)?c:+c);s=new Map(l.map((c,u)=>[c,u])),e.cache.add(Oe.valuesXIndexMap,{value:s,generation:e.state.dataGeneration})}}return t.forEach(o=>{const l=[];o.values.filter(({value:c})=>Ge(c)||c===null).forEach(c=>{let{value:u}=c;if(u!==null&&e.isCandlestickType(c)&&(u=qe(u)?u.slice(0,4):[u.open,u.high,u.low,u.close]),qe(u))l.push(...u);else if(He(u)&&"high"in u)l.push(...Object.values(u));else if(e.isBubbleZType(c))l.push(n&&e.getBubbleZData(u,"y"));else if(i&&s){const f=je(c.x)?c.x:+c.x,d=s.get(f);d!==void 0&&(l[d]=u)}else l.push(u)}),r[o.id]=l}),r},hasMultiTargets(){return this.filterTargetsToShow().length>1},orderTargets(t){const e=this,n=t.slice(),r=e.getSortCompareFn();return r&&n.sort(r),n},getSortCompareFn(t=!1){const e=this,{config:n}=e,r=n.data_order,i=/asc/i.test(r),s=/desc/i.test(r);let o;if(i||s){const l=(u,f)=>u+Math.abs(f.value),c=u=>ae(u)?u:"values"in u?u.values.reduce(l,0):u.value;o=(u,f)=>{const d=c(u),h=c(f);return t?i?d-h:h-d:i?h-d:d-h}}else ie(r)&&(o=r.bind(e.api));return o||null},filterByX(t,e){return this.getValuesByX(t).get(this.getXCacheKey(e))||[]},filterNullish(t){const e=n=>Ge(n.value);return t&&t.filter(n=>"value"in n?e(n):n.values.some(e))},filterRemoveNull(t){return t.filter(e=>Ge(this.getBaseValue(e)))},filterByXDomain(t,e){return t.map(n=>({id:n.id,id_org:n.id_org,values:n.values.filter(r=>e[0]<=r.x&&r.x<=e[1])}))},hasDataLabel(){const t=this.config.data_labels;return Ra(t)&&t||Kn(t)&&vn(t)},hasNullDataValue(t){return t.some(({value:e})=>e===null)},getDataIndexFromEvent(t){const e=this,{$el:n,config:r,state:{hasRadar:i,inputType:s,eventReceiver:{coords:o,rect:l}}}=e;let c;if(i){let u=t.target;/tspan/i.test(u.tagName)&&(u=u.parentNode);const f=Yt(u).datum();c=f&&Object.keys(f).length===1?f.index:void 0}else{const u=r.axis_rotated,f=Oh(n.chart.node()),d=s==="touch"&&t.changedTouches?t.changedTouches[0]:t;let h=u?d.clientY+f.y:d.clientX+f.x;if(Rc(n.svg)){const m=[h,0];u&&m.reverse(),h=So(n.eventRect.node(),...m)[u?"y":"x"]}else h-=u?l.top:l.left;c=Ul(o,h,0,o.length-1,u)}return c},getDataLabelLength(t,e,n){var r,i,s;const o=this,l=1.3,c=[t,e].map(u=>o.dataLabelFormat()(u));if(o.config.render_mode==="canvas"&&!o.$el.svg){const u=(i=(r=o.$el.chart)==null?void 0:r.node)==null?void 0:i.call(r),f=u==null?void 0:u.ownerDocument,d=f==null?void 0:f.createElementNS("http://www.w3.org/2000/svg","svg");if(u&&d){const h=c.map(S=>{const E=f.createElementNS("http://www.w3.org/2000/svg","text");return E.textContent=S,d.appendChild(E),E});d.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",u.appendChild(d);const m=h.map(S=>S.getBoundingClientRect()[n]*l);return d.remove(),m}}return((s=o.getTextRect(c))==null?void 0:s.map(u=>u[n]*l))||[0,0]},isNoneArc(t){return this.hasTarget(this.data.targets,t.id)},isArc(t){return"data"in t&&this.hasTarget(this.data.targets,t.data.id)},findSameXOfValues(t,e){const n=t[e].x,r=[];let i;for(i=e-1;i>=0&&n===t[i].x;i--)r.push(t[i]);for(i=e;i<t.length&&n===t[i].x;i++)r.push(t[i]);return r},getXCacheKey(t){return je(t)?t:+t},getValuesByX(t){const e=this,{cache:n,state:r}=e,i=t.map(l=>{const{values:c}=l,u=c[0],f=c[c.length-1];return`${l.id}:${c.length}:${u?e.getXCacheKey(u.x):""}:${f?e.getXCacheKey(f.x):""}`}).join("|"),s=n.get(Oe.valuesByX);if(s&&s.generation===r.dataGeneration&&s.targetKey===i)return s.value;const o=new Map;for(let l=0;l<t.length;l++){const c=t[l].values;for(let u=0;u<c.length;u++){const f=c[u],d=e.getXCacheKey(f.x),h=o.get(d);h?h.push(f):o.set(d,[f])}}return n.add(Oe.valuesByX,{generation:r.dataGeneration,targetKey:i,value:o}),o},getClosestCandidates(t,e,n=!0){const r=this,{config:i,scale:s}=r,o=t.length,l=t[0];if(!n||o<200||!l||!i.data_xSort)return t;const c=r.isBarType(l.id),u=r.isCandlestickType(l.id),f=i.point_sensitivity;if(!(c||u)&&!ae(f))return t;const d=s.zoom||s.x,h=e[+i.axis_rotated],m=d(t[0].x)<=d(t[o-1].x);let S=0,E=o-1;for(;S<E;){const B=S+E>>1,W=d(t[B].x);(m?W<h:W>h)?S=B+1:E=B}const C=[],w=new Set,$=B=>{B>=0&&B<o&&!w.has(B)&&(w.add(B),C.push(t[B]))},z=B=>{if(B<0||B>=o)return;const W=r.getXCacheKey(t[B].x);let H=B;for(;H>=0&&r.getXCacheKey(t[H].x)===W;)$(H--);for(H=B+1;H<o&&r.getXCacheKey(t[H].x)===W;)$(H++)};if(c||u)for(let B=S-2;B<=S+2;B++)z(B);else{const B=f,W=(H,_)=>{for(let q=H;q>=0&&q<o;q+=_){const st=t[q];if(Math.abs(d(st.x)-h)>B)break;$(q)}};W(S,1),W(S-1,-1)}return C},findClosestFromTargets(t,e){const n=this,r=[];for(let i=0;i<t.length;i++){const s=n.findClosest(t[i].values,e);s&&r.push(s)}return n.findClosest(r,e,!1)},findClosest(t,e,n=!0){const r=this,{$el:{main:i}}=r,s=r.getClosestCandidates(t,e,n);let o,l;for(let c=0;c<s.length;c++){const u=s[c];if(!u||!Ge(u.value))continue;const f=r.isBarType(u.id),d=r.isCandlestickType(u.id);if(f||d){const h=f?`.${rr.chartBar}.${ze.target}${r.getTargetSelectorSuffix(u.id)} .${rr.bar}-${u.index}`:`.${Kr.chartCandlestick}.${ze.target}${r.getTargetSelectorSuffix(u.id)} .${Kr.candlestick}-${u.index} path`;!l&&r.isWithinBar(i.select(h).node())&&(l=u)}else{const h=r.dist(u,e),m=r.getPointSensitivity(u);h<m&&(o===void 0||h<o)&&(o=h,l=u)}}return l},dist(t,e){const n=this,{config:{axis_rotated:r},scale:i}=n,s=+r,o=+!r,l=n.circleY(t,t.index),u=(i.zoom||i.x)(t.x)-e[s],f=l-e[o];return Math.sqrt(u*u+f*f)},convertValuesToStep(t){const e=this,{axis:n,config:r}=e,i=r.line_step_type,s=n?n.isCategorized():!1,o=qe(t)?t.concat():[t];if(!(s||/step\-(after|before)/.test(i)))return t;if(o.length){const l=o[0],c=o[o.length-1],{id:u}=l;let{x:f}=l;o.unshift({x:--f,value:l.value,id:u}),s&&i==="step-after"&&o.unshift({x:f-1,value:l.value,id:u}),f=c.x,o.push({x:++f,value:c.value,id:u}),s&&i==="step-before"&&o.push({x:f+1,value:c.value,id:u})}return o},convertValuesToRange(t){const e=qe(t)?t.concat():[t],n=[];return e.forEach(r=>{const{x:i,id:s}=r;n.push({x:i,id:s,value:r.value[0]}),n.push({x:i,id:s,value:r.value[2]})}),n},updateDataAttributes(t,e){const n=this,{config:r}=n,i=r[`data_${t}`];return mn(e)||(Object.keys(e).forEach(s=>{i[s]=e[s]}),n.redraw({withLegend:!0})),i},getRangedData(t,e="",n="areaRange"){var r,i;const s=t==null?void 0:t.value;if(qe(s)){if(n==="bar")return s.reduce((o,l)=>l-o);{const o=(i=(r=mb[n])==null?void 0:r[e])!=null?i:-1;return o>=0?s[o]:void 0}}else if(s&&e)return s[e];return s},setRatioForGroupedData(t){const e=this,{config:n}=e;if(n.data_groups.length&&t.some(r=>e.isGrouped(r.id))){const r=i=>e.getRatio("index",i,!0);t.forEach(i=>{"values"in i?i.values.forEach(r):r(i)})}},getRatio(t,e,n=!1){const r=this,{config:i,state:s}=r,o=r.api;let l=0;if(e&&o.data.shown().length)if(l=e.ratio||e.value,t==="arc")if(r.pie.padAngle()())l=e.value/r.getTotalDataSum(!0);else{const c=i.gauge_fullCircle?r.getArcLength():r.getStartingAngle()*-2,u=r.hasType("gauge")?c:Math.PI*2;l=(e.endAngle-e.startAngle)/u}else if(t==="index"){const c=r.getVisibleTotalPerIndex(r.isStackNormalizedPerGroup()?e.id:void 0);if(c===null)return l;const u=c[e.index];e.ratio=ae(e.value)&&c&&u?e.value/u:0,l=e.ratio}else if(t==="radar")l=parseFloat(String(Math.max(e.value,0)))/s.current.dataMax*i.radar_size_ratio;else if(t==="bar"){const u=r.getYScaleById.bind(r)(e.id).domain().reduce((f,d)=>d-f);l=u===0?0:Math.abs(r.getRangedData(e,null,t)/u)}else t==="treemap"&&(l/=r.getTotalDataSum(!0));return n&&l?l*100:l},updateDataIndexByX(t){const e=this,n=t.reduce((r,i,s)=>(r[Number(i.x)]=s,r),{});e.data.targets.forEach(r=>{r.values.forEach((i,s)=>{let o=n[Number(i.x)];o===void 0&&(o=s),i.index=o})})},isBubbleZType(t){return this.isBubbleType(t)&&(He(t.value)&&("z"in t.value||"y"in t.value)||qe(t.value)&&t.value.length>=2)},isBarRangeType(t){var e;const n=this,{value:r}=t;return n.isBarType(t)&&!((e=n.isSubchartSourceTypeOf)!=null&&e.call(n,t,qt.CANDLESTICK))&&qe(r)&&r.length>=2&&r.every(ae)},getDataById(t){var e;const n=this.cache.get(t)||this.api.data(t);return(e=n==null?void 0:n[0])!=null?e:n}};function Eo(t,e=!1){const n=this,{api:r}=n;e&&n.api.flush(!0),t==null||t.call(r)}var yb={load(t,e){const n=this,{axis:r,data:i,org:s,scale:o}=n,{append:l}=e,c={domain:null,currentDomain:null,x:null};let u=t;if(u){e.filter&&(u=u.filter(e.filter)),(e.type||e.types)&&u.forEach(d=>{var h;const m=((h=e.types)==null?void 0:h[d.id])||e.type;n.setTargetType(d.id,m)});const f=new Map(u.map(d=>[d.id,d]));i.targets.forEach(d=>{const h=f.get(d.id);if(h){if(l){const m=h.values;for(let S=0;S<m.length;S++)d.values.push(m[S])}else d.values=h.values;f.delete(d.id)}}),f.forEach(d=>i.targets.push(d))}if(n.state.isCanvasMode){n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.updateTypesElements(),Eo.call(n,e.done,e.resizeAfter);return}n.updateTargets(i.targets),o.zoom&&(c.x=r.isCategorized()?o.x.orgScale():(s.xScale||o.x).copy(),c.domain=n.getXDomain(i.targets),c.x.domain(c.domain),c.currentDomain=n.zoom.getDomain(),n.withinRange(c.currentDomain,void 0,c.domain)||(o.x.domain(c.domain),o.zoom=null,n.$el.eventRect.property("__zoom",null))),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(s.xDomain=c.domain,s.xScale=c.x,r.isCategorized()&&(c.currentDomain=n.getZoomDomainValue(c.currentDomain),s.xDomain=n.getZoomDomainValue(s.xDomain),s.xScale=c.x.domain(s.xDomain)),n.updateCurrentZoomTransform(c.x,c.currentDomain)):s.xScale&&s.xScale.domain(s.xDomain),n.updateTypesElements(),Eo.call(n,e.done,e.resizeAfter)},loadFromArgs(t){const e=this;e.config&&(e.cache.reset(!1,[Oe.filteredTargets,Oe.maxDataCountTarget,Oe.valuesXIndexMap,Oe.maxTickSize]),e.convertData(t,n=>{const r=t.data||n;t.append&&(r.__append__=!0),r&&e.load(e.convertDataToTargets.call(e,r),t)}))},unload(t,e){var n;const r=this,{state:i,$el:s,$T:o}=r,l=!!((n=r.hasLegendDefsPoint)!=null&&n.call(r));let c=e,u=t;if(r.cache.reset(!1,[Oe.filteredTargets,Oe.maxDataCountTarget,Oe.valuesXIndexMap,Oe.maxTickSize]),c||(c=()=>{}),u=u.filter(h=>r.hasTarget(r.data.targets,h)),u.length===0){c();return}const f=new Set(u);if(i.isCanvasMode){u.forEach(h=>{i.withoutFadeIn[h]=!1}),r.data.targets=r.data.targets.filter(h=>!f.has(h.id)),r.removeHiddenTargetIds(u),r.removeHiddenLegendIds(u),r.updateTypesElements(),c();return}u.forEach(h=>{var m;const S=r.getTargetSelectorSuffix(h);i.withoutFadeIn[h]=!1,s.legend&&s.legend.selectAll(`.${$e.legendItem}${S}`).remove(),l&&((m=s.defs)==null||m.select(`#${r.getDefsPointId(S)}`).remove())}),r.data.targets=r.data.targets.filter(h=>!f.has(h.id)),i.hasFunnel&&r.updateFunnel(r.data.targets),i.hasTreemap&&r.updateTargetsForTreemap(r.data.targets),r.updateTypesElements();const d=s.svg.selectAll(u.map(h=>r.selectorTarget(h)));o(d).style("opacity","0").remove().call(eo,c)}},Tb={value:()=>{}};function jh(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Co(n)}function Co(t){this._=t}function bb(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Co.prototype=jh.prototype={constructor:Co,on:function(t,e){var n=this._,r=bb(t+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(t=r[s]).type)&&(i=Sb(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=r[s]).type)n[i]=Hh(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Hh(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Co(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,i=s.length;r<i;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};function Sb(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function Hh(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Tb,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Io=jh;const Ab={passive:!1},cs={capture:!0,passive:!1};function Dc(t){t.stopImmediatePropagation()}function ui(t){t.preventDefault(),t.stopImmediatePropagation()}function Fc(t){var e=t.document.documentElement,n=Yt(t).on("dragstart.drag",ui,cs);"onselectstart"in e?n.on("selectstart.drag",ui,cs):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Nc(t,e){var n=t.document.documentElement,r=Yt(t).on("dragstart.drag",null);e&&(r.on("click.drag",ui,cs),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ro=(t=>()=>t);function $c(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:s,x:o,y:l,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}$c.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Eb(t){return!t.ctrlKey&&!t.button}function Cb(){return this.parentNode}function Ib(t,e){return e==null?{x:t.x,y:t.y}:e}function Rb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yh(){var t=Eb,e=Cb,n=Ib,r=Rb,i={},s=Io("start","drag","end"),o=0,l,c,u,f,d=0;function h(B){B.on("mousedown.drag",m).filter(r).on("touchstart.drag",C).on("touchmove.drag",w,Ab).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(B,W){if(!(f||!t.call(this,B,W))){var H=z(this,e.call(this,B,W),B,W,"mouse");H&&(Yt(B.view).on("mousemove.drag",S,cs).on("mouseup.drag",E,cs),Fc(B.view),Dc(B),u=!1,l=B.clientX,c=B.clientY,H("start",B))}}function S(B){if(ui(B),!u){var W=B.clientX-l,H=B.clientY-c;u=W*W+H*H>d}i.mouse("drag",B)}function E(B){Yt(B.view).on("mousemove.drag mouseup.drag",null),Nc(B.view,u),ui(B),i.mouse("end",B)}function C(B,W){if(t.call(this,B,W)){var H=B.changedTouches,_=e.call(this,B,W),q=H.length,st,it;for(st=0;st<q;++st)(it=z(this,_,B,W,H[st].identifier,H[st]))&&(Dc(B),it("start",B,H[st]))}}function w(B){var W=B.changedTouches,H=W.length,_,q;for(_=0;_<H;++_)(q=i[W[_].identifier])&&(ui(B),q("drag",B,W[_]))}function $(B){var W=B.changedTouches,H=W.length,_,q;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),_=0;_<H;++_)(q=i[W[_].identifier])&&(Dc(B),q("end",B,W[_]))}function z(B,W,H,_,q,st){var it=s.copy(),ot=ur(st||H,W),ct,gt,tt;if((tt=n.call(B,new $c("beforestart",{sourceEvent:H,target:h,identifier:q,active:o,x:ot[0],y:ot[1],dx:0,dy:0,dispatch:it}),_))!=null)return ct=tt.x-ot[0]||0,gt=tt.y-ot[1]||0,function ft(lt,bt,St){var Mt=ot,Ot;switch(lt){case"start":i[q]=ft,Ot=o++;break;case"end":delete i[q],--o;case"drag":ot=ur(St||bt,W),Ot=o;break}it.call(lt,B,new $c(lt,{sourceEvent:bt,subject:tt,target:h,identifier:q,active:Ot,x:ot[0]+ct,y:ot[1]+gt,dx:ot[0]-Mt[0],dy:ot[1]-Mt[1],dispatch:it}),_)}}return h.filter=function(B){return arguments.length?(t=typeof B=="function"?B:Ro(!!B),h):t},h.container=function(B){return arguments.length?(e=typeof B=="function"?B:Ro(B),h):e},h.subject=function(B){return arguments.length?(n=typeof B=="function"?B:Ro(B),h):n},h.touchable=function(B){return arguments.length?(r=typeof B=="function"?B:Ro(!!B),h):r},h.on=function(){var B=s.on.apply(s,arguments);return B===s?h:B},h.clickDistance=function(B){return arguments.length?(d=(B=+B)*B,h):Math.sqrt(d)},h}var wb={setExpand(t,e,n){const r=this,{config:i,$el:{circle:s}}=r;s&&i.point_focus_expand_enabled&&r.expandCircles(t,e,n),r.expandBarTypeShapes(!0,t,e,n)},expandBarTypeShapes(t=!0,e,n,r){const i=this;["bar","candlestick"].filter(s=>i.$el[s]).forEach(s=>{r&&i.$el[s].classed(ze.EXPANDED,!1),i.getShapeByIndex(s,e,n).classed(ze.EXPANDED,t)})},setOverOut(t,e){const n=this,{config:r,state:{hasFunnel:i,hasRadar:s,hasTreemap:o},$el:{main:l}}=n,c=He(e);if(c||e!==-1){const u=r[t?"data_onover":"data_onout"].bind(n.api);if(r.color_onover&&n.setOverColor(t,e,c),c){const f=n.getTargetSelectorSuffix(e.id),d=i||o?`${ze.target+f} .${Tn.shape}`:Ze.arc+f;u(e,l.select(`.${d}`).node())}else if(r.tooltip_grouped)t&&(s&&n.isPointFocusOnly()?n.showCircleFocus(n.getAllValuesOnIndex(e,!0)):n.setExpand(e,null,!0)),!n.isMultipleX()&&l.selectAll(`.${Tn.shape}-${e}`).each(function(f){u(f,this)});else{const f=n.cache.get(Oe.setOverOut)||[],d=l.selectAll(`.${Tn.shape}-${e}`).filter(function(m){return n.isWithinShape(this,m)}),h=d.filter(function(){return f.every(m=>m!==this)});if(!t||d.empty()||f.length===h.size()&&h.nodes().every((m,S)=>m!==f[S]))for(;f.length;){const m=f.pop();r.data_onout.bind(n.api)(Yt(m).datum(),m)}h.each(function(){t&&(u(Yt(this).datum(),this),f.push(this))}),n.cache.add(Oe.setOverOut,f)}}},callOverOutForTouch(t){const e=this,n=e.cache.get(Oe.callOverOutForTouch);(He(t)&&n?t.id!==n.id:t!==n)&&((n||ae(n))&&e.setOverOut(!1,n),(t||ae(t))&&e.setOverOut(!0,t),e.cache.add(Oe.callOverOutForTouch,t))},getDraggableSelection(){const t=this,{config:e,state:n}=t;return e.interaction_enabled&&e.data_selection_draggable&&t.drag?Yh().on("drag",function(r){n.event=r,t.drag(Jn(r,this))}).on("start",function(r){n.event=r,t.dragstart(Jn(r,this))}).on("end",r=>{n.event=r,t.dragend()}):()=>{}},dispatchEvent(t,e,n){var r,i,s;const o=this,{config:l,state:{eventReceiver:c,hasAxis:u,hasFunnel:f,hasRadar:d,hasTreemap:h},$el:{eventRect:m,funnel:S,radar:E,svg:C,treemap:w}}=o;let $=(s=(i=(f||h)&&c.rect||d&&E.axes.select(`.${Rn.axis}-${e} text`)||m||((r=o.getArcElementByIdOrIndex)==null?void 0:r.call(o,e)))==null?void 0:i.node)==null?void 0:s.call(i);if($){const z=o.isMultipleX(),B=l.axis_rotated;let{width:W,left:H,top:_}=ln($);if(u&&!d&&!z){const ot=c.coords[e];ot?(W=ot.w,H+=ot.x,_+=ot.y):(W=0,H=0,_=0)}let q=H+(n?n[0]:0)+(z||B?0:W/2),st=_+(n?n[1]:0)+(B?4:0);if(Rc(C)&&o.$el.eventRect){const ot=So(o.$el.eventRect.node(),q,st,!1);q=ot.x,st=ot.y}const it={screenX:q,screenY:st,clientX:q,clientY:st,bubbles:d};(f||h)&&($=(S!=null?S:w).node()),wc[/^(mouse|click)/.test(t)?"mouse":"touch"]($,t,it)}},setDragStatus(t){this.state.dragging=t},unbindZoomEvent(){const t=this,{$el:{canvas:e,eventRect:n,svg:r,zoomResetBtn:i}}=t;n==null||n.on(".zoom wheel.zoom .drag",null),e==null||e.on(".zoom wheel.zoom .drag",null),r==null||r.on("wheel",null),i==null||i.on("click",null).style("display","none")},unbindAllEvents(){var t;const e=this,{$el:{arcs:n,eventRect:r,legend:i,region:s,svg:o,treemap:l},brush:c}=e,u=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,r,s==null?void 0:s.list,c==null?void 0:c.getSelection(),n==null?void 0:n.selectAll("path"),i==null?void 0:i.selectAll("g"),l].forEach(f=>f==null?void 0:f.on(u,null)),(t=e.unbindZoomEvent)==null||t.call(e)}},Ob={categoryName(t){var e;const{axis_x_categories:n}=this.config;return(e=n==null?void 0:n[t])!=null?e:t}};const Pb=/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g;var Mb={generateClass(t,e){const n=this.state.generateClassCache,r=`${t}\0${e}`;let i=n.get(r);return i||(i=` ${t} ${t+this.getTargetSelectorSuffix(e)}`,n.set(r,i)),i},getClass(t,e){const n=/s$/.test(t),r=/^(area|arc|line|funnel|treemap)s?$/.test(t),i=n?"id":"index";return s=>{const o=s.data||s;return((e?this.generateClass(Re[n?"shapes":"shape"],o[i]):"")+this.generateClass(Re[t],o[r?"id":i])).trim()}},getChartClass(t){return e=>Re[`chart${t}`]+this.classTarget((e.data?e.data:e).id)},generateExtraLineClass(){const e=this.config.line_classes||[],n=[];return function(r){var i;const s=r.id||((i=r.data)==null?void 0:i.id)||r;return n.indexOf(s)<0&&n.push(s),e[n.indexOf(s)%e.length]}},classRegion(t,e){return`${this.generateClass(Re.region,e)} ${"class"in t?t.class:""}`},classTarget(t){const e=this.config.data_classes[t];let n="";return e&&(n=` ${Re.target}-${e}`),this.generateClass(Re.target,t)+n},classFocus(t){return this.classFocused(t)+this.classDefocused(t)},classFocused(t){return` ${this.state.focusedTargetIds.has(t.id)?Re.focused:""}`},classDefocused(t){return` ${this.state.defocusedTargetIds.has(t.id)?Re.defocused:""}`},getTargetSelectorSuffix(t){return(t||t===0?`-${t}`:"").replace(Pb,"-")},selectorTarget(t,e="",n=""){const r=this.getTargetSelectorSuffix(t);return`${e}.${Re.target+r} ${n}, ${e}.${Re.circles+r} ${n}`},selectorTargets(t,e){const n=t||[];return n.length?n.map(r=>this.selectorTarget(r,e)):null},selectorLegend(t){return`.${Re.legendItem+this.getTargetSelectorSuffix(t)}`},selectorLegends(t){return t!=null&&t.length?t.map(e=>this.selectorLegend(e)):null}};const Lb=(t,e,n)=>{const r=Yt(t.cloneNode(!0));return r.attr("id",n).insert("rect",":first-child").attr("width",r.attr("width")).attr("height",r.attr("height")).style("fill",e),{id:n,node:r.node()}};function Db(t){const e=Oe.colorPattern,{body:n}=Ye;let r=n[e];if(!r){const s=t.classed(Ac.colorPattern,!0).style("background-image");t.classed(Ac.colorPattern,!1),s.indexOf(";")>-1&&(r=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),n[e]=r)}return r}const Fb=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Nb={generateColor(){const t=this,{$el:e,config:n}=t,r=[],i=n.area_linearGradient||n.bar_linearGradient||n.point_radialGradient;let s=vn(n.color_pattern)?n.color_pattern:[...Db(e.chart)||Fb];const o=s;if(ie(n.color_tiles)){const l=n.color_tiles.bind(t.api)(),c=s.map((u,f)=>{const d=u.replace(/[#\(\)\s,]/g,""),h=`${t.state.datetimeId}-pattern-${d}-${f}`;return Lb(l[f%l.length],u,h)});s=c.map(u=>`url(#${u.id})`),t.patterns=c}return function(l){var c;const u=n.data_colors,f=n.data_color,d=l.id||((c=l.data)==null?void 0:c.id)||l,h=t.isTypeOf(d,["line","spline","step"])||!n.data_types[d];let m;if(ie(u[d]))m=u[d].bind(t.api)(l);else if(u[d])m=u[d];else{let S=r.indexOf(d);S<0&&(r.push(d),S=r.length-1),m=h?o[S%o.length]:s[S%s.length],u[d]=m}if(m=ie(f)?f.call(t.api,m,l):m,i&&e.defs){const S=t.$el.defs.selectAll(`[id$='-gradient${t.getTargetSelectorSuffix(d)}'] stop`);let E;S.each(function(C,w){E=w===0?this.style.stopColor:this.style.stopColor===E}),E===!0&&S.attr("stop-color",m)}return m}},generateLevelColor(){const t=this,{config:e}=t,n=e.color_pattern,r=e.color_threshold,i=r.unit==="value",s=r.max||100,o=r.values&&r.values.length?r.values:[];return vn(r)?function(l){const c=i?l:l*100/s;let u=n[n.length-1];for(let f=0,d=o.length;f<d;f++)if(c<=o[f]){u=n[f];break}return u}:null},generateTextBGColorFilter(t,e={x:0,y:0,width:1,height:1}){const n=this,{$el:{defs:r},state:i}=n;if(t){let s=[];je(t)?s.push(""):He(t)?s=Object.keys(t):ie(t)&&(s=n.mapToTargetIds()),s.forEach(o=>{const l=`${i.datetimeId}-labels-bg${n.getTargetSelectorSuffix(o)}${je(t)?n.getTargetSelectorSuffix(t):""}`,c=Gr(o===""?t:(t==null?void 0:t[o])||"");if(r.select(`#${l}`).empty()){const u=r.append("filter").attr("x",e.x).attr("y",e.y).attr("width",e.width).attr("height",e.height).attr("id",l);u.append("feFlood").attr("flood-color",c),u.append("feComposite").attr("in","SourceGraphic")}})}},getGradienColortUrl(t){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(t)})`},updateLinearGradient(){const t=this,{config:e,data:{targets:n},state:{datetimeId:r},$el:{defs:i}}=t;n.forEach(s=>{const o=`${r}-gradient${t.getTargetSelectorSuffix(s.id)}`,l=t.hasPointType()&&e.point_radialGradient,c=t.isAreaType(s)&&"area"||t.isBarType(s)&&"bar";if((l||c)&&i.select(`#${o}`).empty()){const u=t.color(s),f={defs:null,stops:[]};if(l){const{cx:d=.3,cy:h=.3,r:m=.7,stops:S=[[.1,u,0],[.9,u,1]]}=l;f.stops=S,f.defs=i.append("radialGradient").attr("id",`${o}`).attr("cx",d).attr("cy",h).attr("r",m)}else{const d=e.axis_rotated,{x:h=d?[1,0]:[0,0],y:m=d?[0,0]:[0,1],stops:S=[[0,u,1],[1,u,0]]}=e[`${c}_linearGradient`];f.stops=S,f.defs=i.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",m[0]).attr("y2",m[1])}f.stops.forEach(d=>{const[h,m,S]=d,E=ie(m)?m.bind(t.api)(s.id):m;f.defs&&f.defs.append("stop").attr("offset",h).attr("stop-color",E||u).attr("stop-opacity",S)})}})},setOverColor(t,e){const n=this,{config:r,$el:{main:i}}=n,s=r.color_onover;let o=t?s:n.color;He(o)?o=({id:l})=>l in s?s[l]:n.color(l):je(o)?o=()=>s:ie(s)&&(o=o.bind(n.api)),i.selectAll(He(e)?`.${Ze.arc}${n.getTargetSelectorSuffix(e.id)}`:`.${Tn.shape}-${e}`).style("fill",o)}},fi=0,us=0,fs=0,Kh=1e3,wo,ds,Oo=0,za=0,Po=0,hs=typeof performance=="object"&&performance.now?performance:Date,Zh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Bc(){return za||(Zh($b),za=hs.now()+Po)}function $b(){za=0}function Mo(){this._call=this._time=this._next=null}Mo.prototype=Jh.prototype={constructor:Mo,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Bc():+n)+(e==null?0:+e),!this._next&&ds!==this&&(ds?ds._next=this:wo=this,ds=this),this._call=t,this._time=n,zc()},stop:function(){this._call&&(this._call=null,this._time=1/0,zc())}};function Jh(t,e,n){var r=new Mo;return r.restart(t,e,n),r}function Bb(){Bc(),++fi;for(var t=wo,e;t;)(e=za-t._time)>=0&&t._call.call(void 0,e),t=t._next;--fi}function Qh(){za=(Oo=hs.now())+Po,fi=us=0;try{Bb()}finally{fi=0,Ub(),za=0}}function zb(){var t=hs.now(),e=t-Oo;e>Kh&&(Po-=e,Oo=t)}function Ub(){for(var t,e=wo,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:wo=n);ds=t,zc(r)}function zc(t){if(!fi){us&&(us=clearTimeout(us));var e=t-za;e>24?(t<1/0&&(us=setTimeout(Qh,t-hs.now()-Po)),fs&&(fs=clearInterval(fs))):(fs||(Oo=hs.now(),fs=setInterval(zb,Kh)),fi=1,Zh(Qh))}}function _h(t,e,n){var r=new Mo;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var kb=Io("start","end","cancel","interrupt"),Gb=[],qh=0,tv=1,Uc=2,Lo=3,ev=4,kc=5,Do=6;function Fo(t,e,n,r,i,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;Xb(t,n,{name:e,index:r,group:i,on:kb,tween:Gb,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:qh})}function Gc(t,e){var n=Tr(t,e);if(n.state>qh)throw new Error("too late; already scheduled");return n}function Dr(t,e){var n=Tr(t,e);if(n.state>Lo)throw new Error("too late; already running");return n}function Tr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Xb(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Jh(s,0,n.time);function s(u){n.state=tv,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var f,d,h,m;if(n.state!==tv)return c();for(f in r)if(m=r[f],m.name===n.name){if(m.state===Lo)return _h(o);m.state===ev?(m.state=Do,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete r[f]):+f<e&&(m.state=Do,m.timer.stop(),m.on.call("cancel",t,t.__data__,m.index,m.group),delete r[f])}if(_h(function(){n.state===Lo&&(n.state=ev,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Uc,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Uc){for(n.state=Lo,i=new Array(h=n.tween.length),f=0,d=-1;f<h;++f)(m=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(i[++d]=m);i.length=d+1}}function l(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=kc,1),d=-1,h=i.length;++d<h;)i[d].call(t,f);n.state===kc&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Do,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function di(t,e){var n=t.__transition,r,i,s=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){s=!1;continue}i=r.state>Uc&&r.state<kc,r.state=Do,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}s&&delete t.__transition}}function Wb(t){return this.each(function(){di(this,t)})}var nv=180/Math.PI,Xc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rv(t,e,n,r,i,s){var o,l,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),t*r<e*n&&(t=-t,e=-e,c=-c,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*nv,skewX:Math.atan(c)*nv,scaleX:o,scaleY:l}}var No;function Vb(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Xc:rv(e.a,e.b,e.c,e.d,e.e,e.f)}function jb(t){return t==null||(No||(No=document.createElementNS("http://www.w3.org/2000/svg","g")),No.setAttribute("transform",t),!(t=No.transform.baseVal.consolidate()))?Xc:(t=t.matrix,rv(t.a,t.b,t.c,t.d,t.e,t.f))}function av(t,e,n,r){function i(u){return u.length?u.pop()+" ":""}function s(u,f,d,h,m,S){if(u!==d||f!==h){var E=m.push("translate(",null,e,null,n);S.push({i:E-4,x:gr(u,d)},{i:E-2,x:gr(f,h)})}else(d||h)&&m.push("translate("+d+e+h+n)}function o(u,f,d,h){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),h.push({i:d.push(i(d)+"rotate(",null,r)-2,x:gr(u,f)})):f&&d.push(i(d)+"rotate("+f+r)}function l(u,f,d,h){u!==f?h.push({i:d.push(i(d)+"skewX(",null,r)-2,x:gr(u,f)}):f&&d.push(i(d)+"skewX("+f+r)}function c(u,f,d,h,m,S){if(u!==d||f!==h){var E=m.push(i(m)+"scale(",null,",",null,")");S.push({i:E-4,x:gr(u,d)},{i:E-2,x:gr(f,h)})}else(d!==1||h!==1)&&m.push(i(m)+"scale("+d+","+h+")")}return function(u,f){var d=[],h=[];return u=t(u),f=t(f),s(u.translateX,u.translateY,f.translateX,f.translateY,d,h),o(u.rotate,f.rotate,d,h),l(u.skewX,f.skewX,d,h),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,d,h),u=f=null,function(m){for(var S=-1,E=h.length,C;++S<E;)d[(C=h[S]).i]=C.x(m);return d.join("")}}}var Hb=av(Vb,"px, ","px)","deg)"),Yb=av(jb,", ",")",")");function Kb(t,e){var n,r;return function(){var i=Dr(this,t),s=i.tween;if(s!==n){r=n=s;for(var o=0,l=r.length;o<l;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Zb(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Dr(this,t),o=s.tween;if(o!==r){i=(r=o).slice();for(var l={name:e,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===e){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}function Jb(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Tr(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?Kb:Zb)(n,t,e))}function Wc(t,e,n){var r=t._id;return t.each(function(){var i=Dr(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return Tr(i,r).value[e]}}function iv(t,e){var n;return(typeof e=="number"?gr:e instanceof ba?Gs:(n=ba(e))?(e=n,Gs):_u)(t,e)}function Qb(t){return function(){this.removeAttribute(t)}}function _b(t){return function(){this.removeAttributeNS(t.space,t.local)}}function qb(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===r?s:s=e(r=o,n)}}function tS(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?s:s=e(r=o,n)}}function eS(t,e,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(t):(o=this.getAttribute(t),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=e(r=o,l)))}}function nS(t,e,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=e(r=o,l)))}}function rS(t,e){var n=Nt(t),r=n==="transform"?Yb:iv;return this.attrTween(t,typeof e=="function"?(n.local?nS:eS)(n,r,Wc(this,"attr."+t,e)):e==null?(n.local?_b:Qb)(n):(n.local?tS:qb)(n,r,e))}function aS(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function iS(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function sS(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&iS(t,s)),n}return i._value=e,i}function oS(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&aS(t,s)),n}return i._value=e,i}function lS(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Nt(t);return this.tween(n,(r.local?sS:oS)(r,e))}function cS(t,e){return function(){Gc(this,t).delay=+e.apply(this,arguments)}}function uS(t,e){return e=+e,function(){Gc(this,t).delay=e}}function fS(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?cS:uS)(e,t)):Tr(this.node(),e).delay}function dS(t,e){return function(){Dr(this,t).duration=+e.apply(this,arguments)}}function hS(t,e){return e=+e,function(){Dr(this,t).duration=e}}function vS(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?dS:hS)(e,t)):Tr(this.node(),e).duration}function gS(t,e){if(typeof e!="function")throw new Error;return function(){Dr(this,t).ease=e}}function pS(t){var e=this._id;return arguments.length?this.each(gS(e,t)):Tr(this.node(),e).ease}function mS(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Dr(this,t).ease=n}}function xS(t){if(typeof t!="function")throw new Error;return this.each(mS(this._id,t))}function yS(t){typeof t!="function"&&(t=M(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,l=r[i]=[],c,u=0;u<o;++u)(c=s[u])&&t.call(c,c.__data__,u,s)&&l.push(c);return new Qr(r,this._parents,this._name,this._id)}function TS(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,s=Math.min(r,i),o=new Array(r),l=0;l<s;++l)for(var c=e[l],u=n[l],f=c.length,d=o[l]=new Array(f),h,m=0;m<f;++m)(h=c[m]||u[m])&&(d[m]=h);for(;l<r;++l)o[l]=e[l];return new Qr(o,this._parents,this._name,this._id)}function bS(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function SS(t,e,n){var r,i,s=bS(e)?Gc:Dr;return function(){var o=s(this,t),l=o.on;l!==r&&(i=(r=l).copy()).on(e,n),o.on=i}}function AS(t,e){var n=this._id;return arguments.length<2?Tr(this.node(),n).on.on(t):this.each(SS(n,t,e))}function ES(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function CS(){return this.on("end.remove",ES(this._id))}function IS(t){var e=this._name,n=this._id;typeof t!="function"&&(t=x(t));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var l=r[o],c=l.length,u=s[o]=new Array(c),f,d,h=0;h<c;++h)(f=l[h])&&(d=t.call(f,f.__data__,h,l))&&("__data__"in f&&(d.__data__=f.__data__),u[h]=d,Fo(u[h],e,n,h,u,Tr(f,n)));return new Qr(s,this._parents,e,n)}function RS(t){var e=this._name,n=this._id;typeof t!="function"&&(t=I(t));for(var r=this._groups,i=r.length,s=[],o=[],l=0;l<i;++l)for(var c=r[l],u=c.length,f,d=0;d<u;++d)if(f=c[d]){for(var h=t.call(f,f.__data__,d,c),m,S=Tr(f,n),E=0,C=h.length;E<C;++E)(m=h[E])&&Fo(m,e,n,E,h,S);s.push(h),o.push(f)}return new Qr(s,o,e,n)}var wS=bn.prototype.constructor;function OS(){return new wS(this._groups,this._parents)}function PS(t,e){var n,r,i;return function(){var s=zt(this,t),o=(this.style.removeProperty(t),zt(this,t));return s===o?null:s===n&&o===r?i:i=e(n=s,r=o)}}function sv(t){return function(){this.style.removeProperty(t)}}function MS(t,e,n){var r,i=n+"",s;return function(){var o=zt(this,t);return o===i?null:o===r?s:s=e(r=o,n)}}function LS(t,e,n){var r,i,s;return function(){var o=zt(this,t),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(t),zt(this,t))),o===c?null:o===r&&c===i?s:(i=c,s=e(r=o,l))}}function DS(t,e){var n,r,i,s="style."+e,o="end."+s,l;return function(){var c=Dr(this,t),u=c.on,f=c.value[s]==null?l||(l=sv(e)):void 0;(u!==n||i!==f)&&(r=(n=u).copy()).on(o,i=f),c.on=r}}function FS(t,e,n){var r=(t+="")=="transform"?Hb:iv;return e==null?this.styleTween(t,PS(t,r)).on("end.style."+t,sv(t)):typeof e=="function"?this.styleTween(t,LS(t,r,Wc(this,"style."+t,e))).each(DS(this._id,t)):this.styleTween(t,MS(t,r,e),n).on("end.style."+t,null)}function NS(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function $S(t,e,n){var r,i;function s(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&NS(t,o,n)),r}return s._value=e,s}function BS(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,$S(t,e,n==null?"":n))}function zS(t){return function(){this.textContent=t}}function US(t){return function(){var e=t(this);this.textContent=e==null?"":e}}function kS(t){return this.tween("text",typeof t=="function"?US(Wc(this,"text",t)):zS(t==null?"":t+""))}function GS(t){return function(e){this.textContent=t.call(this,e)}}function XS(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&GS(i)),e}return r._value=t,r}function WS(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,XS(t))}function VS(){for(var t=this._name,e=this._id,n=lv(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var f=Tr(c,e);Fo(c,t,n,u,o,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Qr(r,this._parents,t,n)}function jS(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var l={value:o},c={value:function(){--i===0&&s()}};n.each(function(){var u=Dr(this,r),f=u.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(c)),u.on=e}),i===0&&s()})}var HS=0;function Qr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function ov(t){return bn().transition(t)}function lv(){return++HS}var _r=bn.prototype;Qr.prototype=ov.prototype={constructor:Qr,select:IS,selectAll:RS,selectChild:_r.selectChild,selectChildren:_r.selectChildren,filter:yS,merge:TS,selection:OS,transition:VS,call:_r.call,nodes:_r.nodes,node:_r.node,size:_r.size,empty:_r.empty,each:_r.each,on:AS,attr:rS,attrTween:lS,style:FS,styleTween:BS,text:kS,textTween:WS,remove:CS,tween:Jb,delay:fS,duration:vS,ease:pS,easeVarying:xS,end:jS,[Symbol.iterator]:_r[Symbol.iterator]};function Rw(t){return t*t*t}function ww(t){return--t*t*t+1}function YS(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var KS={time:null,delay:0,duration:250,ease:YS};function ZS(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function JS(t){var e,n;t instanceof Qr?(e=t._id,t=t._name):(e=lv(),(n=KS).time=Bc(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,u=0;u<l;++u)(c=o[u])&&Fo(c,t,e,u,o,n||ZS(c,e));return new Qr(r,this._parents,t,e)}bn.prototype.interrupt=Wb,bn.prototype.transition=JS;var Vc=(t=>()=>t);function QS(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function _S(t){t.stopImmediatePropagation()}function jc(t){t.preventDefault(),t.stopImmediatePropagation()}var cv={name:"drag"},Hc={name:"space"},hi={name:"handle"},vi={name:"center"};const{abs:uv,max:Bn,min:zn}=Math;function fv(t){return[+t[0],+t[1]]}function Yc(t){return[fv(t[0]),fv(t[1])]}var $o={name:"x",handles:["w","e"].map(vs),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Bo={name:"y",handles:["n","s"].map(vs),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},qS={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(vs),input:function(t){return t==null?null:Yc(t)},output:function(t){return t}},qr={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},dv={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},hv={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},tA={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},eA={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function vs(t){return{type:t}}function nA(t){return!t.ctrlKey&&!t.button}function rA(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function aA(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kc(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function iA(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function vv(t){var e=t.__brush;return e?e.dim.output(e.selection):null}function sA(){return Zc($o)}function oA(){return Zc(Bo)}function Ow(){return Zc(qS)}function Zc(t){var e=rA,n=nA,r=aA,i=!0,s=Io("start","brush","end"),o=6,l;function c(C){var w=C.property("__brush",E).selectAll(".overlay").data([vs("overlay")]);w.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",qr.overlay).merge(w).each(function(){var z=Kc(this).extent;Yt(this).attr("x",z[0][0]).attr("y",z[0][1]).attr("width",z[1][0]-z[0][0]).attr("height",z[1][1]-z[0][1])}),C.selectAll(".selection").data([vs("selection")]).enter().append("rect").attr("class","selection").attr("cursor",qr.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var $=C.selectAll(".handle").data(t.handles,function(z){return z.type});$.exit().remove(),$.enter().append("rect").attr("class",function(z){return"handle handle--"+z.type}).attr("cursor",function(z){return qr[z.type]}),C.each(u).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",m).on("touchend.brush touchcancel.brush",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(C,w,$){C.tween?C.on("start.brush",function(z){f(this,arguments).beforestart().start(z)}).on("interrupt.brush end.brush",function(z){f(this,arguments).end(z)}).tween("brush",function(){var z=this,B=z.__brush,W=f(z,arguments),H=B.selection,_=t.input(typeof w=="function"?w.apply(this,arguments):w,B.extent),q=Ya(H,_);function st(it){B.selection=it===1&&_===null?null:q(it),u.call(z),W.brush()}return H!==null&&_!==null?st:st(1)}):C.each(function(){var z=this,B=arguments,W=z.__brush,H=t.input(typeof w=="function"?w.apply(z,B):w,W.extent),_=f(z,B).beforestart();di(z),W.selection=H===null?null:H,u.call(z),_.start($).brush($).end($)})},c.clear=function(C,w){c.move(C,null,w)};function u(){var C=Yt(this),w=Kc(this).selection;w?(C.selectAll(".selection").style("display",null).attr("x",w[0][0]).attr("y",w[0][1]).attr("width",w[1][0]-w[0][0]).attr("height",w[1][1]-w[0][1]),C.selectAll(".handle").style("display",null).attr("x",function($){return $.type[$.type.length-1]==="e"?w[1][0]-o/2:w[0][0]-o/2}).attr("y",function($){return $.type[0]==="s"?w[1][1]-o/2:w[0][1]-o/2}).attr("width",function($){return $.type==="n"||$.type==="s"?w[1][0]-w[0][0]+o:o}).attr("height",function($){return $.type==="e"||$.type==="w"?w[1][1]-w[0][1]+o:o})):C.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function f(C,w,$){var z=C.__brush.emitter;return z&&(!$||!z.clean)?z:new d(C,w,$)}function d(C,w,$){this.that=C,this.args=w,this.state=C.__brush,this.active=0,this.clean=$}d.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(C,w){return this.starting?(this.starting=!1,this.emit("start",C,w)):this.emit("brush",C),this},brush:function(C,w){return this.emit("brush",C,w),this},end:function(C,w){return--this.active===0&&(delete this.state.emitter,this.emit("end",C,w)),this},emit:function(C,w,$){var z=Yt(this.that).datum();s.call(C,this.that,new QS(C,{sourceEvent:w,target:c,selection:t.output(this.state.selection),mode:$,dispatch:s}),z)}};function h(C){if(l&&!C.touches||!n.apply(this,arguments))return;var w=this,$=C.target.__data__.type,z=(i&&C.metaKey?$="overlay":$)==="selection"?cv:i&&C.altKey?vi:hi,B=t===Bo?null:tA[$],W=t===$o?null:eA[$],H=Kc(w),_=H.extent,q=H.selection,st=_[0][0],it,ot,ct=_[0][1],gt,tt,ft=_[1][0],lt,bt,St=_[1][1],Mt,Ot,Kt=0,ee=0,Ae,Ee=B&&W&&i&&C.shiftKey,Te,De,me=Array.from(C.touches||[C],be=>{const un=be.identifier;return be=ur(be,w),be.point0=be.slice(),be.identifier=un,be});di(w);var Pe=f(w,arguments,!0).beforestart();if($==="overlay"){q&&(Ae=!0);const be=[me[0],me[1]||me[0]];H.selection=q=[[it=t===Bo?st:zn(be[0][0],be[1][0]),gt=t===$o?ct:zn(be[0][1],be[1][1])],[lt=t===Bo?ft:Bn(be[0][0],be[1][0]),Mt=t===$o?St:Bn(be[0][1],be[1][1])]],me.length>1&&We(C)}else it=q[0][0],gt=q[0][1],lt=q[1][0],Mt=q[1][1];ot=it,tt=gt,bt=lt,Ot=Mt;var Zt=Yt(w).attr("pointer-events","none"),he=Zt.selectAll(".overlay").attr("cursor",qr[$]);if(C.touches)Pe.moved=Wt,Pe.ended=Xe;else{var ge=Yt(C.view).on("mousemove.brush",Wt,!0).on("mouseup.brush",Xe,!0);i&&ge.on("keydown.brush",pn,!0).on("keyup.brush",Cn,!0),Fc(C.view)}u.call(w),Pe.start(C,z.name);function Wt(be){for(const un of be.changedTouches||[be])for(const an of me)an.identifier===un.identifier&&(an.cur=ur(un,w));if(Ee&&!Te&&!De&&me.length===1){const un=me[0];uv(un.cur[0]-un[0])>uv(un.cur[1]-un[1])?De=!0:Te=!0}for(const un of me)un.cur&&(un[0]=un.cur[0],un[1]=un.cur[1]);Ae=!0,jc(be),We(be)}function We(be){const un=me[0],an=un.point0;var Nr;switch(Kt=un[0]-an[0],ee=un[1]-an[1],z){case Hc:case cv:{B&&(Kt=Bn(st-it,zn(ft-lt,Kt)),ot=it+Kt,bt=lt+Kt),W&&(ee=Bn(ct-gt,zn(St-Mt,ee)),tt=gt+ee,Ot=Mt+ee);break}case hi:{me[1]?(B&&(ot=Bn(st,zn(ft,me[0][0])),bt=Bn(st,zn(ft,me[1][0])),B=1),W&&(tt=Bn(ct,zn(St,me[0][1])),Ot=Bn(ct,zn(St,me[1][1])),W=1)):(B<0?(Kt=Bn(st-it,zn(ft-it,Kt)),ot=it+Kt,bt=lt):B>0&&(Kt=Bn(st-lt,zn(ft-lt,Kt)),ot=it,bt=lt+Kt),W<0?(ee=Bn(ct-gt,zn(St-gt,ee)),tt=gt+ee,Ot=Mt):W>0&&(ee=Bn(ct-Mt,zn(St-Mt,ee)),tt=gt,Ot=Mt+ee));break}case vi:{B&&(ot=Bn(st,zn(ft,it-Kt*B)),bt=Bn(st,zn(ft,lt+Kt*B))),W&&(tt=Bn(ct,zn(St,gt-ee*W)),Ot=Bn(ct,zn(St,Mt+ee*W)));break}}bt<ot&&(B*=-1,Nr=it,it=lt,lt=Nr,Nr=ot,ot=bt,bt=Nr,$ in dv&&he.attr("cursor",qr[$=dv[$]])),Ot<tt&&(W*=-1,Nr=gt,gt=Mt,Mt=Nr,Nr=tt,tt=Ot,Ot=Nr,$ in hv&&he.attr("cursor",qr[$=hv[$]])),H.selection&&(q=H.selection),Te&&(ot=q[0][0],bt=q[1][0]),De&&(tt=q[0][1],Ot=q[1][1]),(q[0][0]!==ot||q[0][1]!==tt||q[1][0]!==bt||q[1][1]!==Ot)&&(H.selection=[[ot,tt],[bt,Ot]],u.call(w),Pe.brush(be,z.name))}function Xe(be){if(_S(be),be.touches){if(be.touches.length)return;l&&clearTimeout(l),l=setTimeout(function(){l=null},500)}else Nc(be.view,Ae),ge.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Zt.attr("pointer-events","all"),he.attr("cursor",qr.overlay),H.selection&&(q=H.selection),iA(q)&&(H.selection=null,u.call(w)),Pe.end(be,z.name)}function pn(be){switch(be.keyCode){case 16:{Ee=B&&W;break}case 18:{z===hi&&(B&&(lt=bt-Kt*B,it=ot+Kt*B),W&&(Mt=Ot-ee*W,gt=tt+ee*W),z=vi,We(be));break}case 32:{(z===hi||z===vi)&&(B<0?lt=bt-Kt:B>0&&(it=ot-Kt),W<0?Mt=Ot-ee:W>0&&(gt=tt-ee),z=Hc,he.attr("cursor",qr.selection),We(be));break}default:return}jc(be)}function Cn(be){switch(be.keyCode){case 16:{Ee&&(Te=De=Ee=!1,We(be));break}case 18:{z===vi&&(B<0?lt=bt:B>0&&(it=ot),W<0?Mt=Ot:W>0&&(gt=tt),z=hi,We(be));break}case 32:{z===Hc&&(be.altKey?(B&&(lt=bt-Kt*B,it=ot+Kt*B),W&&(Mt=Ot-ee*W,gt=tt+ee*W),z=vi):(B<0?lt=bt:B>0&&(it=ot),W<0?Mt=Ot:W>0&&(gt=tt),z=hi),he.attr("cursor",qr[$]),We(be));break}default:return}jc(be)}}function m(C){f(this,arguments).moved(C)}function S(C){f(this,arguments).ended(C)}function E(){var C=this.__brush||{selection:null};return C.extent=Yc(e.apply(this,arguments)),C.dim=t,C}return c.extent=function(C){return arguments.length?(e=typeof C=="function"?C:Vc(Yc(C)),c):e},c.filter=function(C){return arguments.length?(n=typeof C=="function"?C:Vc(!!C),c):n},c.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:Vc(!!C),c):r},c.handleSize=function(C){return arguments.length?(o=+C,c):o},c.keyModifiers=function(C){return arguments.length?(i=!!C,c):i},c.on=function(){var C=s.on.apply(s,arguments);return C===s?c:C},c}function gv(t){const{event:e,$el:n}=t,r=n.subchart.main||n.main;let i;return e&&e.type==="brush"?i=e.selection:r&&(i=r.select(".bb-brush").node())&&(i=vv(i)),i}function pv(t){const e=gv(t);return e?e[0]===e[1]:!0}function mv(t,e){return e.map(n=>{var r,i,s,o,l,c,u,f,d;const{values:h}=n,m=h[0],S=h[h.length-1],E=m?(i=(r=t.getXCacheKey)==null?void 0:r.call(t,m.x))!=null?i:m.x:"",C=S?(o=(s=t.getXCacheKey)==null?void 0:s.call(t,S.x))!=null?o:S.x:"",w=(c=(l=t.getTargetType)==null?void 0:l.call(t,n))!=null?c:"",$=(d=(f=(u=t.state)==null?void 0:u.subchartSourceTypes)==null?void 0:f[n.id])!=null?d:"";return`${n.id}:${w}:${$}:${h.length}:${E}:${C}`}).join("|")}function xv(t,e){var n;const r=(n=t.data)==null?void 0:n.targets;if(!r)return!1;for(let i=0;i<e.length;i++){const s=e[i],o=r.find(l=>l.id===s.id);if(!o||o.values!==s.values)return!1}return!0}function Jc(t,e){vn(e)&&((t.min===void 0||e<t.min)&&(t.min=e),(t.max===void 0||e>t.max)&&(t.max=e))}function yv(t,e){for(let n=0;n<e.length;n++)Jc(t,e[n])}function lA(t,e){var n,r,i,s;const o={min:void 0,max:void 0},l=t.state.hasAxis;for(let c=0;c<e.length;c++){const u=e[c],f=(n=t.isCandlestickType)==null?void 0:n.call(t,u),d=!f&&!!((r=t.isSubchartSourceTypeOf)!=null&&r.call(t,u,qt.CANDLESTICK)),{values:h}=u;for(let m=0;m<h.length;m++){const S=h[m];let E=S.value;if(!(Ge(E)||E===null))continue;const C=d?(i=t.getSubchartCandlestickShapeValue)==null?void 0:i.call(t,S,!0):void 0;ae(C)?E=C:E!==null&&(f||d)&&(E=Array.isArray(E)?E.slice(0,4):[E.open,E.high,E.low,E.close]),Array.isArray(E)?yv(o,E):He(E)&&"high"in E?yv(o,Object.values(E)):(s=t.isBubbleZType)!=null&&s.call(t,S)?Jc(o,l&&t.getBubbleZData(E,"y")):Jc(o,E)}}return[o.min,o.max]}function cA(t,e){let n;for(let r=0;r<t.length;r++){const{values:i}=t[r];for(let s=0;s<i.length;s++){const{x:o}=i[s];vn(o)&&(n===void 0||(e==="min"?o<n:o>n))&&(n=o)}}return n}var uA={getYDomainMinMaxBoth(t){const e=this,{axis:n,cache:r,config:i,state:s}=e,l=xv(e,t)?`${Oe.domainMinMax}_y_${mv(e,t)}`:null,c=l&&r.get(l);if(c&&c.generation===s.dataGeneration)return c.value;const u=i.data_groups,f=e.mapToIds(t),d=Yf(f);let h;if(u.length>0){const m=e.getValuesAsIdKeyed(t),S=t.some(W=>W.values.some(H=>H.value<0)),E=t.some(W=>W.values.some(H=>H.value>0)),C=new Map(f.map(W=>[W,n.getId(W)])),w={},$={};for(const W in m)w[W]=m[W].slice(),$[W]=m[W].slice();u.forEach(W=>{const H=W.filter(_=>d.has(_));if(H.length){const _=H[0],q=C.get(_);w[_]&&S&&(w[_]=w[_].map(st=>st<0?st:0)),$[_]&&E&&($[_]=$[_].map(st=>st>0?st:0)),H.filter((st,it)=>it>0).forEach(st=>{if(w[st]){const it=C.get(st);w[st].forEach((ot,ct)=>{const gt=+ot;it===q&&!(S&&gt>0)&&(w[_][ct]+=gt)})}if($[st]){const it=C.get(st);$[st].forEach((ot,ct)=>{const gt=+ot;it===q&&!(E&&gt<0)&&($[_][ct]+=gt)})}})}});const z=[],B=[];for(const W in w)z.push(pr("min",w[W])),B.push(pr("max",$[W]));h=[pr("min",z),pr("max",B)]}else h=lA(e,t);return l&&r.add(l,{generation:s.dataGeneration,value:h}),h},isHiddenTargetWithYDomain(t){const e=this;for(const n of e.state.hiddenTargetIds)if(e.axis.getId(n)===t)return!0;return!1},getYDomain(t,e,n){const r=this,{axis:i,config:s,scale:o}=r,l=`axis_${e}`;if(r.isStackNormalized()&&t.filter(tt=>i.getId(tt.id)===e).map(tt=>tt.id).some(tt=>r.isGrouped(tt)))return[0,100];const c=(o==null?void 0:o[e])&&o[e].type==="log",u=t.filter(ct=>i.getId(ct.id)===e),f=n?r.filterByXDomain(u,n):u;if(f.length===0)return r.isHiddenTargetWithYDomain(e)?o[e].domain():e==="y2"?o.y.domain():r.getYDomain(t,"y2",n);const d=s[`${l}_min`],h=s[`${l}_max`],m=s[`${l}_center`],S=s[`${l}_inverted`],E=r.hasDataLabel()&&s.axis_rotated,C=r.hasDataLabel()&&!s.axis_rotated,[w,$]=r.getYDomainMinMaxBoth(f);let z=w,B=$,W=[qt.BAR,qt.BUBBLE,qt.SCATTER,...en.Line].some(ct=>{const gt=ct.indexOf("area")>-1?"area":ct;return r.hasType(ct,f,!0)&&s[`${gt}_zerobased`]});z=Ge(d)?d:Ge(h)?z<=h?z:h-10:z,B=Ge(h)?h:Ge(d)?d<=B?B:d+10:B,isNaN(z)&&(z=0),isNaN(B)&&(B=z),z===B&&(z<0?B=0:z=0);const H=z>=0&&B>=0,_=z<=0&&B<=0;(Ge(d)&&H||Ge(h)&&_)&&(W=!1),W&&(H&&(z=0),_&&(B=0));const q=Math.abs(B-z);let st={top:q*.1,bottom:q*.1};if(sn(m)){const ct=Math.max(Math.abs(z),Math.abs(B));B=m+ct,z=m-ct}if(E){const ct=wa(o.y.range()),gt=r.getDataLabelLength(z,B,"width").map(tt=>{const ft=tt/ct;return isFinite(ft)?ft:0});["bottom","top"].forEach((tt,ft)=>{st[tt]+=q*(gt[ft]/(1-gt[0]-gt[1]))})}else if(C){const ct=r.getDataLabelLength(z,B,"height");["bottom","top"].forEach((gt,tt)=>{st[gt]+=r.convertPixelToScale("y",ct[tt],q)})}st=r.getResettedPadding(st);const it=s[`${l}_padding`];vn(it)&&["bottom","top"].forEach(ct=>{st[ct]=i.getPadding(it,ct,st[ct],q)}),W&&(H&&(st.bottom=z),_&&(st.top=-B));const ot=c?[z,B].map(ct=>ct<0?0:ct):[z-st.bottom,B+st.top];return S?ot.reverse():ot},getXDomainMinMax(t,e){var n;const r=this,{cache:i,state:s}=r,o=r.config[`axis_x_${e}`],c=xv(r,t)?`${Oe.domainMinMax}_x_${e}_${mv(r,t)}`:null,u=c&&i.get(c);let f=(u==null?void 0:u.generation)===s.dataGeneration?u.value:void 0;f===void 0&&(f=cA(t,e),c&&i.add(c,{generation:s.dataGeneration,value:f}));let d=He(o)?o.value:o;return d=sn(d)&&((n=r.axis)!=null&&n.isTimeSeries())?Wn.bind(this)(d):d,He(o)&&o.fit&&(e==="min"&&d<f||e==="max"&&d>f)&&(d=void 0),sn(d)?d:f},getXDomainPadding(t,e){const n=this,{axis:r,config:i}=n,s=i.axis_x_padding,o=r.isTimeSeries()&&e,l=wa(t);let c;if(r.isCategorized()||o)c=0;else if(n.hasType("bar")){const d=n.getMaxDataCount();c=d>1?l/(d-1)/2:.5}else c=n.getResettedPadding(l*.01);let{left:u=c,right:f=c}=ae(s)?{left:s,right:s}:s;if(s.unit==="px"){const d=Math.abs(l+l*.2);u=r.getPadding(s,"left",c,d),f=r.getPadding(s,"right",c,d)}else{const d=l+u+f;if(o&&d){const h=l/e/d;u=u/d/h,f=f/d/h}}return{left:u,right:f}},getXDomain(t){const e=this,{axis:n,config:r,scale:{x:i}}=e,s=r.axis_x_inverted,o=[e.getXDomainMinMax(t,"min"),e.getXDomainMinMax(t,"max")];let[l=0,c=0]=o;if(i.type!=="log"){const u=n.isCategorized(),f=n.isTimeSeries(),d=e.getXDomainPadding(o);let[h,m]=o;h-m===0&&!u&&(f?(h=new Date(h.getTime()*.5),m=new Date(m.getTime()*1.5)):(h=h===0?1:h*.5,m=m===0?-1:m*1.5)),(h||h===0)&&(l=f?new Date(h.getTime()-d.left):h-d.left),(m||m===0)&&(c=f?new Date(m.getTime()+d.right):m+d.right)}return s?[c,l]:[l,c]},updateXDomain(t,e,n,r,i){var s;const o=this,{config:l,org:c,scale:{x:u,subX:f}}=o,d=l.zoom_enabled;if(n&&(u.domain(i||ti(o.getXDomain(t),!l.axis_x_inverted)),c.xDomain=u.domain(),f.domain(u.domain()),(s=o.brush)==null||s.scale(f)),e){const h=i||!o.brush||pv(o)?c.xDomain:gv(o).map(f.invert);u.domain(h)}return(n||e)&&d&&o.zoom.updateScaleExtent(),r&&u.domain(o.trimXDomain(u.orgDomain())),u.domain()},trimXDomain(t){const e=this,n=e.config.axis_x_inverted,r=e.getZoomDomain(),[i,s]=r;return(n?t[0]>=i:t[0]<=i)&&(t[1]=+t[1]+(i-t[0]),t[0]=i),(n?t[1]<=s:t[1]>=s)&&(t[0]=+t[0]-(t[1]-s),t[1]=s),t},getZoomDomain(t="zoom",e=!1){const n=this,{config:r,scale:i,org:s}=n;let[o,l]=e&&i[t]?i[t].domain():s.xDomain;return t==="zoom"&&(sn(r.zoom_x_min)&&(o=pr("min",[o,r.zoom_x_min])),sn(r.zoom_x_max)&&(l=pr("max",[l,r.zoom_x_max]))),[o,l]},getZoomDomainValue(t){const e=this,{config:n,axis:r}=e;if(r.isCategorized()&&Array.isArray(t)){const i=n.axis_x_inverted;return t.map((o,l)=>Number(o)+(l===0?+i:+!i))}return t},convertPixelToScale(t,e,n){const r=this,{config:i,state:s}=r,o=i.axis_rotated;let l;return t==="x"?l=o?"height":"width":l=o?"width":"height",n*(e/s[l])},withinRange(t,e=[0,0],n){const i=this.config.axis_x_inverted,[s,o]=n;if(Array.isArray(t)){const l=i?t[1]:t[0],c=i?t[0]:t[1];if(l<c)return t.every((u,f)=>(f===0?i?+u<=s:+u>=s:i?+u>=o:+u<=o)&&!t.every((d,h)=>d===e[h]))}return!1}};function Tv(t,e,n){const{config:r}=t,i=`axis_${e}_tick_format`;return(r[i]?r[i]:t.defaultValueFormat).call(t.api,n)}var fA={yFormat(t){return Tv(this,"y",t)},y2Format(t){return Tv(this,"y2",t)},getDefaultValueFormat(){const t=this,{defaultArcValueFormat:e,yFormat:n,y2Format:r}=t,i=t.hasArcType(null,["gauge","polar","radar"]);return function(s,o,l){return(i?e:t.axis&&t.axis.getId(l)==="y2"?r:n).call(t,s,o)}},defaultValueFormat(t){return qe(t)?t.join("~"):Ge(t)?+t:""},defaultArcValueFormat(t,e){return`${(e*100).toFixed(1)}%`},defaultPolarValueFormat(t){return`${t}`},dataLabelFormat(t){const e=this,n=e.config.data_labels,r=s=>{let l=s;return qe(s)?l=s.join("~"):He(s)&&(l=Object.values(s).join("~")),l};let i=r;return ie(n.format)?i=n.format:Kn(n.format)&&(n.format[t]?i=n.format[t]===!0?r:n.format[t]:i=()=>""),i.bind(e.api)}};const bv=10,dA=750;function zo(t){const e=this,n=e.getDataById(t);return e.levelColor?e.levelColor(n.values[0].value):e.color(n)}function hA(t,e=!0){var n;const{config:r}=this;let i=(n=r.data_names[t])!=null?n:t;return e&&ie(r.legend_format)&&(i=r.legend_format(i,t!==i?t:void 0)),i}function vA(t,e){var n;if(!e||e.empty())return;const r=(n=t.$el.legend)==null?void 0:n.selectAll(`.${$e.legendItem}`);r&&!r.empty()&&(e=r);const i=[];e.each(function(o){i.push({id:o,node:this})});const s=Kf(i,o=>o.id,o=>o.node);t.cache.add(Oe.legendItemMap,s)}function Sv(t){var e,n;return((e=t.changedTouches)==null?void 0:e[0])||((n=t.touches)==null?void 0:n[0])}function gA(t,e,n){const r=Sv(n);t.state.legendTouch=r?{id:e,x:r.clientX,y:r.clientY,moved:!1}:null}function Av(t,e){const n=t.state.legendTouch,r=n&&Sv(e);r&&(n.moved=n.moved||Math.abs(r.clientX-n.x)>bv||Math.abs(r.clientY-n.y)>bv)}function pA(t,e,n){Av(t,n);const r=t.state.legendTouch;return t.state.legendTouch=null,!!r&&r.id===e&&!r.moved}function mA(t,e){t.state.legendLastTouchClickId=e,t.state.legendLastTouchClickTime=Date.now()}function xA(t,e){const{state:n}=t,r=n.legendLastTouchClickId===e&&Date.now()-(n.legendLastTouchClickTime||0)<dA;return r&&(n.legendLastTouchClickId=null,n.legendLastTouchClickTime=0),r}function yA(t){var e;const n=(e=t.config.interaction_inputType_touch)==null?void 0:e.preventDefault,r=Ra(n)&&n||!1,i=!isNaN(n)&&n||null;return{passive:!r&&i===null}}var TA={initLegend(){var t;const e=this,{config:n,$el:r}=e;if(e.legendItemTextBox={},e.state.legendHasRendered=!1,e.state.isCanvasMode){n.legend_show?(t=e.updateHtmlLegend)==null||t.call(e):e.state.hiddenLegendIds=new Set(e.mapToIds(e.data.targets));return}n.legend_show?(n.legend_contents_bindto||(r.legend=e.$el.svg.append("g").classed($e.legend,!0).attr("transform",e.getTranslate("legend"))),e.updateLegend()):e.state.hiddenLegendIds=new Set(e.mapToIds(e.data.targets))},updateLegend(t,e,n){var r;const i=this,{config:s,state:o,scale:l,$el:c}=i,u=e||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};u.withTransition=ia(u,"withTransition",!0),u.withTransitionForTransform=ia(u,"withTransitionForTransform",!0),s.legend_contents_bindto&&s.legend_contents_template?i.updateLegendTemplate():o.hasTreemap||i.updateLegendElement(t||i.mapToIds(i.data.targets),u),(r=c.legend)==null||r.selectAll(`.${$e.legendItem}`).classed($e.legendItemHidden,function(f){const d=!i.isTargetToShow(f);return d&&(this.style.opacity=null),d}),i.updateScales(!1,!l.zoom),i.updateSvgSize(),i.transformAll(u.withTransitionForTransform,n),o.legendHasRendered=!0},updateLegendTemplate(){const t=this,{config:e,$el:n}=t,r=Yt(e.legend_contents_bindto),i=e.legend_contents_template;if(!r.empty()){const s=t.mapToIds(t.data.targets),o=[];let l="";s.forEach(u=>{const f=ie(i)?Gr(i.call(t.api,u,t.color(u),t.api.data(u)[0].values)):Pa(i,{COLOR:t.color(u),TITLE:u});f&&(o.push(u),l+=f)});const c=r.html(l).selectAll(function(){return this.childNodes}).data(o);t.setLegendItem(c),n.legend=r}},updateSizeForLegend(t){const e=this,{config:n,state:{isLegendTop:r,isLegendLeft:i,isLegendRight:s,isLegendInset:o,current:l}}=e,{width:c,height:u}=t,f={top:r?e.getCurrentPaddingByDirection("top")+n.legend_inset_y+5.5:l.height-u-e.getCurrentPaddingByDirection("bottom")-n.legend_inset_y,left:i?e.getCurrentPaddingByDirection("left")+n.legend_inset_x+.5:l.width-c-e.getCurrentPaddingByDirection("right")-n.legend_inset_x+.5};e.state.margin3={top:s?0:o?f.top:l.height-u,right:NaN,bottom:0,left:s?l.width-c:o?f.left:0}},transformLegend(t){const e=this,{$el:{legend:n},$T:r}=e;r(n,t).attr("transform",e.getTranslate("legend"))},updateLegendItemColor(t,e){const n=this,{legend:r}=n.$el;if(r){const i=n.getLegendItemById(t);i&&Yt(i).select("line").style("stroke",e)}},getLegendWidth(){const t=this,{current:{width:e},isLegendRight:n,isLegendInset:r,legendItemWidth:i,legendStep:s}=t.state;return t.config.legend_show?n||r?i*(s+1):e:0},getLegendHeight(){var t;const e=this,{current:n,isLegendRight:r,legendItemHeight:i,legendStep:s}=e.state,l=((t=e.config.padding)==null?void 0:t.mode)==="fit"?10:20;return e.config.legend_show?r?n.height:Math.max(l,i)*(s+1):0},opacityForUnfocusedLegend(t){return t.classed($e.legendItemHidden)?null:"0.3"},toggleFocusLegend(t,e){const n=this,{$el:{legend:r},$T:i}=n,s=n.mapToTargetIds(t);r&&i(r.selectAll(`.${$e.legendItem}`).filter(o=>s.indexOf(o)>=0).classed(nn.legendItemFocused,e)).style("opacity",function(){return e?null:n.opacityForUnfocusedLegend.call(n,Yt(this))})},revertLegend(){const t=this,{$el:{legend:e},$T:n}=t;e&&n(e.selectAll(`.${$e.legendItem}`).classed(nn.legendItemFocused,!1)).style("opacity",null)},showLegend(t){const e=this,{config:n,$el:r,$T:i}=e;n.legend_show||(n.legend_show=!0,r.legend?r.legend.style("visibility",null):e.initLegend(),!e.state.legendHasRendered&&e.updateLegend()),e.removeHiddenLegendIds(t),i(r.legend.selectAll(e.selectorLegends(t)).style("visibility",null)).style("opacity",null)},hideLegend(t){const e=this,{config:n,$el:{legend:r}}=e;n.legend_show&&lr(t)&&(n.legend_show=!1,r==null||r.style("visibility","hidden")),e.addHiddenLegendIds(t),r==null||r.selectAll(e.selectorLegends(t)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(t,e){const n=this,{cache:r,state:i}=n;let s;const o=Oe.legendItemTextBox;return t&&(s=!i.redrawing&&r.get(o)||{},s[t]||(s[t]=n.getTextRect(e,$e.legendItem),r.add(o,s)),s=s[t]),s},setLegendItem(t){const e=this,{$el:n,api:r,config:i,state:s}=e,o=s.inputType==="touch",l=e.hasType("gauge"),c=i.boost_useCssRule,u=i.legend_item_interaction,f=u.dblclick?"dblclick":"click",d=u||ie(i.legend_item_onclick),h=o?yA(e):void 0,m=function(S,E){var C;if(!Ne(i.legend_item_onclick,r,E,!s.hiddenTargetIds.has(E))){const{altKey:w,type:$}=S,z=Yt(this);$==="dblclick"||w?s.hiddenTargetIds.size&&!z.classed($e.legendItemHidden)?r.show():(r.hide(),r.show(E)):(r.toggle(E),z.classed(nn.legendItemFocused,!1))}o&&(e.hideTooltip(),(C=e.hideGridFocus)==null||C.call(e,!0))};t.attr("class",function(S){const E=Yt(this);return(!E.empty()&&E.attr("class")||"")+e.generateClass($e.legendItem,S)}).style("visibility",S=>e.isLegendToShow(S)?null:"hidden"),i.interaction_enabled&&(c&&[[`.${$e.legendItem}`,"cursor:pointer"],[`.${$e.legendItem} text`,"pointer-events:none"],[`.${$e.legendItemPoint} text`,"pointer-events:none"],[`.${$e.legendItemTile}`,"pointer-events:none"],[`.${$e.legendItemEvent}`,"fill-opacity:0"]].forEach(S=>{const[E,C]=S;e.setCssRule(!1,E,[C])(n.legend)}),t.on(f,d?function(S,E){o&&S.type==="click"&&xA(e,E)||m.call(this,S,E)}:null),o&&f==="click"&&d&&t.on("touchstart",function(S,E){gA(e,E,S)},h).on("touchmove",S=>{Av(e,S)},h).on("touchend",function(S,E){pA(e,E,S)&&(mA(e,E),m.call(this,S,E))},h),!o&&t.on("mouseout",u||ie(i.legend_item_onout)?function(S,E){Ne(i.legend_item_onout,r,E,!s.hiddenTargetIds.has(E))||(Yt(this).classed(nn.legendItemFocused,!1),l&&e.undoMarkOverlapped(e,`.${ar.gaugeValue}`),e.api.revert())}:null).on("mouseover",u||ie(i.legend_item_onover)?function(S,E){Ne(i.legend_item_onover,r,E,!s.hiddenTargetIds.has(E))||(Yt(this).classed(nn.legendItemFocused,!0),l&&e.markOverlapped(E,e,`.${ar.gaugeValue}`),!s.transiting&&e.isTargetToShow(E)&&r.focus(E))}:null),!t.empty()&&t.on("click mouseout mouseover")&&t.style("cursor",e.getStylePropValue("pointer"))),vA(e,t)},getLegendItemById(t){var e;const n=this,r=n.cache.get(Oe.legendItemMap);if(r&&r instanceof Map)return r.get(t)||null;const i=(e=n.$el.legend)==null?void 0:e.selectAll(`.${$e.legendItem}`).filter(s=>s===t);return(i==null?void 0:i.node())||null},updateLegendElement(t,e){const n=this,{config:r,state:i,$el:{legend:s},$T:o}=n,c=r.legend_item_tile_type!=="circle",u=r.legend_item_tile_r,f={width:c?r.legend_item_tile_width:u*2,height:c?r.legend_item_tile_height:u*2},d={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let m,S,E;const C=t.filter(q=>!sn(r.data_names[q])||r.data_names[q]!==null),w=e.withTransition,$=i.isLegendRight||i.isLegendInset,z=hA.bind(n),B=n.getUpdateLegendPositions(C,d,h,$);i.isLegendInset&&(d.step=r.legend_inset_step?r.legend_inset_step:C.length,i.legendStep=d.step),i.isLegendRight?(m=q=>d.max.width*h.steps[q],S=q=>h.margins[h.steps[q]]+h.offsets[q]):i.isLegendInset?(m=q=>d.max.width*h.steps[q]+10,S=q=>h.margins[h.steps[q]]+h.offsets[q]):(m=q=>h.margins[h.steps[q]]+h.offsets[q],S=q=>d.max.height*h.steps[q]);const W={xText:(q,st)=>m(q,st)+4+f.width,xRect:(q,st)=>m(q,st),x1Tile:(q,st)=>m(q,st)-2,x2Tile:(q,st)=>m(q,st)-2+f.width,yText:(q,st)=>S(q,st)+9,yRect:(q,st)=>S(q,st)-5,yTile:(q,st)=>S(q,st)+4};n.generateLegendItem(C,f,B,W,$,z),E=s.select(`.${$e.legendBackground} rect`),i.isLegendInset&&d.max.width>0&&E.size()===0&&(E=s.insert("g",`.${$e.legendItem}`).attr("class",$e.legendBackground).append("rect")),r.legend_tooltip&&s.selectAll("title").data(C).text(q=>z(q,!1));const H=s.selectAll("text").data(C).text(q=>z(q)).each(function(q,st){B(this,q,st)});o(H,w).attr("x",W.xText).attr("y",W.yText);const _=s.selectAll(`rect.${$e.legendItemEvent}`).data(C);o(_,w).attr("width",q=>h.widths[q]).attr("height",q=>h.heights[q]).attr("x",W.xRect).attr("y",W.yRect),n.updateLegendItemPos(C,w,W),E&&o(E,w).attr("height",n.getLegendHeight()-12).attr("width",d.max.width*(d.step+1)+10),i.legendItemWidth=d.max.width,i.legendItemHeight=d.max.height,i.legendStep=d.step},getUpdateLegendPositions(t,e,n,r){const i=this,{config:s,state:o}=i;return function(l,c,u){const f=u===0,d=u===t.length-1,h=i.getLegendItemTextBox(c,l),m=h.width+e.tileWidth+(d&&!r?0:e.padding.right)+s.legend_padding,S=h.height+e.padding.top,E=r?S:m,C=r?i.getLegendHeight():i.getLegendWidth();let w;const $=function(B,W){W||(w=(C-e.totalLength-E)/2,w<e.posMin&&(w=(C-E)/2,e.totalLength=0,e.step++)),n.steps[B]=e.step,n.margins[e.step]=o.isLegendInset?10:w,n.offsets[B]=e.totalLength,e.totalLength+=E};if(f&&(e.totalLength=0,e.step=0,e.max.width=0,e.max.height=0),s.legend_show&&!i.isLegendToShow(c)){n.widths[c]=0,n.heights[c]=0,n.steps[c]=0,n.offsets[c]=0;return}n.widths[c]=m,n.heights[c]=S,(!e.max.width||m>=e.max.width)&&(e.max.width=m),(!e.max.height||S>=e.max.height)&&(e.max.height=S);const z=r?e.max.height:e.max.width;if(s.legend_equally){for(const B in n.widths)n.widths[B]=e.max.width;for(const B in n.heights)n.heights[B]=e.max.height;w=(C-z*t.length)/2,w<e.posMin?(e.totalLength=0,e.step=0,t.forEach(B=>$(B))):$(c,!0)}else $(c)}},generateLegendItem(t,e,n,r,i,s){const o=this,{config:l,state:c,$el:{legend:u}}=o,f=l.legend_usePoint,d=l.legend_item_tile_r,h=l.legend_item_tile_type,m=h!=="circle",S=-200,E=u.selectAll(`.${$e.legendItem}`).data(t).enter().append("g");if(o.setLegendItem(E),l.legend_tooltip&&E.append("title").text(C=>C),E.append("text").text(C=>s(C)).each(function(C,w){n(this,C,w)}).style("pointer-events",o.getStylePropValue("none")).attr("x",i?r.xText:S).attr("y",i?S:r.yText),E.append("rect").attr("class",$e.legendItemEvent).style("fill-opacity",o.getStylePropValue("0")).attr("x",i?r.xRect:S).attr("y",i?S:r.yRect),f){const C=[],w=o.getValidPointPattern();E.append($=>{C.indexOf($)===-1&&C.push($);let z=w[C.indexOf($)%w.length];return z==="rectangle"&&(z="rect"),Ye.createElementNS(_t.svg,"hasValidPointType"in o&&o.hasValidPointType(z)?z:"use")}).attr("class",$e.legendItemPoint).style("fill",zo.bind(o)).style("pointer-events",o.getStylePropValue("none")).attr("href",($,z,B)=>{const H=B[z].nodeName.toLowerCase(),_=o.getTargetSelectorSuffix($);return H==="use"?`#${c.datetimeId}-point${_}`:void 0})}else E.append(m?"line":h).attr("class",$e.legendItemTile).style("stroke",zo.bind(o)).style("pointer-events",o.getStylePropValue("none")).call(C=>{h==="circle"?C.attr("r",d).style("fill",zo.bind(o)).attr("cx",i?r.x2Tile:S).attr("cy",i?S:r.yTile):m&&C.attr("stroke-width",e.height).attr("x1",i?r.x1Tile:S).attr("y1",i?S:r.yTile).attr("x2",i?r.x2Tile:S).attr("y2",i?S:r.yTile)})},updateLegendItemPos(t,e,n){const r=this,{config:i,$el:{legend:s},$T:o}=r,l=i.legend_usePoint,c=i.legend_item_tile_type,u=c!=="circle";if(l){const f=s.selectAll(`.${$e.legendItemPoint}`).data(t),d=i.legend_item_tile_type!=="circle",h=d?i.legend_item_tile_width:i.legend_item_tile_r*2,m=d?i.legend_item_tile_height:i.legend_item_tile_r*2,S=h*.75,E=m*.75,C=h/8,w=m/8;o(f,e).each(function(){const $=this.nodeName.toLowerCase();let z="x",B="y",W=null,H=null,_=null;$==="circle"?(z="cx",B="cy",W=Math.min(S,E)/2):$==="rect"&&(H=S,_=E);const q=Yt(this).attr("transform",null).attr("x",null).attr("y",null).attr("cx",null).attr("cy",null).attr("r",W).attr("width",H).attr("height",_);$==="use"?q.attr("transform",st=>`translate(${n.x1Tile(st)} ${n.yTile(st)-m/2}) scale(${C} ${w})`):q.attr(z,st=>n.x1Tile(st)+(h-(H||0))/2).attr(B,st=>n.yTile(st)-(_||0)/2)})}else{const f=s.selectAll(`.${$e.legendItemTile}`).data(t);o(f,e).style("stroke",zo.bind(r)).call(d=>{c==="circle"?d.attr("cx",h=>{const m=n.x2Tile(h);return m-(m-n.x1Tile(h))/2}).attr("cy",n.yTile):u&&d.attr("x1",n.x1Tile).attr("y1",n.yTile).attr("x2",n.x2Tile).attr("y2",n.yTile)})}}},bA={redraw(t={}){var e,n,r,i,s,o,l,c,u,f;const d=this,{config:h,state:m,$el:S}=d,{main:E,treemap:C}=S;m.redrawing=!0,m.redrawGeneration++,(m.dirty.data||m.dirty.visibility||t.initializing)&&m.dataGeneration++,(t.initializing||m.dirty.size||m.dirty.data||!m.rendered)&&d.cache.remove([Oe.svgLeft]);const w=d.filterTargetsToShow(d.data.targets);m._targetsToShow=w;const $={data:m.dirty.data,visibility:m.dirty.visibility,size:m.dirty.size};m.dirty.data=!1,m.dirty.visibility=!1,m.dirty.size=!1;const{flow:z,initializing:B}=t,W=d.getWithOption(t),H=W.Transition?h.transition_duration:0,_=W.TransitionForExit?H:0,q=W.TransitionForAxis?H:0,st=(e=d.axis)==null?void 0:e.generateTransitions(q),it=$.data||$.visibility||B;if(m.isCanvasMode&&(d.setContainerSize(),(n=d.updateHtmlLegend)==null||n.call(d)),d.updateSizes(B),m.isCanvasMode){const ot=d.scale.zoom,ct=ot==null?void 0:ot.domain();ot&&(d.scale.zoom=null),d.updateScales(B,W.UpdateXDomain),ot&&(ot.range(d.scale.x.range()),ct&&ot.domain(ct),d.scale.zoom=d.getCustomizedXScale(ot),d.axis.x.scale(d.scale.zoom),d.scale.x.domain(h.zoom_rescale?ct:d.org.xDomain),d.scale.subX.domain(d.org.xDomain)),m.hasAxis&&d.axis.syncAxisDomains(w,W,z),m.hasAxis&&((r=d.applyCanvasSubchartDomain)==null||r.call(d));const gt=it?d.getDrawShape():m._cachedDrawShape||d.getDrawShape();it&&(m._cachedDrawShape=gt),h.legend_show&&S.legend&&!(h.legend_contents_bindto&&h.legend_contents_template)&&((i=d.positionHtmlLegend)==null||i.call(d)),(s=d.resizeCanvas)==null||s.call(d),m.canvasFocusKey=null,d.renderCanvasFrame(gt,null,!0),B&&d.updateTypesElements(),d.callPluginHook("$redraw",t,0),m.redrawing=!1,m._targetsToShow=null,m._cachedDrawShape=null,d.mapToIds(d.data.targets).forEach(tt=>{m.withoutFadeIn[tt]=!0}),Ne(h.onrendered,d.api);return}W.Legend&&h.legend_show?(t.withTransition=!!H,!C&&d.updateLegend(d.mapToIds(d.data.targets),t,st)):W.Dimension&&d.updateDimension(!0),h.data_empty_label_text&&E.select(`text.${En.text}.${ze.empty}`).attr("x",m.width/2).attr("y",m.height/2).text(h.data_empty_label_text).style("display",w.length?"none":null),(o=d.redrawTitle)==null||o.call(d),m.hasAxis?(d.axis.redrawAxis(w,W,st,z,B),(l=d.hasGrid)!=null&&l.call(d)&&d.updateGrid(),h.regions.length&&((c=d.updateRegion)==null||c.call(d)),["bar","candlestick","line","area"].forEach(ot=>{const ct=Ln(ot);(/^(line|area)$/.test(ot)&&d.hasTypeOf(ct)||d.hasType(ot))&&it&&d[`update${ct}`](W.TransitionForExit)}),S.text&&E.selectAll(`.${on.selectedCircles}`).filter(d.isBarType.bind(d)).selectAll("circle").remove(),h.interaction_enabled&&!z&&W.EventRect&&(d.redrawEventRect(),(u=d.bindZoomEvent)==null||u.call(d))):(S.arcs&&d.redrawArc(H,_,W.Transform),S.radar&&d.redrawRadar(),S.polar&&d.redrawPolar(),S.funnel&&d.redrawFunnel(),C&&d.updateTreemap(_)),!m.resizing&&!C&&(d.hasPointType()||m.hasRadar)?it&&d.updateCircle():(f=d.hasLegendDefsPoint)!=null&&f.call(d)&&d.data.targets.forEach(d.point("create",this)),d.hasDataLabel()&&!d.hasArcType(null,["radar"])&&it&&d.updateText(),B&&d.updateTypesElements(),d.generateRedrawList(w,z,H,W.Subchart,it),d.updateTooltipOnRedraw(),d.callPluginHook("$redraw",t,H)},generateRedrawList(t,e,n,r,i=!0){const s=this,{config:o,state:l}=s,c=i?s.getDrawShape():l._cachedDrawShape||s.getDrawShape();i&&(l._cachedDrawShape=c),l.hasAxis&&o.subchart_show&&s.redrawSubchart(r,n,c);const u=e&&s.generateFlow({targets:t,flow:e,duration:e.duration,shape:c,xv:s.xv.bind(s)}),f=(n||u)&&os(),d=s.getRedrawList(c,e,u,f),h=()=>{u&&u(),l.redrawing=!1,l._targetsToShow=null,l._cachedDrawShape=null,Ne(o.onrendered,s.api)};if(f&&d.length){const m=Mh();ov().duration(n).each(()=>{d.flatMap(S=>S).forEach(S=>m.add(S))}).call(m,h)}else l.transiting||h();s.mapToIds(s.data.targets).forEach(m=>{l.withoutFadeIn[m]=!0})},getRedrawList(t,e,n,r){const i=this,{config:s,state:{hasAxis:o,hasRadar:l,hasTreemap:c},$el:{grid:u}}=i,{cx:f,cy:d,xForText:h,yForText:m}=t.pos,S=[];if(o){i.redrawGrid&&(s.grid_x_lines.length||s.grid_y_lines.length)&&S.push(i.redrawGrid(r)),i.redrawRegion&&s.regions.length&&S.push(i.redrawRegion(r));for(const E in t.type){const C=Ln(E),w=t.type[E];(/^(area|line)$/.test(E)&&i.hasTypeOf(C)||i.hasType(E))&&S.push(i[`redraw${C}`](w,r))}!e&&u.main&&i.updateGridFocus&&S.push(i.updateGridFocus())}return(!i.hasArcType()||l)&&vn(s.data_labels)&&s.data_labels!==!1&&S.push(i.redrawText(h,m,e,r)),(i.hasPointType()||l)&&!i.isPointFocusOnly()&&i.redrawCircle&&S.push(i.redrawCircle(f,d,r,n)),c&&S.push(i.redrawTreemap(r)),S},updateAndRedraw(t={}){const e=this,{config:n,state:r}=e;let i;t.withTransition=ia(t,"withTransition",!0),t.withTransform=ia(t,"withTransform",!1),t.withLegend=ia(t,"withLegend",!1),t.withUpdateXDomain=!0,t.withUpdateOrgXDomain=!0,t.withTransitionForExit=!1,t.withTransitionForTransform=ia(t,"withTransitionForTransform",t.withTransition),t.withLegend&&n.legend_show||(r.hasAxis&&(i=e.axis.generateTransitions(t.withTransitionForAxis?n.transition_duration:0)),e.updateScales(),e.updateSvgSize(),e.transformAll(t.withTransitionForTransform,i)),e.redraw(t)}},SA={setContainerSize(){const t=this,{state:e}=t;e.current.width=t.getCurrentWidth(),e.current.height=t.getCurrentHeight()},getCurrentWidth(){const t=this;return t.config.size_width||t.getParentRectValue("width")},getCurrentHeight(){var t,e;const n=this,{config:r,state:i,$el:s}=n;let o=r.size_height;if(!o){const l=i.isCanvasMode?(t=s.chart)==null?void 0:t.node():null,c=l==null?void 0:l.style.minHeight;c&&(l.style.minHeight=""),o=n.getParentHeight(),c&&(l.style.minHeight=c);const u=l&&parseFloat((e=n.canvasEngine)==null?void 0:e.canvas.style.height)||0,f=i.current.height-u;f>0&&Math.round(o)===Math.round(u)&&(o+=f)}return o>0?o:320/(n.hasType("gauge")&&!r.gauge_fullCircle?2:1)},getParentRectValue(t){const e=`offset${Ln(t)}`;let n=this.$el.chart.node(),r=0;for(;r<30&&n&&n.tagName!=="BODY";){try{r=ln(n,!0)[t]}catch(s){e in n&&(r=n[e])}n=n.parentNode}const i=Ye.body[e];return r>i&&(r=i),r},getParentHeight(){const t=this.$el.chart.style("height");let e=0;return t&&(e=/px$/.test(t)?parseInt(t,10):this.getParentRectValue("height")),e},getSvgLeft(t){var e,n,r;const i=this,{cache:s,config:o,state:{hasAxis:l},$el:c}=i;if(t){const st=s.get(Oe.svgLeft);if(st!==null)return st}const u=o.axis_rotated,f=u||!u&&!o.axis_y_inner,d=u?Rn.axisX:Rn.axisY,h=c.main.select(`.${d}`).node(),m=l&&o[`axis_${u?"x":"y"}_label`],E=l&&(je(m)||je(m.text)||/^inner-/.test(m==null?void 0:m.position))?c.main.select(`.${d}-label`):null,C=E&&!E.empty()?E.node():null,w=!t,$={label:C?ln(C,w):null,leftAxis:h&&f?ln(h,w):null,chart:ln(c.chart.node(),w)},z=(n=(e=$.label)==null?void 0:e.left)!=null?n:0,B=(r=$.leftAxis)!=null?r:{right:0},W=$.chart.left+z,H=i.hasArcType(),_=B.right-W-(H?0:i.getCurrentPaddingByDirection("left",t)),q=_>0?_:0;return s.add(Oe.svgLeft,q),q},previewResize(){var t,e,n;const r=this,{state:i,$el:s}=r,{current:o}=i,l=r.getCurrentWidth(),c=r.getCurrentHeight();if(!(!l||!c||!o.width||!o.height||l===o.width&&c===o.height)){if(i.isCanvasMode){const u=(t=r.canvasEngine)==null?void 0:t.canvas;if(!u)return;s.chart.style("min-height",`${c}px`),u.style.width=`${l}px`,u.style.height=`${Math.max(0,c-((n=(e=r.getCanvasBottomLegendHeight)==null?void 0:e.call(r))!=null?n:0))}px`}else if(s.svg)s.svg.attr("viewBox",`0 0 ${o.width} ${o.height}`).attr("preserveAspectRatio","none").attr("width",l).attr("height",c);else return;i.resizePreview=!0}},clearResizePreview(){const t=this,{config:e,state:n,$el:r}=t;n.resizePreview&&(n.resizePreview=!1,!n.isCanvasMode&&r.svg&&e.resize_auto!=="viewBox"&&r.svg.attr("viewBox",null).attr("preserveAspectRatio",null))},updateDimension(t){var e,n;const r=this,{config:i,state:{hasAxis:s,isCanvasMode:o},$el:l}=r;if(s&&!t&&r.axis.x&&i.axis_rotated&&((e=r.axis.subX)==null||e.create(l.axis.subX)),r.updateScales(t),o){(n=r.resizeCanvas)==null||n.call(r);return}r.updateSvgSize(),r.transformAll(!1)},updateSvgSize(){var t;const e=this,{config:n,state:{clip:r,current:i,hasAxis:s,width:o,height:l},$el:{svg:c}}=e;if(!c){(t=e.resizeCanvas)==null||t.call(e);return}if(e.clearResizePreview(),n.resize_auto==="viewBox"?c.attr("viewBox",`0 0 ${i.width} ${i.height}`):c.attr("width",i.width).attr("height",i.height),s){const u=c.select(`.${Th.brush} .overlay`),f={width:0,height:0};u.size()&&(f.width=+u.attr("width"),f.height=+u.attr("height")),c.selectAll([`#${r.id}`,`#${r.idGrid}`]).select("rect").attr("width",o).attr("height",l),c.select(`#${r.idXAxis}`).select("rect").call(e.setXAxisClipPath.bind(e)),c.select(`#${r.idYAxis}`).select("rect").call(e.setYAxisClipPath.bind(e)),r.idSubchart&&c.select(`#${r.idSubchart}`).select("rect").attr("width",o).attr("height",f.height)}},getCurrentPaddingByDirection(t,e=!1,n=!1){var r;const i=this,{config:s,$el:o,state:{hasAxis:l,isCanvasMode:c}}=i,u=s.axis_rotated,f=((r=s.padding)==null?void 0:r.mode)==="fit",d=ae(s[`padding_${t}`])?s[`padding_${t}`]:void 0,h=l?{top:u?"y2":null,bottom:u?"y":"x",left:u?"x":"y",right:u?null:"y2"}[t]:null,m=/^(left|right)$/.test(t),S=h&&s[`axis_${h}_inner`],E=h&&s[`axis_${h}_show`],C=h?s[`axis_${h}_axes`].length:0;let w=h?m?i.getAxisWidthByAxisId(h,e):i.getHorizontalAxisHeight(h):0;const $=20;let z=0;!f&&m&&(w=py(w));let B=l&&m&&(S||mn(d)&&!E)?0:f?(E?w:0)+(d!=null?d:0):mn(d)?w:d;return m&&l?(h&&(f||S)&&s[`axis_${h}_label`].text&&(B+=i.axis.getAxisLabelPosition(h).isOuter?$:0),t==="right"?(B+=u?!f&&mn(d)?10:2:!E||S?f?2:1:0,B+=n?i.axis.getXAxisTickTextY2Overflow($):0):t==="left"&&u&&mn(d)&&(B=s.axis_x_show?f?w:Math.max(w,40):1)):t==="top"?((o.title&&o.title.node()||c&&s.title_text)&&(B+=i.getTitlePadding()),z=u&&!S?C:0):t==="bottom"&&l&&u&&!E&&(B+=1),B+w*C-z},getCurrentPadding(t=!1){const e=this,[n,r,i,s]=["top","bottom","left","right"].map(o=>e.getCurrentPaddingByDirection(o,null,t));return{top:n,bottom:r,left:i,right:s}},getResettedPadding(t){const e=this,{config:n}=e,r=ae(t);let i=r?0:{};return n.padding===!1?!r&&Object.keys(t).forEach(s=>{i[s]=!lr(n.data_labels)&&n.data_labels!==!1&&s==="top"?t[s]:0}):i=t,i},updateSizes(t){var e,n,r,i,s;const o=this,{config:l,state:c,$el:{legend:u}}=o,f=l.axis_rotated,d=o.hasArcType()||c.hasFunnel||c.hasTreemap,h=((e=l.padding)==null?void 0:e.mode)==="fit";!t&&o.setContainerSize();const m=u?o.getLegendWidth():0,S=u?o.getLegendHeight():0,E={width:m,height:S};!d&&l.axis_x_show&&l.axis_x_tick_autorotate&&o.updateXAxisTickClip();const C={right:l.legend_show&&c.isLegendRight?m+(h?0:20):0,bottom:!l.legend_show||c.isLegendRight||c.isLegendInset?0:S},w=f||d?0:o.getHorizontalAxisHeight("x"),$=l.subchart_axis_x_show&&l.subchart_axis_x_tick_text_show?w:30,z=l.subchart_show&&!d?l.subchart_size_height+$:0,B=o.hasType("gauge")&&l.arc_needle_show&&!l.gauge_fullCircle&&!l.gauge_label_show?10:0,W=o.getCurrentPadding(!0);if(c.margin=!d&&f?{top:W.top,right:d?0:W.right+C.right,bottom:C.bottom+W.bottom,left:z+(d?0:W.left)}:{top:(h?0:4)+W.top,right:d?0:W.right+C.right,bottom:B+z+C.bottom+W.bottom,left:d?0:W.left},c.margin=o.getResettedPadding(c.margin),c.margin2=f?{top:c.margin.top,right:NaN,bottom:20+C.bottom,left:o.state.rotatedPadding.left}:{top:c.current.height-z-C.bottom,right:NaN,bottom:$+C.bottom,left:c.margin.left},c.margin3={top:0,right:NaN,bottom:0,left:0},(n=o.updateSizeForLegend)==null||n.call(o,E),c.width=c.current.width-c.margin.left-c.margin.right,c.height=c.current.height-c.margin.top-c.margin.bottom,c.width<0&&(c.width=0),c.height<0&&(c.height=0),c.width2=f?c.margin.left-c.rotatedPadding.left-c.rotatedPadding.right:c.width,c.height2=f?c.height:c.current.height-c.margin2.top-c.margin2.bottom,c.width2<0&&(c.width2=0),c.height2<0&&(c.height2=0),o.hasArcType()){const H=o.hasType("gauge"),_=l.legend_show&&c.isLegendRight,q=(r=c.hasRadar&&o.cache.get(Oe.radarTextWidth))!=null?r:0;c.arcWidth=c.width-(_?E.width+10:0)-q,c.arcHeight=c.height-(_&&!H?0:10),(i=l.arc_rangeText_values)!=null&&i.length&&(H?(c.arcWidth-=25,c.arcHeight-=10,c.margin.left+=10):(c.arcHeight-=20,c.margin.top+=10)),H&&!l.gauge_fullCircle&&(c.arcHeight+=c.height-o.getPaddingBottomForGauge()),(s=o.updateRadius)==null||s.call(o)}c.isLegendRight&&d&&(c.margin3.left=c.arcWidth/2+c.radiusExpanded*1.1)}},AA={setCssRule(t,e,n,r){const i=this,{config:s,state:{cssRule:o,style:l}}=i;return s.boost_useCssRule?c=>{c.each(u=>{const f=r&&(r==null?void 0:r.call(i,u)),d=`${t?`.${Tn.shapes+i.getTargetSelectorSuffix(u.id)}`:""}${e}`;e in o&&l.sheet.deleteRule(o[d]),i.state.cssRule[d]=W1(l,d,n.filter(Boolean).map(h=>je(f)&&h.indexOf(":")===-1?`${h}: ${f}`:h||""))})}:()=>{}},getStylePropValue(t){const{config:{boost_useCssRule:e}}=this;return e?null:ie(t)?t.bind(this):t}};function Ev(t){return typeof t=="string"?new fn([document.querySelectorAll(t)],[document.documentElement]):new fn([b(t)],hr)}function EA(t){let e="middle";return t>0&&t<=170?e="end":t>190&&t<=360&&(e="start"),e}function CA(t,e,n,r,i){var s;const o=this,{value:l}=t,c=o.isCandlestickType(t),u=ae(l)&&l<0||c&&!((s=o.getCandlestickData(t))!=null&&s._isUp);let{x:f,y:d}=e;const h=4,m=h*2;return r?n==="start"?(f+=u?0:m,d+=h):n==="middle"?(f+=m,d-=m):n==="end"&&(u&&(f-=m),d+=h):(n==="start"?(f+=h,u&&(d+=m*2)):n==="middle"?d-=m:n==="end"&&(f-=h,u&&(d+=m*2)),i&&(d+=u?-17:c?13:7)),{x:f,y:d}}function Cv(t,e){var n;const r=this.config.data_labels_position,{id:i,index:s,value:o}=t;return(n=ie(r)?r.bind(this.api)(e,o,i,s,this.$el.text):(i in r?r[i]:r)[e])!=null?n:0}function IA(t,e,n){var r,i;const s=this,{config:o,$T:l}=s,c=o.axis_rotated,{border:{padding:u="3 5",radius:f=10,stroke:d="#000",strokeWidth:h=1,fill:m="none"}}=o.data_labels,S=jf(u),E=o.data_labels.border!==!0,C=ha(t);let w=Yt(t.previousElementSibling);(w.empty()||((r=w.node())==null?void 0:r.tagName)!=="rect"||!((i=w.attr("class"))!=null&&i.includes(n)))&&(w=Yt(t.parentNode).insert("rect",()=>t).attr("class",`${En.textBorderRect} ${n}`).attr("width",C.width+(E?S.left+S.right:0)).attr("height",C.height+(E?S.top+S.bottom:0)),E&&w.style("fill",m).style("stroke",d).style("stroke-width",`${h}px`).attr("rx",f).attr("ry",f)),l(w).attr("x",e.x-(E?S.left:0)-(c?0:C.width/2)).attr("y",e.y-(E?S.top:0)-C.height/4*3.2)}function Qc(t=0,e){const n=this,{config:r}=n,i=r[`${e}_label_threshold`]||0;return t>=i}function Iv(){const t=this,{$el:{text:e},config:n}=t;(t.state.arcWidth?t.getArcLabelConfig("image"):n.data_labels.image)&&e.filter(function(){const i=this.previousElementSibling;return i?i.tagName!=="image"||!i.classList.contains(En.textLabelImage):!0}).each(function(i){var s,o,l,c;const u=RA.call(t,i);if(!u)return;const{url:f,width:d,height:h,pos:m}=u;if(f){const S=Yt(this.parentNode);S==null||S.insert("image",`${(o=(s=this.getAttribute("class"))==null?void 0:s.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",E=>Pa(f,{ID:"id"in E?E.id:E.data.id})).attr("class",En.textLabelImage).style("pointer-events","none").attr("width",d).attr("height",h).attr("transform",m?`translate(${(l=m.x)!=null?l:0} ${(c=m.y)!=null?c:0})`:null)}})}function RA(t){var e;const n=this,{config:r,state:i}=n,s=i.arcWidth?n.getArcLabelConfig("image"):r.data_labels.image;if(ie(s))return(e=s.call(n.api,t.value,t.id,t.index))!=null?e:{url:"",width:0,height:0,pos:{x:0,y:0}};if(s){const{url:o="",width:l=0,height:c=0,pos:u}=s;return{url:o,width:l,height:c,pos:u}}return null}function Rv(t,e,n){var r;const i=this,{config:s,state:{arcWidth:o,hasTreemap:l}}=i,c=s.axis_rotated,u=Yt(t.previousElementSibling),f=d=>{var h;const m=d.style.opacity!=="0"&&d.style.fillOpacity!=="0";return(o?d.textContent:m)&&((h=this.previousElementSibling)==null?void 0:h.tagName)!=="image"};if(!u.empty()&&((r=u.node())==null?void 0:r.tagName)==="image"){const d=n||ln(t),h=+u.attr("width")/2,m=+u.attr("height")/2;let S=e.x-h,E=e.y-m-d.height/2;c?e.x+=h:(l&&(S=-h,E=-(m*2+d.height)),i.hasType("pie")||i.hasType("polar")||(e.y+=m)),i.$T(u).style("opacity",f(t)?null:"0").attr("x",S).attr("y",E)}}function wA(t){return Kf(t,e=>e,e=>ha(e,!0))}var OA={opacityForText(t){const e=this;return e.isBarType(t)&&!Qc.call(e,Math.abs(e.getRatio("bar",t)),"bar")?"0":e.hasDataLabel()?null:"0"},initText(){const{$el:t}=this;t.main.select(`.${ze.chart}`).append("g").attr("class",En.chartTexts).style("pointer-events",t.funnel||t.treemap?"none":null)},updateTargetsForText(t){const e=this,n=e.getChartClass("Text"),r=e.getClass("texts","id"),i=e.classFocus.bind(e);e.$el.main.select(`.${En.chartTexts}`).selectAll(`.${En.chartText}`).data(e.filterNullish(t)).attr("class",l=>`${n(l)}${i(l)}`.trim()).enter().append("g").style("opacity","0").attr("class",n).call(e.setCssRule(!0,` .${En.text}`,["fill","pointer-events:none"],e.updateTextColor)).append("g").attr("class",r)},updateText(){const t=this,{$el:e,$T:n,config:r,axis:i}=t,s=t.getClass("text","index"),o=r.data_labels.centered,l=e.main.selectAll(`.${En.texts}`).selectAll(`.${En.text}`).data(t.labelishData.bind(t));n(l.exit()).style("fill-opacity","0").remove(),e.text=l.enter().append("text").merge(l).attr("class",s).attr("text-anchor",c=>{let f=r[`axis_${i==null?void 0:i.getId(c.id)}_inverted`]?c.value>0:c.value<0;if(t.isCandlestickType(c)){const d=t.getCandlestickData(c);f=!(d!=null&&d._isUp)}else if(t.isTreemapType(c))return o?"middle":"start";return r.axis_rotated?f?"end":"start":"middle"}).style("fill",t.getStylePropValue(t.updateTextColor)).style("fill-opacity","0").each(function(c,u,f){const d=Yt(this);let{value:h}=c;if(t.isBubbleZType(c))h=t.getBubbleZData(h,"z");else if(t.isCandlestickType(c)){const m=t.getCandlestickData(c);m&&(h=m.close)}h=t.isTreemapType(c)?t.treemapDataLabelFormat(c)(d):t.dataLabelFormat(c.id)(h,c.id,c.index,f),ae(h)?this.textContent=h:ci(d,h,void 0,!0)}),Iv.call(t)},updateTextColor(t){const e=this,{config:n}=e,r=n.data_labels_colors,i=e.isArcType(t)&&!e.isRadarType(t)||e.isFunnelType(t)||e.isTreemapType(t)?null:e.color(t);let s;if(je(r))s=r;else if(He(r)){const{id:o}=t.data||t;s=r[o]}else ie(r)&&(s=r.bind(e.api)(i,t));if(e.isCandlestickType(t)&&!ie(r)){const o=e.getCandlestickData(t);if(!(o!=null&&o._isUp)){const l=n.candlestick_color_down;s=He(l)?l[t.id]:l}}return s||i},updateTextBGColor(t,e){const n=this,{$el:{defs:r}}=n;let i="";if(e){const s=je(e)?"":n.getTargetSelectorSuffix("id"in t?t.id:t.data.id),o=r.select(["filter[id*='labels-bg","']"].join(s));if(o.size()&&(i=`url(#${o.attr("id")})`),ie(e)){n.generateTextBGColorFilter(e);const l=n.color(t),c=e.bind(n.api)(l,t);c?o.select("feFlood").attr("flood-color",c):i=""}}return i||null},redrawText(t,e,n,r){const i=this,{$T:s,axis:o,config:l,state:{hasTreemap:c}}=i,u=Cr(!0),f=l.axis_rotated,d=l.data_labels.rotate,h=EA(d),m=d?`rotate(${d})`:"",S=i.$el.text.style("fill",i.getStylePropValue(i.updateTextColor)).attr("filter",w=>i.updateTextBGColor.bind(i)(w,l.data_labels_backgroundColors)).style("fill-opacity",n?0:i.opacityForText.bind(i)),E=new Map,C=[];return S.each(function(w){const $=this;E.set($,{rect:ln($)}),l.data_labels.centered&&(i.isBarType(w)||i.isTreemapType(w))&&C.push($)}),C.length>0&&wA(C).forEach((w,$)=>{const z=E.get($);z&&(z.bbox=w)}),S.each(function(w,$){const z=E.get(this),B=s(c&&this.childElementCount?this.parentNode:this,!!(r&&(this.getAttribute("x")||this.getAttribute("transform"))),u),W=l[`axis_${o==null?void 0:o.getId(w.id)}_inverted`];let H={x:t.call(this,w,$,z),y:e.call(this,w,$,z)};d&&(H=CA.bind(i)(w,H,h,f,W),B.attr("text-anchor",h)),Rv.call(i,this,H,z==null?void 0:z.rect),this.childElementCount||d?B.attr("transform",`translate(${H.x} ${H.y}) ${m}`):B.attr("x",H.x).attr("y",H.y),l.data_labels.border&&IA.call(i,B.node(),H,`${En.textBorderRect}-${$}`)}),!0},getTextRect(t,e){var n,r;const i=this;let s,o,l;Array.isArray(t)?s=`${Oe.textRect}-${t.join("_")}`:(o=(r=(n=t.node)==null?void 0:n.call(t))!=null?r:t,/text/i.test(o.tagName)||(o=o.querySelector("text")),l=o.textContent,s=`${Oe.textRect}-${l.replace(/\W/g,"_")}`);const c=i.cache.get(s)||[];return c.length===0&&((i.$el.svg||i.$el.chart.select("svg")).selectAll(`.${ze.dummy}`).data(l?[l]:t).enter().append("text").style("visibility","hidden").style("font",o?Yt(o).style("font"):null).classed(e||ze.dummy,!0).text(u=>u).each(function(u,f){c[f]=ln(this)}).remove(),i.cache.add(s,c)),c.length>1?c:c[0]},generateXYForText(t,e){const n=this,{state:{hasRadar:r,hasFunnel:i,hasTreemap:s}}=n,o=Object.keys(t),l={},c=e?n.getXForText:n.getYForText;return i&&o.push("funnel"),r&&o.push("radar"),s&&o.push("treemap"),o.forEach(u=>{l[u]=n[`generateGet${Ln(u)}Points`](t[u],!1)}),function(u,f,d){const h=n.isAreaType(u)&&"area"||n.isBarType(u)&&"bar"||n.isCandlestickType(u)&&"candlestick"||n.isFunnelType(u)&&"funnel"||n.isRadarType(u)&&"radar"||n.isTreemapType(u)&&"treemap"||"line";return c.call(n,l[h](u,f),u,this,d)}},getCenteredTextPos(t,e,n,r,i){const s=this,{config:o}=s,l=o.axis_rotated,c=s.isBarType(t),u=s.isTreemapType(t);if(o.data_labels.centered&&(c||u)){const f=(i==null?void 0:i.bbox)||ha(n);if(c){const d=s.getRangedData(t,null,"bar")>=0;if(l){const h=(d?e[1][1]-e[0][1]:e[0][1]-e[1][1])/2+f.width/2;return d?-h-3:h+2}else{const h=(d?e[0][1]-e[1][1]:e[1][1]-e[0][1])/2+f.height/2;return d?h:-h-2}}else if(u)return r==="x"?(e[1][0]-e[0][0])/2:(e[1][1]-e[0][1])/2-f.y-f.height/2}return 0},getXForText(t,e,n,r){var i,s,o;const l=this,{config:c}=l,u=c.axis_rotated,f=l.isFunnelType(e),d=l.isTreemapType(e);let h=t?t[0][0]:0;if(l.isCandlestickType(e))u?h=(i=l.getCandlestickData(e))!=null&&i._isUp?t[2][2]+4:t[2][1]-4:h+=(t[1][0]-h)/2;else if(f)if(t)h=(o=(s=t[2])==null?void 0:s[0])!=null?o:h;else return Ic(n,"x");else if(d)h+=c.data_labels.centered?0:5;else if(u){const m=c[`axis_${l.axis.getId(e.id)}_inverted`],S=l.isBarType(e)?4:6,E=e.value;h=t[2][1],h+=S*((m?E>0:E<0)?-1:1)}else h=l.hasType("bar")?(t[2][0]+t[0][0])/2:h;return(u||d||f)&&(h+=l.getCenteredTextPos(e,t,n,"x",r)),h+Cv.call(this,e,"x")},getYForText(t,e,n,r){var i,s;const o=this,{axis:l,config:c,state:u}=o,f=c.axis_rotated,d=c[`axis_${l==null?void 0:l.getId(e.id)}_inverted`],h=o.isBarType(e),m=o.isFunnelType(e),S=o.isTreemapType(e),E=c.point_r,C=(r==null?void 0:r.rect)||ln(n);let{value:w}=e,$=3,z;if(o.isCandlestickType(e))w=o.getCandlestickData(e),f?(z=t[0][0],z+=(t[1][0]-z)/2+$):(z=w&&w._isUp?t[2][2]-$:t[2][1]+$*4,d&&(z+=15*(w._isUp?1:-1)));else if(m)if(t)z=((s=(i=t[2])==null?void 0:i[1])!=null?s:t[0][1])+C.height/2-3;else return Ic(n,"y");else if(S)z=t[0][1]+(c.data_labels.centered?0:C.height+5);else if(f)z=(t[0][0]+t[2][0]+C.height*.6)/2;else if(z=t[2][1],ae(E)&&E>5&&(o.isLineType(e)||o.isScatterType(e))&&($+=c.point_r/2.3),w<0||w===0&&!u.hasPositiveValue&&u.hasNegativeValue)z+=d?h?-3:-5:C.height+(h?-$:$);else{let B=-$*2;h?B=-$:o.isBubbleType(e)&&(B=$),d&&(B=h?10:15),z+=B}return(!f||S)&&(z+=o.getCenteredTextPos(e,t,n,"y",r)),z+Cv.call(this,e,"y")},markOverlapped(t,e,n){const r=e.$el.arcs.selectAll(n),i=r.filter(f=>f.data.id!==t),s=r.filter(f=>f.data.id===t),o=Cc(s.node()),l=(f,d)=>Math.sqrt(f*f+d*d);if(!s.node())return;const c=parseInt(s.style("font-size"),10),u=[];i.each(function(){const f=Cc(this),d=l(o.e,o.f)>l(f.e,f.f)?s:Yt(this),h=Math.ceil(Math.abs(o.e-f.e))<Math.ceil(d.node().getComputedTextLength()),m=Math.ceil(Math.abs(o.f-f.f))<c;u.push({node:this,overlaps:h&&m})}),u.forEach(({node:f,overlaps:d})=>{Yt(f).classed(En.TextOverlapping,d)})},undoMarkOverlapped(t,e){t.$el.arcs.selectAll(e).each(function(){Ev([this,this.previousSibling]).classed(En.TextOverlapping,!1)})}};function wv(t="left",e){const n=ae(e);return t.includes("center")?n?e/2:"middle":t.includes("right")?n?e:"end":n?0:"start"}function PA(t){var e,n,r,i,s,o,l,c;const{config:u,$el:f}=t,d=((r=(n=(e=t.canvasTheme)==null?void 0:e.style)==null?void 0:n.title)==null?void 0:r.font)||((o=(s=(i=t.canvasTheme)==null?void 0:i.style)==null?void 0:s.label)==null?void 0:o.font)||"14px sans-serif",h=(c=(l=f.chart)==null?void 0:l.node)==null?void 0:c.call(l),m=h==null?void 0:h.ownerDocument;if(h&&m&&u.title_text){const S=m.createElementNS("http://www.w3.org/2000/svg","svg"),E=m.createElementNS("http://www.w3.org/2000/svg","text");S.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",E.setAttribute("class",En.title),E.style.font=d,E.textContent=String(u.title_text),S.appendChild(E),h.appendChild(S);const C=ln(E).height;if(S.remove(),C)return C}return u.title_text?parseFloat(d)||14:0}var MA={initTitle(){const t=this,{config:e,$el:n}=t;if(e.title_text){n.title=n.svg.append("g");const r=n.title.append("text").style("text-anchor",wv(e.title_position)).attr("class",En.title);ci(r,e.title_text,[.3,1.5])}},redrawTitle(){const t=this,{config:e,state:{current:n},$el:{title:r}}=t;if(r){const i=wv(e.title_position,n.width),s=(e.title_padding.top||0)+t.getTextRect(t.$el.title,En.title).height;r.attr("transform",`translate(${i}, ${s})`)}},getCanvasTitleHeight(){return PA(this)},getTitlePadding(){const t=this,{$el:{title:e},config:n,state:r}=t,i=n.title_padding.top||0,s=n.title_padding.bottom||0;if(r.isCanvasMode&&n.title_text)return i+t.getCanvasTitleHeight()+s;if(!(e!=null&&e.node()))return i+s;const o=e.node(),l=Ic(o,"y");if(l){const c=ha(o);return l+c.y+c.height+s}return i+t.getTextRect(e,En.title).height+s}};const LA=/(\r?\n|\t)/g,DA=/{{(.*)}}/;var FA={initTooltip(){const t=this,{config:e,$el:n}=t;n.tooltip=Yt(e.tooltip_contents.bindto),n.tooltip.empty()&&(n.tooltip=n.chart.append("div").attr("class",bo.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),t.bindTooltipResizePos()},initShowTooltip(){var t;const e=this,{config:n,$el:r,state:{hasAxis:i,hasRadar:s}}=e;if(n.tooltip_init_show){const o=!(i||s);(t=e.axis)!=null&&t.isTimeSeries()&&je(n.tooltip_init_x)&&(n.tooltip_init_x=Wn.call(e,n.tooltip_init_x)),e.api.tooltip.show({data:{[o?"index":"x"]:n.tooltip_init_x}});const l=n.tooltip_init_position;if(!n.tooltip_contents.bindto&&!lr(l)){const{top:c=0,left:u=50}=l;r.tooltip.style("top",je(c)?c:`${c}px`).style("left",je(u)?u:`${u}px`).style("display",null)}}},getTooltipHTML(...t){const e=this,{api:n,config:r}=e;return Gr(ie(r.tooltip_contents)?r.tooltip_contents.bind(n)(...t):e.getTooltipContent(...t))},getTooltipContent(t,e,n,r){var i;const s=this,{api:o,config:l,state:c,$el:u}=s,f=l.tooltip_format_title,d=l.tooltip_format_name,h=l.tooltip_format_value,m=ie(f)?f.bind(o):e,S=ie(d)?d.bind(o):(tt=>tt),E=ie(h)?h.bind(o):null,C=(tt,ft,lt,bt)=>{let St=E;return St||(c.hasTreemap||s.isStackNormalized()&&(!s.isStackNormalizedPerGroup()||s.isGrouped(lt))?St=(Mt,Ot)=>`${(Ot*100).toFixed(2)}%`:St=n),St(tt,ft,lt,bt)},w=l.tooltip_order,$=tt=>s.axis&&s.isBubbleZType(tt)?s.getBubbleZData(tt.value,"z"):s.getBaseValue(tt),z=s.levelColor?tt=>s.levelColor(tt.value):tt=>r(tt),B=l.tooltip_contents,W=B.template,H=s.mapToTargetIds();if(w===null&&l.data_groups.length){const tt=s.orderTargets(s.data.targets).map(ft=>ft.id).reverse();t.sort((ft,lt)=>{let bt=ft?ft.value:null,St=lt?lt.value:null;return bt>0&&St>0&&(bt=ft.id?tt.indexOf(ft.id):null,St=lt.id?tt.indexOf(lt.id):null),bt-St})}else if(/^(asc|desc)$/.test(w)){const tt=w==="asc";t.sort((ft,lt)=>{const bt=ft?$(ft):null,St=lt?$(lt):null;return tt?bt-St:St-bt})}else ie(w)&&t.sort(w.bind(o));const _=s.getTooltipContentTemplate(W),q=t.length;let st,it,ot,ct,gt;for(gt=0;gt<q;gt++){it=t[gt];const tt=it&&$(it);if(!(!it||!(tt||tt===0))){if(mn(st)){const ft=(c.hasAxis||c.hasRadar)&&m(it.x);st=Pa(_[0],{CLASS_TOOLTIP:bo.tooltip,TITLE:Ge(ft)?W?ft:`<tr><th colspan="2">${ft}</th></tr>`:""})}if(!it.ratio&&u.arcs&&(ot=["arc",s.$el.arcs.select(`path.${Ze.arc}-${it.id}`).data()[0]],it.ratio=s.getRatio(...ot)),ot=[it.ratio,it.id,it.index],s.isAreaRangeType(it)){const[ft,lt]=["high","low"].map(St=>C(s.getRangedData(it,St),...ot));ct=`<b>Mid:</b> ${C($(it),...ot)} <b>High:</b> ${ft} <b>Low:</b> ${lt}`}else if(s.isCandlestickType(it)){const[ft,lt,bt,St,Mt]=["open","high","low","close","volume"].map(Ot=>s.getRangedData(it,Ot,"candlestick")?C(s.getRangedData(it,Ot,"candlestick"),...ot):void 0);ct=`<b>Open:</b> ${ft} <b>High:</b> ${lt} <b>Low:</b> ${bt} <b>Close:</b> ${St}${Mt?` <b>Volume:</b> ${Mt}`:""}`}else if(s.isBarRangeType(it)){const{value:ft,id:lt,index:bt}=it;ct=`${C(ft,void 0,lt,bt)}`}else ct=C($(it),...ot);if(ct!==void 0){if(it.name===null)continue;const ft=S((i=it.name)!=null?i:it.id,...ot),lt=z(it),bt={CLASS_TOOLTIP_NAME:bo.tooltipName+s.getTargetSelectorSuffix(it.id),COLOR:W||!s.patterns?lt:`<svg><rect style="fill:${lt}" width="10" height="10"></rect></svg>`,NAME:ft,VALUE:ct};if(W&&He(B.text)){const St=H.indexOf(it.id);Object.keys(B.text).forEach(Mt=>{bt[Mt]=B.text[Mt][St]})}st+=Pa(_[1],bt)}}}return`${st}</table>`},getTooltipContentTemplate(t){return(t||`<table class="{=CLASS_TOOLTIP}"><tbody>
45
+ `),o=r?s.length-1:1;t.html(""),s.forEach((l,c)=>{t.append("tspan").attr("x",0).attr("dy",`${c===0?n[0]*o:n[1]}em`).text(l)})}}}function Rh(t){const{x:e,y:n,width:r,height:i}=ha(t,!0);return[{x:e,y:n+i},{x:e,y:n},{x:e+r,y:n},{x:e+r,y:n+i}]}function wh(t){const{width:e,height:n}=ln(t),r=Rh(t),i=r[0].x,s=Math.min(r[0].y,r[1].y);return{x:i,y:s,width:e,height:n}}function Jn(t,e){var n;const r=t&&((n=t.touches||t.sourceEvent&&t.sourceEvent.touches)==null?void 0:n[0]);let i=[0,0];try{i=ur(r||t,e)}catch(s){}return i.map(s=>isNaN(s)?0:s)}function ln(t,e=!1){return Ih(!0,t,e)}function ha(t,e=!1){return Ih(!1,t,e)}function W1(t,e,n){const{rootSelector:r="",sheet:i}=t,s=`${r} ${X1(e)} {${n.join(";")}}`;return i[i.insertRule?"insertRule":"addRule"](s,i.cssRules.length)}function V1(t){let e=[];return t.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(e=e.concat(Oa(n.cssRules)))}catch(i){(r=se.console)==null||r.warn(`Error while reading rules from ${n.href}: ${String(i)}`)}}),e}function Oh(t){var e,n,r,i,s,o;return{x:((n=(e=se.pageXOffset)!=null?e:se.scrollX)!=null?n:0)+((r=t.scrollLeft)!=null?r:0),y:((s=(i=se.pageYOffset)!=null?i:se.scrollY)!=null?s:0)+((o=t.scrollTop)!=null?o:0)}}function So(t,e=0,n=0,r=!0){const i=new DOMPoint(e,n),s=t.getScreenCTM(),o=i.matrixTransform(r?s==null?void 0:s.inverse():s);if(r===!1){const l=ln(t);o.x-=l.x,o.y-=l.y}return o}function Cc(t){const e=t?t.transform:null,n=e&&e.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Ic(t,e){var n;const r=(n=t==null?void 0:t.getAttribute)==null?void 0:n.call(t,e);if(r)return parseFloat(r);const i=Cc(t);return e==="x"?i.e:i.f}function Rc(t){const e=t.attr("viewBox");return e?e.trim().split(/[\s,]+/).length===4:!1}function j1(t,e,n=!1){const r=!!t.node;let i=!1;for(const[s,o]of Object.entries(e))if(i=r?t.style(s)===o:t.style[s]===o,n?!i:i)break;return i}function os(){var t,e;return((t=Ye)==null?void 0:t.hidden)===!1||((e=Ye)==null?void 0:e.visibilityState)==="visible"}function H1(t,e){const{DocumentTouch:n,matchMedia:r,navigator:i}=se,s=r==null?void 0:r("(pointer:coarse)").matches;let o=!1;if(e)if(i&&"maxTouchPoints"in i)o=i.maxTouchPoints>0;else if("ontouchmove"in se||n&&Ye instanceof n)o=!0;else if(s)o=!0;else{const c=i.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(c)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(c)}return t&&!s&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function Ph(t,e){t.pendingRaf!==null?(se.cancelAnimationFrame(t.pendingRaf),t.pendingRaf=se.requestAnimationFrame(()=>{t.pendingRaf=null,e()})):(t.pendingRaf=se.requestAnimationFrame(()=>{t.pendingRaf=null}),e())}const wc={mouse:(()=>{const t=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(e,n,r=t())=>{e.dispatchEvent(new MouseEvent(n,r))}}catch(e){return(n,r,i=t())=>{const s=Ye.createEvent("MouseEvent");s.initMouseEvent(r,i.bubbles,i.cancelable,se,0,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(t,e,n)=>{const r=new Touch(Xr({identifier:Date.now(),target:t,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));t.dispatchEvent(new TouchEvent(e,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[r],targetTouches:[],changedTouches:[r]}))}},{setTimeout:Y1,clearTimeout:K1}=se;function Z1(t,e){const n=[];let r,i=null;const s=function(){s.clear(),e&&i===null&&(i=$f(()=>{i=null,e()})),t===!1?r=Bf(()=>{r=null,n.forEach(o=>o())},{timeout:200}):r=Y1(()=>{r=null,n.forEach(o=>o())},ae(t)?t:200)};return s.clear=()=>{r&&((t===!1?by:K1)(r),r=null)},s.clearLive=()=>{i!==null&&(Ty(i),i=null)},s.add=o=>n.push(o),s.remove=o=>{const l=n.indexOf(o);l!==-1&&n.splice(l,1)},s}function Mh(){let t=[];const e=function(n,r){function i(){var s;let o=0;for(let l=0,c;c=t[l];l++){if(c===!0||(s=c.empty)!=null&&s.call(c)){o++;continue}if(os()===!1){o=t.length;break}try{c.transition()}catch(u){o++}}return o===t.length}Hf(()=>{r==null||r()},i)};return e.add=function(n){qe(n)?t=t.concat(n):t.push(n)},e}const Lr={},Ao=new Set,Ba=new Map,J1=5e3,Lh=3;let Q1=0;function _1(){try{return"var bbWorker=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=[];return e.forEach(function(e,n){let r=e[0];e.forEach(function(e,i){if(i>0){if(t[i-1]===void 0&&(t[i-1]={}),e===void 0)throw Error(`Source data is missing a component at (${n}, ${i})!`);t[i-1][r]=e}})}),t}function n(e){let t=e[0],n=[];return e.forEach(function(e,r){if(r>0){let i={};e.forEach(function(e,n){if(e===void 0)throw Error(`Source data is missing a component at (${r}, ${n})!`);i[t[n]]=e}),n.push(i)}}),n}function r(e,r){let i=[],a,o;if(Array.isArray(e)){let t=function(e,t){if(e[t]!==void 0)return e[t];let n=t.replace(/\\[(\\w+)\\]/g,`.$1`).replace(/^\\./,``).split(`.`),r=e;return n.some(function(e){return!(r=r&&typeof r==`object`&&e in r?r[e]:void 0)}),r};a=r.x?r.value.concat(r.x):r.value,i.push(a),e.forEach(function(e){let n=a.map(function(n){let r=t(e,n);return r===void 0&&(r=null),r});i.push(n)}),o=n(i)}else Object.keys(e).forEach(function(t){let n=[].concat(e[t]);n.unshift?.(t),i.push(n)}),o=t(i);return o}let i={columns:t,json:r,rows:n},a=self;function o({data:e}){let{args:t,id:n,op:r}=e;try{let e=i[r];if(!e)throw Error(`Unknown worker op: ${r}`);a.postMessage({id:n,result:e(...t)})}catch(e){a.postMessage({id:n,error:e&&(e.message||e.name)||String(e)})}}return typeof window>`u`&&(a.onmessage=o),e.handleMessage=o,e.ops=i,e})({});"}catch(t){return""}}function Oc(){const{Blob:t,Worker:e,URL:n}=se;return e&&t&&(n!=null&&n.createObjectURL)&&(n!=null&&n.revokeObjectURL)?{Blob:t,Worker:e,URL:n}:null}function Dh(){return se.Worker||null}function q1(t){var e,n;return typeof t=="number"?{timeout:t,workerUrl:""}:{timeout:(e=t==null?void 0:t.timeout)!=null?e:J1,workerUrl:(n=t==null?void 0:t.workerUrl)!=null?n:""}}function Fh(t,e=!1){var n,r;const i=Lr[t];e&&Ao.add(t),i&&((n=i.worker)==null||n.terminate(),i.revoke&&((r=Oc())==null||r.URL.revokeObjectURL(i.src)),delete Lr[t]);for(const s of Ba.keys())s.startsWith(`${t}:`)&&Ba.delete(s)}function tb(t,e){if(t===e)return!0;try{return JSON.stringify(t)===JSON.stringify(e)}catch(n){return!0}}function eb(t){const[e,...n]=t;return Array.isArray(e)?[e.slice(0,Lh).map(r=>Array.isArray(r)?r.slice(0,Lh+1):r),...n]:t}function Nh(t,e,n,r){const i=++Q1;let s=!1,o;const l=new Promise((c,u)=>{const f=(S,E)=>{s||(s=!0,o(),S(E))},d=function(S){var E;((E=S.data)==null?void 0:E.id)===i&&(S.data.error?f(u,new Error(S.data.error)):f(c,S.data.result))},h=function(){f(u,new Error("worker error"))},m=setTimeout(()=>f(u,new Error("worker timeout")),r);o=()=>{clearTimeout(m),t.removeEventListener("message",d),t.removeEventListener("error",h)},t.addEventListener("message",d),t.addEventListener("error",h)});try{t.postMessage({args:n,id:i,op:e})}catch(c){throw s=!0,o(),c}return l}function nb(t,e,n,r,i,s){const o=eb(i),l=Nh(t,n,o,s).then(c=>tb(c,r(...o)),()=>!1).then(c=>(c?Ba.set(e,!0):Ba.delete(e),c));return Ba.set(e,l),l}function rb(t,e=""){const n=!!Dh(),r=e?null:Oc(),i=e?"":_1(),s=e||"blob";if(!n||!e&&(!r||!i)||Ao.has(s))return null;if(!(s in Lr))try{if(e)Lr[s]={revoke:!1,src:e,worker:null};else if(r){const o=new r.Blob([i],{type:"text/javascript"});Lr[s]={revoke:!0,src:r.URL.createObjectURL(o),worker:null}}}catch(o){return null}return{key:s,src:Lr[s].src}}function ab(t,e){const n=Lr[t],r=Dh();if(!n||!r||Ao.has(t))return null;if(!n.worker)try{n.worker=new r(e)}catch(i){return Fh(t,!0),null}return n.worker}function Pc(t=!0,e,n,r,i){const{timeout:s,workerUrl:o}=q1(i),l=function(...u){const f=n(...u);r(f)};let c=l;if(t){const u=rb(e,o),f=u?ab(u.key,u.src):null;if(f&&u){const{key:d}=u;c=function(...h){var m;const S=()=>{Fh(d,!0),c=l,l(...h)};try{const E=`${d}:${e}`,C=(m=Ba.get(E))!=null?m:nb(f,E,e,n,h,s);Nh(f,e,h,s).then(w=>{C===!0?r(w):C.then($=>$?r(w):S())},S)}catch(E){S()}}}}return c}function ib(){const t=Oc();for(const e in Lr){const n=Lr[e];n.worker&&n.worker.terminate(),n.src&&n.revoke&&(t==null||t.URL.revokeObjectURL(n.src)),delete Lr[e]}Ao.clear(),Ba.clear()}const Mc=34,ls=10,Lc=13;function $h(t){const e=t.charCodeAt(0);function n(i,s){const o=[];let l=i.length,c=0,u=0,f=l<=0,d=!1;i.charCodeAt(0)===65279&&c++,i.charCodeAt(l-1)===ls&&--l,i.charCodeAt(l-1)===Lc&&--l;function h(){if(f)return null;if(d)return d=!1,null;const S=c;let E,C;if(i.charCodeAt(S)===Mc){for(;++c<l;)if(i.charCodeAt(c)===Mc){if(i.charCodeAt(c+1)!==Mc)break;c++}return(C=c++)>=l?f=!0:(E=i.charCodeAt(c++))===ls?d=!0:E===Lc&&(d=!0,i.charCodeAt(c)===ls&&++c),i.slice(S+1,C).replace(/""/g,'"')}for(;c<l;){if((E=i.charCodeAt(C=c++))===ls)d=!0;else if(E===Lc)d=!0,i.charCodeAt(c)===ls&&++c;else if(E!==e)continue;return i.slice(S,C)}return f=!0,i.slice(S,l)}let m;for(;(m=h())!==null;){const S=[];for(;m!==null;)S.push(m),m=h();if(s){const E=s(S,u++);E!=null&&o.push(E)}else o.push(S)}return o}function r(i,s){let o=[];return n(i,(l,c)=>{var u;if(c===0)return o=l,null;const f={};for(let d=0;d<o.length;d++)f[o[d]]=(u=l[d])!=null?u:"";return s?s(f,c-1,o):f})}return{parse:r,parseRows:n}}const Bh=$h(","),zh=$h(" "),sb=Bh.parse,ob=Bh.parseRows,lb=zh.parse,cb=zh.parseRows;function Uh(t){const e=[];return t.forEach(function(n,r){const i=n[0];n.forEach(function(s,o){if(o>0){if(typeof e[o-1]=="undefined"&&(e[o-1]={}),typeof s=="undefined")throw new Error(`Source data is missing a component at (${r}, ${o})!`);e[o-1][i]=s}})}),e}function kh(t){const e=t[0],n=[];return t.forEach(function(r,i){if(i>0){const s={};r.forEach(function(o,l){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${i}, ${l})!`);s[e[l]]=o}),n.push(s)}}),n}function Gh(t,e){const n=[];let r,i;if(Array.isArray(t)){const s=function(o,l){if(o[l]!==void 0)return o[l];const u=l.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let f=o;return u.some(function(d){return!(f=f&&typeof f=="object"&&d in f?f[d]:void 0)}),f};e.x?r=e.value.concat(e.x):r=e.value,n.push(r),t.forEach(function(o){const l=r.map(function(c){let u=s(o,c);return typeof u=="undefined"&&(u=null),u});n.push(l)}),i=kh(n)}else Object.keys(t).forEach(function(s){var o;const l=[].concat(t[s]);(o=l.unshift)==null||o.call(l,s),n.push(l)}),i=Uh(n);return i}function ub(t,e="csv",n,r,i){const s=new XMLHttpRequest,o={csv:fb,tsv:db,json:Gh};s.open("GET",t),n&&Object.keys(n).forEach(function(l){s.setRequestHeader(l,n[l])}),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){const l=s.responseText;l&&i.call(this,o[e](e==="json"?JSON.parse(l):l,r))}else throw new Error(`${t}: Something went wrong loading!`)},s.send()}function Xh(t,e){const n=t.rows(e);let r;return n.length===1?(r=[{}],n[0].forEach(i=>{r[0][i]=null})):r=t.parse(e),r}function fb(t){return Xh({rows:ob,parse:sb},t)}function db(t){return Xh({rows:cb,parse:lb},t)}const hb=5e3;function vb(t){var e,n;const r=t[0];if(qe(r)){let i=0;for(let s=0,o=t.length;s<o;s++)i+=(n=(e=t[s])==null?void 0:e.length)!=null?n:0;return i}return t.length*Object.keys(r!=null?r:{}).length}function Wh(t,e){const n=t||(e==null?void 0:e.data_keys);return n!=null&&n.x&&(e.data_x=n.x),n}function gb(t,e,n){const r=this,{config:i}=r;let s;t.forEach(o=>{const l=r.getXKey(o);if(n.customX||n.timeSeries?n.xs.indexOf(l)>=0?s=(n.appendXs&&r.data.xs[o]||[]).concat(e.map((c,u)=>{const f=c[l];return Ge(f)?r.generateTargetX(f,o,u):!1}).filter(c=>c!==!1)):i.data_x?s=this.getOtherTargetXs():vn(i.data_xs)&&(s=r.getXValuesOfXKey(l,r.data.targets)):s=e.map((c,u)=>u),s)r.data.xs[o]=s;else throw new Error(`x is not defined for id = "${o}".`)})}var pb={convertData(t,e){const{config:n}=this,r=o=>!(o!=null&&o.length)||lr(o[0])?!1:n.boost_useWorker==="auto"?vb(o)>=hb:!!n.boost_useWorker,i=n.boost_workerUrl?{workerUrl:n.boost_workerUrl}:void 0;let s=t;if(t.bindto&&(s={},["url","mimeType","headers","keys","json","rows","columns"].forEach(o=>{const l=`data_${o}`;l in t&&(s[o]=t[l])})),s.url&&e)ub(s.url,s.mimeType,s.headers,Wh(s.keys,n),e);else if(s.json)Pc(r(s.json),"json",Gh,e,i)(s.json,Wh(s.keys,n));else if(s.rows)Pc(r(s.rows),"rows",kh,e,i)(s.rows);else if(s.columns)Pc(r(s.columns),"columns",Uh,e,i)(s.columns);else if(t.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(t,e){const n=this,{axis:r,config:i,state:s}=n,o=i.data_type,l=Object.keys(t[0]||{}),{ids:c,xs:u}=l.length?l.reduce((S,E)=>(n.isX.call(n,E)?S.xs.push(E):S.ids.push(E),S),{ids:[],xs:[]}):{ids:[],xs:[]},f={appendXs:e,xs:u,categorized:r==null?void 0:r.isCategorized(),timeSeries:r==null?void 0:r.isTimeSeries(),customX:r==null?void 0:r.isCustomX()};gb.bind(n)(c,t,f);const d=f.customX&&f.categorized&&i.axis_x_categories.length?new Map(i.axis_x_categories.map((S,E)=>[S,E])):null,h=i.data_idConverter.bind(n.api),m=c.map((S,E)=>{const C=h(S),w=n.getXKey(S),$=f.customX&&f.categorized,z=$&&E===0&&(()=>{const H=Yf(i.axis_x_categories);return t.every(_=>H.has(_[w]))})(),B=t.__append__,W=w===null&&B?n.api.data.values(S).length:0;return{id:C,id_org:S,values:t.map((H,_)=>{var q;const st=H[w];let it=H[S],ot;if(it=it!==null&&!isNaN(it)&&!He(it)?+it:qe(it)||He(it)?it:null,($||s.hasRadar)&&E===0&&!mn(st)){!z&&_===0&&!B&&(i.axis_x_categories=[],d&&d.clear());const ct=String(st);ot=(q=d==null?void 0:d.get(ct))!=null?q:-1,ot===-1&&(ot=i.axis_x_categories.length,i.axis_x_categories.push(st),d==null||d.set(ct,ot))}else ot=n.generateTargetX(st,S,W+_);return(mn(it)||n.data.xs[S].length<=_)&&(ot=void 0),{x:ot,value:it,id:C,index:-1}}).filter(H=>sn(H.x))}});if(m.forEach(S=>{var E;i.data_xSort&&(S.values=S.values.sort((C,w)=>{const $=C.x||C.x===0?C.x:1/0,z=w.x||w.x===0?w.x:1/0;return $-z})),S.values.forEach((C,w)=>C.index=w),(E=n.data.xs[S.id])==null||E.sort((C,w)=>C-w)}),s.hasNegativeValue=m.some(S=>S.values.some(E=>E.value!==null&&E.value<0)),s.hasPositiveValue=m.some(S=>S.values.some(E=>E.value!==null&&E.value>0)),o&&n.isValidChartType(o)){const S=n.mapToIds(m).filter(E=>!(E in i.data_types)||!n.isValidChartType(i.data_types[E]));n.setTargetType(S,o)}return m.forEach(S=>n.cache.add(S.id_org,S,!0)),m}};const mb={areaRange:{high:0,mid:1,low:2},candlestick:{open:0,high:1,low:2,close:3,volume:4}};function Vh(t){return qe(t)?t:[t]}var xb={isX(t){const e=this,{config:n}=e,r=n.data_x&&t===n.data_x,i=vn(n.data_xs)&&ky(n.data_xs,t);return r||i},isStackNormalized(){const{config:t}=this;return!!((t.data_stack_normalize===!0||Kn(t.data_stack_normalize))&&t.data_groups.length)},isStackNormalizedPerGroup(){var t;const{config:e}=this;return!!(Kn(e.data_stack_normalize)&&((t=e.data_stack_normalize)!=null&&t.perGroup)&&e.data_groups.length)},isGrouped(t){const e=this.config.data_groups;return t?e.some(n=>n.indexOf(t)>=0&&n.length>1):e.length>0},hasAxisGroupedData(t){const e=this,{axis:n}=e;return e.data.targets.filter(s=>n.getId(s.id)===t).map(s=>s.id).some(s=>e.isGrouped(s))},getXKey(t){const e=this,{config:n}=e;return n.data_x?n.data_x:vn(n.data_xs)?n.data_xs[t]:null},getXValuesOfXKey(t,e){const n=this,r=e&&vn(e)?n.mapToIds(e):[];let i;return r.forEach(s=>{n.getXKey(s)===t&&(i=n.data.xs[s])}),i},getIndexByX(t,e){const n=this;return e?e.indexOf(je(t)?t:+t):(n.filterByX(n.data.targets,t)[0]||{index:null}).index},getXValue(t,e){const n=this;return t in n.data.xs&&n.data.xs[t]&&Ge(n.data.xs[t][e])?n.data.xs[t][e]:e},getOtherTargetXs(){const t=this,e=Object.keys(t.data.xs);return e.length?t.data.xs[e[0]]:null},getOtherTargetX(t){const e=this.getOtherTargetXs();return e&&t<e.length?e[t]:null},addXs(t){const e=this,{config:n}=e;Object.keys(t).forEach(r=>{n.data_xs[r]=t[r]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(vn(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(t){const e=this,{config:n}=e;let r;return t&&(r=n.data_names[t.id],t.name=r!==void 0?r:t.id),t},getAllValuesOnIndex(t,e=!1){const n=this;let r=n.filterTargetsToShow(n.data.targets).map(i=>n.addName(n.getValueOnIndex(i.values,t)));return e&&(r=r.filter(i=>i&&"value"in i&&Ge(i.value))),r},getValueOnIndex(t,e){var n;if(((n=t[e])==null?void 0:n.index)===e)return t[e];const r=t.filter(i=>i.index===e);return r.length?r[0]:null},updateTargetX(t,e){const n=this;t.forEach(r=>{r.values.forEach((i,s)=>{i.x=n.generateTargetX(e[s],r.id,s)}),n.data.xs[r.id]=e})},updateTargetXs(t,e){const n=this;t.forEach(r=>{e[r.id]&&n.updateTargetX([r],e[r.id])})},generateTargetX(t,e,n){const r=this,{axis:i}=r;let s=i!=null&&i.isCategorized()?n:t||n;if(i!=null&&i.isTimeSeries()){const o=Wn.bind(r);s=o(t||r.getXValue(e,n))}else i!=null&&i.isCustomX()&&!(i!=null&&i.isCategorized())&&(s=Ge(t)?+t:r.getXValue(e,n));return s},updateXs(t){t.length&&(this.axis.xs=t.map(e=>e.x))},getPrevX(t){const e=this.axis.xs[t-1];return sn(e)?e:null},getNextX(t){const e=this.axis.xs[t+1];return sn(e)?e:null},getBaseValue(t){const e=this,{hasAxis:n}=e.state;let{value:r}=t;return r&&n&&(e.isAreaRangeType(t)?r=e.getRangedData(t,"mid"):e.isBubbleZType(t)&&(r=e.getBubbleZData(r,"y"))),r},getMinMaxValue(t){const e=this.getBaseValue.bind(this);let n=1/0,r=-1/0;const i=t||this.data.targets.map(s=>s.values);for(let s=0;s<i.length;s++){const o=i[s];for(let l=0;l<o.length;l++){const c=e(o[l]);ae(c)&&(c<n&&(n=c),c>r&&(r=c))}}return{min:n,max:r}},getMinMaxData(){const t=this,e=Oe.dataMinMax;let n=t.cache.get(e);if(!n){const r=t.data.targets.map(u=>u.values),i=t.getMinMaxValue(r),s=[],o=[],{min:l,max:c}=i;r.forEach(u=>{const f=t.getFilteredDataByValue(u,l),d=t.getFilteredDataByValue(u,c);if(f.length)for(let h=0;h<f.length;h++)s.push(f[h]);if(d.length)for(let h=0;h<d.length;h++)o.push(d[h])}),t.cache.add(e,n={min:s,max:o})}return n},getTotalPerIndex(t){const e=this,{config:n}=e,r=t?`${Oe.dataTotalPerIndex}-${t}`:Oe.dataTotalPerIndex,i=e.cache.get(r);let s=(i==null?void 0:i.generation)===e.state.dataGeneration?i.value:null;if((e.config.data_groups.length||e.isStackNormalized())&&!s){s=[];let{targets:o}=e.data;if(e.isStackNormalizedPerGroup()&&t){const l=n.data_groups.find(c=>c.indexOf(t)>=0);if(l)o=o.filter(c=>l.indexOf(c.id)>=0);else return null}o.forEach(l=>{l.values.forEach((c,u)=>{s[u]||(s[u]=0),s[u]+=ae(c.value)?c.value:0})}),e.cache.add(r,{generation:e.state.dataGeneration,value:s})}return s},getVisibleTotalPerIndex(t){const e=this,{api:n,config:r,state:i,cache:s}=e;let o=s.get(Oe.visibleTotalPerIndex);if((!o||o.generation!==i.dataGeneration)&&(o=s.add(Oe.visibleTotalPerIndex,{generation:i.dataGeneration,values:new Map})),o.values.has(t))return o.values.get(t);const l=n.data.values.bind(n),{hiddenTargetIds:c}=i;let u=e.getTotalPerIndex(t);if(u===null)return o.values.set(t,u),u;if(c.size){let f=[...c];if(t){const d=r.data_groups.find(h=>h.indexOf(t)>=0);d&&(f=f.filter(h=>d.indexOf(h)>=0))}if(f.length){let d=l(f,!1);d.length&&(d=d.reduce((h,m)=>h.map((S,E)=>(ae(S)?S:0)+m[E])),u=u.map((h,m)=>h-d[m]))}}return o.values.set(t,u),u},getTotalDataSum(t){const e=this,n=Oe.dataTotalSum;let r=e.cache.get(n);return ae(r)||(r=e.data.targets.reduce((i,s)=>i+s.values.reduce((o,l)=>{var c;return o+((c=l.value)!=null?c:0)},0),0),e.cache.add(n,r)),t&&(r-=e.getHiddenTotalDataSum()),r},getHiddenTotalDataSum(){const t=this,{api:e,state:{hiddenTargetIds:n}}=t;let r=0;return n.size&&(r=e.data.values.bind(e)([...n]).reduce((i,s)=>i+s,0)),r},getFilteredDataByValue(t,e){return t.filter(n=>this.getBaseValue(n)===e)},getMaxDataCount(){const{targets:t}=this.data;let e=0;for(let n=0;n<t.length;n++)t[n].values.length>e&&(e=t[n].values.length);return e},getMaxDataCountTarget(){const t=this,{cache:e,state:n}=t,r=e.get(Oe.maxDataCountTarget);if(r&&r.generation===n.dataGeneration)return r.value;let i=t.filterTargetsToShow()||[];const s=i.length,o=t.config.axis_x_inverted;if(s>1){const l=[];for(let c=0;c<i.length;c++){const u=i[c].values;for(let f=0;f<u.length;f++)l.push(u[f].x)}i=l,i=ti(zl(i)).map((c,u,f)=>({x:c,index:o?f.length-u-1:u}))}else s&&(i=i[0].values.concat());return e.add(Oe.maxDataCountTarget,{value:i,generation:n.dataGeneration}),i},mapToIds(t){return t.map(e=>e.id)},mapToTargetIds(t){const e=this;return t?qe(t)?t.concat():[t]:e.mapToIds(e.data.targets)},hasTarget(t,e){const n=this.mapToIds(t);for(let r=0,i;i=n[r];r++)if(i===e)return!0;return!1},isTargetToShow(t){return!this.state.hiddenTargetIds.has(t)},isLegendToShow(t){return!this.state.hiddenLegendIds.has(t)},getTargetsToShow(){var t;const{state:e}=this;return(t=e._targetsToShow)!=null?t:this.filterTargetsToShow()},filterTargetsToShow(t){const e=this;if(!t){const{cache:n,data:r,state:i}=e,s=Oe.filteredTargets,o=n.get(s);if(o&&o.generation===i.dataGeneration)return o.value;const l=r.targets.filter(c=>e.isTargetToShow(c.id));return n.add(s,{value:l,generation:i.dataGeneration}),l}return t.filter(n=>e.isTargetToShow(n.id))},mapTargetsToUniqueXs(t){const e=this,{axis:n}=e;let r=[];return t!=null&&t.length&&(r=zl(Wy(t.map(i=>i.values.map(s=>+s.x)))),r=n!=null&&n.isTimeSeries()?r.map(i=>new Date(+i)):r.map(Number)),ti(r)},addTargetIds(t,e){const{state:n}=this;Vh(e).forEach(r=>n[t].add(r))},removeTargetIds(t,e){const{state:n}=this;Vh(e).forEach(r=>n[t].delete(r))},addHiddenTargetIds(t){this.addTargetIds("hiddenTargetIds",t),this.cache.remove(Oe.visibleTotalPerIndex)},removeHiddenTargetIds(t){this.removeTargetIds("hiddenTargetIds",t),this.cache.remove(Oe.visibleTotalPerIndex)},addHiddenLegendIds(t){this.addTargetIds("hiddenLegendIds",t)},removeHiddenLegendIds(t){this.removeTargetIds("hiddenLegendIds",t)},getValuesAsIdKeyed(t){const e=this,{hasAxis:n}=e.state,r={},i=e.isMultipleX();let s=null;if(i){const o=e.cache.get(Oe.valuesXIndexMap);if(o&&o.generation===e.state.dataGeneration)s=o.value;else{const l=e.mapTargetsToUniqueXs(e.data.targets).map(c=>je(c)?c:+c);s=new Map(l.map((c,u)=>[c,u])),e.cache.add(Oe.valuesXIndexMap,{value:s,generation:e.state.dataGeneration})}}return t.forEach(o=>{const l=[];o.values.filter(({value:c})=>Ge(c)||c===null).forEach(c=>{let{value:u}=c;if(u!==null&&e.isCandlestickType(c)&&(u=qe(u)?u.slice(0,4):[u.open,u.high,u.low,u.close]),qe(u))l.push(...u);else if(He(u)&&"high"in u)l.push(...Object.values(u));else if(e.isBubbleZType(c))l.push(n&&e.getBubbleZData(u,"y"));else if(i&&s){const f=je(c.x)?c.x:+c.x,d=s.get(f);d!==void 0&&(l[d]=u)}else l.push(u)}),r[o.id]=l}),r},hasMultiTargets(){return this.filterTargetsToShow().length>1},orderTargets(t){const e=this,n=t.slice(),r=e.getSortCompareFn();return r&&n.sort(r),n},getSortCompareFn(t=!1){const e=this,{config:n}=e,r=n.data_order,i=/asc/i.test(r),s=/desc/i.test(r);let o;if(i||s){const l=(u,f)=>u+Math.abs(f.value),c=u=>ae(u)?u:"values"in u?u.values.reduce(l,0):u.value;o=(u,f)=>{const d=c(u),h=c(f);return t?i?d-h:h-d:i?h-d:d-h}}else ie(r)&&(o=r.bind(e.api));return o||null},filterByX(t,e){return this.getValuesByX(t).get(this.getXCacheKey(e))||[]},filterNullish(t){const e=n=>Ge(n.value);return t&&t.filter(n=>"value"in n?e(n):n.values.some(e))},filterRemoveNull(t){return t.filter(e=>Ge(this.getBaseValue(e)))},filterByXDomain(t,e){return t.map(n=>({id:n.id,id_org:n.id_org,values:n.values.filter(r=>e[0]<=r.x&&r.x<=e[1])}))},hasDataLabel(){const t=this.config.data_labels;return Ra(t)&&t||Kn(t)&&vn(t)},hasNullDataValue(t){return t.some(({value:e})=>e===null)},getDataIndexFromEvent(t){const e=this,{$el:n,config:r,state:{hasRadar:i,inputType:s,eventReceiver:{coords:o,rect:l}}}=e;let c;if(i){let u=t.target;/tspan/i.test(u.tagName)&&(u=u.parentNode);const f=Yt(u).datum();c=f&&Object.keys(f).length===1?f.index:void 0}else{const u=r.axis_rotated,f=Oh(n.chart.node()),d=s==="touch"&&t.changedTouches?t.changedTouches[0]:t;let h=u?d.clientY+f.y:d.clientX+f.x;if(Rc(n.svg)){const m=[h,0];u&&m.reverse(),h=So(n.eventRect.node(),...m)[u?"y":"x"]}else h-=u?l.top:l.left;c=Ul(o,h,0,o.length-1,u)}return c},getDataLabelLength(t,e,n){var r,i,s;const o=this,l=1.3,c=[t,e].map(u=>o.dataLabelFormat()(u));if(o.config.render_mode==="canvas"&&!o.$el.svg){const u=(i=(r=o.$el.chart)==null?void 0:r.node)==null?void 0:i.call(r),f=u==null?void 0:u.ownerDocument,d=f==null?void 0:f.createElementNS("http://www.w3.org/2000/svg","svg");if(u&&d){const h=c.map(S=>{const E=f.createElementNS("http://www.w3.org/2000/svg","text");return E.textContent=S,d.appendChild(E),E});d.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",u.appendChild(d);const m=h.map(S=>S.getBoundingClientRect()[n]*l);return d.remove(),m}}return((s=o.getTextRect(c))==null?void 0:s.map(u=>u[n]*l))||[0,0]},isNoneArc(t){return this.hasTarget(this.data.targets,t.id)},isArc(t){return"data"in t&&this.hasTarget(this.data.targets,t.data.id)},findSameXOfValues(t,e){const n=t[e].x,r=[];let i;for(i=e-1;i>=0&&n===t[i].x;i--)r.push(t[i]);for(i=e;i<t.length&&n===t[i].x;i++)r.push(t[i]);return r},getXCacheKey(t){return je(t)?t:+t},getValuesByX(t){const e=this,{cache:n,state:r}=e,i=t.map(l=>{const{values:c}=l,u=c[0],f=c[c.length-1];return`${l.id}:${c.length}:${u?e.getXCacheKey(u.x):""}:${f?e.getXCacheKey(f.x):""}`}).join("|"),s=n.get(Oe.valuesByX);if(s&&s.generation===r.dataGeneration&&s.targetKey===i)return s.value;const o=new Map;for(let l=0;l<t.length;l++){const c=t[l].values;for(let u=0;u<c.length;u++){const f=c[u],d=e.getXCacheKey(f.x),h=o.get(d);h?h.push(f):o.set(d,[f])}}return n.add(Oe.valuesByX,{generation:r.dataGeneration,targetKey:i,value:o}),o},getClosestCandidates(t,e,n=!0){const r=this,{config:i,scale:s}=r,o=t.length,l=t[0];if(!n||o<200||!l||!i.data_xSort)return t;const c=r.isBarType(l.id),u=r.isCandlestickType(l.id),f=i.point_sensitivity;if(!(c||u)&&!ae(f))return t;const d=s.zoom||s.x,h=e[+i.axis_rotated],m=d(t[0].x)<=d(t[o-1].x);let S=0,E=o-1;for(;S<E;){const B=S+E>>1,W=d(t[B].x);(m?W<h:W>h)?S=B+1:E=B}const C=[],w=new Set,$=B=>{B>=0&&B<o&&!w.has(B)&&(w.add(B),C.push(t[B]))},z=B=>{if(B<0||B>=o)return;const W=r.getXCacheKey(t[B].x);let H=B;for(;H>=0&&r.getXCacheKey(t[H].x)===W;)$(H--);for(H=B+1;H<o&&r.getXCacheKey(t[H].x)===W;)$(H++)};if(c||u)for(let B=S-2;B<=S+2;B++)z(B);else{const B=f,W=(H,_)=>{for(let q=H;q>=0&&q<o;q+=_){const st=t[q];if(Math.abs(d(st.x)-h)>B)break;$(q)}};W(S,1),W(S-1,-1)}return C},findClosestFromTargets(t,e){const n=this,r=[];for(let i=0;i<t.length;i++){const s=n.findClosest(t[i].values,e);s&&r.push(s)}return n.findClosest(r,e,!1)},findClosest(t,e,n=!0){const r=this,{$el:{main:i}}=r,s=r.getClosestCandidates(t,e,n);let o,l;for(let c=0;c<s.length;c++){const u=s[c];if(!u||!Ge(u.value))continue;const f=r.isBarType(u.id),d=r.isCandlestickType(u.id);if(f||d){const h=f?`.${rr.chartBar}.${ze.target}${r.getTargetSelectorSuffix(u.id)} .${rr.bar}-${u.index}`:`.${Kr.chartCandlestick}.${ze.target}${r.getTargetSelectorSuffix(u.id)} .${Kr.candlestick}-${u.index} path`;!l&&r.isWithinBar(i.select(h).node())&&(l=u)}else{const h=r.dist(u,e),m=r.getPointSensitivity(u);h<m&&(o===void 0||h<o)&&(o=h,l=u)}}return l},dist(t,e){const n=this,{config:{axis_rotated:r},scale:i}=n,s=+r,o=+!r,l=n.circleY(t,t.index),u=(i.zoom||i.x)(t.x)-e[s],f=l-e[o];return Math.sqrt(u*u+f*f)},convertValuesToStep(t){const e=this,{axis:n,config:r}=e,i=r.line_step_type,s=n?n.isCategorized():!1,o=qe(t)?t.concat():[t];if(!(s||/step\-(after|before)/.test(i)))return t;if(o.length){const l=o[0],c=o[o.length-1],{id:u}=l;let{x:f}=l;o.unshift({x:--f,value:l.value,id:u}),s&&i==="step-after"&&o.unshift({x:f-1,value:l.value,id:u}),f=c.x,o.push({x:++f,value:c.value,id:u}),s&&i==="step-before"&&o.push({x:f+1,value:c.value,id:u})}return o},convertValuesToRange(t){const e=qe(t)?t.concat():[t],n=[];return e.forEach(r=>{const{x:i,id:s}=r;n.push({x:i,id:s,value:r.value[0]}),n.push({x:i,id:s,value:r.value[2]})}),n},updateDataAttributes(t,e){const n=this,{config:r}=n,i=r[`data_${t}`];return mn(e)||(Object.keys(e).forEach(s=>{i[s]=e[s]}),n.redraw({withLegend:!0})),i},getRangedData(t,e="",n="areaRange"){var r,i;const s=t==null?void 0:t.value;if(qe(s)){if(n==="bar")return s.reduce((o,l)=>l-o);{const o=(i=(r=mb[n])==null?void 0:r[e])!=null?i:-1;return o>=0?s[o]:void 0}}else if(s&&e)return s[e];return s},setRatioForGroupedData(t){const e=this,{config:n}=e;if(n.data_groups.length&&t.some(r=>e.isGrouped(r.id))){const r=i=>e.getRatio("index",i,!0);t.forEach(i=>{"values"in i?i.values.forEach(r):r(i)})}},getRatio(t,e,n=!1){const r=this,{config:i,state:s}=r,o=r.api;let l=0;if(e&&o.data.shown().length)if(l=e.ratio||e.value,t==="arc")if(r.pie.padAngle()())l=e.value/r.getTotalDataSum(!0);else{const c=i.gauge_fullCircle?r.getArcLength():r.getStartingAngle()*-2,u=r.hasType("gauge")?c:Math.PI*2;l=(e.endAngle-e.startAngle)/u}else if(t==="index"){const c=r.getVisibleTotalPerIndex(r.isStackNormalizedPerGroup()?e.id:void 0);if(c===null)return l;const u=c[e.index];e.ratio=ae(e.value)&&c&&u?e.value/u:0,l=e.ratio}else if(t==="radar")l=parseFloat(String(Math.max(e.value,0)))/s.current.dataMax*i.radar_size_ratio;else if(t==="bar"){const u=r.getYScaleById.bind(r)(e.id).domain().reduce((f,d)=>d-f);l=u===0?0:Math.abs(r.getRangedData(e,null,t)/u)}else t==="treemap"&&(l/=r.getTotalDataSum(!0));return n&&l?l*100:l},updateDataIndexByX(t){const e=this,n=t.reduce((r,i,s)=>(r[Number(i.x)]=s,r),{});e.data.targets.forEach(r=>{r.values.forEach((i,s)=>{let o=n[Number(i.x)];o===void 0&&(o=s),i.index=o})})},isBubbleZType(t){return this.isBubbleType(t)&&(He(t.value)&&("z"in t.value||"y"in t.value)||qe(t.value)&&t.value.length>=2)},isBarRangeType(t){var e;const n=this,{value:r}=t;return n.isBarType(t)&&!((e=n.isSubchartSourceTypeOf)!=null&&e.call(n,t,qt.CANDLESTICK))&&qe(r)&&r.length>=2&&r.every(ae)},getDataById(t){var e;const n=this.cache.get(t)||this.api.data(t);return(e=n==null?void 0:n[0])!=null?e:n}};function Eo(t,e=!1){const n=this,{api:r}=n;e&&n.api.flush(!0),t==null||t.call(r)}var yb={load(t,e){const n=this,{axis:r,data:i,org:s,scale:o}=n,{append:l}=e,c={domain:null,currentDomain:null,x:null};let u=t;if(u){e.filter&&(u=u.filter(e.filter)),(e.type||e.types)&&u.forEach(d=>{var h;const m=((h=e.types)==null?void 0:h[d.id])||e.type;n.setTargetType(d.id,m)});const f=new Map(u.map(d=>[d.id,d]));i.targets.forEach(d=>{const h=f.get(d.id);if(h){if(l){const m=h.values;for(let S=0;S<m.length;S++)d.values.push(m[S])}else d.values=h.values;f.delete(d.id)}}),f.forEach(d=>i.targets.push(d))}if(n.state.isCanvasMode){n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.updateTypesElements(),Eo.call(n,e.done,e.resizeAfter);return}n.updateTargets(i.targets),o.zoom&&(c.x=r.isCategorized()?o.x.orgScale():(s.xScale||o.x).copy(),c.domain=n.getXDomain(i.targets),c.x.domain(c.domain),c.currentDomain=n.zoom.getDomain(),n.withinRange(c.currentDomain,void 0,c.domain)||(o.x.domain(c.domain),o.zoom=null,n.$el.eventRect.property("__zoom",null))),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(s.xDomain=c.domain,s.xScale=c.x,r.isCategorized()&&(c.currentDomain=n.getZoomDomainValue(c.currentDomain),s.xDomain=n.getZoomDomainValue(s.xDomain),s.xScale=c.x.domain(s.xDomain)),n.updateCurrentZoomTransform(c.x,c.currentDomain)):s.xScale&&s.xScale.domain(s.xDomain),n.updateTypesElements(),Eo.call(n,e.done,e.resizeAfter)},loadFromArgs(t){const e=this;e.config&&(e.cache.reset(!1,[Oe.filteredTargets,Oe.maxDataCountTarget,Oe.valuesXIndexMap,Oe.maxTickSize]),e.convertData(t,n=>{const r=t.data||n;t.append&&(r.__append__=!0),r&&e.load(e.convertDataToTargets.call(e,r),t)}))},unload(t,e){var n;const r=this,{state:i,$el:s,$T:o}=r,l=!!((n=r.hasLegendDefsPoint)!=null&&n.call(r));let c=e,u=t;if(r.cache.reset(!1,[Oe.filteredTargets,Oe.maxDataCountTarget,Oe.valuesXIndexMap,Oe.maxTickSize]),c||(c=()=>{}),u=u.filter(h=>r.hasTarget(r.data.targets,h)),u.length===0){c();return}const f=new Set(u);if(i.isCanvasMode){u.forEach(h=>{i.withoutFadeIn[h]=!1}),r.data.targets=r.data.targets.filter(h=>!f.has(h.id)),r.removeHiddenTargetIds(u),r.removeHiddenLegendIds(u),r.updateTypesElements(),c();return}u.forEach(h=>{var m;const S=r.getTargetSelectorSuffix(h);i.withoutFadeIn[h]=!1,s.legend&&s.legend.selectAll(`.${$e.legendItem}${S}`).remove(),l&&((m=s.defs)==null||m.select(`#${r.getDefsPointId(S)}`).remove())}),r.data.targets=r.data.targets.filter(h=>!f.has(h.id)),i.hasFunnel&&r.updateFunnel(r.data.targets),i.hasTreemap&&r.updateTargetsForTreemap(r.data.targets),r.updateTypesElements();const d=s.svg.selectAll(u.map(h=>r.selectorTarget(h)));o(d).style("opacity","0").remove().call(eo,c)}},Tb={value:()=>{}};function jh(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Co(n)}function Co(t){this._=t}function bb(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Co.prototype=jh.prototype={constructor:Co,on:function(t,e){var n=this._,r=bb(t+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(t=r[s]).type)&&(i=Sb(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=r[s]).type)n[i]=Hh(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Hh(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Co(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,i=s.length;r<i;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};function Sb(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function Hh(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Tb,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Io=jh;const Ab={passive:!1},cs={capture:!0,passive:!1};function Dc(t){t.stopImmediatePropagation()}function ui(t){t.preventDefault(),t.stopImmediatePropagation()}function Fc(t){var e=t.document.documentElement,n=Yt(t).on("dragstart.drag",ui,cs);"onselectstart"in e?n.on("selectstart.drag",ui,cs):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Nc(t,e){var n=t.document.documentElement,r=Yt(t).on("dragstart.drag",null);e&&(r.on("click.drag",ui,cs),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ro=(t=>()=>t);function $c(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:s,x:o,y:l,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}$c.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Eb(t){return!t.ctrlKey&&!t.button}function Cb(){return this.parentNode}function Ib(t,e){return e==null?{x:t.x,y:t.y}:e}function Rb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yh(){var t=Eb,e=Cb,n=Ib,r=Rb,i={},s=Io("start","drag","end"),o=0,l,c,u,f,d=0;function h(B){B.on("mousedown.drag",m).filter(r).on("touchstart.drag",C).on("touchmove.drag",w,Ab).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(B,W){if(!(f||!t.call(this,B,W))){var H=z(this,e.call(this,B,W),B,W,"mouse");H&&(Yt(B.view).on("mousemove.drag",S,cs).on("mouseup.drag",E,cs),Fc(B.view),Dc(B),u=!1,l=B.clientX,c=B.clientY,H("start",B))}}function S(B){if(ui(B),!u){var W=B.clientX-l,H=B.clientY-c;u=W*W+H*H>d}i.mouse("drag",B)}function E(B){Yt(B.view).on("mousemove.drag mouseup.drag",null),Nc(B.view,u),ui(B),i.mouse("end",B)}function C(B,W){if(t.call(this,B,W)){var H=B.changedTouches,_=e.call(this,B,W),q=H.length,st,it;for(st=0;st<q;++st)(it=z(this,_,B,W,H[st].identifier,H[st]))&&(Dc(B),it("start",B,H[st]))}}function w(B){var W=B.changedTouches,H=W.length,_,q;for(_=0;_<H;++_)(q=i[W[_].identifier])&&(ui(B),q("drag",B,W[_]))}function $(B){var W=B.changedTouches,H=W.length,_,q;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),_=0;_<H;++_)(q=i[W[_].identifier])&&(Dc(B),q("end",B,W[_]))}function z(B,W,H,_,q,st){var it=s.copy(),ot=ur(st||H,W),ct,gt,tt;if((tt=n.call(B,new $c("beforestart",{sourceEvent:H,target:h,identifier:q,active:o,x:ot[0],y:ot[1],dx:0,dy:0,dispatch:it}),_))!=null)return ct=tt.x-ot[0]||0,gt=tt.y-ot[1]||0,function ft(lt,bt,St){var Mt=ot,Ot;switch(lt){case"start":i[q]=ft,Ot=o++;break;case"end":delete i[q],--o;case"drag":ot=ur(St||bt,W),Ot=o;break}it.call(lt,B,new $c(lt,{sourceEvent:bt,subject:tt,target:h,identifier:q,active:Ot,x:ot[0]+ct,y:ot[1]+gt,dx:ot[0]-Mt[0],dy:ot[1]-Mt[1],dispatch:it}),_)}}return h.filter=function(B){return arguments.length?(t=typeof B=="function"?B:Ro(!!B),h):t},h.container=function(B){return arguments.length?(e=typeof B=="function"?B:Ro(B),h):e},h.subject=function(B){return arguments.length?(n=typeof B=="function"?B:Ro(B),h):n},h.touchable=function(B){return arguments.length?(r=typeof B=="function"?B:Ro(!!B),h):r},h.on=function(){var B=s.on.apply(s,arguments);return B===s?h:B},h.clickDistance=function(B){return arguments.length?(d=(B=+B)*B,h):Math.sqrt(d)},h}var wb={setExpand(t,e,n){const r=this,{config:i,$el:{circle:s}}=r;s&&i.point_focus_expand_enabled&&r.expandCircles(t,e,n),r.expandBarTypeShapes(!0,t,e,n)},expandBarTypeShapes(t=!0,e,n,r){const i=this;["bar","candlestick"].filter(s=>i.$el[s]).forEach(s=>{r&&i.$el[s].classed(ze.EXPANDED,!1),i.getShapeByIndex(s,e,n).classed(ze.EXPANDED,t)})},setOverOut(t,e){const n=this,{config:r,state:{hasFunnel:i,hasRadar:s,hasTreemap:o},$el:{main:l}}=n,c=He(e);if(c||e!==-1){const u=r[t?"data_onover":"data_onout"].bind(n.api);if(r.color_onover&&n.setOverColor(t,e,c),c){const f=n.getTargetSelectorSuffix(e.id),d=i||o?`${ze.target+f} .${Tn.shape}`:Ze.arc+f;u(e,l.select(`.${d}`).node())}else if(r.tooltip_grouped)t&&(s&&n.isPointFocusOnly()?n.showCircleFocus(n.getAllValuesOnIndex(e,!0)):n.setExpand(e,null,!0)),!n.isMultipleX()&&l.selectAll(`.${Tn.shape}-${e}`).each(function(f){u(f,this)});else{const f=n.cache.get(Oe.setOverOut)||[],d=l.selectAll(`.${Tn.shape}-${e}`).filter(function(m){return n.isWithinShape(this,m)}),h=d.filter(function(){return f.every(m=>m!==this)});if(!t||d.empty()||f.length===h.size()&&h.nodes().every((m,S)=>m!==f[S]))for(;f.length;){const m=f.pop();r.data_onout.bind(n.api)(Yt(m).datum(),m)}h.each(function(){t&&(u(Yt(this).datum(),this),f.push(this))}),n.cache.add(Oe.setOverOut,f)}}},callOverOutForTouch(t){const e=this,n=e.cache.get(Oe.callOverOutForTouch);(He(t)&&n?t.id!==n.id:t!==n)&&((n||ae(n))&&e.setOverOut(!1,n),(t||ae(t))&&e.setOverOut(!0,t),e.cache.add(Oe.callOverOutForTouch,t))},getDraggableSelection(){const t=this,{config:e,state:n}=t;return e.interaction_enabled&&e.data_selection_draggable&&t.drag?Yh().on("drag",function(r){n.event=r,t.drag(Jn(r,this))}).on("start",function(r){n.event=r,t.dragstart(Jn(r,this))}).on("end",r=>{n.event=r,t.dragend()}):()=>{}},dispatchEvent(t,e,n){var r,i,s;const o=this,{config:l,state:{eventReceiver:c,hasAxis:u,hasFunnel:f,hasRadar:d,hasTreemap:h},$el:{eventRect:m,funnel:S,radar:E,svg:C,treemap:w}}=o;let $=(s=(i=(f||h)&&c.rect||d&&E.axes.select(`.${Rn.axis}-${e} text`)||m||((r=o.getArcElementByIdOrIndex)==null?void 0:r.call(o,e)))==null?void 0:i.node)==null?void 0:s.call(i);if($){const z=o.isMultipleX(),B=l.axis_rotated;let{width:W,left:H,top:_}=ln($);if(u&&!d&&!z){const ot=c.coords[e];ot?(W=ot.w,H+=ot.x,_+=ot.y):(W=0,H=0,_=0)}let q=H+(n?n[0]:0)+(z||B?0:W/2),st=_+(n?n[1]:0)+(B?4:0);if(Rc(C)&&o.$el.eventRect){const ot=So(o.$el.eventRect.node(),q,st,!1);q=ot.x,st=ot.y}const it={screenX:q,screenY:st,clientX:q,clientY:st,bubbles:d};(f||h)&&($=(S!=null?S:w).node()),wc[/^(mouse|click)/.test(t)?"mouse":"touch"]($,t,it)}},setDragStatus(t){this.state.dragging=t},unbindZoomEvent(){const t=this,{$el:{canvas:e,eventRect:n,svg:r,zoomResetBtn:i}}=t;n==null||n.on(".zoom wheel.zoom .drag",null),e==null||e.on(".zoom wheel.zoom .drag",null),r==null||r.on("wheel",null),i==null||i.on("click",null).style("display","none")},unbindAllEvents(){var t;const e=this,{$el:{arcs:n,eventRect:r,legend:i,region:s,svg:o,treemap:l},brush:c}=e,u=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,r,s==null?void 0:s.list,c==null?void 0:c.getSelection(),n==null?void 0:n.selectAll("path"),i==null?void 0:i.selectAll("g"),l].forEach(f=>f==null?void 0:f.on(u,null)),(t=e.unbindZoomEvent)==null||t.call(e)}},Ob={categoryName(t){var e;const{axis_x_categories:n}=this.config;return(e=n==null?void 0:n[t])!=null?e:t}};const Pb=/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g;var Mb={generateClass(t,e){const n=this.state.generateClassCache,r=`${t}\0${e}`;let i=n.get(r);return i||(i=` ${t} ${t+this.getTargetSelectorSuffix(e)}`,n.set(r,i)),i},getClass(t,e){const n=/s$/.test(t),r=/^(area|arc|line|funnel|treemap)s?$/.test(t),i=n?"id":"index";return s=>{const o=s.data||s;return((e?this.generateClass(Re[n?"shapes":"shape"],o[i]):"")+this.generateClass(Re[t],o[r?"id":i])).trim()}},getChartClass(t){return e=>Re[`chart${t}`]+this.classTarget((e.data?e.data:e).id)},generateExtraLineClass(){const e=this.config.line_classes||[],n=[];return function(r){var i;const s=r.id||((i=r.data)==null?void 0:i.id)||r;return n.indexOf(s)<0&&n.push(s),e[n.indexOf(s)%e.length]}},classRegion(t,e){return`${this.generateClass(Re.region,e)} ${"class"in t?t.class:""}`},classTarget(t){const e=this.config.data_classes[t];let n="";return e&&(n=` ${Re.target}-${e}`),this.generateClass(Re.target,t)+n},classFocus(t){return this.classFocused(t)+this.classDefocused(t)},classFocused(t){return` ${this.state.focusedTargetIds.has(t.id)?Re.focused:""}`},classDefocused(t){return` ${this.state.defocusedTargetIds.has(t.id)?Re.defocused:""}`},getTargetSelectorSuffix(t){return(t||t===0?`-${t}`:"").replace(Pb,"-")},selectorTarget(t,e="",n=""){const r=this.getTargetSelectorSuffix(t);return`${e}.${Re.target+r} ${n}, ${e}.${Re.circles+r} ${n}`},selectorTargets(t,e){const n=t||[];return n.length?n.map(r=>this.selectorTarget(r,e)):null},selectorLegend(t){return`.${Re.legendItem+this.getTargetSelectorSuffix(t)}`},selectorLegends(t){return t!=null&&t.length?t.map(e=>this.selectorLegend(e)):null}};const Lb=(t,e,n)=>{const r=Yt(t.cloneNode(!0));return r.attr("id",n).insert("rect",":first-child").attr("width",r.attr("width")).attr("height",r.attr("height")).style("fill",e),{id:n,node:r.node()}};function Db(t){const e=Oe.colorPattern,{body:n}=Ye;let r=n[e];if(!r){const s=t.classed(Ac.colorPattern,!0).style("background-image");t.classed(Ac.colorPattern,!1),s.indexOf(";")>-1&&(r=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),n[e]=r)}return r}const Fb=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Nb={generateColor(){const t=this,{$el:e,config:n}=t,r=[],i=n.area_linearGradient||n.bar_linearGradient||n.point_radialGradient;let s=vn(n.color_pattern)?n.color_pattern:[...Db(e.chart)||Fb];const o=s;if(ie(n.color_tiles)){const l=n.color_tiles.bind(t.api)(),c=s.map((u,f)=>{const d=u.replace(/[#\(\)\s,]/g,""),h=`${t.state.datetimeId}-pattern-${d}-${f}`;return Lb(l[f%l.length],u,h)});s=c.map(u=>`url(#${u.id})`),t.patterns=c}return function(l){var c;const u=n.data_colors,f=n.data_color,d=l.id||((c=l.data)==null?void 0:c.id)||l,h=t.isTypeOf(d,["line","spline","step"])||!n.data_types[d];let m;if(ie(u[d]))m=u[d].bind(t.api)(l);else if(u[d])m=u[d];else{let S=r.indexOf(d);S<0&&(r.push(d),S=r.length-1),m=h?o[S%o.length]:s[S%s.length],u[d]=m}if(m=ie(f)?f.call(t.api,m,l):m,i&&e.defs){const S=t.$el.defs.selectAll(`[id$='-gradient${t.getTargetSelectorSuffix(d)}'] stop`);let E;S.each(function(C,w){E=w===0?this.style.stopColor:this.style.stopColor===E}),E===!0&&S.attr("stop-color",m)}return m}},generateLevelColor(){const t=this,{config:e}=t,n=e.color_pattern,r=e.color_threshold,i=r.unit==="value",s=r.max||100,o=r.values&&r.values.length?r.values:[];return vn(r)?function(l){const c=i?l:l*100/s;let u=n[n.length-1];for(let f=0,d=o.length;f<d;f++)if(c<=o[f]){u=n[f];break}return u}:null},generateTextBGColorFilter(t,e={x:0,y:0,width:1,height:1}){const n=this,{$el:{defs:r},state:i}=n;if(t){let s=[];je(t)?s.push(""):He(t)?s=Object.keys(t):ie(t)&&(s=n.mapToTargetIds()),s.forEach(o=>{const l=`${i.datetimeId}-labels-bg${n.getTargetSelectorSuffix(o)}${je(t)?n.getTargetSelectorSuffix(t):""}`,c=Gr(o===""?t:(t==null?void 0:t[o])||"");if(r.select(`#${l}`).empty()){const u=r.append("filter").attr("x",e.x).attr("y",e.y).attr("width",e.width).attr("height",e.height).attr("id",l);u.append("feFlood").attr("flood-color",c),u.append("feComposite").attr("in","SourceGraphic")}})}},getGradienColortUrl(t){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(t)})`},updateLinearGradient(){const t=this,{config:e,data:{targets:n},state:{datetimeId:r},$el:{defs:i}}=t;n.forEach(s=>{const o=`${r}-gradient${t.getTargetSelectorSuffix(s.id)}`,l=t.hasPointType()&&e.point_radialGradient,c=t.isAreaType(s)&&"area"||t.isBarType(s)&&"bar";if((l||c)&&i.select(`#${o}`).empty()){const u=t.color(s),f={defs:null,stops:[]};if(l){const{cx:d=.3,cy:h=.3,r:m=.7,stops:S=[[.1,u,0],[.9,u,1]]}=l;f.stops=S,f.defs=i.append("radialGradient").attr("id",`${o}`).attr("cx",d).attr("cy",h).attr("r",m)}else{const d=e.axis_rotated,{x:h=d?[1,0]:[0,0],y:m=d?[0,0]:[0,1],stops:S=[[0,u,1],[1,u,0]]}=e[`${c}_linearGradient`];f.stops=S,f.defs=i.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",m[0]).attr("y2",m[1])}f.stops.forEach(d=>{const[h,m,S]=d,E=ie(m)?m.bind(t.api)(s.id):m;f.defs&&f.defs.append("stop").attr("offset",h).attr("stop-color",E||u).attr("stop-opacity",S)})}})},setOverColor(t,e){const n=this,{config:r,$el:{main:i}}=n,s=r.color_onover;let o=t?s:n.color;He(o)?o=({id:l})=>l in s?s[l]:n.color(l):je(o)?o=()=>s:ie(s)&&(o=o.bind(n.api)),i.selectAll(He(e)?`.${Ze.arc}${n.getTargetSelectorSuffix(e.id)}`:`.${Tn.shape}-${e}`).style("fill",o)}},fi=0,us=0,fs=0,Kh=1e3,wo,ds,Oo=0,za=0,Po=0,hs=typeof performance=="object"&&performance.now?performance:Date,Zh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Bc(){return za||(Zh($b),za=hs.now()+Po)}function $b(){za=0}function Mo(){this._call=this._time=this._next=null}Mo.prototype=Jh.prototype={constructor:Mo,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Bc():+n)+(e==null?0:+e),!this._next&&ds!==this&&(ds?ds._next=this:wo=this,ds=this),this._call=t,this._time=n,zc()},stop:function(){this._call&&(this._call=null,this._time=1/0,zc())}};function Jh(t,e,n){var r=new Mo;return r.restart(t,e,n),r}function Bb(){Bc(),++fi;for(var t=wo,e;t;)(e=za-t._time)>=0&&t._call.call(void 0,e),t=t._next;--fi}function Qh(){za=(Oo=hs.now())+Po,fi=us=0;try{Bb()}finally{fi=0,Ub(),za=0}}function zb(){var t=hs.now(),e=t-Oo;e>Kh&&(Po-=e,Oo=t)}function Ub(){for(var t,e=wo,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:wo=n);ds=t,zc(r)}function zc(t){if(!fi){us&&(us=clearTimeout(us));var e=t-za;e>24?(t<1/0&&(us=setTimeout(Qh,t-hs.now()-Po)),fs&&(fs=clearInterval(fs))):(fs||(Oo=hs.now(),fs=setInterval(zb,Kh)),fi=1,Zh(Qh))}}function _h(t,e,n){var r=new Mo;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var kb=Io("start","end","cancel","interrupt"),Gb=[],qh=0,tv=1,Uc=2,Lo=3,ev=4,kc=5,Do=6;function Fo(t,e,n,r,i,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;Xb(t,n,{name:e,index:r,group:i,on:kb,tween:Gb,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:qh})}function Gc(t,e){var n=Tr(t,e);if(n.state>qh)throw new Error("too late; already scheduled");return n}function Dr(t,e){var n=Tr(t,e);if(n.state>Lo)throw new Error("too late; already running");return n}function Tr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Xb(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Jh(s,0,n.time);function s(u){n.state=tv,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var f,d,h,m;if(n.state!==tv)return c();for(f in r)if(m=r[f],m.name===n.name){if(m.state===Lo)return _h(o);m.state===ev?(m.state=Do,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete r[f]):+f<e&&(m.state=Do,m.timer.stop(),m.on.call("cancel",t,t.__data__,m.index,m.group),delete r[f])}if(_h(function(){n.state===Lo&&(n.state=ev,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Uc,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Uc){for(n.state=Lo,i=new Array(h=n.tween.length),f=0,d=-1;f<h;++f)(m=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(i[++d]=m);i.length=d+1}}function l(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=kc,1),d=-1,h=i.length;++d<h;)i[d].call(t,f);n.state===kc&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Do,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function di(t,e){var n=t.__transition,r,i,s=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){s=!1;continue}i=r.state>Uc&&r.state<kc,r.state=Do,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}s&&delete t.__transition}}function Wb(t){return this.each(function(){di(this,t)})}var nv=180/Math.PI,Xc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rv(t,e,n,r,i,s){var o,l,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),t*r<e*n&&(t=-t,e=-e,c=-c,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*nv,skewX:Math.atan(c)*nv,scaleX:o,scaleY:l}}var No;function Vb(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Xc:rv(e.a,e.b,e.c,e.d,e.e,e.f)}function jb(t){return t==null||(No||(No=document.createElementNS("http://www.w3.org/2000/svg","g")),No.setAttribute("transform",t),!(t=No.transform.baseVal.consolidate()))?Xc:(t=t.matrix,rv(t.a,t.b,t.c,t.d,t.e,t.f))}function av(t,e,n,r){function i(u){return u.length?u.pop()+" ":""}function s(u,f,d,h,m,S){if(u!==d||f!==h){var E=m.push("translate(",null,e,null,n);S.push({i:E-4,x:gr(u,d)},{i:E-2,x:gr(f,h)})}else(d||h)&&m.push("translate("+d+e+h+n)}function o(u,f,d,h){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),h.push({i:d.push(i(d)+"rotate(",null,r)-2,x:gr(u,f)})):f&&d.push(i(d)+"rotate("+f+r)}function l(u,f,d,h){u!==f?h.push({i:d.push(i(d)+"skewX(",null,r)-2,x:gr(u,f)}):f&&d.push(i(d)+"skewX("+f+r)}function c(u,f,d,h,m,S){if(u!==d||f!==h){var E=m.push(i(m)+"scale(",null,",",null,")");S.push({i:E-4,x:gr(u,d)},{i:E-2,x:gr(f,h)})}else(d!==1||h!==1)&&m.push(i(m)+"scale("+d+","+h+")")}return function(u,f){var d=[],h=[];return u=t(u),f=t(f),s(u.translateX,u.translateY,f.translateX,f.translateY,d,h),o(u.rotate,f.rotate,d,h),l(u.skewX,f.skewX,d,h),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,d,h),u=f=null,function(m){for(var S=-1,E=h.length,C;++S<E;)d[(C=h[S]).i]=C.x(m);return d.join("")}}}var Hb=av(Vb,"px, ","px)","deg)"),Yb=av(jb,", ",")",")");function Kb(t,e){var n,r;return function(){var i=Dr(this,t),s=i.tween;if(s!==n){r=n=s;for(var o=0,l=r.length;o<l;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Zb(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Dr(this,t),o=s.tween;if(o!==r){i=(r=o).slice();for(var l={name:e,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===e){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}function Jb(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Tr(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?Kb:Zb)(n,t,e))}function Wc(t,e,n){var r=t._id;return t.each(function(){var i=Dr(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return Tr(i,r).value[e]}}function iv(t,e){var n;return(typeof e=="number"?gr:e instanceof ba?Gs:(n=ba(e))?(e=n,Gs):_u)(t,e)}function Qb(t){return function(){this.removeAttribute(t)}}function _b(t){return function(){this.removeAttributeNS(t.space,t.local)}}function qb(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===r?s:s=e(r=o,n)}}function tS(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?s:s=e(r=o,n)}}function eS(t,e,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(t):(o=this.getAttribute(t),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=e(r=o,l)))}}function nS(t,e,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=e(r=o,l)))}}function rS(t,e){var n=Nt(t),r=n==="transform"?Yb:iv;return this.attrTween(t,typeof e=="function"?(n.local?nS:eS)(n,r,Wc(this,"attr."+t,e)):e==null?(n.local?_b:Qb)(n):(n.local?tS:qb)(n,r,e))}function aS(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function iS(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function sS(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&iS(t,s)),n}return i._value=e,i}function oS(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&aS(t,s)),n}return i._value=e,i}function lS(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Nt(t);return this.tween(n,(r.local?sS:oS)(r,e))}function cS(t,e){return function(){Gc(this,t).delay=+e.apply(this,arguments)}}function uS(t,e){return e=+e,function(){Gc(this,t).delay=e}}function fS(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?cS:uS)(e,t)):Tr(this.node(),e).delay}function dS(t,e){return function(){Dr(this,t).duration=+e.apply(this,arguments)}}function hS(t,e){return e=+e,function(){Dr(this,t).duration=e}}function vS(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?dS:hS)(e,t)):Tr(this.node(),e).duration}function gS(t,e){if(typeof e!="function")throw new Error;return function(){Dr(this,t).ease=e}}function pS(t){var e=this._id;return arguments.length?this.each(gS(e,t)):Tr(this.node(),e).ease}function mS(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Dr(this,t).ease=n}}function xS(t){if(typeof t!="function")throw new Error;return this.each(mS(this._id,t))}function yS(t){typeof t!="function"&&(t=M(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,l=r[i]=[],c,u=0;u<o;++u)(c=s[u])&&t.call(c,c.__data__,u,s)&&l.push(c);return new Qr(r,this._parents,this._name,this._id)}function TS(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,s=Math.min(r,i),o=new Array(r),l=0;l<s;++l)for(var c=e[l],u=n[l],f=c.length,d=o[l]=new Array(f),h,m=0;m<f;++m)(h=c[m]||u[m])&&(d[m]=h);for(;l<r;++l)o[l]=e[l];return new Qr(o,this._parents,this._name,this._id)}function bS(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function SS(t,e,n){var r,i,s=bS(e)?Gc:Dr;return function(){var o=s(this,t),l=o.on;l!==r&&(i=(r=l).copy()).on(e,n),o.on=i}}function AS(t,e){var n=this._id;return arguments.length<2?Tr(this.node(),n).on.on(t):this.each(SS(n,t,e))}function ES(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function CS(){return this.on("end.remove",ES(this._id))}function IS(t){var e=this._name,n=this._id;typeof t!="function"&&(t=x(t));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var l=r[o],c=l.length,u=s[o]=new Array(c),f,d,h=0;h<c;++h)(f=l[h])&&(d=t.call(f,f.__data__,h,l))&&("__data__"in f&&(d.__data__=f.__data__),u[h]=d,Fo(u[h],e,n,h,u,Tr(f,n)));return new Qr(s,this._parents,e,n)}function RS(t){var e=this._name,n=this._id;typeof t!="function"&&(t=I(t));for(var r=this._groups,i=r.length,s=[],o=[],l=0;l<i;++l)for(var c=r[l],u=c.length,f,d=0;d<u;++d)if(f=c[d]){for(var h=t.call(f,f.__data__,d,c),m,S=Tr(f,n),E=0,C=h.length;E<C;++E)(m=h[E])&&Fo(m,e,n,E,h,S);s.push(h),o.push(f)}return new Qr(s,o,e,n)}var wS=bn.prototype.constructor;function OS(){return new wS(this._groups,this._parents)}function PS(t,e){var n,r,i;return function(){var s=zt(this,t),o=(this.style.removeProperty(t),zt(this,t));return s===o?null:s===n&&o===r?i:i=e(n=s,r=o)}}function sv(t){return function(){this.style.removeProperty(t)}}function MS(t,e,n){var r,i=n+"",s;return function(){var o=zt(this,t);return o===i?null:o===r?s:s=e(r=o,n)}}function LS(t,e,n){var r,i,s;return function(){var o=zt(this,t),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(t),zt(this,t))),o===c?null:o===r&&c===i?s:(i=c,s=e(r=o,l))}}function DS(t,e){var n,r,i,s="style."+e,o="end."+s,l;return function(){var c=Dr(this,t),u=c.on,f=c.value[s]==null?l||(l=sv(e)):void 0;(u!==n||i!==f)&&(r=(n=u).copy()).on(o,i=f),c.on=r}}function FS(t,e,n){var r=(t+="")=="transform"?Hb:iv;return e==null?this.styleTween(t,PS(t,r)).on("end.style."+t,sv(t)):typeof e=="function"?this.styleTween(t,LS(t,r,Wc(this,"style."+t,e))).each(DS(this._id,t)):this.styleTween(t,MS(t,r,e),n).on("end.style."+t,null)}function NS(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function $S(t,e,n){var r,i;function s(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&NS(t,o,n)),r}return s._value=e,s}function BS(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,$S(t,e,n==null?"":n))}function zS(t){return function(){this.textContent=t}}function US(t){return function(){var e=t(this);this.textContent=e==null?"":e}}function kS(t){return this.tween("text",typeof t=="function"?US(Wc(this,"text",t)):zS(t==null?"":t+""))}function GS(t){return function(e){this.textContent=t.call(this,e)}}function XS(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&GS(i)),e}return r._value=t,r}function WS(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,XS(t))}function VS(){for(var t=this._name,e=this._id,n=lv(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var f=Tr(c,e);Fo(c,t,n,u,o,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Qr(r,this._parents,t,n)}function jS(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var l={value:o},c={value:function(){--i===0&&s()}};n.each(function(){var u=Dr(this,r),f=u.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(c)),u.on=e}),i===0&&s()})}var HS=0;function Qr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function ov(t){return bn().transition(t)}function lv(){return++HS}var _r=bn.prototype;Qr.prototype=ov.prototype={constructor:Qr,select:IS,selectAll:RS,selectChild:_r.selectChild,selectChildren:_r.selectChildren,filter:yS,merge:TS,selection:OS,transition:VS,call:_r.call,nodes:_r.nodes,node:_r.node,size:_r.size,empty:_r.empty,each:_r.each,on:AS,attr:rS,attrTween:lS,style:FS,styleTween:BS,text:kS,textTween:WS,remove:CS,tween:Jb,delay:fS,duration:vS,ease:pS,easeVarying:xS,end:jS,[Symbol.iterator]:_r[Symbol.iterator]};function Rw(t){return t*t*t}function ww(t){return--t*t*t+1}function YS(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var KS={time:null,delay:0,duration:250,ease:YS};function ZS(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function JS(t){var e,n;t instanceof Qr?(e=t._id,t=t._name):(e=lv(),(n=KS).time=Bc(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,u=0;u<l;++u)(c=o[u])&&Fo(c,t,e,u,o,n||ZS(c,e));return new Qr(r,this._parents,t,e)}bn.prototype.interrupt=Wb,bn.prototype.transition=JS;var Vc=(t=>()=>t);function QS(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function _S(t){t.stopImmediatePropagation()}function jc(t){t.preventDefault(),t.stopImmediatePropagation()}var cv={name:"drag"},Hc={name:"space"},hi={name:"handle"},vi={name:"center"};const{abs:uv,max:Bn,min:zn}=Math;function fv(t){return[+t[0],+t[1]]}function Yc(t){return[fv(t[0]),fv(t[1])]}var $o={name:"x",handles:["w","e"].map(vs),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Bo={name:"y",handles:["n","s"].map(vs),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},qS={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(vs),input:function(t){return t==null?null:Yc(t)},output:function(t){return t}},qr={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},dv={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},hv={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},tA={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},eA={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function vs(t){return{type:t}}function nA(t){return!t.ctrlKey&&!t.button}function rA(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function aA(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kc(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function iA(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function vv(t){var e=t.__brush;return e?e.dim.output(e.selection):null}function sA(){return Zc($o)}function oA(){return Zc(Bo)}function Ow(){return Zc(qS)}function Zc(t){var e=rA,n=nA,r=aA,i=!0,s=Io("start","brush","end"),o=6,l;function c(C){var w=C.property("__brush",E).selectAll(".overlay").data([vs("overlay")]);w.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",qr.overlay).merge(w).each(function(){var z=Kc(this).extent;Yt(this).attr("x",z[0][0]).attr("y",z[0][1]).attr("width",z[1][0]-z[0][0]).attr("height",z[1][1]-z[0][1])}),C.selectAll(".selection").data([vs("selection")]).enter().append("rect").attr("class","selection").attr("cursor",qr.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var $=C.selectAll(".handle").data(t.handles,function(z){return z.type});$.exit().remove(),$.enter().append("rect").attr("class",function(z){return"handle handle--"+z.type}).attr("cursor",function(z){return qr[z.type]}),C.each(u).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",m).on("touchend.brush touchcancel.brush",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(C,w,$){C.tween?C.on("start.brush",function(z){f(this,arguments).beforestart().start(z)}).on("interrupt.brush end.brush",function(z){f(this,arguments).end(z)}).tween("brush",function(){var z=this,B=z.__brush,W=f(z,arguments),H=B.selection,_=t.input(typeof w=="function"?w.apply(this,arguments):w,B.extent),q=Ya(H,_);function st(it){B.selection=it===1&&_===null?null:q(it),u.call(z),W.brush()}return H!==null&&_!==null?st:st(1)}):C.each(function(){var z=this,B=arguments,W=z.__brush,H=t.input(typeof w=="function"?w.apply(z,B):w,W.extent),_=f(z,B).beforestart();di(z),W.selection=H===null?null:H,u.call(z),_.start($).brush($).end($)})},c.clear=function(C,w){c.move(C,null,w)};function u(){var C=Yt(this),w=Kc(this).selection;w?(C.selectAll(".selection").style("display",null).attr("x",w[0][0]).attr("y",w[0][1]).attr("width",w[1][0]-w[0][0]).attr("height",w[1][1]-w[0][1]),C.selectAll(".handle").style("display",null).attr("x",function($){return $.type[$.type.length-1]==="e"?w[1][0]-o/2:w[0][0]-o/2}).attr("y",function($){return $.type[0]==="s"?w[1][1]-o/2:w[0][1]-o/2}).attr("width",function($){return $.type==="n"||$.type==="s"?w[1][0]-w[0][0]+o:o}).attr("height",function($){return $.type==="e"||$.type==="w"?w[1][1]-w[0][1]+o:o})):C.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function f(C,w,$){var z=C.__brush.emitter;return z&&(!$||!z.clean)?z:new d(C,w,$)}function d(C,w,$){this.that=C,this.args=w,this.state=C.__brush,this.active=0,this.clean=$}d.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(C,w){return this.starting?(this.starting=!1,this.emit("start",C,w)):this.emit("brush",C),this},brush:function(C,w){return this.emit("brush",C,w),this},end:function(C,w){return--this.active===0&&(delete this.state.emitter,this.emit("end",C,w)),this},emit:function(C,w,$){var z=Yt(this.that).datum();s.call(C,this.that,new QS(C,{sourceEvent:w,target:c,selection:t.output(this.state.selection),mode:$,dispatch:s}),z)}};function h(C){if(l&&!C.touches||!n.apply(this,arguments))return;var w=this,$=C.target.__data__.type,z=(i&&C.metaKey?$="overlay":$)==="selection"?cv:i&&C.altKey?vi:hi,B=t===Bo?null:tA[$],W=t===$o?null:eA[$],H=Kc(w),_=H.extent,q=H.selection,st=_[0][0],it,ot,ct=_[0][1],gt,tt,ft=_[1][0],lt,bt,St=_[1][1],Mt,Ot,Kt=0,ee=0,Ae,Ee=B&&W&&i&&C.shiftKey,Te,De,me=Array.from(C.touches||[C],be=>{const un=be.identifier;return be=ur(be,w),be.point0=be.slice(),be.identifier=un,be});di(w);var Pe=f(w,arguments,!0).beforestart();if($==="overlay"){q&&(Ae=!0);const be=[me[0],me[1]||me[0]];H.selection=q=[[it=t===Bo?st:zn(be[0][0],be[1][0]),gt=t===$o?ct:zn(be[0][1],be[1][1])],[lt=t===Bo?ft:Bn(be[0][0],be[1][0]),Mt=t===$o?St:Bn(be[0][1],be[1][1])]],me.length>1&&We(C)}else it=q[0][0],gt=q[0][1],lt=q[1][0],Mt=q[1][1];ot=it,tt=gt,bt=lt,Ot=Mt;var Zt=Yt(w).attr("pointer-events","none"),he=Zt.selectAll(".overlay").attr("cursor",qr[$]);if(C.touches)Pe.moved=Wt,Pe.ended=Xe;else{var ge=Yt(C.view).on("mousemove.brush",Wt,!0).on("mouseup.brush",Xe,!0);i&&ge.on("keydown.brush",pn,!0).on("keyup.brush",Cn,!0),Fc(C.view)}u.call(w),Pe.start(C,z.name);function Wt(be){for(const un of be.changedTouches||[be])for(const an of me)an.identifier===un.identifier&&(an.cur=ur(un,w));if(Ee&&!Te&&!De&&me.length===1){const un=me[0];uv(un.cur[0]-un[0])>uv(un.cur[1]-un[1])?De=!0:Te=!0}for(const un of me)un.cur&&(un[0]=un.cur[0],un[1]=un.cur[1]);Ae=!0,jc(be),We(be)}function We(be){const un=me[0],an=un.point0;var Nr;switch(Kt=un[0]-an[0],ee=un[1]-an[1],z){case Hc:case cv:{B&&(Kt=Bn(st-it,zn(ft-lt,Kt)),ot=it+Kt,bt=lt+Kt),W&&(ee=Bn(ct-gt,zn(St-Mt,ee)),tt=gt+ee,Ot=Mt+ee);break}case hi:{me[1]?(B&&(ot=Bn(st,zn(ft,me[0][0])),bt=Bn(st,zn(ft,me[1][0])),B=1),W&&(tt=Bn(ct,zn(St,me[0][1])),Ot=Bn(ct,zn(St,me[1][1])),W=1)):(B<0?(Kt=Bn(st-it,zn(ft-it,Kt)),ot=it+Kt,bt=lt):B>0&&(Kt=Bn(st-lt,zn(ft-lt,Kt)),ot=it,bt=lt+Kt),W<0?(ee=Bn(ct-gt,zn(St-gt,ee)),tt=gt+ee,Ot=Mt):W>0&&(ee=Bn(ct-Mt,zn(St-Mt,ee)),tt=gt,Ot=Mt+ee));break}case vi:{B&&(ot=Bn(st,zn(ft,it-Kt*B)),bt=Bn(st,zn(ft,lt+Kt*B))),W&&(tt=Bn(ct,zn(St,gt-ee*W)),Ot=Bn(ct,zn(St,Mt+ee*W)));break}}bt<ot&&(B*=-1,Nr=it,it=lt,lt=Nr,Nr=ot,ot=bt,bt=Nr,$ in dv&&he.attr("cursor",qr[$=dv[$]])),Ot<tt&&(W*=-1,Nr=gt,gt=Mt,Mt=Nr,Nr=tt,tt=Ot,Ot=Nr,$ in hv&&he.attr("cursor",qr[$=hv[$]])),H.selection&&(q=H.selection),Te&&(ot=q[0][0],bt=q[1][0]),De&&(tt=q[0][1],Ot=q[1][1]),(q[0][0]!==ot||q[0][1]!==tt||q[1][0]!==bt||q[1][1]!==Ot)&&(H.selection=[[ot,tt],[bt,Ot]],u.call(w),Pe.brush(be,z.name))}function Xe(be){if(_S(be),be.touches){if(be.touches.length)return;l&&clearTimeout(l),l=setTimeout(function(){l=null},500)}else Nc(be.view,Ae),ge.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Zt.attr("pointer-events","all"),he.attr("cursor",qr.overlay),H.selection&&(q=H.selection),iA(q)&&(H.selection=null,u.call(w)),Pe.end(be,z.name)}function pn(be){switch(be.keyCode){case 16:{Ee=B&&W;break}case 18:{z===hi&&(B&&(lt=bt-Kt*B,it=ot+Kt*B),W&&(Mt=Ot-ee*W,gt=tt+ee*W),z=vi,We(be));break}case 32:{(z===hi||z===vi)&&(B<0?lt=bt-Kt:B>0&&(it=ot-Kt),W<0?Mt=Ot-ee:W>0&&(gt=tt-ee),z=Hc,he.attr("cursor",qr.selection),We(be));break}default:return}jc(be)}function Cn(be){switch(be.keyCode){case 16:{Ee&&(Te=De=Ee=!1,We(be));break}case 18:{z===vi&&(B<0?lt=bt:B>0&&(it=ot),W<0?Mt=Ot:W>0&&(gt=tt),z=hi,We(be));break}case 32:{z===Hc&&(be.altKey?(B&&(lt=bt-Kt*B,it=ot+Kt*B),W&&(Mt=Ot-ee*W,gt=tt+ee*W),z=vi):(B<0?lt=bt:B>0&&(it=ot),W<0?Mt=Ot:W>0&&(gt=tt),z=hi),he.attr("cursor",qr[$]),We(be));break}default:return}jc(be)}}function m(C){f(this,arguments).moved(C)}function S(C){f(this,arguments).ended(C)}function E(){var C=this.__brush||{selection:null};return C.extent=Yc(e.apply(this,arguments)),C.dim=t,C}return c.extent=function(C){return arguments.length?(e=typeof C=="function"?C:Vc(Yc(C)),c):e},c.filter=function(C){return arguments.length?(n=typeof C=="function"?C:Vc(!!C),c):n},c.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:Vc(!!C),c):r},c.handleSize=function(C){return arguments.length?(o=+C,c):o},c.keyModifiers=function(C){return arguments.length?(i=!!C,c):i},c.on=function(){var C=s.on.apply(s,arguments);return C===s?c:C},c}function gv(t){const{event:e,$el:n}=t,r=n.subchart.main||n.main;let i;return e&&e.type==="brush"?i=e.selection:r&&(i=r.select(".bb-brush").node())&&(i=vv(i)),i}function pv(t){const e=gv(t);return e?e[0]===e[1]:!0}function mv(t,e){return e.map(n=>{var r,i,s,o,l,c,u,f,d;const{values:h}=n,m=h[0],S=h[h.length-1],E=m?(i=(r=t.getXCacheKey)==null?void 0:r.call(t,m.x))!=null?i:m.x:"",C=S?(o=(s=t.getXCacheKey)==null?void 0:s.call(t,S.x))!=null?o:S.x:"",w=(c=(l=t.getTargetType)==null?void 0:l.call(t,n))!=null?c:"",$=(d=(f=(u=t.state)==null?void 0:u.subchartSourceTypes)==null?void 0:f[n.id])!=null?d:"";return`${n.id}:${w}:${$}:${h.length}:${E}:${C}`}).join("|")}function xv(t,e){var n;const r=(n=t.data)==null?void 0:n.targets;if(!r)return!1;for(let i=0;i<e.length;i++){const s=e[i],o=r.find(l=>l.id===s.id);if(!o||o.values!==s.values)return!1}return!0}function Jc(t,e){vn(e)&&((t.min===void 0||e<t.min)&&(t.min=e),(t.max===void 0||e>t.max)&&(t.max=e))}function yv(t,e){for(let n=0;n<e.length;n++)Jc(t,e[n])}function lA(t,e){var n,r,i,s;const o={min:void 0,max:void 0},l=t.state.hasAxis;for(let c=0;c<e.length;c++){const u=e[c],f=(n=t.isCandlestickType)==null?void 0:n.call(t,u),d=!f&&!!((r=t.isSubchartSourceTypeOf)!=null&&r.call(t,u,qt.CANDLESTICK)),{values:h}=u;for(let m=0;m<h.length;m++){const S=h[m];let E=S.value;if(!(Ge(E)||E===null))continue;const C=d?(i=t.getSubchartCandlestickShapeValue)==null?void 0:i.call(t,S,!0):void 0;ae(C)?E=C:E!==null&&(f||d)&&(E=Array.isArray(E)?E.slice(0,4):[E.open,E.high,E.low,E.close]),Array.isArray(E)?yv(o,E):He(E)&&"high"in E?yv(o,Object.values(E)):(s=t.isBubbleZType)!=null&&s.call(t,S)?Jc(o,l&&t.getBubbleZData(E,"y")):Jc(o,E)}}return[o.min,o.max]}function cA(t,e){let n;for(let r=0;r<t.length;r++){const{values:i}=t[r];for(let s=0;s<i.length;s++){const{x:o}=i[s];vn(o)&&(n===void 0||(e==="min"?o<n:o>n))&&(n=o)}}return n}var uA={getYDomainMinMaxBoth(t){const e=this,{axis:n,cache:r,config:i,state:s}=e,l=xv(e,t)?`${Oe.domainMinMax}_y_${mv(e,t)}`:null,c=l&&r.get(l);if(c&&c.generation===s.dataGeneration)return c.value;const u=i.data_groups,f=e.mapToIds(t),d=Yf(f);let h;if(u.length>0){const m=e.getValuesAsIdKeyed(t),S=t.some(W=>W.values.some(H=>H.value<0)),E=t.some(W=>W.values.some(H=>H.value>0)),C=new Map(f.map(W=>[W,n.getId(W)])),w={},$={};for(const W in m)w[W]=m[W].slice(),$[W]=m[W].slice();u.forEach(W=>{const H=W.filter(_=>d.has(_));if(H.length){const _=H[0],q=C.get(_);w[_]&&S&&(w[_]=w[_].map(st=>st<0?st:0)),$[_]&&E&&($[_]=$[_].map(st=>st>0?st:0)),H.filter((st,it)=>it>0).forEach(st=>{if(w[st]){const it=C.get(st);w[st].forEach((ot,ct)=>{const gt=+ot;it===q&&!(S&&gt>0)&&(w[_][ct]+=gt)})}if($[st]){const it=C.get(st);$[st].forEach((ot,ct)=>{const gt=+ot;it===q&&!(E&&gt<0)&&($[_][ct]+=gt)})}})}});const z=[],B=[];for(const W in w)z.push(pr("min",w[W])),B.push(pr("max",$[W]));h=[pr("min",z),pr("max",B)]}else h=lA(e,t);return l&&r.add(l,{generation:s.dataGeneration,value:h}),h},isHiddenTargetWithYDomain(t){const e=this;for(const n of e.state.hiddenTargetIds)if(e.axis.getId(n)===t)return!0;return!1},getYDomain(t,e,n){const r=this,{axis:i,config:s,scale:o}=r,l=`axis_${e}`;if(r.isStackNormalized()&&t.filter(tt=>i.getId(tt.id)===e).map(tt=>tt.id).some(tt=>r.isGrouped(tt)))return[0,100];const c=(o==null?void 0:o[e])&&o[e].type==="log",u=t.filter(ct=>i.getId(ct.id)===e),f=n?r.filterByXDomain(u,n):u;if(f.length===0)return r.isHiddenTargetWithYDomain(e)?o[e].domain():e==="y2"?o.y.domain():r.getYDomain(t,"y2",n);const d=s[`${l}_min`],h=s[`${l}_max`],m=s[`${l}_center`],S=s[`${l}_inverted`],E=r.hasDataLabel()&&s.axis_rotated,C=r.hasDataLabel()&&!s.axis_rotated,[w,$]=r.getYDomainMinMaxBoth(f);let z=w,B=$,W=[qt.BAR,qt.BUBBLE,qt.SCATTER,...en.Line].some(ct=>{const gt=ct.indexOf("area")>-1?"area":ct;return r.hasType(ct,f,!0)&&s[`${gt}_zerobased`]});z=Ge(d)?d:Ge(h)?z<=h?z:h-10:z,B=Ge(h)?h:Ge(d)?d<=B?B:d+10:B,isNaN(z)&&(z=0),isNaN(B)&&(B=z),z===B&&(z<0?B=0:z=0);const H=z>=0&&B>=0,_=z<=0&&B<=0;(Ge(d)&&H||Ge(h)&&_)&&(W=!1),W&&(H&&(z=0),_&&(B=0));const q=Math.abs(B-z);let st={top:q*.1,bottom:q*.1};if(sn(m)){const ct=Math.max(Math.abs(z),Math.abs(B));B=m+ct,z=m-ct}if(E){const ct=wa(o.y.range()),gt=r.getDataLabelLength(z,B,"width").map(tt=>{const ft=tt/ct;return isFinite(ft)?ft:0});["bottom","top"].forEach((tt,ft)=>{st[tt]+=q*(gt[ft]/(1-gt[0]-gt[1]))})}else if(C){const ct=r.getDataLabelLength(z,B,"height");["bottom","top"].forEach((gt,tt)=>{st[gt]+=r.convertPixelToScale("y",ct[tt],q)})}st=r.getResettedPadding(st);const it=s[`${l}_padding`];vn(it)&&["bottom","top"].forEach(ct=>{st[ct]=i.getPadding(it,ct,st[ct],q)}),W&&(H&&(st.bottom=z),_&&(st.top=-B));const ot=c?[z,B].map(ct=>ct<0?0:ct):[z-st.bottom,B+st.top];return S?ot.reverse():ot},getXDomainMinMax(t,e){var n;const r=this,{cache:i,state:s}=r,o=r.config[`axis_x_${e}`],c=xv(r,t)?`${Oe.domainMinMax}_x_${e}_${mv(r,t)}`:null,u=c&&i.get(c);let f=(u==null?void 0:u.generation)===s.dataGeneration?u.value:void 0;f===void 0&&(f=cA(t,e),c&&i.add(c,{generation:s.dataGeneration,value:f}));let d=He(o)?o.value:o;return d=sn(d)&&((n=r.axis)!=null&&n.isTimeSeries())?Wn.bind(this)(d):d,He(o)&&o.fit&&(e==="min"&&d<f||e==="max"&&d>f)&&(d=void 0),sn(d)?d:f},getXDomainPadding(t,e){const n=this,{axis:r,config:i}=n,s=i.axis_x_padding,o=r.isTimeSeries()&&e,l=wa(t);let c;if(r.isCategorized()||o)c=0;else if(n.hasType("bar")){const d=n.getMaxDataCount();c=d>1?l/(d-1)/2:.5}else c=n.getResettedPadding(l*.01);let{left:u=c,right:f=c}=ae(s)?{left:s,right:s}:s;if(s.unit==="px"){const d=Math.abs(l+l*.2);u=r.getPadding(s,"left",c,d),f=r.getPadding(s,"right",c,d)}else{const d=l+u+f;if(o&&d){const h=l/e/d;u=u/d/h,f=f/d/h}}return{left:u,right:f}},getXDomain(t){const e=this,{axis:n,config:r,scale:{x:i}}=e,s=r.axis_x_inverted,o=[e.getXDomainMinMax(t,"min"),e.getXDomainMinMax(t,"max")];let[l=0,c=0]=o;if(i.type!=="log"){const u=n.isCategorized(),f=n.isTimeSeries(),d=e.getXDomainPadding(o);let[h,m]=o;h-m===0&&!u&&(f?(h=new Date(h.getTime()*.5),m=new Date(m.getTime()*1.5)):(h=h===0?1:h*.5,m=m===0?-1:m*1.5)),(h||h===0)&&(l=f?new Date(h.getTime()-d.left):h-d.left),(m||m===0)&&(c=f?new Date(m.getTime()+d.right):m+d.right)}return s?[c,l]:[l,c]},updateXDomain(t,e,n,r,i){var s;const o=this,{config:l,org:c,scale:{x:u,subX:f}}=o,d=l.zoom_enabled;if(n&&(u.domain(i||ti(o.getXDomain(t),!l.axis_x_inverted)),c.xDomain=u.domain(),f.domain(u.domain()),(s=o.brush)==null||s.scale(f)),e){const h=i||!o.brush||pv(o)?c.xDomain:gv(o).map(f.invert);u.domain(h)}return(n||e)&&d&&o.zoom.updateScaleExtent(),r&&u.domain(o.trimXDomain(u.orgDomain())),u.domain()},trimXDomain(t){const e=this,n=e.config.axis_x_inverted,r=e.getZoomDomain(),[i,s]=r;return(n?t[0]>=i:t[0]<=i)&&(t[1]=+t[1]+(i-t[0]),t[0]=i),(n?t[1]<=s:t[1]>=s)&&(t[0]=+t[0]-(t[1]-s),t[1]=s),t},getZoomDomain(t="zoom",e=!1){const n=this,{config:r,scale:i,org:s}=n;let[o,l]=e&&i[t]?i[t].domain():s.xDomain;return t==="zoom"&&(sn(r.zoom_x_min)&&(o=pr("min",[o,r.zoom_x_min])),sn(r.zoom_x_max)&&(l=pr("max",[l,r.zoom_x_max]))),[o,l]},getZoomDomainValue(t){const e=this,{config:n,axis:r}=e;if(r.isCategorized()&&Array.isArray(t)){const i=n.axis_x_inverted;return t.map((o,l)=>Number(o)+(l===0?+i:+!i))}return t},convertPixelToScale(t,e,n){const r=this,{config:i,state:s}=r,o=i.axis_rotated;let l;return t==="x"?l=o?"height":"width":l=o?"width":"height",n*(e/s[l])},withinRange(t,e=[0,0],n){const i=this.config.axis_x_inverted,[s,o]=n;if(Array.isArray(t)){const l=i?t[1]:t[0],c=i?t[0]:t[1];if(l<c)return t.every((u,f)=>(f===0?i?+u<=s:+u>=s:i?+u>=o:+u<=o)&&!t.every((d,h)=>d===e[h]))}return!1}};function Tv(t,e,n){const{config:r}=t,i=`axis_${e}_tick_format`;return(r[i]?r[i]:t.defaultValueFormat).call(t.api,n)}var fA={yFormat(t){return Tv(this,"y",t)},y2Format(t){return Tv(this,"y2",t)},getDefaultValueFormat(){const t=this,{defaultArcValueFormat:e,yFormat:n,y2Format:r}=t,i=t.hasArcType(null,["gauge","polar","radar"]);return function(s,o,l){return(i?e:t.axis&&t.axis.getId(l)==="y2"?r:n).call(t,s,o)}},defaultValueFormat(t){return qe(t)?t.join("~"):Ge(t)?+t:""},defaultArcValueFormat(t,e){return`${(e*100).toFixed(1)}%`},defaultPolarValueFormat(t){return`${t}`},dataLabelFormat(t){const e=this,n=e.config.data_labels,r=s=>{let l=s;return qe(s)?l=s.join("~"):He(s)&&(l=Object.values(s).join("~")),l};let i=r;return ie(n.format)?i=n.format:Kn(n.format)&&(n.format[t]?i=n.format[t]===!0?r:n.format[t]:i=()=>""),i.bind(e.api)}};const bv=10,dA=750;function zo(t){const e=this,n=e.getDataById(t);return e.levelColor?e.levelColor(n.values[0].value):e.color(n)}function hA(t,e=!0){var n;const{config:r}=this;let i=(n=r.data_names[t])!=null?n:t;return e&&ie(r.legend_format)&&(i=r.legend_format(i,t!==i?t:void 0)),i}function vA(t,e){var n;if(!e||e.empty())return;const r=(n=t.$el.legend)==null?void 0:n.selectAll(`.${$e.legendItem}`);r&&!r.empty()&&(e=r);const i=[];e.each(function(o){i.push({id:o,node:this})});const s=Kf(i,o=>o.id,o=>o.node);t.cache.add(Oe.legendItemMap,s)}function Sv(t){var e,n;return((e=t.changedTouches)==null?void 0:e[0])||((n=t.touches)==null?void 0:n[0])}function gA(t,e,n){const r=Sv(n);t.state.legendTouch=r?{id:e,x:r.clientX,y:r.clientY,moved:!1}:null}function Av(t,e){const n=t.state.legendTouch,r=n&&Sv(e);r&&(n.moved=n.moved||Math.abs(r.clientX-n.x)>bv||Math.abs(r.clientY-n.y)>bv)}function pA(t,e,n){Av(t,n);const r=t.state.legendTouch;return t.state.legendTouch=null,!!r&&r.id===e&&!r.moved}function mA(t,e){t.state.legendLastTouchClickId=e,t.state.legendLastTouchClickTime=Date.now()}function xA(t,e){const{state:n}=t,r=n.legendLastTouchClickId===e&&Date.now()-(n.legendLastTouchClickTime||0)<dA;return r&&(n.legendLastTouchClickId=null,n.legendLastTouchClickTime=0),r}function yA(t){var e;const n=(e=t.config.interaction_inputType_touch)==null?void 0:e.preventDefault,r=Ra(n)&&n||!1,i=!isNaN(n)&&n||null;return{passive:!r&&i===null}}var TA={initLegend(){var t;const e=this,{config:n,$el:r}=e;if(e.legendItemTextBox={},e.state.legendHasRendered=!1,e.state.isCanvasMode){n.legend_show?(t=e.updateHtmlLegend)==null||t.call(e):e.state.hiddenLegendIds=new Set(e.mapToIds(e.data.targets));return}n.legend_show?(n.legend_contents_bindto||(r.legend=e.$el.svg.append("g").classed($e.legend,!0).attr("transform",e.getTranslate("legend"))),e.updateLegend()):e.state.hiddenLegendIds=new Set(e.mapToIds(e.data.targets))},updateLegend(t,e,n){var r;const i=this,{config:s,state:o,scale:l,$el:c}=i,u=e||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};u.withTransition=ia(u,"withTransition",!0),u.withTransitionForTransform=ia(u,"withTransitionForTransform",!0),s.legend_contents_bindto&&s.legend_contents_template?i.updateLegendTemplate():o.hasTreemap||i.updateLegendElement(t||i.mapToIds(i.data.targets),u),(r=c.legend)==null||r.selectAll(`.${$e.legendItem}`).classed($e.legendItemHidden,function(f){const d=!i.isTargetToShow(f);return d&&(this.style.opacity=null),d}),i.updateScales(!1,!l.zoom),i.updateSvgSize(),i.transformAll(u.withTransitionForTransform,n),o.legendHasRendered=!0},updateLegendTemplate(){const t=this,{config:e,$el:n}=t,r=Yt(e.legend_contents_bindto),i=e.legend_contents_template;if(!r.empty()){const s=t.mapToIds(t.data.targets),o=[];let l="";s.forEach(u=>{const f=ie(i)?Gr(i.call(t.api,u,t.color(u),t.api.data(u)[0].values)):Pa(i,{COLOR:t.color(u),TITLE:u});f&&(o.push(u),l+=f)});const c=r.html(l).selectAll(function(){return this.childNodes}).data(o);t.setLegendItem(c),n.legend=r}},updateSizeForLegend(t){const e=this,{config:n,state:{isLegendTop:r,isLegendLeft:i,isLegendRight:s,isLegendInset:o,current:l}}=e,{width:c,height:u}=t,f={top:r?e.getCurrentPaddingByDirection("top")+n.legend_inset_y+5.5:l.height-u-e.getCurrentPaddingByDirection("bottom")-n.legend_inset_y,left:i?e.getCurrentPaddingByDirection("left")+n.legend_inset_x+.5:l.width-c-e.getCurrentPaddingByDirection("right")-n.legend_inset_x+.5};e.state.margin3={top:s?0:o?f.top:l.height-u,right:NaN,bottom:0,left:s?l.width-c:o?f.left:0}},transformLegend(t){const e=this,{$el:{legend:n},$T:r}=e;r(n,t).attr("transform",e.getTranslate("legend"))},updateLegendItemColor(t,e){const n=this,{legend:r}=n.$el;if(r){const i=n.getLegendItemById(t);i&&Yt(i).select("line").style("stroke",e)}},getLegendWidth(){const t=this,{current:{width:e},isLegendRight:n,isLegendInset:r,legendItemWidth:i,legendStep:s}=t.state;return t.config.legend_show?n||r?i*(s+1):e:0},getLegendHeight(){var t;const e=this,{current:n,isLegendRight:r,legendItemHeight:i,legendStep:s}=e.state,l=((t=e.config.padding)==null?void 0:t.mode)==="fit"?10:20;return e.config.legend_show?r?n.height:Math.max(l,i)*(s+1):0},opacityForUnfocusedLegend(t){return t.classed($e.legendItemHidden)?null:"0.3"},toggleFocusLegend(t,e){const n=this,{$el:{legend:r},$T:i}=n,s=n.mapToTargetIds(t);r&&i(r.selectAll(`.${$e.legendItem}`).filter(o=>s.indexOf(o)>=0).classed(nn.legendItemFocused,e)).style("opacity",function(){return e?null:n.opacityForUnfocusedLegend.call(n,Yt(this))})},revertLegend(){const t=this,{$el:{legend:e},$T:n}=t;e&&n(e.selectAll(`.${$e.legendItem}`).classed(nn.legendItemFocused,!1)).style("opacity",null)},showLegend(t){const e=this,{config:n,$el:r,$T:i}=e;n.legend_show||(n.legend_show=!0,r.legend?r.legend.style("visibility",null):e.initLegend(),!e.state.legendHasRendered&&e.updateLegend()),e.removeHiddenLegendIds(t),i(r.legend.selectAll(e.selectorLegends(t)).style("visibility",null)).style("opacity",null)},hideLegend(t){const e=this,{config:n,$el:{legend:r}}=e;n.legend_show&&lr(t)&&(n.legend_show=!1,r==null||r.style("visibility","hidden")),e.addHiddenLegendIds(t),r==null||r.selectAll(e.selectorLegends(t)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(t,e){const n=this,{cache:r,state:i}=n;let s;const o=Oe.legendItemTextBox;return t&&(s=!i.redrawing&&r.get(o)||{},s[t]||(s[t]=n.getTextRect(e,$e.legendItem),r.add(o,s)),s=s[t]),s},setLegendItem(t){const e=this,{$el:n,api:r,config:i,state:s}=e,o=s.inputType==="touch",l=e.hasType("gauge"),c=i.boost_useCssRule,u=i.legend_item_interaction,f=u.dblclick?"dblclick":"click",d=u||ie(i.legend_item_onclick),h=o?yA(e):void 0,m=function(S,E){var C;if(!Ne(i.legend_item_onclick,r,E,!s.hiddenTargetIds.has(E))){const{altKey:w,type:$}=S,z=Yt(this);$==="dblclick"||w?s.hiddenTargetIds.size&&!z.classed($e.legendItemHidden)?r.show():(r.hide(),r.show(E)):(r.toggle(E),z.classed(nn.legendItemFocused,!1))}o&&(e.hideTooltip(),(C=e.hideGridFocus)==null||C.call(e,!0))};t.attr("class",function(S){const E=Yt(this);return(!E.empty()&&E.attr("class")||"")+e.generateClass($e.legendItem,S)}).style("visibility",S=>e.isLegendToShow(S)?null:"hidden"),i.interaction_enabled&&(c&&[[`.${$e.legendItem}`,"cursor:pointer"],[`.${$e.legendItem} text`,"pointer-events:none"],[`.${$e.legendItemPoint} text`,"pointer-events:none"],[`.${$e.legendItemTile}`,"pointer-events:none"],[`.${$e.legendItemEvent}`,"fill-opacity:0"]].forEach(S=>{const[E,C]=S;e.setCssRule(!1,E,[C])(n.legend)}),t.on(f,d?function(S,E){o&&S.type==="click"&&xA(e,E)||m.call(this,S,E)}:null),o&&f==="click"&&d&&t.on("touchstart",function(S,E){gA(e,E,S)},h).on("touchmove",S=>{Av(e,S)},h).on("touchend",function(S,E){pA(e,E,S)&&(mA(e,E),m.call(this,S,E))},h),!o&&t.on("mouseout",u||ie(i.legend_item_onout)?function(S,E){Ne(i.legend_item_onout,r,E,!s.hiddenTargetIds.has(E))||(Yt(this).classed(nn.legendItemFocused,!1),l&&e.undoMarkOverlapped(e,`.${ar.gaugeValue}`),e.api.revert())}:null).on("mouseover",u||ie(i.legend_item_onover)?function(S,E){Ne(i.legend_item_onover,r,E,!s.hiddenTargetIds.has(E))||(Yt(this).classed(nn.legendItemFocused,!0),l&&e.markOverlapped(E,e,`.${ar.gaugeValue}`),!s.transiting&&e.isTargetToShow(E)&&r.focus(E))}:null),!t.empty()&&t.on("click mouseout mouseover")&&t.style("cursor",e.getStylePropValue("pointer"))),vA(e,t)},getLegendItemById(t){var e;const n=this,r=n.cache.get(Oe.legendItemMap);if(r&&r instanceof Map)return r.get(t)||null;const i=(e=n.$el.legend)==null?void 0:e.selectAll(`.${$e.legendItem}`).filter(s=>s===t);return(i==null?void 0:i.node())||null},updateLegendElement(t,e){const n=this,{config:r,state:i,$el:{legend:s},$T:o}=n,c=r.legend_item_tile_type!=="circle",u=r.legend_item_tile_r,f={width:c?r.legend_item_tile_width:u*2,height:c?r.legend_item_tile_height:u*2},d={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let m,S,E;const C=t.filter(q=>!sn(r.data_names[q])||r.data_names[q]!==null),w=e.withTransition,$=i.isLegendRight||i.isLegendInset,z=hA.bind(n),B=n.getUpdateLegendPositions(C,d,h,$);i.isLegendInset&&(d.step=r.legend_inset_step?r.legend_inset_step:C.length,i.legendStep=d.step),i.isLegendRight?(m=q=>d.max.width*h.steps[q],S=q=>h.margins[h.steps[q]]+h.offsets[q]):i.isLegendInset?(m=q=>d.max.width*h.steps[q]+10,S=q=>h.margins[h.steps[q]]+h.offsets[q]):(m=q=>h.margins[h.steps[q]]+h.offsets[q],S=q=>d.max.height*h.steps[q]);const W={xText:(q,st)=>m(q,st)+4+f.width,xRect:(q,st)=>m(q,st),x1Tile:(q,st)=>m(q,st)-2,x2Tile:(q,st)=>m(q,st)-2+f.width,yText:(q,st)=>S(q,st)+9,yRect:(q,st)=>S(q,st)-5,yTile:(q,st)=>S(q,st)+4};n.generateLegendItem(C,f,B,W,$,z),E=s.select(`.${$e.legendBackground} rect`),i.isLegendInset&&d.max.width>0&&E.size()===0&&(E=s.insert("g",`.${$e.legendItem}`).attr("class",$e.legendBackground).append("rect")),r.legend_tooltip&&s.selectAll("title").data(C).text(q=>z(q,!1));const H=s.selectAll("text").data(C).text(q=>z(q)).each(function(q,st){B(this,q,st)});o(H,w).attr("x",W.xText).attr("y",W.yText);const _=s.selectAll(`rect.${$e.legendItemEvent}`).data(C);o(_,w).attr("width",q=>h.widths[q]).attr("height",q=>h.heights[q]).attr("x",W.xRect).attr("y",W.yRect),n.updateLegendItemPos(C,w,W),E&&o(E,w).attr("height",n.getLegendHeight()-12).attr("width",d.max.width*(d.step+1)+10),i.legendItemWidth=d.max.width,i.legendItemHeight=d.max.height,i.legendStep=d.step},getUpdateLegendPositions(t,e,n,r){const i=this,{config:s,state:o}=i;return function(l,c,u){const f=u===0,d=u===t.length-1,h=i.getLegendItemTextBox(c,l),m=h.width+e.tileWidth+(d&&!r?0:e.padding.right)+s.legend_padding,S=h.height+e.padding.top,E=r?S:m,C=r?i.getLegendHeight():i.getLegendWidth();let w;const $=function(B,W){W||(w=(C-e.totalLength-E)/2,w<e.posMin&&(w=(C-E)/2,e.totalLength=0,e.step++)),n.steps[B]=e.step,n.margins[e.step]=o.isLegendInset?10:w,n.offsets[B]=e.totalLength,e.totalLength+=E};if(f&&(e.totalLength=0,e.step=0,e.max.width=0,e.max.height=0),s.legend_show&&!i.isLegendToShow(c)){n.widths[c]=0,n.heights[c]=0,n.steps[c]=0,n.offsets[c]=0;return}n.widths[c]=m,n.heights[c]=S,(!e.max.width||m>=e.max.width)&&(e.max.width=m),(!e.max.height||S>=e.max.height)&&(e.max.height=S);const z=r?e.max.height:e.max.width;if(s.legend_equally){for(const B in n.widths)n.widths[B]=e.max.width;for(const B in n.heights)n.heights[B]=e.max.height;w=(C-z*t.length)/2,w<e.posMin?(e.totalLength=0,e.step=0,t.forEach(B=>$(B))):$(c,!0)}else $(c)}},generateLegendItem(t,e,n,r,i,s){const o=this,{config:l,state:c,$el:{legend:u}}=o,f=l.legend_usePoint,d=l.legend_item_tile_r,h=l.legend_item_tile_type,m=h!=="circle",S=-200,E=u.selectAll(`.${$e.legendItem}`).data(t).enter().append("g");if(o.setLegendItem(E),l.legend_tooltip&&E.append("title").text(C=>C),E.append("text").text(C=>s(C)).each(function(C,w){n(this,C,w)}).style("pointer-events",o.getStylePropValue("none")).attr("x",i?r.xText:S).attr("y",i?S:r.yText),E.append("rect").attr("class",$e.legendItemEvent).style("fill-opacity",o.getStylePropValue("0")).attr("x",i?r.xRect:S).attr("y",i?S:r.yRect),f){const C=[],w=o.getValidPointPattern();E.append($=>{C.indexOf($)===-1&&C.push($);let z=w[C.indexOf($)%w.length];return z==="rectangle"&&(z="rect"),Ye.createElementNS(_t.svg,"hasValidPointType"in o&&o.hasValidPointType(z)?z:"use")}).attr("class",$e.legendItemPoint).style("fill",zo.bind(o)).style("pointer-events",o.getStylePropValue("none")).attr("href",($,z,B)=>{const H=B[z].nodeName.toLowerCase(),_=o.getTargetSelectorSuffix($);return H==="use"?`#${c.datetimeId}-point${_}`:void 0})}else E.append(m?"line":h).attr("class",$e.legendItemTile).style("stroke",zo.bind(o)).style("pointer-events",o.getStylePropValue("none")).call(C=>{h==="circle"?C.attr("r",d).style("fill",zo.bind(o)).attr("cx",i?r.x2Tile:S).attr("cy",i?S:r.yTile):m&&C.attr("stroke-width",e.height).attr("x1",i?r.x1Tile:S).attr("y1",i?S:r.yTile).attr("x2",i?r.x2Tile:S).attr("y2",i?S:r.yTile)})},updateLegendItemPos(t,e,n){const r=this,{config:i,$el:{legend:s},$T:o}=r,l=i.legend_usePoint,c=i.legend_item_tile_type,u=c!=="circle";if(l){const f=s.selectAll(`.${$e.legendItemPoint}`).data(t),d=i.legend_item_tile_type!=="circle",h=d?i.legend_item_tile_width:i.legend_item_tile_r*2,m=d?i.legend_item_tile_height:i.legend_item_tile_r*2,S=h*.75,E=m*.75,C=h/8,w=m/8;o(f,e).each(function(){const $=this.nodeName.toLowerCase();let z="x",B="y",W=null,H=null,_=null;$==="circle"?(z="cx",B="cy",W=Math.min(S,E)/2):$==="rect"&&(H=S,_=E);const q=Yt(this).attr("transform",null).attr("x",null).attr("y",null).attr("cx",null).attr("cy",null).attr("r",W).attr("width",H).attr("height",_);$==="use"?q.attr("transform",st=>`translate(${n.x1Tile(st)} ${n.yTile(st)-m/2}) scale(${C} ${w})`):q.attr(z,st=>n.x1Tile(st)+(h-(H||0))/2).attr(B,st=>n.yTile(st)-(_||0)/2)})}else{const f=s.selectAll(`.${$e.legendItemTile}`).data(t);o(f,e).style("stroke",zo.bind(r)).call(d=>{c==="circle"?d.attr("cx",h=>{const m=n.x2Tile(h);return m-(m-n.x1Tile(h))/2}).attr("cy",n.yTile):u&&d.attr("x1",n.x1Tile).attr("y1",n.yTile).attr("x2",n.x2Tile).attr("y2",n.yTile)})}}},bA={redraw(t={}){var e,n,r,i,s,o,l,c,u,f;const d=this,{config:h,state:m,$el:S}=d,{main:E,treemap:C}=S;m.redrawing=!0,m.redrawGeneration++,(m.dirty.data||m.dirty.visibility||t.initializing)&&m.dataGeneration++,(t.initializing||m.dirty.size||m.dirty.data||!m.rendered)&&d.cache.remove([Oe.svgLeft]);const w=d.filterTargetsToShow(d.data.targets);m._targetsToShow=w;const $={data:m.dirty.data,visibility:m.dirty.visibility,size:m.dirty.size};m.dirty.data=!1,m.dirty.visibility=!1,m.dirty.size=!1;const{flow:z,initializing:B}=t,W=d.getWithOption(t),H=W.Transition?h.transition_duration:0,_=W.TransitionForExit?H:0,q=W.TransitionForAxis?H:0,st=(e=d.axis)==null?void 0:e.generateTransitions(q),it=$.data||$.visibility||B;if(m.isCanvasMode&&(d.setContainerSize(),(n=d.updateHtmlLegend)==null||n.call(d)),d.updateSizes(B),m.isCanvasMode){const ot=d.scale.zoom,ct=ot==null?void 0:ot.domain();ot&&(d.scale.zoom=null),d.updateScales(B,W.UpdateXDomain),ot&&(ot.range(d.scale.x.range()),ct&&ot.domain(ct),d.scale.zoom=d.getCustomizedXScale(ot),d.axis.x.scale(d.scale.zoom),d.scale.x.domain(h.zoom_rescale?ct:d.org.xDomain),d.scale.subX.domain(d.org.xDomain)),m.hasAxis&&d.axis.syncAxisDomains(w,W,z),m.hasAxis&&((r=d.applyCanvasSubchartDomain)==null||r.call(d));const gt=it?d.getDrawShape():m._cachedDrawShape||d.getDrawShape();it&&(m._cachedDrawShape=gt),h.legend_show&&S.legend&&!(h.legend_contents_bindto&&h.legend_contents_template)&&((i=d.positionHtmlLegend)==null||i.call(d)),(s=d.resizeCanvas)==null||s.call(d),m.canvasFocusKey=null,d.renderCanvasFrame(gt,null,!0),B&&d.updateTypesElements(),d.callPluginHook("$redraw",t,0),m.redrawing=!1,m._targetsToShow=null,m._cachedDrawShape=null,d.mapToIds(d.data.targets).forEach(tt=>{m.withoutFadeIn[tt]=!0}),Ne(h.onrendered,d.api);return}W.Legend&&h.legend_show?(t.withTransition=!!H,!C&&d.updateLegend(d.mapToIds(d.data.targets),t,st)):W.Dimension&&d.updateDimension(!0),h.data_empty_label_text&&E.select(`text.${En.text}.${ze.empty}`).attr("x",m.width/2).attr("y",m.height/2).text(h.data_empty_label_text).style("display",w.length?"none":null),(o=d.redrawTitle)==null||o.call(d),m.hasAxis?(d.axis.redrawAxis(w,W,st,z,B),(l=d.hasGrid)!=null&&l.call(d)&&d.updateGrid(),h.regions.length&&((c=d.updateRegion)==null||c.call(d)),["bar","candlestick","line","area"].forEach(ot=>{const ct=Ln(ot);(/^(line|area)$/.test(ot)&&d.hasTypeOf(ct)||d.hasType(ot))&&it&&d[`update${ct}`](W.TransitionForExit)}),S.text&&E.selectAll(`.${on.selectedCircles}`).filter(d.isBarType.bind(d)).selectAll("circle").remove(),h.interaction_enabled&&!z&&W.EventRect&&(d.redrawEventRect(),(u=d.bindZoomEvent)==null||u.call(d))):(S.arcs&&d.redrawArc(H,_,W.Transform),S.radar&&d.redrawRadar(),S.polar&&d.redrawPolar(),S.funnel&&d.redrawFunnel(),C&&d.updateTreemap(_)),!m.resizing&&!C&&(d.hasPointType()||m.hasRadar)?it&&d.updateCircle():(f=d.hasLegendDefsPoint)!=null&&f.call(d)&&d.data.targets.forEach(d.point("create",this)),d.hasDataLabel()&&!d.hasArcType(null,["radar"])&&it&&d.updateText(),B&&d.updateTypesElements(),d.generateRedrawList(w,z,H,W.Subchart,it),d.updateTooltipOnRedraw(),d.callPluginHook("$redraw",t,H)},generateRedrawList(t,e,n,r,i=!0){const s=this,{config:o,state:l}=s,c=i?s.getDrawShape():l._cachedDrawShape||s.getDrawShape();i&&(l._cachedDrawShape=c),l.hasAxis&&o.subchart_show&&s.redrawSubchart(r,n,c);const u=e&&s.generateFlow({targets:t,flow:e,duration:e.duration,shape:c,xv:s.xv.bind(s)}),f=(n||u)&&os(),d=s.getRedrawList(c,e,u,f),h=()=>{u&&u(),l.redrawing=!1,l._targetsToShow=null,l._cachedDrawShape=null,Ne(o.onrendered,s.api)};if(f&&d.length){const m=Mh();ov().duration(n).each(()=>{d.flatMap(S=>S).forEach(S=>m.add(S))}).call(m,h)}else l.transiting||h();s.mapToIds(s.data.targets).forEach(m=>{l.withoutFadeIn[m]=!0})},getRedrawList(t,e,n,r){const i=this,{config:s,state:{hasAxis:o,hasRadar:l,hasTreemap:c},$el:{grid:u}}=i,{cx:f,cy:d,xForText:h,yForText:m}=t.pos,S=[];if(o){i.redrawGrid&&(s.grid_x_lines.length||s.grid_y_lines.length)&&S.push(i.redrawGrid(r)),i.redrawRegion&&s.regions.length&&S.push(i.redrawRegion(r));for(const E in t.type){const C=Ln(E),w=t.type[E];(/^(area|line)$/.test(E)&&i.hasTypeOf(C)||i.hasType(E))&&S.push(i[`redraw${C}`](w,r))}!e&&u.main&&i.updateGridFocus&&S.push(i.updateGridFocus())}return(!i.hasArcType()||l)&&vn(s.data_labels)&&s.data_labels!==!1&&S.push(i.redrawText(h,m,e,r)),(i.hasPointType()||l)&&!i.isPointFocusOnly()&&i.redrawCircle&&S.push(i.redrawCircle(f,d,r,n)),c&&S.push(i.redrawTreemap(r)),S},updateAndRedraw(t={}){const e=this,{config:n,state:r}=e;let i;t.withTransition=ia(t,"withTransition",!0),t.withTransform=ia(t,"withTransform",!1),t.withLegend=ia(t,"withLegend",!1),t.withUpdateXDomain=!0,t.withUpdateOrgXDomain=!0,t.withTransitionForExit=!1,t.withTransitionForTransform=ia(t,"withTransitionForTransform",t.withTransition),t.withLegend&&n.legend_show||(r.hasAxis&&(i=e.axis.generateTransitions(t.withTransitionForAxis?n.transition_duration:0)),e.updateScales(),e.updateSvgSize(),e.transformAll(t.withTransitionForTransform,i)),e.redraw(t)}},SA={setContainerSize(){const t=this,{state:e}=t;e.current.width=t.getCurrentWidth(),e.current.height=t.getCurrentHeight()},getCurrentWidth(){const t=this;return t.config.size_width||t.getParentRectValue("width")},getCurrentHeight(){var t,e;const n=this,{config:r,state:i,$el:s}=n;let o=r.size_height;if(!o){const l=i.isCanvasMode?(t=s.chart)==null?void 0:t.node():null,c=l==null?void 0:l.style.minHeight;c&&(l.style.minHeight=""),o=n.getParentHeight(),c&&(l.style.minHeight=c);const u=l&&parseFloat((e=n.canvasEngine)==null?void 0:e.canvas.style.height)||0,f=i.current.height-u;f>0&&Math.round(o)===Math.round(u)&&(o+=f)}return o>0?o:320/(n.hasType("gauge")&&!r.gauge_fullCircle?2:1)},getParentRectValue(t){const e=`offset${Ln(t)}`;let n=this.$el.chart.node(),r=0;for(;r<30&&n&&n.tagName!=="BODY";){try{r=ln(n,!0)[t]}catch(s){e in n&&(r=n[e])}n=n.parentNode}const i=Ye.body[e];return r>i&&(r=i),r},getParentHeight(){const t=this.$el.chart.style("height");let e=0;return t&&(e=/px$/.test(t)?parseInt(t,10):this.getParentRectValue("height")),e},getSvgLeft(t){var e,n,r;const i=this,{cache:s,config:o,state:{hasAxis:l},$el:c}=i;if(t){const st=s.get(Oe.svgLeft);if(st!==null)return st}const u=o.axis_rotated,f=u||!u&&!o.axis_y_inner,d=u?Rn.axisX:Rn.axisY,h=c.main.select(`.${d}`).node(),m=l&&o[`axis_${u?"x":"y"}_label`],E=l&&(je(m)||je(m.text)||/^inner-/.test(m==null?void 0:m.position))?c.main.select(`.${d}-label`):null,C=E&&!E.empty()?E.node():null,w=!t,$={label:C?ln(C,w):null,leftAxis:h&&f?ln(h,w):null,chart:ln(c.chart.node(),w)},z=(n=(e=$.label)==null?void 0:e.left)!=null?n:0,B=(r=$.leftAxis)!=null?r:{right:0},W=$.chart.left+z,H=i.hasArcType(),_=B.right-W-(H?0:i.getCurrentPaddingByDirection("left",t)),q=_>0?_:0;return s.add(Oe.svgLeft,q),q},previewResize(){var t,e,n;const r=this,{state:i,$el:s}=r,{current:o}=i,l=r.getCurrentWidth(),c=r.getCurrentHeight();if(!(!l||!c||!o.width||!o.height||l===o.width&&c===o.height)){if(i.isCanvasMode){const u=(t=r.canvasEngine)==null?void 0:t.canvas;if(!u)return;s.chart.style("min-height",`${c}px`),u.style.width=`${l}px`,u.style.height=`${Math.max(0,c-((n=(e=r.getCanvasBottomLegendHeight)==null?void 0:e.call(r))!=null?n:0))}px`}else if(s.svg)s.svg.attr("viewBox",`0 0 ${o.width} ${o.height}`).attr("preserveAspectRatio","none").attr("width",l).attr("height",c);else return;i.resizePreview=!0}},clearResizePreview(){const t=this,{config:e,state:n,$el:r}=t;n.resizePreview&&(n.resizePreview=!1,!n.isCanvasMode&&r.svg&&e.resize_auto!=="viewBox"&&r.svg.attr("viewBox",null).attr("preserveAspectRatio",null))},updateDimension(t){var e,n;const r=this,{config:i,state:{hasAxis:s,isCanvasMode:o},$el:l}=r;if(s&&!t&&r.axis.x&&i.axis_rotated&&((e=r.axis.subX)==null||e.create(l.axis.subX)),r.updateScales(t),o){(n=r.resizeCanvas)==null||n.call(r);return}r.updateSvgSize(),r.transformAll(!1)},updateSvgSize(){var t;const e=this,{config:n,state:{clip:r,current:i,hasAxis:s,width:o,height:l},$el:{svg:c}}=e;if(!c){(t=e.resizeCanvas)==null||t.call(e);return}if(e.clearResizePreview(),n.resize_auto==="viewBox"?c.attr("viewBox",`0 0 ${i.width} ${i.height}`):c.attr("width",i.width).attr("height",i.height),s){const u=c.select(`.${Th.brush} .overlay`),f={width:0,height:0};u.size()&&(f.width=+u.attr("width"),f.height=+u.attr("height")),c.selectAll([`#${r.id}`,`#${r.idGrid}`]).select("rect").attr("width",o).attr("height",l),c.select(`#${r.idXAxis}`).select("rect").call(e.setXAxisClipPath.bind(e)),c.select(`#${r.idYAxis}`).select("rect").call(e.setYAxisClipPath.bind(e)),r.idSubchart&&c.select(`#${r.idSubchart}`).select("rect").attr("width",o).attr("height",f.height)}},getCurrentPaddingByDirection(t,e=!1,n=!1){var r;const i=this,{config:s,$el:o,state:{hasAxis:l,isCanvasMode:c}}=i,u=s.axis_rotated,f=((r=s.padding)==null?void 0:r.mode)==="fit",d=ae(s[`padding_${t}`])?s[`padding_${t}`]:void 0,h=l?{top:u?"y2":null,bottom:u?"y":"x",left:u?"x":"y",right:u?null:"y2"}[t]:null,m=/^(left|right)$/.test(t),S=h&&s[`axis_${h}_inner`],E=h&&s[`axis_${h}_show`],C=h?s[`axis_${h}_axes`].length:0;let w=h?m?i.getAxisWidthByAxisId(h,e):i.getHorizontalAxisHeight(h):0;const $=20;let z=0;!f&&m&&(w=py(w));let B=l&&m&&(S||mn(d)&&!E)?0:f?(E?w:0)+(d!=null?d:0):mn(d)?w:d;return m&&l?(h&&(f||S)&&s[`axis_${h}_label`].text&&(B+=i.axis.getAxisLabelPosition(h).isOuter?$:0),t==="right"?(B+=u?!f&&mn(d)?10:2:!E||S?f?2:1:0,B+=n?i.axis.getXAxisTickTextY2Overflow($):0):t==="left"&&u&&mn(d)&&(B=s.axis_x_show?f?w:Math.max(w,40):1)):t==="top"?((o.title&&o.title.node()||c&&s.title_text)&&(B+=i.getTitlePadding()),z=u&&!S?C:0):t==="bottom"&&l&&u&&!E&&(B+=1),B+w*C-z},getCurrentPadding(t=!1){const e=this,[n,r,i,s]=["top","bottom","left","right"].map(o=>e.getCurrentPaddingByDirection(o,null,t));return{top:n,bottom:r,left:i,right:s}},getResettedPadding(t){const e=this,{config:n}=e,r=ae(t);let i=r?0:{};return n.padding===!1?!r&&Object.keys(t).forEach(s=>{i[s]=!lr(n.data_labels)&&n.data_labels!==!1&&s==="top"?t[s]:0}):i=t,i},updateSizes(t){var e,n,r,i,s;const o=this,{config:l,state:c,$el:{legend:u}}=o,f=l.axis_rotated,d=o.hasArcType()||c.hasFunnel||c.hasTreemap,h=((e=l.padding)==null?void 0:e.mode)==="fit";!t&&o.setContainerSize();const m=u?o.getLegendWidth():0,S=u?o.getLegendHeight():0,E={width:m,height:S};!d&&l.axis_x_show&&l.axis_x_tick_autorotate&&o.updateXAxisTickClip();const C={right:l.legend_show&&c.isLegendRight?m+(h?0:20):0,bottom:!l.legend_show||c.isLegendRight||c.isLegendInset?0:S},w=f||d?0:o.getHorizontalAxisHeight("x"),$=l.subchart_axis_x_show&&l.subchart_axis_x_tick_text_show?w:30,z=l.subchart_show&&!d?l.subchart_size_height+$:0,B=o.hasType("gauge")&&l.arc_needle_show&&!l.gauge_fullCircle&&!l.gauge_label_show?10:0,W=o.getCurrentPadding(!0);if(c.margin=!d&&f?{top:W.top,right:d?0:W.right+C.right,bottom:C.bottom+W.bottom,left:z+(d?0:W.left)}:{top:(h?0:4)+W.top,right:d?0:W.right+C.right,bottom:B+z+C.bottom+W.bottom,left:d?0:W.left},c.margin=o.getResettedPadding(c.margin),c.margin2=f?{top:c.margin.top,right:NaN,bottom:20+C.bottom,left:o.state.rotatedPadding.left}:{top:c.current.height-z-C.bottom,right:NaN,bottom:$+C.bottom,left:c.margin.left},c.margin3={top:0,right:NaN,bottom:0,left:0},(n=o.updateSizeForLegend)==null||n.call(o,E),c.width=c.current.width-c.margin.left-c.margin.right,c.height=c.current.height-c.margin.top-c.margin.bottom,c.width<0&&(c.width=0),c.height<0&&(c.height=0),c.width2=f?c.margin.left-c.rotatedPadding.left-c.rotatedPadding.right:c.width,c.height2=f?c.height:c.current.height-c.margin2.top-c.margin2.bottom,c.width2<0&&(c.width2=0),c.height2<0&&(c.height2=0),o.hasArcType()){const H=o.hasType("gauge"),_=l.legend_show&&c.isLegendRight,q=(r=c.hasRadar&&o.cache.get(Oe.radarTextWidth))!=null?r:0;c.arcWidth=c.width-(_?E.width+10:0)-q,c.arcHeight=c.height-(_&&!H?0:10),(i=l.arc_rangeText_values)!=null&&i.length&&(H?(c.arcWidth-=25,c.arcHeight-=10,c.margin.left+=10):(c.arcHeight-=20,c.margin.top+=10)),H&&!l.gauge_fullCircle&&(c.arcHeight+=c.height-o.getPaddingBottomForGauge()),(s=o.updateRadius)==null||s.call(o)}c.isLegendRight&&d&&(c.margin3.left=c.arcWidth/2+c.radiusExpanded*1.1)}},AA={setCssRule(t,e,n,r){const i=this,{config:s,state:{cssRule:o,style:l}}=i;return s.boost_useCssRule?c=>{c.each(u=>{const f=r&&(r==null?void 0:r.call(i,u)),d=`${t?`.${Tn.shapes+i.getTargetSelectorSuffix(u.id)}`:""}${e}`;e in o&&l.sheet.deleteRule(o[d]),i.state.cssRule[d]=W1(l,d,n.filter(Boolean).map(h=>je(f)&&h.indexOf(":")===-1?`${h}: ${f}`:h||""))})}:()=>{}},getStylePropValue(t){const{config:{boost_useCssRule:e}}=this;return e?null:ie(t)?t.bind(this):t}};function Ev(t){return typeof t=="string"?new fn([document.querySelectorAll(t)],[document.documentElement]):new fn([b(t)],hr)}function EA(t){let e="middle";return t>0&&t<=170?e="end":t>190&&t<=360&&(e="start"),e}function CA(t,e,n,r,i){var s;const o=this,{value:l}=t,c=o.isCandlestickType(t),u=ae(l)&&l<0||c&&!((s=o.getCandlestickData(t))!=null&&s._isUp);let{x:f,y:d}=e;const h=4,m=h*2;return r?n==="start"?(f+=u?0:m,d+=h):n==="middle"?(f+=m,d-=m):n==="end"&&(u&&(f-=m),d+=h):(n==="start"?(f+=h,u&&(d+=m*2)):n==="middle"?d-=m:n==="end"&&(f-=h,u&&(d+=m*2)),i&&(d+=u?-17:c?13:7)),{x:f,y:d}}function Cv(t,e){var n;const r=this.config.data_labels_position,{id:i,index:s,value:o}=t;return(n=ie(r)?r.bind(this.api)(e,o,i,s,this.$el.text):(i in r?r[i]:r)[e])!=null?n:0}function IA(t,e,n){var r,i;const s=this,{config:o,$T:l}=s,c=o.axis_rotated,{border:{padding:u="3 5",radius:f=10,stroke:d="#000",strokeWidth:h=1,fill:m="none"}}=o.data_labels,S=jf(u),E=o.data_labels.border!==!0,C=ha(t);let w=Yt(t.previousElementSibling);(w.empty()||((r=w.node())==null?void 0:r.tagName)!=="rect"||!((i=w.attr("class"))!=null&&i.includes(n)))&&(w=Yt(t.parentNode).insert("rect",()=>t).attr("class",`${En.textBorderRect} ${n}`).attr("width",C.width+(E?S.left+S.right:0)).attr("height",C.height+(E?S.top+S.bottom:0)),E&&w.style("fill",m).style("stroke",d).style("stroke-width",`${h}px`).attr("rx",f).attr("ry",f)),l(w).attr("x",e.x-(E?S.left:0)-(c?0:C.width/2)).attr("y",e.y-(E?S.top:0)-C.height/4*3.2)}function Qc(t=0,e){const n=this,{config:r}=n,i=r[`${e}_label_threshold`]||0;return t>=i}function Iv(){const t=this,{$el:{text:e},config:n}=t;(t.state.arcWidth?t.getArcLabelConfig("image"):n.data_labels.image)&&e.filter(function(){const i=this.previousElementSibling;return i?i.tagName!=="image"||!i.classList.contains(En.textLabelImage):!0}).each(function(i){var s,o,l,c;const u=RA.call(t,i);if(!u)return;const{url:f,width:d,height:h,pos:m}=u;if(f){const S=Yt(this.parentNode);S==null||S.insert("image",`${(o=(s=this.getAttribute("class"))==null?void 0:s.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",E=>Pa(f,{ID:"id"in E?E.id:E.data.id})).attr("class",En.textLabelImage).style("pointer-events","none").attr("width",d).attr("height",h).attr("transform",m?`translate(${(l=m.x)!=null?l:0} ${(c=m.y)!=null?c:0})`:null)}})}function RA(t){var e;const n=this,{config:r,state:i}=n,s=i.arcWidth?n.getArcLabelConfig("image"):r.data_labels.image;if(ie(s))return(e=s.call(n.api,t.value,t.id,t.index))!=null?e:{url:"",width:0,height:0,pos:{x:0,y:0}};if(s){const{url:o="",width:l=0,height:c=0,pos:u}=s;return{url:o,width:l,height:c,pos:u}}return null}function Rv(t,e,n){var r;const i=this,{config:s,state:{arcWidth:o,hasTreemap:l}}=i,c=s.axis_rotated,u=Yt(t.previousElementSibling),f=d=>{var h;const m=d.style.opacity!=="0"&&d.style.fillOpacity!=="0";return(o?d.textContent:m)&&((h=this.previousElementSibling)==null?void 0:h.tagName)!=="image"};if(!u.empty()&&((r=u.node())==null?void 0:r.tagName)==="image"){const d=n||ln(t),h=+u.attr("width")/2,m=+u.attr("height")/2;let S=e.x-h,E=e.y-m-d.height/2;c?e.x+=h:(l&&(S=-h,E=-(m*2+d.height)),i.hasType("pie")||i.hasType("polar")||(e.y+=m)),i.$T(u).style("opacity",f(t)?null:"0").attr("x",S).attr("y",E)}}function wA(t){return Kf(t,e=>e,e=>ha(e,!0))}var OA={opacityForText(t){const e=this;return e.isBarType(t)&&!Qc.call(e,Math.abs(e.getRatio("bar",t)),"bar")?"0":e.hasDataLabel()?null:"0"},initText(){const{$el:t}=this;t.main.select(`.${ze.chart}`).append("g").attr("class",En.chartTexts).style("pointer-events",t.funnel||t.treemap?"none":null)},updateTargetsForText(t){const e=this,n=e.getChartClass("Text"),r=e.getClass("texts","id"),i=e.classFocus.bind(e);e.$el.main.select(`.${En.chartTexts}`).selectAll(`.${En.chartText}`).data(e.filterNullish(t)).attr("class",l=>`${n(l)}${i(l)}`.trim()).enter().append("g").style("opacity","0").attr("class",n).call(e.setCssRule(!0,` .${En.text}`,["fill","pointer-events:none"],e.updateTextColor)).append("g").attr("class",r)},updateText(){const t=this,{$el:e,$T:n,config:r,axis:i}=t,s=t.getClass("text","index"),o=r.data_labels.centered,l=e.main.selectAll(`.${En.texts}`).selectAll(`.${En.text}`).data(t.labelishData.bind(t));n(l.exit()).style("fill-opacity","0").remove(),e.text=l.enter().append("text").merge(l).attr("class",s).attr("text-anchor",c=>{let f=r[`axis_${i==null?void 0:i.getId(c.id)}_inverted`]?c.value>0:c.value<0;if(t.isCandlestickType(c)){const d=t.getCandlestickData(c);f=!(d!=null&&d._isUp)}else if(t.isTreemapType(c))return o?"middle":"start";return r.axis_rotated?f?"end":"start":"middle"}).style("fill",t.getStylePropValue(t.updateTextColor)).style("fill-opacity","0").each(function(c,u,f){const d=Yt(this);let{value:h}=c;if(t.isBubbleZType(c))h=t.getBubbleZData(h,"z");else if(t.isCandlestickType(c)){const m=t.getCandlestickData(c);m&&(h=m.close)}h=t.isTreemapType(c)?t.treemapDataLabelFormat(c)(d):t.dataLabelFormat(c.id)(h,c.id,c.index,f),ae(h)?this.textContent=h:ci(d,h,void 0,!0)}),Iv.call(t)},updateTextColor(t){const e=this,{config:n}=e,r=n.data_labels_colors,i=e.isArcType(t)&&!e.isRadarType(t)||e.isFunnelType(t)||e.isTreemapType(t)?null:e.color(t);let s;if(je(r))s=r;else if(He(r)){const{id:o}=t.data||t;s=r[o]}else ie(r)&&(s=r.bind(e.api)(i,t));if(e.isCandlestickType(t)&&!ie(r)){const o=e.getCandlestickData(t);if(!(o!=null&&o._isUp)){const l=n.candlestick_color_down;s=He(l)?l[t.id]:l}}return s||i},updateTextBGColor(t,e){const n=this,{$el:{defs:r}}=n;let i="";if(e){const s=je(e)?"":n.getTargetSelectorSuffix("id"in t?t.id:t.data.id),o=r.select(["filter[id*='labels-bg","']"].join(s));if(o.size()&&(i=`url(#${o.attr("id")})`),ie(e)){n.generateTextBGColorFilter(e);const l=n.color(t),c=e.bind(n.api)(l,t);c?o.select("feFlood").attr("flood-color",c):i=""}}return i||null},redrawText(t,e,n,r){const i=this,{$T:s,axis:o,config:l,state:{hasTreemap:c}}=i,u=Cr(!0),f=l.axis_rotated,d=l.data_labels.rotate,h=EA(d),m=d?`rotate(${d})`:"",S=i.$el.text.style("fill",i.getStylePropValue(i.updateTextColor)).attr("filter",w=>i.updateTextBGColor.bind(i)(w,l.data_labels_backgroundColors)).style("fill-opacity",n?0:i.opacityForText.bind(i)),E=new Map,C=[];return S.each(function(w){const $=this;E.set($,{rect:ln($)}),l.data_labels.centered&&(i.isBarType(w)||i.isTreemapType(w))&&C.push($)}),C.length>0&&wA(C).forEach((w,$)=>{const z=E.get($);z&&(z.bbox=w)}),S.each(function(w,$){const z=E.get(this),B=s(c&&this.childElementCount?this.parentNode:this,!!(r&&(this.getAttribute("x")||this.getAttribute("transform"))),u),W=l[`axis_${o==null?void 0:o.getId(w.id)}_inverted`];let H={x:t.call(this,w,$,z),y:e.call(this,w,$,z)};d&&(H=CA.bind(i)(w,H,h,f,W),B.attr("text-anchor",h)),Rv.call(i,this,H,z==null?void 0:z.rect),this.childElementCount||d?B.attr("transform",`translate(${H.x} ${H.y}) ${m}`):B.attr("x",H.x).attr("y",H.y),l.data_labels.border&&IA.call(i,B.node(),H,`${En.textBorderRect}-${$}`)}),!0},getTextRect(t,e){var n,r;const i=this;let s,o,l;Array.isArray(t)?s=`${Oe.textRect}-${t.join("_")}`:(o=(r=(n=t.node)==null?void 0:n.call(t))!=null?r:t,/text/i.test(o.tagName)||(o=o.querySelector("text")),l=o.textContent,s=`${Oe.textRect}-${l.replace(/\W/g,"_")}`);const c=i.cache.get(s)||[];return c.length===0&&((i.$el.svg||i.$el.chart.select("svg")).selectAll(`.${ze.dummy}`).data(l?[l]:t).enter().append("text").style("visibility","hidden").style("font",o?Yt(o).style("font"):null).classed(e||ze.dummy,!0).text(u=>u).each(function(u,f){c[f]=ln(this)}).remove(),i.cache.add(s,c)),c.length>1?c:c[0]},generateXYForText(t,e){const n=this,{state:{hasRadar:r,hasFunnel:i,hasTreemap:s}}=n,o=Object.keys(t),l={},c=e?n.getXForText:n.getYForText;return i&&o.push("funnel"),r&&o.push("radar"),s&&o.push("treemap"),o.forEach(u=>{l[u]=n[`generateGet${Ln(u)}Points`](t[u],!1)}),function(u,f,d){const h=n.isAreaType(u)&&"area"||n.isBarType(u)&&"bar"||n.isCandlestickType(u)&&"candlestick"||n.isFunnelType(u)&&"funnel"||n.isRadarType(u)&&"radar"||n.isTreemapType(u)&&"treemap"||"line";return c.call(n,l[h](u,f),u,this,d)}},getCenteredTextPos(t,e,n,r,i){const s=this,{config:o}=s,l=o.axis_rotated,c=s.isBarType(t),u=s.isTreemapType(t);if(o.data_labels.centered&&(c||u)){const f=(i==null?void 0:i.bbox)||ha(n);if(c){const d=s.getRangedData(t,null,"bar")>=0;if(l){const h=(d?e[1][1]-e[0][1]:e[0][1]-e[1][1])/2+f.width/2;return d?-h-3:h+2}else{const h=(d?e[0][1]-e[1][1]:e[1][1]-e[0][1])/2+f.height/2;return d?h:-h-2}}else if(u){const d=f.y-(n.childElementCount?0:+(n.getAttribute("y")||0));return r==="x"?(e[1][0]-e[0][0])/2:(e[1][1]-e[0][1])/2-d-f.height/2}}return 0},getXForText(t,e,n,r){var i,s,o;const l=this,{config:c}=l,u=c.axis_rotated,f=l.isFunnelType(e),d=l.isTreemapType(e);let h=t?t[0][0]:0;if(l.isCandlestickType(e))u?h=(i=l.getCandlestickData(e))!=null&&i._isUp?t[2][2]+4:t[2][1]-4:h+=(t[1][0]-h)/2;else if(f)if(t)h=(o=(s=t[2])==null?void 0:s[0])!=null?o:h;else return Ic(n,"x");else if(d)h+=c.data_labels.centered?0:5;else if(u){const m=c[`axis_${l.axis.getId(e.id)}_inverted`],S=l.isBarType(e)?4:6,E=e.value;h=t[2][1],h+=S*((m?E>0:E<0)?-1:1)}else h=l.hasType("bar")?(t[2][0]+t[0][0])/2:h;return(u||d||f)&&(h+=l.getCenteredTextPos(e,t,n,"x",r)),h+Cv.call(this,e,"x")},getYForText(t,e,n,r){var i,s;const o=this,{axis:l,config:c,state:u}=o,f=c.axis_rotated,d=c[`axis_${l==null?void 0:l.getId(e.id)}_inverted`],h=o.isBarType(e),m=o.isFunnelType(e),S=o.isTreemapType(e),E=c.point_r,C=(r==null?void 0:r.rect)||ln(n);let{value:w}=e,$=3,z;if(o.isCandlestickType(e))w=o.getCandlestickData(e),f?(z=t[0][0],z+=(t[1][0]-z)/2+$):(z=w&&w._isUp?t[2][2]-$:t[2][1]+$*4,d&&(z+=15*(w._isUp?1:-1)));else if(m)if(t)z=((s=(i=t[2])==null?void 0:i[1])!=null?s:t[0][1])+C.height/2-3;else return Ic(n,"y");else if(S)z=t[0][1]+(c.data_labels.centered?0:C.height+5);else if(f)z=(t[0][0]+t[2][0]+C.height*.6)/2;else if(z=t[2][1],ae(E)&&E>5&&(o.isLineType(e)||o.isScatterType(e))&&($+=c.point_r/2.3),w<0||w===0&&!u.hasPositiveValue&&u.hasNegativeValue)z+=d?h?-3:-5:C.height+(h?-$:$);else{let B=-$*2;h?B=-$:o.isBubbleType(e)&&(B=$),d&&(B=h?10:15),z+=B}return(!f||S)&&(z+=o.getCenteredTextPos(e,t,n,"y",r)),z+Cv.call(this,e,"y")},markOverlapped(t,e,n){const r=e.$el.arcs.selectAll(n),i=r.filter(f=>f.data.id!==t),s=r.filter(f=>f.data.id===t),o=Cc(s.node()),l=(f,d)=>Math.sqrt(f*f+d*d);if(!s.node())return;const c=parseInt(s.style("font-size"),10),u=[];i.each(function(){const f=Cc(this),d=l(o.e,o.f)>l(f.e,f.f)?s:Yt(this),h=Math.ceil(Math.abs(o.e-f.e))<Math.ceil(d.node().getComputedTextLength()),m=Math.ceil(Math.abs(o.f-f.f))<c;u.push({node:this,overlaps:h&&m})}),u.forEach(({node:f,overlaps:d})=>{Yt(f).classed(En.TextOverlapping,d)})},undoMarkOverlapped(t,e){t.$el.arcs.selectAll(e).each(function(){Ev([this,this.previousSibling]).classed(En.TextOverlapping,!1)})}};function wv(t="left",e){const n=ae(e);return t.includes("center")?n?e/2:"middle":t.includes("right")?n?e:"end":n?0:"start"}function PA(t){var e,n,r,i,s,o,l,c;const{config:u,$el:f}=t,d=((r=(n=(e=t.canvasTheme)==null?void 0:e.style)==null?void 0:n.title)==null?void 0:r.font)||((o=(s=(i=t.canvasTheme)==null?void 0:i.style)==null?void 0:s.label)==null?void 0:o.font)||"14px sans-serif",h=(c=(l=f.chart)==null?void 0:l.node)==null?void 0:c.call(l),m=h==null?void 0:h.ownerDocument;if(h&&m&&u.title_text){const S=m.createElementNS("http://www.w3.org/2000/svg","svg"),E=m.createElementNS("http://www.w3.org/2000/svg","text");S.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",E.setAttribute("class",En.title),E.style.font=d,E.textContent=String(u.title_text),S.appendChild(E),h.appendChild(S);const C=ln(E).height;if(S.remove(),C)return C}return u.title_text?parseFloat(d)||14:0}var MA={initTitle(){const t=this,{config:e,$el:n}=t;if(e.title_text){n.title=n.svg.append("g");const r=n.title.append("text").style("text-anchor",wv(e.title_position)).attr("class",En.title);ci(r,e.title_text,[.3,1.5])}},redrawTitle(){const t=this,{config:e,state:{current:n},$el:{title:r}}=t;if(r){const i=wv(e.title_position,n.width),s=(e.title_padding.top||0)+t.getTextRect(t.$el.title,En.title).height;r.attr("transform",`translate(${i}, ${s})`)}},getCanvasTitleHeight(){return PA(this)},getTitlePadding(){const t=this,{$el:{title:e},config:n,state:r}=t,i=n.title_padding.top||0,s=n.title_padding.bottom||0;if(r.isCanvasMode&&n.title_text)return i+t.getCanvasTitleHeight()+s;if(!(e!=null&&e.node()))return i+s;const o=e.node(),l=Ic(o,"y");if(l){const c=ha(o);return l+c.y+c.height+s}return i+t.getTextRect(e,En.title).height+s}};const LA=/(\r?\n|\t)/g,DA=/{{(.*)}}/;var FA={initTooltip(){const t=this,{config:e,$el:n}=t;n.tooltip=Yt(e.tooltip_contents.bindto),n.tooltip.empty()&&(n.tooltip=n.chart.append("div").attr("class",bo.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),t.bindTooltipResizePos()},initShowTooltip(){var t;const e=this,{config:n,$el:r,state:{hasAxis:i,hasRadar:s}}=e;if(n.tooltip_init_show){const o=!(i||s);(t=e.axis)!=null&&t.isTimeSeries()&&je(n.tooltip_init_x)&&(n.tooltip_init_x=Wn.call(e,n.tooltip_init_x)),e.api.tooltip.show({data:{[o?"index":"x"]:n.tooltip_init_x}});const l=n.tooltip_init_position;if(!n.tooltip_contents.bindto&&!lr(l)){const{top:c=0,left:u=50}=l;r.tooltip.style("top",je(c)?c:`${c}px`).style("left",je(u)?u:`${u}px`).style("display",null)}}},getTooltipHTML(...t){const e=this,{api:n,config:r}=e;return Gr(ie(r.tooltip_contents)?r.tooltip_contents.bind(n)(...t):e.getTooltipContent(...t))},getTooltipContent(t,e,n,r){var i;const s=this,{api:o,config:l,state:c,$el:u}=s,f=l.tooltip_format_title,d=l.tooltip_format_name,h=l.tooltip_format_value,m=ie(f)?f.bind(o):e,S=ie(d)?d.bind(o):(tt=>tt),E=ie(h)?h.bind(o):null,C=(tt,ft,lt,bt)=>{let St=E;return St||(c.hasTreemap||s.isStackNormalized()&&(!s.isStackNormalizedPerGroup()||s.isGrouped(lt))?St=(Mt,Ot)=>`${(Ot*100).toFixed(2)}%`:St=n),St(tt,ft,lt,bt)},w=l.tooltip_order,$=tt=>s.axis&&s.isBubbleZType(tt)?s.getBubbleZData(tt.value,"z"):s.getBaseValue(tt),z=s.levelColor?tt=>s.levelColor(tt.value):tt=>r(tt),B=l.tooltip_contents,W=B.template,H=s.mapToTargetIds();if(w===null&&l.data_groups.length){const tt=s.orderTargets(s.data.targets).map(ft=>ft.id).reverse();t.sort((ft,lt)=>{let bt=ft?ft.value:null,St=lt?lt.value:null;return bt>0&&St>0&&(bt=ft.id?tt.indexOf(ft.id):null,St=lt.id?tt.indexOf(lt.id):null),bt-St})}else if(/^(asc|desc)$/.test(w)){const tt=w==="asc";t.sort((ft,lt)=>{const bt=ft?$(ft):null,St=lt?$(lt):null;return tt?bt-St:St-bt})}else ie(w)&&t.sort(w.bind(o));const _=s.getTooltipContentTemplate(W),q=t.length;let st,it,ot,ct,gt;for(gt=0;gt<q;gt++){it=t[gt];const tt=it&&$(it);if(!(!it||!(tt||tt===0))){if(mn(st)){const ft=(c.hasAxis||c.hasRadar)&&m(it.x);st=Pa(_[0],{CLASS_TOOLTIP:bo.tooltip,TITLE:Ge(ft)?W?ft:`<tr><th colspan="2">${ft}</th></tr>`:""})}if(!it.ratio&&u.arcs&&(ot=["arc",s.$el.arcs.select(`path.${Ze.arc}-${it.id}`).data()[0]],it.ratio=s.getRatio(...ot)),ot=[it.ratio,it.id,it.index],s.isAreaRangeType(it)){const[ft,lt]=["high","low"].map(St=>C(s.getRangedData(it,St),...ot));ct=`<b>Mid:</b> ${C($(it),...ot)} <b>High:</b> ${ft} <b>Low:</b> ${lt}`}else if(s.isCandlestickType(it)){const[ft,lt,bt,St,Mt]=["open","high","low","close","volume"].map(Ot=>s.getRangedData(it,Ot,"candlestick")?C(s.getRangedData(it,Ot,"candlestick"),...ot):void 0);ct=`<b>Open:</b> ${ft} <b>High:</b> ${lt} <b>Low:</b> ${bt} <b>Close:</b> ${St}${Mt?` <b>Volume:</b> ${Mt}`:""}`}else if(s.isBarRangeType(it)){const{value:ft,id:lt,index:bt}=it;ct=`${C(ft,void 0,lt,bt)}`}else ct=C($(it),...ot);if(ct!==void 0){if(it.name===null)continue;const ft=S((i=it.name)!=null?i:it.id,...ot),lt=z(it),bt={CLASS_TOOLTIP_NAME:bo.tooltipName+s.getTargetSelectorSuffix(it.id),COLOR:W||!s.patterns?lt:`<svg><rect style="fill:${lt}" width="10" height="10"></rect></svg>`,NAME:ft,VALUE:ct};if(W&&He(B.text)){const St=H.indexOf(it.id);Object.keys(B.text).forEach(Mt=>{bt[Mt]=B.text[Mt][St]})}st+=Pa(_[1],bt)}}}return`${st}</table>`},getTooltipContentTemplate(t){return(t||`<table class="{=CLASS_TOOLTIP}"><tbody>
46
46
  {=TITLE}
47
47
  {{<tr class="{=CLASS_TOOLTIP_NAME}">
48
48
  <td class="name">${this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>'}{=NAME}</td>
@@ -58,4 +58,4 @@ ${(l*100).toFixed(2)}%`;return u==null?null:String(u)}var Ew=Array.prototype.sli
58
58
  </foreignObject></svg>`;return`data:image/svg+xml;base64,${aC(d)}`}function sC(t,e){const{top:n,left:r}=e,{x:i,y:s}=ha(t,!0),{a:o,b:l,c,d:u,e:f,f:d}=t.getScreenCTM(),{width:h,height:m}=ln(t,!0);return{x:o*i+c*s+f-r,y:l*i+u*s+d-n+(m-Math.round(m/4)),width:h,height:m}}function oC(t){const{left:e,top:n}=ln(t),r=s=>s.textContent||s.childElementCount,i=[];return Oa(t.querySelectorAll("text")).filter(r).forEach(s=>{const o=l=>{const{fill:c,fontFamily:u,fontSize:f,textAnchor:d,transform:h}=se.getComputedStyle(l),{x:m,y:S,width:E,height:C}=sC(l,{left:e,top:n});return{[l.textContent]:{x:m,y:S,width:E,height:C,fill:c,fontFamily:u,fontSize:f,textAnchor:d,transform:h}}};s.childElementCount>1?Oa(s.querySelectorAll("tspan")).filter(r).forEach(l=>{i.push(o(l))}):i.push(o(s))}),i}function lC(t,e){e.forEach(n=>{Object.keys(n).forEach(r=>{const{x:i,y:s,width:o,height:l,fill:c,fontFamily:u,fontSize:f,transform:d}=n[r];if(t.save(),t.font=`${f} ${u}`,t.fillStyle=c,d==="none")t.fillText(r,i,s);else{const h=d.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(m=>+m==0)?(h.push(i+o-o/4),h.push(s-l+l/3)):(h.push(i),h.push(s)),t.transform(...h),t.fillText(r,0,0)}t.restore()})})}function cC(t,e,n){const{width:r,height:i}=e||n,s=Ye.createElement("canvas"),o=s.getContext("2d");if(s.width=r,s.height=i,o){let c=0,u=r,f=i;if((e==null?void 0:e.preserveAspectRatio)!==!1){const d=Math.min(r/n.width,i/n.height);u=n.width*d,f=n.height*d,c=(i-f)/2}o.drawImage(t,0,0,t.width,t.height,0,c,u,f)}return s.toDataURL(e.mimeType)}var uC={export(t,e){var n;const r=this.internal,{state:i,$el:{chart:s,svg:o}}=r,l=(n=r.canvasEngine)==null?void 0:n.canvas,c=i.isCanvasMode&&l?ln(l,!0):null,{width:u,height:f}=c&&c.width&&c.height?{width:c.width,height:c.height}:i.current,d=Xr(Object.create(null),{width:u,height:f,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},t);if(i.isCanvasMode&&l){const S=cC(l,d,{width:u,height:f});return e==null||e.bind(this)(S),S}const h=iC(s.node(),d,{width:u,height:f}),m=d.preserveFontStyle?oC(o.node()):[];if(e&&ie(e)){const S=new Image;S.crossOrigin="Anonymous",S.onload=()=>{const E=Ye.createElement("canvas"),C=E.getContext("2d");E.width=d.width||u,E.height=d.height||f,C.drawImage(S,0,0),m.length&&(lC(C,m),m.length=0),e.bind(this)(E.toDataURL(d.mimeType))},S.src=h}return h}};let mg=()=>(jn.prototype.export=uC.export,(mg=()=>({}))());var fC={flow(t){const e=this.internal;let n;(t.json||t.rows||t.columns)&&e.convertData(t,i=>{n=i,r()});function r(){var i,s,o;let l,c=0,u=0,f,d;if(e.state.redrawing||!n||!os())return;(i=e.flushCanvasFlow)==null||i.call(e);const h=[],m=e.getMaxDataCount(),S=e.convertDataToTargets(n,!0),E=e.axis.isTimeSeries();e.data.targets.forEach($=>{let z=!1;for(let B=0;B<S.length;B++)if($.id===S[B].id){z=!0,$.values[$.values.length-1]&&(u=$.values[$.values.length-1].index+1);const W=S[B].values;c=W.length;for(let H=0;H<c;H++)W[H].index=u+H,E||(W[H].x=u+H),$.values.push(W[H]);S.splice(B,1);break}!z&&h.push($.id)}),e.data.targets.forEach($=>{for(let z=0;z<h.length;z++)if($.id===h[z]){if(!$.values[$.values.length-1])continue;u=$.values[$.values.length-1].index+1;for(let B=0;B<c;B++)$.values.push({id:$.id,index:u+B,x:E?e.getOtherTargetX(u+B):u+B,value:null})}}),e.data.targets.length&&S.forEach($=>{const z=e.data.targets[0].values[0].index,B=$.values,W=B.length,H=Math.max(u-z,0);if(H){B.length=W+H;for(let _=W-1;_>=0;_--)B[_+H]=B[_];for(let _=0;_<H;_++){const q=z+_;B[_]={id:$.id,index:q,x:E?e.getOtherTargetX(q):q,value:null}}}for(let _=H;_<B.length;_++){const q=B[_];q.index+=u,E||(q.x+=u)}});for(let $=0;$<S.length;$++)e.data.targets.push(S[$]);const C=e.data.targets[0],w=C.values[0];if(sn(t.to)?(c=0,d=E?Wn.call(e,t.to):t.to,C.values.forEach($=>{$.x<d&&c++})):sn(t.length)&&(c=t.length),m?m===1&&E&&(f=(C.values[C.values.length-1].x-w.x)/2,l=[new Date(+w.x-f),new Date(+w.x+f)]):(E?f=C.values.length>1?C.values[C.values.length-1].x-w.x:w.x-e.getXDomain(e.data.targets)[0]:f=1,l=[w.x-f,w.x]),l&&e.updateXDomain(null,!0,!0,!1,l),e.state.isCanvasMode){const $=Ge(t.duration)?t.duration:e.config.transition_duration;if((s=e.animateCanvasFlow)==null?void 0:s.call(e,{done:t.done,duration:$,length:c,orgDataCount:m}))return;c&&m&&e.data.targets.forEach(B=>{B.values.splice(0,c)}),e.state.dirty.data=!0,e.state._eventRectFingerprint=null,e.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),e.updateTypesElements(),(o=t.done)==null||o.call(e.api);return}e.updateTargets(e.data.targets),e.state.dirty.data=!0,e.state._eventRectFingerprint=null,e.redraw({flow:{index:w.index,length:c,duration:Ge(t.duration)?t.duration:e.config.transition_duration,done:t.done,orgDataCount:m},withLegend:!0,withTransition:m>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}},dC={generateFlow(t){const e=this,{data:n,state:r,$el:i}=e;return function(){var s;const o=t.flow.length;r.flowing=!0,n.targets.forEach(c=>{c.values.splice(0,o)}),r.dataGeneration++,e.updateXGrid&&e.updateXGrid(!0);const l={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(c=>{const u=c.split(".");let f=i[u[0]];f&&u.length>1&&(f=f[u[1]]),f!=null&&f.size()&&(l[c]=f)}),(s=e.hideGridFocus)==null||s.call(e),e.setFlowList(l,t)}},setFlowList(t,e){const n=this,{flow:r,targets:i}=e,{duration:s=e.duration,index:o,length:l,orgDataCount:c}=r,u=n.getFlowTransform(i,c,o,l),f=Mh();let d;f.add(Object.keys(t).map(h=>(d=t[h].transition().ease(m=>+m).duration(s),h==="axis.x"?d=d.call(m=>{n.axis.x.setTransition(m).create(m)}):h==="region.list"?d=d.filter(n.isRegionOnX).attr("transform",u):d=d.attr("transform",u),d))),d.call(f,()=>{n.cleanUpFlow(t,e)})},cleanUpFlow(t,e){const n=this,{config:r,state:i,$el:{svg:s}}=n,o=r.axis_rotated,{flow:l,shape:c,xv:u}=e,{cx:f,cy:d,xForText:h,yForText:m}=c.pos,{done:S=()=>{},length:E}=l;E&&(["circle","text","shape","eventRect"].forEach(C=>{const w=[];for(let $=0;$<E;$++)w.push(`.${Re[C]}-${$}`);s.selectAll(`.${Re[`${C}s`]}`).selectAll(w).remove()}),s.select(`.${Re.xgrid}`).remove()),Object.keys(t).forEach(C=>{const w=t[C];if(C!=="axis.x"&&w.attr("transform",null),C==="grid.x")w.attr(i.xgridAttr);else if(C==="gridLines.x")w.attr("x1",o?0:u).attr("x2",o?i.width:u),w.select("text").attr("x",o?i.width:0).attr("y",u);else if(/^(area|bar|line)$/.test(C))w.attr("d",c.type[C]);else if(C==="text")w.attr("x",h).attr("y",m).style("fill-opacity",n.opacityForText.bind(n));else if(C==="circle")if(n.isCirclePoint())w.attr("cx",f).attr("cy",d);else{const $=B=>f(B)-r.point_r,z=B=>d(B)-r.point_r;w.attr("x",$).attr("y",z)}else C==="region.list"&&w.select("rect").filter(n.isRegionOnX).attr("x",n.regionX.bind(n)).attr("width",n.regionWidth.bind(n))}),r.interaction_enabled&&n.redrawEventRect(),S.call(n.api),i.flowing=!1},getFlowTransform(t,e,n,r){const i=this,{data:s,scale:{x:o}}=i,l=s.targets[0].values;let c=i.getValueOnIndex(l,n),u=i.getValueOnIndex(l,n+r),f;const d=o.domain(),h=i.updateXDomain(t,!0,!0);e?e===1||(c==null?void 0:c.x)===(u==null?void 0:u.x)?f=o(d[0])-o(h[0]):f=i.axis.isTimeSeries()?o(d[0])-o(h[0]):o((c==null?void 0:c.x)||0)-o(u.x):l.length!==1?f=o(d[0])-o(h[0]):i.axis.isTimeSeries()?(c=i.getValueOnIndex(l,0),u=i.getValueOnIndex(l,l.length-1),f=o(c.x)-o(u.x)):f=wa(h)/2;const m=wa(d)/wa(h);return`translate(${f},0) scale(${m},1)`}};let xg=()=>(xn(br.prototype,dC),jn.prototype.flow=fC.flow,(xg=()=>({}))());function yg(t){return Array.isArray(t)?t:[t]}function Tg(t){var e;t.state.canvasShape=null,(e=t.renderCanvasFrame)==null||e.call(t,void 0,null,!1)}function hu(t,e){const n=this.internal,{config:r}=n,i=r.transition_duration&&os(),s=`grid_${e}_lines`;return t?(r[s]=yg(t),n.state.isCanvasMode?(Tg(n),r[s]):(n.updateGrid(),n.redrawGrid(i),r[s])):r[s]}function bg(t,e){const n=`grid_${e}_lines`;return hu.bind(this)(this.internal.config[n].concat(t?yg(t):[]),e)}function Sg(t,e){var n;const r=this.internal;if(r.state.isCanvasMode){const i=((n=r.getGridFilterToRemove)==null?void 0:n.call(r,t))||(()=>!0),s=`grid_${e?"x":"y"}_lines`;r.config[s]=r.config[s].filter(o=>!i(o)),Tg(r);return}r.removeGridLines(t,e)}const Ag=function(t){return hu.bind(this)(t,"x")};xn(Ag,{add(t){return bg.bind(this)(t,"x")},remove(t){return Sg.bind(this)(t,!0)}});const Eg=function(t){return hu.bind(this)(t,"y")};xn(Eg,{add(t){return bg.bind(this)(t,"y")},remove(t){return Sg.bind(this)(t,!1)}});var Cg={xgrids:Ag,ygrids:Eg};const hC=`line.${nn.xgridFocus}:not(.${nn.xgridFocusContinuous}), line.${nn.ygridFocus}`,vC=t=>Ge(t.position)||"end",gC=t=>t.position==="start"?4:t.position==="middle"?0:-4;function Ig(t){var e;const{state:n,$el:{main:r}}=t,i=n._gridFocusEl,s=r.node(),o=((e=i==null?void 0:i.nodes)==null?void 0:e.call(i))||[];return o.length&&o.every(l=>s==null?void 0:s.contains(l))?i:n._gridFocusEl=r.selectAll(hC)}function Rg(t){t.$el.main.select(`line.${nn.xgridFocusContinuous}`).style("visibility","hidden")}function wg(t,e,n){return r=>{let i=t?0:e;return r.position==="start"?i=t?-n:0:r.position==="middle"&&(i=(t?-n:e)/2),i}}function Og(t,e){e==="grid"&&t.each(function(){const n=Yt(this);["x1","x2","y1","y2"].forEach(r=>n.attr(r,+n.attr(r)))})}var pC={hasGrid(){const{config:t}=this;return["x","y"].some(e=>t[`grid_${e}_show`]||t[`grid_${e}_lines`].length)},initGrid(){const t=this;t.hasGrid()&&t.initGridLines(),t.initFocusGrid()},initGridLines(){const t=this,{config:e,state:{clip:n},$el:r}=t;(e.grid_x_lines.length||e.grid_y_lines.length)&&(r.gridLines.main=r.main.insert("g",`.${ze.chart}${e.grid_lines_front?" + *":""}`).attr("clip-path",n.pathGrid).attr("class",`${yn.grid} ${yn.gridLines}`),r.gridLines.main.append("g").attr("class",yn.xgridLines),r.gridLines.main.append("g").attr("class",yn.ygridLines),r.gridLines.x=Ev([]))},updateXGrid(t){const e=this,{config:n,scale:r,state:i,$el:{main:s,grid:o}}=e,l=n.axis_rotated,c=e.generateGridData(n.grid_x_type,r.x),u=e.axis.isCategorized()?e.axis.x.tickOffset():0,f=d=>(r.zoom||r.x)(d)+u*(l?-1:1);i.xgridAttr=l?{x1:0,x2:i.width,y1:f,y2:f}:{x1:f,x2:f,y1:0,y2:i.height},o.x=s.select(`.${yn.xgrids}`).selectAll(`.${yn.xgrid}`).data(c),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",yn.xgrid).merge(o.x),t||o.x.each(function(){const d=Yt(this);Object.keys(i.xgridAttr).forEach(h=>{d.attr(h,i.xgridAttr[h])}),d.style("opacity",()=>+d.attr(l?"y1":"x1")===(l?i.height:0)?"0":null)})},updateYGrid(){const t=this,{axis:e,config:n,scale:r,state:i,$el:{grid:s,main:o}}=t,l=n.axis_rotated,c=d=>r.y(d),u=e.y.getGeneratedTicks(n.grid_y_ticks),f=u!=null&&u.length?u:t.scale.y.ticks(n.grid_y_ticks);s.y=o.select(`.${yn.ygrids}`).selectAll(`.${yn.ygrid}`).data(f),s.y.exit().remove(),s.y=s.y.enter().append("line").attr("class",yn.ygrid).merge(s.y),s.y.attr("x1",l?c:0).attr("x2",l?c:i.width).attr("y1",l?0:c).attr("y2",l?i.height:c),Og(s.y,"grid")},updateGrid(){const t=this,{$el:{grid:e,gridLines:n}}=t;!n.main&&t.initGridLines(),e.main.style("visibility",t.hasArcType()?"hidden":null),t.hideGridFocus(),t.updateGridLines("x"),t.updateGridLines("y")},updateGridLines(t){const e=this,{config:n,$el:{gridLines:r,main:i},$T:s}=e,o=n.axis_rotated,l=t==="x";n[`grid_${t}_show`]&&e[`update${t.toUpperCase()}Grid`]();let c=i.select(`.${yn[`${t}gridLines`]}`).selectAll(`.${yn[`${t}gridLine`]}`).data(n[`grid_${t}_lines`]);s(c.exit()).style("opacity","0").remove();const u=c.enter().append("g");u.append("line").style("opacity","0"),c=u.merge(c),c.each(function(f){const d=Yt(this);d.select("text").empty()&&f.text&&d.append("text").style("opacity","0")}),s(c.attr("class",f=>`${yn[`${t}gridLine`]} ${f.class||""}`.trim()).select("text").attr("text-anchor",vC).attr("transform",()=>l?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",gC).attr("dy",-5)).text(function(f){var d;return(d=f.text)!=null?d:this.remove()}),r[t]=c},redrawGrid(t){const e=this,{config:{axis_rotated:n},state:{width:r,height:i},$el:{gridLines:s},$T:o}=e,l=e.xv.bind(e),c=e.yv.bind(e);let u=s.x.select("line"),f=s.x.select("text"),d=s.y.select("line"),h=s.y.select("text");return u=o(u,t).attr("x1",n?0:l).attr("x2",n?r:l).attr("y1",n?l:0).attr("y2",n?l:i),f=o(f,t).attr("x",wg(!n,r,i)).attr("y",l),d=o(d,t).attr("x1",n?c:0).attr("x2",n?c:r).attr("y1",n?0:c).attr("y2",n?i:c),h=o(h,t).attr("x",wg(n,r,i)).attr("y",c),[u.style("opacity",null),f.style("opacity",null),d.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const t=this,{config:e,state:n,state:{clip:r},$el:i}=t;n._gridFocusEl=null;const s=e.grid_front,o=`.${s&&i.gridLines.main?yn.gridLines:ze.chart}${s?" + *":""}`,l=i.main.insert("g",o).attr("clip-path",r.pathGrid).attr("class",yn.grid);if(i.grid.main=l,e.grid_x_show&&l.append("g").attr("class",yn.xgrids),e.grid_y_show&&l.append("g").attr("class",yn.ygrids),e.axis_tooltip){const c=l.append("g").attr("class","bb-axis-tooltip");c.append("line").attr("class","bb-axis-tooltip-x"),c.append("line").attr("class","bb-axis-tooltip-y")}e.interaction_enabled&&e.grid_focus_show&&!e.axis_tooltip&&(l.append("g").attr("class",nn.xgridFocus).append("line").attr("class",nn.xgridFocus),e.grid_focus_y&&!e.tooltip_grouped&&l.append("g").attr("class",nn.ygridFocus).append("line").attr("class",nn.ygridFocus),e.subchart_grid_focus_continuous&&e.subchart_grid_focus!==!1&&i.main.insert("g",o).attr("class",nn.xgridFocusContinuous).append("line").attr("class",`${nn.xgridFocus} ${nn.xgridFocusContinuous}`).style("visibility","hidden"))},showAxisGridFocus(){var t,e;const n=this,{config:r,format:i,state:{event:s,width:o,height:l}}=n,c=r.axis_rotated,[u,f]=Jn(s,(t=n.$el.eventRect)==null?void 0:t.node()),d={x:u,y:f};for(const[h,m]of Object.entries(n.$el.axisTooltip)){const S=h==="x"&&!c||h!=="x"&&c?"x":"y",E=d[S];let C=(e=n.scale[h])==null?void 0:e.invert(E);C&&(C=h==="x"&&n.axis.isTimeSeries()?i.xAxisTick(C):C==null?void 0:C.toFixed(2),m==null||m.attr(S,E).text(C))}n.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,m){const S=Yt(this);m===0?S.attr("x1",u).attr("x2",u).attr("y1",m?0:l).attr("y2",m?l:0):S.attr("x1",m?0:o).attr("x2",m?o:0).attr("y1",f).attr("y2",f)})},hideAxisGridFocus(){const t=this;t.$el.main.selectAll(`line.${Rn.axisTooltipX}, line.${Rn.axisTooltipY}`).style("visibility","hidden"),Object.values(t.$el.axisTooltip).forEach(e=>e==null?void 0:e.style("display","none"))},showGridFocus(t){var e;const n=this,{config:r,state:{width:i,height:s}}=n,o=r.axis_rotated,l=Ig(n),c=(t||[l.datum()]).filter(d=>d&&Ge(n.getBaseValue(d)));if(!r.tooltip_show||c.length===0||!r.axis_x_forceAsSingle&&n.hasType("bubble")||n.hasArcType())return;const u=r.grid_focus_edge&&!r.tooltip_grouped,f=n.xx.bind(n);l.style("visibility",null).data(c.concat(c)).each(function(d){const h=Yt(this),m={x:f(d),y:n.getYScaleById(d.id)(d.value)};let S;if(h.classed(nn.xgridFocus))S=o?[null,m.x,u?m.y:i,m.x]:[m.x,u?m.y:null,m.x,s];else{const E=n.axis.getId(d.id)==="y2";S=o?[m.y,u&&!E?m.x:null,m.y,u&&E?m.x:s]:[u&&E?m.x:null,m.y,u&&!E?m.x:i,m.y]}["x1","y1","x2","y2"].forEach((E,C)=>h.attr(E,S[C]))}),Og(l,"grid"),(e=n.showCircleFocus)==null||e.call(n,t)},hideGridFocus(t=!1){var e;const n=this,{state:{inputType:r,resizing:i}}=n;(t||r==="mouse"||!i)&&(Ig(n).style("visibility","hidden"),Rg(n),(e=n.hideCircleFocus)==null||e.call(n))},updateGridFocus(){var t;const e=this,{state:{inputType:n,width:r,height:i,resizing:s},$el:{grid:o}}=e,l=o.main.select(`line.${nn.xgridFocus}`);if(n==="touch")l.empty()?s&&((t=e.showCircleFocus)==null||t.call(e)):e.showGridFocus();else{const c=e.config.axis_rotated;l.attr("x1",c?0:-10).attr("x2",c?r:-10).attr("y1",c?-10:0).attr("y2",c?-10:i),Rg(e)}return!0},generateGridData(t,e){const n=this,r=n.$el.main.select(`.${Rn.axisX}`).selectAll(".tick").size();let i=[];if(t==="year"){const s=n.getXDomain(n.data.targets),[o,l]=s.map(c=>c.getFullYear());for(let c=o;c<=l;c++)i.push(new Date(`${c}-01-01 00:00:00`))}else i=e.ticks(Bt),i.length>r&&(i=i.filter(s=>String(s).indexOf(".")<0));return i},getGridFilterToRemove(t){return t?e=>{let n=!1;return(qe(t)?t.concat():[t]).forEach(r=>{("value"in r&&e.value===r.value||"class"in r&&e.class===r.class)&&(n=!0)}),n}:()=>!0},removeGridLines(t,e){const n=this,{config:r,$T:i}=n,s=n.getGridFilterToRemove(t),o=f=>!s(f),l=e?yn.xgridLines:yn.ygridLines,c=e?yn.xgridLine:yn.ygridLine;i(n.$el.main.select(`.${l}`).selectAll(`.${c}`).filter(s)).style("opacity","0").remove();const u=`grid_${e?"x":"y"}_lines`;r[u]=r[u].filter(o)}},mC={grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:void 0,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0};let Pg=()=>(xn(br.prototype,pC),jn.prototype.xgrids=Cg.xgrids,jn.prototype.ygrids=Cg.ygrids,$a.setOptions([mC]),(Pg=()=>({}))());function Mg(t,e,n,r){const i=this,{config:s,$el:{main:o}}=i,l=s.data_selection_grouped,c=s.data_selection_isselectable.bind(i.api),u=sn(e)?[].concat(e):null,f=t&&!s.data_selection_multiple;let d=!f;const h=(m,S,E)=>{i.unselectPoint(m,S,E),m.interrupt().remove()};i.getTargetsToShow().forEach(m=>{const{id:S}=m,E=l||!u||u.indexOf(S)>=0,C=o.select(`.${on.selectedCircles}${i.getTargetSelectorSuffix(S)}`);m.values.forEach(w=>{const{index:$}=w,z=!n||n.indexOf($)>=0,B=C.selectAll(`.${on.selectedCircle}-${$}`),W=!B.empty();t?E&&z&&c(w)&&(!W||f)?(d||(Mg.call(i,!1),d=!0),i.selectPoint(null,w,$)):(!f||d)&&sn(r)&&r&&W&&h(B,w,$):E&&z&&W&&h(B,w,$)})})}function vu(t=!1,e,n,r){var i;const s=this,{config:o,$el:{main:l}}=s,c=o.data_selection_grouped,u=o.data_selection_isselectable.bind(s.api),f=t&&!o.data_selection_multiple;let d=!f;if(o.data_selection_enabled){if(f&&(n=n!=null&&n.length?[n[0]]:[0],c||(e=(sn(e)?[].concat(e):s.getTargetsToShow().map(m=>m.id)).slice(0,1))),(i=s.isPointFocusOnly)!=null&&i.call(s)){Mg.call(s,t,e,n,r);return}l.selectAll(`.${Tn.shapes}`).selectAll(`.${Tn.shape}`).each(function(h){const m=Yt(this),{id:S,index:E}=h.data?h.data:h,C=c||!e||e.indexOf(S)>=0,w=!n||n.indexOf(E)>=0;if(m.classed(Mr.line)||m.classed(To.area))return;const $=s.getToggle(this,h).bind(s),z=m.classed(on.SELECTED);t?C&&w&&u(h)&&(!z||f)?(d||(vu.call(s,!1),d=!0),!m.classed(on.SELECTED)&&$(!0,m.classed(on.SELECTED,!0),h,E)):(!f||d)&&sn(r)&&r&&z&&$(!1,m.classed(on.SELECTED,!1),h,E):C&&w&&u(h)&&z&&$(!1,m.classed(on.SELECTED,!1),h,E)})}}var xC={selected(t){var e,n;const r=this.internal,i=[];return r.state.isCanvasMode?((e=r.getCanvasSelectedData)==null?void 0:e.call(r,t))||i:(n=r.isPointFocusOnly)!=null&&n.call(r)?(r.$el.main.selectAll(`.${on.selectedCircles+r.getTargetSelectorSuffix(t)}`).selectAll(`.${on.selectedCircle}`).each(s=>i.push(s)),i):(r.$el.main.selectAll(`.${Tn.shapes+r.getTargetSelectorSuffix(t)}`).selectAll(`.${Tn.shape}`).filter(function(){return Yt(this).classed(on.SELECTED)}).each(s=>i.push(s)),i)},select(t,e,n){var r;const i=this.internal;if(i.state.isCanvasMode){(r=i.setCanvasSelection)==null||r.call(i,!0,t,e,n);return}vu.bind(i)(!0,t,e,n)},unselect(t,e){var n;const r=this.internal;if(r.state.isCanvasMode){(n=r.setCanvasSelection)==null||n.call(r,!1,t,e);return}vu.bind(r)(!1,t,e)}},yC={drag(t){const e=this,{config:n,state:r,$el:{main:i}}=e,s=n.data_selection_grouped,o=n.interaction_enabled&&n.data_selection_isselectable;if(e.hasArcType()||!n.data_selection_enabled||n.zoom_enabled&&!e.zoom.altDomain||!n.data_selection_multiple)return;const[l,c]=r.dragStart||[0,0],[u,f]=t,d=Math.min(l,u),h=Math.max(l,u),m=s?r.margin.top:Math.min(c,f),S=s?r.height:Math.max(c,f),E=()=>{!e||!e.$el||!e.$el.main||(i.select(`.${Na.dragarea}`).attr("x",d).attr("y",m).attr("width",h-d).attr("height",S-m),i.selectAll(`.${Tn.shapes}`).selectAll(`.${Tn.shape}`).filter(C=>o==null?void 0:o.bind(e.api)(C)).each(function(C,w){const $=Yt(this),z=$.classed(on.SELECTED),B=$.classed(Na.INCLUDED);let W,H;if($.classed($n.circle)){const _=+$.attr("cx"),q=+$.attr("cy");H=e.togglePoint,W=d<_&&_<h&&m<q&&q<S}else if($.classed(rr.bar)){const{x:_,y:q,width:st,height:it}=wh(this);H=e.togglePath,W=!(h<_||_+st<d)&&!(S<q||q+it<m)}else return;W^B&&($.classed(Na.INCLUDED,!B),$.classed(on.SELECTED,!z),H.call(e,!z,$,C,w))}))};Ph(e.state,E)},dragstart(t){const e=this,{config:n,state:r,$el:{main:i}}=e;e.hasArcType()||!n.data_selection_enabled||(r.dragStart=t,i.select(`.${ze.chart}`).append("rect").attr("class",Na.dragarea).style("opacity","0.1"),e.setDragStatus(!0))},dragend(){const t=this,{config:e,$el:{main:n},$T:r}=t;t.hasArcType()||!e.data_selection_enabled||(r(n.select(`.${Na.dragarea}`)).style("opacity","0").remove(),n.selectAll(`.${Tn.shape}`).classed(Na.INCLUDED,!1),t.setDragStatus(!1))}},TC=Object.defineProperty,bC=Object.defineProperties,SC=Object.getOwnPropertyDescriptors,Lg=Object.getOwnPropertySymbols,AC=Object.prototype.hasOwnProperty,EC=Object.prototype.propertyIsEnumerable,Dg=(t,e,n)=>e in t?TC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,CC=(t,e)=>{for(var n in e||(e={}))AC.call(e,n)&&Dg(t,n,e[n]);if(Lg)for(var n of Lg(e))EC.call(e,n)&&Dg(t,n,e[n]);return t},IC=(t,e)=>bC(t,SC(e)),RC=IC(CC({},yC),{selectPoint(t,e,n){const r=this,{config:i,$el:{main:s},$T:o}=r,l=i.axis_rotated,c=(l?r.circleY:r.circleX).bind(r),u=(l?r.circleX:r.circleY).bind(r),f=r.pointSelectR.bind(r);Ne(i.data_onselected,r.api,e,t==null?void 0:t.node()),o(s.select(`.${on.selectedCircles}${r.getTargetSelectorSuffix(e.id)}`).selectAll(`.${on.selectedCircle}-${n}`).data([e]).enter().append("circle").attr("class",()=>r.generateClass(on.selectedCircle,n)).attr("cx",c).attr("cy",u).attr("stroke",r.color).attr("r",d=>r.pointSelectR(d)*1.4)).attr("r",f)},unselectPoint(t,e,n){const r=this,{config:i,$el:{main:s},$T:o}=r;Ne(i.data_onunselected,r.api,e,t==null?void 0:t.node()),o(s.select(`.${on.selectedCircles}${r.getTargetSelectorSuffix(e.id)}`).selectAll(`.${on.selectedCircle}-${n}`)).attr("r",0).remove()},togglePoint(t,e,n,r){this[`${t?"":"un"}selectPoint`](e,n,r)},selectPath(t,e){const n=this,{config:r}=n;Ne(r.data_onselected,n.api,e,t.node()),r.interaction_brighten&&t.style("filter","brightness(1.25)")},unselectPath(t,e){const n=this,{config:r}=n;Ne(r.data_onunselected,n.api,e,t.node()),r.interaction_brighten&&t.style("filter",null)},togglePath(t,e,n,r){this[`${t?"":"un"}selectPath`](e,n,r)},getToggle(t,e){const n=this;return t.nodeName==="path"?n.togglePath:n.isStepType(e)?()=>{}:n.togglePoint},toggleShape(t,e,n){var r;const i=this,{config:s,$el:{main:o}}=i;if(s.data_selection_enabled&&s.data_selection_isselectable.bind(i.api)(e)){const l=Yt(t),c=l.classed(on.SELECTED),u=i.getToggle(t,e).bind(i);let f;if(!s.data_selection_multiple){const d=(r=i.isPointFocusOnly)==null?void 0:r.call(i);let h=`.${d?on.selectedCircles:Tn.shapes}`;s.data_selection_grouped&&(h+=i.getTargetSelectorSuffix(e.id)),o.selectAll(h).selectAll(d?`.${on.selectedCircle}`:`.${Tn.shape}.${on.SELECTED}`).classed(on.SELECTED,!1).each(function(m){const S=Yt(this);f=S,u(!1,S,m,m.index)})}(!f||f.node()!==l.node())&&(l.classed(on.SELECTED,!c),u(!c,l,e,n))}}}),wC={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:()=>!0,data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:()=>{},data_onunselected:()=>{}};let Fg=()=>(xn(br.prototype,RC),xn(jn.prototype,xC),$a.setOptions([wC]),(Fg=()=>!0)());const Ng=function(t){var e,n;const r=this.internal,{axis:i,brush:s,config:o,scale:{x:l,subX:c},state:u}=r;let f;return u.isCanvasMode?(o.subchart_show&&(f=t,Array.isArray(f)?(f=i.isTimeSeries()?f.map(d=>Wn.bind(r)(d)):f,f=r.setCanvasSubchartDomain(f)||u.domain):f=(e=u.domain)!=null?e:l.orgDomain()),f):(o.subchart_show&&(f=t,Array.isArray(f)?(i.isTimeSeries()&&(f=f.map(h=>Wn.bind(r)(h))),r.withinRange(f,r.getZoomDomain("subX",!0),r.getZoomDomain("subX"))&&(u.domain=f.slice(),s.move(s.getSelection(),f.map(c)))):f=(n=u.domain)!=null?n:l.orgDomain()),f)};xn(Ng,{show(){var t,e,n;const r=this.internal,{$el:{subchart:i},config:s}=r,o=s.subchart_show;if(!o){if(r.state.isCanvasMode){(t=r.unbindZoomEvent)==null||t.call(r),s.subchart_show=!0,this.resize();return}r.unbindZoomEvent(),s.subchart_show=!o,!i.main&&r.initSubchart();let l=i.main.selectAll(`.${ze.target}`);r.data.targets.length!==l.size()&&(r.updateSizes(),r.updateTargetsForSubchart(r.data.targets),l=(e=i.main)==null?void 0:e.selectAll(`.${ze.target}`)),l==null||l.style("opacity",null),(n=i.main)==null||n.style("display",null),this.resize()}},hide(){var t;const e=this.internal,{$el:{subchart:{main:n}},config:r}=e;if(e.state.isCanvasMode){r.subchart_show&&(r.subchart_show=!1,this.resize(),(t=e.bindZoomEvent)==null||t.call(e));return}r.subchart_show&&(n==null?void 0:n.style("display"))!=="none"&&(r.subchart_show=!1,n.style("display","none"),this.resize())},toggle(){const t=this.internal,{config:e}=t;this.subchart[e.subchart_show?"hide":"show"]()},reset(){var t;const e=this.internal,{brush:n}=e;if(e.state.isCanvasMode){(t=e.clearCanvasSubchartDomain)==null||t.call(e,!0,!1);return}n.clear(n.getSelection())}});var OC={subchart:Ng};const $g=["bar","line","bubble","candlestick","scatter"],PC=["opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width"];function Bg(t,e){var n,r;const i=(r=(n=t.$el.grid)==null?void 0:n.main)==null?void 0:r.select(`line.${Re.xgridFocus}`).node();if(!i||!se.getComputedStyle)return;const s=se.getComputedStyle(i);PC.forEach(o=>{const l=s.getPropertyValue(o);l&&e.style(o,l)})}function mi(t,e){const n=Number(t);return Number.isFinite(n)?n:e}function MC(t){var e,n;if(!rc(t))return!1;const{config:r,state:i,$el:s}=t,o=(n=(e=s.grid)==null?void 0:e.main)==null?void 0:n.select(`line.${Re.xgridFocus}:not(.${Re.xgridFocusContinuous})`),l=s.main.select(`line.${Re.xgridFocusContinuous}`);if(!(o!=null&&o.node())||!l.node())return!1;const c=i.margin2.left-i.margin.left+i.width2,u=i.margin2.top-i.margin.top+i.height2;return Bg(t,l),r.axis_rotated?l.attr("x1",mi(o.attr("x1"),0)).attr("x2",c).attr("y1",mi(o.attr("y1"),-10)).attr("y2",mi(o.attr("y2"),-10)):l.attr("x1",mi(o.attr("x1"),-10)).attr("x2",mi(o.attr("x2"),-10)).attr("y1",mi(o.attr("y1"),0)).attr("y2",u),l.style("visibility",null),o.style("visibility","hidden"),!0}function LC(t){var e;(e=t.$el.main)==null||e.select(`line.${Re.xgridFocusContinuous}`).style("visibility","hidden")}function DC(t,e,n){const{config:r,state:i}=t,[s,o]=Jn(e,n),l=Td(t,r.axis_rotated?o:s);return l===null?null:r.axis_rotated?[i.width/2,l]:[l,i.height/2]}function gu(t,e,n,r){var i,s;const o=(s=(i=t.$el.eventRect)==null?void 0:i.node)==null?void 0:s.call(i);if(!o)return;const l=DC(t,n,r)||[0,0],c=ln(o,!0),u=c.left+l[0],f=c.top+l[1],d={bubbles:!0,cancelable:!0,screenX:u,screenY:f,clientX:u,clientY:f};/^touch/.test(e)?wc.touch(o,e,d):wc.mouse(o,e,d)}var FC={isSubchartBrushEnabled(){const{config:t}=this;return t.subchart_show&&t.subchart_brush_enabled!==!1},bindSubchartEventRect(t){const e=this,{config:n,state:r}=e;t.on("mouseover mousemove mouseout touchstart touchmove touchend",null),n.interaction_enabled&&(r.inputType==="mouse"?t.on("mouseover mousemove",function(i){e.isSubchartBrushEnabled()||gu(e,i.type,i,this)}).on("mouseout",function(i){e.isSubchartBrushEnabled()||gu(e,"mouseout",i,this)}):r.inputType==="touch"&&t.on("touchstart touchmove touchend",function(i){var s;e.isSubchartBrushEnabled()||((s=i.touches)==null?void 0:s.length)>1||gu(e,i.type,i,this)}))},initBrush(){const t=this,{config:e,scale:n,$el:{subchart:r},state:i}=t,s=e.axis_rotated,o=e.subchart_size_height;let l,c,u;t.brush=(s?oA():sA()).handleSize(5),t.brush.on("start brush end",f=>{const{selection:d,sourceEvent:h,target:m,type:S}=f;S==="start"&&(t.state.inputType==="touch"&&t.hideTooltip(),c=h?d:null),/(start|brush)/.test(S)&&(S==="brush"&&h&&i.domain&&(c==null||c.forEach((E,C)=>{E!==d[C]&&(i.domain[C]=n.x.orgDomain()[C])})),t.redrawForBrush(S!=="start")),S==="end"&&(l=n.x.orgDomain()),m!=null&&m.handle&&(d===null?t.brush.handle.attr("display","none"):t.brush.handle.attr("display",null).attr("transform",(E,C)=>{const w=[d[C],o/2];return`translate(${s?w.reverse():w})`}))}),t.brush.updateResize=function(){u&&clearTimeout(u),u=setTimeout(()=>{const f=this.getSelection();l&&vv(f.node())&&this.move(f,l.map(n.subX.orgScale()))},0)},t.brush.update=function(){var f;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((f=r.main)==null||f.select(`.${Re.brush}`).call(this)),this},t.brush.scale=function(f){const d=e.subchart_size_height;let h=t.axis.getExtent();!h&&f.range?h=[[0,0],[f.range()[1],d]]:qe(h)&&(h=h.map((m,S)=>[m,S>0?d:S])),s&&h[1].reverse(),this.extent(h),this.update()},t.brush.getSelection=()=>r.main?r.main.select(`.${Re.brush}`):Yt([])},initSubchart(){const t=this,{config:e,state:{clip:n,hasAxis:r},$el:{defs:i,svg:s,subchart:o,axis:l}}=t;if(!r)return;const c=e.subchart_show?null:"hidden",u=`${n.id}-subchart`,f=t.getClipPath(u);n.idSubchart=u,t.appendClip(i,u),t.initBrush(),o.main=s.append("g").classed(Re.subchart,!0).attr("transform",t.getTranslate("context"));const{main:d}=o;d.style("visibility",c),d.append("g").attr("clip-path",f).attr("class",Re.chart),t.withSubchartTypeContext(()=>{$g.forEach(m=>{const S=Ln(/^(bubble|scatter)$/.test(m)?"circle":m);if(t.hasType(m)||t.hasTypeOf(S)){const E=d.select(`.${Re.chart}`),C=Re[`chart${S}s`];E.select(`.${C}`).empty()&&E.append("g").attr("class",C)}})});const h=d.append("g").attr("clip-path",f).attr("class",Re.brush).style("pointer-events",t.isSubchartBrushEnabled()?null:"none").call(t.brush);e.subchart_showHandle&&t.addBrushHandle(h),o.eventRect=d.append("g").attr("clip-path",f).attr("class",`${Re.eventRects} ${Re.eventRects}-subchart`).style("fill-opacity","0").style("pointer-events",t.isSubchartBrushEnabled()?"none":"all").append("rect").attr("class",`${Re.eventRect} ${Re.eventRect}-subchart`).attr("width",t.state.width2).attr("height",t.state.height2),t.bindSubchartEventRect(o.eventRect),d.append("g").attr("clip-path",f).attr("class",Re.xgridFocus).append("line").attr("class",Re.xgridFocus).style("visibility","hidden"),l.subX=d.append("g").attr("class",Re.axisX).attr("transform",t.getTranslate("subX")).attr("clip-path",e.axis_rotated?"":n.pathXAxis).style("visibility",e.subchart_axis_x_show?c:"hidden"),l.subY=d.append("g").attr("class",Re.axisY).attr("transform",t.getTranslate("subY")).style("visibility",e.subchart_axis_y_show?c:"hidden"),l.subY2=d.append("g").attr("class",Re.axisY2).attr("transform",t.getTranslate("subY2")).style("visibility",e.subchart_axis_y2_show?c:"hidden")},addBrushHandle(t){const e=this,{config:n}=e,r=n.axis_rotated,i=n.subchart_init_range,s="handle--custom",o=de[r?"y":"x"];e.brush.handle=t.selectAll(`.${s}`).data(r?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",s).attr("cursor",`${r?"ns":"ew"}-resize`).attr("d",l=>o[/[se]/.test(l.type)?"end":"start"]).attr("display",i?null:"none")},updateTargetsForSubchart(t){var e;const n=this,{config:r,state:i,$el:{subchart:{main:s}}}=n;r.subchart_show&&(n.withSubchartTypeContext(()=>{$g.filter(o=>n.hasType(o)||n.hasTypeOf(Ln(o))).forEach(o=>{const l=/^(bubble|scatter)$/.test(o),c=Ln(l?"circle":o),u=n.getChartClass(c,!0),f=n.getClass(l?"circles":`${o}s`,!0),d=s.select(`.${Re[`chart${`${c}s`}`]}`);if(l){const h=d.selectAll(`.${Re.circles}`).data(t.filter(n[`is${Ln(o)}Type`].bind(n))).attr("class",f);h.exit().remove(),h.enter().append("g").attr("class",f)}else{const h=d.selectAll(`.${Re[`chart${c}`]}`).attr("class",u).data(t.filter(n[`is${c}Type`].bind(n))),m=h.enter().append("g").style("opacity","0").attr("class",u).append("g").attr("class",f);h.exit().remove(),o==="line"&&n.hasTypeOf("Area")&&m.append("g").attr("class",n.getClass("areas",!0))}})}),s.selectAll(`.${Re.brush} rect`).attr(r.axis_rotated?"width":"height",r.axis_rotated?i.width2:i.height2),(e=n.$el.subchart.eventRect)==null||e.attr("width",i.width2).attr("height",i.height2).style("pointer-events",n.isSubchartBrushEnabled()?"none":"all"))},updateSubchartYDomain(t){var e,n;const r=this,{scale:i}=r,s=t||r.filterTargetsToShow(r.data.targets);(e=i.subY)==null||e.domain(r.getYDomain(s,"y")),(n=i.subY2)==null||n.domain(r.getYDomain(s,"y2"))},redrawSubchart(t,e){var n,r,i,s;const o=this,{config:l,$el:{subchart:{main:c}},state:u}=o,f=!!e;if(c.style("visibility",l.subchart_show?null:"hidden"),c.select(`.${Re.brush}`).style("pointer-events",o.isSubchartBrushEnabled()?null:"none"),(n=o.$el.subchart.eventRect)==null||n.style("pointer-events",o.isSubchartBrushEnabled()?"none":"all"),(r=o.$el.axis.subY)==null||r.style("visibility",l.subchart_axis_y_show?null:"hidden"),(i=o.$el.axis.subY2)==null||i.style("visibility",l.subchart_axis_y2_show?null:"hidden"),l.subchart_show&&(((s=u.event)==null?void 0:s.type)==="zoom"&&o.brush.update(),t)){const d=l.subchart_init_range;!pv(o)&&o.brush.update(),o.withSubchartTypeContext(()=>{const h=u._targetsToShow||o.filterTargetsToShow(o.data.targets);o.updateSubchartYDomain(h);const m=o.getDrawShape();if(Object.keys(m.type).forEach(S=>{const E=Ln(S),C=o[`generateDraw${E}`](m.indices[S],!0);o[`update${E}`](f,!0),o[`redraw${E}`](C,f,!0)}),o.hasType("bubble")||o.hasType("scatter")){const{cx:S}=m.pos,E=o.updateCircleY(!0);o.updateCircle(!0),o.redrawCircle(S,E,f,void 0,!0)}}),!u.rendered&&d&&(u.domain=d,o.brush.move(o.brush.getSelection(),d.map(o.scale.x)))}},showSubchartGridFocus(t){const e=this,{config:n,state:r,$el:{subchart:{main:i}}}=e;if(!i||!n.subchart_show||e.isSubchartBrushEnabled()||n.grid_focus_show===!1||n.subchart_grid_focus===!1||!n.tooltip_show||n.axis_tooltip)return;const o=(Array.isArray(t)?t:[t]).find(u=>u&&e.getBaseValue(u)!=null);if(!o){e.hideSubchartGridFocus();return}const l=e.scale.subX(o.x);if(!Number.isFinite(l)){e.hideSubchartGridFocus();return}const c=i.select(`g.${Re.xgridFocus} line.${Re.xgridFocus}`);if(MC(e)){c.style("visibility","hidden");return}Bg(e,c),n.axis_rotated?c.attr("x1",0).attr("x2",r.width2).attr("y1",l).attr("y2",l):c.attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",r.height2),c.style("visibility",null)},hideSubchartGridFocus(){var t;LC(this),(t=this.$el.subchart.main)==null||t.select(`g.${Re.xgridFocus} line.${Re.xgridFocus}`).style("visibility","hidden")},redrawForBrush(t=!0){var e;const n=this,{config:{subchart_onbrush:r,zoom_rescale:i},scale:s,state:o}=n;n.redraw({withTransition:!1,withY:i,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),t&&o.rendered&&r.bind(n.api)((e=o.domain)!=null?e:s.x.orgDomain())},transformContext(t,e){const n=this,{$el:{subchart:r},$T:i}=n,s=e!=null&&e.axisSubX?e.axisSubX:i(r.main.select(`.${Re.axisX}`),t),o=e!=null&&e.axisSubY?e.axisSubY:i(r.main.select(`.${Re.axisY}`),t),l=e!=null&&e.axisSubY2?e.axisSubY2:i(r.main.select(`.${Re.axisY2}`),t);r.main.attr("transform",n.getTranslate("context")),s.attr("transform",n.getTranslate("subX")),o.attr("transform",n.getTranslate("subY")),l.attr("transform",n.getTranslate("subY2"))}},NC={subchart_show:!1,subchart_type:void 0,subchart_types:{},subchart_brush_enabled:!0,subchart_showHandle:!1,subchart_size_height:60,subchart_grid_focus:!0,subchart_grid_focus_continuous:!1,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_count:void 0,subchart_axis_x_tick_values:void 0,subchart_axis_x_tick_culling:void 0,subchart_axis_x_tick_culling_max:void 0,subchart_axis_x_tick_culling_lines:void 0,subchart_axis_x_tick_culling_reverse:void 0,subchart_axis_x_tick_outer:void 0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_axis_y_show:!1,subchart_axis_y_tick_show:!0,subchart_axis_y_tick_count:void 0,subchart_axis_y_tick_values:void 0,subchart_axis_y_tick_culling:void 0,subchart_axis_y_tick_culling_max:void 0,subchart_axis_y_tick_culling_lines:void 0,subchart_axis_y_tick_culling_reverse:void 0,subchart_axis_y_tick_outer:void 0,subchart_axis_y_tick_format:void 0,subchart_axis_y_tick_text_show:!0,subchart_axis_y2_show:!1,subchart_axis_y2_tick_show:!0,subchart_axis_y2_tick_count:void 0,subchart_axis_y2_tick_values:void 0,subchart_axis_y2_tick_culling:void 0,subchart_axis_y2_tick_culling_max:void 0,subchart_axis_y2_tick_culling_lines:void 0,subchart_axis_y2_tick_culling_reverse:void 0,subchart_axis_y2_tick_outer:void 0,subchart_axis_y2_tick_format:void 0,subchart_axis_y2_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:()=>{}};let zg=()=>(xn(br.prototype,FC),xn(jn.prototype,OC),$a.setOptions([NC]),(zg=()=>!0)());var $C=1e-12;function Ug(t){return((t=Math.exp(t))+1/t)/2}function BC(t){return((t=Math.exp(t))-1/t)/2}function zC(t){return((t=Math.exp(2*t))-1)/(t+1)}var UC=(function t(e,n,r){function i(s,o){var l=s[0],c=s[1],u=s[2],f=o[0],d=o[1],h=o[2],m=f-l,S=d-c,E=m*m+S*S,C,w;if(E<$C)w=Math.log(h/u)/e,C=function(_){return[l+_*m,c+_*S,u*Math.exp(e*_*w)]};else{var $=Math.sqrt(E),z=(h*h-u*u+r*E)/(2*u*n*$),B=(h*h-u*u-r*E)/(2*h*n*$),W=Math.log(Math.sqrt(z*z+1)-z),H=Math.log(Math.sqrt(B*B+1)-B);w=(H-W)/e,C=function(_){var q=_*w,st=Ug(W),it=u/(n*$)*(st*zC(e*q+W)-BC(W));return[l+it*m,c+it*S,u*st/Ug(e*q+W)]}}return C.duration=w*1e3*e/Math.SQRT2,C}return i.rho=function(s){var o=Math.max(.001,+s),l=o*o,c=l*l;return t(o,l,c)},i})(Math.SQRT2,2,4),_o=(t=>()=>t);function kC(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ta(t,e,n){this.k=t,this.x=e,this.y=n}ta.prototype={constructor:ta,scale:function(t){return t===1?this:new ta(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ta(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var fr=new ta(1,0,0);pu.prototype=ta.prototype;function pu(t){for(;!t.__zoom;)if(!(t=t.parentNode))return fr;return t.__zoom}function mu(t){t.stopImmediatePropagation()}function xs(t){t.preventDefault(),t.stopImmediatePropagation()}function GC(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function XC(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function kg(){return this.__zoom||fr}function WC(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function VC(){return navigator.maxTouchPoints||"ontouchstart"in this}function jC(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function HC(){var t=GC,e=XC,n=jC,r=WC,i=VC,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=UC,u=Io("start","zoom","end"),f,d,h,m=500,S=150,E=0,C=10;function w(tt){tt.property("__zoom",kg).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",st).on("dblclick.zoom",it).filter(i).on("touchstart.zoom",ot).on("touchmove.zoom",ct).on("touchend.zoom touchcancel.zoom",gt).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(tt,ft,lt,bt){var St=tt.selection?tt.selection():tt;St.property("__zoom",kg),tt!==St?W(tt,ft,lt,bt):St.interrupt().each(function(){H(this,arguments).event(bt).start().zoom(null,typeof ft=="function"?ft.apply(this,arguments):ft).end()})},w.scaleBy=function(tt,ft,lt,bt){w.scaleTo(tt,function(){var St=this.__zoom.k,Mt=typeof ft=="function"?ft.apply(this,arguments):ft;return St*Mt},lt,bt)},w.scaleTo=function(tt,ft,lt,bt){w.transform(tt,function(){var St=e.apply(this,arguments),Mt=this.__zoom,Ot=lt==null?B(St):typeof lt=="function"?lt.apply(this,arguments):lt,Kt=Mt.invert(Ot),ee=typeof ft=="function"?ft.apply(this,arguments):ft;return n(z($(Mt,ee),Ot,Kt),St,o)},lt,bt)},w.translateBy=function(tt,ft,lt,bt){w.transform(tt,function(){return n(this.__zoom.translate(typeof ft=="function"?ft.apply(this,arguments):ft,typeof lt=="function"?lt.apply(this,arguments):lt),e.apply(this,arguments),o)},null,bt)},w.translateTo=function(tt,ft,lt,bt,St){w.transform(tt,function(){var Mt=e.apply(this,arguments),Ot=this.__zoom,Kt=bt==null?B(Mt):typeof bt=="function"?bt.apply(this,arguments):bt;return n(fr.translate(Kt[0],Kt[1]).scale(Ot.k).translate(typeof ft=="function"?-ft.apply(this,arguments):-ft,typeof lt=="function"?-lt.apply(this,arguments):-lt),Mt,o)},bt,St)};function $(tt,ft){return ft=Math.max(s[0],Math.min(s[1],ft)),ft===tt.k?tt:new ta(ft,tt.x,tt.y)}function z(tt,ft,lt){var bt=ft[0]-lt[0]*tt.k,St=ft[1]-lt[1]*tt.k;return bt===tt.x&&St===tt.y?tt:new ta(tt.k,bt,St)}function B(tt){return[(+tt[0][0]+ +tt[1][0])/2,(+tt[0][1]+ +tt[1][1])/2]}function W(tt,ft,lt,bt){tt.on("start.zoom",function(){H(this,arguments).event(bt).start()}).on("interrupt.zoom end.zoom",function(){H(this,arguments).event(bt).end()}).tween("zoom",function(){var St=this,Mt=arguments,Ot=H(St,Mt).event(bt),Kt=e.apply(St,Mt),ee=lt==null?B(Kt):typeof lt=="function"?lt.apply(St,Mt):lt,Ae=Math.max(Kt[1][0]-Kt[0][0],Kt[1][1]-Kt[0][1]),Ee=St.__zoom,Te=typeof ft=="function"?ft.apply(St,Mt):ft,De=c(Ee.invert(ee).concat(Ae/Ee.k),Te.invert(ee).concat(Ae/Te.k));return function(me){if(me===1)me=Te;else{var Pe=De(me),Zt=Ae/Pe[2];me=new ta(Zt,ee[0]-Pe[0]*Zt,ee[1]-Pe[1]*Zt)}Ot.zoom(null,me)}})}function H(tt,ft,lt){return!lt&&tt.__zooming||new _(tt,ft)}function _(tt,ft){this.that=tt,this.args=ft,this.active=0,this.sourceEvent=null,this.extent=e.apply(tt,ft),this.taps=0}_.prototype={event:function(tt){return tt&&(this.sourceEvent=tt),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(tt,ft){return this.mouse&&tt!=="mouse"&&(this.mouse[1]=ft.invert(this.mouse[0])),this.touch0&&tt!=="touch"&&(this.touch0[1]=ft.invert(this.touch0[0])),this.touch1&&tt!=="touch"&&(this.touch1[1]=ft.invert(this.touch1[0])),this.that.__zoom=ft,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(tt){var ft=Yt(this.that).datum();u.call(tt,this.that,new kC(tt,{sourceEvent:this.sourceEvent,target:w,type:tt,transform:this.that.__zoom,dispatch:u}),ft)}};function q(tt,...ft){if(!t.apply(this,arguments))return;var lt=H(this,ft).event(tt),bt=this.__zoom,St=Math.max(s[0],Math.min(s[1],bt.k*Math.pow(2,r.apply(this,arguments)))),Mt=ur(tt);if(lt.wheel)(lt.mouse[0][0]!==Mt[0]||lt.mouse[0][1]!==Mt[1])&&(lt.mouse[1]=bt.invert(lt.mouse[0]=Mt)),clearTimeout(lt.wheel);else{if(bt.k===St)return;lt.mouse=[Mt,bt.invert(Mt)],di(this),lt.start()}xs(tt),lt.wheel=setTimeout(Ot,S),lt.zoom("mouse",n(z($(bt,St),lt.mouse[0],lt.mouse[1]),lt.extent,o));function Ot(){lt.wheel=null,lt.end()}}function st(tt,...ft){if(h||!t.apply(this,arguments))return;var lt=tt.currentTarget,bt=H(this,ft,!0).event(tt),St=Yt(tt.view).on("mousemove.zoom",ee,!0).on("mouseup.zoom",Ae,!0),Mt=ur(tt,lt),Ot=tt.clientX,Kt=tt.clientY;Fc(tt.view),mu(tt),bt.mouse=[Mt,this.__zoom.invert(Mt)],di(this),bt.start();function ee(Ee){if(xs(Ee),!bt.moved){var Te=Ee.clientX-Ot,De=Ee.clientY-Kt;bt.moved=Te*Te+De*De>E}bt.event(Ee).zoom("mouse",n(z(bt.that.__zoom,bt.mouse[0]=ur(Ee,lt),bt.mouse[1]),bt.extent,o))}function Ae(Ee){St.on("mousemove.zoom mouseup.zoom",null),Nc(Ee.view,bt.moved),xs(Ee),bt.event(Ee).end()}}function it(tt,...ft){if(t.apply(this,arguments)){var lt=this.__zoom,bt=ur(tt.changedTouches?tt.changedTouches[0]:tt,this),St=lt.invert(bt),Mt=lt.k*(tt.shiftKey?.5:2),Ot=n(z($(lt,Mt),bt,St),e.apply(this,ft),o);xs(tt),l>0?Yt(this).transition().duration(l).call(W,Ot,bt,tt):Yt(this).call(w.transform,Ot,bt,tt)}}function ot(tt,...ft){if(t.apply(this,arguments)){var lt=tt.touches,bt=lt.length,St=H(this,ft,tt.changedTouches.length===bt).event(tt),Mt,Ot,Kt,ee;for(mu(tt),Ot=0;Ot<bt;++Ot)Kt=lt[Ot],ee=ur(Kt,this),ee=[ee,this.__zoom.invert(ee),Kt.identifier],St.touch0?!St.touch1&&St.touch0[2]!==ee[2]&&(St.touch1=ee,St.taps=0):(St.touch0=ee,Mt=!0,St.taps=1+!!f);f&&(f=clearTimeout(f)),Mt&&(St.taps<2&&(d=ee[0],f=setTimeout(function(){f=null},m)),di(this),St.start())}}function ct(tt,...ft){if(this.__zooming){var lt=H(this,ft).event(tt),bt=tt.changedTouches,St=bt.length,Mt,Ot,Kt,ee;for(xs(tt),Mt=0;Mt<St;++Mt)Ot=bt[Mt],Kt=ur(Ot,this),lt.touch0&&lt.touch0[2]===Ot.identifier?lt.touch0[0]=Kt:lt.touch1&&lt.touch1[2]===Ot.identifier&&(lt.touch1[0]=Kt);if(Ot=lt.that.__zoom,lt.touch1){var Ae=lt.touch0[0],Ee=lt.touch0[1],Te=lt.touch1[0],De=lt.touch1[1],me=(me=Te[0]-Ae[0])*me+(me=Te[1]-Ae[1])*me,Pe=(Pe=De[0]-Ee[0])*Pe+(Pe=De[1]-Ee[1])*Pe;Ot=$(Ot,Math.sqrt(me/Pe)),Kt=[(Ae[0]+Te[0])/2,(Ae[1]+Te[1])/2],ee=[(Ee[0]+De[0])/2,(Ee[1]+De[1])/2]}else if(lt.touch0)Kt=lt.touch0[0],ee=lt.touch0[1];else return;lt.zoom("touch",n(z(Ot,Kt,ee),lt.extent,o))}}function gt(tt,...ft){if(this.__zooming){var lt=H(this,ft).event(tt),bt=tt.changedTouches,St=bt.length,Mt,Ot;for(mu(tt),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),Mt=0;Mt<St;++Mt)Ot=bt[Mt],lt.touch0&&lt.touch0[2]===Ot.identifier?delete lt.touch0:lt.touch1&&lt.touch1[2]===Ot.identifier&&delete lt.touch1;if(lt.touch1&&!lt.touch0&&(lt.touch0=lt.touch1,delete lt.touch1),lt.touch0)lt.touch0[1]=this.__zoom.invert(lt.touch0[0]);else if(lt.end(),lt.taps===2&&(Ot=ur(Ot,this),Math.hypot(d[0]-Ot[0],d[1]-Ot[1])<C)){var Kt=Yt(this).on("dblclick.zoom");Kt&&Kt.apply(this,arguments)}}}return w.wheelDelta=function(tt){return arguments.length?(r=typeof tt=="function"?tt:_o(+tt),w):r},w.filter=function(tt){return arguments.length?(t=typeof tt=="function"?tt:_o(!!tt),w):t},w.touchable=function(tt){return arguments.length?(i=typeof tt=="function"?tt:_o(!!tt),w):i},w.extent=function(tt){return arguments.length?(e=typeof tt=="function"?tt:_o([[+tt[0][0],+tt[0][1]],[+tt[1][0],+tt[1][1]]]),w):e},w.scaleExtent=function(tt){return arguments.length?(s[0]=+tt[0],s[1]=+tt[1],w):[s[0],s[1]]},w.translateExtent=function(tt){return arguments.length?(o[0][0]=+tt[0][0],o[1][0]=+tt[1][0],o[0][1]=+tt[0][1],o[1][1]=+tt[1][1],w):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},w.constrain=function(tt){return arguments.length?(n=tt,w):n},w.duration=function(tt){return arguments.length?(l=+tt,w):l},w.interpolate=function(tt){return arguments.length?(c=tt,w):c},w.on=function(){var tt=u.on.apply(u,arguments);return tt===u?w:tt},w.clickDistance=function(tt){return arguments.length?(E=(tt=+tt)*tt,w):Math.sqrt(E)},w.tapDistance=function(tt){return arguments.length?(C=+tt,w):C},w}const Gg=function(t){var e,n;const r=this.internal,{axis:i,config:s,org:o,scale:l,state:c}=r;let u;if(!i)return;const f=i.isCategorized();if(s.zoom_enabled)if(u=t,Array.isArray(u)){if(i.isTimeSeries()&&(u=u.map(h=>Wn.bind(r)(h))),r.withinRange(u,r.getZoomDomain("zoom",!0),r.getZoomDomain("zoom"))){if(c.domain=u.slice(),u=r.getZoomDomainValue(u),r.api.tooltip.hide(),s.subchart_show)if(c.isCanvasMode)(e=r.setCanvasSubchartDomain)==null||e.call(r,u,!0,!1);else{const h=l.zoom||l.x;r.brush.getSelection().call(r.brush.move,u.map(h))}else{const h=f?l.x.orgScale():o.xScale||l.x;r.updateCurrentZoomTransform(h,u)}r.setZoomResetButton()}}else u=r.zoom.getDomain();return(n=c.domain)!=null?n:u};xn(Gg,{enable(t){var e;const n=this.internal,{axis:r,config:i}=n;if(!r){i.zoom_enabled=!1;return}/^(drag|wheel)$/.test(t)&&(i.zoom_type=t),i.zoom_enabled=!!t,n.zoom?t===!1&&n.bindZoomEvent(!1):n.initZoom(),t!==!1&&(i.zoom_type==="drag"&&!n.zoomBehaviour&&((e=n.initZoomBehaviour)==null||e.call(n)),n.bindZoomEvent()),n.updateAndRedraw()},max(t){const e=this.internal,{config:n,org:{xDomain:r}}=e;return(t===0||t)&&(n.zoom_x_max=pr("max",[r[1],t])),n.zoom_x_max},min(t){const e=this.internal,{config:n,org:{xDomain:r}}=e;return(t===0||t)&&(n.zoom_x_min=pr("min",[r[0],t])),n.zoom_x_min},range(t){const e=this.zoom;if(He(t)){const{min:n,max:r}=t;sn(n)&&e.min(n),sn(r)&&e.max(r)}return{min:e.min(),max:e.max()}}});var YC={zoom:Gg,unzoom(){var t;const e=this.internal,{config:n,$el:{canvas:r,eventRect:i,zoomResetBtn:s},scale:{zoom:o},state:l}=e,c=l.isCanvasMode?r:i;(o||l.isCanvasMode&&n.subchart_show&&l.domain)&&(n.subchart_show?l.isCanvasMode?(t=e.clearCanvasSubchartDomain)==null||t.call(e,!0,!1):e.brush.getSelection().call(e.brush.move,null):e.zoom.updateTransformScale(fr),e.updateZoom(!0),s==null||s.style("display","none"),c!=null&&c.node()&&pu(c.node())!==fr&&e.zoom.transform(c,fr),l.domain=void 0)}};function qo(t){return t.state.isCanvasMode?t.$el.canvas:t.$el.eventRect}function Xg(t,e){if(!t.state.isCanvasMode)return e;const{margin:n}=t.state;return fr.translate(e.x+(e.k-1)*n.left,e.y+(e.k-1)*n.top).scale(e.k)}function Wg(t,e){if(!t.state.isCanvasMode)return e;const{margin:n}=t.state;return fr.translate(e.x-(e.k-1)*n.left,e.y-(e.k-1)*n.top).scale(e.k)}function Vg(t,e,n){const r=Jn(e,n);if(t.state.isCanvasMode){const{margin:i}=t.state;r[0]-=i.left,r[1]-=i.top}return r}var KC={initZoom(){const t=this;t.scale.zoom=null,t.generateZoom(),t.config.zoom_type==="drag"&&t.initZoomBehaviour()},bindZoomEvent(t=!0){const e=this,{config:n}=e;n.zoom_enabled&&t?!n.subchart_show&&e.bindZoomOnEventRect():t===!1&&(e.api.unzoom(),e.unbindZoomEvent())},generateZoom(){const t=this,{config:e,org:n,scale:r}=t,i=HC().duration(0).on("start",t.onZoomStart.bind(t)).on("zoom",t.onZoom.bind(t)).on("end",t.onZoomEnd.bind(t));i.orgScaleExtent=()=>{const s=e.zoom_extent||[1,10];return[s[0],Math.max(t.getMaxDataCount()/s[1],s[1])]},i.updateScaleExtent=function(){const s=wa(t.scale.x.orgDomain())/wa(t.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*s,o[1]*s]),this},i.updateTransformScale=(s,o)=>{var l,c;const u=e.axis_rotated,f=Xg(t,s);(l=n.xScale)==null||l.range(r.x.range());const d=f[u?"rescaleY":"rescaleX"](n.xScale||r.x);if(d.domain().some(S=>/(Invalid Date|NaN)/.test(S.toString())))return;const h=t.trimXDomain(d.domain()),m=e.zoom_rescale;if(d.domain(h,n.xDomain),o){const S=d(r.x.domain()[0]),E=u?f.x:S,C=u?S:f.y,w=Wg(t,fr.translate(E,C).scale(s.k));(c=qo(t))==null||c.property("__zoom",w)}r.zoom=t.getCustomizedXScale(d),t.axis.x.scale(r.zoom),m?(!n.xScale&&(n.xScale=r.x.copy()),r.x.domain(h)):n.xScale&&(r.x.domain(n.xScale.domain()),n.xScale=null)},i.getDomain=()=>{const s=r[r.zoom?"zoom":"subX"].domain();return t.axis.isCategorized()&&(s[1]-=2),s},t.zoom=i},onZoomStart(t){const e=this,{sourceEvent:n}=t;n&&(e.zoom.startEvent=n,e.state.zooming=!0,Ne(e.config.zoom_onzoomstart,e.api,t))},onZoom(t){const e=this,{config:n,scale:r,state:i,org:s}=e,{sourceEvent:o}=t,l=(t==null?void 0:t.transform)===fr;if(!n.zoom_enabled||e.filterTargetsToShow(e.data.targets).length===0||!r.zoom&&(o==null?void 0:o.type.indexOf("touch"))>-1&&(o==null?void 0:o.touches.length)===1)return;t.sourceEvent&&(i.zooming=!0,i.domain=void 0);const c=(o==null?void 0:o.type)==="mousemove",u=(o==null?void 0:o.wheelDelta)<0,{transform:f}=t;!c&&u&&r.x.domain().every((S,E)=>S!==s.xDomain[E])&&r.x.domain(s.xDomain),e.zoom.updateTransformScale(f,n.zoom_type==="wheel"&&o);const d=n.transition_duration>0&&!n.subchart_show&&(i.dragging||l||!t.sourceEvent),h=o&&c&&n.zoom_type!=="wheel",m=()=>{var S;e.config&&(e.redraw({withTransition:d,withY:n.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),e.state.cancelClick=c,!l&&Ne(n.zoom_onzoom,e.api,(S=e.state.domain)!=null?S:e.zoom.getDomain()))};h?Ph(e.state,m):m()},onZoomEnd(t){var e,n;const r=this,{config:i,state:s}=r,o=r.zoom;if(!o)return;let{startEvent:l}=o,c=t==null?void 0:t.sourceEvent;const u=(t==null?void 0:t.transform)===fr;(l==null?void 0:l.type.indexOf("touch"))>-1&&(l=l.changedTouches[0],c=(e=c==null?void 0:c.changedTouches)==null?void 0:e[0]),!(i.zoom_type==="drag"&&c&&l.clientX===c.clientX&&l.clientY===c.clientY)&&(s.zooming=!1,!s.isCanvasMode&&r.redrawEventRect(),r.updateZoom(),!u&&(c||s.dragging)&&Ne(i.zoom_onzoomend,r.api,(n=r.state.domain)!=null?n:r.zoom.getDomain()))},updateZoom(t){const e=this,{subX:n,x:r,zoom:i}=e.scale;if(i){const s=i.domain(),o=n.domain(),l=.015,c=e.config.axis_x_inverted?(s[0]>=o[0]||s[0]+l>=o[0])&&(o[1]>=s[1]||o[1]>=s[1]+l):(s[0]<=o[0]||s[0]-l<=o[0])&&(o[1]<=s[1]||o[1]<=s[1]-l);(t||c)&&(e.axis.x.scale(n),r.domain(n.orgDomain()),e.scale.zoom=null)}},updateCurrentZoomTransform(t,e){var n;const r=this,{config:i}=r,s=i.axis_rotated,o=[-t(e[0]),0],l=fr.scale(t.range()[1]/(t(e[1])-t(e[0]))).translate(...s?o.reverse():o);(n=qo(r))==null||n.call(r.zoom.transform,Wg(r,l))},bindZoomOnEventRect(){var t,e;const n=this,{config:r,$el:{svg:i}}=n,s=qo(n),o=r.zoom_type==="drag"?n.zoomBehaviour:n.zoom;n.state.isCanvasMode&&((t=o==null?void 0:o.touchable)==null||t.call(o,()=>r.interaction_inputType_touch!==!1)),!n.state.isCanvasMode&&se.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((e=se.navigator)==null?void 0:e.userAgent)&&i.on("wheel",()=>{}),s==null||s.call(o).on("dblclick.zoom",null)},initZoomBehaviour(){const t=this,{config:e,state:n}=t,r=e.axis_rotated;let i=0,s=0,o,l;const c={axis:r?"y":"x",attr:r?"height":"width",index:r?1:0},u=f=>{const[d,h]=l!=null?l:[0,r?n.height:n.width];return Math.min(Math.max(f,d),h)};t.zoomBehaviour=Yh().touchable(()=>!n.isCanvasMode||e.interaction_inputType_touch!==!1).clickDistance(4).on("start",function(f){var d;l=t.scale.zoom?null:t.axis.getExtent(),n.event=f,t.setDragStatus(!0),t.unselectRect(),!n.isCanvasMode&&!o&&(o=t.$el.main.append("rect").attr("clip-path",n.clip.path).attr("class",Ec.zoomBrush).attr("width",r?n.width:0).attr("height",r?0:n.height)),o==null||o.attr(r?"width":"height",r?n.width:n.height),i=u(Vg(t,f,this)[c.index]),s=i,n.isCanvasMode?(d=t.renderCanvasZoomBrush)==null||d.call(t,i,s):o.attr(c.axis,i).attr(c.attr,0),t.onZoomStart(f)}).on("drag",function(f){var d;s=u(Vg(t,f,this)[c.index]),n.isCanvasMode?(d=t.renderCanvasZoomBrush)==null||d.call(t,i,s):o.attr(c.axis,Math.min(i,s)).attr(c.attr,Math.abs(s-i))}).on("end",f=>{var d;const h=t.scale.zoom||t.scale.x;n.event=f,s=u(s),n.isCanvasMode?(d=t.clearCanvasZoomBrush)==null||d.call(t):o.attr(c.axis,0).attr(c.attr,0),i>s&&([i,s]=[s,i]),i<0&&(s+=Math.abs(i),i=0),i!==s&&t.api.zoom([i,s].map(m=>h.invert(m))),t.setDragStatus(!1)})},setZoomResetButton(){const t=this,{config:e,$el:n}=t,r=e.zoom_resetButton;r&&e.zoom_type==="drag"&&(n.zoomResetBtn?n.zoomResetBtn.style("display",null):n.zoomResetBtn=t.$el.chart.append("div").classed(ze.button,!0).append("span").on("click",function(){ie(r.onclick)&&r.onclick.bind(t.api)(this),t.api.unzoom()}).classed(Ec.buttonZoomReset,!0).text(r.text||"Reset Zoom"))},getZoomTransform(){const t=this,e=qo(t),n=e==null?void 0:e.node();return n?Xg(t,pu(n)):{k:1}}},ZC={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0};let jg=()=>(xn(br.prototype,KC),xn(jn.prototype,YC),$a.setOptions([ZC]),(jg=()=>!0)());function Hg(t){var e;t.state.canvasShape=null,(e=t.renderCanvasFrame)==null||e.call(t,void 0,null,!1)}function Yg(t,e=!1){const n=this.internal,{config:r}=n,i=r.transition_duration&&os();return t?(r.regions=e?r.regions.concat(t):t,n.state.isCanvasMode?(Hg(n),r.regions):(n.updateRegion(),n.redrawRegion(i),r.regions)):r.regions}const Kg=function(t){return Yg.bind(this)(t)};xn(Kg,{add:function(t){return Yg.bind(this)(t,!0)},remove:function(t){const e=this.internal,{config:n,$T:r}=e,i=t||{},s=ia(i,"classes",[ss.region]);let o=n.regions;if(e.state.isCanvasMode)return Object.keys(i).length?(o=o.filter(c=>{let u=!1;return c.class?(c.class.split(" ").forEach(f=>{s.indexOf(f)>=0&&(u=!0)}),!u):!0}),n.regions=o):n.regions=[],Hg(e),n.regions;const l=e.$el.main.select(`.${ss.regions}`).selectAll(s.map(c=>`.${c}`));return r(l).style("opacity","0").remove(),Object.keys(i).length?(o=o.filter(c=>{let u=!1;return c.class?(c.class.split(" ").forEach(f=>{s.indexOf(f)>=0&&(u=!0)}),!u):!0}),n.regions=o):n.regions=[],o}});var JC={regions:Kg},QC={initRegion(){const t=this,{$el:e}=t;e.region.main=e.main.insert("g",":first-child").attr("clip-path",t.state.clip.path).attr("class",ss.regions)},updateRegion(){const t=this,{config:e,$el:{region:n},$T:r}=t;n.main||t.initRegion(),n.main.style("visibility",t.hasArcType()?"hidden":null);const i=n.main.selectAll(`.${ss.region}`).data(e.regions);r(i.exit()).style("opacity","0").remove();const s=i.enter().append("g");s.append("rect").style("fill-opacity","0"),n.list=s.merge(i).attr("class",t.classRegion.bind(t)),n.list.each(function(o){var l;Yt(this).select("text").empty()&&((l=o.label)!=null&&l.text)&&Yt(this).append("text").style("opacity","0")})},redrawRegion(t){const e=this,{$el:{region:n},$T:r}=e,i=e.regionX.bind(e),s=e.regionY.bind(e),o=["width","height"];let l=n.list.select("rect"),c=n.list.selectAll("text");return l=r(l,t).attr("x",i).attr("y",s).attr("width",e.regionWidth.bind(e)).attr("height",e.regionHeight.bind(e)),c=r(c,t).text(u=>{var f;return(f=u.label)==null?void 0:f.text}).attr("transform",({label:u})=>u.rotated?" rotate(-90)":null).attr("transform",function(u){var f;const{x:d=0,y:h=0,center:m=!1,rotated:S=!1}=(f=u.label)!=null?f:{},E=this.previousElementSibling,C={x:0,y:0};return je(m)&&["x","y"].forEach((w,$)=>{m.indexOf(w)>-1&&(C[w]=(+E.getAttribute(o[$])-ln(this)[o[$]])/2)}),`translate(${i(u)+C.x+d}, ${s(u)+C.y+h})${S?" rotate(-90)":""}`}).attr("text-anchor",({label:u})=>u!=null&&u.rotated?"end":null).attr("dy","1em").style("fill",({label:u})=>{var f;return(f=u==null?void 0:u.color)!=null?f:null}),[l.style("fill-opacity",u=>Ge(u.opacity)?u.opacity:null).on("end",function(){Yt(this.parentNode).selectAll("rect:not([x])").remove()}),c.style("opacity",null)]},regionX(t){return this.getRegionSize("x",t)},regionY(t){return this.getRegionSize("y",t)},regionWidth(t){return this.getRegionSize("width",t)},regionHeight(t){return this.getRegionSize("height",t)},getRegionSize(t,e){const n=this,{config:r,scale:i,state:s}=n,o=r.axis_rotated,l=/(x|y|y2)/.test(t),c=l?t==="x":t==="width",u=!l&&n[c?"regionX":"regionY"](e);let f=l?"start":"end",d=l?0:s[t],h;if(e.axis==="y"||e.axis==="y2"?(!l&&!c?f="start":l&&!c&&(f="end"),(c?o:!o)&&f in e&&(h=i[e.axis])):(c?!o:o)&&f in e&&(h=i.zoom||i.x),h){let m=0;d=e[f],n.axis.isTimeSeries(e.axis)?d=Wn.call(n,d):/(x|width)/.test(t)&&n.axis.isCategorized()&&isNaN(d)&&(d=r.axis_x_categories.indexOf(d),m=n.axis.x.tickOffset()*(f==="start"?-1:1)),d=h(d)+m}return l?d:d<u?0:d-u},isRegionOnX(t){return!t.axis||t.axis==="x"}};let Zg=()=>(xn(br.prototype,QC),jn.prototype.regions=JC.regions,(Zg=()=>({}))());var xi={initArea(t){const e=this,{config:n}=e;t.insert("g",`.${n.area_front?$n.circles:Mr.lines}`).attr("class",e.getClass("areas",!0))},updateAreaColor(t){const e=this;return Yv.call(e,t,"area_linearGradient",e.color)},updateArea(t,e=!1){const n=this;if(n.state.isCanvasMode)return;const{config:r,state:i,$el:s,$T:o}=n,l=e?s.subchart:s;r.area_linearGradient&&n.updateLinearGradient();const c=l.main.selectAll(`.${To.areas}`).selectAll(`.${To.area}`).data(n.lineData.bind(n));o(c.exit(),t).style("opacity","0").remove(),l.area=c.enter().append("path").attr("class",n.getClass("area",!0)).style("fill",n.updateAreaColor.bind(n)).style("opacity",function(){return i.orgAreaOpacity=Yt(this).style("opacity"),"0"}).merge(c),c.style("opacity",i.orgAreaOpacity),n.setRatioForGroupedData(l.area.data())},redrawArea(t,e,n=!1){const r=this;if(r.state.isCanvasMode)return[];const{area:i}=n?this.$el.subchart:this.$el,{orgAreaOpacity:s}=r.state;return[r.$T(i,e,Cr()).attr("d",t).style("fill",r.updateAreaColor.bind(r)).style("opacity",o=>String(r.isAreaRangeType(o)?s/1.75:s))]},generateDrawArea(t,e){return Bd(this,t,e)}},yi={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},xu={spline_interpolation_type:"cardinal"};function _C(t){return Kn(t)&&ie(t.create)&&ie(t.update)}function qC(t,e){var n;const r=this,i=(c,u)=>{const f=c.attributes;for(let d=0,h;h=f[d];d++)h=h.name,u.setAttribute(h,c.getAttribute(h))},o=new DOMParser().parseFromString(Gr(t),"image/svg+xml").documentElement,l=Ye.createElementNS(_t.svg,o.nodeName.toLowerCase());if(l.id=e,l.style.fill="inherit",l.style.stroke="inherit",i(o,l),(n=o.childNodes)!=null&&n.length){const c=Yt(l);"innerHTML"in l?c.html(Gr(o.innerHTML)):Oa(o.childNodes).forEach(u=>{i(u,c.append(u.tagName).node())})}r.$el.defs.node().appendChild(l)}var Ti={hasValidPointType(t){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(t||this.config.point_type)},hasLegendDefsPoint(){var t;const{config:e}=this;return e.legend_show&&((t=e.point_pattern)==null?void 0:t.length)&&e.legend_usePoint},getDefsPointId(t){const{state:{datetimeId:e}}=this;return`${e}-point${t}`},getValidPointPattern(){const{config:t}=this,e=/^(circle|rect(angle)?)$/i.test(t.point_type)?t.point_type:"circle";return vn(t.point_pattern)?t.point_pattern:[e]},generatePoint(){const t=this,{$el:e,config:n}=t,r=[],i=t.getValidPointPattern();return function(s,o,...l){return function(c){var u,f,d,h;const m=t.getTargetSelectorSuffix(c.id||((u=c.data)==null?void 0:u.id)||c),S=Yt(this);r.indexOf(m)<0&&r.push(m);let E=i[r.indexOf(m)%i.length];if(t.hasValidPointType(E))E=t[E];else if(!_C(E||n.point_type)){const C=t.getDefsPointId(m);if(e.defs.select(`#${C}`).size()<1&&qC.call(t,E,C),s==="create")return(f=t.custom)==null?void 0:f.create.bind(o)(S,C,...l);if(s==="update")return(d=t.custom)==null?void 0:d.update.bind(o)(S,...l)}return(h=E[s])==null?void 0:h.bind(o)(S,...l)}}}};function t2(t,e,n,r=!1){const i=t?[t,0]:n;for(let s=t||n.reduce((o,l)=>o+l);s<=e;)n.forEach(o=>{s+o<=e&&i.push(o),s+=o});return i.length%2!==0&&i.push(r?n[1]:0),{dash:i.join(" "),length:i.reduce((s,o)=>s+o,0)}}var e2={initLine(){Kv.call(this,{elKey:"line",className:Mr.chartLines,cssRules:["pointer-events:none"]})},updateTargetsForLine(t){const e=this,{$el:{area:n,main:r}}=e,i=e.getClass("lines",!0),s=t.filter(l=>!(e.isScatterType(l)||e.isBubbleType(l))),o=su.call(e,s,{type:"Line",elKey:"line",containerClass:Mr.chartLines,itemClass:Mr.chartLine,initFn:e.initLine});if(o.append("g").attr("class",i),e.hasTypeOf("Area")){const l=r.select(`.${Mr.chartLines}`).selectAll(`.${Mr.chartLine}`),c=(!n&&o.empty()?l:o).filter(e.isAreaType.bind(e));e.initArea(c)}e.updateTargetForCircle(s,o)},updateLine(t,e=!1){const n=this;if(n.state.isCanvasMode)return;const{format:{extraLineClasses:r},$el:i,$T:s}=n,o=e?i.subchart:i,l=o.main.selectAll(`.${Mr.lines}`).selectAll(`.${Mr.line}`).data(n.lineData.bind(n));s(l.exit(),t).style("opacity","0").remove(),o.line=l.enter().append("path").attr("class",c=>`${n.getClass("line",!0)(c)} ${r(c)||""}`).style("stroke",n.color).merge(l).style("opacity",n.initialOpacity.bind(n)).attr("transform",null)},redrawLine(t,e,n=!1){const r=this;if(r.state.isCanvasMode)return[];const{$el:i,$T:s}=r,{line:o}=n?i.subchart:i;return[s(o,e,Cr()).attr("d",t).style("stroke",this.color).style("opacity",null)]},generateDrawLine(t,e){return $d(this,t,e)},lineWithRegions(t,e,n,r){const i=this,{config:s}=i,o=s.axis_rotated,l=i.axis.isTimeSeries(),c="2 2",u=Ad(i,t,r),f=i.hasNullDataValue(t);let d,h,m,S;const E=o?it=>n(it.value):it=>e(it.x),C=o?it=>e(it.x):it=>n(it.value),w=it=>`M${it[0][0]},${it[0][1]}L${it[1][0]},${it[1][1]}`,$=l?(it,ot,ct,gt)=>{const tt=it.x.getTime(),ft=ot.x-it.x,lt=new Date(tt+ft*ct),bt=new Date(tt+ft*(ct+gt)),St=o?[[n(h(ct)),e(lt)],[n(h(ct+m)),e(bt)]]:[[e(lt),n(h(ct))],[e(bt),n(h(ct+m))]];return w(St)}:(it,ot,ct,gt)=>{const tt=e(ot.x,!o),ft=n(ot.value,o),lt=ct+gt,bt=e(d(ct),!o),St=n(h(ct),o);let Mt=e(d(lt),!o),Ot=n(h(lt),o);Mt>tt&&(Mt=tt),it.value>ot.value&&(o?Ot<ft:Ot>ft)&&(Ot=ft);const Kt=[[bt,St],[Mt,Ot]];return o&&Kt.forEach(ee=>ee.reverse()),w(Kt)},z={x:i.axis.getAxisType("x"),y:i.axis.getAxisType("y")};let B="";if(!t.length)return B;const W=i.$el.line.filter(({id:it})=>it===t[0].id),H=W.clone().style("display","none"),_=(it,ot)=>it.attr("d",ot).node().getTotalLength(),q={dash:[],lastLength:0};let st=!1;for(let it=0,ot;ot=t[it];it++){const ct=t[it-1],gt=ct&&Ge(ct.value);let tt=i.isWithinRegions(ot.x,u);if(Ge(ot.value)){if(mn(u)||!tt||!gt)B+=`${it&&gt?"L":"M"}${E(ot)},${C(ot)}`;else if(gt)if(tt=((tt==null?void 0:tt.dasharray)||c).split(" ").map(Number),d=sa(z.x,ct.x,ot.x),h=sa(z.y,ct.value,ot.value),f){const ft=e(ot.x)-e(ct.x),lt=n(ot.value)-n(ct.value),bt=Math.sqrt(ft*ft+lt*lt);m=tt[0]/bt,S=m*tt[1];for(let St=m;St<=1;St+=S)B+=$(ct,ot,St,m),St+S>=1&&(B+=$(ct,ot,1,0))}else{let ft;if(st=ot.x===t[t.length-1].x,l){const Mt=+ct.x,Ot=new Date(Mt),Kt=new Date(Mt+(+ot.x-Mt));ft=[[e(Ot),n(h(0))],[e(Kt),n(h(1))]]}else ft=[[e(d(0)),n(h(0))],[e(d(1)),n(h(1))]];o&&ft.forEach(Mt=>Mt.reverse());const lt=_(H,B),bt=_(H,B+=`L${ft[1].join(",")}`),St=t2(lt-q.lastLength,bt-q.lastLength,tt,st);q.lastLength+=St.length,q.dash.push(St.dash)}}}return q.dash.length&&(!st&&q.dash.push(_(H,B)),W.attr("stroke-dasharray",q.dash.join(" "))),H.remove(),B},isWithinRegions(t,e){return Ed(t,e)},isWithinStep(t,e){return Math.abs(e-Jn(this.state.event,t)[1])<30},shouldDrawPointsForLine(t){const e=this.config.line_point;return e===!0||qe(e)&&e.indexOf(t.id)!==-1}};const bi=()=>Cr(),Jg=new WeakMap;function Qg(t){const e=t.getAttribute("height"),n=t.getAttribute("width"),r=t.getAttribute("href")||t.getAttribute("xlink:href"),i=Jg.get(t);if(i&&i.attrHeight===e&&i.attrWidth===n&&i.href===r)return i;const{width:s,height:o}=ha(t),l={attrHeight:e,attrWidth:n,height:o,href:r,width:s};return Jg.set(t,l),l}var tl={initialOpacityForCircle(t){const{config:e,state:{withoutFadeIn:n}}=this;let r=e.point_opacity;return mn(r)&&(r=this.getBaseValue(t)!==null&&n[t.id]?this.opacityForCircle(t):"0"),r},opacityForCircle(t){var e;const{config:n}=this;let r=n.point_opacity;return mn(r)&&(r=n.point_show&&!((e=this.isPointFocusOnly)!=null&&e.call(this))?null:"0",r=Ge(this.getBaseValue(t))?this.isBubbleType(t)||this.isScatterType(t)?"0.5":r:"0"),r},initCircle(){const t=this,{$el:{main:e}}=t;!t.point&&(t.point=t.generatePoint()),(t.hasType("bubble")||t.hasType("scatter"))&&e.select(`.${ze.chart} > .${$n.chartCircles}`).empty()&&e.select(`.${ze.chart}`).append("g").attr("class",$n.chartCircles)},updateTargetForCircle(t,e){const n=this,{config:r,data:i,$el:s}=n,o=r.interaction_enabled&&r.data_selection_enabled,l=o&&r.data_selection_isselectable,c=n.getClass("circles",!0);if(!r.point_show)return;n.initCircle();let u=t,f=e;if(!u){u=n.filterNullish(i.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const d=s.main.select(`.${$n.chartCircles}`).style("pointer-events","none").selectAll(`.${$n.circles}`).data(u);d.exit().remove(),f=d.enter()}o&&f.append("g").attr("class",d=>n.generateClass(on.selectedCircles,d.id)),f.append("g").attr("class",c).call(d=>{n.setCssRule(!0,`.${$n.circles}`,["cursor:pointer"],l)(d),n.setCssRule(!0,` .${$n.circle}`,["fill","stroke"],n.color)(d)}).style("opacity",function(){return Yt(this.parentNode).classed($n.chartCircles)?"0":null}),o&&u.forEach(d=>{s.main.selectAll(`.${on.selectedCircles}${n.getTargetSelectorSuffix(d.id)}`).selectAll(`${on.selectedCircle}`).each(h=>{h.value=d.values[h.index].value})})},updateCircle(t=!1){const e=this,{config:n,state:r,$el:i}=e,s=e.isPointFocusOnly(),o=t?i.subchart:i;if(n.point_show&&!r.toggling){n.point_radialGradient&&e.updateLinearGradient();const l=o.main.selectAll(`.${$n.circles}`).selectAll(`.${$n.circle}`).data(d=>{const h=e.isLineType(d)&&e.shouldDrawPointsForLine(d)||e.isBubbleType(d)||e.isRadarType(d)||e.isScatterType(d)?s?[d.values[0]]:d.values:[];return e.filterNullish(h)});l.exit().remove();const c=e.pointR.bind(e),u=e.generateUpdateCircleColor(),f=e.initialOpacityForCircle.bind(e);l.enter().filter(Boolean).append(e.point("create",this,c,u)),o.circle=o.main.selectAll(`.${$n.circles} .${$n.circle}`).style("stroke",e.getStylePropValue(e.color)).style("opacity",f)}},generateUpdateCircleColor(){const t=this,e=t.getStylePropValue(t.color);return n=>t.config.point_radialGradient?t.getGradienColortUrl(n.id):e?e(n):null},updateCircleColor(t){return this.generateUpdateCircleColor()(t)},redrawCircle(t,e,n,r,i=!1){const s=this,{state:{rendered:o},$el:l,$T:c}=s,u=i?l.subchart:l,f=u.main.selectAll(`.${on.selectedCircle}`);if(!s.config.point_show)return[];const d=s.isCirclePoint()?"c":"",h=Cr(),m=s.opacityForCircle.bind(s),S=s.generateUpdateCircleColor();if(s.isCirclePoint()){const w=u.circle;return s.hasType("bubble")&&w.attr("r",s.pointR.bind(s)),n?(r&&w.attr("cx",t),c(w.filter(function(){return!!this.getAttribute("cx")}),!0,`${h}-pos`).attr("cx",t).attr("cy",e).style("fill",S),w.filter(function(){return!this.getAttribute("cx")}).attr("cx",t).attr("cy",e).style("fill",S)):w.attr("cx",t).attr("cy",e).style("fill",S),[[c(w,n||!o,h).style("opacity",m)],c(f,n).attr("cx",t).attr("cy",e)]}const E=s.point("update",s,t,e,S,n,r,f),C=[];return u.circle.each(function(w){let $=E.bind(this)(w);$=c($,n||!o,h).style("opacity",m),C.push($)}),[C,c(f,n).attr(`${d}x`,t).attr(`${d}y`,e)]},showCircleFocus(t){const e=this,{state:{hasRadar:n,resizing:r,toggling:i,transiting:s},$el:o}=e;let{circle:l}=o;if(s===!1&&l&&e.isPointFocusOnly()){const c=(n?e.radarCircleX:e.circleX).bind(e),u=(n?e.radarCircleY:e.circleY).bind(e),f=i||mn(t),d=e.point("update",e,c,u,e.getStylePropValue(e.color),r?!1:f);t&&(l=l.filter(function(h){var m;const S=(m=t.filter)==null?void 0:m.call(t,E=>E.id===h.id);return S.length?Yt(this).datum(S[0]):!1})),l.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:m,index:S,value:E}=h;let C="hidden";Ge(E)&&(d.bind(this)(h),e.expandCircles(S,m),C=""),this.style.visibility=C})}},hideCircleFocus(){const t=this,{$el:{circle:e}}=t;t.isPointFocusOnly()&&e&&(t.unexpandCircles(),e.style("visibility","hidden"))},expandCircles(t,e,n){const r=this,i=r.pointExpandedR.bind(r);n&&r.unexpandCircles();const s=r.getShapeByIndex("circle",t,e).classed(ze.EXPANDED,!0),o=i(s)/r.config.point_r,l=1-o;r.isCirclePoint()?s.attr("r",i):s.each(function(){const c=Yt(this);if(this.tagName==="circle")c.attr("r",i);else{const{width:u,height:f}=Qg(this),d=l*(+c.attr("x")+u/2),h=l*(+c.attr("y")+f/2);c.attr("transform",`translate(${d} ${h}) scale(${o})`)}})},unexpandCircles(t){const e=this,n=e.pointR.bind(e),r=e.getShapeByIndex("circle",t).filter(function(){return Yt(this).classed(ze.EXPANDED)}).classed(ze.EXPANDED,!1);if(r.attr("r",n),!e.isCirclePoint()){const i=n(r)/e.config.point_r;r.attr("transform",i!==1?`scale(${i})`:null)}},isWithinCircle(t,e){const{state:n}=this,r=Jn(n.event,t),i=Yt(t),s=this.isCirclePoint(t)?"c":"",o=this.getPointSensitivity(i==null?void 0:i.datum());let l=+i.attr(`${s}x`),c=+i.attr(`${s}y`);if(!(l||c)&&t.nodeType===1){const{x:d,y:h}=ln(t);l=d,c=h}const u=l-r[0],f=c-r[1];return Math.sqrt(u*u+f*f)<(e||o)},updatePointClass(t){const e=this,{circle:n}=e.$el;let r=!1;return(He(t)||n)&&(r=t===!0?n.each(function(i){let s=e.getClass("circle",!0)(i);this.getAttribute("class").indexOf(ze.EXPANDED)>-1&&(s+=` ${ze.EXPANDED}`),this.setAttribute("class",s)}):e.getClass("circle",!0)(t)),r},custom:{create(t,e,n){return t.append("use").attr("xlink:href",`#${e}`).attr("class",this.updatePointClass.bind(this)).style("fill",n).node()},update(t,e,n,r,i,s,o){const l=this,{width:c,height:u}=Qg(t.node()),f=m=>Ge(m.value)?e(m)-c/2:0,d=m=>Ge(m.value)?n(m)-u/2:0;let h=t;return i&&(s&&h.attr("x",f),h=l.$T(h,i,bi()),o&&l.$T(o,i,bi())),h.attr("x",f).attr("y",d).style("fill",r)}},circle:{create(t,e,n){return t.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",e).style("fill",n).node()},update(t,e,n,r,i,s,o){const l=this;let c=t;return l.hasType("bubble")&&c.attr("r",l.pointR.bind(l)),i&&(s&&c.attr("cx",e),c.attr("cx")&&(c=l.$T(c,i,bi())),o&&l.$T(o,i,bi())),c.attr("cx",e).attr("cy",n).style("fill",r)}},rectangle:{create(t,e,n){const r=i=>e(i)*2;return t.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",r).attr("height",r).style("fill",n).node()},update(t,e,n,r,i,s,o){const l=this,c=l.config.point_r,u=h=>e(h)-c,f=h=>n(h)-c;let d=t;return i&&(s&&d.attr("x",u),d=l.$T(d,i,bi()),o&&l.$T(o,i,bi())),d.attr("x",u).attr("y",f).style("fill",r)}}},ka={point_show:!0,point_r:2.5,point_radialGradient:!1,point_sensitivity:10,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_focus_only:!1,point_opacity:void 0,point_pattern:[],point_select_r:void 0,point_type:"circle"},n2={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0};function _g(t,e,n){const{config:r}=t,i=(s,o)=>{const l=ae(o)?o:o===!1?void 0:null;l!==null&&(r[`axis_${s}_${e}`]=l)};sn(n)&&(Kn(n)?Object.keys(n).forEach(s=>{i(s,n[s])}):(ae(n)||n===!1)&&["y","y2"].forEach(s=>{i(s,n)}),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function qg(t,e){const{config:n}=t;return{x:n[`axis_x_${e}`],y:n[`axis_y_${e}`],y2:n[`axis_y2_${e}`]}}var r2={axis:{labels:function(t){var e;const n=this.internal;let r;return t&&(Object.keys(t).forEach(i=>{n.axis.setLabelText(i,t[i])}),n.state.isCanvasMode?(e=n.renderCanvasFrame)==null||e.call(n,void 0,null,!1):n.axis.updateLabels()),["x","y","y2"].forEach(i=>{const s=n.axis.getLabelText(i);s&&(!r&&(r={}),r[i]=s)}),r},min:function(t){const e=this.internal;return Ge(t)||t===!1?_g(e,"min",t):qg(e,"min")},max:function(t){const e=this.internal;return Ge(t)||t===!1?_g(e,"max",t):qg(e,"max")},range:function(t){const{axis:e}=this;if(arguments.length){const{min:n,max:r}=t;sn(r)&&e.max(r),sn(n)&&e.min(n)}else return{max:e.max(),min:e.min()}}}},a2={groups(t){const e=this.internal,{config:n}=e;return mn(t)||(n.data_groups=t,e.state.dirty.data=!0,e.redraw()),n.data_groups}},i2={x(t){const e=this.internal,{axis:n,data:r}=e,i=n.isCustomX()&&n.isCategorized();return qe(t)&&(i?this.categories(t):(e.updateTargetX(r.targets,t),e.state.dirty.data=!0,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),i?this.categories():r.xs},xs(t){const e=this.internal;return He(t)&&(e.updateTargetXs(e.data.targets,t),e.state.dirty.data=!0,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),e.data.xs}},s2=Object.defineProperty,o2=(t,e,n)=>e in t?s2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,el=(t,e,n)=>o2(t,typeof e!="symbol"?e+"":e,n);class l2{constructor(e){el(this,"owner"),el(this,"config"),el(this,"scale"),el(this,"charSize",{});const n=sa(),{config:r,params:i}=e;this.owner=e,this.config=r,this.scale=n,(r.noTransition||!i.config.transition_duration)&&(r.withoutTransition=!0),r.range=this.scaleExtent((i.orgXScale||n).range())}getSizeFor1Char(e,n,r=!0){const i={w:5.5,h:11.5};return this.charSize[e]&&r?this.charSize[e]:(!n.empty()&&n.text("0").call(s=>{try{const{width:o,height:l}=ha(s.node(),!0);o&&l&&(i.w=o,i.h=l)}finally{s.text("")}}),this.charSize[e]=i,i)}getTickTransformSetter(e){const{config:n}=this,r=e==="x"?i=>`translate(${i+n.tickOffset},0)`:i=>`translate(0,${i})`;return(i,s)=>{i.attr("transform",o=>{const l=s(o);return Ge(o)?r(l):null})}}scaleExtent(e){const n=e[0],r=e[e.length-1];return n<r?[n,r]:[r,n]}generateTicks(e,n){const{tickStepSize:r}=this.owner.params,[i,s]=e.domain();let o=[];if(n&&r){let l=Math.round(i);for(;l<=s;)o.push(l),l+=r}else if(e.ticks){const{tickArguments:l}=this.config;if(e.type==="log"&&!l){const c=sa("_log").domain([i>0?i:1,s]).range(e.range());o=c.ticks();for(let u=s.toFixed().length;o.length>15;u--)o=c.ticks(u);o.splice(0,1,i),o.splice(o.length-1,1,s)}else o=e.ticks(...this.config.tickArguments||[])}return o}copyScale(){const e=this.scale.copy();return e.domain().length||e.domain(this.scale.domain()),e.type=this.scale.type,e}textFormatted(e){const n=this.config.tickFormat,r=/\d+\.\d+0{5,}\d$/.test(e)?+String(e).replace(/0+\d$/,""):e,i=n?n(r):r;return sn(i)?i:""}transitionise(e){const{config:n}=this;let r=e;if(n.withoutTransition)r=e.interrupt();else if(n.transition||!this.owner.params.noTransition)try{r=e.transition(n.transition)}catch(i){}return r}}var c2=Object.defineProperty,u2=(t,e,n)=>e in t?c2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ys=(t,e,n)=>u2(t,typeof e!="symbol"?e+"":e,n);function nl(t){return t==="subX"?"x":t==="subY"?"y":t==="subY2"?"y2":t}function f2(t){const e=nl(t);return/^sub/.test(t)?`subchart_axis_${e}`:`axis_${e}`}class tp{constructor(e={}){ys(this,"helper"),ys(this,"config"),ys(this,"params"),ys(this,"g"),ys(this,"generatedTicks",[]);const n={innerTickSize:xt,outerTickSize:e.outerTick?xt:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:Gt,tickOffset:0,tickPadding:mt,tickValues:null,transition:null,noTransition:e.noTransition};n.tickLength=Math.max(n.innerTickSize,0)+n.tickPadding,this.config=n,this.params=e,this.helper=new l2(this)}canReuseTickTextOnResize(e){const{config:n,params:r}=this,{config:i,id:s,owner:o}=r,l=/^(x|subX)$/.test(s),c=nl(s),u=/^sub/.test(s)?i[`subchart_axis_${c}_tick_format`]||i[`axis_${c}_tick_format`]:i[`axis_${c}_tick_format`],f=r.tickMultiline&&r.isCategory&&!e&&!(r.tickWidth>0);return!!(o.state.resizing&&!o.state.flowing&&!ie(i.axis_evalTextSize)&&!u&&!r.tickTitle&&!(l&&i.axis_x_tick_autorotate)&&!f&&n.withoutTransition)}canReuseTickNodesOnResize(e,n,r,i){if(i.tick||!i.text||!this.canReuseTickTextOnResize(r)||e.size()!==n.length)return!1;const s=e.nodes();for(let o=0;o<n.length;o++){const l=s[o].__data__,c=n[o];if(l instanceof Date||c instanceof Date){if(+l!=+c)return!1}else if(l!==c)return!1}return!0}create(e){const n=this,{config:r,helper:i,params:s}=n,{scale:o}=i,{orient:l}=r,c=this.splitTickText.bind(n),u=/^(left|right)$/.test(l),f=/^(top|bottom)$/.test(l),d=i.getTickTransformSetter(f?"x":"y"),h=d===i.axisX?"y":"x",m=/^(top|left)$/.test(l)?-1:1,S=s.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():i.scaleExtent((s.orgXScale||o).range());const{innerTickSize:E,tickLength:C,range:w}=r,$=s.id,z=nl($),{isSubAxes:B}=s,W=!B&&z&&/^(x|y|y2)$/.test(z)?s.config[`axis_${z}_tick_text_position`]:{x:0,y:0},H=f2($),_=s.config[`${H}_show`],q=B?{tick:!0,text:!0}:{tick:_?s.config[`${H}_tick_show`]:!1,text:_?s.config[`${H}_tick_text_show`]:!1},st=s.config.axis_evalTextSize;let it;e.each(function(){const ot=Yt(this);let ct=this.__chart__||o,gt=i.copyScale();it=ot,this.__chart__=gt,r.tickOffset=s.isCategory?(gt(1)-gt(0))/2:0;const tt=ot.selectAll(".domain").data([0]);if(tt.enter().append("path").attr("class","domain").merge(tt).attr("d",()=>{const ft=r.outerTickSize*m;return f?`M${w[0]},${ft}V0H${w[1]}V${ft}`:`M${ft},${w[0]}H0V${w[1]}H${ft}`}),q.tick||q.text){const ft=r.tickValues||i.generateTicks(gt,u||s.config.axis_rotated);n.generatedTicks=ft;let lt=ot.selectAll(".tick");if(n.canReuseTickNodesOnResize(lt,ft,u||s.config.axis_rotated,q))d(lt,gt);else{lt=lt.data(ft,gt);const St=lt.enter().insert("g",".domain").attr("class","tick"),Mt=lt.exit().remove();lt=St.merge(lt),q.tick&&St.append("line"),q.text&&St.append("text");const Ot=!St.empty()||!Mt.empty(),Kt=q.text&&!Ot&&n.canReuseTickTextOnResize(u||s.config.axis_rotated);let ee={w:0,h:0},Ae=lt.selectAll("text.__bb-empty");if(q.text&&!Kt){const Te=lt.select("text"),De=[];Ae=Te,ie(st)&&(ee=st.bind(n.params.owner.api)(Te.node(),$),this.classList.contains(ze.dummy)&&(this.sizeFor1Char=ee)),(!ee||ee.w===0||ee.h===0)&&(ee=n.helper.getSizeFor1Char(l,Te,!!st));let me=Te.selectAll("tspan").data((Pe,Zt)=>{let he;if(s.tickMultiline)he=c(Pe,gt,ft,u,ee.w);else{const ge=i.textFormatted(Pe);he=qe(ge)?ge.concat():[ge]}return De[Zt]=he.length,he.map(ge=>({index:Zt,splitted:ge}))});me.exit().remove(),me=me.enter().append("tspan").merge(me).text(Pe=>Pe.splitted),me.attr("x",f?0:C*m).attr("dx",(()=>{let Pe=0;return/(top|bottom)/.test(l)&&S&&(Pe=8*Math.sin(Math.PI*(S/180))*(l==="top"?-1:1)),Pe+(W.x||0)})()).attr("dy",(Pe,Zt)=>{const he=".71em";let ge=0;return l!=="top"&&(ge=ee.h,Zt===0&&(ge=u?-((De[Pe.index]-1)*(ee.h/2)-3):W.y===0?he:0)),ae(ge)&&W.y?ge+W.y:ge||he})}const Ee=lt.select("line");if(St.select("line").attr(`${h}2`,E*m),St.select("text").attr(h,C*m),n.setTickLineTextPosition(Ee,Ae,ee),s.tickTitle){const Te=Ae.select("title"),De=s.tickTitle;(Te.empty()?Ae.append("title"):Te).text(me=>De[Number(me)])}if(gt.bandwidth){const Te=gt,De=Te.bandwidth()/2;ct=me=>Te(me)+De,gt=ct}else ct.bandwidth?ct=gt:d(Mt,gt);lt=s.owner.state.flowing?i.transitionise(lt):s.owner.$T(lt),d(St,ct),d(lt.style("opacity",null),gt)}}}),this.g=it}getGeneratedTicks(e){var n;const r=((n=this.generatedTicks)==null?void 0:n.length)-1;let i=this.generatedTicks;if(r>e){const s=Math.round(r/e+.1);i=this.generatedTicks.map((o,l)=>l%s===0?o:null).filter(o=>o!==null).splice(0,e)}return i}getTickXY(){const{config:e}=this,n={x:0,y:0};return this.params.isCategory&&(n.x=e.tickCentered?0:e.tickOffset,n.y=e.tickCentered?e.tickOffset:0),n}getTickSize(e){const{scale:n}=this.helper,{config:r}=this,{innerTickSize:i,range:s}=r,o=n(e)+(r.tickCentered?0:r.tickOffset);return s[0]<o&&o<s[1]?i:0}setTickLineTextPosition(e,n,r){const i=this.getTickXY(),{innerTickSize:s,orient:o,tickLength:l,tickOffset:c}=this.config,u=this.params.id,f=this.params.tickTextRotate,d=6,h=r.h/2-d,m=z=>{const B=["start","end"];return o==="top"&&B.reverse(),z?B[z>0?0:1]:"middle"},S=z=>z?`rotate(${z})`:null,E=z=>{const B=z/(o==="bottom"?15:23);return z?11.5-2.5*B*(z>0?1:-1):l},{config:{axis_rotated:C,axis_x_tick_text_inner:w}}=this.params.owner,$=this.params.config[`axis_${nl(u)}_tick_inner`];switch(o){case"bottom":e.attr("x1",i.x).attr("x2",i.x).attr("y2",z=>this.getTickSize.bind(this)(z)*($?-1:1)),n.attr("x",0).attr("y",E(f)).style("text-anchor",(z,B,{length:W})=>!C&&B===0&&(w===!0||w.first)?"start":!C&&B===W-1&&(w===!0||w.last)?"end":m(f)).attr("transform",S(f));break;case"top":e.attr("x2",0).attr("y2",$?s:-s),n.attr("x",0).attr("y",-(E(f)+h+d)).style("text-anchor",m(f)).attr("transform",S(f));break;case"left":e.attr("x2",$?s:-s).attr("y1",i.y).attr("y2",i.y),n.attr("x",-l).attr("y",c+(C?h/4:h)).style("text-anchor","end");break;case"right":e.attr("x2",$?-s:s).attr("y2",0),n.attr("x",l).attr("y",h).style("text-anchor","start")}}splitTickText(e,n,r,i,s){const{params:o}=this,l=this.helper.textFormatted(e),c=je(l)&&l.indexOf(`
59
59
  `)>-1?l.split(`
60
60
  `):[];if(c.length)return c;if(qe(l))return l;let u=o.tickWidth;(!u||u<=0)&&(u=i?95:o.isCategory?(o.isInverted?n(r[0])-n(r[1]):n(r[1])-n(r[0]))-12:110);function f(d,h){let m,S,E;for(let C=1;C<h.length;C++)if(h.charAt(C)===" "&&(S=C),m=h.substr(0,C+1),E=s*m.length,u<E)return f(d.concat(h.substr(0,S||C)),h.slice(S?S+1:C));return d.concat(h)}return f(c,String(l))}scale(e){return arguments.length?(this.helper.scale=e,this):this.helper.scale}orient(e){return arguments.length?(this.config.orient=e in{top:1,right:1,bottom:1,left:1}?String(e):"bottom",this):this.config.orient}tickFormat(e){const{config:n}=this;return arguments.length?(n.tickFormat=e,this):n.tickFormat}tickCentered(e){const{config:n}=this;return arguments.length?(n.tickCentered=e,this):n.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(e){var n,r,i;const{outerTickSize:s,tickOffset:o,tickValues:l}=this.config;let c;if(this.params.isCategory){const u=(n=this.params.owner.scale.zoom)!=null?n:this.helper.scale;c=o*2||Math.abs(u(1)-u(0))}else{const u=(r=this.params.owner.scale.zoom)!=null?r:this.helper.scale;if(c=(this.g?this.g.select("path.domain").node().getTotalLength()-s*2:Math.abs(u.range()[1]-u.range()[0]))/(e||((i=this.g)==null?void 0:i.selectAll("line").size())||1),l)for(let d=0;d<l.length-1;d++){const h=u(l[d+1])-u(l[d]);h&&h<c&&(c=h)}}return c===1/0?0:c}ticks(...e){const{config:n}=this;return e.length?(n.tickArguments=Oa(e),this):n.tickArguments}tickCulling(e){const{config:n}=this;return arguments.length?(n.tickCulling=e,this):n.tickCulling}tickValues(e){const{config:n}=this;if(ie(e))n.tickValues=()=>e(this.helper.scale.domain());else{if(!arguments.length)return n.tickValues;n.tickValues=e}return this}setTransition(e){return this.config.transition=e,this}}var d2=Object.defineProperty,h2=Object.defineProperties,v2=Object.getOwnPropertyDescriptors,ep=Object.getOwnPropertySymbols,g2=Object.prototype.hasOwnProperty,p2=Object.prototype.propertyIsEnumerable,yu=(t,e,n)=>e in t?d2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m2=(t,e)=>{for(var n in e||(e={}))g2.call(e,n)&&yu(t,n,e[n]);if(ep)for(var n of ep(e))p2.call(e,n)&&yu(t,n,e[n]);return t},x2=(t,e)=>h2(t,v2(e)),Sr=(t,e,n)=>yu(t,typeof e!="symbol"?e+"":e,n);function Tu(t){return t==="subX"?"x":t==="subY"?"y":t==="subY2"?"y2":t}function rl(t){return/^sub/.test(t)}function pa(t,e,n){const r=Tu(e),i=t[`subchart_axis_${r}_tick_${n}`];return rl(e)&&i!==void 0?i:t[`axis_${r}_tick_${n}`]}function y2(t){var e,n;const r=[t[0],t[t.length-1]];let i=0,s=null;for(const l of t){const c=(n=(e=l.textContent)==null?void 0:e.length)!=null?n:0;c>i&&(i=c,s=l)}s&&!r.includes(s)&&r.push(s);const o=t[Math.floor(t.length/2)];return r.includes(o)||r.push(o),r}const al=50,bu=Symbol("tickWidthFallback");function T2(t){var e,n,r;const i=t.select("line").node(),s=(n=(e=i==null?void 0:i.ownerDocument)==null?void 0:e.defaultView)!=null&&n.getComputedStyle?parseFloat(i.ownerDocument.defaultView.getComputedStyle(i).strokeWidth):parseFloat((r=i==null?void 0:i.getAttribute)==null?void 0:r.call(i,"stroke-width"));return Number.isFinite(s)&&s>0?s:1}function b2(t,e,n){var r;const i=(r=t==null?void 0:t.scale)==null?void 0:r.call(t);if(!i||e.length<2)return!1;const s=Math.max(1,n)/2,o=e.map(c=>+i(c)).filter(Number.isFinite).sort((c,u)=>c-u);if(o.length<2)return!1;let l=o[0]+s;for(let c=1;c<o.length;c++){const u=o[c]-s,f=o[c]+s;if(u<=l+Se)return!0;l=Math.max(l,f)}return!1}function S2(t,e){if(t.length<=al)return t;const n=new Map,r=l=>{l>=0&&l<t.length&&n.set(l,t[l])};r(0),r(t.length-1),r(Math.floor(t.length/2));const i=Math.max(1,Math.floor(t.length/(al-3)));let s=-1,o=0;for(let l=0;l<t.length;l+=i){r(l);const c=t[l],u=e?e(c):c,f=Array.isArray(u)?u.join("").length:String(u!=null?u:"").length;f>s&&(s=f,o=l)}return r(o),Array.from(n.keys()).sort((l,c)=>l-c).map(l=>n.get(l))}function A2(t){return ie(t)?rp(t):!Array.isArray(t)||t.length<=al?t:{length:t.length,first:t[0],middle:t[Math.floor(t.length/2)],last:t[t.length-1]}}function Su(t){return t[bu]}function il(t,e){ae(e)?Object.defineProperty(t,bu,{configurable:!0,value:e,writable:!0}):delete t[bu]}function Au(t){t.length=0,il(t)}function E2(t,e,n){Au(t),t.length=e,il(t,n)}function C2(t){const e=[];return e.length=t.length,Object.keys(t).forEach(n=>{const r=+n;e[r]=t[r]}),il(e,Su(t)),e}function I2(t,e){Au(t),t.length=e.length,Object.keys(e).forEach(n=>{const r=+n;t[r]=e[r]}),il(t,Su(e))}function R2(t,e,n){const r=t[e];if(ae(r))return r;const i=Number(r);return Number.isFinite(i)?i:n}const np=new WeakMap;let w2=0;function rp(t){if(!t||!/^(function|object)$/.test(typeof t))return`${typeof t}:${String(t)}`;let e=np.get(t);return e||(e=++w2,np.set(t,e)),`${typeof t}:${e}`}function Eu(t){return t instanceof Date?`date:${+t}`:Array.isArray(t)?`[${t.map(e=>Eu(e)).join(",")}]`:t&&typeof t=="object"?`{${Object.keys(t).sort().map(e=>`${e}:${Eu(t[e])}`).join(",")}}`:typeof t=="function"?rp(t):`${typeof t}:${String(t)}`}function Cu(t){return t instanceof Date?new Date(+t):Array.isArray(t)?t.map(e=>Cu(e)):t}function O2(t){return{width:t.width,height:t.height,ticks:t.ticks&&C2(t.ticks),clipPath:t.clipPath,domain:Cu(t.domain)}}function P2(t,e){return t.width=e.width,t.height=e.height,t.clipPath=e.clipPath,t.domain=Cu(e.domain),t.ticks&&e.ticks&&I2(t.ticks,e.ticks),t}var M2={getAxisInstance:function(){return this.axis||new L2(this)}};class L2{constructor(e){Sr(this,"owner"),Sr(this,"x"),Sr(this,"subX"),Sr(this,"subY"),Sr(this,"subY2"),Sr(this,"y"),Sr(this,"y2"),Sr(this,"axesList",{}),Sr(this,"tick",{x:null,y:null,y2:null}),Sr(this,"xs",[]),Sr(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom",subY:"left",subY2:"right"}),this.owner=e,this.setOrient()}getAxisClassName(e){return`${Rn.axis} ${Rn[`axis${Ln(e)}`]}`}isHorizontal(e,n){const r=e.config.axis_rotated;return n?r:!r}isCategorized(){const{config:e,state:n}=this.owner;return e.axis_x_type.indexOf("category")>=0||n.hasRadar}isCustomX(){const{config:e}=this.owner;return!this.isTimeSeries()&&(e.data_x||vn(e.data_xs))}isTimeSeries(e="x"){return this.owner.config[`axis_${e}_type`]==="timeseries"}isLog(e="x"){return this.owner.config[`axis_${e}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(e="x"){let n="linear";return this.isTimeSeries(e)?n=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(e)&&(n="log"),n}getExtent(){const e=this.owner,{config:n,scale:r}=e;let i=n.axis_x_extent;if(i){if(ie(i))i=i.bind(e.api)(e.getXDomain(e.data.targets),r.subX);else if(this.isTimeSeries()&&i.every(isNaN)){const s=Wn.bind(e);i=i.map(o=>r.subX(s(o)))}}return i}init(){const e=this.owner,{config:n,$el:{main:r,axis:i},state:{clip:s}}=e,o=["x","y"];n.axis_y2_show&&o.push("y2"),o.forEach(l=>{const c=this.getAxisClassName(l);i[l]=r.append("g").attr("class",c).attr("clip-path",()=>{let u=null;return l==="x"?u=s.pathXAxis:l==="y"&&(u=s.pathYAxis),u}).attr("transform",e.getTranslate(l)).style("visibility",n[`axis_${l}_show`]?null:"hidden"),this.generateAxes(l)})}setOrient(){const e=this.owner,{axis_rotated:n,axis_y_inner:r,axis_y2_inner:i}=e.config;this.orient={x:n?"left":"bottom",y:n?r?"top":"bottom":r?"right":"left",y2:n?i?"bottom":"top":i?"left":"right",subX:n?"left":"bottom",subY:n?r?"top":"bottom":r?"right":"left",subY2:n?i?"bottom":"top":i?"left":"right"}}generateAxes(e){const n=this.owner,{config:r}=n,i=[],s=r[`axis_${e}_axes`],o=r.axis_rotated;let l;e==="x"?l=o?"left":"bottom":e==="y"?l=o?"bottom":"left":e==="y2"&&(l=o?"top":"right"),s.length&&s.forEach(c=>{const u=c.tick||{},f=n.scale[e].copy();c.domain&&f.domain(c.domain);const d=new tp({outerTick:u.outer!==!1,noTransition:!1,config:r,id:e,isSubAxes:!0,owner:n}).scale(f).orient(l).tickFormat(ie(u.format)?u.format.bind(n.api):(h=>h));Ge(u.count)&&d.ticks(u.count),u.values&&d.tickValues(u.values),i.push(d)}),this.axesList[e]=i}updateAxes(){const e=this.owner,{config:n,$el:{main:r},$T:i}=e;Object.keys(this.axesList).forEach(s=>{const o=n[`axis_${s}_axes`],l=e.scale[s].copy(),c=l.range();this.axesList[s].forEach((u,f)=>{const d=u.scale().range();c.every((S,E)=>S===d[E])||u.scale().range(c);const h=`${this.getAxisClassName(s)}-${f+1}`;let m=r.select(`.${h.replace(/\s/,".")}`);m.empty()?(m=r.append("g").attr("class",h).style("visibility",n[`axis_${s}_show`]?null:"hidden"),u.create(m)):(o[f].domain&&l.domain(o[f].domain),u.scale(l).create(i(m))),m.attr("transform",e.getTranslate(s,f+1))})})}setAxis(e,n,r,i){const s=this.owner,o=Tu(e);rl(e)||(this.tick[o]=this.getTickValues(o)),this[e]=this.getAxis(e,n,r,e==="x"&&(s.scale.zoom||s.config.subchart_show||s.state.resizing)?!0:i)}getAxis(e,n,r,i,s){const o=this.owner,{config:l}=o,c=/^(x|subX)$/.test(e),u=Tu(e),f=c&&this.isCategorized(),d=this.orient[e],h=s?0:o.getAxisTickRotate(u);let m;if(c)m=e==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const $=rl(e)?l[`subchart_axis_${u}_tick_format`]||l[`axis_${u}_tick_format`]:l[`axis_${u}_tick_format`];ie($)&&(m=$.bind(o.api))}let S=rl(e)?this.getTickValues(u,!0):this.tick[u];const E=Xr({outerTick:r,noTransition:i,config:l,id:e,tickTextRotate:h,owner:o},c&&{isCategory:f,isInverted:l.axis_x_inverted,tickMultiline:l.axis_x_tick_multiline,tickWidth:l.axis_x_tick_width,tickTitle:f&&l.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});c||(E.tickStepSize=l[`axis_${u}_tick_stepSize`]);const C=new tp(E).scale(c&&o.scale.zoom||n).orient(d);if(c&&this.isTimeSeries()&&S&&!ie(S)){const $=Wn.bind(o);S=S.map(z=>$(z))}else!c&&this.isTimeSeriesY()&&(C.ticks(l.axis_y_tick_time_value),S=null);S&&C.tickValues(S),C.tickFormat(m||!c&&o.isStackNormalized()&&o.hasAxisGroupedData(u)&&($=>`${$}%`)),f&&(C.tickCentered(l.axis_x_tick_centered),lr(l.axis_x_tick_culling)&&(l.axis_x_tick_culling=!1));const w=pa(l,e,"count");return w&&C.ticks(w),C}updateXAxisTickValues(e,n){var r;const i=this.owner,{config:s}=i,o=s.axis_x_tick_fit,l=(u=s.axis_x_tick_count)=>{let f=u,d;return o&&(d=i.mapTargetsToUniqueXs(e),this.isCategorized()&&f>d.length&&(f=d.length),d=this.generateTickValues(d,f,this.isTimeSeries())),d},c=l();if(n)n.tickValues(c);else if(this.x){const u=this.getTickValues("x",!0),f=pa(s,"subX","count"),d=u!=null?u:f!==s.axis_x_tick_count?l(f):c;this.x.tickValues(c),(r=this.subX)==null||r.tickValues(d)}return c}getId(e){const{config:n,scale:r}=this.owner;let i=n.data_axes[e];return(!i||!r[i])&&(i="y"),i}getXAxisTickFormat(e){const n=this.owner,{config:r,format:i}=n,s=e&&r.subchart_axis_x_tick_format||r.axis_x_tick_format,o=this.isTimeSeries(),l=this.isCategorized();let c;return s?ie(s)?c=s.bind(n.api):o&&(c=u=>u?i.axisTime(s)(u):""):c=o?i.defaultAxisTime:l?n.categoryName:u=>u<0?u.toFixed(0):u,ie(c)?u=>c.apply(n,l?[u,n.categoryName(u)]:[u]):c}getTickValues(e,n=!1){const r=this.owner,i=n?pa(r.config,`sub${Ln(e)}`,"values"):r.config[`axis_${e}_tick_values`],s=ie(i)?i.call(r.api):i,o=r[`${e}Axis`];return n?s!=null?s:void 0:s||(o?o.tickValues():void 0)}getLabelOptionByAxisId(e){return this.owner.config[`axis_${e}_label`]}getLabelText(e){const n=this.getLabelOptionByAxisId(e);return je(n)?n:n?n.text:null}setLabelText(e,n){const r=this.owner,{config:i}=r,s=this.getLabelOptionByAxisId(e);je(s)?i[`axis_${e}_label`]=n:s&&(s.text=n)}getLabelPosition(e,n){const r=this.owner.config.axis_rotated,i=this.getLabelOptionByAxisId(e),s=Kn(i)&&i.position?i.position:n[+!r],o=l=>!!~s.indexOf(l);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}}getAxisLabelPosition(e){return this.getLabelPosition(e,e==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}xForAxisLabel(e){const n=this.owner,{state:{width:r,height:i}}=n,s=this.getAxisLabelPosition(e);let o=s.isMiddle?-i/2:0;return this.isHorizontal(n,e!=="x")?o=s.isLeft?0:s.isCenter?r/2:r:s.isBottom&&(o=-i),o}textAnchorForAxisLabel(e){const n=this.owner,r=this.getAxisLabelPosition(e);let i=r.isMiddle?"middle":"end";return this.isHorizontal(n,e!=="x")?i=r.isLeft?"start":r.isCenter?"middle":"end":r.isBottom&&(i="start"),i}dxForAxisLabel(e){const n=this.owner,r=this.getAxisLabelPosition(e);let i=r.isBottom?"0.5em":"0";return this.isHorizontal(n,e!=="x")?i=r.isLeft?"0.5em":r.isRight?"-0.5em":"0":r.isTop&&(i="-0.5em"),i}dyForAxisLabel(e){const n=this.owner,{config:r}=n,i=r.axis_rotated,s=this.getAxisLabelPosition(e).isInner,o=r[`axis_${e}_tick_rotate`]?n.getHorizontalAxisHeight(e):0,{width:l}=this.getMaxTickSize(e);let c;if(e==="x"){const u=r.axis_x_height;i?c=s?"1.2em":-25-l:s?c="-0.5em":u?c=u-10:o?c=o-10:c="3em"}else c={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[e],i?s?c=c[0]:o?c=o*(e==="y2"?-1:1)-c[1]:c=c[2]:c=s?c[3]:(c[4]+(r[`axis_${e}_inner`]?0:l+c[4]))*(e==="y"?-1:1);return c}getTickFormatCacheValue(e){const n=this.owner,{config:r}=n;return e==="x"?{format:r.axis_x_tick_format,type:r.axis_x_type,localtime:r.axis_x_localtime,categories:r.axis_x_categories}:{format:r[`axis_${e}_tick_format`],normalized:n.isStackNormalized(),grouped:n.hasAxisGroupedData(e),type:r[`axis_${e}_type`]}}getMaxTickSizeFingerprint(e,n,r,i,s,o){var l;const c=this.owner,{config:u,state:f}=c,d=e==="x",h=d?"axis_x":`axis_${e}`,m=i.tickValues();return Eu({id:e,withoutRecompute:!!o,dataGeneration:f.dataGeneration,size:[f.current.width,f.current.height],range:(l=n.range)==null?void 0:l.call(n),domain:r,type:n.type,orient:this.orient[e],axisRotated:u.axis_rotated,evalTextSize:u.axis_evalTextSize,format:this.getTickFormatCacheValue(e),ticks:{values:A2(m),rawValues:u[`${h}_tick_values`],arguments:i.ticks(),count:u[`${h}_tick_count`],rotate:s,show:u[`${h}_tick_show`],textShow:u[`${h}_tick_text_show`],textPosition:u[`${h}_tick_text_position`],inner:u[`${h}_tick_inner`],culling:u[`${h}_tick_culling`],cullingMax:u[`${h}_tick_culling_max`],cullingLines:u[`${h}_tick_culling_lines`],cullingReverse:u[`${h}_tick_culling_reverse`],stepSize:!d&&u[`${h}_tick_stepSize`],timeValue:!d&&u[`${h}_tick_time_value`],fit:d&&u.axis_x_tick_fit,autorotate:d&&u.axis_x_tick_autorotate,centered:d&&u.axis_x_tick_centered,inverted:d&&u.axis_x_inverted,multiline:d&&u.axis_x_tick_multiline,width:d&&u.axis_x_tick_width}})}getMaxTickSize(e,n){var r;const i=this.owner,{config:s,state:o,$el:{svg:l,chart:c}}=i,{current:u,resizing:f}=o,d=u.maxTickSize[e],h=`${Oe.maxTickSize}_${e}_${!!n}`,m=i.cache.get(h);if(m&&m.generation===o.redrawGeneration)return d;const S=`axis_${e}`,E={width:0,height:0};let C;if(f||n||!s[`${S}_show`]||d.width>0&&i.filterTargetsToShow().length===0)return d;if((l||s.render_mode==="canvas")&&((r=i.scale[e])!=null&&r.copy)){const w=/^y2?$/.test(e),$=i.getTargetsToShow(),z=i.scale[e].copy().domain(i[`get${w?"Y":"X"}Domain`]($,e)),B=z.domain(),W=B[0]===B[1]&&B.every(St=>St>0),H=qe(d.domain)&&d.domain[0]===d.domain[1]&&d.domain.every(St=>St>0);if(W||H)return d;d.domain=B,w||Au(d.ticks);const _=this.getAxis(e,z,!1,!1,!0),q=s[`${S}_tick_rotate`],st=s[`${S}_tick_count`];if(!s[`${S}_tick_values`]&&st&&_.tickValues(this.generateTickValues(B,st,w?this.isTimeSeriesY():this.isTimeSeries())),!w&&this.updateXAxisTickValues($,_),C=this.getMaxTickSizeFingerprint(e,z,B,_,q,n),(m==null?void 0:m.fingerprint)===C)return i.cache.add(h,x2(m2({},m),{generation:o.redrawGeneration})),P2(d,m.value);const ot=_.tickValues(),ct=!w&&Array.isArray(ot)&&ot.length>al;ct&&_.tickValues(S2(ot,_.tickFormat()));const gt=c.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),tt=gt.append("g").attr("class",`${Rn[`axis${Ln(e)}`]} ${ze.dummy}`);_.create(tt);const{sizeFor1Char:ft}=tt.node(),lt=gt.selectAll("text").attr("transform",ae(q)?`rotate(${q})`:null),bt=ct?ot.length:lt.size();if(ft)lt.each(function(St,Mt){const Ot=this.textContent.length*ft.w,Kt=ft.h;E.width=Math.max(E.width,Ot),E.height=Math.max(E.height,Kt),w||(d.ticks[Mt]=Ot)});else{const St=[];if(lt.each(function(){St.push(this)}),(St.length<=5?St:y2(St)).map(Ot=>ln(Ot,!0)).forEach(Ot=>{E.width=Math.max(E.width,Ot.width),E.height=Math.max(E.height,Ot.height)}),!w)for(let Ot=0;Ot<St.length;Ot++)d.ticks[Ot]=E.width}!w&&ct&&E2(d.ticks,bt,E.width),gt.remove()}return Object.keys(E).forEach(w=>{E[w]>0&&(d[w]=E[w])}),i.cache.add(h,{fingerprint:C,generation:o.redrawGeneration,value:O2(d)}),d}getXAxisTickTextY2Overflow(e){const n=this.owner,{axis:r,config:i,state:{current:s,isLegendRight:o,legendItemWidth:l}}=n,c=n.getAxisTickRotate("x"),u=c>0&&c<90;if((r.isCategorized()||r.isTimeSeries())&&i.axis_x_tick_fit&&(!i.axis_x_tick_culling||lr(i.axis_x_tick_culling))&&!i.axis_x_tick_multiline&&u){const f=i.axis_y2_show&&s.maxTickSize.y2.width||0,d=o&&l||0,h=s.width-n.getCurrentPaddingByDirection("left"),m=this.getXAxisTickMaxOverflow(c,h-e)-f-d,S=Math.max(0,m)+e;return Math.min(S,h/2)}return 0}getXAxisTickMaxOverflow(e,n){var r;const i=this.owner,{axis:s,config:o,state:l}=i,c=s.isTimeSeries(),u=l.current.maxTickSize.x.ticks,f=u.length,d=(r=Su(u))!=null?r:l.current.maxTickSize.x.width,{left:h,right:m}=l.axis.x.padding;let S=0;const E=f-(c&&o.axis_x_tick_fit?.5:0);for(let $=0;$<f;$++){const z=$+1,B=Math.cos(Math.PI*e/180)*R2(u,$,d),W=z-(c?1:.5)+h;if(W<=0)continue;const _=(n-B)/W,q=E-z,st=m*_,it=q*_+st,ot=B-_/2-it;S=Math.max(S,ot)}const C=i.getTargetsToShow();let w=0;if(!c&&o.axis_x_tick_count<=C.length&&C[0].values.length){const $=sa(i.axis.getAxisType("x"),0,n-S).domain([h*-1,i.getXDomainMax(i.data.targets)+1+m]);w=($(1)-$(0))/2}return S+w}updateLabels(e){const n=this.owner,{config:r,$el:{main:i},$T:s}=n,o=r.axis_rotated;["x","y","y2"].forEach(l=>{const c=this.getLabelText(l),u=`axis${Ln(l)}`,f=Rn[`${u}Label`];if(c){let d=i.select(`text.${f}`);d.empty()&&(d=i.select(`g.${Rn[u]}`).insert("text",":first-child").attr("class",f).attr("transform",["rotate(-90)",null][l==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(l))),s(d,e).attr("x",()=>this.xForAxisLabel(l)).attr("dx",()=>this.dxForAxisLabel(l)).attr("dy",()=>this.dyForAxisLabel(l)).text(c)}})}getPadding(e,n,r,i){const s=ae(e)?e:e[n];return Ge(s)?this.owner.convertPixelToScale(/(bottom|top)/.test(n)?"y":"x",s,i):r}generateTickValues(e,n,r){let i=e;if(n){const s=ie(n)?n():n;if(s===1)i=[e[0]];else if(s===2)i=[e[0],e[e.length-1]];else if(s>2){const o=this.isCategorized(),l=s-2,c=e[0],u=e[e.length-1],f=(u-c)/(l+1);let d;i=[c];for(let h=0;h<l;h++)d=+c+f*(h+1),i.push(r?new Date(d):o?Math.round(d):d);i.push(u)}}return r||(i=i.sort((s,o)=>s-o)),i}generateTransitions(e){const n=this.owner,{$el:{axis:r},$T:i}=n,[s,o,l,c,u,f]=["x","y","y2","subX","subY","subY2"].map(d=>i(r[d],e));return{axisX:s,axisY:o,axisY2:l,axisSubX:c,axisSubY:u,axisSubY2:f}}redraw(e,n,r){const i=this.owner,{config:s,state:o,$el:l}=i,c=n?"0":null;["x","y","y2","subX","subY","subY2"].forEach(u=>{const f=this[u],d=l.axis[u];f&&d&&(!r&&!s.transition_duration&&(f.config.withoutTransition=!0),d.style("opacity",c),f.create(e[`axis${Ln(u)}`]))}),this.updateAxes(),!o.rendered&&s.axis_tooltip&&this.setAxisTooltip()}syncAxisDomains(e,n,r){var i;const s=this.owner,{config:o,scale:l,$el:c}=s,u=!!l.zoom;let f;if(!u&&this.isCategorized()&&e.length===0&&c.axis.x&&l.x.domain([0,c.axis.x.selectAll(".tick").size()]),l.x&&e.length?(!u&&s.updateXDomain(e,n.UpdateXDomain,n.UpdateOrgXDomain,n.TrimXDomain),o.axis_x_tick_values||this.updateXAxisTickValues(e)):this.x&&(this.x.tickValues([]),(i=this.subX)==null||i.tickValues([])),o.zoom_rescale&&!r&&(f=l.x.orgDomain()),["y","y2"].forEach(d=>{const h=`axis_${d}_`,m=l[d];if(m){const S=o[`${h}tick_values`],E=o[`${h}tick_count`];if(m.domain(s.getYDomain(e,d,f)),!S&&E){const C=s.axis[d],w=m.domain();C.tickValues(this.generateTickValues(w,w.every($=>$===0)?1:E,this.isTimeSeriesY()))}}}),n.Y){const d=()=>{var h,m;(h=l.subY)==null||h.domain(s.getYDomain(e,"y")),(m=l.subY2)==null||m.domain(s.getYDomain(e,"y2")),["y","y2"].forEach(S=>{const E=S==="y2"?"subY2":"subY",C=l[E],w=s.axis[E],$=this.getTickValues(S,!0),z=pa(o,E,"count");if(!C||!w||$||!z)return;const B=C.domain();w.tickValues(this.generateTickValues(B,B.every(W=>W===0)?1:z,this.isTimeSeriesY()))})};o.subchart_show?s.withSubchartTypeContext(d):d()}}redrawAxis(e,n,r,i,s){const o=this.owner;this.syncAxisDomains(e,n,i),this.redraw(r,o.hasArcType(),s),this.updateLabels(n.Transition),(n.UpdateXDomain||n.UpdateXAxis||n.Y)&&e.length&&this.setCulling()}setCulling(){const e=this.owner,{config:n,state:{clip:r,current:i},$el:s}=e;["subX","x","y","y2","subY","subY2"].forEach(o=>{const l=s.axis[o],c=pa(n,o,"culling");if(l&&c){const u=l.selectAll(".tick"),f=ti(u.data(),!pa(n,o,"culling_reverse")),d=f.length,h=pa(n,o,"culling_max"),S=!pa(n,o,"culling_lines")||b2(this[o],f,T2(u));let E;if(d){for(let w=1;w<d;w++)if(d/w<h){E=w;break}E=E!=null?E:d;const C=new Map;for(let w=0;w<f.length;w++)C.set(f[w],w);u.each(function(w){var $;const z=S?this:this.querySelector("text");z&&(z.style.display=(($=C.get(w))!=null?$:0)%E?"none":null)})}else u.style("display",null);if(o==="x"){const C=i.maxTickSize.x.clipPath?r.pathXAxisTickTexts:null;s.svg.selectAll(`.${Rn.axisX} .tick text`).attr("clip-path",C)}}})}setAxisTooltip(){var e;const n=this.owner,{config:{axis_rotated:r,axis_tooltip:i},$el:{axis:s,axisTooltip:o}}=n,l=(e=i.backgroundColor)!=null?e:"black";n.generateTextBGColorFilter(l,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(c=>{var u,f,d;if(je(l)||l[c])if(o[c]=(u=s[c])==null?void 0:u.append("text").classed(Rn[`axis${c.toUpperCase()}Tooltip`],!0).attr("filter",n.updateTextBGColor({id:c},l)),r){const h=c==="x"?"x":"y",m=c==="y"?"1.15em":c==="x"?"-0.3em":"-0.4em";(f=o[c])==null||f.attr(h,m).attr(`d${c==="x"?"y":"x"}`,c==="x"?"0.4em":"-1.3em").style("text-anchor",c==="x"?"end":null)}else{const h=c==="x"?"y":"x",m=c==="x"?"1.15em":`${c==="y"?"-":""}0.4em`;(d=o[c])==null||d.attr(h,m).attr(`d${c==="x"?"x":"y"}`,c==="x"?"-1em":"0.3em").style("text-anchor",c==="y"?"end":null)}})}}var ap=Math.pow,D2={initEventRect(){this.$el.main.select(`.${ze.chart}`).append("g").attr("class",Zr.eventRects).style("fill-opacity","0")},redrawEventRect(){var t;const e=this,{config:n,state:r,$el:i}=e,s=e.isMultipleX(),o=n.axis_x_inverted;if(i.eventRect)e.updateEventRect(i.eventRect,!0);else if(e.data.targets.length){const c=e.$el.main.select(`.${Zr.eventRects}`).style("cursor",n.zoom_enabled&&n.zoom_type!=="drag"?n.axis_rotated?"ns-resize":"ew-resize":null).classed(Zr.eventRectsMultiple,s).classed(Zr.eventRectsSingle,!s).selectAll(`.${Zr.eventRect}`).data([0]).enter().append("rect");e.updateEventRect(c),e.updateEventType(c),c.call(e.getDraggableSelection()),i.eventRect=c,e.state.inputType==="touch"&&!i.svg.on("touchstart.eventRect")&&!e.hasArcType()&&e.bindTouchOnEventRect(),r.rendered&&e.updateEventRect(i.eventRect,!0)}if(!s){const l=e.getMaxDataCountTarget();(!n.data_xSort||o)&&l.sort((c,u)=>o?u.x-c.x:c.x-u.x),e.updateDataIndexByX(l),e.updateXs(l),(t=e.updatePointClass)==null||t.call(e,!0),r.eventReceiver.data=l}e.updateEventRectData()},bindTouchOnEventRect(){const t=this,{config:e,state:n,$el:{eventRect:r,svg:i}}=t,s=m=>{if(t.isMultipleX())t.selectRectForMultipleXs(m);else{const S=t.getDataIndexFromEvent(n.event);t.callOverOutForTouch(S),S===-1?t.unselectRect():t.selectRectForSingle(m,S)}},o=()=>{t.unselectRect(),t.callOverOutForTouch()},l=e.interaction_inputType_touch.preventDefault,c=Ra(l)&&l||!1,u=!isNaN(l)&&l||null;let f;const d=!c&&u===null,h=m=>{const S=m.type,C=m.changedTouches[0][`client${e.axis_rotated?"Y":"X"}`];S==="touchstart"?c?m.preventDefault():u!==null&&(f=C):S==="touchmove"&&(c||f===!0||u!==null&&Math.abs(f-C)>=u)&&(f=!0,m.preventDefault())};r.on("touchstart",m=>{n.event=m,t.updateEventRect()},{passive:d}).on("touchstart.eventRect touchmove.eventRect",m=>{if(n.event=m,!r.empty()&&r.classed(Zr.eventRect)){if(n.dragging||n.flowing||t.hasArcType()||m.touches.length>1)return;h(m),s(r.node())}else o()},{passive:d}).on("touchend.eventRect",m=>{n.event=m,!r.empty()&&r.classed(Zr.eventRect)&&(t.hasArcType()||!t.toggleShape||n.cancelClick)&&n.cancelClick&&(n.cancelClick=!1)},{passive:d}),i.on("touchstart",m=>{n.event=m;const{target:S}=m;S&&S!==r.node()&&o()},{passive:d})},updateEventRect(t,e=!1){const n=this,{state:r,$el:i}=n,{eventReceiver:s,width:o,height:l,rendered:c,resizing:u}=r,f=t||i.eventRect,d=()=>{if(s){const h=Oh(i.chart.node());s.rect=ln(f.node(),!0).toJSON(),s.rect.top+=h.y,s.rect.left+=h.x}};(!c||u||e)&&(f.attr("x",0).attr("y",0).attr("width",o).attr("height",l),(!c||e)&&f.classed(Zr.eventRect,!0)),d()},updateEventType(t){const e=this,n=Ra(t),r=n?e.$el.eventRect:t,i=n?t!==(r==null?void 0:r.datum().multipleX):!1;r&&(i&&(r==null||r.on("mouseover mousemove mouseout click",null)),e.isMultipleX()?e.generateEventRectsForMultipleXs(r):e.generateEventRectsForSingleX(r))},updateEventRectData(){const t=this,{config:e,scale:n,state:r}=t,i=n.zoom||n.x,s=e.axis_rotated,o=t.isMultipleX(),l=i==null?void 0:i.domain(),c=l?`${l[0]}_${l[1]}_${r.width}_${r.height}_${t.data.targets.length}_${r.dataGeneration}_${[...r.hiddenTargetIds].join(",")}`:null;if(c&&c===r._eventRectFingerprint)return;r._eventRectFingerprint=c;let u,f,d,h;if(t.updateEventType(o),o)u=0,f=0,d=r.width,h=r.height;else{let E,C;if(t.axis.isCategorized())E=t.getEventRectWidth(),C=w=>i(w.x)-E/2;else{const w=({index:$})=>({prev:t.getPrevX($),next:t.getNextX($)});E=$=>{const z=w($),B=i.domain();let W;return z.prev===null&&z.next===null?W=s?r.height:r.width:z.prev===null?W=(i(z.next)+i($.x))/2:z.next===null?W=i(B[1])-(i(z.prev)+i($.x))/2:W=Math.max(0,(i(z.next)-i(z.prev))/2),W},C=$=>{const z=w($);let B;return z.prev===null&&z.next===null?B=0:z.prev===null?B=i(i.domain()[0]):B=(i($.x)+i(z.prev))/2,B}}u=s?0:C,f=s?C:0,d=s?r.width:E,h=s?E:r.height}const{eventReceiver:m}=r,S=(E,C)=>ie(E)?E(C):E;m.coords.splice(m.data.length),m.data.forEach((E,C)=>{m.coords[C]={x:S(u,E),y:S(f,E),w:S(d,E),h:S(h,E)}})},selectRectForSingle(t,e){var n,r,i,s,o,l,c;const u=this,{config:f,state:d,$el:{main:h,circle:m}}=u,S=f.data_selection_enabled,E=f.data_selection_grouped,C=f.data_selection_isselectable,w=f.tooltip_grouped,$=u.getAllValuesOnIndex(e);if(w&&(u.showTooltip($,t),(n=u.showGridFocus)==null||n.call(u,$),(r=u.showSubchartGridFocus)==null||r.call(u,$),!S||E))return;!m&&h.selectAll(`.${ze.EXPANDED}:not(.${Tn.shape}-${e})`).classed(ze.EXPANDED,!1);const z=h.selectAll(`.${Tn.shape}-${e}`).classed(ze.EXPANDED,!0).style("cursor",C?"pointer":null).filter(function(B){return u.isWithinShape(this,B)});if(z.call(B=>{var W,H,_;const q=B.data();S&&(E||C!=null&&C.bind(u.api)(q))&&(t.style.cursor="pointer"),w||(u.showTooltip(q,t),(W=u.showGridFocus)==null||W.call(u,q),(H=u.showSubchartGridFocus)==null||H.call(u,q),(_=u.unexpandCircles)==null||_.call(u),B.each(st=>u.setExpand(e,st.id)))}),!w&&z.empty()){const B=Jn(d.event,t),W=$.filter(H=>u.isTargetToShow(H.id)?u.dist(H,B)<u.getPointSensitivity(H):!1);if(W.length>0){let H=W[0],_=u.dist(H,B);for(let q=1;q<W.length;q++){const st=W[q],it=u.dist(st,B);it<_&&(_=it,H=st)}u.showTooltip([H],t),(i=u.showGridFocus)==null||i.call(u,[H]),(s=u.showSubchartGridFocus)==null||s.call(u,[H]),(o=u.unexpandCircles)==null||o.call(u),u.setExpand(e,H.id,!0),S&&(E||C!=null&&C.bind(u.api)(H))&&(t.style.cursor="pointer")}else f.interaction_onout&&((l=u.hideGridFocus)==null||l.call(u),(c=u.hideSubchartGridFocus)==null||c.call(u),u.hideTooltip(),!E&&u.setExpand(e))}},selectRectForMultipleXs(t,e=!0){var n,r;const i=this,{config:s,state:o}=i,l=i.getTargetsToShow();if(o.dragging||i.hasArcType(l))return;const c=Jn(o.event,t),u=i.findClosestFromTargets(l,c);if(e&&o.mouseover&&(!u||u.id!==o.mouseover.id)&&(s.data_onout.call(i.api,o.mouseover),o.mouseover=void 0),!u){i.unselectRect();return}const d=(i.isBubbleType(u)||i.isScatterType(u)||!s.tooltip_grouped?[u]:i.filterByX(l,u.x)).map(m=>i.addName(m));i.showTooltip(d,t),i.setExpand(u.index,u.id,!0),(n=i.showGridFocus)==null||n.call(i,d),(r=i.showSubchartGridFocus)==null||r.call(i,d);const h=i.dist(u,c);(i.isBarType(u.id)||h<i.getPointSensitivity(u))&&(i.$el.eventRect.style("cursor","pointer"),e&&(!o.mouseover||o.mouseover.x!==u.x||o.mouseover.id!==u.id)&&(s.data_onover.call(i.api,u),o.mouseover=u))},unselectRect(){var t,e,n,r;const i=this,{state:s,$el:{circle:o,tooltip:l}}=i;if(s._lastTooltipMouse=null,s.isCanvasMode){(t=i.clearCanvasFocus)==null||t.call(i),l&&i.hideTooltip();return}(e=i.$el.eventRect)==null||e.style("cursor",null),(n=i.hideGridFocus)==null||n.call(i),(r=i.hideSubchartGridFocus)==null||r.call(i),l&&(i.hideTooltip(),i._handleLinkedCharts(!1)),o&&!i.isPointFocusOnly()&&i.unexpandCircles(),i.expandBarTypeShapes(!1)},generateEventRectsForSingleX(t){const e=this,{config:n,state:r}=e,{eventReceiver:i}=r,s=t.style("cursor",n.data_selection_enabled&&n.data_selection_grouped?"pointer":null).on("click",function(o){r.event=o;const{currentIdx:l,data:c}=i,u=c[l===-1?e.getDataIndexFromEvent(o):l];e.clickHandlerForSingleX.bind(this)(u,e)}).datum({multipleX:!1});if(r.inputType==="mouse"){const o=l=>{const c=l?e.getDataIndexFromEvent(l):i.currentIdx;return c>-1?i.data[c]:null};s.on("mouseover",l=>{r.event=l,e.updateEventRect(),Object.values(e.$el.axisTooltip).forEach(c=>c==null?void 0:c.style("display",null))}).on("mousemove",function(l){var c;const u=o(l);if(r.event=l,!u)return;let{index:f}=u;const d=n.line_step_type;if(n.line_step_tooltipMatch&&e.hasType("step")&&/^step\-(before|after)$/.test(d)){const m=e.scale.zoom||e.scale.x,S=e.axis.xs[f],E=m.invert(Jn(l,this)[0]);d==="step-after"&&E<S?f-=1:d==="step-before"&&E>S&&(f+=1)}(c=e.showAxisGridFocus)==null||c.call(e);const h=n.tooltip_grouped&&f===i.currentIdx;if(r.dragging||r.flowing||e.hasArcType()||h){if(n.tooltip_show&&h){const[m,S]=Jn(l,this),E=r._lastTooltipMouse;(!E||ap(m-E[0],2)+ap(S-E[1],2)>=9)&&(r._lastTooltipMouse=[m,S],e.setTooltipPosition())}return}f!==i.currentIdx&&(e.setOverOut(!1,i.currentIdx),i.currentIdx=f),f===-1?e.unselectRect():e.selectRectForSingle(this,f),e.setOverOut(f!==-1,f)}).on("mouseout",l=>{var c;r.event=l,!(!e.config||e.hasArcType()||i.currentIdx===-1||!n.interaction_onout)&&((c=e.hideAxisGridFocus)==null||c.call(e),e.unselectRect(),e.setOverOut(!1,i.currentIdx),i.currentIdx=-1)})}return s},clickHandlerForSingleX(t,e){const n=e,{config:r,state:i,$el:{main:s}}=n;if(!t||n.hasArcType()||i.cancelClick){i.cancelClick&&(i.cancelClick=!1);return}const{index:o}=t;s.selectAll(`.${Tn.shape}-${o}`).each(function(l){var c;(r.data_selection_grouped||n.isWithinShape(this,l))&&((c=n.toggleShape)==null||c.call(n,this,l,o),r.data_onclick.bind(n.api)(l,this))})},generateEventRectsForMultipleXs(t){const e=this,{config:n,state:r}=e;t.on("click",function(i){r.event=i,e.clickHandlerForMultipleXS.bind(this)(e)}).datum({multipleX:!0}),r.inputType==="mouse"&&t.on("mouseover mousemove",function(i){r.event=i,e.selectRectForMultipleXs(this)}).on("mouseout",i=>{r.event=i,!(!e.config||e.hasArcType()||!n.interaction_onout)&&e.unselectRect()})},clickHandlerForMultipleXS(t){const e=t,{config:n,state:r}=e,i=e.getTargetsToShow();if(e.hasArcType(i))return;const s=Jn(r.event,this),o=e.findClosestFromTargets(i,s);if(!o)return;const l=e.getPointSensitivity(o);(e.isBarType(o.id)||e.dist(o,s)<l)&&e.$el.main.selectAll(`.${Tn.shapes}${e.getTargetSelectorSuffix(o.id)}`).selectAll(`.${Tn.shape}-${o.index}`).each(function(){var c;(n.data_selection_grouped||e.isWithinShape(this,o))&&((c=e.toggleShape)==null||c.call(e,this,o,o.index),n.data_onclick.bind(e.api)(o,this))})}},F2={initClip(){const t=this,{clip:e,datetimeId:n}=t.state;e.id=`${n}-clip`,e.idXAxis=`${e.id}-xaxis`,e.idYAxis=`${e.id}-yaxis`,e.idGrid=`${e.id}-grid`,e.path=t.getClipPath(e.id),e.pathXAxis=t.getClipPath(e.idXAxis),e.pathYAxis=t.getClipPath(e.idYAxis),e.pathGrid=t.getClipPath(e.idGrid)},getClipPath(t){const e=this,{config:n}=e;return!n.clipPath&&/-clip$/.test(t)||!n.axis_x_clipPath&&/-clip-xaxis$/.test(t)||!n.axis_y_clipPath&&/-clip-yaxis$/.test(t)?null:`url(#${t})`},appendClip(t,e){e&&t.append("clipPath").attr("id",e).append("rect")},setXAxisClipPath(t){const e=this,{config:n,state:{margin:r,width:i,height:s}}=e,o=n.axis_rotated,l=Math.max(30,r.left)-(o?0:20),c=(o?r.top+s+10:r.bottom)+20,u=o?-(1+l):-(l-1),f=-15,d=o?r.left+20:i+10+l;t.attr("x",u).attr("y",f).attr("width",d).attr("height",c)},setYAxisClipPath(t){const e=this,{config:n,state:{margin:r,width:i,height:s}}=e,o=n.axis_rotated,l=Math.max(30,r.left)-(o?20:0),c=n.axis_y_inner,u=c&&!o?n.axis_y_label.text?-20:-1:o?-(1+l):-(l-1),f=-(o?20:r.top),d=(o?i+15+l:r.left+20)+(c?20:0),h=(o?r.bottom+10:r.top+s)+10;t.attr("x",u).attr("y",f).attr("width",d).attr("height",h)},updateXAxisTickClip(){const t=this,{config:e,state:{clip:n,xAxisHeight:r},$el:{defs:i}}=t,s=t.getHorizontalAxisHeight("x");if(i&&!n.idXAxisTickTexts){const o=`${n.id}-xaxisticktexts`;t.appendClip(i,o),n.idXAxisTickTexts=o,n.pathXAxisTickTexts=t.getClipPath(n.idXAxisTickTexts)}!e.axis_x_tick_multiline&&t.getAxisTickRotate("x")&&s!==r&&(t.setXAxisTickClipWidth(),t.setXAxisTickTextClipPathWidth()),t.state.xAxisHeight=s},setXAxisTickClipWidth(){const t=this,{config:e,state:{current:{maxTickSize:n}}}=t,r=t.getAxisTickRotate("x");if(!e.axis_x_tick_multiline&&r){const i=Math.sin(Math.PI/180*Math.abs(r));n.x.clipPath=(t.getHorizontalAxisHeight("x")-20)/i}else n.x.clipPath=null},setXAxisTickTextClipPathWidth(){const t=this,{state:{clip:e,current:n},$el:{svg:r}}=t;r&&r.select(`#${e.idXAxisTickTexts} rect`).attr("width",n.maxTickSize.x.clipPath).attr("height",30)}},N2={getAxisSize(t){const e=this,n=e.config.axis_rotated;return n&&t==="x"||!n&&/y2?/.test(t)?e.getAxisWidthByAxisId(t,!0):e.getHorizontalAxisHeight(t)},getAxisWidthByAxisId(t,e){var n,r;const i=this;if(i.axis){const s=(n=i.axis)==null?void 0:n.getAxisLabelPosition(t),{width:o}=i.axis.getMaxTickSize(t,e),l=o===0?.5:0;return o+(((r=i.config.padding)==null?void 0:r.mode)==="fit"?s.isInner?10+l:10:s.isInner?20+l:40)}else return 40},getHorizontalAxisHeight(t){var e,n;const r=this,{config:i,state:s}=r,{rotatedPadding:o,isLegendRight:l,isLegendInset:c}=s,u=i.axis_rotated,f=((e=i.padding)==null?void 0:e.mode)==="fit",d=i[`axis_${t}_inner`],h=i[`axis_${t}_label`].text,m=13;let S=((n=i.padding)==null?void 0:n.mode)==="fit"?d&&!h?t==="y"?1:0:20:30;if(t==="x"&&!i.axis_x_show)return 8;if(t==="x"&&ae(i.axis_x_height))return i.axis_x_height;if(t==="y"&&!i.axis_y_show)return i.legend_show&&!l&&!c?10:1;if(t==="y2"&&!i.axis_y2_show)return f?0:o.top;const E=r.axis.getMaxTickSize(t),C=Math.abs(i.axis_x_tick_rotate)>0&&(!i.axis_x_tick_autorotate||r.needToRotateXAxisTickTexts());return(i.axis_x_tick_multiline||C)&&E.height>m&&(S+=E.height-m),S+(r.axis.getAxisLabelPosition(t).isInner?0:10)+(t==="y2"&&!u?-10:0)},getEventRectWidth(){const t=this,{config:e,axis:n}=t,r=e.axis_x_inverted,i=n.x.tickInterval();return Math.max(0,r?Math.abs(i):i)},getAxisTickRotate(t){const e=this,{axis:n,config:r,state:i,$el:s}=e;let o=r[`axis_${t}_tick_rotate`];if(t==="x"){const l=n.isCategorized()||n.isTimeSeries();if(r.axis_x_tick_fit&&l){const c=r.axis_x_tick_count,u=i.current.maxTickSize.x.ticks.length;let f=0;if(c?f=c>u?u:c:u&&(f=u),f!==i.axis.x.tickCount){const{targets:d}=e.data;i.axis.x.padding=e.getXDomainPadding([e.getXDomainMinMax(d,"min"),e.getXDomainMinMax(d,"max")],f)}i.axis.x.tickCount=f}(s.svg||i.isCanvasMode)&&r.axis_x_tick_autorotate&&r.axis_x_tick_fit&&!r.axis_x_tick_multiline&&!r.axis_x_tick_culling&&l&&(o=e.needToRotateXAxisTickTexts()?r.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const t=this,{state:{axis:e,current:n,isLegendRight:r,legendItemWidth:i}}=t,s=r&&i,o=n.width-s-t.getCurrentPaddingByDirection("left")-t.getCurrentPaddingByDirection("right"),l=e.x.tickCount+e.x.padding.left+e.x.padding.right,{width:c}=t.axis.getMaxTickSize("x"),u=l?o/l:0;return c>u}},$2={axis_x_clipPath:!0,axis_x_show:!0,axis_x_forceAsSingle:!1,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_culling_lines:!0,axis_x_tick_culling_reverse:!1,axis_x_tick_count:void 0,axis_x_tick_inner:!1,axis_x_tick_show:!0,axis_x_tick_text_show:!0,axis_x_tick_text_inner:!1,axis_x_tick_text_position:{x:0,y:0},axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_autorotate:!1,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_tick_tooltip:!1,axis_x_max:void 0,axis_x_min:void 0,axis_x_inverted:!1,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_x_axes:[]},B2={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_culling_reverse:!1,axis_y_tick_inner:!1,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},z2={axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_culling_reverse:!1,axis_y2_tick_inner:!1,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]},U2=Object.defineProperty,ip=Object.getOwnPropertySymbols,k2=Object.prototype.hasOwnProperty,G2=Object.prototype.propertyIsEnumerable,sp=(t,e,n)=>e in t?U2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Iu=(t,e)=>{for(var n in e||(e={}))k2.call(e,n)&&sp(t,n,e[n]);if(ip)for(var n of ip(e))G2.call(e,n)&&sp(t,n,e[n]);return t},X2=Iu(Iu(Iu({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},$2),B2),z2),W2={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const V2=[r2,a2,i2],op={axis:M2,clip:F2,eventrect:D2,sizeAxis:N2},lp={optDataAxis:W2,optAxis:X2};function cp(t){return Object.keys(t).map(e=>t[e])}function up(t=[],e=[]){xn(br.prototype,cp(op).concat(t)),xn(jn.prototype,V2),$a.setOptions(cp(lp).concat(e))}function Ts(t=[],e=[]){up(t,e)}function ea(t,e=[]){const n=Array.isArray(t)?t:t?[t]:[];up([Ti,tl,e2].concat(n),[ka,n2].concat(e))}let fp=()=>(ea(xi,[yi]),(fp=()=>qt.AREA)()),dp=()=>(ea(xi,[yi]),(dp=()=>qt.AREA_LINE_RANGE)()),hp=()=>(ea(xi,[yi]),(hp=()=>qt.AREA_STEP_RANGE)()),vp=()=>(ea(xi,[yi,xu]),(vp=()=>qt.AREA_SPLINE)()),gp=()=>(ea(xi,[yi,xu]),(gp=()=>qt.AREA_SPLINE_RANGE)()),pp=()=>(ea(xi,[yi]),(pp=()=>qt.AREA_STEP)());function Ru(t){const e=this.config.bar_connectLine,n=(e==null?void 0:e[t])||e;return/^(start|end)\-(start|end)$/.test(n)?n:null}var j2={initBar(){const{$el:t,config:e,state:{clip:n}}=this;t.bar=t.main.select(`.${ze.chart}`),t.bar=e.bar_front?t.bar.append("g"):t.bar.insert("g",":first-child"),t.bar.attr("class",rr.chartBars).call(this.setCssRule(!1,`.${rr.chartBars}`,["pointer-events:none"])),e.clipPath===!1&&(e.bar_radius||e.bar_radius_ratio)&&t.bar.attr("clip-path",n.pathXAxis.replace(/#[^)]*/,`#${n.id}`))},updateTargetsForBar(t){const e=this,{config:n}=e,r=e.getClass("bars",!0),i=n.interaction_enabled&&n.data_selection_isselectable;su.call(e,t,{type:"Bar",elKey:"bar",containerClass:rr.chartBars,itemClass:rr.chartBar,initFn:e.initBar}).append("g").attr("class",r).style("cursor",o=>{var l;return(l=i==null?void 0:i.bind)!=null&&l.call(i,e.api)(o)?"pointer":null}).call(o=>{e.setCssRule(!0,` .${rr.bar}`,["fill"],e.color)(o),o.each(function(l){Ru.call(e,l.id)&&Yt(this).append("path").attr("class",rr.barConnectLine)})})},updateBar(t,e=!1){const n=this;if(n.state.isCanvasMode)return;const{config:r,$el:i,$T:s}=n,o=e?i.subchart:i,l=n.getClass("bar",!0),c=n.initialOpacity.bind(n);r.bar_linearGradient&&n.updateLinearGradient();const u=o.main.selectAll(`.${rr.bars}`).selectAll(`.${rr.bar}`).data(n.labelishData.bind(n));s(u.exit(),t).style("opacity","0").remove(),o.bar=u.enter().append("path").attr("class",l).style("fill",n.generateUpdateBarColor()).merge(u).style("opacity",c),n.setRatioForGroupedData(o.bar.data())},generateUpdateBarColor(){const t=this,e=t.getStylePropValue(t.color)||(()=>null);return n=>Yv.call(t,n,"bar_linearGradient",e)},updateBarColor(t){return this.generateUpdateBarColor()(t)},redrawBar(t,e,n=!1){const r=this;if(r.state.isCanvasMode)return[];const{bar:i}=n?r.$el.subchart:r.$el,s=[],o=new Map,l=uo(r),c=r.generateUpdateBarColor(),u=function(d,h,m){var S;const C=ae(d.value)||r.isBarRangeType(d)||((S=r.isSubchartCandlestickBarValue)==null?void 0:S.call(r,d,n))?t(d,h):[""];let w=o.get(d.id);if(w===void 0&&(w=Ru.call(r,d.id),o.set(d.id,w)),C.length>1&&s.push(C[1]),h===m.length-1&&s.length){const $=r.$T(Yt(this.parentNode.querySelector(`.${rr.barConnectLine}`)),e,Cr());r.updateConnectLine($,w,s),s.splice(0)}return C[0]},f=r.$T(i,e,Cr());return l&&typeof f.attrTween=="function"?f.attrTween("d",function(d,h,m){var S;const E=u.call(this,d,h,m);return k0((S=this.getAttribute("d"))!=null?S:"",E)}):f.attr("d",u),[f.style("fill",d=>{var h;return((h=r.getSubchartCandlestickBarColor)==null?void 0:h.call(r,d,n))||c(d)}).style("clip-path",d=>d.clipPath).style("opacity",null)]},generateDrawBar(t,e){const n=this,{config:r}=n,i=n.generateGetBarPoints(t,e),s=uo(n),o=s?ic(n):new Set,l=new Map;return(c,u)=>{const f=i(c,u),{indexX:d,indexY:h,isNegative:m,pos:S,radius:E,clipPath:C}=sc(n,c,f,s,o,n.isStackingRadiusData.bind(n)),w=["",""];if(c.clipPath=C,s){const W=`a${E} ${E} ${m?"1 0 0":"0 0 1"} `;w[h]=`${W}${E},${E}`,w[d]=`${W}${[-E,E][r.axis_rotated?"sort":"reverse"]()}`,m&&w.reverse()}const $=r.axis_rotated?`H${S} ${w[0]}V${f[2][h]-E} ${w[1]}H${f[3][d]}`:`V${S} ${w[0]}H${f[2][d]-E} ${w[1]}V${f[3][h]}`,z=[`M${f[0][d]},${f[0][h]}${$}z`];let B=l.get(c.id);return B===void 0&&(B=Ru.call(n,c.id),l.set(c.id,B)),B&&z.push(r.axis_rotated?{x:f[0][d],y:f[0][h],width:f[0][d]-S,height:f[2][h]-f[0][h]}:{x:f[0][d],y:S,width:f[2][d]-f[0][d],height:f[3][h]-S}),z}},isStackingRadiusData(t){const e=this,{$el:n,config:r,data:i,state:s}=e,{id:o,index:l,value:c}=t;if(s.hiddenTargetIds.has(o)){const h=n.bar.filter(m=>m.id===o&&m.value===c);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const u=r.data_groups.find(h=>h.indexOf(o)>-1),d=e.orderTargets(e.filterTargetsToShow(i.targets.filter(e.isBarType,e))).filter(h=>u.indexOf(h.id)>-1).map(h=>{const m=h.values[l];if(m&&(ae(c)&&c>0?m.value>0:m.value<0))return m}).filter(Boolean).map(h=>h.id);return c!==0&&d.indexOf(o)===d.length-1},updateConnectLine(t,e,n){const r=n.map((i,s,o)=>{const l=this.config.axis_rotated,c=/^start-(start|end)$/.test(e),u=/^end-(start|end)$/.test(e),f=[],d=l?u?i.x-i.width:i.x:i.x+i.width,h=l||c?i.y+i.height:i.y;return s===0?f.push(`${d},${h}`):(f.push(l?`L${i.x-(/\w+-end$/.test(e)?i.width:0)},${i.y}`:`L${i.x},${i.y+(/\w+-start$/.test(e)?i.height:0)}`),s<o.length-1&&f.push(`M${d},${h}`)),f.join(" ")});t.attr("d",`M${r.join("")}z`)}},H2={bar_connectLine:!1,bar_front:!1,bar_indices_removeNull:!1,bar_label_threshold:0,bar_linearGradient:!1,bar_overlap:!1,bar_padding:0,bar_radius:void 0,bar_radius_ratio:void 0,bar_sensitivity:2,bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0};let mp=()=>(Ts([j2,Ti],[H2,ka]),(mp=()=>qt.BAR)());var Y2={initBubble(){const t=this,{config:e}=t;t.hasType("bubble")&&(e.point_show=!0,e.point_type="circle")},getBaseLength(){const t=this,{width:e,height:n}=t.state,r=Oe.bubbleBaseLength;let i=t.cache.get(r);return i||t.cache.add(r,i=pr("min",[e,n])),i},getBubbleR(t){const e=this;let n=e.config.bubble_maxR;ie(n)?n=n.bind(e.api)(t):ae(n)||(n=e.getBaseLength()/(e.getMaxDataCount()*2)+12);const r=Oe.bubbleMaxValue;let i=e.cache.get(r);i===null&&e.cache.add(r,i=pr("max",e.getMinMaxData().max.map(l=>e.isBubbleZType(l)?e.getBubbleZData(l.value,"y"):He(l.value)?l.value.mid:l.value)));const s=n*n*Math.PI,o=(e.isBubbleZType(t)?e.getBubbleZData(t.value,"z"):t.value)*(s/i);return Math.sqrt(o/Math.PI)},getBubbleZData(t,e){return He(t)?t[e]:t[e==="y"?0:1]}},K2=Y2,Z2={bubble_maxR:35,bubble_zerobased:!1};let xp=()=>(Ts([Ti,tl,K2],[Z2,ka]),(xp=()=>qt.BUBBLE)());var J2=Object.defineProperty,yp=Object.getOwnPropertySymbols,Q2=Object.prototype.hasOwnProperty,_2=Object.prototype.propertyIsEnumerable,Tp=(t,e,n)=>e in t?J2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,q2=(t,e)=>{for(var n in e||(e={}))Q2.call(e,n)&&Tp(t,n,e[n]);if(yp)for(var n of yp(e))_2.call(e,n)&&Tp(t,n,e[n]);return t},tI={generateGetCandlestickPoints(t,e=!1){const n=this,r=e?n.axis.subX:n.axis.x,i=n.getIndicesMax(t)+1,s=n.getBarW("candlestick",r,i),o=n.getShapeX(s,t,!!e),l=n.getShapeY(!!e),c=n.getShapeOffset(n.isCandlestickType,t,!!e),u=n.getYScaleById.bind(n);return(f,d)=>{const h=u.call(n,f.id,e)(n.getShapeYMin(f.id,e)),m=c(f,d)||h,S=ae(s)?s:s[f.id]||s._$width,E=n.getCandlestickData(f);let C;if(E&&ae(E.open)&&ae(E.close)){const w={start:o(f),end:0};w.end=w.start+S;const $={start:l(E.open),end:l(E.close)},z={x:w.start+S/2,high:l(E.high),low:l(E.low)},B=h-m;$.start-=B,$.end-=B,z.high-=B,z.low-=B,C=[[w.start,$.start],[w.end,$.end],[z.x,z.low,z.high]]}else C=[[0,0],[0,0],[0,0,0]];return C}},getCandlestickData({value:t}){let e;if(qe(t)){const[n,r,i,s,o=!1]=t;e={open:n,high:r,low:i,close:s},o!==!1&&(e.volume=o)}else He(t)&&(e=q2({},t));return e&&(e._isUp=e.close>=e.open),e||null}},eI=Object.defineProperty,nI=Object.defineProperties,rI=Object.getOwnPropertyDescriptors,bp=Object.getOwnPropertySymbols,aI=Object.prototype.hasOwnProperty,iI=Object.prototype.propertyIsEnumerable,Sp=(t,e,n)=>e in t?eI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sI=(t,e)=>{for(var n in e||(e={}))aI.call(e,n)&&Sp(t,n,e[n]);if(bp)for(var n of bp(e))iI.call(e,n)&&Sp(t,n,e[n]);return t},oI=(t,e)=>nI(t,rI(e)),lI=oI(sI({},tI),{initCandlestick(){Kv.call(this,{elKey:"candlestick",className:Kr.chartCandlesticks})},updateTargetsForCandlestick(t){su.call(this,t,{type:"Candlestick",elKey:"candlestick",containerClass:Kr.chartCandlesticks,itemClass:Kr.chartCandlestick,initFn:this.initCandlestick,withFocus:!1,withStyles:!1}).style("pointer-events","none")},updateCandlestick(t,e=!1){const n=this,{$el:r,$T:i}=n,s=e?r.subchart:r,o=n.getClass("candlestick",!0),l=n.initialOpacity.bind(n),c=s.main.selectAll(`.${Kr.chartCandlestick}`).selectAll(`.${Kr.candlestick}`).data(n.labelishData.bind(n));i(c.exit(),t).style("opacity","0").remove();const u=c.enter().filter(f=>f.value).append("g").attr("class",o);u.append("line"),u.append("path"),s.candlestick=c.merge(u).style("opacity",l)},generateDrawCandlestick(t,e){const n=this,{config:r}=n,i=n.generateGetCandlestickPoints(t,e),s=r.axis_rotated,o=r.candlestick_color_down;return(l,c,u)=>{const f=i(l,c),d=n.getCandlestickData(l),h=d==null?void 0:d._isUp,m=+s,S=+!m;u.classed&&u.classed(Kr[h?"valueUp":"valueDown"],!0);const E=s?`H${f[1][1]} V${f[1][0]} H${f[0][1]}`:`V${f[1][1]} H${f[1][0]} V${f[0][1]}`;u.select("path").attr("d",`M${f[0][m]},${f[0][S]}${E}z`).style("fill",$=>(h?n.color($):He(o)?o[$.id]:o)||n.color($));const C=u.select("line"),w=s?{x1:f[2][1],x2:f[2][2],y1:f[2][0],y2:f[2][0]}:{x1:f[2][0],x2:f[2][0],y1:f[2][1],y2:f[2][2]};for(const $ in w)C.attr($,w[$])}},redrawCandlestick(t,e,n=!1){const r=this,{$el:i,$T:s}=r,{candlestick:o}=n?i.subchart:i,l=Cr(!0);return[o.each(function(c,u){const f=s(Yt(this),e,l);t(c,u,f)}).style("opacity",null)]}}),cI={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"};let Ap=()=>(Ts([lI,Ti],[cI,ka]),(Ap=()=>qt.CANDLESTICK)());var sl={arc_cornerRadius:0,arc_cornerRadius_ratio:0,arc_needle_show:!1,arc_needle_color:void 0,arc_needle_value:void 0,arc_needle_path:void 0,arc_needle_length:100,arc_needle_top_rx:0,arc_needle_top_ry:0,arc_needle_top_width:0,arc_needle_bottom_rx:1,arc_needle_bottom_ry:1,arc_needle_bottom_width:15,arc_needle_bottom_len:0,arc_rangeText_values:void 0,arc_rangeText_unit:"absolute",arc_rangeText_fixed:!1,arc_rangeText_format:void 0,arc_rangeText_position:void 0},uI={donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_label_line:!1,donut_label_image:void 0,donut_label_ratio:void 0,donut_width:void 0,donut_title:"",donut_expand:{},donut_expand_rate:.98,donut_expand_duration:50,donut_padAngle:0,donut_startingAngle:0};function fI(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function dI(t){return t}function hI(){var t=dI,e=fI,n=null,r=Je(0),i=Je(Wo),s=Je(0);function o(l){var c,u=(l=oc(l)).length,f,d,h=0,m=new Array(u),S=new Array(u),E=+r.apply(this,arguments),C=Math.min(Wo,Math.max(-Wo,i.apply(this,arguments)-E)),w,$=Math.min(Math.abs(C)/u,s.apply(this,arguments)),z=$*(C<0?-1:1),B;for(c=0;c<u;++c)(B=S[m[c]=c]=+t(l[c],c,l))>0&&(h+=B);for(e!=null?m.sort(function(W,H){return e(S[W],S[H])}):n!=null&&m.sort(function(W,H){return n(l[W],l[H])}),c=0,d=h?(C-u*z)/h:0;c<u;++c,E=w)f=m[c],B=S[f],w=E+(B>0?B*d:0)+z,S[f]={data:l[f],index:c,value:B,startAngle:E,endAngle:w,padAngle:$};return S}return o.value=function(l){return arguments.length?(t=typeof l=="function"?l:Je(+l),o):t},o.sortValues=function(l){return arguments.length?(e=l,n=null,o):e},o.sort=function(l){return arguments.length?(n=l,e=null,o):n},o.startAngle=function(l){return arguments.length?(r=typeof l=="function"?l:Je(+l),o):r},o.endAngle=function(l){return arguments.length?(i=typeof l=="function"?l:Je(+l),o):i},o.padAngle=function(l){return arguments.length?(s=typeof l=="function"?l:Je(+l),o):s},o}function vI(t){return t.innerRadius}function gI(t){return t.outerRadius}function pI(t){return t.startAngle}function mI(t){return t.endAngle}function xI(t){return t&&t.padAngle}function yI(t,e,n,r,i,s,o,l){var c=n-t,u=r-e,f=o-i,d=l-s,h=d*c-f*u;if(!(h*h<kn))return h=(f*(e-s)-d*(t-i))/h,[t+h*c,e+h*u]}function ol(t,e,n,r,i,s,o){var l=t-n,c=e-r,u=(o?s:-s)/gi(l*l+c*c),f=u*c,d=-u*l,h=t+f,m=e+d,S=n+f,E=r+d,C=(h+S)/2,w=(m+E)/2,$=S-h,z=E-m,B=$*$+z*z,W=i-s,H=h*E-S*m,_=(z<0?-1:1)*gi(jA(0,W*W*B-H*H)),q=(H*z-$*_)/B,st=(-H*$-z*_)/B,it=(H*z+$*_)/B,ot=(-H*$+z*_)/B,ct=q-C,gt=st-w,tt=it-C,ft=ot-w;return ct*ct+gt*gt>tt*tt+ft*ft&&(q=it,st=ot),{cx:q,cy:st,x01:-f,y01:-d,x11:q*(i/W-1),y11:st*(i/W-1)}}function Ep(){var t=vI,e=gI,n=Je(0),r=null,i=pI,s=mI,o=xI,l=null,c=uc(u);function u(){var f,d,h=+t.apply(this,arguments),m=+e.apply(this,arguments),S=i.apply(this,arguments)-Xo,E=s.apply(this,arguments)-Xo,C=Lv(E-S),w=E>S;if(l||(l=f=c()),m<h&&(d=m,m=h,h=d),!(m>kn))l.moveTo(0,0);else if(C>Wo-kn)l.moveTo(m*Ua(S),m*Fr(S)),l.arc(0,0,m,S,E,!w),h>kn&&(l.moveTo(h*Ua(E),h*Fr(E)),l.arc(0,0,h,E,S,w));else{var $=S,z=E,B=S,W=E,H=C,_=C,q=o.apply(this,arguments)/2,st=q>kn&&(r?+r.apply(this,arguments):gi(h*h+m*m)),it=eu(Lv(m-h)/2,+n.apply(this,arguments)),ot=it,ct=it,gt,tt;if(st>kn){var ft=Dv(st/h*Fr(q)),lt=Dv(st/m*Fr(q));(H-=ft*2)>kn?(ft*=w?1:-1,B+=ft,W-=ft):(H=0,B=W=(S+E)/2),(_-=lt*2)>kn?(lt*=w?1:-1,$+=lt,z-=lt):(_=0,$=z=(S+E)/2)}var bt=m*Ua($),St=m*Fr($),Mt=h*Ua(W),Ot=h*Fr(W);if(it>kn){var Kt=m*Ua(z),ee=m*Fr(z),Ae=h*Ua(B),Ee=h*Fr(B),Te;if(C<gs)if(Te=yI(bt,St,Ae,Ee,Kt,ee,Mt,Ot)){var De=bt-Te[0],me=St-Te[1],Pe=Kt-Te[0],Zt=ee-Te[1],he=1/Fr(HA((De*Pe+me*Zt)/(gi(De*De+me*me)*gi(Pe*Pe+Zt*Zt)))/2),ge=gi(Te[0]*Te[0]+Te[1]*Te[1]);ot=eu(it,(h-ge)/(he-1)),ct=eu(it,(m-ge)/(he+1))}else ot=ct=0}_>kn?ct>kn?(gt=ol(Ae,Ee,bt,St,m,ct,w),tt=ol(Kt,ee,Mt,Ot,m,ct,w),l.moveTo(gt.cx+gt.x01,gt.cy+gt.y01),ct<it?l.arc(gt.cx,gt.cy,ct,Un(gt.y01,gt.x01),Un(tt.y01,tt.x01),!w):(l.arc(gt.cx,gt.cy,ct,Un(gt.y01,gt.x01),Un(gt.y11,gt.x11),!w),l.arc(0,0,m,Un(gt.cy+gt.y11,gt.cx+gt.x11),Un(tt.cy+tt.y11,tt.cx+tt.x11),!w),l.arc(tt.cx,tt.cy,ct,Un(tt.y11,tt.x11),Un(tt.y01,tt.x01),!w))):(l.moveTo(bt,St),l.arc(0,0,m,$,z,!w)):l.moveTo(bt,St),!(h>kn)||!(H>kn)?l.lineTo(Mt,Ot):ot>kn?(gt=ol(Mt,Ot,Kt,ee,h,-ot,w),tt=ol(bt,St,Ae,Ee,h,-ot,w),l.lineTo(gt.cx+gt.x01,gt.cy+gt.y01),ot<it?l.arc(gt.cx,gt.cy,ot,Un(gt.y01,gt.x01),Un(tt.y01,tt.x01),!w):(l.arc(gt.cx,gt.cy,ot,Un(gt.y01,gt.x01),Un(gt.y11,gt.x11),!w),l.arc(0,0,h,Un(gt.cy+gt.y11,gt.cx+gt.x11),Un(tt.cy+tt.y11,tt.cx+tt.x11),w),l.arc(tt.cx,tt.cy,ot,Un(tt.y11,tt.x11),Un(tt.y01,tt.x01),!w))):l.arc(0,0,h,W,B,w)}if(l.closePath(),f)return l=null,f+""||null}return u.centroid=function(){var f=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,d=(+i.apply(this,arguments)+ +s.apply(this,arguments))/2-gs/2;return[Ua(d)*f,Fr(d)*f]},u.innerRadius=function(f){return arguments.length?(t=typeof f=="function"?f:Je(+f),u):t},u.outerRadius=function(f){return arguments.length?(e=typeof f=="function"?f:Je(+f),u):e},u.cornerRadius=function(f){return arguments.length?(n=typeof f=="function"?f:Je(+f),u):n},u.padRadius=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Je(+f),u):r},u.startAngle=function(f){return arguments.length?(i=typeof f=="function"?f:Je(+f),u):i},u.endAngle=function(f){return arguments.length?(s=typeof f=="function"?f:Je(+f),u):s},u.padAngle=function(f){return arguments.length?(o=typeof f=="function"?f:Je(+f),u):o},u.context=function(f){return arguments.length?(l=f==null?null:f,u):l},u}const TI=15,Cp=20,Ip=.35;function bI(t=!1){const e=this;return["donut","pie","polar","gauge"].find(n=>e.hasType(n)&&!(n==="gauge"&&t&&e.hasMultiArcGauge()))}function Rp(){const t=this,{config:e}=t,n=bI.call(t,!0),r=n&&e[`${n}_label_line`],i=Kn(r),s=(c,u,f)=>f,o={show:r===!0||i&&(r==null?void 0:r.show)!==!1,distance:i&&(r==null?void 0:r.distance)||Cp};if(r===!0)return{chartType:n,line:o,text:{formatter:s}};if(!i)return{chartType:n,line:{show:!1,distance:Cp},text:{formatter:null}};let l=s;return ie(r.text)?l=r.text:r.text===!1&&(l=null),{chartType:n,line:o,text:{formatter:l}}}function SI(t,e){const n=this,{state:r}=n,i=n.updateAngle(t);if(!i)return null;let{outerRadius:s}=n.getRadius(t),o=s;n.hasType("polar")&&(o=n.getPolarOuterRadius(t,s),s=r.radius);let l=(i.startAngle+i.endAngle)/2;Math.abs(i.endAngle-i.startAngle-2*Math.PI)<.01&&(l=Math.PI/2);const u=Math.sin(l),f=-Math.cos(l),d={x:u*o,y:f*o},h=s+TI,m={x:u*h,y:f*h},S=u>=0,E={x:m.x+e*(S?1:-1),y:m.y};return{startPoint:d,breakPoint:m,endPoint:E,isRight:S,midAngle:l}}function wp(){return Rp.call(this).line.show}function AI(t){const e=this,{$el:{arcs:n},$T:r}=e,{line:i,text:s}=Rp.call(e),o=i.distance;let l=null;n.selectAll(`.${Ze.chartArc}`).each(function(c){var u,f,d;const h=Yt(this),m=SI.call(e,c,o),{ratio:S,meetsThreshold:E,updated:C}=(u=c._cache)!=null?u:{};if(!C||!m)return;const w=e.isTargetToShow(c.data.id)&&E,{startPoint:$,breakPoint:z,endPoint:B,isRight:W}=m,H=`${$.x},${$.y} ${z.x},${z.y} ${B.x},${B.y}`;if(i.show){let q=h.select(`.${Ze.arcLabelLine}`);q.empty()&&(q=h.append("polyline").attr("class",Ze.arcLabelLine)),r(q,t).attr("points",H).style("stroke",e.color(c.data)).style("opacity",w?null:"0")}let _=h.select(`.${Ze.arcLabelLineText}`);if(_.empty()&&(_=h.append("text").attr("class",Ze.arcLabelLineText).style("pointer-events","none")),w){const{value:q}=C,{id:st}=c.data,it=((d=(f=s.formatter)!=null?f:e.getArcLabelConfig("format"))!=null?d:e.defaultArcValueFormat)(q,S,st).toString();ci(_,it,[-1,1],!1);const ot={x:B.x+5*(W?1:-1),y:B.y};_.style("text-anchor",W?"start":"end");const ct=_.node(),gt=ct==null?void 0:ct.querySelectorAll("tspan");if(l===null&&(l=parseFloat(se.getComputedStyle(ct).fontSize)||12),gt&&gt.length>1){const ft=(gt.length-3)/2;ot.y+=(-ft+Ip)*l}else ot.y+=Ip*l;r(_,t).attr("transform",`translate(${ot.x},${ot.y})`).style("opacity",null).style("fill",e.updateTextColor.bind(e)(c))}else r(_,t).style("opacity","0")})}var EI=Object.defineProperty,CI=Object.defineProperties,II=Object.getOwnPropertyDescriptors,Op=Object.getOwnPropertySymbols,RI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,Pp=(t,e,n)=>e in t?EI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,OI=(t,e)=>{for(var n in e||(e={}))RI.call(e,n)&&Pp(t,n,e[n]);if(Op)for(var n of Op(e))wI.call(e,n)&&Pp(t,n,e[n]);return t},PI=(t,e)=>CI(t,II(e));const wu=["donut","gauge","pie","polar"];function MI(t){return["donut","pie","polar","gauge"].find(e=>t.hasType(e))}function LI(t,e,n,r){var i,s;const{config:o,state:{radiusExpanded:l}}=t,c=n.endAngle-Math.PI/2,u=Math.sin(c),f={x:Math.cos(c)*(l+(r?5:25)),y:u*(l+15-Math.abs(u*10))+3};if(r){const d=o.arc_rangeText_position;if(d){const h=o.arc_rangeText_values,m=ie(d)?d(h[e.index]):d;f.x+=(i=m==null?void 0:m.x)!=null?i:0,f.y+=(s=m==null?void 0:m.y)!=null?s:0}}return f}function DI(t,e,n,r){const{config:i}=t,s=MI(t);let o=s?i[`${s}_label_ratio`]:void 0;if(o)o=ie(o)?o.bind(t.api)(e,n,r):o;else{const d=36/n,h=d>.375;o=n&&r?(h?1.175-d:.8)*n/r:0}return o}function FI(t,e,n){let{outerRadius:r}=t.getRadius(e);t.hasType("polar")&&(r=t.getPolarOuterRadius(e,r));const[i,s]=t.svgArc.centroid(n).map(c=>isNaN(c)?0:c),o=Math.sqrt(i*i+s*s),l=DI(t,e,r,o);return{pos:{x:i,y:s},ratio:l}}function Mp(t=0){const e=this,{config:n,state:r}=e,i=e.hasMultiArcGauge(),s=r.gaugeArcWidth/e.getTargetsToShow().length,o=t?Math.min(r.radiusExpanded*t-r.radius,s*.8-(1-t)*100):0;return{inner(l){const{innerRadius:c}=e.getRadius(l);return i?r.radius-s*(l.index+1):ae(c)?c:0},outer(l){const{outerRadius:c}=e.getRadius(l);let u;if(i)u=r.radius-s*l.index+o;else if(e.hasType("polar")&&!t)u=e.getPolarOuterRadius(l,c);else if(u=c,t){let{radiusExpanded:f}=r;r.radius!==c&&(f-=Math.abs(r.radius-c)),u=f*t}return u},corner(l,c){const{arc_cornerRadius_ratio:u=0,arc_cornerRadius:f=0}=n,{data:{id:d},value:h}=l;let m;return u?m=u*c:m=ae(f)?f:f.call(e.api,d,h,c),m}}}function Ou(t){return function(e){const n=({startAngle:i=0,endAngle:s=0,padAngle:o=0})=>({startAngle:i,endAngle:s,padAngle:o}),r=Ya(n(this._current),n(e));return this._current=e,function(i){const s=r(i),{data:o,index:l,value:c}=e;return t(PI(OI({},s),{data:o,index:l,value:c}))}}}var NI={initPie(){const t=this,{config:e}=t,n=e.data_type,r=e[`${n}_padding`],i=e[`${n}_startingAngle`]||0,s=(r?r*.01:e[`${n}_padAngle`])||0;t.pie=hI().startAngle(i).endAngle(i+2*Math.PI).padAngle(s).value(o=>{var l,c;return(c=(l=o.values)==null?void 0:l.reduce((u,f)=>u+f.value,0))!=null?c:o}).sort(t.getSortCompareFn.bind(t)(!0))},updateRadius(){const t=this,{config:e,state:n}=t,r=e.data_type,i=e[`${r}_padding`],s=e.gauge_width||e.donut_width,o=t.getTargetsToShow().length*e.gauge_arcs_minWidth,l=.85,c=wp.call(t)?l:1;n.radiusExpanded=Math.min(n.arcWidth,n.arcHeight)/2*(t.hasMultiArcGauge()&&e.gauge_label_show?l:c),n.radius=n.radiusExpanded*.95,n.innerRadiusRatio=s?(n.radius-s)/n.radius:.6,n.gaugeArcWidth=s||(o<=n.radius-n.innerRadius?n.radius-n.innerRadius:o<=n.radius?o:n.radius);const u=e.pie_innerRadius||(i?i*(n.innerRadiusRatio+.1):0);n.outerRadius=e.pie_outerRadius,n.innerRadius=t.hasType("donut")||t.hasType("gauge")?n.radius*n.innerRadiusRatio:u},getRadius(t){const e=this,n=t==null?void 0:t.data;let{innerRadius:r,outerRadius:i}=e.state;return!ae(r)&&n&&(r=r[n.id]||0),He(i)&&n&&n.id in i?i=i[n.id]:ae(i)||(i=e.state.radius),{innerRadius:r,outerRadius:i}},updateArc(){const t=this;t.updateRadius(),t.svgArc=t.getSvgArc(),t.svgArcExpanded=t.getSvgArcExpanded()},getArcLength(){const t=this,{config:e}=t,n=e.gauge_arcLength*3.6;let r=2*(n/360);return n<-360?r=-2:n>360&&(r=2),r*Math.PI},getStartingAngle(){const t=this,{config:e}=t,n=e.data_type,r=t.hasType("gauge")?e.gauge_fullCircle:!1,i=-1*Math.PI/2,s=Math.PI/2;let o=e[`${n}_startingAngle`]||0;return!r&&o<=i?o=i:!r&&o>=s?o=s:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(t,e=!1){var n;const r=this,{config:i,state:s}=r,o=e&&r.hasType("gauge");let{pie:l}=r,c=t,u=!1;if(!i)return null;const f=r.getStartingAngle(),d=i.gauge_fullCircle||e&&!o?r.getArcLength():f*-2,h=c.data&&r.isGaugeType(c.data)&&!r.hasMultiArcGauge();if(h){const{gauge_min:m,gauge_max:S}=i,E=r.getTotalDataSum(s.rendered),C=d*((E-m)/(S-m));l=l.startAngle(f).endAngle(C+f)}if(e===!1){let m;if(h)m=l(r.filterTargetsToShow());else{const S="$arcPieLayout";let E=r.cache.get(S);(!E||E.generation!==s.redrawGeneration)&&(E={generation:s.redrawGeneration,layout:l(r.filterTargetsToShow())},r.cache.add(S,E)),m=E.layout}m.forEach((S,E)=>{var C;!u&&S.data.id===((C=c.data)==null?void 0:C.id)&&(u=!0,c=S,c.index=E)})}if(isNaN(c.startAngle)&&(c.startAngle=0),isNaN(c.endAngle)&&(c.endAngle=c.startAngle),e||c.data&&(i.gauge_enforceMinMax||r.hasMultiArcGauge())){const{gauge_min:m,gauge_max:S}=i,E=e&&!o?r.getTotalDataSum(s.rendered):S,C=d/(E-m),w=(n=c.value)!=null?n:0,$=w<m?0:w<E?w-m:E-m;c.startAngle=f,c.endAngle=f+C*$}return u||e?c:null},getSvgArc(){const t=this,{inner:e,outer:n,corner:r}=Mp.call(t),i=Ep().innerRadius(e).outerRadius(n),s=function(o,l){var c;let u="M 0 0";if(o.value||o.data){const f=l?o:(c=t.updateAngle(o))!=null?c:null;f&&(u=i.cornerRadius(r(f,n(f)))(f))}return u};return s.centroid=i.centroid,s},getSvgArcExpanded(t=1){const e=this,{inner:n,outer:r,corner:i}=Mp.call(e,t),s=Ep().innerRadius(n).outerRadius(r);return o=>{const l=e.updateAngle(o),c=r(l);let u=0;return l&&(u=i(l,c)),l&&s.cornerRadius(u)(l)||"M 0 0"}},getArc(t,e,n){return n||this.isArcType(t.data)?this.svgArc(t,e):"M 0 0"},redrawArcRangeText(){const t=this,{config:e,$el:{arcs:n},state:r,$T:i}=t,s=e.arc_rangeText_format,o=t.hasType("gauge")&&e.arc_rangeText_fixed;let l=e.arc_rangeText_values;if(l!=null&&l.length){const c=e.arc_rangeText_unit==="%",u=t.getTotalDataSum(r.rendered);c&&(l=l.map(h=>u/100*h));const f=t.pie(l).map((h,m)=>(h.index=m,h));let d=n.selectAll(`.${Ze.arcRange}`).data(l);d.exit().remove(),d=i(d.enter().append("text").attr("class",Ze.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const m=c?h/u*100:h;return ie(s)?s(m):`${m}${c?"%":""}`}).merge(d)),(!r.rendered||r.rendered&&!o)&&u>0&&d.attr("transform",function(h,m){return t.transformForArcLabel(this,f[m],!0)}),d.style("opacity",h=>!o&&(h>u||u===0)?"0":null)}},transformForArcLabel(t,e,n=!1){const r=this,i=r.updateAngle(e,n);if(!i)return"";let s,o=1;if(n||r.hasMultiArcGauge())s=LI(r,e,i,n);else if(!r.hasType("gauge")||r.data.targets.length>1){const l=FI(r,e,i);s=l.pos,o=l.ratio}else return"";return Rv.call(r,t,s),`translate(${s.x*o},${s.y*o})`},convertToArcData(t){return this.addName({id:"data"in t?t.data.id:t.id,value:t.value,ratio:this.getRatio("arc",t),index:t.index})},textForArcLabel(t){var e;const n=this,r=n.hasType("gauge"),i=(e=wu.filter(n.hasType.bind(n)))==null?void 0:e[0];n.shouldShowArcLabel()&&t.style("fill",n.updateTextColor.bind(n)).attr("filter",s=>n.updateTextBGColor.bind(n)(s,n.config.data_labels_backgroundColors)).each(function(s){const o=Yt(this),l=n.updateAngle(s),c=n.getRatio("arc",l),u=Qc.call(n,c,i);if(s._cache={updated:l,ratio:c,meetsThreshold:u},u){const{value:f}=l||s,d=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(f,c,s.data.id).toString();ci(o,d,[-1,1],r)}else o.text("")})},expandArc(t){const e=this,{state:{transiting:n},$el:r}=e;if(n){const s=setInterval(()=>{e.state.transiting||(clearInterval(s),r.legend.selectAll(`.${nn.legendItemFocused}`).size()>0&&e.expandArc(t))},10);return}const i=e.mapToTargetIds(t);r.svg.selectAll(e.selectorTargets(i,`.${Ze.chartArc}`)).each(function(s){if(!e.shouldExpand(s.data.id))return;const o=e.getExpandConfig(s.data.id,"duration"),l=e.getSvgArcExpanded(e.getExpandConfig(s.data.id,"rate"));Yt(this).selectAll("path").transition().duration(o).attrTween("d",Ou(e.svgArcExpanded.bind(e))).transition().duration(o*2).attrTween("d",Ou(l.bind(e)))})},unexpandArc(t){const e=this,{state:{transiting:n},$el:{svg:r}}=e;if(n)return;const i=e.mapToTargetIds(t);r.selectAll(e.selectorTargets(i,`.${Ze.chartArc}`)).selectAll("path").transition().duration(s=>e.getExpandConfig(s.data.id,"duration")).attrTween("d",Ou(e.svgArc.bind(e))),r.selectAll(`${Ze.arc}`).style("opacity",null)},getExpandConfig(t,e){const n=this,{config:r}=n,i={duration:50,rate:.98};let s;return n.isDonutType(t)?s="donut":n.isGaugeType(t)?s="gauge":n.isPieType(t)&&(s="pie"),s?r[`${s}_expand_${e}`]:i[e]},shouldExpand(t){const e=this,{config:n}=e,r=e.isDonutType(t)?"donut":e.isGaugeType(t)?"gauge":e.isPieType(t)?"pie":null;return r?!!n[`${r}_expand`]:!1},shouldShowArcLabel(){const t=this,{config:e}=t;return wu.some(n=>t.hasType(n)&&e[`${n}_label_show`])},getArcLabelConfig(t="format"){const e=this,{config:n}=e;let r=i=>i;return wu.filter(e.hasType.bind(e)).forEach(i=>{r=n[`${i}_label_${t}`]}),t==="format"&&ie(r)?r.bind(e.api):r},updateTargetsForArc(t){const e=this,{$el:n}=e,r=e.hasType("gauge"),i=e.getChartClass("Arc"),s=e.getClass("arcs",!0),o=e.classFocus.bind(e),l=n.main.select(`.${Ze.chartArcs}`),c=l.selectAll(`.${Ze.chartArc}`).data(e.pie(t)).attr("class",f=>i(f)+o(f.data)),u=c.enter().append("g").attr("class",i).call(this.setCssRule(!1,`.${Ze.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));u.append("g").attr("class",s).merge(c),u.append("text").attr("dy",r&&!e.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",e.getStylePropValue("middle")).style("pointer-events",e.getStylePropValue("none")),n.text=l.selectAll(`.${ze.target} text`)},initArc(){const t=this,{$el:e}=t;e.arcs=e.main.select(`.${ze.chart}`).append("g").attr("class",Ze.chartArcs).attr("transform",t.getTranslate("arc")),t.setArcTitle()},setArcTitle(t){const e=this,n=t||e.getArcTitle(),r=e.hasType("gauge");if(n){const i=r?ar.chartArcsGaugeTitle:Ze.chartArcsTitle;let s=e.$el.arcs.select(`.${i}`);s.empty()&&(s=e.$el.arcs.append("text").attr("class",i).style("text-anchor","middle")),r&&s.attr("dy","-0.3em"),ci(s,n,r?void 0:[-.6,1.35],!0)}},getArcTitle(){const t=this,e=t.hasType("donut")&&"donut"||t.hasType("gauge")&&"gauge";return e?t.config[`${e}_title`]:""},getArcTitleWithNeedleValue(){const t=this,{config:e,state:n}=t,r=t.getArcTitle();if(r&&t.config.arc_needle_show&&/{=[A-Z_]+}/.test(r)){let i=n.current.needle;return ae(i)||(i=e.arc_needle_value),Pa(r,{NEEDLE_VALUE:~~i})}return!1},redrawArc(t,e,n){const r=this,{config:i,state:s,$el:{main:o}}=r,l=i.interaction_enabled,c=l&&i.data_selection_isselectable;let u=o.selectAll(`.${Ze.arcs}`).selectAll(`.${Ze.arc}`).data(r.arcData.bind(r));u.exit().transition().duration(e).style("opacity","0").remove(),u=u.enter().append("path").attr("class",r.getClass("arc",!0)).style("fill",f=>r.color(f.data)).style("cursor",f=>{var d;return(d=c==null?void 0:c.bind)!=null&&d.call(c,r.api)(f)?"pointer":null}).style("opacity","0").each(function(f){r.isGaugeType(f.data)&&(f.startAngle=i.gauge_startingAngle,f.endAngle=i.gauge_startingAngle),this._current=f}).merge(u),r.hasType("gauge")&&(r.updateGaugeMax(),r.hasMultiArcGauge()&&r.redrawArcGaugeLine()),u.attr("transform",f=>!r.isGaugeType(f.data)&&n?"scale(0)":"").style("opacity",function(f){return f===this._current?"0":null}).each(()=>{s.transiting=!0}).transition().duration(t).attrTween("d",function(f){const d=r.updateAngle(f);if(!d)return()=>"M 0 0";isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const h=Ya(this._current,d);return this._current=h(0),function(m){const S=h(m);return S.data=f.data,r.getArc(S,!0)}}).attr("transform",n?"scale(1)":"").style("fill",f=>{let d;return r.levelColor?(d=r.levelColor(f.data.values[0].value),i.data_colors[f.data.id]=d):d=r.color(f.data),d}).style("opacity",null).call(eo,function(){if(r.levelColor){const f=Yt(this),d=f.datum(this._current);r.updateLegendItemColor(d.data.id,f.style("fill"))}s.transiting=!1,s.redrawing&&(s.redrawing=!1,s._targetsToShow=null,s._cachedDrawShape=null),Ne(i.onrendered,r.api)}),l&&r.bindArcEvent(u),r.hasType("polar")&&r.redrawPolar(),r.hasType("gauge")&&r.redrawBackgroundArcs(),i.arc_needle_show&&r.redrawNeedle(),r.redrawArcText(t),r.redrawArcRangeText()},redrawNeedle(){const t=this,{$el:e,config:n,state:{hiddenTargetIds:r,radius:i}}=t,s=(i-1)/100*n.arc_needle_length,o=r.size!==t.data.targets.length;let l=t.$el.arcs.select(`.${Ze.needle}`);const c=n.arc_needle_path,u=n.arc_needle_bottom_width/2,f=n.arc_needle_top_width/2,d=n.arc_needle_top_rx,h=n.arc_needle_top_ry,m=n.arc_needle_bottom_len,S=n.arc_needle_bottom_rx,E=n.arc_needle_bottom_ry,C=t.getNeedleAngle(),w=()=>{const $=t.getArcTitleWithNeedleValue();$&&t.setArcTitle($)};if(w(),l.empty()&&(l=e.arcs.append("path").classed(Ze.needle,!0),e.needle=l,e.needle.updateHelper=($,z=!1)=>{e.needle.style("display")!=="none"&&t.$T(e.needle).style("transform",`rotate(${t.getNeedleAngle($)}deg)`).call(eo,()=>{z&&(n.arc_needle_value=$),w()})}),o){const $=ie(c)?c.call(t,s):`M-${u} ${m} A${S} ${E} 0 0 0 ${u} ${m} L${f} -${s} A${d} ${h} 0 0 0 -${f} -${s} L-${u} ${m} Z`;t.$T(l).attr("d",$).style("fill",n.arc_needle_color).style("display",null).style("transform",`rotate(${C}deg)`)}else l.style("display","none")},getNeedleAngle(t){const e=this,{config:n,state:r}=e,i=e.getArcLength(),s=e.hasType("gauge"),o=e.getTotalDataSum(!0);let l=sn(t)?t:n.arc_needle_value,c=n[`${n.data_type}_startingAngle`]||0,u;if(ae(l)||(l=s&&e.data.targets.length===1?o:0),r.current.needle=l,s){c=e.getStartingAngle();const f=n.gauge_fullCircle?i:c*-2,{gauge_min:d,gauge_max:h}=n;u=f*((l-d)/(h-d))}else u=o?i*(l/o):0;return(c+u)*(180/Math.PI)},redrawBackgroundArcs(){const t=this,{config:e,state:n}=t,r=t.hasMultiArcGauge(),i=e.gauge_fullCircle,s=t.getTargetsToShow().length===0&&!!e.data_empty_label_text,o=t.getStartingAngle(),l=i?o+t.getArcLength():o*-1;let c=t.$el.arcs.select(`${r?"g":""}.${Ze.chartArcsBackground}`);if(r){let u=0;c=c.selectAll(`path.${Ze.chartArcsBackground}`).data(t.data.targets),c.enter().append("path").attr("class",(f,d)=>`${Ze.chartArcsBackground} ${Ze.chartArcsBackground}-${d}`).merge(c).style("fill",e.gauge_background||null).attr("d",({id:f})=>{if(s||n.hiddenTargetIds.has(f))return"M 0 0";const d={data:[{value:e.gauge_max}],startAngle:o,endAngle:l,index:u++};return t.getArc(d,!0,!0)}),c.exit().remove()}else c.attr("d",s?"M 0 0":()=>{const u={data:[{value:e.gauge_max}],startAngle:o,endAngle:l};return t.getArc(u,!0,!0)})},bindArcEvent(t){const e=this,{config:n,state:r}=e,i=r.inputType==="touch",s=r.inputType==="mouse",o=u=>{const f=e.updateAngle(u);return f?e.convertToArcData(f):null};function l(u,f,d){e.expandArc(d),e.api.focus(d),e.toggleFocusLegend(d,!0),e.showTooltip([f],u)}function c(u){const f=(u==null?void 0:u.id)||void 0;e.unexpandArc(f),e.api.revert(),e.revertLegend(),e.hideTooltip()}if(t.on("click",function(u,f,d){var h;const m=o(f);m&&((h=e.toggleShape)==null||h.call(e,this,m,d),n.data_onclick.bind(e.api)(m,this))}),s&&t.on("mouseover",function(u,f){if(r.transiting)return;r.event=u;const d=o(f),h=(d==null?void 0:d.id)||void 0;l(this,d,h),e.setOverOut(!0,d)}).on("mouseout",(u,f)=>{if(r.transiting||!n.interaction_onout)return;r.event=u;const d=o(f);c(),e.setOverOut(!1,d)}).on("mousemove",function(u,f){const d=o(f);r.event=u,e.showTooltip([d],this)}),i&&e.hasArcType()&&!e.radars){const u=f=>{var d,h;const{clientX:m,clientY:S}=(h=(d=f.changedTouches)==null?void 0:d[0])!=null?h:{clientX:0,clientY:0};return Yt(Ye.elementFromPoint(m,S))};e.$el.svg.on("touchstart touchmove",function(f){if(r.transiting)return;r.event=f;const h=u(f).datum(),m=h!=null&&h.data&&h.data.id?e.updateAngle(h):null,S=m?e.convertToArcData(m):null,E=(S==null?void 0:S.id)||void 0;e.callOverOutForTouch(S),mn(E)?c():l(this,S,E)},{passive:!0})}},redrawArcText(t){const e=this,{config:n,state:r,$el:{main:i,arcs:s}}=e,o=e.hasType("gauge"),l=e.hasMultiArcGauge();let c;if(o&&e.data.targets.length===1&&n.gauge_title||(c=i.selectAll(`.${Ze.chartArc}`).select("text").style("opacity","0").attr("class",u=>e.isGaugeType(u.data)?ar.gaugeValue:null).call(e.textForArcLabel.bind(e)).style("font-size",u=>e.isGaugeType(u.data)&&e.data.targets.length===1&&!l?`${Math.round(r.radius/5)}px`:null),Iv.call(e),c.attr("transform",function(u){return e.transformForArcLabel.bind(e)(this,u)}).transition().duration(t).style("opacity",u=>e.isTargetToShow(u.data.id)&&e.isArcType(u.data)?null:"0"),l&&c.attr("dy","-.1em")),i.select(`.${Ze.chartArcsTitle}`).style("opacity",e.hasType("donut")||o?null:"0"),o){const u=n.gauge_fullCircle;u&&(c==null||c.attr("dy",`${l?0:Math.round(r.radius/14)}`)),n.gauge_label_show&&(s.select(`.${ar.chartArcsGaugeUnit}`).attr("dy",`${u?1.5:.75}em`).text(n.gauge_units),s.select(`.${ar.chartArcsGaugeMin}`).attr("dx",`${-1*(r.innerRadius+(r.radius-r.innerRadius)/(u?1:2))}px`).attr("dy","1.2em").text(e.textForGaugeMinMax(n.gauge_min,!1)),!u&&s.select(`.${ar.chartArcsGaugeMax}`).attr("dx",`${r.innerRadius+(r.radius-r.innerRadius)/2}px`).attr("dy","1.2em").text(e.textForGaugeMinMax(n.gauge_max,!0)))}wp.call(e)&&AI.call(e,t)},getArcElementByIdOrIndex(t){const e=this,{$el:{arcs:n}}=e,r=ae(t)?i=>i.index===t:i=>i.data.id===t;return n==null?void 0:n.selectAll(`.${ze.target} path`).filter(r)}};function Si(t,e){xn(br.prototype,[NI,Ti].concat(t||[])),$a.setOptions([ka].concat(e||[]))}let Lp=()=>(Si(void 0,[sl,uI]),(Lp=()=>qt.DONUT)());var $I=Object.defineProperty,Dp=Object.getOwnPropertySymbols,BI=Object.prototype.hasOwnProperty,zI=Object.prototype.propertyIsEnumerable,Fp=(t,e,n)=>e in t?$I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,UI=(t,e)=>{for(var n in e||(e={}))BI.call(e,n)&&Fp(t,n,e[n]);if(Dp)for(var n of Dp(e))zI.call(e,n)&&Fp(t,n,e[n]);return t};function Ai(t=!1){const e=this,{config:n,state:{current:{width:r,height:i}}}=e,s=e.getCurrentPadding(),o=UI({width:r-s.left-s.right,height:i-(n.legend_show?e.getLegendHeight()+10:0)-s.top-s.bottom},s);if(t){const l=Pu.call(e,o),c=n.funnel_rotated;o.width=Math.max(o.width,c?l.height:l.width),o.height=Math.max(o.height,c?l.width:l.height)}return o}function Pu(t){const e=this,{config:n}=e,r=n.funnel_rotated,[i,s]=[n.funnel_neck_width,n.funnel_neck_height].map((o,l)=>He(o)?t[r!==!l?"width":"height"]*o.ratio:o);return{width:i,height:s}}function kI(t){const e=this,n=e.config.funnel_rotated,{width:r,height:i}=Ai.call(e,!0),s=[];return t.forEach((o,l)=>{const{ratio:c=0}=o,u=l>0?s[l-1][2][n?0:1]:0,f=c+u;s.push(o.coords=n?[[u,0],[f,0],[f,i],[u,i],[u,0]]:[[0,u],[r,u],[r,f],[0,f],[0,u]])}),s}function GI(){const t=this,e=t.config.funnel_rotated,{width:n,height:r}=Ai.call(t,!0),i=Pu.call(t,{width:n,height:r});let s;if(e){const o=(r-i.width)/2,l=n-i.height;s=[[l,o],[n,o],[n,r-o],[l,r-o],[0,r]]}else{const o=(n-i.width)/2,l=r-i.height;s=[[n,0],[n-o,l],[n-o,r],[o,r],[o,l]]}return`M${[[0,0],...s,[0,0]].join("L")}z`}function XI(t){const e=this,{config:n}=e,r=t.map(i=>({id:i.id,value:i.values.reduce((s,o)=>s+o.value,0)}));return n.data_order&&r.sort(e.getSortCompareFn.bind(e)(!0)),Np.call(e,r)}function Np(t){const e=this,{width:n,height:r}=Ai.call(e),i=e.getTotalDataSum(!0),s=e.config.funnel_rotated?n:r;return t.forEach(o=>{o.ratio=o.value/i*s}),t}function WI(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}function $p(t,e,n,r,i){const s=[];for(let l=0;l<=20;l++){const c=l/20,u=t+(e-t)*c,f=n+(r-n)*WI(c);s.push(i?[u,f]:[f,u])}return s}function VI(){var t;const e=this,n=e.config.funnel_rotated,{width:r,height:i}=Ai.call(e,!0),s=Pu.call(e,{width:r,height:i}),o=fc().x(m=>m[0]).y(m=>m[1]).curve(ho),l=(n?i-s.width:r-s.width)/2,c=n?r-s.height:i-s.height,u=$p(0,c,n?0:r,n?l:r-l,n),f=[];if(s.height>0&&(u.push(n?[r,l]:[r-l,i]),f.push(n?[r,i-l]:[l,i])),f.push(...$p(c,0,n?i-l:l,n?i:0,n)),u.length>1){const[m,S]=n?[1,0]:[0,1];u.splice(1,0,[u[m][0],u[S][1]]);const E=f.length-1;E>0&&f.splice(E,0,[f[E-m][0],f[E-S][1]])}const d=o(u)||"",h=((t=o(f))==null?void 0:t.replace(/^M/,"L"))||"";return n?`${d}${h}z`:`M0,0${d.replace(/^M/,"L")}${h}z`}var jI={initFunnel(){const t=this,{$el:e}=t;e.funnel=e.main.select(`.${ze.chart}`).append("g").classed(is.chartFunnels,!0),e.funnel.background=e.funnel.append("path").classed(is.funnelBackground,!0),t.bindFunnelEvent()},bindFunnelEvent(){const t=this,{$el:{funnel:e},config:n,state:r}=t;if(!n.interaction_enabled)return;const i=o=>{var l;const c=o.isTrusted?o.target:(l=r.eventReceiver.rect)==null?void 0:l.node();if(c&&/^path$/i.test(c.tagName))return r.event=o,Yt(c).datum()},s=r.inputType==="touch";e.on(s?"touchstart":"mouseover mousemove",o=>{const l=i(o);l&&(t.showTooltip([l],o.target),/^(touchstart|mouseover)$/.test(o.type)&&t.setOverOut(!0,l))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const l=i(o);n.interaction_onout&&(t.hideTooltip(),t.setOverOut(!1,l))})},updateTargetsForFunnel(t){const e=this,{$el:{funnel:n}}=e;n||e.initFunnel();const r=e.getChartClass("Funnel"),i=e.getClass("funnel",!0),s=XI.call(e,t.filter(e.isFunnelType.bind(e))),o=e.filterNullish(s),l=n.selectAll(`.${is.chartFunnel}`).data(o);l.exit().remove();const c=l.enter().insert("g",`.${is.funnelBackground}`);c.append("path"),n.path=c.merge(l).attr("class",r).select("path").attr("class",i).style("opacity","0").style("fill",e.color)},updateFunnel(t){const e=this,{$el:{funnel:n}}=e,r=t.map(({id:i})=>i);n.path=n.path.filter(i=>r.includes(i.id))},generateGetFunnelPoints(){const t=this,{config:e,$el:{funnel:n}}=t,r=e.funnel_rotated,i=t.filterTargetsToShow(n.path),{top:s,left:o,width:l,height:c}=Ai.call(t),u={};let f=0;return i.each(d=>{const h=f,{ratio:m}=d;f+=m;const S=r?o:s,E=S+h,C=S+f,w=(E+C)/2,$=r?s+c/2:o+l/2;u[d.id]=r?[[E,$],[C,$],[w,$]]:[[$,E],[$,C],[$,w]]}),d=>u[d.id]},redrawFunnel(){const t=this,{config:e,$T:n,$el:{funnel:r}}=t,i=t.filterTargetsToShow(r.path),s=kI.call(t,Np.call(t,i.data())),{top:o,left:l}=Ai.call(t),c=(e.funnel_spline?VI:GI).call(t);r.attr("transform",`translate(${l}, ${o})`).attr("clip-path",`path('${c}')`),r.background.attr("d",c),n(i).attr("d",(u,f)=>`M${s[f].join("L")}z`).style("opacity","1"),r.selectAll("g").style("opacity",null)}},HI={funnel_neck_width:0,funnel_neck_height:0,funnel_rotated:!1,funnel_spline:!1};let Bp=()=>(Si([jI],[HI]),(Bp=()=>qt.FUNNEL)());var YI={initGauge(){const t=this,{config:e,$el:{arcs:n}}=t,r=(i=null,s="")=>{n.append("text").attr("class",i).style("text-anchor","middle").style("pointer-events","none").text(s)};if(t.hasType("gauge")){const i=t.hasMultiArcGauge();n.append(i?"g":"path").attr("class",Ze.chartArcsBackground).style("fill",!i&&e.gauge_background||null),e.gauge_units&&r(ar.chartArcsGaugeUnit),e.gauge_label_show&&(r(ar.chartArcsGaugeMin),!e.gauge_fullCircle&&r(ar.chartArcsGaugeMax))}},updateGaugeMax(){const t=this,{config:e,state:n}=t,i=t.hasMultiArcGauge()?t.getMinMaxData().max[0].value:t.getTotalDataSum(n.rendered);!e.gauge_enforceMinMax&&i+e.gauge_min*(e.gauge_min>0?-1:1)>e.gauge_max&&(e.gauge_max=i-e.gauge_min)},redrawArcGaugeLine(){const t=this,{config:e,state:n,$el:r}=t,{hiddenTargetIds:i}=t.state,s=r.main.selectAll(`.${Ze.arcs}`).selectAll(`.${Ze.arcLabelLine}`).data(t.arcData.bind(t));s.enter().append("rect").attr("class",l=>`${Ze.arcLabelLine} ${ze.target} ${ze.target}-${l.data.id}`).merge(s).style("fill",l=>t.levelColor?t.levelColor(l.data.values[0].value):t.color(l.data)).style("display",e.gauge_label_show?null:"none").each(function(l){let c=0;const u=2;let f=0,d=0,h="";if(!i.has(l.data.id)){const m=t.updateAngle(l),S=n.gaugeArcWidth/t.getTargetsToShow().length*(m.index+1),E=m.endAngle-Math.PI/2,C=n.radius-S,w=E-(C===0?0:1/C);c=n.radiusExpanded-n.radius+S,f=Math.cos(w)*C,d=Math.sin(w)*C,h=`rotate(${E*180/Math.PI}, ${f}, ${d})`}Yt(this).attr("x",f).attr("y",d).attr("width",c).attr("height",u).attr("transform",h).style("stroke-dasharray",`0, ${c+u}, 0`)})},textForGaugeMinMax(t,e){const n=this,{config:r}=n,i=r.gauge_label_extents;return ie(i)?i.bind(n.api)(t,e):t},getGaugeLabelHeight(){const{config:t}=this;return this.config.gauge_label_show&&!t.gauge_fullCircle?20:0},getPaddingBottomForGauge(){return this.getGaugeLabelHeight()*2}},KI={gauge_background:"",gauge_fullCircle:!1,gauge_label_show:!0,gauge_label_extents:void 0,gauge_label_format:void 0,gauge_label_ratio:void 0,gauge_label_threshold:0,gauge_label_line:!1,gauge_label_image:void 0,gauge_enforceMinMax:!1,gauge_min:0,gauge_max:100,gauge_type:"single",gauge_startingAngle:-1*Math.PI/2,gauge_arcLength:100,gauge_title:"",gauge_units:void 0,gauge_width:void 0,gauge_arcs_minWidth:5,gauge_expand:{},gauge_expand_rate:.98,gauge_expand_duration:50};let zp=()=>(Si([YI],[sl,KI]),(zp=()=>qt.GAUGE)()),Up=()=>(ea(),(Up=()=>qt.LINE)()),kp=()=>(ea(void 0,[xu]),(kp=()=>qt.SPLINE)()),Gp=()=>(ea(),(Gp=()=>qt.STEP)());var ZI={pie_label_show:!0,pie_label_format:void 0,pie_label_ratio:void 0,pie_label_threshold:.05,pie_label_line:!1,pie_label_image:void 0,pie_expand:{},pie_expand_rate:.98,pie_expand_duration:50,pie_innerRadius:0,pie_outerRadius:void 0,pie_padAngle:0,pie_padding:0,pie_startingAngle:0};let Xp=()=>(Si(void 0,[sl,ZI]),(Xp=()=>qt.PIE)());function Wp(t){const e=t.config.polar_level_max;let n=t.getMinMaxData().max[0].value;return e&&e>n&&(n=e),n}var JI={initPolar(){const t=this,{$el:{arcs:e},config:n}=t,r=n.polar_level_text_show,i=n.polar_level_text_backgroundColor;e.levels=e.append("g").attr("class",Jr.levels),r&&i&&t.generateTextBGColorFilter(i)},getPolarOuterRadius(t,e){var n;const r=Wp(this);return((n=t==null?void 0:t.data.values[0].value)!=null?n:0)/r*e},updateTargetsForPolar(t){this.updateTargetsForArc(t)},redrawPolar(){const t=this,{config:e}=t;e.polar_level_show&&t.updatePolarLevel()},updatePolarLevel(){const t=this,{config:e,state:n,$el:{arcs:{levels:r}}}=t,i=e.polar_level_depth,s=Wp(t),o=no(0,i),l=n.radius,c=o.map(h=>l*((h+1)/i)),u=(e.polar_level_text_format||function(){}).bind(t.api),f=r.selectAll(`.${Jr.level}`).data(o);f.exit().remove();const d=f.enter().append("g").attr("class",(h,m)=>`${Jr.level} ${Jr.level}-${m}`);if(d.append("circle"),d.merge(f).selectAll("circle").style("visibility",e.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>c[h]),e.polar_level_text_show){const h=e.polar_level_text_backgroundColor,m=`#${n.datetimeId}-labels-bg${t.getTargetSelectorSuffix(h)}`;d.append("text").style("text-anchor","middle"),d.merge(f).selectAll("text").attr("dy",S=>-c[S]+5).attr("filter",h?`url(${m})`:null).text(S=>u(s/o.length*(S+1)))}}},QI={polar_label_show:!0,polar_label_format:void 0,polar_label_threshold:.05,polar_label_line:!1,polar_label_image:void 0,polar_label_ratio:void 0,polar_level_depth:3,polar_level_max:void 0,polar_level_show:!0,polar_level_text_backgroundColor:"#fff",polar_level_text_format:t=>t%1===0?t:t.toFixed(2),polar_level_text_show:!0,polar_padAngle:0,polar_padding:0,polar_startingAngle:0};let Vp=()=>(Si([JI],[sl,QI]),(Vp=()=>qt.POLAR)());function _I(t,e,n,r,i,s){const o=t&&r>0?n-r:r,l=2*Math.PI;return i*(1-s*(e==="x"?Math.sin:Math.cos)(o*l/n))}const Ei=Oe.radarPoints,jp=Oe.radarTextWidth;var qI={initRadar(){const t=this,{config:e,state:{current:n},$el:r}=t;t.hasType("radar")&&(r.radar=r.main.select(`.${ze.chart}`).append("g").attr("class",yh.chartRadars),r.radar.levels=r.radar.append("g").attr("class",Jr.levels),r.radar.axes=r.radar.append("g").attr("class",Rn.axis),r.radar.shapes=r.radar.append("g").attr("class",Tn.shapes),n.dataMax=e.radar_axis_max||t.getMinMaxData().max[0].value,e.radar_axis_text_show&&(e.interaction_enabled&&t.bindRadarEvent(),t.updateRadarLevel(),t.updateRadarAxes()))},getRadarSize(){const t=this,{config:e,state:{arcWidth:n,arcHeight:r}}=t,i=e.axis_x_categories.length<4?-20:10,s=(Math.min(n,r)-i)/2;return[s,s]},updateTargetsForRadar(t){const e=this,{config:n}=e;lr(n.axis_x_categories)&&(n.axis_x_categories=no(0,pr("max",t.map(r=>r.values.length)))),e.generateRadarPoints()},getRadarPosition(t,e,n,r){const i=this,{config:s}=i,[o,l]=i.getRadarSize(),c=s.axis_x_categories.length,u=s.radar_direction_clockwise,f=Oa(t).map(d=>_I(u,d,c,e,sn(n)?n:t==="x"?o:l,ae(r)?r:s.radar_size_ratio));return f.length===1?f[0]:f},generateRadarPoints(){const t=this,e=t.data.targets,[n,r]=t.getRadarSize(),i=t.cache.get(Ei)||{},s=i._size;(!s||s.width!==n&&s.height!==r)&&(e.forEach(o=>{i[o.id]=o.values.map((l,c)=>t.getRadarPosition(["x","y"],c,void 0,t.getRatio("radar",l)))}),i._size={width:n,height:r},t.cache.add(Ei,i))},redrawRadar(){const t=this,{radar:e,main:n}=t.$el,r=t.getTranslate("radar");r&&(e.attr("transform",r),n.select(`.${En.chartTexts}`).attr("transform",r),t.generateRadarPoints(),t.updateRadarLevel(),t.updateRadarAxes(),t.updateRadarShape())},generateGetRadarPoints(){const t=this.cache.get(Ei);return(e,n)=>{const r=t[e.id][n];return[r,r,r,r]}},updateRadarLevel(){const t=this,{config:e,state:n,$el:{radar:r}}=t,[i,s]=t.getRadarSize(),o=e.radar_level_depth,l=e.axis_x_categories.length,c=e.radar_level_text_show,u=r.levels,f=no(0,o),d=e.radar_size_ratio*Math.min(i,s),h=f.map(w=>d*((w+1)/o)),m=(e.radar_level_text_format||function(){}).bind(t.api),S=f.map(w=>{const $=h[w];return no(0,l).map(B=>t.getRadarPosition(["x","y"],B,$,1).join(",")).join(" ")}),E=u.selectAll(`.${Jr.level}`).data(f);E.exit().remove();const C=E.enter().append("g").attr("class",(w,$)=>`${Jr.level} ${Jr.level}-${$}`);C.append("polygon").style("visibility",e.radar_level_show?null:"hidden"),c&&(u.select("text").empty()&&u.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>m(0)),C.append("text").attr("dx","-.5em").style("text-anchor","end").text(w=>m(n.current.dataMax/f.length*(w+1)))),C.merge(E).attr("transform",w=>`translate(${i-h[w]}, ${s-h[w]})`).selectAll("polygon").attr("points",w=>S[w]),c&&u.selectAll("text").attr("x",w=>mn(w)?i:S[w].split(",")[0]).attr("y",w=>mn(w)?s:0)},updateRadarAxes(){const t=this,{config:e,$el:{radar:n}}=t,[r,i]=t.getRadarSize(),s=e.axis_x_categories;let o=n.axes.selectAll("g").data(s);o.exit().remove();const l=o.enter().append("g").attr("class",(c,u)=>`${Rn.axis}-${u}`);if(e.radar_axis_line_show&&l.append("line"),e.radar_axis_text_show&&l.append("text"),o=l.merge(o),e.radar_axis_line_show&&o.select("line").attr("x1",r).attr("y1",i).attr("x2",(c,u)=>t.getRadarPosition("x",u)).attr("y2",(c,u)=>t.getRadarPosition("y",u)),e.radar_axis_text_show){const{x:c=0,y:u=0}=e.radar_axis_text_position,f=t.cache.get(jp)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){ci(Yt(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){mn(this.width)&&(this.width=ln(this,!0).width/2);let h=t.getRadarPosition("x",d.index,void 0,1),m=Math.round(t.getRadarPosition("y",d.index,void 0,1));return h>r?h+=this.width+c:Math.round(h)<r&&(h-=this.width+c),m>i?(m/2===i&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),m+=u):m<i&&(m-=u),`translate(${h} ${m})`}),!f){const d=[n.axes,n.levels].map(h=>wh(h.node()).width);d.every(h=>h>0)&&t.cache.add(jp,d[0]-d[1])}}},bindRadarEvent(){const t=this,{config:e,state:n,$el:{radar:r,svg:i}}=t,s=t.isPointFocusOnly(),{inputType:o,transiting:l}=n,c=o==="mouse",u=f=>{if(n.event=f,!e.interaction_onout)return;const d=t.getDataIndexFromEvent(f),h=mn(d);(c||h)&&(t.hideTooltip(),s?t.hideCircleFocus():t.unexpandCircles(),c?t.setOverOut(!1,d):h&&t.callOverOutForTouch())};r.axes.on(c?"mouseover ":"touchstart",f=>{if(l)return;n.event=f;const d=t.getDataIndexFromEvent(f);t.selectRectForSingle(i.node(),d),c?t.setOverOut(!0,d):t.callOverOutForTouch(d)},c?void 0:{passive:!0}).on("mouseout",c?u:null),c||i.on("touchstart",u,{passive:!0})},updateRadarShape(){const t=this,e=t.data.targets.filter(s=>t.isRadarType(s)),n=t.cache.get(Ei),r=t.$el.radar.shapes.selectAll("polygon").data(t.filterNullish(e)),i=r.enter().append("g").attr("class",t.getChartClass("Radar"));t.$T(r.exit()).remove(),i.append("polygon").merge(r).style("fill",t.color).style("stroke",t.color).attr("points",s=>n[s.id].join(" ")),t.updateTargetForCircle(e,i)},radarCircleX(t){return this.cache.get(Ei)[t.id][t.index][0]},radarCircleY(t){return this.cache.get(Ei)[t.id][t.index][1]}},tR={radar_axis_max:void 0,radar_axis_line_show:!0,radar_axis_text_show:!0,radar_axis_text_position:{},radar_level_depth:3,radar_level_show:!0,radar_level_text_format:t=>t%1===0?t:t.toFixed(2),radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1};let Hp=()=>(Si([op.eventrect,tl,qI],[ka,tR,{axis_x_categories:lp.optAxis.axis_x_categories}]),(Hp=()=>qt.RADAR)());var eR={scatter_zerobased:!1};let Yp=()=>(Ts([Ti,tl],[ka,eR]),(Yp=()=>qt.SCATTER)());function nR(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function ll(t,e,n,r,i){for(var s=t.children,o,l=-1,c=s.length,u=t.value&&(r-e)/t.value;++l<c;)o=s[l],o.y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*u}function cl(t,e,n,r,i){for(var s=t.children,o,l=-1,c=s.length,u=t.value&&(i-n)/t.value;++l<c;)o=s[l],o.x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*u}var Kp=(1+Math.sqrt(5))/2;function Zp(t,e,n,r,i,s){for(var o=[],l=e.children,c,u,f=0,d=0,h=l.length,m,S,E=e.value,C,w,$,z,B,W,H;f<h;){m=i-n,S=s-r;do C=l[d++].value;while(!C&&d<h);for(w=$=C,W=Math.max(S/m,m/S)/(E*t),H=C*C*W,B=Math.max($/H,H/w);d<h;++d){if(C+=u=l[d].value,u<w&&(w=u),u>$&&($=u),H=C*C*W,z=Math.max($/H,H/w),z>B){C-=u;break}B=z}o.push(c={value:C,dice:m<S,children:l.slice(f,d)}),c.dice?ll(c,n,r,i,E?r+=S*C/E:s):cl(c,n,r,E?n+=m*C/E:i,s),E-=C,f=d}return o}var Jp=(function t(e){function n(r,i,s,o,l){Zp(e,r,i,s,o,l)}return n.ratio=function(r){return t((r=+r)>1?r:1)},n})(Kp);function Dw(t){return t==null?null:Qp(t)}function Qp(t){if(typeof t!="function")throw new Error;return t}function bs(){return 0}function Ss(t){return function(){return t}}function rR(){var t=Jp,e=!1,n=1,r=1,i=[0],s=bs,o=bs,l=bs,c=bs,u=bs;function f(h){return h.x0=h.y0=0,h.x1=n,h.y1=r,h.eachBefore(d),i=[0],e&&h.eachBefore(nR),h}function d(h){var m=i[h.depth],S=h.x0+m,E=h.y0+m,C=h.x1-m,w=h.y1-m;C<S&&(S=C=(S+C)/2),w<E&&(E=w=(E+w)/2),h.x0=S,h.y0=E,h.x1=C,h.y1=w,h.children&&(m=i[h.depth+1]=s(h)/2,S+=u(h)-m,E+=o(h)-m,C-=l(h)-m,w-=c(h)-m,C<S&&(S=C=(S+C)/2),w<E&&(E=w=(E+w)/2),t(h,S,E,C,w))}return f.round=function(h){return arguments.length?(e=!!h,f):e},f.size=function(h){return arguments.length?(n=+h[0],r=+h[1],f):[n,r]},f.tile=function(h){return arguments.length?(t=Qp(h),f):t},f.padding=function(h){return arguments.length?f.paddingInner(h).paddingOuter(h):f.paddingInner()},f.paddingInner=function(h){return arguments.length?(s=typeof h=="function"?h:Ss(+h),f):s},f.paddingOuter=function(h){return arguments.length?f.paddingTop(h).paddingRight(h).paddingBottom(h).paddingLeft(h):f.paddingTop()},f.paddingTop=function(h){return arguments.length?(o=typeof h=="function"?h:Ss(+h),f):o},f.paddingRight=function(h){return arguments.length?(l=typeof h=="function"?h:Ss(+h),f):l},f.paddingBottom=function(h){return arguments.length?(c=typeof h=="function"?h:Ss(+h),f):c},f.paddingLeft=function(h){return arguments.length?(u=typeof h=="function"?h:Ss(+h),f):u},f}function _p(t,e,n,r,i){var s=t.children,o,l=s.length,c,u=new Array(l+1);for(u[0]=c=o=0;o<l;++o)u[o+1]=c+=s[o].value;f(0,l,t.value,e,n,r,i);function f(d,h,m,S,E,C,w){if(d>=h-1){var $=s[d];$.x0=S,$.y0=E,$.x1=C,$.y1=w;return}for(var z=u[d],B=m/2+z,W=d+1,H=h-1;W<H;){var _=W+H>>>1;u[_]<B?W=_+1:H=_}B-u[W-1]<u[W]-B&&d+1<W&&--W;var q=u[W]-z,st=m-q;if(C-S>w-E){var it=m?(S*st+C*q)/m:C;f(d,W,q,S,E,it,w),f(W,h,st,it,E,C,w)}else{var ot=m?(E*st+w*q)/m:w;f(d,W,q,S,E,C,ot),f(W,h,st,S,ot,C,w)}}}function aR(t,e,n,r,i){(t.depth&1?cl:ll)(t,e,n,r,i)}var iR=(function t(e){function n(r,i,s,o,l){if((c=r._squarify)&&c.ratio===e)for(var c,u,f,d,h=-1,m,S=c.length,E=r.value;++h<S;){for(u=c[h],f=u.children,d=u.value=0,m=f.length;d<m;++d)u.value+=f[d].value;u.dice?ll(u,i,s,o,E?s+=(l-s)*u.value/E:l):cl(u,i,s,E?i+=(o-i)*u.value/E:o,l),E-=u.value}else r._squarify=c=Zp(e,r,i,s,o,l),c.ratio=e}return n.ratio=function(r){return t((r=+r)>1?r:1)},n})(Kp);function sR(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function oR(){return this.eachAfter(sR)}function lR(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this}function cR(t,e){for(var n=this,r=[n],i,s,o=-1;n=r.pop();)if(t.call(e,n,++o,this),i=n.children)for(s=i.length-1;s>=0;--s)r.push(i[s]);return this}function uR(t,e){for(var n=this,r=[n],i=[],s,o,l,c=-1;n=r.pop();)if(i.push(n),s=n.children)for(o=0,l=s.length;o<l;++o)r.push(s[o]);for(;n=i.pop();)t.call(e,n,++c,this);return this}function fR(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r}function dR(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})}function hR(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function vR(t){for(var e=this,n=gR(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r}function gR(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}function pR(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function mR(){return Array.from(this)}function xR(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function yR(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*TR(){var t=this,e,n=[t],r,i,s;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(i=0,s=r.length;i<s;++i)n.push(r[i]);while(n.length)}function Mu(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=AR)):e===void 0&&(e=SR);for(var n=new ul(t),r,i=[n],s,o,l,c;r=i.pop();)if((o=e(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,l=c-1;l>=0;--l)i.push(s=o[l]=new ul(o[l])),s.parent=r,s.depth=r.depth+1;return n.eachBefore(CR)}function bR(){return Mu(this).eachBefore(ER)}function SR(t){return t.children}function AR(t){return Array.isArray(t)?t[1]:null}function ER(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function CR(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function ul(t){this.data=t,this.depth=this.height=0,this.parent=null}ul.prototype=Mu.prototype={constructor:ul,count:oR,each:lR,eachAfter:uR,eachBefore:cR,find:fR,sum:dR,sort:hR,path:vR,ancestors:pR,descendants:mR,leaves:xR,links:yR,copy:bR,[Symbol.iterator]:TR};function IR(t){const e=this;return t.map(n=>{const{id:r,values:i}=n,{value:s}=i[0];return{name:r,id:r,value:s,ratio:e.getRatio("treemap",i[0])}})}var RR={initTreemapLayout(){this.treemap=rR().tile(this.getTreemapTile())},getTreemapTile(){var t,e;const n=this,{config:r,state:{current:{width:i,height:s}}}=n,o=(e={binary:_p,dice:ll,slice:cl,sliceDice:aR,squarify:Jp,resquarify:iR}[(t=r.treemap_tile)!=null?t:"binary"])!=null?e:_p;return(l,c,u,f,d)=>{o(l,0,0,i,s);for(const h of l.children)h.x0=c+h.x0/i*(f-c),h.x1=c+h.x1/i*(f-c),h.y0=u+h.y0/s*(d-u),h.y1=u+h.y1/s*(d-u)}},getTreemapData(t){const e=this;return{name:"root",children:IR.bind(e)(e.filterTargetsToShow(t.filter(e.isTreemapType,e)))}},getTreemapRoot(t){const e=this,n=e.getTreemapData(t!=null?t:e.data.targets),r=Mu(n).sum(s=>s.value),i=e.getSortCompareFn(!0);return e.treemap||e.initTreemapLayout(),e.treemap(i?r.sort(i):r)}},wR=Object.defineProperty,OR=Object.defineProperties,PR=Object.getOwnPropertyDescriptors,qp=Object.getOwnPropertySymbols,MR=Object.prototype.hasOwnProperty,LR=Object.prototype.propertyIsEnumerable,tm=(t,e,n)=>e in t?wR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,DR=(t,e)=>{for(var n in e||(e={}))MR.call(e,n)&&tm(t,n,e[n]);if(qp)for(var n of qp(e))LR.call(e,n)&&tm(t,n,e[n]);return t},FR=(t,e)=>OR(t,PR(e));function NR(t,e){const n=this;t.selectAll("g").attr("transform",r=>{const i=ai(n,r,e);return`translate(${i.x},${i.y})`}).select("rect").attr("width",r=>ai(n,r,e).w).attr("height",r=>ai(n,r,e).h)}var $R=FR(DR({},RR),{initTreemap(){const t=this,{$el:e,state:{current:{width:n,height:r},clip:i,datetimeId:s}}=t;i.id=`${s}-clip`,t.initTreemapLayout(),e.defs.append("clipPath").attr("id",i.id).append("rect").attr("width",n).attr("height",r),e.treemap=e.main.select(`.${ze.chart}`).attr("clip-path",`url(#${i.id})`).append("g").classed(bh.chartTreemaps,!0),t.bindTreemapEvent()},bindTreemapEvent(){const t=this,{$el:e,config:n,state:r}=t,i=s=>{var o;const l=s.isTrusted?s.target:(o=r.eventReceiver.rect)==null?void 0:o.node();let c;return l&&/^rect$/i.test(l.tagName)&&(r.event=s,c=Yt(l).datum()),c==null?void 0:c.data};if(n.interaction_enabled){const s=r.inputType==="touch";e.treemap.on(s?"touchstart":"mouseover mousemove",o=>{const l=i(o);l&&(t.showTooltip([l],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&t.setOverOut(!0,l))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const l=i(o);n.interaction_onout&&(t.hideTooltip(),t.setOverOut(!1,l))})}},updateTargetsForTreemap(t){const e=this,{$el:{treemap:n}}=e,r=[e.getTreemapRoot(t!=null?t:e.data.targets)];n.data(e.filterNullish(r))},updateTreemap(t){const e=this,{$el:n,$T:r}=e,i=n.treemap.datum(),s=e.getChartClass("Treemap"),o=e.getClass("treemap",!0),l=n.treemap.selectAll("g").data(i.children);r(l.exit(),t).style("opacity","0").remove(),l.enter().append("g").append("rect"),n.treemap.selectAll("g").attr("class",s).select("rect").attr("class",o).attr("fill",c=>e.color(c.data.name))},generateGetTreemapPoints(){const t=this,{$el:e}=t,n={};return e.treemap.selectAll("g").each(r=>{const i=ai(t,r);n[r.data.name]=[[i.x,i.y],[i.x+i.w,i.y+i.h]]}),r=>n[r.id]},redrawTreemap(t){const e=this,{$el:n,state:{current:{width:r,height:i}}}=e;return n.defs.select("rect").attr("width",r).attr("height",i),[e.$T(n.treemap,t,Cr()).call(NR.bind(e),n.treemap.datum())]},treemapDataLabelFormat(t){const e=this,{$el:{treemap:n},config:r,scale:{x:i,y:s}}=e,{id:o,value:l}=t,c=r.treemap_label_format,u=e.getRatio("treemap",t),f=(u*100).toFixed(2),d=r.treemap_label_show&&Qc.call(e,u,"treemap")?null:"0",h=n.selectAll("g").filter(E=>E.data.id===o).datum();let m=0,S=0;if(h){const{x0:E,x1:C,y0:w,y1:$}=h;m=i(C)-i(E),S=s($)-s(w)}return function(E){return E.style("opacity",d),ie(c)?c.bind(e.api)(l,u,o,{width:m,height:S}):`${o}
61
- ${f}%`}}}),BR={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};let em=()=>(Ts([$R],[BR]),(em=()=>qt.TREEMAP)()),Lu=Object.create(null);const nm={version:"4.1.1",generate(t){const e=Xr(Object.create(null),Lu,t),n=new jn(e);return n.internal.charts=this.instance,this.instance.push(n),n},defaults(t){return He(t)&&(Lu=t),Lu},instance:[],plugin:{}};Object.keys(g).forEach(t=>g[t]()),Object.keys(v).forEach(t=>v[t]()),mg(),xg(),Pg(),Zg(),pg(),dg()})],Es={};function ir(T){var P=Es[T];if(P!==void 0)return P.exports;var a=Es[T]={exports:{}};return Du[T].call(a.exports,a,a.exports,ir),a.exports}ir.d=function(T,P){for(var a in P)ir.o(P,a)&&!ir.o(T,a)&&Object.defineProperty(T,a,{enumerable:!0,get:P[a]})},ir.o=function(T,P){return Object.prototype.hasOwnProperty.call(T,P)},ir.r=function(T){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})},ir(0);var Cs=ir(634);return Cs})()});
61
+ ${f}%`}}}),BR={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};let em=()=>(Ts([$R],[BR]),(em=()=>qt.TREEMAP)()),Lu=Object.create(null);const nm={version:"4.1.2",generate(t){const e=Xr(Object.create(null),Lu,t),n=new jn(e);return n.internal.charts=this.instance,this.instance.push(n),n},defaults(t){return He(t)&&(Lu=t),Lu},instance:[],plugin:{}};Object.keys(g).forEach(t=>g[t]()),Object.keys(v).forEach(t=>v[t]()),mg(),xg(),Pg(),Zg(),pg(),dg()})],Es={};function ir(T){var P=Es[T];if(P!==void 0)return P.exports;var a=Es[T]={exports:{}};return Du[T].call(a.exports,a,a.exports,ir),a.exports}ir.d=function(T,P){for(var a in P)ir.o(P,a)&&!ir.o(T,a)&&Object.defineProperty(T,a,{enumerable:!0,get:P[a]})},ir.o=function(T,P){return Object.prototype.hasOwnProperty.call(T,P)},ir.r=function(T){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})},ir(0);var Cs=ir(634);return Cs})()});