billboard.js 4.1.4 → 4.2.0-next.1

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 (352) hide show
  1. package/dist/billboard.css +87 -1
  2. package/dist/billboard.js +11129 -7032
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +20 -20
  5. package/dist/billboard.pkgd.js +22703 -14154
  6. package/dist/billboard.pkgd.min.js +37 -37
  7. package/dist/billboard.react.js +5 -5
  8. package/dist/billboard.react.min.js +2 -2
  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 +21 -4
  13. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  14. package/dist/plugin/billboardjs-plugin-stanford.js +22 -13
  15. package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
  16. package/dist/plugin/billboardjs-plugin-tableview.js +20 -3
  17. package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
  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 +1689 -1252
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2288 -1012
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6350 -2390
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1310 -1006
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +10 -10
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1293 -1006
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
  30. package/dist/theme/dark.css +90 -1
  31. package/dist/theme/dark.min.css +2 -2
  32. package/dist/theme/datalab.css +87 -1
  33. package/dist/theme/datalab.min.css +2 -2
  34. package/dist/theme/graph.css +87 -1
  35. package/dist/theme/graph.min.css +2 -2
  36. package/dist/theme/insight.css +87 -1
  37. package/dist/theme/insight.min.css +2 -2
  38. package/dist/theme/modern.css +87 -1
  39. package/dist/theme/modern.min.css +2 -2
  40. package/dist-esm/Chart/Chart.js +5 -5
  41. package/dist-esm/Chart/api/axis.js +2 -3
  42. package/dist-esm/Chart/api/category.js +2 -3
  43. package/dist-esm/Chart/api/chart.js +3 -4
  44. package/dist-esm/Chart/api/color.js +2 -3
  45. package/dist-esm/Chart/api/data.js +3 -4
  46. package/dist-esm/Chart/api/export.js +3 -4
  47. package/dist-esm/Chart/api/flow.js +15 -9
  48. package/dist-esm/Chart/api/focus.js +5 -3
  49. package/dist-esm/Chart/api/grid.js +2 -3
  50. package/dist-esm/Chart/api/group.js +2 -3
  51. package/dist-esm/Chart/api/legend.js +1 -2
  52. package/dist-esm/Chart/api/load.js +3 -4
  53. package/dist-esm/Chart/api/regions.js +3 -4
  54. package/dist-esm/Chart/api/selection.js +3 -4
  55. package/dist-esm/Chart/api/show.js +2 -3
  56. package/dist-esm/Chart/api/stubs.js +3 -4
  57. package/dist-esm/Chart/api/subchart.js +4 -5
  58. package/dist-esm/Chart/api/tooltip.js +28 -9
  59. package/dist-esm/Chart/api/x.js +2 -3
  60. package/dist-esm/Chart/api/zoom.js +6 -7
  61. package/dist-esm/ChartInternal/Axis/Axis.js +5 -6
  62. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +26 -17
  63. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +40 -12
  64. package/dist-esm/ChartInternal/ChartInternal.js +39 -24
  65. package/dist-esm/ChartInternal/data/convert.helper.js +2 -3
  66. package/dist-esm/ChartInternal/data/convert.js +3 -4
  67. package/dist-esm/ChartInternal/data/data.js +18 -11
  68. package/dist-esm/ChartInternal/data/load.js +4 -5
  69. package/dist-esm/ChartInternal/interactions/drag.js +3 -4
  70. package/dist-esm/ChartInternal/interactions/eventrect.js +4 -5
  71. package/dist-esm/ChartInternal/interactions/flow.js +25 -19
  72. package/dist-esm/ChartInternal/interactions/interaction.js +14 -13
  73. package/dist-esm/ChartInternal/interactions/subchart.js +5 -6
  74. package/dist-esm/ChartInternal/interactions/zoom.js +4 -5
  75. package/dist-esm/ChartInternal/internals/category.js +2 -3
  76. package/dist-esm/ChartInternal/internals/class.js +5 -5
  77. package/dist-esm/ChartInternal/internals/clip.js +2 -3
  78. package/dist-esm/ChartInternal/internals/color.js +4 -5
  79. package/dist-esm/ChartInternal/internals/domain.js +7 -7
  80. package/dist-esm/ChartInternal/internals/format.js +3 -4
  81. package/dist-esm/ChartInternal/internals/grid.js +4 -5
  82. package/dist-esm/ChartInternal/internals/legend.js +7 -7
  83. package/dist-esm/ChartInternal/internals/redraw.js +13 -13
  84. package/dist-esm/ChartInternal/internals/region.js +4 -5
  85. package/dist-esm/ChartInternal/internals/scale.js +2 -3
  86. package/dist-esm/ChartInternal/internals/selection.js +3 -4
  87. package/dist-esm/ChartInternal/internals/size.axis.js +2 -3
  88. package/dist-esm/ChartInternal/internals/size.js +8 -9
  89. package/dist-esm/ChartInternal/internals/style.js +4 -5
  90. package/dist-esm/ChartInternal/internals/subchart.util.js +2 -3
  91. package/dist-esm/ChartInternal/internals/text.arc.js +3 -4
  92. package/dist-esm/ChartInternal/internals/text.js +22 -23
  93. package/dist-esm/ChartInternal/internals/text.util.js +4 -5
  94. package/dist-esm/ChartInternal/internals/title.js +4 -5
  95. package/dist-esm/ChartInternal/internals/tooltip.js +42 -23
  96. package/dist-esm/ChartInternal/internals/transform.js +5 -6
  97. package/dist-esm/ChartInternal/internals/type.js +78 -11
  98. package/dist-esm/ChartInternal/shape/arc.js +5 -6
  99. package/dist-esm/ChartInternal/shape/area.js +4 -5
  100. package/dist-esm/ChartInternal/shape/bar.js +5 -6
  101. package/dist-esm/ChartInternal/shape/boxplot.js +111 -0
  102. package/dist-esm/ChartInternal/shape/bubble.js +2 -3
  103. package/dist-esm/ChartInternal/shape/bullet.js +213 -0
  104. package/dist-esm/ChartInternal/shape/candlestick.js +5 -6
  105. package/dist-esm/ChartInternal/shape/core/barRadius.js +2 -3
  106. package/dist-esm/ChartInternal/shape/core/boxplot.js +192 -0
  107. package/dist-esm/ChartInternal/shape/core/bubble.js +4 -5
  108. package/dist-esm/ChartInternal/shape/core/bullet.js +528 -0
  109. package/dist-esm/ChartInternal/shape/core/candlestick.js +2 -3
  110. package/dist-esm/ChartInternal/shape/core/dataRegion.js +2 -3
  111. package/dist-esm/ChartInternal/shape/core/geometry.js +2 -3
  112. package/dist-esm/ChartInternal/shape/core/heatmap.js +453 -0
  113. package/dist-esm/ChartInternal/shape/core/path.js +2 -3
  114. package/dist-esm/ChartInternal/shape/core/point.js +2 -3
  115. package/dist-esm/ChartInternal/shape/core/sankey.js +576 -0
  116. package/dist-esm/ChartInternal/shape/core/treemap.js +2 -3
  117. package/dist-esm/ChartInternal/shape/funnel.js +45 -6
  118. package/dist-esm/ChartInternal/shape/gauge.js +3 -4
  119. package/dist-esm/ChartInternal/shape/heatmap.js +144 -0
  120. package/dist-esm/ChartInternal/shape/line.js +7 -8
  121. package/dist-esm/ChartInternal/shape/point.js +9 -9
  122. package/dist-esm/ChartInternal/shape/polar.js +3 -4
  123. package/dist-esm/ChartInternal/shape/radar.js +19 -7
  124. package/dist-esm/ChartInternal/shape/sankey.js +154 -0
  125. package/dist-esm/ChartInternal/shape/shape.js +15 -11
  126. package/dist-esm/ChartInternal/shape/treemap.js +8 -5
  127. package/dist-esm/canvas/CanvasAxisRenderer.js +28 -328
  128. package/dist-esm/canvas/CanvasEngine.js +2 -3
  129. package/dist-esm/canvas/CanvasPainter.js +2 -3
  130. package/dist-esm/canvas/CanvasRenderer.js +38 -408
  131. package/dist-esm/canvas/CanvasTheme.js +28 -8
  132. package/dist-esm/canvas/HitDetector.js +20 -24
  133. package/dist-esm/canvas/axisTicks.js +5 -6
  134. package/dist-esm/canvas/boxplot.js +201 -0
  135. package/dist-esm/canvas/bullet.js +212 -0
  136. package/dist-esm/canvas/classes.js +2 -3
  137. package/dist-esm/canvas/color.js +2 -3
  138. package/dist-esm/canvas/flow.js +190 -0
  139. package/dist-esm/canvas/geometry.js +2 -3
  140. package/dist-esm/canvas/grid.js +206 -0
  141. package/dist-esm/canvas/heatmap.js +141 -0
  142. package/dist-esm/canvas/labels.js +3 -4
  143. package/dist-esm/canvas/pointPattern.js +2 -3
  144. package/dist-esm/canvas/sankey.js +137 -0
  145. package/dist-esm/canvas/selection.js +473 -0
  146. package/dist-esm/canvas/subchart.js +814 -0
  147. package/dist-esm/canvas/treemap.js +100 -0
  148. package/dist-esm/canvas/util.js +2 -3
  149. package/dist-esm/config/Options/Options.js +3 -4
  150. package/dist-esm/config/Options/axis/axis.js +2 -3
  151. package/dist-esm/config/Options/axis/x.js +2 -3
  152. package/dist-esm/config/Options/axis/y.js +2 -3
  153. package/dist-esm/config/Options/axis/y2.js +14 -3
  154. package/dist-esm/config/Options/common/boost.js +2 -3
  155. package/dist-esm/config/Options/common/color.js +2 -3
  156. package/dist-esm/config/Options/common/grid.js +2 -3
  157. package/dist-esm/config/Options/common/legend.js +2 -3
  158. package/dist-esm/config/Options/common/main.js +2 -3
  159. package/dist-esm/config/Options/common/point.js +2 -3
  160. package/dist-esm/config/Options/common/title.js +2 -3
  161. package/dist-esm/config/Options/common/tooltip.js +2 -3
  162. package/dist-esm/config/Options/data/axis.js +2 -3
  163. package/dist-esm/config/Options/data/data.js +49 -4
  164. package/dist-esm/config/Options/data/selection.js +2 -3
  165. package/dist-esm/config/Options/interaction/interaction.js +2 -3
  166. package/dist-esm/config/Options/interaction/subchart.js +6 -3
  167. package/dist-esm/config/Options/interaction/zoom.js +2 -3
  168. package/dist-esm/config/Options/shape/arc.js +2 -3
  169. package/dist-esm/config/Options/shape/area.js +2 -3
  170. package/dist-esm/config/Options/shape/bar.js +2 -3
  171. package/dist-esm/config/Options/shape/boxplot.js +106 -0
  172. package/dist-esm/config/Options/shape/bubble.js +2 -3
  173. package/dist-esm/config/Options/shape/bullet.js +177 -0
  174. package/dist-esm/config/Options/shape/candlestick.js +2 -3
  175. package/dist-esm/config/Options/shape/donut.js +2 -3
  176. package/dist-esm/config/Options/shape/funnel.js +2 -3
  177. package/dist-esm/config/Options/shape/gauge.js +2 -3
  178. package/dist-esm/config/Options/shape/heatmap.js +137 -0
  179. package/dist-esm/config/Options/shape/line.js +2 -3
  180. package/dist-esm/config/Options/shape/pie.js +2 -3
  181. package/dist-esm/config/Options/shape/polar.js +2 -3
  182. package/dist-esm/config/Options/shape/radar.js +2 -3
  183. package/dist-esm/config/Options/shape/sankey.js +116 -0
  184. package/dist-esm/config/Options/shape/scatter.js +2 -3
  185. package/dist-esm/config/Options/shape/spline.js +2 -3
  186. package/dist-esm/config/Options/shape/treemap.js +2 -3
  187. package/dist-esm/config/Store/Element.js +2 -3
  188. package/dist-esm/config/Store/State.js +4 -4
  189. package/dist-esm/config/Store/Store.js +2 -3
  190. package/dist-esm/config/classes.js +2 -4
  191. package/dist-esm/config/config.js +2 -3
  192. package/dist-esm/config/const.js +31 -23
  193. package/dist-esm/config/resolver/axis.core.js +4 -5
  194. package/dist-esm/config/resolver/axis.js +2 -3
  195. package/dist-esm/config/resolver/canvas.js +113 -900
  196. package/dist-esm/config/resolver/canvasBoxplot.js +49 -0
  197. package/dist-esm/config/resolver/canvasBullet.js +29 -0
  198. package/dist-esm/config/resolver/canvasFlow.js +28 -0
  199. package/dist-esm/config/resolver/canvasGrid.js +27 -0
  200. package/dist-esm/config/resolver/canvasHeatmap.js +31 -0
  201. package/dist-esm/config/resolver/canvasSankey.js +31 -0
  202. package/dist-esm/config/resolver/canvasSelection.js +30 -0
  203. package/dist-esm/config/resolver/canvasShape.js +13 -12
  204. package/dist-esm/config/resolver/canvasSubchart.js +30 -0
  205. package/dist-esm/config/resolver/canvasType.js +48 -0
  206. package/dist-esm/config/resolver/category.js +3 -4
  207. package/dist-esm/config/resolver/customType.js +58 -0
  208. package/dist-esm/config/resolver/export.js +3 -4
  209. package/dist-esm/config/resolver/flow.js +5 -6
  210. package/dist-esm/config/resolver/grid.js +6 -7
  211. package/dist-esm/config/resolver/interaction/selection.js +6 -7
  212. package/dist-esm/config/resolver/interaction/subchart.js +6 -7
  213. package/dist-esm/config/resolver/interaction/zoom.js +6 -7
  214. package/dist-esm/config/resolver/regions.js +5 -6
  215. package/dist-esm/config/resolver/shape/arc.helpers.js +5 -6
  216. package/dist-esm/config/resolver/shape/area.js +3 -4
  217. package/dist-esm/config/resolver/shape/axis.helpers.js +2 -3
  218. package/dist-esm/config/resolver/shape/bar.js +5 -6
  219. package/dist-esm/config/resolver/shape/boxplot.js +30 -0
  220. package/dist-esm/config/resolver/shape/bubble.js +5 -6
  221. package/dist-esm/config/resolver/shape/bullet.js +23 -0
  222. package/dist-esm/config/resolver/shape/candlestick.js +5 -6
  223. package/dist-esm/config/resolver/shape/donut.js +2 -3
  224. package/dist-esm/config/resolver/shape/funnel.js +7 -6
  225. package/dist-esm/config/resolver/shape/gauge.js +4 -5
  226. package/dist-esm/config/resolver/shape/heatmap.js +23 -0
  227. package/dist-esm/config/resolver/shape/line.js +2 -3
  228. package/dist-esm/config/resolver/shape/pie.js +3 -4
  229. package/dist-esm/config/resolver/shape/polar.js +4 -5
  230. package/dist-esm/config/resolver/shape/radar.js +5 -6
  231. package/dist-esm/config/resolver/shape/sankey.js +23 -0
  232. package/dist-esm/config/resolver/shape/scatter.js +4 -5
  233. package/dist-esm/config/resolver/shape/treemap.js +4 -5
  234. package/dist-esm/core.js +5 -6
  235. package/dist-esm/index.canvas.js +13 -9
  236. package/dist-esm/index.esm.js +6 -2
  237. package/dist-esm/module/Cache.js +2 -3
  238. package/dist-esm/module/browser.js +2 -3
  239. package/dist-esm/module/dsv.js +2 -3
  240. package/dist-esm/module/error.js +23 -16
  241. package/dist-esm/module/generator.js +3 -4
  242. package/dist-esm/module/sanitize.js +2 -3
  243. package/dist-esm/module/util/brush.js +2 -3
  244. package/dist-esm/module/util/dom.js +3 -4
  245. package/dist-esm/module/util/object.js +13 -6
  246. package/dist-esm/module/util/type-checks.js +2 -3
  247. package/dist-esm/module/worker.js +2 -3
  248. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +6 -10
  249. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +10 -18
  250. package/dist-esm/plugin/billboardjs-plugin-stanford.js +17 -45
  251. package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -18
  252. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +9 -16
  253. package/dist-esm/react/index.js +2 -3
  254. package/package.json +44 -44
  255. package/src/Chart/Chart.ts +1 -0
  256. package/src/Chart/api/chart.ts +2 -1
  257. package/src/Chart/api/flow.ts +20 -7
  258. package/src/Chart/api/focus.ts +3 -0
  259. package/src/Chart/api/subchart.ts +1 -1
  260. package/src/Chart/api/tooltip.ts +54 -15
  261. package/src/ChartInternal/Axis/AxisRenderer.ts +29 -20
  262. package/src/ChartInternal/Axis/AxisRendererHelper.ts +45 -9
  263. package/src/ChartInternal/ChartInternal.ts +46 -19
  264. package/src/ChartInternal/data/IData.ts +13 -0
  265. package/src/ChartInternal/data/data.ts +26 -5
  266. package/src/ChartInternal/data/load.ts +2 -2
  267. package/src/ChartInternal/interactions/flow.ts +50 -19
  268. package/src/ChartInternal/interactions/interaction.ts +15 -11
  269. package/src/ChartInternal/internals/class.ts +3 -2
  270. package/src/ChartInternal/internals/domain.ts +4 -2
  271. package/src/ChartInternal/internals/format.ts +3 -1
  272. package/src/ChartInternal/internals/legend.ts +2 -1
  273. package/src/ChartInternal/internals/redraw.ts +18 -12
  274. package/src/ChartInternal/internals/size.ts +5 -3
  275. package/src/ChartInternal/internals/text.ts +24 -28
  276. package/src/ChartInternal/internals/tooltip.ts +59 -20
  277. package/src/ChartInternal/internals/transform.ts +2 -2
  278. package/src/ChartInternal/internals/type.ts +101 -9
  279. package/src/ChartInternal/shape/boxplot.ts +172 -0
  280. package/src/ChartInternal/shape/bullet.ts +323 -0
  281. package/src/ChartInternal/shape/core/boxplot.ts +241 -0
  282. package/src/ChartInternal/shape/core/bullet.ts +734 -0
  283. package/src/ChartInternal/shape/core/heatmap.ts +665 -0
  284. package/src/ChartInternal/shape/core/sankey.ts +782 -0
  285. package/src/ChartInternal/shape/funnel.ts +73 -2
  286. package/src/ChartInternal/shape/heatmap.ts +236 -0
  287. package/src/ChartInternal/shape/point.ts +6 -3
  288. package/src/ChartInternal/shape/radar.ts +30 -1
  289. package/src/ChartInternal/shape/sankey.ts +242 -0
  290. package/src/ChartInternal/shape/shape.ts +16 -4
  291. package/src/ChartInternal/shape/treemap.ts +10 -0
  292. package/src/Plugin/stanford/index.ts +1 -28
  293. package/src/canvas/CanvasAxisRenderer.ts +54 -596
  294. package/src/canvas/CanvasRenderer.ts +68 -640
  295. package/src/canvas/CanvasTheme.ts +92 -6
  296. package/src/canvas/HitDetector.ts +30 -28
  297. package/src/canvas/boxplot.ts +230 -0
  298. package/src/canvas/bullet.ts +269 -0
  299. package/src/canvas/flow.ts +237 -0
  300. package/src/canvas/grid.ts +359 -0
  301. package/src/canvas/heatmap.ts +147 -0
  302. package/src/canvas/labels.ts +3 -1
  303. package/src/canvas/sankey.ts +151 -0
  304. package/src/canvas/selection.ts +626 -0
  305. package/src/canvas/subchart.ts +1292 -0
  306. package/src/canvas/treemap.ts +142 -0
  307. package/src/config/Options/axis/y2.ts +13 -0
  308. package/src/config/Options/data/data.ts +47 -1
  309. package/src/config/Options/interaction/subchart.ts +4 -0
  310. package/src/config/Options/shape/boxplot.ts +95 -0
  311. package/src/config/Options/shape/bullet.ts +170 -0
  312. package/src/config/Options/shape/heatmap.ts +125 -0
  313. package/src/config/Options/shape/sankey.ts +108 -0
  314. package/src/config/Store/State.ts +2 -1
  315. package/src/config/classes.ts +0 -1
  316. package/src/config/const.ts +30 -21
  317. package/src/config/resolver/canvas.ts +147 -1293
  318. package/src/config/resolver/canvasBoxplot.ts +42 -0
  319. package/src/config/resolver/canvasBullet.ts +20 -0
  320. package/src/config/resolver/canvasFlow.ts +18 -0
  321. package/src/config/resolver/canvasGrid.ts +17 -0
  322. package/src/config/resolver/canvasHeatmap.ts +23 -0
  323. package/src/config/resolver/canvasSankey.ts +23 -0
  324. package/src/config/resolver/canvasSelection.ts +20 -0
  325. package/src/config/resolver/canvasShape.ts +6 -1
  326. package/src/config/resolver/canvasSubchart.ts +20 -0
  327. package/src/config/resolver/canvasType.ts +51 -0
  328. package/src/config/resolver/customType.ts +69 -0
  329. package/src/config/resolver/shape/boxplot.ts +31 -0
  330. package/src/config/resolver/shape/bullet.ts +18 -0
  331. package/src/config/resolver/shape/funnel.ts +8 -2
  332. package/src/config/resolver/shape/heatmap.ts +18 -0
  333. package/src/config/resolver/shape/index.ts +4 -0
  334. package/src/config/resolver/shape/sankey.ts +18 -0
  335. package/src/index.canvas.ts +9 -3
  336. package/src/index.esm.ts +4 -0
  337. package/src/index.ts +34 -0
  338. package/src/module/error.ts +32 -18
  339. package/src/module/util/object.ts +26 -1
  340. package/src/scss/billboard.scss +106 -0
  341. package/src/scss/theme/dark.scss +110 -0
  342. package/src/scss/theme/datalab.scss +106 -0
  343. package/src/scss/theme/graph.scss +106 -0
  344. package/src/scss/theme/insight.scss +106 -0
  345. package/src/scss/theme/modern.scss +106 -0
  346. package/types/bb.d.ts +4 -0
  347. package/types/canvas.d.ts +3 -0
  348. package/types/chart.d.ts +5 -0
  349. package/types/index.d.ts +4 -0
  350. package/types/options.d.ts +13 -1
  351. package/types/options.shape.d.ts +431 -0
  352. package/types/types.d.ts +4 -0
@@ -5,36 +5,36 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.4
9
- */(function(Jt,fn){if(typeof exports=="object"&&typeof module=="object")module.exports=fn(require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if(typeof define=="function"&&define.amd)define(["d3-brush","d3-drag","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],fn);else{var ii=typeof exports=="object"?fn(require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):fn(Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3,Jt.d3);for(var ai in ii)(typeof exports=="object"?exports:Jt)[ai]=ii[ai]}})(this,function(_s,Jt,fn,ii,ai,jc,Uc,Kc,Zc,qc){return(function(){var Jc=[,,(function(J){"use strict";J.exports=jc}),(function(J){"use strict";J.exports=ai}),(function(J){"use strict";J.exports=Uc}),(function(J){"use strict";J.exports=Kc}),(function(J){"use strict";J.exports=Jt}),(function(J){"use strict";J.exports=_s}),(function(J){"use strict";J.exports=Zc}),(function(J){"use strict";J.exports=qc}),(function(J){"use strict";J.exports=ii}),(function(J){"use strict";J.exports=fn})],xs={};function wt(J){var Qt=xs[J];if(Qt!==void 0)return Qt.exports;var F=xs[J]={exports:{}};return Jc[J](F,F.exports,wt),F.exports}wt.d=function(J,Qt){for(var F in Qt)wt.o(Qt,F)&&!wt.o(J,F)&&Object.defineProperty(J,F,{enumerable:!0,get:Qt[F]})},wt.o=function(J,Qt){return Object.prototype.hasOwnProperty.call(J,Qt)},wt.r=function(J){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})};var ji={};return(function(){"use strict"})(),(function(){"use strict";wt.r(ji),wt.d(ji,{bb:function(){return Yc},default:function(){return Yc}});var J={};wt.r(J),wt.d(J,{selection:function(){return El},subchart:function(){return Ml},zoom:function(){return zl}});var Qt={};wt.r(Qt),wt.d(Qt,{area:function(){return sc},areaLineRange:function(){return oc},areaSpline:function(){return lc},areaSplineRange:function(){return cc},areaStep:function(){return uc},areaStepRange:function(){return rc},bar:function(){return dc},bubble:function(){return hc},candlestick:function(){return xc},donut:function(){return Ac},funnel:function(){return Pc},gauge:function(){return Dc},line:function(){return Ic},pie:function(){return Oc},polar:function(){return Bc},radar:function(){return Nc},scatter:function(){return Xc},spline:function(){return Mc},step:function(){return Fc},treemap:function(){return Wc}});var F=wt(2);const O={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",AREA_STEP_RANGE:"area-step-range",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",FUNNEL:"funnel",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},Qc={export:"exportApi",flow:"flow",xgrids:"grid",ygrids:"grid",regions:"regions",category:"category",categories:"category"},ms=16,xe=10,dt=6,Je=3,tu=dt+Je,vs=1,bs={x:{start:"M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",end:"M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"},y:{start:"M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z",end:"M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"}},Ui={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",AREA_STEP_RANGE:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",FUNNEL:"initFunnel",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},ce={Area:[O.AREA,O.AREA_SPLINE,O.AREA_SPLINE_RANGE,O.AREA_LINE_RANGE,O.AREA_STEP,O.AREA_STEP_RANGE],AreaRange:[O.AREA_SPLINE_RANGE,O.AREA_LINE_RANGE,O.AREA_STEP_RANGE],Arc:[O.PIE,O.DONUT,O.GAUGE,O.POLAR,O.RADAR],Line:[O.LINE,O.SPLINE,O.AREA,O.AREA_SPLINE,O.AREA_SPLINE_RANGE,O.AREA_LINE_RANGE,O.STEP,O.AREA_STEP,O.AREA_STEP_RANGE],Step:[O.STEP,O.AREA_STEP,O.AREA_STEP_RANGE],Spline:[O.SPLINE,O.AREA_SPLINE,O.AREA_SPLINE_RANGE]};var Qe=wt(3);const q=e=>e||e===0,z=e=>typeof e=="function",Q=e=>typeof e=="string",$=e=>typeof e=="number",Ct=e=>typeof e=="undefined",ct=e=>typeof e!="undefined",tn=e=>typeof e=="boolean",eu=e=>Math.ceil(e/10)*10,gn=e=>Math.ceil(e)+.5,en=e=>e[1]-e[0],Ut=e=>typeof e=="object",nu=e=>{for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},se=e=>Ct(e)||e===null||Q(e)&&e.length===0||Ut(e)&&!(e instanceof Date)&&nu(e)||$(e)&&isNaN(e),bt=e=>!se(e),ot=e=>Array.isArray(e),tt=e=>e&&!(e!=null&&e.nodeType)&&Ut(e)&&!ot(e);function iu(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function au(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",i=s=>setTimeout(s,1),a=s=>clearTimeout(s);return[t?e.requestAnimationFrame:i,t?e.cancelAnimationFrame:a,n?e.requestIdleCallback:i,n?e.cancelIdleCallback:a]}const N=iu(),nt=N==null?void 0:N.document,[ys,su,Ts,ou]=au(N),ru=new Set(["span","div","p","br","b","i","em","small","strong","mark","u","s","sub","sup","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","hr","pre","code","blockquote","abbr","ins","del","a","img","figure","figcaption","svg","g","path","circle","ellipse","rect","line","polyline","polygon","text","tspan","textPath","use","defs","symbol","clipPath","mask","linearGradient","radialGradient","stop","pattern","marker","title","desc"]),lu=new Set(["class","id","style","title","lang","dir","href","src","alt","width","height","colspan","rowspan","scope","headers","d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","dx","dy","viewBox","preserveAspectRatio","transform","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternTransform","marker-start","marker-mid","marker-end","markerWidth","markerHeight","refX","refY","xlink:href"]),si=new Map;ru.forEach(e=>si.set(e.toLowerCase(),e));const oi=new Map;lu.forEach(e=>oi.set(e.toLowerCase(),e));const cu=new Set(["http:","https:","mailto:"]),uu=new Set(["href","src","xlink:href"]),du=/^<\/?([a-zA-Z][a-zA-Z0-9]*)/,hu=/^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/,fu=/^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/,ws=/([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,Cs=/url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi,gu=["expression(","behavior:","binding:","@import","@charset","-moz-binding:"];function Ki(e){return e.replace(/&colon;/gi,":").replace(/&newline;/gi,`
10
- `).replace(/&tab;/gi," ").replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&#(\d+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,10))).replace(/&#x([0-9a-f]+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,16)))}function Ss(e){const n=Ki(e).trim().replace(/[\s\u0000-\u001f]/g,"").toLowerCase();if(!n||n.startsWith("#"))return!0;const i=n.match(/^[^/?#]*:/);return i?cu.has(i[0]):!0}function pu(e){const n=Ki(e).replace(/[\u0000-\u001f]/g,"");Cs.lastIndex=0;let i;for(;(i=Cs.exec(n))!==null;)if(!Ss(i[1]))return null;const a=n.toLowerCase().replace(/\s/g,"");for(const s of gu)if(a.includes(s))return null;return e}const _u={'"':"&quot;","'":"&#39;","`":"&#96;"},xu=/["'`]/g;function Zi(e){return e.replace(xu,t=>_u[t])}function mu(e,t,n=!1){if(uu.has(e))return Ss(t)?n?Zi(t):t:null;if(e==="style"){const a=pu(t);return a===null?null:n?Zi(a):a}const i=Ki(t).toLowerCase().replace(/\s/g,"");return/\bon\w+=/.test(i)?null:n?Zi(t):t}function vu(e){const t=e.match(du);return t?t[1].toLowerCase():null}function bu(e){const t=vu(e);return t!==null&&si.has(t)}function yu(e){var t,n,i;const a=e.match(hu);if(a){const p=a[1].toLowerCase();return`</${(t=si.get(p))!=null?t:p}>`}const s=e.match(fu);if(!s)return"";const[,o,r,l]=s,c=o.toLowerCase(),d=(n=si.get(c))!=null?n:c,u=[];ws.lastIndex=0;let h;for(;(h=ws.exec(r))!==null;){const p=h[1].toLowerCase(),_=h[2],x=h[3],m=h[4];if(p.startsWith("on"))continue;const b=(i=oi.get(p))!=null?i:p;let v,y;if(_!==void 0)v=_,y='"';else if(x!==void 0)v=x,y="'";else if(m!==void 0)v=m,y='"';else{oi.has(p)&&u.push(b);continue}if(oi.has(p)){const w=mu(p,v,m!==void 0);w!==null&&u.push(`${b}=${y}${w}${y}`)}}const f=u.length>0?` ${u.join(" ")}`:"";return`<${d}${f}${l?"/>":">"}`}function ue(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|<[^>]*$|[^<>\s]+>/g,t=>t.startsWith("<")&&!t.endsWith(">")?t.replace(/</g,"&lt;"):t.startsWith("<!--")?"":t.startsWith("<")?bu(t)?yu(t):t.replace(/</g,"&lt;"):t.slice(0,-1)+"&gt;")}var Tu=Object.defineProperty,As=Object.getOwnPropertySymbols,wu=Object.prototype.hasOwnProperty,Cu=Object.prototype.propertyIsEnumerable,ks=(e,t,n)=>t in e?Tu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ls=(e,t)=>{for(var n in t||(t={}))wu.call(t,n)&&ks(e,n,t[n]);if(As)for(var n of As(t))Cu.call(t,n)&&ks(e,n,t[n]);return e};function Rs(e,t){for(let n=0;n<e.length;n++){const i=e[n];i!==null&&ct(i)&&t(i,n)}}function Ne(e,t,n){return ct(e[t])?e[t]:n}function Su(e,t){for(const n in e)if(e[n]===t)return!0;return!1}function H(e,t,...n){const i=z(e);return i&&e.call(t,...n),i}function ri(e,t){let n=0;const i=function(...a){!--n&&t.apply(this,a)};"duration"in e?e.each(()=>++n).on("end",i):(++n,e.call(i))}const Ot=e=>e.charAt(0).toUpperCase()+e.slice(1);function Au(e,t="-"){return e.split(t).map((n,i)=>i?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const nn=e=>[].slice.call(e);function ku(...e){const t=n=>{if(ot(n))return n.map(t);if(tt(n)&&n.constructor){const i=new n.constructor;for(const a in n)i[a]=t(n[a]);return i}return n};return e.map(n=>t(n)).reduce((n,i)=>Ls(Ls({},n),i))}function St(e={},t){ot(t)&&t.forEach(n=>St(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}function qi(e){const t=e[0]instanceof Date,n=Array.from(new Set(t?e.map(Number):e));return t?n.map(i=>new Date(i)):n}function Lu(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function Ae(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return tt(e)&&tt(n)&&Object.keys(n).forEach(i=>{if(!/^(__proto__|constructor|prototype)$/i.test(i)){const a=n[i];a instanceof Date?e[i]=new Date(a.getTime()):tt(a)?(!e[i]&&(e[i]={}),e[i]=Ae(e[i],a)):e[i]=ot(a)?a.concat():a}}),Ae(e,...t)}function pn(e,t=!0){let n;return e[0]instanceof Date?n=t?(i,a)=>i-a:(i,a)=>a-i:t&&!e.every(isNaN)?n=(i,a)=>i-a:t||(n=(i,a)=>i>a&&-1||i<a&&1||i===a&&0),e.concat().sort(n)}function de(e,t){let n=t.filter(i=>bt(i));if(n.length)if($(n[0])){let i=e==="min"?1/0:-1/0;for(const a of n)(e==="min"?a<i:a>i)&&(i=a);n=i}else n[0]instanceof Date&&(n=pn(n,e==="min")[0]);else n=void 0;return n}const li=(e,t,n=1)=>{const i=[],a=Math.max(0,Math.ceil((t-e)/n))|0;for(let s=0;s<a;s++)i.push(e+s*n);return i};let Ru=0;function me(e=!0){const t=++Ru;return e?String(t):t}function Ji(e,t,n,i,a){if(n>i)return-1;const s=Math.floor((n+i)/2);let{x:o,w:r=0}=e[s];return a&&(o=e[s].y,r=e[s].h),t>=o&&t<=o+r?s:t<o?Ji(e,t,n,s-1,a):Ji(e,t,s+1,i,a)}function an(e,t){return ue(e.replace(/\{=([^}]+)\}/g,(n,i)=>{var a;return(a=t[i])!=null?a:""}))}function Vt(e){var t;let n;if(e instanceof Date)n=e;else if(Q(e)){const{config:i,format:a}=this;n=(t=a.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else $(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function Es(e){if(tt(e)&&!Q(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(Q(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[n,i=n,a=n,s=i]=t;return{top:n,right:i,bottom:a,left:s}}function Ps(e,t){t()===!1?ys(()=>Ps(e,t)):e()}function Ds(e,t=(n=>n)){const n=new Set;return Rs(e,(i,a)=>{n.add(t(i,a))}),n}function Is(e,t,n=(i=>i)){const i=new Map;return Rs(e,(a,s)=>{i.set(t(a,s),n(a,s))}),i}function Xe(e="linear",t,n){const i={linear:Qe.scaleLinear,log:Qe.scaleSymlog,_log:Qe.scaleLog,time:Qe.scaleTime,utc:Qe.scaleUtc}[e]();return i.type=e,/_?log/.test(e)&&i.clamp(!0),i.range([t!=null?t:0,n!=null?n:1])}var Eu={getXScale(e,t,n,i){const a=this,s=a.state.loading!=="append"&&a.scale.zoom||Xe(a.axis.getAxisType("x"),e,t);return a.getCustomizedXScale(n?s.domain(n):s,i)},getYScale(e,t,n,i,a){const o=this.axis.getAxisType(e);if(a&&a.type===o)return a.range([t,n]),i&&a.domain(i),a;const r=Xe(o,t,n);return i&&r.domain(i),r},getYScaleById(e,t=!1){var n;const i=((n=this.axis)==null?void 0:n.getId(e))==="y2",a=t?i?"subY2":"subY":i?"y2":"y";return this.scale[a]},getCustomizedXScale(e,t){const n=this,i=()=>(t?t():n.axis.x.tickOffset())||(n.axis.isCategorized()?(e(1)-e(0))/2:0),a=n.config.axis_x_inverted,s=function(o){return e(o)+i()};for(const o in e)s[o]=e[o];return s.orgDomain=()=>e.domain(),s.orgScale=()=>e,n.axis.isCategorized()&&(s.domain=function(o){let r=o;return arguments.length?(e.domain(r),s):(r=this.orgDomain(),a?[r[0]+1,r[1]]:[r[0],r[1]+1])}),s},updateScales(e,t=!0){var n,i,a,s,o,r,l,c,d;const u=this,{axis:h,config:f,format:g,org:p,scale:_,state:{current:x,width:m,height:b,width2:v,height2:y,hasAxis:T,hasTreemap:w}}=u;if(T){const C=f.axis_rotated,A=u.getResettedPadding(1),S={x:C?A:0,y:C?0:b,subX:C?1:0,subY:C?0:y},k={x:C?b:m,y:C?m:A,subX:C?b:m,subY:C?v:1},L=t?(n=_.x)==null?void 0:n.orgDomain():_.zoom||(a=(i=_.x)==null?void 0:i.domain)==null?void 0:a.call(i),E=t?p.xDomain:_.zoom||(o=(s=_.subX)==null?void 0:s.domain)==null?void 0:o.call(s);_.x=u.getXScale(S.x,k.x,L,()=>h.x.tickOffset()),_.subX=u.getXScale(S.x,k.x,E,D=>{var R;return D%1?0:((R=h.subX)!=null?R:h.x).tickOffset()}),g.xAxisTick=h.getXAxisTickFormat(),g.subXAxisTick=h.getXAxisTickFormat(!0),h.setAxis("x",_.x,f.axis_x_tick_outer,e),f.subchart_show&&h.setAxis("subX",_.subX,(r=f.subchart_axis_x_tick_outer)!=null?r:f.axis_x_tick_outer,e),_.y=u.getYScale("y",S.y,k.y,_.y?_.y.domain():f.axis_y_default,_.y),_.subY=u.getYScale("y",S.subY,k.subY,_.subY?_.subY.domain():f.axis_y_default,_.subY),h.setAxis("y",_.y,f.axis_y_tick_outer,e),f.subchart_show&&f.subchart_axis_y_show&&h.setAxis("subY",_.subY,(l=f.subchart_axis_y_tick_outer)!=null?l:f.axis_y_tick_outer,e),(f.axis_y2_show||f.subchart_axis_y2_show)&&(_.y2=u.getYScale("y2",S.y,k.y,_.y2?_.y2.domain():f.axis_y2_default,_.y2),_.subY2=u.getYScale("y2",S.subY,k.subY,_.subY2?_.subY2.domain():f.axis_y2_default,_.subY2),h.setAxis("y2",_.y2,f.axis_y2_tick_outer,e),f.subchart_show&&f.subchart_axis_y2_show&&h.setAxis("subY2",_.subY2,(c=f.subchart_axis_y2_tick_outer)!=null?c:f.axis_y2_tick_outer,e))}else if(w){const C=u.getCurrentPadding();_.x=(0,Qe.scaleLinear)().rangeRound([C.left,x.width-C.right]),_.y=(0,Qe.scaleLinear)().rangeRound([C.top,x.height-C.bottom])}else(d=u.updateArc)==null||d.call(u)},xx(e){const t=this,{config:n,scale:{x:i,zoom:a}}=t,s=n.zoom_enabled&&a?a:i;return e?s(q(e.x)?e.x:e):null},xv(e){const t=this,{axis:n,config:i,scale:{x:a,zoom:s}}=t,o=i.zoom_enabled&&s?s:a;let r=t.getBaseValue(e);return n.isTimeSeries()?r=Vt.call(t,r):n.isCategorized()&&Q(r)&&(r=i.axis_x_categories.indexOf(r)),o(r)},yv(e){const t=this,{scale:{y:n,y2:i}}=t;return(e.axis&&e.axis==="y2"?i:n)(t.getBaseValue(e))},subxx(e){return e?this.scale.subX(e.x):null}};const Ms=1e5;function he(e){const t=/(\d+(?:\.\d+)?)px/.exec(e),n=parseFloat(t?t[1]:e);return Number.isFinite(n)?n:12}function te(e,t,n,i){return t.indices[n]||e.getShapeIndices(i)}function _n(e,t,n=[]){var i;const a=typeof t=="string"?t:t==null?void 0:t.id;return!((i=e.isGrouped)!=null&&i.call(e,a))||n.some(s=>s(e,t))}function Ge(e,t){var n;const i=typeof t=="string"?t:t==null?void 0:t.id;return i&&((n=e.data_types)==null?void 0:n[i])||e.data_type||O.LINE}function ci(e){const t=+e;return Number.isFinite(t)?t:null}function Fs(e){var t,n;const i=(n=(t=e.scale.zoom||e.scale.x)==null?void 0:t.domain)==null?void 0:n.call(t),a=ci(i==null?void 0:i[0]),s=ci(i==null?void 0:i[1]);return a===null||s===null?null:[Math.min(a,s),Math.max(a,s)]}function ui(e){return ci(e==null?void 0:e.x)}function Pu(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=ui(e[s]);if(o===null)return 0;(n?o<t:o>t)?i=s+1:a=s}return i}function Du(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=ui(e[s]);if(o===null)return e.length;(n?o<=t:o>=t)?i=s+1:a=s}return i}function ke(e,t,n=1){const i=(t==null?void 0:t.values)||[],a={start:0,end:i.length},s=Fs(e);if(!i.length||!s)return a;const o=e.state,r=o._canvasVisibleRangeCache||(o._canvasVisibleRangeCache=new Map),l=[t.id,i.length,o.dataGeneration,s[0],s[1],n].join(":"),c=r.get(t.id);if((c==null?void 0:c.key)===l)return c.range;const d=ui(i[0]),u=ui(i[i.length-1]);if(d===null||u===null)return a;const h=d<=u,f=Pu(i,s[0],h),g=Du(i,s[1],h),p={start:Math.max(0,Math.min(f,g)-n),end:Math.min(i.length,Math.max(f,g)+n)};return r.set(t.id,{key:l,range:p}),p}function ee(e,t){return Ge(e.config,t)===O.BAR}function Mn(e,t){return ce.Area.indexOf(Ge(e.config,t))>-1}function xn(e,t){const n=Ge(e.config,t);return ce.Line.indexOf(n)>-1}function Ve(e,t){return Ge(e.config,t)===O.SCATTER}function We(e,t){return Ge(e.config,t)===O.BUBBLE}function fe(e,t){return xn(e,t)||Ve(e,t)||We(e,t)}function Wt(e,t){return Ge(e.config,t)===O.CANDLESTICK}function Qi(e,t){return Ge(e.config,t)===O.TREEMAP}function Mm(e,t){const n=Ge(e,t);return n===O.BAR||ce.Area.indexOf(n)>-1}function Rt(e,t){const n=e.getBaseValue(t);return n!=null}function yt(e,t){return Number.isFinite(e)&&Number.isFinite(t)}function Os(e,t,n){const i=Math.ceil(n)+1,a=Math.max(1,Math.ceil(e)+i*2+1),s=Math.max(1,Math.ceil(t)+i*2+1);return{data:new Uint8Array(a*s),height:s,offset:i,width:a}}function $s(e,t,n){const i=Math.round(t)+e.offset,a=Math.round(n)+e.offset;if(i<0||i>=e.width||a<0||a>=e.height)return!1;const s=a*e.width+i;return e.data[s]?!1:(e.data[s]=1,!0)}function zt(e,t,n,i=`axis_${t}`){const a=e[`${i}_tick_${n}`];return a!==void 0?a:e[`axis_${t}_tick_${n}`]}function di(e,t){const n=typeof e=="function"?e.call(t):e;return n!=null&&n.length?n:void 0}function Bs(e,t,n){var i,a,s,o,r,l;if((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i,n))return t instanceof Date?t:Vt.call(e,t);if(n==="x"&&((o=(s=e.axis)==null?void 0:s.isCategorized)!=null&&o.call(s))&&typeof t=="string"){const c=e.config.axis_x_categories.indexOf(t);return c>=0?c:t}return(l=(r=e.axis)==null?void 0:r.isLog)!=null&&l.call(r,n)&&t!==null&&t!==void 0?+t:t}function Le(e,t){return Bs(e,t,"x")}function Fn(e,t,n="y"){return Bs(e,t,n)}function zs(e,t,n="y"){return t.map(i=>Fn(e,i,n))}function ta(e,t){return t.map(n=>Le(e,n)).filter(n=>{var i,a;return!(typeof n=="string"&&((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)))})}function sn(e,t){const n=typeof t=="function"?t():t;return e.ticks?e.ticks(n):e.domain()}function Ns(e,t){const[n,i]=e.domain(),a=+n,s=+i;if(t||!Number.isFinite(a)||!Number.isFinite(s)||s<=0)return sn(e,t);const o=Xe("_log").domain([a>0?a:1,s]).range(e.range());let r=o.ticks();for(let l=s.toFixed().length;r.length>15;l--)r=o.ticks(l);return r.length&&(r.splice(0,1,n),r.splice(r.length-1,1,i)),r}function On(e,t){const n=+e,i=+t;return Number.isFinite(n)&&Number.isFinite(i)?Math.abs(n-i)<1e-6:e===t}function Iu(e,t){const[n,i]=t,a=e.slice();return n!==void 0&&!a.some(s=>On(s,n))&&a.unshift(n),i!==void 0&&!a.some(s=>On(s,i))&&a.push(i),a}function Xs(e,t){const n=Le(e,t);return ci(n)}function ea(e){var t,n,i,a,s,o,r,l;const{scale:c}=e,d=(n=(t=c.zoom)==null?void 0:t.domain)==null?void 0:n.call(t),u=((a=(i=c.subX)==null?void 0:i.domain)==null?void 0:a.call(i))||((o=(s=c.x)==null?void 0:s.orgDomain)==null?void 0:o.call(s))||((l=(r=c.x)==null?void 0:r.domain)==null?void 0:l.call(r));return!(d!=null&&d.length)||!(u!=null&&u.length)?!1:!On(d[0],u[0])||!On(d[1],u[1])}function Kt(e){return ea(e)?e.scale.zoom:e.scale.x}function Mu(e,t,n=0){var i,a;const s=(a=(i=Kt(e)).domain)==null?void 0:a.call(i);if(!(s!=null&&s.length))return!0;const o=Xs(e,t),r=+s[0],l=+s[1];return o===null||!Number.isFinite(r)||!Number.isFinite(l)?!0:o>=Math.min(r,l)-n&&o<=Math.max(r,l)+n}function Fu(e,t){const n=[t>0?Math.abs(e[t]-e[t-1]):1/0,t<e.length-1?Math.abs(e[t+1]-e[t]):1/0].filter(Number.isFinite),i=Math.min(...n);return Number.isFinite(i)?i/2:0}function Gs(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<t?n=a+1:i=a}return n}function Ou(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<=t?n=a+1:i=a}return n}function $u(e,t){var n;const{axis:i,state:a}=e,s=[a.dataGeneration,(n=i==null?void 0:i.isTimeSeries)!=null&&n.call(i)?1:0,t.map(c=>`${c.id}:${c.values.length}`).join(",")].join("|"),o=a._canvasXDataTickCache;if((o==null?void 0:o.key)===s)return o;const r=e.mapTargetsToUniqueXs(t),l={key:s,values:r,comparable:r.map(c=>{var d;return(d=Xs(e,c))!=null?d:NaN})};return a._canvasXDataTickCache=l,l}function Bu(e,t){const{values:n,comparable:i}=t;if(!ea(e))return n;const a=Fs(e);if(!a||i.length!==n.length||!Number.isFinite(i[0]))return n.filter(d=>Mu(e,d));const[s,o]=a;let r=Gs(i,s),l=Ou(i,o);const c=d=>{const u=Gs(i,d);let h=-1,f=1/0;for(const g of[u-1,u]){const p=i[g],_=Math.abs(p-d);_<f&&(f=_,h=g)}h>-1&&h<i.length&&f<=Fu(i,h)+1e-6&&(r=Math.min(r,h),l=Math.max(l,h+1))};return c(s),c(o),n.slice(Math.max(0,r),Math.min(n.length,l))}function zu(e,t){return typeof e=="function"?`fn:${t}`:Array.isArray(e)?e.map(n=>n instanceof Date?+n:String(n)).join(","):""}function Nu(e,t){var n,i,a;const{config:s,state:o}=e,l=(((i=(n=Kt(e)).domain)==null?void 0:i.call(n))||[]).map(d=>d instanceof Date?+d:String(d)).join(","),c=s.axis_rotated?o.height:o.width;return[t?1:0,o.dataGeneration,l,c,s.axis_x_tick_fit?1:0,s.axis_x_tick_count||"",s.axis_x_tick_culling,s.axis_x_tick_culling_max||"",s.axis_x_tick_culling_reverse?1:0,((a=s.axis_x_categories)==null?void 0:a.length)||0,zu(s.axis_x_tick_values,o.redrawGeneration)].join("|")}function na(e,t,n,i=!1){var a;return(a=e.axis)!=null&&a.generateTickValues?e.axis.generateTickValues(t,n,i):t}function Xu(e,t){const[n,i]=e,a=[];if(!t||!Number.isFinite(t))return a;for(let s=Math.round(n);s<=i;s+=t)a.push(s);return a}function hi(e,t=!0){var n,i,a,s,o,r,l;const{axis:c,config:d}=e,u=Kt(e),h=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),f=e.state._canvasXTickValuesCache||(e.state._canvasXTickValuesCache=new Map),g=Nu(e,t),p=f.get(g);if(p)return p;const _=b=>(f.set(g,b),b);if(!(h!=null&&h.length))return _([]);const x=di(d.axis_x_tick_values,e.api);if(x){const b=ta(e,x);return _(t?aa(e,b):b)}if(d.axis_x_tick_fit&&(h!=null&&h.length)&&e.mapTargetsToUniqueXs){const b=$u(e,h),v=Bu(e,b),y=na(e,v,d.axis_x_tick_count,(i=c==null?void 0:c.isTimeSeries)==null?void 0:i.call(c));return _(t?aa(e,y,!0):y)}if(ea(e)&&!((a=c==null?void 0:c.isCategorized)!=null&&a.call(c))){const b=((o=(s=e.zoom)==null?void 0:s.getDomain)==null?void 0:o.call(s))||u.domain(),v=Iu(sn(u,d.axis_x_tick_count||xe),b);return _(t?gi(v,sa(e)):v)}if((r=c==null?void 0:c.isCategorized)!=null&&r.call(c)&&((l=d.axis_x_categories)!=null&&l.length)){const b=d.axis_x_categories.map((v,y)=>y);return _(t?gi(b,sa(e)):b)}const m=sn(u,d.axis_x_tick_count||xe);return _(t?gi(m,sa(e)):m)}function Gu(e){const{config:t,state:{height2:n,width2:i}}=e,a=t.axis_rotated?n:i,s=zt(t,"x","count","subchart_axis_x"),o=zt(t,"x","culling","subchart_axis_x"),r=zt(t,"x","culling_max","subchart_axis_x");if(s)return s;if(o!==!1)return Math.min(r||xe,Math.max(2,Math.floor(a/70)))}function Vs(e,t=!0){var n,i,a,s;const{axis:o,config:r,scale:l}=e,c=l.subX,d=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),u=zt(r,"x","count","subchart_axis_x"),h=Gu(e),f=(_,x=!1)=>t?aa(e,_,x,"subchart_axis_x",h):_;if(!c||!(d!=null&&d.length))return[];const g=di(zt(r,"x","values","subchart_axis_x"),e.api);if(g)return f(ta(e,g));if(r.axis_x_tick_fit&&e.mapTargetsToUniqueXs){const _=na(e,e.mapTargetsToUniqueXs(d),u,(i=o==null?void 0:o.isTimeSeries)==null?void 0:i.call(o));return f(_,!0)}if((a=o==null?void 0:o.isCategorized)!=null&&a.call(o)&&((s=r.axis_x_categories)!=null&&s.length))return f(r.axis_x_categories.map((_,x)=>x),!0);const p=sn(c,u||xe);return f(p,!0)}function Ws(e,t=Kt(e),n=e.config.axis_x_tick_outer){var i,a;const s=t,o=((i=s.orgDomain)==null?void 0:i.call(s))||((a=s.domain)==null?void 0:a.call(s));if(!(o!=null&&o.length))return[];const r=+o[0],l=+o[o.length-1];if(!Number.isFinite(r)||!Number.isFinite(l))return[];const c=Math.ceil(Math.min(r,l)),d=Math.floor(Math.max(r,l)),u=Array.from({length:Math.max(0,d-c+1)},(h,f)=>c+f);return n?u.slice(1,-1):u}function ia(e,t,n=Kt(e)){var i,a,s,o,r;const l=n,c=Le(e,t);if((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)){const d=(s=l.orgScale)==null?void 0:s.call(l);if(d)return d(c);const u=((r=(o=e.axis.x)==null?void 0:o.tickOffset)==null?void 0:r.call(o))||(l(1)-l(0))/2;return l(c)-u}return l(c)}function Ys(e,t,n,i=Kt(e)){if(t.length<2)return!1;const a=Math.max(1,n)/2,s=t.map(r=>ia(e,r,i)).filter(Number.isFinite).sort((r,l)=>r-l);if(s.length<2)return!1;let o=s[0]+a;for(let r=1;r<s.length;r++){const l=s[r]-a,c=s[r]+a;if(l<=o+vs)return!0;o=Math.max(o,c)}return!1}function fi(e,t,n=Kt(e)){const i=new Set;return t.filter(a=>{const s=ia(e,a,n),o=Math.round(s);return!Number.isFinite(s)||i.has(o)?!1:(i.add(o),!0)})}function Vu(e,t,n=1){var i;const{axis:a,config:s}=e;if((i=a==null?void 0:a.isCategorized)!=null&&i.call(a)){const r=Ws(e);return fi(e,r)}if(s.axis_x_tick_culling===!1||s.axis_x_tick_culling_lines===!1)return t;const o=hi(e,!1);return Ys(e,o,n)?t:fi(e,o)}function Wu(e,t,n=1){var i;const{axis:a,config:s,scale:o}=e,r=o.subX,l=zt(s,"x","culling","subchart_axis_x"),c=zt(s,"x","culling_lines","subchart_axis_x"),d=zt(s,"x","outer","subchart_axis_x");if(!r)return[];if((i=a==null?void 0:a.isCategorized)!=null&&i.call(a)){const h=Ws(e,r,d);return fi(e,h,r)}if(l===!1||c===!1)return t;const u=Vs(e,!1);return Ys(e,u,n,r)?t:fi(e,u,r)}function $n(e,t="y",n,i=!0,a=e.scale[t],s=`axis_${t}`){var o,r,l;const{axis:c,config:d}=e,u=`axis_${t}`,h=di(zt(d,t,"values",s),e.api),f=_=>i?Uu(e,t,_,s):_;if(h)return f(zs(e,h,t));const g=Xu(a.domain(),d[`${u}_tick_stepSize`]);if(g.length)return f(g);const p=n!=null?n:zt(d,t,"count",s);if((o=c==null?void 0:c.isTimeSeries)!=null&&o.call(c,t)&&d[`${u}_tick_time_value`])return f(sn(a,d[`${u}_tick_time_value`]));if((r=c==null?void 0:c.isLog)!=null&&r.call(c,t))return f(Ns(a,p));if(p){const _=a.domain();return f(na(e,_,_.every(x=>x===0)?1:p,(l=c==null?void 0:c.isTimeSeries)==null?void 0:l.call(c,t)))}return f(sn(a,xe))}function Yu(e,t,n){const i=t==="x"?Kt(e):e.scale[t],a=i!=null&&i.copy?i.copy():i;return n.domain&&(a!=null&&a.domain)&&a.domain(n.domain),a}function Hu(e,t,n,i){var a,s,o;const r=i.tick||{},l=di(r.values,e.api);return l?t==="x"?ta(e,l):zs(e,l,t):t!=="x"&&((s=(a=e.axis)==null?void 0:a.isLog)!=null&&s.call(a,t))?Ns(n,r.count):sn(n,(o=r.count)!=null?o:xe)}function ju(e,t){var n;const i=(n=t.tick)==null?void 0:n.format;return typeof i=="function"?i.bind(e.api):(a=>a)}function gi(e,t){const n=e.length-1;if(t&&n>t){const i=e.length-1;return t<=1?[e[0]]:Array.from({length:t},(a,s)=>e[Math.round(s*i/(t-1))])}return e}function Uu(e,t,n,i=`axis_${t}`){const{config:a}=e;if(!zt(a,t,"culling",i))return n;const o=zt(a,t,"culling_max",i)||xe,r=zt(a,t,"culling_reverse",i),l=n.slice().sort((h,f)=>{const g=+h,p=+f,_=Number.isFinite(g)&&Number.isFinite(p)?g-p:String(h).localeCompare(String(f));return r?-_:_}),c=l.length;let d=0;for(let h=1;h<c;h++)if(c/h<o){d=h;break}if(!d)return n;const u=new Set(l.filter((h,f)=>f%d===0));return n.filter(h=>u.has(h))}function aa(e,t,n=!1,i="axis_x",a){const{config:s}=e;if(zt(s,"x","culling",i)===!1)return t;const r=a||zt(s,"x","culling_max",i)||xe,l=zt(s,"x","culling_reverse",i),c=n?t:t.slice().sort((f,g)=>{const p=+f,_=+g;return Number.isFinite(p)&&Number.isFinite(_)?l?_-p:p-_:l?String(g).localeCompare(String(f)):String(f).localeCompare(String(g))}),d=c.length;let u=0;for(let f=1;f<d;f++)if(d/f<r){u=f;break}if(!u)return t;if(n)return t.filter((f,g)=>l?(d-1-g)%u===0:g%u===0);const h=new Set(c.filter((f,g)=>g%u===0));return t.filter(f=>h.has(f))}function sa(e){const{config:t,state:{height:n,width:i}}=e,a=t.axis_rotated?n:i;if(t.axis_x_tick_count)return t.axis_x_tick_count;if(t.axis_x_tick_culling!==!1)return Math.min(t.axis_x_tick_culling_max||xe,Math.max(2,Math.floor(a/70)))}function Ku(e){var t,n;const{axis:i,config:a}=e,s=(n=(t=i==null?void 0:i.y)==null?void 0:t.getGeneratedTicks)==null?void 0:n.call(t,a.grid_y_ticks);return s!=null&&s.length?s:a.grid_y_ticks?gi($n(e,"y",void 0,!1),a.grid_y_ticks):$n(e,"y",void 0,!1)}var Zu=Object.defineProperty,qu=(e,t,n)=>t in e?Zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ju=(e,t,n)=>qu(e,typeof t!="symbol"?t+"":t,n);class Hs{constructor(t){Ju(this,"ctx",t)}get context(){return this.ctx}withContext(t,n){const i=this.ctx;this.ctx=t;try{n()}finally{this.ctx=i}}withState(t){const{ctx:n}=this;n.save();try{t(n)}finally{n.restore()}}withTranslation(t,n,i){this.withState(a=>{a.translate(t,n),i(a)})}clipRect(t,n){this.withState(i=>{i.beginPath(),i.rect(t.x,t.y,t.w,t.h),i.clip(),n(i)})}measureText(t){return this.ctx.measureText(t)}traceLine(t,n,i,a){const{ctx:s}=this;s.moveTo(t,n),s.lineTo(i,a)}traceCrispLine(t,n,i,a,s){this.traceLine(this.crisp(t,s),this.crisp(n,s),this.crisp(i,s),this.crisp(a,s))}traceCircle(t,n,i){this.ctx.moveTo(t+i,n),this.ctx.arc(t,n,i,0,Math.PI*2)}strokePath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.stroke()})}fillPath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.fill()})}fillRect(t,n){this.withStyle(n,i=>{i.fillRect(t.x,t.y,t.w,t.h)})}fillRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.fillRect(a,i);return}this.fillPath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.strokeRect(a,i);return}this.strokePath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRect(t,n){this.withStyle(n,i=>{i.strokeRect(t.x,t.y,t.w,t.h)})}text(t,n,i,a){const s=(r,l,c)=>{(a==null?void 0:a.maxWidth)===void 0?r.fillText(t,l,c):r.fillText(t,l,c,a.maxWidth)},o=r=>{a!=null&&a.angle?(r.translate(n,i),r.rotate(a.angle*Math.PI/180),s(r,0,0)):s(r,n,i)};a!=null&&a.angle?this.withState(r=>{this.applyStyle(a),o(r)}):this.withStyle(a,o)}textLines(t,n,i,a){this.withState(s=>{const o=t.split(`
11
- `),r=he((a==null?void 0:a.font)||s.font),l=o.length>1?-((o.length-1)*r):0;this.applyStyle(a),s.translate(n,i),a!=null&&a.angle&&s.rotate(a.angle*Math.PI/180),o.forEach((c,d)=>{const u=l+d*r;(a==null?void 0:a.maxWidth)===void 0?s.fillText(c,0,u):s.fillText(c,0,u,a.maxWidth)})})}point(t,n,i,a,s){this.withStyle(s,o=>{const r=!(s!=null&&s.stroke)||s.fill!==void 0,l=(s==null?void 0:s.stroke)!==void 0;if(t==="rectangle"){const c=a*2,d={x:n-a,y:i-a,w:c,h:c};r&&o.fillRect(d.x,d.y,d.w,d.h),l&&o.strokeRect(d.x,d.y,d.w,d.h)}else o.beginPath(),o.arc(n,i,a,0,Math.PI*2),r&&o.fill(),l&&o.stroke()})}getRectRadii(t,n){const i=typeof n=="number"?{tl:n,tr:n,br:n,bl:n}:{tl:n.tl||0,tr:n.tr||0,br:n.br||0,bl:n.bl||0},a=Math.max(0,Math.min(Math.abs(t.w),Math.abs(t.h))/2);return{tl:Math.max(0,Math.min(i.tl,a)),tr:Math.max(0,Math.min(i.tr,a)),br:Math.max(0,Math.min(i.br,a)),bl:Math.max(0,Math.min(i.bl,a))}}traceRoundRect(t,n,i){const{x:a,y:s,w:o,h:r}=n,l=a+o,c=s+r;t.moveTo(a+i.tl,s),t.lineTo(l-i.tr,s),i.tr?t.quadraticCurveTo(l,s,l,s+i.tr):t.lineTo(l,s),t.lineTo(l,c-i.br),i.br?t.quadraticCurveTo(l,c,l-i.br,c):t.lineTo(l,c),t.lineTo(a+i.bl,c),i.bl?t.quadraticCurveTo(a,c,a,c-i.bl):t.lineTo(a,c),t.lineTo(a,s+i.tl),i.tl?t.quadraticCurveTo(a,s,a+i.tl,s):t.lineTo(a,s),t.closePath()}normalizeRect(t){const n=t.w<0?t.x+t.w:t.x,i=t.h<0?t.y+t.h:t.y;return{x:n,y:i,w:Math.abs(t.w),h:Math.abs(t.h)}}applyStyle(t){if(!t)return;const{ctx:n}=this;t.fill!==void 0&&(n.fillStyle=t.fill),t.stroke!==void 0&&(n.strokeStyle=t.stroke),t.lineWidth!==void 0&&(n.lineWidth=t.lineWidth),t.alpha!==void 0&&(n.globalAlpha=t.alpha),t.font!==void 0&&(n.font=t.font),t.textAlign!==void 0&&(n.textAlign=t.textAlign),t.textBaseline!==void 0&&(n.textBaseline=t.textBaseline),t.lineDash!==void 0&&n.setLineDash(t.lineDash)}withStyle(t,n){t?this.withState(i=>{this.applyStyle(t),n(i)}):n(this.ctx)}crisp(t,n){return n%2?Math.round(t)+.5:Math.round(t)}}var Qu=Object.defineProperty,td=Object.defineProperties,ed=Object.getOwnPropertyDescriptors,js=Object.getOwnPropertySymbols,nd=Object.prototype.hasOwnProperty,id=Object.prototype.propertyIsEnumerable,oa=(e,t,n)=>t in e?Qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Us=(e,t)=>{for(var n in t||(t={}))nd.call(t,n)&&oa(e,n,t[n]);if(js)for(var n of js(t))id.call(t,n)&&oa(e,n,t[n]);return e},Ks=(e,t)=>td(e,ed(t)),ra=(e,t,n)=>oa(e,typeof t!="symbol"?t+"":t,n);const Zs=20,qs=15;function la(e){return e?-1:1}function ad(e,t){return e?t?-1:1:t?1:-1}function sd(e,t){var n,i,a;const s=t==="y2"?"subY2":"subY",o=(a=(i=(n=e.axis)==null?void 0:n[s])==null?void 0:i.tickFormat)==null?void 0:a.call(i),r=e.config[`subchart_axis_${t}_tick_format`]||e.config[`axis_${t}_tick_format`];return o||(typeof r=="function"?r.bind(e.api):(l=>l))}function od(e){return e?{stroke:e.lineColor,lineWidth:e.lineWidth,lineDash:e.dashArray}:void 0}function rd(e){return e?{fill:e.labelColor,font:e.labelFont}:void 0}function ca(e,t,n){return{x:e.left-Zs,y:0,w:t+Zs*2,h:n}}function ua(e,t,n){return{x:0,y:e.top-qs,w:t,h:n+qs*2}}function ld(e,t){var n,i;const a=(i=(n=e.config.axis_tooltip)==null?void 0:n.backgroundColor)!=null?i:"black";return typeof a=="string"?a:(a==null?void 0:a[t])||null}function cd(e,t,n){var i,a;const s=e.scale[t];if(!(s!=null&&s.invert))return null;const o=s.invert(n);if(o==null)return null;if(t==="x"&&((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i)))return e.format.xAxisTick(o);const r=Number(o);return Number.isFinite(r)?r.toFixed(2):`${o}`}function ud(e,t){const{config:n,state:{height:i,margin:a,width:s}}=e,o=n.axis_rotated,r={x:a.left,y:a.top};return t==="x"?!o&&(r.y+=i):t==="y"?o&&(r.y+=i):o?r.y-=1:r.x+=s,r}function dd(e,t,n,i){return i?{x:e.x+n,y:e.y-t}:{x:e.x+t,y:e.y+n}}function Js(e,t){const n=e?e(t):t;return n==null?"":String(n)}function Bn(e,t){return e[`${t}TickFont`]||e.labelFont}function da(e,t){const n=e.measureText("0"),i=(n.fontBoundingBoxAscent||0)+(n.fontBoundingBoxDescent||0),a=(n.actualBoundingBoxAscent||0)+(n.actualBoundingBoxDescent||0),s=(t||10)*(11.5/10);return Math.max(t,i,a,s)}function hd(e){return 11.5-2.5*(e/15)*(e>0?1:-1)}function fd(e){return 8*Math.sin(Math.PI*(e/180))}function ha(e,t){if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return Number.isFinite(n)?/em$/.test(e.trim())?n*t:n:0}return 0}function gd(e,t,n){if(!t)return[e];const i=n.measureText("0").width||5.5;function a(s,o){let r;for(let l=1;l<o.length;l++)if(o.charAt(l)===" "&&(r=l),t<i*(l+1)){const c=r||l;return a(s.concat(o.slice(0,c)),o.slice(r?r+1:l))}return s.concat(o)}return a([],e)}function fa(e,t,n,i){var a,s;const o=e.config.axis_x_tick_width;if(o&&o>0)return o;if(n)return 95;if((s=(a=e.axis)==null?void 0:a.isCategorized)!=null&&s.call(a)&&t.length>1){const r=i(Le(e,t[0])),l=i(Le(e,t[1]));return Math.max(0,Math.abs(l-r)-12)}return 110}function Qs(e,t,n,i,a=[],s=!1,o=Kt(e),r){const l=n?n(i):i;if(l==null)return[""];if(Array.isArray(l))return l.map(d=>String(d));const c=String(l);return c.indexOf(`
8
+ * @version 4.2.0-next.1
9
+ */(function(te,kn){if(typeof exports=="object"&&typeof module=="object")module.exports=kn(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if(typeof define=="function"&&define.amd)define(["d3-axis","d3-brush","d3-drag","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],kn);else{var ya=typeof exports=="object"?kn(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):kn(te.d3,te.d3,te.d3,te.d3,te.d3,te.d3,te.d3,te.d3,te.d3,te.d3,te.d3);for(var Ta in ya)(typeof exports=="object"?exports:te)[Ta]=ya[Ta]}})(this,function(qs,te,kn,ya,Ta,xd,md,vd,bd,yd,Td){return(function(){var wd=[,,(function(at){"use strict";at.exports=vd}),(function(at){"use strict";at.exports=xd}),(function(at){"use strict";at.exports=md}),(function(at){"use strict";at.exports=bd}),(function(at){"use strict";at.exports=kn}),(function(at){"use strict";at.exports=te}),(function(at){"use strict";at.exports=yd}),(function(at){"use strict";at.exports=Td}),(function(at){"use strict";at.exports=qs}),(function(at){"use strict";at.exports=Ta}),(function(at){"use strict";at.exports=ya})],Js={};function kt(at){var re=Js[at];if(re!==void 0)return re.exports;var ee=Js[at]={exports:{}};return wd[at](ee,ee.exports,kt),ee.exports}kt.d=function(at,re){for(var ee in re)kt.o(re,ee)&&!kt.o(at,ee)&&Object.defineProperty(at,ee,{enumerable:!0,get:re[ee]})},kt.o=function(at,re){return Object.prototype.hasOwnProperty.call(at,re)},kt.r=function(at){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(at,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(at,"__esModule",{value:!0})};var fi={};return(function(){"use strict"})(),(function(){"use strict";kt.r(fi),kt.d(fi,{bb:function(){return fd},default:function(){return fd}});var at={};kt.r(at),kt.d(at,{selection:function(){return yc},subchart:function(){return Cc},zoom:function(){return Rc}});var re={};kt.r(re),kt.d(re,{area:function(){return qc},areaLineRange:function(){return Jc},areaSpline:function(){return tu},areaSplineRange:function(){return eu},areaStep:function(){return nu},areaStepRange:function(){return Qc},bar:function(){return au},boxplot:function(){return ou},bubble:function(){return ru},bullet:function(){return _u},candlestick:function(){return yu},donut:function(){return Pu},funnel:function(){return Ou},gauge:function(){return $u},heatmap:function(){return Wu},line:function(){return Vu},pie:function(){return ju},polar:function(){return Ku},radar:function(){return qu},sankey:function(){return ld},scatter:function(){return cd},spline:function(){return Hu},step:function(){return Yu},treemap:function(){return hd}});function ee(e,t){return e.config.axis_rotated?[t[1],t[0]]:[t[0],t[1]]}function wa(e,t,n=1){const a=t.map(h=>ee(e,h)),i=a.map(([h])=>h),s=a.map(([,h])=>h),o=Math.min(...i),r=Math.min(...s),l=Math.max(...i)-o,c=Math.max(...s)-r,u=Math.max(n,l),d=Math.max(n,c);return{x:o-(u-l)/2,y:r-(d-c)/2,w:u,h:d}}function Kn(e,t){var n,a;const i=(n=e.isGrouped)!=null&&n.call(e,t.id)&&e.circleY?e.circleY(t,t.index):e.getYScaleById(t.id)(e.getBaseValue(t)),s=(a=e.xx(t))!=null?a:NaN;return e.config.axis_rotated?{x:i,y:s}:{x:s,y:i}}function kd(e,t,n){return{x:e.cx(t,n),y:e.cy(t,n)}}function Cd(e,t){return{body:wa(e,[t[0],t[1]]),wickStart:ee(e,[t[2][0],t[2][1]]),wickEnd:ee(e,[t[2][0],t[2][2]])}}function Cn(e,t,n,a=!1){if(t===n)return{x:0,y:0,w:e.state.width,h:0};const{scale:{x:i,y:s}}=e,o=i(t.x0),r=s(t.y0),l=i(t.x1)-o,c=s(t.y1)-r;return{x:o,y:r,w:a?Math.max(0,l):l,h:a?Math.max(0,c):c}}function Sd(e,t,n,a){const{config:i}=e,{id:s,value:o,ratio:r=0}=t,l=i.treemap_label_format,c=typeof l=="function"?l.bind(e.api)(o,r,s,{width:n,height:a}):`${s}
10
+ ${(r*100).toFixed(2)}%`;return c==null?null:String(c)}function gi(e){const{config:t,state:n}=e;return!!(t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&t.subchart_show&&t.subchart_brush_enabled===!1&&n.width2>0&&n.height2>0)}function Qs(e,t){var n;const{config:a,scale:i,state:s}=e,o=i.zoom||i.x,r=i.subX;if(!o||!r)return null;const l=a.axis_rotated?s.height2:s.width2,c=a.axis_rotated?s.height:s.width,u=(n=r.invert)==null?void 0:n.call(r,t);let d=u==null?NaN:o(u);return!Number.isFinite(d)&&l>0&&(d=Math.max(0,Math.min(1,t/l))*c),Number.isFinite(d)?Math.max(0,Math.min(c,d)):null}const nt=e=>e||e===0,G=e=>typeof e=="function",st=e=>typeof e=="string",N=e=>typeof e=="number",Ct=e=>typeof e=="undefined",ht=e=>typeof e!="undefined",cn=e=>typeof e=="boolean",Ad=e=>Math.ceil(e/10)*10,Sn=e=>Math.ceil(e)+.5,un=e=>e[1]-e[0],ne=e=>typeof e=="object",Ld=e=>{for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},le=e=>Ct(e)||e===null||st(e)&&e.length===0||ne(e)&&!(e instanceof Date)&&Ld(e)||N(e)&&isNaN(e),St=e=>!le(e),et=e=>Array.isArray(e),Q=e=>e&&!(e!=null&&e.nodeType)&&ne(e)&&!et(e),pi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,to=/([aAcChHlLmMqQsStTvVzZ])|([-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?)/g;function Pd(e){const t=new Set;let n=-1,a=0,i=!1,s;for(to.lastIndex=0;s=to.exec(e);)if(s[1])i=s[1]==="a"||s[1]==="A",a=0;else if(n++,i){const o=a%7;(o===2||o===3||o===4)&&t.add(n),a++}return t}function Rd(e,t){const n=Pd(t),a=[],i=[];let s=0,o=-1,r=-1,l,c;const u=f=>{a[o]?a[o]+=f:a[++o]=f};pi.lastIndex=0;const d=pi,h=new RegExp(pi.source,"g");for(e+="",t+="";(l=d.exec(e))&&(c=h.exec(t));){if(r++,c.index>s&&u(t.slice(s,c.index)),l[0]===c[0])u(c[0]);else{const f=+l[0],p=+c[0],g=n.has(r);a[++o]=null,i.push({index:o,fn:g?_=>Math.round(f+(p-f)*_):_=>f+(p-f)*_})}s=h.lastIndex}if(s<t.length&&u(t.slice(s)),!i.length){const f=a.join("");return()=>f}return f=>{for(let p=0,g=i.length;p<g;p++){const{index:_,fn:x}=i[p];a[_]=String(x(f))}return a.join("")}}function ka(e){const{bar_radius:t,bar_radius_ratio:n}=e.config;return N(t)&&t>0?()=>t:N(n)?a=>a*n:null}function _i(e){const{config:t,data:n}=e,a=new Set;if(!t.data_groups.length)return a;const i=e.orderTargets(e.filterTargetsToShow(n.targets.filter(e.isBarType,e)));for(const s of t.data_groups){const o=new Set(s),r=new Map,l=new Map;for(const c of i)if(o.has(c.id))for(const u of c.values)u.value===null||u.value===0||(u.value>0?r:l).set(u.index,c.id);for(const[c,u]of r)a.add(`${u}:${c}`);for(const[c,u]of l)a.add(`${u}:${c}`)}return a}function Ed(e,t,n){return n?e?t?{tl:n,bl:n}:{tr:n,br:n}:t?{br:n,bl:n}:{tl:n,tr:n}:0}function Md(e,t,n,a){let i="";return n?a&&e[0]<t?i=`0 ${t-e[0]}px 0 0`:!a&&e[0]>t&&(i=`0 0 0 ${e[0]-t}px`):a&&e[1]>t?i=`${e[1]-t}px 0 0 0`:!a&&e[1]<t&&(i=`0 0 ${t-e[1]}px 0`),i?`inset(${i})`:null}function xi(e,t,n,a,i,s){const{config:o,state:r}=e,l=o.axis_rotated,c=+l,u=+!c,d=t.value<0,h=o[`axis_${e.axis.getId(t.id)}_inverted`],f=!h&&d||h&&!d,p=e.isGrouped(t.id),g=a&&p&&t.value!==0?r.hiddenTargetIds.has(t.id)&&s?s(t):i.has(`${t.id}:${t.index}`):!1,_=[n[0][c],n[0][u]];let x=0;if(a){const v=l?u:c,b=Math.abs(n[2][v]-n[0][v]);x=Math.max(0,!p||g?a(b):0)}const m=l?n[1][c]+(f?x:-x):n[1][u]+(f?-x:x);return{radius:x,corners:Ed(l,f,x),clipPath:x?Md(_,m,l,f):null,indexX:c,indexY:u,isNegative:f,pos:m}}function Dd(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function Od(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",a=s=>setTimeout(s,1),i=s=>clearTimeout(s);return[t?e.requestAnimationFrame:a,t?e.cancelAnimationFrame:i,n?e.requestIdleCallback:a,n?e.cancelIdleCallback:i]}const W=Dd(),rt=W==null?void 0:W.document,[eo,$d,no,Fd]=Od(W),Id=new Set(["span","div","p","br","b","i","em","small","strong","mark","u","s","sub","sup","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","hr","pre","code","blockquote","abbr","ins","del","a","img","figure","figcaption","svg","g","path","circle","ellipse","rect","line","polyline","polygon","text","tspan","textPath","use","defs","symbol","clipPath","mask","linearGradient","radialGradient","stop","pattern","marker","title","desc"]),Bd=new Set(["class","id","style","title","lang","dir","href","src","alt","width","height","colspan","rowspan","scope","headers","d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","dx","dy","viewBox","preserveAspectRatio","transform","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternTransform","marker-start","marker-mid","marker-end","markerWidth","markerHeight","refX","refY","xlink:href"]),Ca=new Map;Id.forEach(e=>Ca.set(e.toLowerCase(),e));const Sa=new Map;Bd.forEach(e=>Sa.set(e.toLowerCase(),e));const zd=new Set(["http:","https:","mailto:"]),Nd=new Set(["href","src","xlink:href"]),Xd=/^<\/?([a-zA-Z][a-zA-Z0-9]*)/,Gd=/^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/,Wd=/^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/,ao=/([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,io=/url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi,Vd=["expression(","behavior:","binding:","@import","@charset","-moz-binding:"];function mi(e){return e.replace(/&colon;/gi,":").replace(/&newline;/gi,`
11
+ `).replace(/&tab;/gi," ").replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&#(\d+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,10))).replace(/&#x([0-9a-f]+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,16)))}function so(e){const n=mi(e).trim().replace(/[\s\u0000-\u001f]/g,"").toLowerCase();if(!n||n.startsWith("#"))return!0;const a=n.match(/^[^/?#]*:/);return a?zd.has(a[0]):!0}function Hd(e){const n=mi(e).replace(/[\u0000-\u001f]/g,"");io.lastIndex=0;let a;for(;(a=io.exec(n))!==null;)if(!so(a[1]))return null;const i=n.toLowerCase().replace(/\s/g,"");for(const s of Vd)if(i.includes(s))return null;return e}const Yd={'"':"&quot;","'":"&#39;","`":"&#96;"},jd=/["'`]/g;function vi(e){return e.replace(jd,t=>Yd[t])}function Ud(e,t,n=!1){if(Nd.has(e))return so(t)?n?vi(t):t:null;if(e==="style"){const i=Hd(t);return i===null?null:n?vi(i):i}const a=mi(t).toLowerCase().replace(/\s/g,"");return/\bon\w+=/.test(a)?null:n?vi(t):t}function Kd(e){const t=e.match(Xd);return t?t[1].toLowerCase():null}function Zd(e){const t=Kd(e);return t!==null&&Ca.has(t)}function qd(e){var t,n,a;const i=e.match(Gd);if(i){const g=i[1].toLowerCase();return`</${(t=Ca.get(g))!=null?t:g}>`}const s=e.match(Wd);if(!s)return"";const[,o,r,l]=s,c=o.toLowerCase(),u=(n=Ca.get(c))!=null?n:c,d=[];ao.lastIndex=0;let h;for(;(h=ao.exec(r))!==null;){const g=h[1].toLowerCase(),_=h[2],x=h[3],m=h[4];if(g.startsWith("on"))continue;const v=(a=Sa.get(g))!=null?a:g;let b,T;if(_!==void 0)b=_,T='"';else if(x!==void 0)b=x,T="'";else if(m!==void 0)b=m,T='"';else{Sa.has(g)&&d.push(v);continue}if(Sa.has(g)){const w=Ud(g,b,m!==void 0);w!==null&&d.push(`${v}=${T}${w}${T}`)}}const f=d.length>0?` ${d.join(" ")}`:"";return`<${u}${f}${l?"/>":">"}`}function ve(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|<[^>]*$|[^<>\s]+>/g,t=>t.startsWith("<")&&!t.endsWith(">")?t.replace(/</g,"&lt;"):t.startsWith("<!--")?"":t.startsWith("<")?Zd(t)?qd(t):t.replace(/</g,"&lt;"):t.slice(0,-1)+"&gt;")}var Jd=Object.defineProperty,oo=Object.getOwnPropertySymbols,Qd=Object.prototype.hasOwnProperty,th=Object.prototype.propertyIsEnumerable,ro=(e,t,n)=>t in e?Jd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lo=(e,t)=>{for(var n in t||(t={}))Qd.call(t,n)&&ro(e,n,t[n]);if(oo)for(var n of oo(t))th.call(t,n)&&ro(e,n,t[n]);return e};function co(e,t){for(let n=0;n<e.length;n++){const a=e[n];a!==null&&ht(a)&&t(a,n)}}function je(e,t,n){return ht(e[t])?e[t]:n}function eh(e,t){for(const n in e)if(e[n]===t)return!0;return!1}function q(e,t,...n){const a=G(e);return a&&e.call(t,...n),a}function Aa(e,t){let n=0;const a=function(...i){!--n&&t.apply(this,i)};"duration"in e?e.each(()=>++n).on("end",a):(++n,e.call(a))}const Mt=e=>e.charAt(0).toUpperCase()+e.slice(1);function nh(e,t="-"){return e.split(t).map((n,a)=>a?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const dn=e=>[].slice.call(e);function ah(...e){const t=n=>{if(et(n))return n.map(t);if(Q(n)&&n.constructor){const a=new n.constructor;for(const i in n)a[i]=t(n[i]);return a}return n};return e.map(n=>t(n)).reduce((n,a)=>lo(lo({},n),a))}function pt(e={},t){et(t)&&t.forEach(n=>pt(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}function bi(e){const t=e[0]instanceof Date,n=Array.from(new Set(t?e.map(Number):e));return t?n.map(a=>new Date(a)):n}function ih(e){if(!(e!=null&&e.length))return[];if(e.length===1)return e[0];const t=[];for(let n=0;n<e.length;n++){const a=e[n];if(Array.isArray(a))for(let i=0;i<a.length;i++)t.push(a[i]);else t.push(a)}return t}function Fe(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return Q(e)&&Q(n)&&Object.keys(n).forEach(a=>{if(!/^(__proto__|constructor|prototype)$/i.test(a)){const i=n[a];i instanceof Date?e[a]=new Date(i.getTime()):Q(i)?(!e[a]&&(e[a]={}),e[a]=Fe(e[a],i)):e[a]=et(i)?i.concat():i}}),Fe(e,...t)}function An(e,t=!0){let n;return e[0]instanceof Date?n=t?(a,i)=>a-i:(a,i)=>i-a:t&&!e.every(isNaN)?n=(a,i)=>a-i:t||(n=(a,i)=>a>i&&-1||a<i&&1||a===i&&0),e.concat().sort(n)}function be(e,t){let n=t.filter(a=>St(a));if(n.length)if(N(n[0])){let a=e==="min"?1/0:-1/0;for(const i of n)(e==="min"?i<a:i>a)&&(a=i);n=a}else n[0]instanceof Date&&(n=An(n,e==="min")[0]);else n=void 0;return n}const La=(e,t,n=1)=>{const a=[],i=Math.max(0,Math.ceil((t-e)/n))|0;for(let s=0;s<i;s++)a.push(e+s*n);return a};let sh=0;function ye(e=!0){const t=++sh;return e?String(t):t}function yi(e,t,n,a,i){if(n>a)return-1;const s=Math.floor((n+a)/2);let{x:o,w:r=0}=e[s];return i&&(o=e[s].y,r=e[s].h),t>=o&&t<=o+r?s:t<o?yi(e,t,n,s-1,i):yi(e,t,s+1,a,i)}function hn(e,t){return ve(e.replace(/\{=([^}]+)\}/g,(n,a)=>{var i;return(i=t[a])!=null?i:""}))}function Zt(e){var t;let n;if(e instanceof Date)n=e;else if(st(e)){const{config:a,format:i}=this;n=(t=i.dataTime(a.data_xFormat)(e))!=null?t:new Date(e)}else N(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function uo(e){if(Q(e)&&!st(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(st(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[n,a=n,i=n,s=a]=t;return{top:n,right:a,bottom:i,left:s}}function ho(e,t){t()===!1?eo(()=>ho(e,t)):e()}function fo(e,t=(n=>n)){const n=new Set;return co(e,(a,i)=>{n.add(t(a,i))}),n}function go(e,t,n=(a=>a)){const a=new Map;return co(e,(i,s)=>{a.set(t(i,s),n(i,s))}),a}const po="2 2";function _o(e,t,n){const a=e.axis.isTimeSeries(),i=(s,o)=>Ct(s)?o:a?Zt.call(e,s):s;return(n||[]).map(s=>{var o,r;return{start:i(s.start,(o=t[0])==null?void 0:o.x),end:i(s.end,(r=t[t.length-1])==null?void 0:r.x),style:s.style||{dasharray:po}}})}function xo(e,t){for(let n=0,a;a=t[n];n++)if(a.start<e&&e<=a.end)return a.style;return!1}function oh(e){const t=String((e==null?void 0:e.dasharray)||po).split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:[2,2]}function rh(e,t,n,a,i){const s=e.config.axis_rotated,o=_o(e,t,i),r=[];for(let l=1;l<t.length;l++){const c=t[l-1],u=t[l];if(!nt(c.value)||!nt(u.value)){r.push({isBreak:!0});continue}const d=xo(u.x,o),h=n(c.x),f=a(c.value),p=n(u.x),g=a(u.value);r.push({start:s?[f,h]:[h,f],end:s?[g,p]:[p,g],dash:d?oh(d):[]})}return r}var bt=kt(2),lh=Object.defineProperty,ch=Object.defineProperties,uh=Object.getOwnPropertyDescriptors,mo=Object.getOwnPropertySymbols,dh=Object.prototype.hasOwnProperty,hh=Object.prototype.propertyIsEnumerable,vo=(e,t,n)=>t in e?lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bo=(e,t)=>{for(var n in t||(t={}))dh.call(t,n)&&vo(e,n,t[n]);if(mo)for(var n of mo(t))hh.call(t,n)&&vo(e,n,t[n]);return e},yo=(e,t)=>ch(e,uh(t));function To(e,t){return t?n=>{var a;const i=(a=e.getSubchartCandlestickShapeValue)==null?void 0:a.call(e,n,!0);return i===void 0?e.getBaseValue(n):i}:n=>e.getBaseValue(n)}function wo(e,t,n){return n?t.map(a=>{var i;const s=(i=e.getSubchartCandlestickShapeValue)==null?void 0:i.call(e,a,n);return s===void 0?a:yo(bo({},a),{value:s})}):t}function fh(e,t,n){return e.isStepType(t)?e.convertValuesToStep(n):n}function ko(e,t,n,a){const{config:i,scale:s}=e,o=i.line_connectNull,r=i.axis_rotated,l=e.generateGetLinePoints(t,n),c=e.getYScaleById.bind(e),u=To(e,n),d=g=>(n?e.subxx:e.xx).call(e,g),h=(g,_)=>e.isGrouped(g.id)?l(g,_)[0][1]:c(g.id,n)(u(g));let f=(0,bt.line)();f=r?f.x(h).y(d):f.x(d).y(h),a&&(f=f.context(a)),o||(f=f.defined(g=>u(g)!==null));const p=n?s.subX:s.x;return g=>{const _=c(g.id,n);let x=o?e.filterRemoveNull(g.values):g.values,m=0,v=0,b;if(e.isLineType(g)){const T=i.data_regions[g.id];T&&!a&&e.lineWithRegions?(x=wo(e,x,n),e.isAreaRangeType(g)&&(x=x.map(k=>yo(bo({},k),{value:e.getRangedData(k,"mid")}))),e.isStepType(g)&&(x=e.convertValuesToStep(x)),b=e.lineWithRegions(x,s.zoom||p,_,T)):b=f.curve(e.getCurve(g))(fh(e,g,x))}else x[0]&&(m=p(x[0].x),v=_(u(x[0]))),b=r?`M ${v} ${m}`:`M ${m} ${v}`;return b||(a?void 0:"M 0 0")}}function Co(e,t,n,a){const{config:i}=e,s=i.line_connectNull,o=i.axis_rotated,r=e.generateGetAreaPoints(t,n),l=e.getYScaleById.bind(e),c=To(e,n),u=new Map,d=g=>{let _=u.get(g);return _===void 0&&(_=e.getShapeYMin(g,n),u.set(g,_)),_},h=g=>(n?e.subxx:e.xx).call(e,g),f=(g,_)=>e.isGrouped(g.id)?r(g,_)[0][1]:l(g.id,n)(e.isAreaRangeType(g)?e.getRangedData(g,"high"):d(g.id)),p=(g,_)=>e.isGrouped(g.id)?r(g,_)[1][1]:l(g.id,n)(e.isAreaRangeType(g)?e.getRangedData(g,"low"):c(g));return g=>{let _=s?e.filterRemoveNull(g.values):g.values,x=0,m=0,v;if(e.isAreaType(g)){let b=(0,bt.area)();b=o?b.y(h).x0(f).x1(p):b.x(h).y0(i.area_above?0:i.area_below?n?e.state.height2:e.state.height:f).y1(p),a&&(b=b.context(a)),s||(b=b.defined(T=>c(T)!==null)),_=wo(e,_,n),e.isStepType(g)&&(_=e.convertValuesToStep(_)),v=b.curve(e.getCurve(g))(_)}else _[0]&&(x=(n?e.scale.subX:e.scale.x)(_[0].x),m=e.getYScaleById(g.id,n)(c(_[0]))),v=o?`M ${m} ${x}`:`M ${x} ${m}`;return v||(a?void 0:"M 0 0")}}const X={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",AREA_STEP_RANGE:"area-step-range",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",FUNNEL:"funnel",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},gh={export:"exportApi",flow:"flow",xgrids:"grid",ygrids:"grid",regions:"regions",category:"category",categories:"category"},So=16,Ae=10,xt=6,fn=3,Ao=xt+fn,Lo=1,Po={x:{start:"M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",end:"M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"},y:{start:"M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z",end:"M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"}},Ro={area:"initArea","area-line-range":"initArea","area-spline":"initArea","area-spline-range":"initArea","area-step":"initArea","area-step-range":"initArea",bar:"initBar",bubble:"initCircle",boxplot:"initBoxplot",bullet:"getBulletData",candlestick:"initCandlestick",donut:"initArc",funnel:"initFunnel",gauge:"initArc",line:"initLine",pie:"initArc",polar:"initPolar",radar:"initCircle",heatmap:"getHeatmapLayout",sankey:"getSankeyLayout",scatter:"initCircle",spline:"initLine",step:"initLine",treemap:"initTreemap"},Te={Area:[X.AREA,X.AREA_SPLINE,X.AREA_SPLINE_RANGE,X.AREA_LINE_RANGE,X.AREA_STEP,X.AREA_STEP_RANGE],AreaRange:[X.AREA_SPLINE_RANGE,X.AREA_LINE_RANGE,X.AREA_STEP_RANGE],Arc:[X.PIE,X.DONUT,X.GAUGE,X.POLAR,X.RADAR],Line:[X.LINE,X.SPLINE,X.AREA,X.AREA_SPLINE,X.AREA_SPLINE_RANGE,X.AREA_LINE_RANGE,X.STEP,X.AREA_STEP,X.AREA_STEP_RANGE],Step:[X.STEP,X.AREA_STEP,X.AREA_STEP_RANGE],Spline:[X.SPLINE,X.AREA_SPLINE,X.AREA_SPLINE_RANGE]},Eo=1e5;function ce(e){const t=/(\d+(?:\.\d+)?)px/.exec(e),n=parseFloat(t?t[1]:e);return Number.isFinite(n)?n:12}function Gt(e,t,n,a){return t.indices[n]||e.getShapeIndices(a)}function Ln(e,t,n=[]){var a;const i=typeof t=="string"?t:t==null?void 0:t.id;return!((a=e.isGrouped)!=null&&a.call(e,i))||n.some(s=>s(e,t))}function Ue(e,t){var n;const a=typeof t=="string"?t:t==null?void 0:t.id;return a&&((n=e.data_types)==null?void 0:n[a])||e.data_type||X.LINE}function Pa(e){const t=+e;return Number.isFinite(t)?t:null}function Mo(e){var t,n;const a=(n=(t=e.scale.zoom||e.scale.x)==null?void 0:t.domain)==null?void 0:n.call(t),i=Pa(a==null?void 0:a[0]),s=Pa(a==null?void 0:a[1]);return i===null||s===null?null:[Math.min(i,s),Math.max(i,s)]}function Ra(e){return Pa(e==null?void 0:e.x)}function ph(e,t,n){let a=0,i=e.length;for(;a<i;){const s=a+i>>1,o=Ra(e[s]);if(o===null)return 0;(n?o<t:o>t)?a=s+1:i=s}return a}function _h(e,t,n){let a=0,i=e.length;for(;a<i;){const s=a+i>>1,o=Ra(e[s]);if(o===null)return e.length;(n?o<=t:o>=t)?a=s+1:i=s}return a}function we(e,t,n=1){const a=(t==null?void 0:t.values)||[],i={start:0,end:a.length},s=Mo(e);if(!a.length||!s)return i;const o=e.state,r=o._canvasVisibleRangeCache||(o._canvasVisibleRangeCache=new Map),l=[t.id,a.length,o.dataGeneration,s[0],s[1],n].join(":"),c=r.get(t.id);if((c==null?void 0:c.key)===l)return c.range;const u=Ra(a[0]),d=Ra(a[a.length-1]);if(u===null||d===null)return i;const h=u<=d,f=ph(a,s[0],h),p=_h(a,s[1],h),g={start:Math.max(0,Math.min(f,p)-n),end:Math.min(a.length,Math.max(f,p)+n)};return r.set(t.id,{key:l,range:g}),g}function ue(e,t){return Ue(e.config,t)===X.BAR}function Zn(e,t){return Te.Area.indexOf(Ue(e.config,t))>-1}function Pn(e,t){const n=Ue(e.config,t);return Te.Line.indexOf(n)>-1}function Ke(e,t){return Ue(e.config,t)===X.SCATTER}function Ze(e,t){return Ue(e.config,t)===X.BUBBLE}function ke(e,t){return Pn(e,t)||Ke(e,t)||Ze(e,t)}function qt(e,t){return Ue(e.config,t)===X.CANDLESTICK}function Ti(e,t){return Ue(e.config,t)===X.TREEMAP}function k0(e,t){const n=Ue(e,t);return n===X.BAR||Te.Area.indexOf(n)>-1}function Dt(e,t){const n=e.getBaseValue(t);return n!=null}function At(e,t){return Number.isFinite(e)&&Number.isFinite(t)}function Do(e,t,n){const a=Math.ceil(n)+1,i=Math.max(1,Math.ceil(e)+a*2+1),s=Math.max(1,Math.ceil(t)+a*2+1);return{data:new Uint8Array(i*s),height:s,offset:a,width:i}}function Oo(e,t,n){const a=Math.round(t)+e.offset,i=Math.round(n)+e.offset;if(a<0||a>=e.width||i<0||i>=e.height)return!1;const s=i*e.width+a;return e.data[s]?!1:(e.data[s]=1,!0)}var xh=Object.defineProperty,mh=(e,t,n)=>t in e?xh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vh=(e,t,n)=>mh(e,typeof t!="symbol"?t+"":t,n);class $o{constructor(t){vh(this,"ctx",t)}get context(){return this.ctx}withContext(t,n){const a=this.ctx;this.ctx=t;try{n()}finally{this.ctx=a}}withState(t){const{ctx:n}=this;n.save();try{t(n)}finally{n.restore()}}withTranslation(t,n,a){this.withState(i=>{i.translate(t,n),a(i)})}clipRect(t,n){this.withState(a=>{a.beginPath(),a.rect(t.x,t.y,t.w,t.h),a.clip(),n(a)})}measureText(t){return this.ctx.measureText(t)}traceLine(t,n,a,i){const{ctx:s}=this;s.moveTo(t,n),s.lineTo(a,i)}traceCrispLine(t,n,a,i,s){this.traceLine(this.crisp(t,s),this.crisp(n,s),this.crisp(a,s),this.crisp(i,s))}traceCircle(t,n,a){this.ctx.moveTo(t+a,n),this.ctx.arc(t,n,a,0,Math.PI*2)}strokePath(t,n){this.withStyle(n,a=>{a.beginPath(),t(a),a.stroke()})}fillPath(t,n){this.withStyle(n,a=>{a.beginPath(),t(a),a.fill()})}fillRect(t,n){this.withStyle(n,a=>{a.fillRect(t.x,t.y,t.w,t.h)})}fillRoundRect(t,n=0,a){const i=this.normalizeRect(t),s=this.getRectRadii(i,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.fillRect(i,a);return}this.fillPath(o=>{this.traceRoundRect(o,i,s)},a)}strokeRoundRect(t,n=0,a){const i=this.normalizeRect(t),s=this.getRectRadii(i,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.strokeRect(i,a);return}this.strokePath(o=>{this.traceRoundRect(o,i,s)},a)}strokeRect(t,n){this.withStyle(n,a=>{a.strokeRect(t.x,t.y,t.w,t.h)})}text(t,n,a,i){const s=(r,l,c)=>{(i==null?void 0:i.maxWidth)===void 0?r.fillText(t,l,c):r.fillText(t,l,c,i.maxWidth)},o=r=>{i!=null&&i.angle?(r.translate(n,a),r.rotate(i.angle*Math.PI/180),s(r,0,0)):s(r,n,a)};i!=null&&i.angle?this.withState(r=>{this.applyStyle(i),o(r)}):this.withStyle(i,o)}textLines(t,n,a,i){this.withState(s=>{const o=t.split(`
12
+ `),r=ce((i==null?void 0:i.font)||s.font),l=o.length>1?-((o.length-1)*r):0;this.applyStyle(i),s.translate(n,a),i!=null&&i.angle&&s.rotate(i.angle*Math.PI/180),o.forEach((c,u)=>{const d=l+u*r;(i==null?void 0:i.maxWidth)===void 0?s.fillText(c,0,d):s.fillText(c,0,d,i.maxWidth)})})}point(t,n,a,i,s){this.withStyle(s,o=>{const r=!(s!=null&&s.stroke)||s.fill!==void 0,l=(s==null?void 0:s.stroke)!==void 0;if(t==="rectangle"){const c=i*2,u={x:n-i,y:a-i,w:c,h:c};r&&o.fillRect(u.x,u.y,u.w,u.h),l&&o.strokeRect(u.x,u.y,u.w,u.h)}else o.beginPath(),o.arc(n,a,i,0,Math.PI*2),r&&o.fill(),l&&o.stroke()})}getRectRadii(t,n){const a=typeof n=="number"?{tl:n,tr:n,br:n,bl:n}:{tl:n.tl||0,tr:n.tr||0,br:n.br||0,bl:n.bl||0},i=Math.max(0,Math.min(Math.abs(t.w),Math.abs(t.h))/2);return{tl:Math.max(0,Math.min(a.tl,i)),tr:Math.max(0,Math.min(a.tr,i)),br:Math.max(0,Math.min(a.br,i)),bl:Math.max(0,Math.min(a.bl,i))}}traceRoundRect(t,n,a){const{x:i,y:s,w:o,h:r}=n,l=i+o,c=s+r;t.moveTo(i+a.tl,s),t.lineTo(l-a.tr,s),a.tr?t.quadraticCurveTo(l,s,l,s+a.tr):t.lineTo(l,s),t.lineTo(l,c-a.br),a.br?t.quadraticCurveTo(l,c,l-a.br,c):t.lineTo(l,c),t.lineTo(i+a.bl,c),a.bl?t.quadraticCurveTo(i,c,i,c-a.bl):t.lineTo(i,c),t.lineTo(i,s+a.tl),a.tl?t.quadraticCurveTo(i,s,i+a.tl,s):t.lineTo(i,s),t.closePath()}normalizeRect(t){const n=t.w<0?t.x+t.w:t.x,a=t.h<0?t.y+t.h:t.y;return{x:n,y:a,w:Math.abs(t.w),h:Math.abs(t.h)}}applyStyle(t){if(!t)return;const{ctx:n}=this;t.fill!==void 0&&(n.fillStyle=t.fill),t.stroke!==void 0&&(n.strokeStyle=t.stroke),t.lineWidth!==void 0&&(n.lineWidth=t.lineWidth),t.alpha!==void 0&&(n.globalAlpha=t.alpha),t.font!==void 0&&(n.font=t.font),t.textAlign!==void 0&&(n.textAlign=t.textAlign),t.textBaseline!==void 0&&(n.textBaseline=t.textBaseline),t.lineDash!==void 0&&n.setLineDash(t.lineDash)}withStyle(t,n){t?this.withState(a=>{this.applyStyle(t),n(a)}):n(this.ctx)}crisp(t,n){return n%2?Math.round(t)+.5:Math.round(t)}}let Ie;function Ea(e,t){if(!N(t)||t>=1)return e;const n=e.match(/^#([\da-f]{3}|[\da-f]{6})$/i);if(n){const s=(n[1].length===3?n[1].split("").map(r=>r+r).join(""):n[1]).match(/.{2}/g);return s?`rgba(${s.map(r=>parseInt(r,16)).join(",")},${t})`:e}if(/^rgb\(/i.test(e))return e.replace(/^rgb\((.*)\)$/i,`rgba($1,${t})`);if(/^rgba\(/i.test(e))return e.replace(/^rgba\((.*),\s*([\d.]+)\)$/i,(i,s,o)=>`rgba(${s},${Number(o)*t})`);const a=bh(e);return a&&a!==e?Ea(a,t):e}function bh(e){if(!W.document||(Ie===void 0&&(Ie=W.document.createElement("canvas").getContext("2d")),!Ie))return null;Ie.fillStyle="#000",Ie.fillStyle=e;const t=Ie.fillStyle;Ie.fillStyle="#fff",Ie.fillStyle=e;const n=Ie.fillStyle;return t===n?t:null}function qn(e,t,n,a){const i=t(n,a),s=wa(e,i);return At(s.x,s.y)&&At(s.x+s.w,s.y+s.h)?{points:i,rect:s}:null}function Jn(e,t,n,a){const i=t(n,a),{body:s,wickStart:o,wickEnd:r}=Cd(e,i);return At(s.x,s.y)&&At(s.x+s.w,s.y+s.h)&&At(o[0],o[1])&&At(r[0],r[1])?{body:s,points:i,wickStart:o,wickEnd:r}:null}const yh=1.2;function wi(e,t){var n,a,i;let{value:s}=t;if((n=e.isBubbleZType)!=null&&n.call(e,t))s=e.getBubbleZData(s,"z");else if((a=e.isCandlestickType)!=null&&a.call(e,t)){const o=(i=e.getCandlestickData)==null?void 0:i.call(e,t);o&&(s=o.close)}return s}function ki(e,t){const n=e.dataLabelFormat(t.id)(wi(e,t),t.id,t.index,[]);return n==null?null:String(n)}function Fo(e){return`${e.id}:${e.index}`}function Ci(e,t,n){var a;if(!(t!=null&&t.length))return()=>!1;if(e.config.tooltip_grouped&&t.length>1){const s=(a=t[0])==null?void 0:a.index;return o=>s!==void 0&&o.index===s&&n(e,o)}const i=new Set(t.filter(s=>s&&n(e,s)).map(Fo));return s=>i.has(Fo(s))}function Rn(e,t,n,a){const i=e.config.data_labels_position;let s;if(G(i))s=i.bind(e.api)(n,wi(e,t),t.id,t.index,a);else if(i){const o=t.id in i?i[t.id]:i;s=o==null?void 0:o[n]}return N(s)?s:0}function Th(e,t){var n,a;const i=(n=e.config.data_labels)==null?void 0:n.image;if(G(i))return(a=i.call(e.api,wi(e,t),t.id,t.index))!=null?a:null;if(i){const{url:s="",width:o=0,height:r=0,pos:l}=i;return{url:s,width:o,height:r,pos:l}}return null}function wh(e,t){return hn(e.url,{ID:t.id})}function kh(e,t,n,a,i,s){var o,r,l;const{width:c=0,height:u=0,pos:d}=t,h=c/2,f=u/2,p=Si(e.canvasEngine.ctx,n,a,i).h,g=ce(e.canvasEngine.ctx.font),_=a-h,x=i-f-((o=e.isTreemapType)!=null&&o.call(e,s)?g*.7:p/2);let m=a,v=i;return e.config.axis_rotated?m+=h:v+=f,{x:_+((r=d==null?void 0:d.x)!=null?r:0),y:x+((l=d==null?void 0:d.y)!=null?l:0),textX:m,textY:v}}function Io(e,t,n){var a,i,s,o,r;const l=(a=e.updateTextColor)==null?void 0:a.call(e,t);return typeof l=="string"?l:(s=(i=e.getCustomTypeHooks)==null?void 0:i.call(e,t))!=null&&s.themeTextColor||(o=e.isTreemapType)!=null&&o.call(e,t)?n:((r=e.color)==null?void 0:r.call(e,t))||n}function Ch(e,t){var n;const a=e.config.data_labels_backgroundColors;if(!a)return null;if(st(a))return a;if(G(a)){const s=(n=e.color)==null?void 0:n.call(e,t),o=a.bind(e.api)(s,t);return o==null?null:String(o)}const i=a[t.id];return i==null?null:String(i)}function Sh(e){var t,n,a;if(!e)return null;const i=Q(e)?e:{};return{padding:uo((t=i.padding)!=null?t:"3 5"),radius:N(i.radius)?i.radius:10,stroke:(n=i.stroke)!=null?n:"#000",strokeWidth:N(i.strokeWidth)?i.strokeWidth:1,fill:(a=i.fill)!=null?a:"none"}}function Si(e,t,n,a,i={top:0,right:0,bottom:0,left:0}){var s,o;const r=t.split(`
13
+ `),l=r.map(x=>e.measureText(x)),c=Math.max(...l.map(x=>x.width),0),u=ce(e.font),d=u*yh,h=l[0]?(l[0].fontBoundingBoxAscent||0)+(l[0].fontBoundingBoxDescent||0):0,f=l[0]&&(l[0].fontBoundingBoxDescent||l[0].actualBoundingBoxDescent)||0,p=r.length>1?d*r.length:Math.max(u,h,((s=l[0])==null?void 0:s.actualBoundingBoxAscent)+((o=l[0])==null?void 0:o.actualBoundingBoxDescent)||0);let g=n,_=a;return e.textAlign==="center"?g-=c/2:(e.textAlign==="right"||e.textAlign==="end")&&(g-=c),e.textBaseline==="middle"?_-=p/2:e.textBaseline==="alphabetic"?_-=p-f:(e.textBaseline==="bottom"||e.textBaseline==="ideographic")&&(_-=p),{x:g-i.left,y:_-i.top,w:c+i.left+i.right,h:p+i.top+i.bottom}}function Bo(e,t,n,a,i,s){var o,r;const l=t.context,c=Ch(e,n),u=Sh((o=e.config.data_labels)==null?void 0:o.border),d=(r=u==null?void 0:u.padding)!=null?r:{top:0,right:0,bottom:0,left:0},h=Si(l,a,i,s,d),f=e.config.data_labels.rotate;t.withState(p=>{var g;f&&(p.translate(i,s),p.rotate(f*Math.PI/180),h.x-=i,h.y-=s),c&&t.fillRoundRect(h,(g=u==null?void 0:u.radius)!=null?g:0,{fill:c}),u&&(u.fill!=="none"&&t.fillRoundRect(h,u.radius,{fill:u.fill}),t.strokeRoundRect(h,u.radius,{stroke:u.stroke,lineWidth:u.strokeWidth}))})}function Ah(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function Lh(e){return e==="start"?"left":e==="end"?"right":"center"}function Ph(e,t,n,a){var i,s,o;const r=Ah(e.config.data_labels.rotate),l=e.config.axis_rotated,c=e.config[`axis_${(i=e.axis)==null?void 0:i.getId(t.id)}_inverted`],u=qt(e,t),{value:d}=t,h=N(d)&&d<0||u&&!((o=(s=e.getCandlestickData)==null?void 0:s.call(e,t))!=null&&o._isUp),f=4,p=f*2;return l?r==="start"?(n+=h?0:p,a+=f):r==="middle"?(n+=p,a-=p):r==="end"&&(h&&(n-=p),a+=f):(r==="start"?(n+=f,h&&(a+=p*2)):r==="middle"?a-=p:r==="end"&&(n-=f,h&&(a+=p*2)),c&&(a+=h?-17:u?13:7)),{x:n,y:a,textAlign:Lh(r)}}function zo(e,t,n,a,i){var s;if(e.config.axis_rotated)a+=6,t.textAlign="left",t.textBaseline="middle";else if(Ze(e,n))t.textAlign="center",t.textBaseline="middle";else{const{config:o,state:r}=e,l=o[`axis_${(s=e.axis)==null?void 0:s.getId(n.id)}_inverted`],c=n.value<0||n.value===0&&!r.hasPositiveValue&&r.hasNegativeValue;let u=3;N(o.point_r)&&o.point_r>5&&(Pn(e,n)||Ke(e,n))&&(u+=o.point_r/2.3),t.textAlign="center",(l?!c:c)?(i+=u,t.textBaseline="top"):(i-=u*2,t.textBaseline="bottom")}return{x:a,y:i}}var Rh=Object.defineProperty,No=Object.getOwnPropertySymbols,Eh=Object.prototype.hasOwnProperty,Mh=Object.prototype.propertyIsEnumerable,Xo=(e,t,n)=>t in e?Rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Be=(e,t)=>{for(var n in t||(t={}))Eh.call(t,n)&&Xo(e,n,t[n]);if(No)for(var n of No(t))Mh.call(t,n)&&Xo(e,n,t[n]);return e};const Go={x:0,y:0,w:8,h:8},Ai=new Map,Wo=[1,0,0,1,0,0];function Dh(e){return e==="circle"||e==="rectangle"}function Nt(e,t,n=0){const a=e.getAttribute(t),i=a===null?NaN:parseFloat(a);return Number.isFinite(i)?i:n}function Oh(e){const t=(e.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi)||[]).map(Number).filter(Number.isFinite),n=[];for(let a=0;a<t.length-1;a+=2)n.push([t[a],t[a+1]]);return n}function $h(e){const t=(e==null?void 0:e.trim().split(/[\s,]+/).map(Number).filter(Number.isFinite))||[];return t.length===4?{x:t[0],y:t[1],w:t[2],h:t[3]}:null}function Vo(e){const t=e.map(([s])=>s),n=e.map(([,s])=>s),a=Math.min(...t),i=Math.min(...n);return{x:a,y:i,w:Math.max(...t)-a,h:Math.max(...n)-i}}function Fh(e){const t=e.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)&&Number.isFinite(o.w)&&Number.isFinite(o.h));if(!t.length)return Be({},Go);const n=Math.min(...t.map(o=>o.x)),a=Math.min(...t.map(o=>o.y)),i=Math.max(...t.map(o=>o.x+o.w)),s=Math.max(...t.map(o=>o.y+o.h));return{x:n,y:a,w:i-n,h:s-a}}function Qn(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Ih(e){let t=[...Wo];return((e==null?void 0:e.match(/[a-z]+\([^)]*\)/gi))||[]).forEach(n=>{var a;const[,i,s]=n.match(/^([a-z]+)\(([^)]*)\)$/i)||[],o=i==null?void 0:i.toLowerCase(),r=((s==null?void 0:s.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi))||[]).map(Number).filter(Number.isFinite);let l=null;if(o==="matrix"&&r.length>=6)l=r.slice(0,6);else if(o==="translate"&&r.length)l=[1,0,0,1,r[0],r[1]||0];else if(o==="scale"&&r.length)l=[r[0],0,0,(a=r[1])!=null?a:r[0],0,0];else if(o==="rotate"&&r.length){const c=r[0]*Math.PI/180,u=Math.cos(c),d=Math.sin(c),h=[u,d,-d,u,0,0];l=r.length>=3?Qn(Qn([1,0,0,1,r[1],r[2]],h),[1,0,0,1,-r[1],-r[2]]):h}else o==="skewx"&&r.length?l=[1,0,Math.tan(r[0]*Math.PI/180),1,0,0]:o==="skewy"&&r.length&&(l=[1,Math.tan(r[0]*Math.PI/180),0,1,0,0]);l&&(t=Qn(t,l))}),t}function qe(e,t){const n=e.getAttribute("style"),a=e.getAttribute(t),i=n==null?void 0:n.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"));return((i==null?void 0:i[1])||a||"").trim()||null}function Bh(e,t){const n=Be({},t),a=qe(e,"fill"),i=qe(e,"stroke"),s=qe(e,"stroke-width"),o=qe(e,"opacity"),r=qe(e,"fill-opacity"),l=qe(e,"stroke-opacity");if(a&&(n.fill=a==="none"?null:a),i&&(n.stroke=i==="none"?null:i),s){const c=parseFloat(s);Number.isFinite(c)&&(n.lineWidth=c)}return[o,r,l].forEach(c=>{var u;const d=c===null?NaN:parseFloat(c);Number.isFinite(d)&&(n.alpha=((u=n.alpha)!=null?u:1)*d)}),n}function zh(e){const t=new Map;return Array.from(e.querySelectorAll("[id]")).forEach(n=>{const a=n.getAttribute("id");a&&t.set(a,n)}),t}function Le(e,t){const n=e==null?void 0:e.trim();return n?/%$/.test(n)?n:parseFloat(n):t}function Pe(e,t,n,a){if(typeof e=="number")return Number.isFinite(e)?e:a;if(typeof e=="string"&&/%$/.test(e)){const s=parseFloat(e);return Number.isFinite(s)?t+n*s/100:a}const i=parseFloat(e!=null?e:"");return Number.isFinite(i)?i:a}function Nh(e){const t=(e==null?void 0:e.trim())||"0",n=parseFloat(t),a=/%$/.test(t)?n/100:n;return Math.max(0,Math.min(1,Number.isFinite(a)?a:0))}function Xh(e){return Array.from(e.children||[]).filter(t=>t.tagName.toLowerCase()==="stop").map(t=>{const n=qe(t,"stop-color")||"#000",a=qe(t,"stop-opacity"),i=a===null?NaN:parseFloat(a);return{offset:Nh(t.getAttribute("offset")),color:n,opacity:Number.isFinite(i)?i:void 0}})}function Gh(e){const t=new Map;return e.forEach((n,a)=>{const i=n.tagName.toLowerCase(),s=Xh(n);s.length&&(i==="lineargradient"?t.set(a,{type:"linearGradient",x1:Le(n.getAttribute("x1"),"0%"),y1:Le(n.getAttribute("y1"),"0%"),x2:Le(n.getAttribute("x2"),"100%"),y2:Le(n.getAttribute("y2"),"0%"),stops:s}):i==="radialgradient"&&t.set(a,{type:"radialGradient",cx:Le(n.getAttribute("cx"),"50%"),cy:Le(n.getAttribute("cy"),"50%"),r:Le(n.getAttribute("r"),"50%"),fx:Le(n.getAttribute("fx"),"50%"),fy:Le(n.getAttribute("fy"),"50%"),fr:Le(n.getAttribute("fr"),0),stops:s}))}),t}function Li(e,t,n,a=Wo,i={},s=new Set){const o=e.tagName.toLowerCase(),r=Array.from(e.children||[]),l=Bh(e,i),c=Qn(a,Ih(e.getAttribute("transform"))),u={matrix:c,style:l};if(o==="defs")return[];if(o==="svg"||o==="g"||o==="symbol")return r.reduce((d,h)=>d.concat(Li(h,t,n,c,l,s)),[]);if(o==="use"){const d=e.getAttribute("href")||e.getAttribute("xlink:href")||"",h=d.charAt(0)==="#"?d.slice(1):"",f=h&&n.get(h);if(!f||s.has(h))return[];const p=Nt(e,"x",0),g=Nt(e,"y",0),_=Qn(c,[1,0,0,1,p,g]);s.add(h);const x=Li(f,t,n,_,l,s);return s.delete(h),x}if(o==="polygon"||o==="polyline"){const d=Oh(e.getAttribute("points")||"");return d.length?[Be({type:o,points:d,box:Vo(d)},u)]:[]}if(o==="circle"){const d=Nt(e,"cx",0),h=Nt(e,"cy",0),f=Nt(e,"r",0);return f>0?[Be({type:"circle",cx:d,cy:h,r:f,box:{x:d-f,y:h-f,w:f*2,h:f*2}},u)]:[]}if(o==="ellipse"){const d=Nt(e,"cx",0),h=Nt(e,"cy",0),f=Nt(e,"rx",0),p=Nt(e,"ry",0);return f>0&&p>0?[Be({type:"ellipse",cx:d,cy:h,rx:f,ry:p,box:{x:d-f,y:h-p,w:f*2,h:p*2}},u)]:[]}if(o==="rect"){const d=Nt(e,"x",0),h=Nt(e,"y",0),f=Nt(e,"width",0),p=Nt(e,"height",0);return f>0&&p>0?[Be({type:"rect",x:d,y:h,w:f,h:p,box:{x:d,y:h,w:f,h:p}},u)]:[]}if(o==="line"){const d=Nt(e,"x1",0),h=Nt(e,"y1",0),f=Nt(e,"x2",0),p=Nt(e,"y2",0);return[Be({type:"line",x1:d,y1:h,x2:f,y2:p,box:Vo([[d,h],[f,p]])},u)]}if(o==="path"){const d=e.getAttribute("d")||"";return d?[Be({type:"path",d,box:t},u)]:[]}return[]}function Wh(e){if(!/^</.test(e))return null;if(Ai.has(e))return Ai.get(e)||null;let t=null;try{const a=new W.DOMParser().parseFromString(ve(e),"image/svg+xml").documentElement,i=$h(a.getAttribute("viewBox"))||Go,s=zh(a),o=Li(a,i,s);o.length&&(t={shapes:o,box:a.tagName.toLowerCase()==="svg"?i:Fh(o.map(r=>r.box)),paints:Gh(s)})}catch(n){t=null}return Ai.set(e,t),t}function Vh(e,t){if(t.type==="polygon"||t.type==="polyline"){const[n,...a]=t.points;e.moveTo(n[0],n[1]),a.forEach(([i,s])=>e.lineTo(i,s)),t.type==="polygon"&&e.closePath()}else t.type==="circle"?(e.moveTo(t.cx+t.r,t.cy),e.arc(t.cx,t.cy,t.r,0,Math.PI*2)):t.type==="ellipse"?(e.moveTo(t.cx+t.rx,t.cy),e.ellipse(t.cx,t.cy,t.rx,t.ry,0,0,Math.PI*2)):t.type==="rect"?e.rect(t.x,t.y,t.w,t.h):t.type==="line"&&(e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2))}function Ma(e){const t=e==null?void 0:e.match(/^url\(#([^)]+)\)$/);return(t==null?void 0:t[1])||null}function Ho(e,t,n){const{x:a,y:i,w:s,h:o}=n,r=t.type==="linearGradient"?e.createLinearGradient(Pe(t.x1,a,s,a),Pe(t.y1,i,o,i),Pe(t.x2,a,s,a+s),Pe(t.y2,i,o,i)):e.createRadialGradient(Pe(t.fx,a,s,a+s/2),Pe(t.fy,i,o,i+o/2),Pe(t.fr,a,Math.max(s,o),0),Pe(t.cx,a,s,a+s/2),Pe(t.cy,i,o,i+o/2),Math.max(.01,Pe(t.r,0,Math.max(s,o),Math.max(s,o)/2)));return t.stops.forEach(({offset:l,color:c,opacity:u})=>{r.addColorStop(l,u===void 0?c:Ea(c,u))}),r}function Hh(e,t,n,a,i){const s=Be({},t||{});if(n.fill!==void 0)if(n.fill===null)delete s.fill;else if(Ma(n.fill)){const o=a.get(Ma(n.fill));o&&(s.fill=Ho(e,o,i))}else/^url\(/.test(n.fill)||(s.fill=n.fill);if(n.stroke!==void 0)if(n.stroke===null)delete s.stroke;else if(Ma(n.stroke)){const o=a.get(Ma(n.stroke));o&&(s.stroke=Ho(e,o,i))}else/^url\(/.test(n.stroke)||(s.stroke=n.stroke);return n.lineWidth!==void 0&&(s.lineWidth=n.lineWidth),{style:s,shouldFill:n.fill!==null&&(!s.stroke||s.fill!==void 0),shouldStroke:n.stroke!==null&&s.stroke!==void 0,alpha:n.alpha}}function ta(e,t,n,a,i,s,o=i){if(Dh(t)){e.point(t,n,a,i,s);return}const r=Wh(t);if(!r||i<=0){e.point("circle",n,a,i,s);return}e.withState(l=>{const{box:c,paints:u,shapes:d}=r,h=o>0?i/o:1,f=p=>{const{style:g,shouldFill:_,shouldStroke:x,alpha:m}=Hh(l,s,p.style,u,c);if(l.save(),e.applyStyle(g),m!==void 0&&(l.globalAlpha*=m),l.transform(...p.matrix),l.beginPath(),p.type==="path"){if(W.Path2D){const v=p.path2D||(p.path2D=new W.Path2D(p.d));_&&l.fill(v),x&&l.stroke(v)}}else Vh(l,p),_&&l.fill(),x&&l.stroke();l.restore()};l.translate(n-(c.x+c.w/2)*h,a-(c.y+c.h/2)*h),l.scale(h,h),d.forEach(f)})}var Yh=Object.defineProperty,jh=Object.defineProperties,Uh=Object.getOwnPropertyDescriptors,Yo=Object.getOwnPropertySymbols,Kh=Object.prototype.hasOwnProperty,Zh=Object.prototype.propertyIsEnumerable,Pi=(e,t,n)=>t in e?Yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jo=(e,t)=>{for(var n in t||(t={}))Kh.call(t,n)&&Pi(e,n,t[n]);if(Yo)for(var n of Yo(t))Zh.call(t,n)&&Pi(e,n,t[n]);return e},Uo=(e,t)=>jh(e,Uh(t)),En=(e,t,n)=>Pi(e,typeof t!="symbol"?t+"":t,n);const qh=[Zn,ue,ke,qt],Jh=1e3,Ko=new WeakMap;function Zo(e,t){if(!t||t==="none")return;const n=t.match(/^matrix\(([^)]+)\)$/),a=t.match(/^matrix3d\(([^)]+)\)$/);if(n){const i=n[1].split(",").map(s=>Number(s.trim()));i.length===6&&i.every(Number.isFinite)&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5])}else if(a){const i=a[1].split(",").map(s=>Number(s.trim()));i.length===16&&i.every(Number.isFinite)&&e.transform(i[0],i[1],i[4],i[5],i[12],i[13])}}function Qh(e,t,n){const a=e.naturalWidth||e.width,i=e.naturalHeight||e.height;if(!a||!i||!t||!n)return{x:0,y:0,w:t,h:n};const s=Math.min(t/a,n/i),o=a*s,r=i*s;return{x:(t-o)/2,y:(n-r)/2,w:o,h:r}}function tf(e){const{state:t}=e;return t.customType||t.hasTreemap?{x:0,y:0}:{x:Sn(t.margin.left),y:Sn(t.margin.top)}}function qo(e,t,n,a,i=!1){a.strokePath(s=>{ko(e,n,i,s)(t)},{lineDash:[]})}function Jo(e,t,n,a,i=!1){a.fillPath(s=>{Co(e,n,i,s)(t)})}function Qo(e,t){const n=we(e,t);return n.start===0&&n.end===t.values.length?t:Uo(jo({},t),{values:t.values.slice(n.start,n.end)})}function Ri(e,t){if(!(e!=null&&e.length)||!(t!=null&&t.id))return null;let n=Ko.get(e);if(!n){n=new Map;for(const a of e){if(!(a!=null&&a.id))continue;const i=`${a.id}:*`;n.has(i)||n.set(i,a),"index"in a&&n.set(`${a.id}:${a.index}`,a)}Ko.set(e,n)}return"index"in t?n.get(`${t.id}:${t.index}`)||null:n.get(`${t.id}:*`)||null}function ea(e,t){const n=e.config.color_onover;return!n||!t?null:Q(n)?t.id in n?n[t.id]:null:st(n)?n:G(n)?n.call(e.api,t):null}function ef(e,t,n){const a=Ri(n,t);return ea(e,a)||e.color(t.id)}function tr(e){var t;return(e==null?void 0:e.id)||((t=e==null?void 0:e.data)==null?void 0:t.id)}function er(e,t){var n;const a=tr(t);return!!a&&((n=e.state.focusedTargetIds)==null?void 0:n.has(a))}function fe(e,t){var n;const a=tr(t);return a&&((n=e.state.defocusedTargetIds)!=null&&n.has(a))?e.canvasTheme.style.shape.targetDefocusedOpacity:1}function nf(e,t,n,a=!1){var i;const s=(i=e.generateGetAreaPoints)==null?void 0:i.call(e,n,a);if(!s)return null;const o=we(e,t);let r=1/0,l=1/0,c=-1/0,u=-1/0;for(let d=o.start;d<o.end;d++){const h=t.values[d];Dt(e,h)&&s(h,d).forEach(([f,p])=>{At(f,p)&&(r=Math.min(r,f),l=Math.min(l,p),c=Math.max(c,f),u=Math.max(u,p))})}return Number.isFinite(r)&&Number.isFinite(l)?{x:r,y:l,w:c-r,h:u-l}:null}function Da(e,t,n){return t+n*(N(e)?e:0)}function nr(e,t,n,a,i,s){const o=e.config[`${a}_linearGradient`];if(!o||!i||!i.w||!i.h)return s;const r=e.config.axis_rotated,l=typeof o=="object"?o:{},c=l.x||(r?[1,0]:[0,0]),u=l.y||(r?[0,0]:[0,1]),d=Array.isArray(l.stops)?l.stops:[[0,s,1],[1,s,0]],h=t.createLinearGradient(Da(c[0],i.x,i.w),Da(u[0],i.y,i.h),Da(c[1],i.x,i.w),Da(u[1],i.y,i.h));return d.forEach(([f,p,g])=>{const _=G(p)?p.call(e.api,n.id):p,x=String(_||s),m=Number(f),v=Number.isFinite(m)?Math.max(0,Math.min(1,m)):0;h.addColorStop(v,Ea(x,g))}),h}function Re(e,t){return Ln(e,t,qh)}function Oa(e,t){const n=e.config.point_opacity;return Number.isFinite(n)?n:Ke(e,t)||Ze(e,t)?.5:1}function na(e,t,n){var a,i;const s=e.config.point_r;return Ze(e,t)||G(s)?(i=(a=e.pointR)==null?void 0:a.call(e,n))!=null?i:2.5:s}function af(e,t,n,a){return!a&&n==="circle"&&Ke(e,t)&&!G(e.config.point_r)&&t.values.length>Eo}function sf(e,t){const{bar_connectLine:n}=e.config,a=Q(n)?n[t]:n;return/^(start|end)-(start|end)$/.test(a)?a:null}function of(e,t,n){const{indexX:a,indexY:i,pos:s}=n;return e.config.axis_rotated?{x:t[0][a],y:t[0][i],width:t[0][a]-s,height:t[2][i]-t[0][i]}:{x:t[0][a],y:s,width:t[2][a]-t[0][a],height:t[3][i]-s}}function rf(e,t,n,a,i=1){if(a.length<2)return;const s=e.config.axis_rotated,o=/^start-(start|end)$/.test(n),r=/^end-(start|end)$/.test(n),l=/\w+-end$/.test(n),c=/\w+-start$/.test(n),u=f=>({x:s?r?f.x-f.width:f.x:f.x+f.width,y:s||o?f.y+f.height:f.y}),d=f=>({x:s?f.x-(l?f.width:0):f.x,y:s?f.y:f.y+(c?f.height:0)});let h=u(a[0]);t.strokePath(()=>{for(let f=1;f<a.length;f++){const p=d(a[f]);t.traceLine(h.x,h.y,p.x,p.y),f<a.length-1&&(h=u(a[f]))}},{alpha:i,stroke:e.canvasTheme.style.shape.barConnectLineColor,lineWidth:e.canvasTheme.style.shape.barConnectLineWidth,lineDash:[]})}function Ei(e,t){var n;const{config:a}=e;if(Ze(e,t))return"circle";const i=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],s=Array.isArray(a.point_pattern)&&a.point_pattern.length?a.point_pattern:[a.point_type],o=Math.max(0,i.indexOf(t.id)),r=s[o%s.length];return/^rect(angle)?$/i.test(r)||r==="rectangle"?"rectangle":r||"circle"}function lf(e,t,n,a,i,s,o){const r=e.config.point_radialGradient;if(!r||!s)return o;const l=Q(r)?r:{},c=N(l.cx)?l.cx:.3,u=N(l.cy)?l.cy:.3,d=N(l.r)?l.r:.7,h=Array.isArray(l.stops)?l.stops:[[.1,null,1],[.9,null,0]],f=a+(c-.5)*s*2,p=i+(u-.5)*s*2,g=t.createRadialGradient(f,p,0,f,p,Math.max(1,s*d*2));return h.forEach(([_,x,m])=>{let v=G(x)?x.bind(e.api)(n.id):x;v||(v=o);const b=Number(_),T=Number.isFinite(b)?Math.max(0,Math.min(1,b)):0;g.addColorStop(T,Ea(v,m))}),g}function ar(e,t,n){const a=e.config.candlestick_color_down;return(n!=null&&n._isUp?e.color(t):a&&typeof a=="object"?a[t.id]:a)||e.color(t)}function cf(e,t){return e.shouldDrawPointsForLine?e.shouldDrawPointsForLine(t):!0}function uf(e,t){return e.length===t.length&&e.every((n,a)=>n===t[a])}function df(e,t,n){const{config:a,scale:i}=e,s=i.zoom||i.x,o=e.getYScaleById(t.id),r=a.line_connectNull?e.filterRemoveNull(t.values):t.values;let l=e.isAreaRangeType(t)?r.map(p=>Uo(jo({},p),{value:e.getRangedData(p,"mid")})):r;e.isStepType(t)&&(l=e.convertValuesToStep(l));const c=rh(e,l,s,o,a.data_regions[t.id]);let u=null,d=[];const h=()=>{if(d.length<2||!u){d=[];return}n.strokePath(p=>{const[g,..._]=d;p.moveTo(g[0],g[1]),_.forEach(x=>{p.lineTo(x[0],x[1])})},{lineDash:u}),d=[]},f=(p,g,_)=>{!u||!uf(u,_)?(h(),u=_,d=[p,g]):d.push(g)};for(const{start:p,end:g,dash:_,isBreak:x}of c){if(x||!p||!g||!_){h(),u=null;continue}if(!At(p[0],p[1])||!At(g[0],g[1])){h(),u=null;continue}f(p,g,_)}h()}class hf{constructor(t,n){En(this,"engine",t),En(this,"theme",n),En(this,"painter"),En(this,"labelImageCache",new Map),En(this,"backgroundImageCache",new Map),En(this,"backgroundClassStyleCache",new Map),this.painter=new $o(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}destroy(){const t=n=>{n.image.onload=null,n.image.onerror=null};this.labelImageCache.forEach(t),this.backgroundImageCache.forEach(t),this.labelImageCache.clear(),this.backgroundImageCache.clear(),this.backgroundClassStyleCache.clear()}getLabelImage(t,n){if(!t||!W.Image)return null;let a=this.labelImageCache.get(t);if(!a){const i={image:new W.Image,loaded:!1,loading:!0};a=i,this.labelImageCache.set(t,a),i.image.onload=()=>{var s;i.loaded=!0,i.loading=!1,(s=n.redraw)==null||s.call(n)},i.image.onerror=()=>{i.loaded=!1,i.loading=!1},i.image.src=t}return a}getBackgroundImage(t,n){if(!t||!W.Image)return null;let a=this.backgroundImageCache.get(t);if(!a){const i={image:new W.Image,loaded:!1,loading:!0};a=i,this.backgroundImageCache.set(t,a),i.image.onload=()=>{var s;i.loaded=!0,i.loading=!1,(s=n.renderCanvasFrame)==null||s.call(n,void 0,null,!1)},i.image.onerror=()=>{i.loaded=!1,i.loading=!1},i.image.src=t}return a}getBackgroundClassStyle(t,n){if(!n||!W.document)return{};const a=this.backgroundClassStyleCache.get(n);if(a)return a;const i=W.document.createElement("div");i.className=n,i.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:1px;height:1px;",t.$el.chart.node().appendChild(i);const s=W.getComputedStyle(i),o=parseFloat(s.opacity),r={opacity:Number.isFinite(o)?o:void 0,transform:s.transform||void 0};return i.remove(),this.backgroundClassStyleCache.set(n,r),r}drawBackground(t){const n=t.config.background;if(!(n!=null&&n.imgUrl)&&!(n!=null&&n.color))return;const{ctx:a,painter:i}=this,{current:s,margin:o,width:r,height:l}=t.state,c=this.getBackgroundClassStyle(t,n.class);i.withState(()=>{if(c.opacity!==void 0&&(a.globalAlpha*=c.opacity),n.imgUrl){const u=this.getBackgroundImage(n.imgUrl,t);if(u!=null&&u.loaded){const d=tf(t),h=Qh(u.image,s.width,s.height);a.translate(d.x,d.y),Zo(a,c.transform),a.drawImage(u.image,h.x,h.y,h.w,h.h)}}else n.color&&(Zo(a,c.transform),i.fillRect({x:o.left,y:o.top,w:r,h:l},{fill:n.color}))})}drawLabelImage(t,n,a,i,s){const o=Th(t,n);if(!(o!=null&&o.url))return{x:i,y:s};const r=wh(o,n),l=kh(t,o,a,i,s,n),c=this.getLabelImage(r,t);return c!=null&&c.loaded&&this.ctx.drawImage(c.image,l.x,l.y,o.width,o.height),{x:l.textX,y:l.textY}}drawDataLabel(t,n,a,i,s){const{painter:o,theme:{style:r}}=this;if({x:i,y:s}=this.drawLabelImage(t,n,a,i,s),t.config.data_labels.rotate){const l=Ph(t,n,i,s);i=l.x,s=l.y,this.ctx.textAlign=l.textAlign}this.ctx.fillStyle=Io(t,n,r.label.color),Bo(t,o,n,a,i,s),o.textLines(a,i,s,{angle:t.config.data_labels.rotate})}drawFocusLabels(t,n){var a;if(!((a=t.hasDataLabel)!=null&&a.call(t)))return;const{ctx:i,theme:{style:s}}=this,o=n.filter(l=>l&&Dt(t,l)&&ke(t,l)&&Re(t,{id:l.id})),r={size:()=>o.length};o.length&&(i.font=s.label.font,o.forEach(l=>{const c=ki(t,l);let{x:u,y:d}=Kn(t,l);c&&({x:u,y:d}=zo(t,i,l,u,d),u+=Rn(t,l,"x",r),d+=Rn(t,l,"y",r),At(u,d)&&this.drawDataLabel(t,l,c,u,d))}))}draw(t,n,a){var i,s,o,r,l;const c=(i=t.getCanvasTypeParts)==null?void 0:i.call(t).find(g=>g.exclusive);if(c){(s=c.draw)==null||s.call(t,this,n,a);return}if(t.state.customType){(l=(r=(o=t.getCustomTypeParts())==null?void 0:o.canvas)==null?void 0:r.draw)==null||l.call(t,this);return}const{margin:u,width:d,height:h}=t.state,f=()=>{t.config.area_front||this.drawAreas(t,n,a),this.drawLines(t,n),t.config.area_front&&this.drawAreas(t,n,a),this.drawCircles(t,n,a)},p=()=>{var g,_,x;t.config.bar_front||this.drawBars(t,n,a),this.drawCandlesticks(t,n,a),(g=t.getAxisTypeParts)==null||g.call(t).forEach(m=>{var v,b;return(b=(v=m.canvas)==null?void 0:v.draw)==null?void 0:b.call(t,this,n)}),f(),t.config.bar_front&&this.drawBars(t,n,a),(x=(_=t.getCanvasFeature)==null?void 0:_.call(t,"selection"))==null||x.draw.call(t,this,n),this.drawLabels(t,n)};t.config.clipPath===!1?p():this.painter.clipRect({x:u.left,y:u.top,w:d,h},p)}drawBars(t,n,a){const{ctx:i,painter:s,theme:{style:o}}=this,r=ue.bind(null,t),l=Ci(t,a,ue),c=t.filterTargetsToShow().filter(r).filter(Re.bind(null,t)),u=t.generateGetBarPoints(Gt(t,n,X.BAR,r),!1),{margin:d}=t.state,h=ka(t),f=h?_i(t):new Set;u&&s.withTranslation(d.left,d.top,()=>{var p;for(const g of c){const _=we(t,g),x=sf(t,g.id),m=fe(t,g),v=[],b=[];for(let T=_.start;T<_.end;T++){const k=g.values[T];if(!Dt(t,k))continue;const w=qn(t,u,k,T);if(!w)continue;const{points:y,rect:C}=w,A=xi(t,k,y,h,f,(p=t.isStackingRadiusData)==null?void 0:p.bind(t));b.push({d:k,points:y,rect:C,radiusInfo:A}),x&&v.push(of(t,y,A))}x&&o.shape.barConnectLineWidth>0&&rf(t,s,x,v,m);for(const{d:T,rect:k,radiusInfo:w}of b){const y=ea(t,Ri(a,T)),C=y||t.color(g.id),S=(l(T)?o.shape.barExpandedOpacity:o.shape.barOpacity)*m;i.fillStyle=y?C:nr(t,i,g,"bar",k,C),h?s.fillRoundRect(k,w.corners,{alpha:S}):s.fillRect(k,{alpha:S}),o.shape.barLineWidth>0&&(i.strokeStyle=o.shape.barStrokeColor,i.lineWidth=o.shape.barLineWidth,h?s.strokeRoundRect(k,w.corners,{alpha:o.shape.barOpacity*m}):s.strokeRect(k,{alpha:o.shape.barOpacity*m}))}}})}drawCandlesticks(t,n,a){var i;const{ctx:s,painter:o,theme:{style:r}}=this,l=qt.bind(null,t),c=Ci(t,a,qt),u=t.filterTargetsToShow().filter(l).filter(Re.bind(null,t)),d=(i=t.generateGetCandlestickPoints)==null?void 0:i.call(t,Gt(t,n,X.CANDLESTICK,l),!1),{margin:h}=t.state;d&&o.withTranslation(h.left,h.top,()=>{var f;s.lineWidth=r.shape.candlestickLineWidth;for(const p of u){const g=we(t,p),_=fe(t,p),x=r.shape.candlestickLineWidth,m=r.shape.candlestickStrokeColor||"#000";for(let v=g.start;v<g.end;v++){const b=p.values[v],T=(f=t.getCandlestickData)==null?void 0:f.call(t,b);if(!T)continue;const k=Jn(t,d,b,v);if(!k)continue;const{body:w,wickStart:y,wickEnd:C}=k;s.fillStyle=ea(t,Ri(a,b))||ar(t,b,T),s.strokeStyle=m,s.globalAlpha=_,x>0&&o.strokePath(()=>{o.traceLine(y[0],y[1],C[0],C[1])}),o.fillRect(w,{alpha:(c(b)?r.shape.candlestickExpandedOpacity:1)*_}),x>0&&o.strokeRect(w,{alpha:_,lineWidth:x,stroke:m})}}s.globalAlpha=1})}hasExpandedShapeFocus(t,n){const a=ue.bind(null,t);let i;return!!(n!=null&&n.some(s=>{if(!s)return!1;if(qt(t,s))return!0;if(!a(s))return!1;i=i||t.generateGetBarPoints(Gt(t,t.state.canvasShape||{indices:{}},X.BAR,a),!1);const o=i==null?void 0:i(s,s.index);if(!o)return!0;const r=wa(t,o,0);return(t.config.axis_rotated?r.h:r.w)>=1}))}drawLines(t,n){const{ctx:a,painter:i,theme:{style:s}}=this,o=Pn.bind(null,t),r=t.filterTargetsToShow().filter(o).filter(Re.bind(null,t)),l=Gt(t,n,X.LINE,o),{margin:c}=t.state;t.generateGetLinePoints&&i.withTranslation(c.left,c.top,()=>{var u;for(const d of r){const h=Qo(t,d);h.values.some(Dt.bind(null,t))&&(a.globalAlpha=fe(t,d),a.lineWidth=er(t,d)?s.shape.lineFocusedWidth:s.shape.lineWidth,a.strokeStyle=t.color(d.id),(u=t.config.data_regions)!=null&&u[h.id]?df(t,h,i):qo(t,h,l,i))}a.globalAlpha=1})}drawAreas(t,n,a){const{ctx:i,painter:s,theme:{style:o}}=this,r=Zn.bind(null,t),l=t.filterTargetsToShow().filter(r).filter(Re.bind(null,t)),c=Gt(t,n,X.AREA,r),{margin:u}=t.state;t.generateGetAreaPoints&&s.withTranslation(u.left,u.top,()=>{for(const d of l){const h=Qo(t,d);if(!h.values.some(Dt.bind(null,t)))continue;const f=ef(t,h,a);i.globalAlpha=o.shape.areaOpacity*fe(t,d),i.fillStyle=nr(t,i,h,"area",t.config.area_linearGradient?nf(t,d,c):null,f),Jo(t,h,c,s)}i.globalAlpha=1})}drawCircles(t,n,a){var i;if(!t.config.point_show||(i=t.isPointFocusOnly)!=null&&i.call(t))return;const{ctx:s,painter:o,theme:{style:r}}=this,{cx:l,cy:c}=n.pos,{margin:u}=t.state,d=Ci(t,a,ke),h=!!(a!=null&&a.some(f=>f&&ke(t,f)));!l||!c||o.withTranslation(u.left,u.top,()=>{var f,p,g;for(const _ of t.filterTargetsToShow()){if(!ke(t,_)||!Re(t,_)||Pn(t,_)&&!cf(t,_))continue;const x=t.color(_.id),m=Ei(t,_),v=fe(t,_),b=!!t.config.point_radialGradient,T=af(t,_,m,b),k=we(t,_),w=k.end-k.start,y=T?Do(t.state.width,t.state.height,na(t,_,_.values[k.start]||_.values[0])):null,C=Oa(t,_)*v;s.fillStyle=x,s.globalAlpha=C;const A=r.shape.pointFillColor||x,S=r.shape.pointStrokeColor||x,L=S?(f=r.shape.pointLineWidth)!=null?f:1:0,P=!!S&&L>0,D=P&&m==="circle"&&N(C)&&C<1&&A===S;if(!h&&!b&&m==="circle")if(s.fillStyle=A,P&&!D&&(s.strokeStyle=S,s.lineWidth=L),w>Jh)for(let R=k.start;R<k.end;R++){const E=_.values[R];if(!Dt(t,E))continue;const M=na(t,_,E),O=D?M+L/2:M,$=l(E,R),I=c(E,R);At($,I)&&(y&&!Oo(y,$,I)||(s.beginPath(),s.arc($,I,O,0,Math.PI*2),s.fill(),P&&!D&&s.stroke()))}else{s.beginPath();for(let R=k.start;R<k.end;R++){const E=_.values[R];if(!Dt(t,E))continue;const M=na(t,_,E),O=D?M+L/2:M,$=l(E,R),I=c(E,R);At($,I)&&o.traceCircle($,I,O)}s.fill(),P&&!D&&s.stroke()}else for(let R=k.start;R<k.end;R++){const E=_.values[R];if(!Dt(t,E))continue;const M=d(E),O=na(t,_,E),$=M?(g=(p=t.pointExpandedR)==null?void 0:p.call(t,E))!=null?g:O*1.75:O,I=l(E,R),F=c(E,R),V=ea(t,E),Y=V||x,j=r.shape.pointFillColor||Y,dt=r.shape.pointStrokeColor||Y,it=M&&(V||r.focusPoint.fill)||j,ft=M?V||r.focusPoint.stroke||Y:dt,wt=M?r.focusPoint.lineWidth:L,_t=Oa(t,E)*v,jt=!!ft&&(wt!=null?wt:0)>0,It=m==="circle"&&jt&&N(_t)&&_t<1&&it===ft,Et=It?$+(wt||0)/2:$;At(I,F)&&(s.fillStyle=b?lf(t,s,E,I,F,$,Y):it,s.globalAlpha=_t,ta(o,m,I,F,Et,jt&&!It?{fill:s.fillStyle,stroke:ft,lineWidth:wt}:void 0,O))}}})}drawLabels(t,n){var a;if(!((a=t.hasDataLabel)!=null&&a.call(t)))return;const{ctx:i,painter:s,theme:{style:o}}=this,{margin:r}=t.state,{cx:l,cy:c}=n.pos,u=n.indices[X.BAR]?t.generateGetBarPoints(n.indices[X.BAR],!1):null,d=t.generateGetCandlestickPoints?t.generateGetCandlestickPoints(Gt(t,n,X.CANDLESTICK,qt.bind(null,t)),!1):null,h=t.filterTargetsToShow().filter(_=>(ue(t,_)||ke(t,_)||Zn(t,_)||qt(t,_))&&Re(t,_)),f=[];let p=0;h.forEach(_=>{const x=we(t,_),m=t.labelishData(_),v=[];for(let b=0;b<m.length;b++){const T=m[b],k=ki(t,T);k&&T.index>=x.start&&T.index<x.end&&Dt(t,T)&&v.push({d:T,text:k})}p+=v.length,v.length&&f.push(v)});const g={size:()=>p};s.withTranslation(r.left,r.top,()=>{i.font=o.label.font,i.textAlign="center",f.forEach(_=>{var x,m;for(const{d:v,text:b}of _){let T,k;if(ue(t,v)&&u){const w=qn(t,u,v,v.index);if(!w)continue;const{points:y,rect:C}=w,A=t.getBaseValue(v),S=ee(t,y[2]),L=A<0,P=Si(i,b,0,0).h;T=t.config.axis_rotated&&!t.config.data_labels.centered?S[0]+(L?-4:4):C.x+C.w/2,k=t.config.data_labels.centered||t.config.axis_rotated?C.y+C.h/2:S[1]+(L?P-3:-3),i.textAlign=t.config.axis_rotated&&!t.config.data_labels.centered?L?"right":"left":"center",i.textBaseline=t.config.data_labels.centered||t.config.axis_rotated?"middle":"alphabetic"}else if(qt(t,v)&&d){const w=(x=t.getCandlestickData)==null?void 0:x.call(t,v),y=Jn(t,d,v,v.index),C=w==null?void 0:w._isUp;if(!y)continue;const{wickEnd:A,wickStart:S}=y,L=t.config[`axis_${(m=t.axis)==null?void 0:m.getId(v.id)}_inverted`];T=t.config.axis_rotated?C?A[0]+4:S[0]-4:S[0],k=t.config.axis_rotated?S[1]+3:C?A[1]-3:S[1]+12,!t.config.axis_rotated&&L&&(k+=15*(C?1:-1)),i.textAlign=t.config.axis_rotated?C?"left":"right":"center",i.textBaseline="alphabetic"}else l&&c&&({x:T,y:k}=kd(n.pos,v,v.index),{x:T,y:k}=zo(t,i,v,T,k));T+=Rn(t,v,"x",g),k+=Rn(t,v,"y",g),At(T,k)&&this.drawDataLabel(t,v,b,T,k)}})})}drawEmptyLabel(t){const n=t.config.data_empty_label_text,a=t.filterTargetsToShow();if(!n||a.length)return;const{margin:i,width:s,height:o}=t.state,{style:r}=this.theme;this.painter.text(String(n),i.left+s/2,i.top+o/2,{fill:r.emptyLabel.color,font:r.emptyLabel.font,textAlign:"center",textBaseline:"middle"})}drawZoomBrush(t,n,a){const{axis_rotated:i}=t.config,{height:s,margin:o,width:r}=t.state,l=Math.min(n,a),c=Math.abs(a-n),u=i?{x:o.left,y:o.top+l,w:r,h:c}:{x:o.left+l,y:o.top,w:c,h:s};c<=0||this.painter.fillRect(u,{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawFocus(t,n){var a,i;if(!(n!=null&&n.length)||t.state.customType)return;const{painter:s}=this,{style:o}=this.theme,{margin:r}=t.state,l=n.find(c=>c&&Dt(t,c));t.config.subchart_grid_focus!==!1&&!gi(t)&&((i=(a=t.getCanvasFeature)==null?void 0:a.call(t,"subchart"))==null||i.drawFocus.call(t,this,n)),s.withTranslation(r.left,r.top,()=>{if(t.config.tooltip_show&&t.config.grid_focus_show!==!1&&!t.config.axis_tooltip&&l){const{x:c,y:u}=Kn(t,l),d=o.axis.lineWidth,h=t.config.axis_rotated,f=Number.isFinite(h?u:c),p=Number.isFinite(h?c:u),g=T=>s.crisp(r.left+T,d)-r.left,_=T=>s.crisp(r.top+T,d)-r.top,x=t.config.grid_focus_edge&&!t.config.tooltip_grouped,m=gi(t),v=m?t.state.margin2.left-r.left+t.state.width2:t.state.width,b=m?t.state.margin2.top-r.top+t.state.height2:t.state.height;f&&s.strokePath(()=>{var T,k;if(h){if(s.traceLine(g(0),u,x&&p?c:g(v),u),p&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const w=((T=t.axis)==null?void 0:T.getId(l.id))==="y2";s.traceLine(c,x&&!w?u:_(0),c,x&&w?u:_(t.state.height))}}else if(s.traceLine(c,x&&p?u:_(0),c,_(b)),p&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const w=((k=t.axis)==null?void 0:k.getId(l.id))==="y2";s.traceLine(x&&w?c:g(0),u,x&&!w?c:g(t.state.width),u)}},{lineDash:o.focusGrid.dashArray,lineWidth:o.focusGrid.lineWidth,stroke:o.focusGrid.lineColor})}t.config.point_show&&!t.state.canvasFocusMainRedraw&&n.filter(c=>c&&Dt(t,c)&&ke(t,c)&&Re(t,{id:c.id})).forEach(c=>{var u,d,h,f;const p=Ei(t,{id:c.id}),{x:g,y:_}=Kn(t,c),x=(d=(u=t.pointR)==null?void 0:u.call(t,c))!=null?d:2.5,m=(f=(h=t.pointExpandedR)==null?void 0:h.call(t,c))!=null?f:x*1.75,v=ea(t,c),b=v||t.color(c.id),T=v||o.focusPoint.fill||o.shape.pointFillColor||b,k=v||o.focusPoint.stroke||b,w=o.focusPoint.lineWidth,y=Oa(t,c),C=!!k&&(w!=null?w:0)>0,A=p==="circle"&&C&&N(y)&&y<1&&T===k;At(g,_)&&ta(s,p,g,_,A?m+(w||0)/2:m,C&&!A?{fill:T,lineWidth:w,stroke:k,alpha:y}:{fill:T,alpha:y},x)}),this.drawFocusLabels(t,n)})}}const ff={section:"boxplot",probe({probeIn:e,toColor:t,toNumber:n}){const a=e("bb-chart-boxplot","path","bb-boxplot-box",["stroke","stroke-width","fill-opacity"]),i=e("bb-chart-boxplot","path","bb-boxplot-whisker",["stroke-width"]),s=e("bb-chart-boxplot","path","bb-boxplot-median",["stroke-width"]),o=e("bb-chart-boxplot","path","bb-boxplot-outlier",["stroke-width"]),r=e("bb-chart-boxplot","path","bb-boxplot-mean",["fill"]);return{stroke:t(a.stroke,"#000"),boxLineWidth:n(a["stroke-width"],1),boxOpacity:n(a["fill-opacity"],.7),whiskerLineWidth:n(i["stroke-width"],1),medianLineWidth:n(s["stroke-width"],2),outlierLineWidth:n(o["stroke-width"],1),meanFill:t(r.fill,"#fff")}},selectors:{".bb-boxplot-box":(e,{readColorValue:t,readNumberValue:n})=>({stroke:t(e,"stroke"),boxLineWidth:n(e,"stroke-width"),boxOpacity:n(e,"fill-opacity")}),".bb-boxplot-whisker":(e,{readNumberValue:t})=>({whiskerLineWidth:t(e,"stroke-width")}),".bb-boxplot-median":(e,{readNumberValue:t})=>({medianLineWidth:t(e,"stroke-width")}),".bb-boxplot-outlier":(e,{readNumberValue:t})=>({outlierLineWidth:t(e,"stroke-width")}),".bb-boxplot-mean":(e,{readColorValue:t})=>({meanFill:t(e,"fill")})}};function ir(e,t,n,a){const i=t(n,a);if(!i)return null;const[[s,o],[r,l],[c,u,d],[h],f,p]=i,g=(m,v)=>ee(e,[m,v]),_=(r-s)*e.config.boxplot_whisker_width/2,x=e.config.boxplot_mean_r;return{box:wa(e,[[s,o],[r,l]]),median:[g(s,h),g(r,h)],whisker:[[g(c,d),g(c,l)],[g(c,o),g(c,u)],..._>0?[[g(c-_,d),g(c+_,d)],[g(c-_,u),g(c+_,u)]]:[]],outliers:f.map(m=>g(c,m)),mean:p.map(m=>[g(c-x,m),g(c,m-x),g(c+x,m),g(c,m+x)])}}var gf={theme:ff,draw(e,t){const n=this,{ctx:a,painter:i,theme:{style:{boxplot:s}}}=e,{margin:o}=n.state,r=n.config.boxplot_outlier_r,l=n.isBoxplotType.bind(n),c=n.generateGetBoxplotPoints(Gt(n,t,"boxplot",l),!1);i.withTranslation(o.left,o.top,()=>{n.filterTargetsToShow().filter(l).filter(u=>Re(n,u)).forEach(u=>{const d=we(n,u),h=fe(n,u);for(let f=d.start;f<d.end;f++){const p=u.values[f],g=ir(n,c,p,f);if(!g)continue;const _=s.stroke;a.strokeStyle=_,a.globalAlpha=h,s.whiskerLineWidth>0&&i.strokePath(()=>{g.whisker.forEach(([v,b])=>i.traceLine(v[0],v[1],b[0],b[1]))},{lineWidth:s.whiskerLineWidth,stroke:_,alpha:h}),i.fillRect(g.box,{fill:n.color(p),alpha:s.boxOpacity*h}),s.boxLineWidth>0&&i.strokeRect(g.box,{stroke:_,lineWidth:s.boxLineWidth,alpha:h});const[x,m]=g.median;i.strokePath(()=>i.traceLine(x[0],x[1],m[0],m[1]),{lineWidth:s.medianLineWidth,stroke:_,alpha:h}),g.outliers.length&&i.strokePath(()=>{g.outliers.forEach(([v,b])=>{a.moveTo(v+r,b),a.arc(v,b,r,0,Math.PI*2)})},{lineWidth:s.outlierLineWidth,stroke:_,alpha:h}),g.mean.forEach(([v,b,T,k])=>{a.beginPath(),a.moveTo(v[0],v[1]),[b,T,k].forEach(w=>a.lineTo(w[0],w[1])),a.closePath(),a.globalAlpha=h,a.fillStyle=s.meanFill,a.fill(),a.strokeStyle=_,a.lineWidth=s.boxLineWidth,a.stroke()})}a.globalAlpha=1})})},hits(e,{shape:t,targets:n,margin:a,addIndex:i}){const s=this,o=s.isBoxplotType.bind(s),r=s.generateGetBoxplotPoints(Gt(s,t,"boxplot",o),!1);n.filter(o).forEach(l=>{const c=we(s,l);for(let u=c.start;u<c.end;u++){const d=l.values[u],h=ir(s,r,d,u);if(!h)continue;const{x:f,y:p,w:g,h:_}=h.box;e.addBar({x:a.left+f,y:a.top+p,w:g,h:_,data:d}),i(a.left+f+g/2,a.top+p+_/2,d)}})}};function pf(e,t,n){const{scale:a,ticks:i,format:s,rotated:o,x:r,y:l}=t,[c,u]=a.range(),d=6,h={fill:n.axisColor,font:n.axisFont,textAlign:o?"right":"center",textBaseline:o?"middle":"top"};e.withTranslation(r,l,()=>{e.strokePath(()=>{o?e.traceLine(0,c,0,u):e.traceLine(c,0,u,0),i.forEach(f=>{const p=a(f);o?e.traceLine(0,p,-d,p):e.traceLine(p,0,p,d)})},{stroke:n.axisColor,lineWidth:1}),i.forEach(f=>{const p=a(f);o?e.text(s(f),-(d+3),p,h):e.text(s(f),p,d+3,h)})})}var _f={theme:{section:"bullet",probe({probeIn:e,probeInNested:t,axisFont:n,toColor:a,toNumber:i}){const s=e("bb-chart-bullets","line","bb-bullet-target",["stroke","stroke-width"]),o=e("bb-chart-bullets","text","bb-bullet-title",["fill","font"]),r=e("bb-chart-bullets","rect","bb-bullet-range",["--bb-bullet-range-min","--bb-bullet-range-max"]),l=t("bb-chart-bullets","bb-bullet-axis","text","",["fill","font"]);return{targetStroke:a(s.stroke,"#000"),targetLineWidth:i(s["stroke-width"],2),rangeMin:i(r["--bb-bullet-range-min"],55),rangeMax:i(r["--bb-bullet-range-max"],90),axisFont:l.font||n,axisColor:a(l.fill,"#000"),titleFont:o.font||l.font||n,titleColor:a(o.fill,"#000")}},selectors:{".bb-chart-bullets .bb-bullet-target":(e,{readColorValue:t,readNumberValue:n})=>({targetStroke:t(e,"stroke"),targetLineWidth:n(e,"stroke-width")}),".bb-bullet-target":(e,{readColorValue:t,readNumberValue:n})=>({targetStroke:t(e,"stroke"),targetLineWidth:n(e,"stroke-width")}),".bb-chart-bullets .bb-bullet-axis text":(e,{readColorValue:t,readFontValue:n})=>({axisColor:t(e,"fill"),axisFont:n(e)}),".bb-bullet-axis text":(e,{readColorValue:t,readFontValue:n})=>({axisColor:t(e,"fill"),axisFont:n(e)}),".bb-chart-bullets .bb-bullet-title":(e,{readColorValue:t,readFontValue:n})=>({titleColor:t(e,"fill"),titleFont:n(e)}),".bb-bullet-title":(e,{readColorValue:t,readFontValue:n})=>({titleColor:t(e,"fill"),titleFont:n(e)})},normalize(e,{toNumber:t}){e.targetLineWidth=t(e.targetLineWidth,2)}},draw(e){const t=this,{ctx:n,painter:a,theme:{style:i}}=e,{bullet:s}=i,{config:o}=t,r=t.getBulletLayout(),l=t.hasDataLabel()&&o.bullet_label_show?new Map(t.data.targets.filter(t.isBulletType,t).map(u=>[u.id,u.values[u.values.length-1]])):null,c={size:()=>r.rows.length};for(const u of r.rows){if(!t.isTargetToShow(u.id))continue;const{area:d,offset:h,ranges:f,isDot:p,measure:g,color:_,targets:x,axis:m,label:v,title:b}=t.getBulletRowGeometry(u,r);a.withState(()=>{n.globalAlpha=fe(t,u),n.translate(d.left+h.x,d.top+h.y),f.forEach(({x:w,y,width:C,height:A,fill:S,t:L})=>{a.fillRect({x:w,y,w:C,h:A},{fill:S!=null?S:`hsl(0, 0%, ${s.rangeMin+L*(s.rangeMax-s.rangeMin)}%)`})}),p?a.fillPath(()=>a.traceCircle(g.cx,g.cy,g.r),{fill:_}):a.fillRect({x:g.x,y:g.y,w:g.width,h:g.height},{fill:_}),x.forEach(w=>{a.strokePath(()=>a.traceLine(w.x1,w.y1,w.x2,w.y2),{stroke:s.targetStroke,lineWidth:s.targetLineWidth})}),m&&pf(a,m,s),b&&a.text(b.text,b.x,b.y,{fill:s.titleColor,font:s.titleFont,textAlign:b.anchor==="end"?"right":"center",textBaseline:b.anchor==="end"?"middle":"alphabetic"});const T=l==null?void 0:l.get(u.id),k=T&&(N(T.value)||T.value)?ki(t,T):null;if(k){const w=o.data_labels.centered,y=w?v.center:v,C=o.bullet_rotated;n.font=i.label.font,n.textAlign=w||C?"center":"left",n.textBaseline=w||!C?"middle":"alphabetic",e.drawDataLabel(t,T,k,y.x+Rn(t,T,"x",c),y.y+Rn(t,T,"y",c))}})}},hits(e){const t=this,n=t.getBulletLayout(),a=4;n.rows.forEach(i=>{if(!t.isTargetToShow(i.id))return;const{area:s,offset:o,isDot:r,measure:l,targets:c}=t.getBulletRowGeometry(i,n),u=s.left+o.x,d=s.top+o.y,h=r?{x:l.cx-l.r,y:l.cy-l.r,w:l.r*2,h:l.r*2}:{x:l.x,y:l.y,w:l.width,h:l.height};e.addBar({x:u+h.x,y:d+h.y,w:h.w,h:h.h,data:i}),c.forEach(f=>{e.addBar({x:u+Math.min(f.x1,f.x2)-a,y:d+Math.min(f.y1,f.y2)-a,w:Math.abs(f.x2-f.x1)+a*2,h:Math.abs(f.y2-f.y1)+a*2,data:i})})})}};const xf=1e5;function mf(){var e,t,n;return(n=(t=(e=W.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function sr(e,t=!1){return Array.isArray(e)&&e.length>=2&&e.every(n=>Number.isFinite(+n)&&(!t||+n>0))}function vf(e,t,n,a=!1){return e.slice(0,2).map((i,s)=>{const o=a?Math.exp(Math.log(+i)+(Math.log(+t[s])-Math.log(+i))*n):+i+(+t[s]-+i)*n;return i instanceof Date||t[s]instanceof Date?new Date(o):o})}function bf(e){return e.data.targets.reduce((t,n)=>t+n.values.length,0)}function yf(e){const{scale:t}=e,n=e.filterTargetsToShow(e.data.targets);["y","y2"].forEach(a=>{var i;(i=t[a])==null||i.domain(e.getYDomain(n,a))}),e.withSubchartTypeContext(()=>{var a,i;(a=t.subY)==null||a.domain(e.getYDomain(n,"y")),(i=t.subY2)==null||i.domain(e.getYDomain(n,"y2"))})}var Tf={updateCanvasFlowFocus(){var e;const t=this,{state:n}=t;n.canvasFocusKey=null,((e=t.$el.tooltip)==null?void 0:e.style("display"))==="block"&&n.event&&t.onCanvasMouseMove(n.event)},flushCanvasFlow(){var e,t;const{state:n}=this;n.canvasFlowFinish&&(n.canvasFlowFrame!==null&&((t=(e=W).cancelAnimationFrame)==null||t.call(e,n.canvasFlowFrame)),n.canvasFlowFrame=null,n.canvasFlowFinish())},animateCanvasFlow(e){var t,n,a,i,s,o,r,l,c,u;const d=this,{axis:h,data:f,org:p,scale:g,state:_}=d,{done:x=()=>{},duration:m,length:v,orgDataCount:b}=e,T=(t=W.requestAnimationFrame)==null?void 0:t.bind(W),k=!!((n=h.isLog)!=null&&n.call(h,"x"));if(!T||!m||!v||!b||bf(d)>xf)return!1;const w=g.x.domain().slice(0,2),y=(i=(a=p.xDomain)==null?void 0:a.slice)==null?void 0:i.call(a),C=(l=(o=(s=g.subX)==null?void 0:s.domain)==null?void 0:(r=o.call(s)).slice)==null?void 0:l.call(r),A=_.canvasFocusKey?_.canvasFocusData:null;if(!sr(w,k))return!1;const S=f.targets.map(O=>O.values.splice(0,v));d.updateXDomain(d.filterTargetsToShow(f.targets),!0,!0);const L=g.x.domain().slice(0,2),P=(u=(c=p.xDomain)==null?void 0:c.slice)==null?void 0:u.call(c);if(f.targets.forEach((O,$)=>{O.values.unshift(...S[$])}),!sr(L,k))return y&&(p.xDomain=y),g.x.domain(w),C&&g.subX.domain(C),h.x.scale(g.x),!1;yf(d);let D=!1;const R=mf(),E=()=>{var O,$;D||(D=!0,f.targets.forEach(I=>{I.values.splice(0,v)}),P&&(p.xDomain=P),g.x.domain(L),($=(O=g.subX)==null?void 0:O.domain)==null||$.call(O,P!=null?P:L),h.x.scale(g.x),_.dirty.data=!0,_._eventRectFingerprint=null,_.canvasShape=null,_._cachedDrawShape=null,d.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),d.updateTypesElements(),_.canvasFlowFrame=null,_.canvasFlowFinish=null,_.flowing=!1,d.updateCanvasFlowFocus(),x.call(d.api))},M=O=>{const $=Math.min(1,Math.max(0,(O-R)/m)),I=vf(w,L,$,k);g.x.domain(I),h.x.scale(g.x),_.canvasShape=null,_._cachedDrawShape=null,_._canvasVisibleRangeCache=null,_._canvasXTickValuesCache=null,d.renderCanvasFrame(void 0,A,!1),$<1?_.canvasFlowFrame=T(M):E()};return y&&(p.xDomain=y),g.x.domain(w),C&&g.subX.domain(C),h.x.scale(g.x),_.flowing=!0,_.cancelClick=!0,_.canvasFlowFinish=E,_.canvasFlowFrame=T(M),!0}},ze=kt(3);function Je(e="linear",t,n){const a={linear:ze.scaleLinear,log:ze.scaleSymlog,_log:ze.scaleLog,time:ze.scaleTime,utc:ze.scaleUtc}[e]();return a.type=e,/_?log/.test(e)&&a.clamp(!0),a.range([t!=null?t:0,n!=null?n:1])}var wf={getXScale(e,t,n,a){const i=this,s=i.state.loading!=="append"&&i.scale.zoom||Je(i.axis.getAxisType("x"),e,t);return i.getCustomizedXScale(n?s.domain(n):s,a)},getYScale(e,t,n,a,i){const o=this.axis.getAxisType(e);if(i&&i.type===o)return i.range([t,n]),a&&i.domain(a),i;const r=Je(o,t,n);return a&&r.domain(a),r},getYScaleById(e,t=!1){var n;const a=((n=this.axis)==null?void 0:n.getId(e))==="y2",i=t?a?"subY2":"subY":a?"y2":"y";return this.scale[i]},getCustomizedXScale(e,t){const n=this,a=()=>(t?t():n.axis.x.tickOffset())||(n.axis.isCategorized()?(e(1)-e(0))/2:0),i=n.config.axis_x_inverted,s=function(o){return e(o)+a()};for(const o in e)s[o]=e[o];return s.orgDomain=()=>e.domain(),s.orgScale=()=>e,n.axis.isCategorized()&&(s.domain=function(o){let r=o;return arguments.length?(e.domain(r),s):(r=this.orgDomain(),i?[r[0]+1,r[1]]:[r[0],r[1]+1])}),s},updateScales(e,t=!0){var n,a,i,s,o,r,l,c,u;const d=this,{axis:h,config:f,format:p,org:g,scale:_,state:{current:x,width:m,height:v,width2:b,height2:T,hasAxis:k,hasTreemap:w}}=d;if(k){const y=f.axis_rotated,C=d.getResettedPadding(1),A={x:y?C:0,y:y?0:v,subX:y?1:0,subY:y?0:T},S={x:y?v:m,y:y?m:C,subX:y?v:m,subY:y?b:1},L=t?(n=_.x)==null?void 0:n.orgDomain():_.zoom||(i=(a=_.x)==null?void 0:a.domain)==null?void 0:i.call(a),P=t?g.xDomain:_.zoom||(o=(s=_.subX)==null?void 0:s.domain)==null?void 0:o.call(s);_.x=d.getXScale(A.x,S.x,L,()=>h.x.tickOffset()),_.subX=d.getXScale(A.x,S.x,P,D=>{var R;return D%1?0:((R=h.subX)!=null?R:h.x).tickOffset()}),p.xAxisTick=h.getXAxisTickFormat(),p.subXAxisTick=h.getXAxisTickFormat(!0),h.setAxis("x",_.x,f.axis_x_tick_outer,e),f.subchart_show&&h.setAxis("subX",_.subX,(r=f.subchart_axis_x_tick_outer)!=null?r:f.axis_x_tick_outer,e),_.y=d.getYScale("y",A.y,S.y,_.y?_.y.domain():f.axis_y_default,_.y),_.subY=d.getYScale("y",A.subY,S.subY,_.subY?_.subY.domain():f.axis_y_default,_.subY),h.setAxis("y",_.y,f.axis_y_tick_outer,e),f.subchart_show&&f.subchart_axis_y_show&&h.setAxis("subY",_.subY,(l=f.subchart_axis_y_tick_outer)!=null?l:f.axis_y_tick_outer,e),(f.axis_y2_show||f.subchart_axis_y2_show)&&(_.y2=d.getYScale("y2",A.y,S.y,_.y2?_.y2.domain():f.axis_y2_default,_.y2),_.subY2=d.getYScale("y2",A.subY,S.subY,_.subY2?_.subY2.domain():f.axis_y2_default,_.subY2),h.setAxis("y2",_.y2,f.axis_y2_tick_outer,e),f.subchart_show&&f.subchart_axis_y2_show&&h.setAxis("subY2",_.subY2,(c=f.subchart_axis_y2_tick_outer)!=null?c:f.axis_y2_tick_outer,e))}else if(w){const y=d.getCurrentPadding();_.x=(0,ze.scaleLinear)().rangeRound([y.left,x.width-y.right]),_.y=(0,ze.scaleLinear)().rangeRound([y.top,x.height-y.bottom])}else(u=d.updateArc)==null||u.call(d)},xx(e){const t=this,{config:n,scale:{x:a,zoom:i}}=t,s=n.zoom_enabled&&i?i:a;return e?s(nt(e.x)?e.x:e):null},xv(e){const t=this,{axis:n,config:a,scale:{x:i,zoom:s}}=t,o=a.zoom_enabled&&s?s:i;let r=t.getBaseValue(e);return n.isTimeSeries()?r=Zt.call(t,r):n.isCategorized()&&st(r)&&(r=a.axis_x_categories.indexOf(r)),o(r)},yv(e){const t=this,{scale:{y:n,y2:a}}=t;return(e.axis&&e.axis==="y2"?a:n)(t.getBaseValue(e))},subxx(e){return e?this.scale.subX(e.x):null}};function Wt(e,t,n,a=`axis_${t}`){const i=e[`${a}_tick_${n}`];return i!==void 0?i:e[`axis_${t}_tick_${n}`]}function $a(e,t){const n=typeof e=="function"?e.call(t):e;return n!=null&&n.length?n:void 0}function or(e,t,n){var a,i,s,o,r,l;if((i=(a=e.axis)==null?void 0:a.isTimeSeries)!=null&&i.call(a,n))return t instanceof Date?t:Zt.call(e,t);if(n==="x"&&((o=(s=e.axis)==null?void 0:s.isCategorized)!=null&&o.call(s))&&typeof t=="string"){const c=e.config.axis_x_categories.indexOf(t);return c>=0?c:t}return(l=(r=e.axis)==null?void 0:r.isLog)!=null&&l.call(r,n)&&t!==null&&t!==void 0?+t:t}function Ne(e,t){return or(e,t,"x")}function aa(e,t,n="y"){return or(e,t,n)}function rr(e,t,n="y"){return t.map(a=>aa(e,a,n))}function Mi(e,t){return t.map(n=>Ne(e,n)).filter(n=>{var a,i;return!(typeof n=="string"&&((i=(a=e.axis)==null?void 0:a.isCategorized)!=null&&i.call(a)))})}function gn(e,t){const n=typeof t=="function"?t():t;return e.ticks?e.ticks(n):e.domain()}function lr(e,t){const[n,a]=e.domain(),i=+n,s=+a;if(t||!Number.isFinite(i)||!Number.isFinite(s)||s<=0)return gn(e,t);const o=Je("_log").domain([i>0?i:1,s]).range(e.range());let r=o.ticks();for(let l=s.toFixed().length;r.length>15;l--)r=o.ticks(l);return r.length&&(r.splice(0,1,n),r.splice(r.length-1,1,a)),r}function ia(e,t){const n=+e,a=+t;return Number.isFinite(n)&&Number.isFinite(a)?Math.abs(n-a)<1e-6:e===t}function kf(e,t){const[n,a]=t,i=e.slice();return n!==void 0&&!i.some(s=>ia(s,n))&&i.unshift(n),a!==void 0&&!i.some(s=>ia(s,a))&&i.push(a),i}function cr(e,t){const n=Ne(e,t);return Pa(n)}function Di(e){var t,n,a,i,s,o,r,l;const{scale:c}=e,u=(n=(t=c.zoom)==null?void 0:t.domain)==null?void 0:n.call(t),d=((i=(a=c.subX)==null?void 0:a.domain)==null?void 0:i.call(a))||((o=(s=c.x)==null?void 0:s.orgDomain)==null?void 0:o.call(s))||((l=(r=c.x)==null?void 0:r.domain)==null?void 0:l.call(r));return!(u!=null&&u.length)||!(d!=null&&d.length)?!1:!ia(u[0],d[0])||!ia(u[1],d[1])}function ae(e){return Di(e)?e.scale.zoom:e.scale.x}function Cf(e,t,n=0){var a,i;const s=(i=(a=ae(e)).domain)==null?void 0:i.call(a);if(!(s!=null&&s.length))return!0;const o=cr(e,t),r=+s[0],l=+s[1];return o===null||!Number.isFinite(r)||!Number.isFinite(l)?!0:o>=Math.min(r,l)-n&&o<=Math.max(r,l)+n}function Sf(e,t){const n=[t>0?Math.abs(e[t]-e[t-1]):1/0,t<e.length-1?Math.abs(e[t+1]-e[t]):1/0].filter(Number.isFinite),a=Math.min(...n);return Number.isFinite(a)?a/2:0}function ur(e,t){let n=0,a=e.length;for(;n<a;){const i=n+a>>1;e[i]<t?n=i+1:a=i}return n}function Af(e,t){let n=0,a=e.length;for(;n<a;){const i=n+a>>1;e[i]<=t?n=i+1:a=i}return n}function Lf(e,t){var n;const{axis:a,state:i}=e,s=[i.dataGeneration,(n=a==null?void 0:a.isTimeSeries)!=null&&n.call(a)?1:0,t.map(c=>`${c.id}:${c.values.length}`).join(",")].join("|"),o=i._canvasXDataTickCache;if((o==null?void 0:o.key)===s)return o;const r=e.mapTargetsToUniqueXs(t),l={key:s,values:r,comparable:r.map(c=>{var u;return(u=cr(e,c))!=null?u:NaN})};return i._canvasXDataTickCache=l,l}function Pf(e,t){const{values:n,comparable:a}=t;if(!Di(e))return n;const i=Mo(e);if(!i||a.length!==n.length||!Number.isFinite(a[0]))return n.filter(u=>Cf(e,u));const[s,o]=i;let r=ur(a,s),l=Af(a,o);const c=u=>{const d=ur(a,u);let h=-1,f=1/0;for(const p of[d-1,d]){const g=a[p],_=Math.abs(g-u);_<f&&(f=_,h=p)}h>-1&&h<a.length&&f<=Sf(a,h)+1e-6&&(r=Math.min(r,h),l=Math.max(l,h+1))};return c(s),c(o),n.slice(Math.max(0,r),Math.min(n.length,l))}function Rf(e,t){return typeof e=="function"?`fn:${t}`:Array.isArray(e)?e.map(n=>n instanceof Date?+n:String(n)).join(","):""}function Ef(e,t){var n,a,i;const{config:s,state:o}=e,l=(((a=(n=ae(e)).domain)==null?void 0:a.call(n))||[]).map(u=>u instanceof Date?+u:String(u)).join(","),c=s.axis_rotated?o.height:o.width;return[t?1:0,o.dataGeneration,l,c,s.axis_x_tick_fit?1:0,s.axis_x_tick_count||"",s.axis_x_tick_culling,s.axis_x_tick_culling_max||"",s.axis_x_tick_culling_reverse?1:0,((i=s.axis_x_categories)==null?void 0:i.length)||0,Rf(s.axis_x_tick_values,o.redrawGeneration)].join("|")}function Oi(e,t,n,a=!1){var i;return(i=e.axis)!=null&&i.generateTickValues?e.axis.generateTickValues(t,n,a):t}function Mf(e,t){const[n,a]=e,i=[];if(!t||!Number.isFinite(t))return i;for(let s=Math.round(n);s<=a;s+=t)i.push(s);return i}function Fa(e,t=!0){var n,a,i,s,o,r,l;const{axis:c,config:u}=e,d=ae(e),h=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),f=e.state._canvasXTickValuesCache||(e.state._canvasXTickValuesCache=new Map),p=Ef(e,t),g=f.get(p);if(g)return g;const _=v=>(f.set(p,v),v);if(!(h!=null&&h.length))return _([]);const x=$a(u.axis_x_tick_values,e.api);if(x){const v=Mi(e,x);return _(t?Fi(e,v):v)}if(u.axis_x_tick_fit&&(h!=null&&h.length)&&e.mapTargetsToUniqueXs){const v=Lf(e,h),b=Pf(e,v),T=Oi(e,b,u.axis_x_tick_count,(a=c==null?void 0:c.isTimeSeries)==null?void 0:a.call(c));return _(t?Fi(e,T,!0):T)}if(Di(e)&&!((i=c==null?void 0:c.isCategorized)!=null&&i.call(c))){const v=((o=(s=e.zoom)==null?void 0:s.getDomain)==null?void 0:o.call(s))||d.domain(),b=kf(gn(d,u.axis_x_tick_count||Ae),v);return _(t?Ba(b,Ii(e)):b)}if((r=c==null?void 0:c.isCategorized)!=null&&r.call(c)&&((l=u.axis_x_categories)!=null&&l.length)){const v=u.axis_x_categories.map((b,T)=>T);return _(t?Ba(v,Ii(e)):v)}const m=gn(d,u.axis_x_tick_count||Ae);return _(t?Ba(m,Ii(e)):m)}function Df(e){const{config:t,state:{height2:n,width2:a}}=e,i=t.axis_rotated?n:a,s=Wt(t,"x","count","subchart_axis_x"),o=Wt(t,"x","culling","subchart_axis_x"),r=Wt(t,"x","culling_max","subchart_axis_x");if(s)return s;if(o!==!1)return Math.min(r||Ae,Math.max(2,Math.floor(i/70)))}function dr(e,t=!0){var n,a,i,s;const{axis:o,config:r,scale:l}=e,c=l.subX,u=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),d=Wt(r,"x","count","subchart_axis_x"),h=Df(e),f=(_,x=!1)=>t?Fi(e,_,x,"subchart_axis_x",h):_;if(!c||!(u!=null&&u.length))return[];const p=$a(Wt(r,"x","values","subchart_axis_x"),e.api);if(p)return f(Mi(e,p));if(r.axis_x_tick_fit&&e.mapTargetsToUniqueXs){const _=Oi(e,e.mapTargetsToUniqueXs(u),d,(a=o==null?void 0:o.isTimeSeries)==null?void 0:a.call(o));return f(_,!0)}if((i=o==null?void 0:o.isCategorized)!=null&&i.call(o)&&((s=r.axis_x_categories)!=null&&s.length))return f(r.axis_x_categories.map((_,x)=>x),!0);const g=gn(c,d||Ae);return f(g,!0)}function hr(e,t=ae(e),n=e.config.axis_x_tick_outer){var a,i;const s=t,o=((a=s.orgDomain)==null?void 0:a.call(s))||((i=s.domain)==null?void 0:i.call(s));if(!(o!=null&&o.length))return[];const r=+o[0],l=+o[o.length-1];if(!Number.isFinite(r)||!Number.isFinite(l))return[];const c=Math.ceil(Math.min(r,l)),u=Math.floor(Math.max(r,l)),d=Array.from({length:Math.max(0,u-c+1)},(h,f)=>c+f);return n?d.slice(1,-1):d}function $i(e,t,n=ae(e)){var a,i,s,o,r;const l=n,c=Ne(e,t);if((i=(a=e.axis)==null?void 0:a.isCategorized)!=null&&i.call(a)){const u=(s=l.orgScale)==null?void 0:s.call(l);if(u)return u(c);const d=((r=(o=e.axis.x)==null?void 0:o.tickOffset)==null?void 0:r.call(o))||(l(1)-l(0))/2;return l(c)-d}return l(c)}function fr(e,t,n,a=ae(e)){if(t.length<2)return!1;const i=Math.max(1,n)/2,s=t.map(r=>$i(e,r,a)).filter(Number.isFinite).sort((r,l)=>r-l);if(s.length<2)return!1;let o=s[0]+i;for(let r=1;r<s.length;r++){const l=s[r]-i,c=s[r]+i;if(l<=o+Lo)return!0;o=Math.max(o,c)}return!1}function Ia(e,t,n=ae(e)){const a=new Set;return t.filter(i=>{const s=$i(e,i,n),o=Math.round(s);return!Number.isFinite(s)||a.has(o)?!1:(a.add(o),!0)})}function Of(e,t,n=1){var a;const{axis:i,config:s}=e;if((a=i==null?void 0:i.isCategorized)!=null&&a.call(i)){const r=hr(e);return Ia(e,r)}if(s.axis_x_tick_culling===!1||s.axis_x_tick_culling_lines===!1)return t;const o=Fa(e,!1);return fr(e,o,n)?t:Ia(e,o)}function $f(e,t,n=1){var a;const{axis:i,config:s,scale:o}=e,r=o.subX,l=Wt(s,"x","culling","subchart_axis_x"),c=Wt(s,"x","culling_lines","subchart_axis_x"),u=Wt(s,"x","outer","subchart_axis_x");if(!r)return[];if((a=i==null?void 0:i.isCategorized)!=null&&a.call(i)){const h=hr(e,r,u);return Ia(e,h,r)}if(l===!1||c===!1)return t;const d=dr(e,!1);return fr(e,d,n,r)?t:Ia(e,d,r)}function sa(e,t="y",n,a=!0,i=e.scale[t],s=`axis_${t}`){var o,r,l;const{axis:c,config:u}=e,d=`axis_${t}`,h=$a(Wt(u,t,"values",s),e.api),f=_=>a?zf(e,t,_,s):_;if(h)return f(rr(e,h,t));const p=Mf(i.domain(),u[`${d}_tick_stepSize`]);if(p.length)return f(p);const g=n!=null?n:Wt(u,t,"count",s);if((o=c==null?void 0:c.isTimeSeries)!=null&&o.call(c,t)&&u[`${d}_tick_time_value`])return f(gn(i,u[`${d}_tick_time_value`]));if((r=c==null?void 0:c.isLog)!=null&&r.call(c,t))return f(lr(i,g));if(g){const _=i.domain();return f(Oi(e,_,_.every(x=>x===0)?1:g,(l=c==null?void 0:c.isTimeSeries)==null?void 0:l.call(c,t)))}return f(gn(i,Ae))}function Ff(e,t,n){const a=t==="x"?ae(e):e.scale[t],i=a!=null&&a.copy?a.copy():a;return n.domain&&(i!=null&&i.domain)&&i.domain(n.domain),i}function If(e,t,n,a){var i,s,o;const r=a.tick||{},l=$a(r.values,e.api);return l?t==="x"?Mi(e,l):rr(e,l,t):t!=="x"&&((s=(i=e.axis)==null?void 0:i.isLog)!=null&&s.call(i,t))?lr(n,r.count):gn(n,(o=r.count)!=null?o:Ae)}function Bf(e,t){var n;const a=(n=t.tick)==null?void 0:n.format;return typeof a=="function"?a.bind(e.api):(i=>i)}function Ba(e,t){const n=e.length-1;if(t&&n>t){const a=e.length-1;return t<=1?[e[0]]:Array.from({length:t},(i,s)=>e[Math.round(s*a/(t-1))])}return e}function zf(e,t,n,a=`axis_${t}`){const{config:i}=e;if(!Wt(i,t,"culling",a))return n;const o=Wt(i,t,"culling_max",a)||Ae,r=Wt(i,t,"culling_reverse",a),l=n.slice().sort((h,f)=>{const p=+h,g=+f,_=Number.isFinite(p)&&Number.isFinite(g)?p-g:String(h).localeCompare(String(f));return r?-_:_}),c=l.length;let u=0;for(let h=1;h<c;h++)if(c/h<o){u=h;break}if(!u)return n;const d=new Set(l.filter((h,f)=>f%u===0));return n.filter(h=>d.has(h))}function Fi(e,t,n=!1,a="axis_x",i){const{config:s}=e;if(Wt(s,"x","culling",a)===!1)return t;const r=i||Wt(s,"x","culling_max",a)||Ae,l=Wt(s,"x","culling_reverse",a),c=n?t:t.slice().sort((f,p)=>{const g=+f,_=+p;return Number.isFinite(g)&&Number.isFinite(_)?l?_-g:g-_:l?String(p).localeCompare(String(f)):String(f).localeCompare(String(p))}),u=c.length;let d=0;for(let f=1;f<u;f++)if(u/f<r){d=f;break}if(!d)return t;if(n)return t.filter((f,p)=>l?(u-1-p)%d===0:p%d===0);const h=new Set(c.filter((f,p)=>p%d===0));return t.filter(f=>h.has(f))}function Ii(e){const{config:t,state:{height:n,width:a}}=e,i=t.axis_rotated?n:a;if(t.axis_x_tick_count)return t.axis_x_tick_count;if(t.axis_x_tick_culling!==!1)return Math.min(t.axis_x_tick_culling_max||Ae,Math.max(2,Math.floor(i/70)))}function Nf(e){var t,n;const{axis:a,config:i}=e,s=(n=(t=a==null?void 0:a.y)==null?void 0:t.getGeneratedTicks)==null?void 0:n.call(t,i.grid_y_ticks);return s!=null&&s.length?s:i.grid_y_ticks?Ba(sa(e,"y",void 0,!1),i.grid_y_ticks):sa(e,"y",void 0,!1)}var Xf=Object.defineProperty,Gf=(e,t,n)=>t in e?Xf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bi=(e,t,n)=>Gf(e,typeof t!="symbol"?t+"":t,n);const gr=20,pr=15;function zi(e){return e?-1:1}function Wf(e,t){return e?t?-1:1:t?1:-1}function Ni(e,t,n){return{x:e.left-gr,y:0,w:t+gr*2,h:n}}function Xi(e,t,n){return{x:0,y:e.top-pr,w:t,h:n+pr*2}}function Vf(e,t){var n,a;const i=(a=(n=e.config.axis_tooltip)==null?void 0:n.backgroundColor)!=null?a:"black";return typeof i=="string"?i:(i==null?void 0:i[t])||null}function Hf(e,t,n){var a,i;const s=e.scale[t];if(!(s!=null&&s.invert))return null;const o=s.invert(n);if(o==null)return null;if(t==="x"&&((i=(a=e.axis)==null?void 0:a.isTimeSeries)!=null&&i.call(a)))return e.format.xAxisTick(o);const r=Number(o);return Number.isFinite(r)?r.toFixed(2):`${o}`}function Yf(e,t){const{config:n,state:{height:a,margin:i,width:s}}=e,o=n.axis_rotated,r={x:i.left,y:i.top};return t==="x"?!o&&(r.y+=a):t==="y"?o&&(r.y+=a):o?r.y-=1:r.x+=s,r}function jf(e,t,n,a){return a?{x:e.x+n,y:e.y-t}:{x:e.x+t,y:e.y+n}}function Gi(e,t){const n=e?e(t):t;return n==null?"":String(n)}function oa(e,t){return e[`${t}TickFont`]||e.labelFont}function Wi(e,t){const n=e.measureText("0"),a=(n.fontBoundingBoxAscent||0)+(n.fontBoundingBoxDescent||0),i=(n.actualBoundingBoxAscent||0)+(n.actualBoundingBoxDescent||0),s=(t||10)*(11.5/10);return Math.max(t,a,i,s)}function Uf(e){return 11.5-2.5*(e/15)*(e>0?1:-1)}function Kf(e){return 8*Math.sin(Math.PI*(e/180))}function za(e,t){if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return Number.isFinite(n)?/em$/.test(e.trim())?n*t:n:0}return 0}function Zf(e,t,n){if(!t)return[e];const a=n.measureText("0").width||5.5,i=[];let s=0;for(;;){let o,r=-1;for(let l=1;s+l<e.length;l++)if(e.charAt(s+l)===" "&&(o=l),t<a*(l+1)){r=l;break}if(r===-1)return i.push(e.slice(s)),i;i.push(e.slice(s,s+(o||r))),s+=o?o+1:r}}function Vi(e,t,n,a){var i,s;const o=e.config.axis_x_tick_width;if(o&&o>0)return o;if(n)return 95;if((s=(i=e.axis)==null?void 0:i.isCategorized)!=null&&s.call(i)&&t.length>1){const r=a(Ne(e,t[0])),l=a(Ne(e,t[1]));return Math.max(0,Math.abs(l-r)-12)}return 110}function _r(e,t,n,a,i=[],s=!1,o=ae(e),r){const l=n?n(a):a;if(l==null)return[""];if(Array.isArray(l))return l.map(u=>String(u));const c=String(l);return c.indexOf(`
12
14
  `)>-1?c.split(`
13
- `):e.config.axis_x_tick_multiline?gd(c,r!=null?r:fa(e,a,s,o),t):[c]}function ga(e,t){const{isRotated:n,tickCount:i,tickIndex:a,tickRotate:s,tickTextDirection:o}=t,r=e.config.axis_x_tick_text_inner;let l=n?o>0?"left":"right":s?s>0?"left":"right":"center";return!n&&a===0&&(r===!0||r!=null&&r.first)?l="left":!n&&a===i-1&&(r===!0||r!=null&&r.last)&&(l="right"),l}function pd(e,t){var n,i;return((n=e==null?void 0:e.indexOf("center"))!=null?n:-1)>-1?{x:t/2,align:"center"}:((i=e==null?void 0:e.indexOf("right"))!=null?i:-1)>-1?{x:t,align:"right"}:{x:0,align:"left"}}function Ye(e){return Number.isFinite(e)}function pi(e,t,n){return Ye(e)&&e>=Math.min(t,n)&&e<=Math.max(t,n)}function to(e){return e?-1:1}function _d(e,t,n){return t?n?e.axis_y2_inner?1:-1:e.axis_y_inner?-1:1:n?e.axis_y2_inner?-1:1:e.axis_y_inner?1:-1}function pa(e,t,n=Kt(e)){return n(Le(e,t))}function xd(e,t){var n,i;return(i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&typeof t=="string"&&Number.isNaN(Number(t))?e.config.axis_x_categories.indexOf(t):Le(e,t)}function md(e,t){var n,i;return!!((i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&Number.isNaN(Number(t)))}function eo(e,t,n,i){var a,s;if(t===void 0)return n;let o=Kt(e)(xd(e,t));if(md(e,t)){const r=Kt(e),l=((s=(a=e.axis.x)==null?void 0:a.tickOffset)==null?void 0:s.call(a))||(r(1)-r(0))/2;o+=l*(i==="start"?-1:1)}return o}function no(e,t,n="y"){return e.scale[n||"y"](Fn(e,t,n))}function io(e,t,n){return e==="start"?t+4:e==="middle"?(t+n)/2:n-4}function ao(e,t,n){return e==="start"?n-4:e==="middle"?(t+n)/2:t+4}function vd(e,t){const{config:n,scale:i,state:{width:a,height:s}}=e,o=t.axis||"x",r=n.axis_rotated;if(o==="x"){const h=eo(e,t.start,0,"start"),f=eo(e,t.end,r?s:a,"end"),g=Math.min(h,f),p=Math.abs(f-h);return r?{x:0,y:g,w:a,h:p}:{x:g,y:0,w:p,h:s}}if(!i[o])return null;const l=t.start===void 0?r?0:s:no(e,t.start,o),c=t.end===void 0?r?a:0:no(e,t.end,o),d=Math.min(l,c),u=Math.abs(c-l);return r?{x:d,y:0,w:u,h:s}:{x:0,y:d,w:a,h:u}}class bd{constructor(t,n){ra(this,"engine",t),ra(this,"theme",n),ra(this,"painter"),this.painter=new Hs(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}draw(t){this.drawRegions(t),this.drawGrid(t),this.drawAxis(t)}drawAxis(t){const{config:n}=t;n.axis_x_show&&this.drawXAxis(t),n.axis_y_show&&this.drawYAxis(t),n.axis_y2_show&&t.scale.y2&&this.drawYAxis(t,"y2"),this.drawAdditionalAxes(t),this.drawAxisLabels(t)}drawSubXAxis(t){var n,i,a,s;const{ctx:o,painter:r,theme:{style:{axis:l}}}=this,{config:c,format:d,scale:u,state:{current:h,margin2:f,width2:g,height2:p}}=t;if(!c.subchart_show||!c.subchart_axis_x_show||!u.subX||g<=0||p<=0)return;const _=c.axis_rotated,x=r.crisp(f.left,l.lineWidth),m=r.crisp(f.top+p,l.lineWidth),b=f.left,v=f.left+g,y=f.top,T=f.top+p,w=_?y:b,C=_?T:v,A=Vs(t),S=Wu(t,A,l.tickWidth),k=(n=c.subchart_axis_x_tick_outer)!=null?n:c.axis_x_tick_outer,L=_?c.axis_x_tick_inner?1:-1:c.axis_x_tick_inner?-1:1,E=to(_),D=la(_),R=c.axis_x_tick_text_position,P=_?0:((i=t.getAxisTickRotate)==null?void 0:i.call(t,"x"))||0,B=d.subXAxisTick||((s=(a=t.axis)==null?void 0:a.getXAxisTickFormat)==null?void 0:s.call(a,!0));r.clipRect(_?ua(f,h.width,p):Ks(Us({},ca(f,g,h.height-f.top)),{y:f.top}),()=>{o.globalAlpha=1,o.strokeStyle=l.lineColor,o.lineWidth=l.lineWidth,o.setLineDash([]),r.strokePath(()=>{_?r.traceLine(x,y,x,T):r.traceLine(b,m,v,m),k&&(_?(r.traceLine(x,y,x+dt*E,y),r.traceLine(x,T,x+dt*E,T)):(r.traceLine(b,m,b,m+dt*E),r.traceLine(v,m,v,m+dt*E)))});const I=Bn(l,"x");o.font=I,o.fillStyle=l.labelColor,o.textAlign=_?D>0?"left":"right":"center",o.textBaseline=_?"middle":D>0?"top":"bottom",o.strokeStyle=l.tickColor,o.lineWidth=l.tickWidth;const X=da(r,he(I)),G=fa(t,A,_,u.subX);if(c.subchart_axis_x_tick_show)for(const Z of S){const et=u.subX(Le(t,Z)),rt=f.left+et,xt=f.top+et;pi(_?xt:rt,w,C)&&r.strokePath(()=>{_?r.traceLine(x,xt,x+dt*L,xt):r.traceLine(rt,m,rt,m+dt*L)})}for(const Z of A){const et=u.subX(Le(t,Z)),rt=f.left+et,xt=f.top+et;if(!pi(_?xt:rt,w,C)||!c.subchart_axis_x_tick_text_show)continue;const Tt=Qs(t,r,B,Z,A,_,u.subX,G);let _t,mt;_?(_t=x+(dt+Je)*D+(R.x||0),mt=xt+(R.y||0),o.textAlign=D>0?"left":"right",o.textBaseline="middle"):(_t=rt+(R.x||0),mt=m+(dt+Je)*D+(R.y||0),o.textAlign=P?P>0?"left":"right":"center",o.textBaseline=D>0?"top":"bottom"),r.withState(Pt=>{Pt.translate(_t,mt),P&&Pt.rotate(P*Math.PI/180),Tt.forEach((Dt,Lt)=>{Pt.fillText(Dt,0,Lt*X)})})}})}drawSubYAxes(t){const{config:n,scale:i,state:{margin2:a,width2:s,height2:o}}=t;!n.subchart_show||s<=0||o<=0||["y","y2"].forEach(r=>{var l;const c=r==="y2"?i.subY2:i.subY;!n[`subchart_axis_${r}_show`]||!c||this.drawYAxis(t,r,{scale:c,ticks:$n(t,r,void 0,!0,c,`subchart_axis_${r}`),format:sd(t,r),index:0,outerTick:(l=n[`subchart_axis_${r}_tick_outer`])!=null?l:n[`axis_${r}_tick_outer`],margin:a,width:s,height:o,prefix:`subchart_axis_${r}`,tickShow:n[`subchart_axis_${r}_tick_show`],tickTextShow:n[`subchart_axis_${r}_tick_text_show`],tickTextPosition:n[`axis_${r}_tick_text_position`]})})}drawTitle(t){var n,i;const{ctx:a,painter:s,theme:{style:{title:o}}}=this,{config:r,state:{current:l}}=t;if(!r.title_text)return;const c=String(r.title_text).split(`
14
- `),d=he(o.font),u=d*1.5,{x:h,align:f}=pd(r.title_position,l.width),g=(i=(n=t.getCanvasTitleHeight)==null?void 0:n.call(t))!=null?i:d,p=(r.title_padding.top||0)+g;s.withState(()=>{a.font=o.font,a.fillStyle=o.color,a.textAlign=f,a.textBaseline="alphabetic",c.forEach((_,x)=>{a.fillText(_,h,p+(x?d+(x-1)*u:0))})})}drawAxisLabels(t){const{ctx:n,painter:i,theme:{style:{axis:a}}}=this,{axis:s,config:o}=t,r=he(a.labelFont),l=["x","y","y2"],c={x:a.xLabelColor,y:a.yLabelColor,y2:a.y2LabelColor},d={start:"left",middle:"center",end:"right"};s&&i.withState(()=>{n.font=a.labelFont,n.textBaseline="alphabetic",l.forEach(u=>{const h=s.getLabelText(u);if(!h||!o[`axis_${u}_show`]||u==="y2"&&!t.scale.y2)return;const f=u==="x"&&o.axis_rotated||u!=="x"&&!o.axis_rotated,g=ud(t,u),p=s.xForAxisLabel(u)+ha(s.dxForAxisLabel(u),r),_=ha(s.dyForAxisLabel(u),r),{x,y:m}=dd(g,p,_,f),b=s.textAnchorForAxisLabel(u);n.fillStyle=c[u]||a.labelColor,n.textAlign=d[b]||"center",i.text(String(h),x,m,{angle:f?-90:0})})})}drawGrid(t){const{ctx:n,painter:i,theme:{style:{grid:a}}}=this,{config:s,scale:o,state:{height:r,margin:l,width:c}}=t;if(!a.lineColor)return;const d=s.axis_rotated,u=l.left,h=l.left+c,f=l.top,g=l.top+r;i.withState(()=>{n.strokeStyle=a.lineColor,n.lineWidth=a.lineWidth,a.dashArray.length&&n.setLineDash(a.dashArray),s.grid_x_show&&o.x&&i.strokePath(()=>{for(const p of hi(t)){const _=pa(t,p);Ye(_)&&(d?i.traceCrispLine(u,l.top+_,h,l.top+_,a.lineWidth):i.traceCrispLine(l.left+_,f,l.left+_,g,a.lineWidth))}}),s.grid_y_show&&o.y&&i.strokePath(()=>{for(const p of Ku(t)){const _=Fn(t,p),x=o.y(_);Ye(x)&&(d?i.traceCrispLine(l.left+x,f,l.left+x,g,a.lineWidth):i.traceCrispLine(u,l.top+x,h,l.top+x,a.lineWidth))}}),!s.grid_lines_front&&this.drawGridLines(t)})}drawRegions(t){const{ctx:n,painter:i,theme:{style:{region:a}}}=this,{config:s,state:{height:o,margin:r,width:l}}=t,c=s.regions||[];c.length&&i.clipRect({x:r.left,y:r.top,w:l,h:o},()=>{var d;n.fillStyle=a.fill,n.font=a.labelFont,n.textBaseline="top";for(const u of c){const h=vd(t,u);if(!h||!Ye(h.x)||!Ye(h.y)||!h.w||!h.h)continue;const f=r.left+h.x,g=r.top+h.y,p=h.w,_=h.h;if(n.globalAlpha=Number.isFinite(u.opacity)?u.opacity:a.opacity,i.fillRect({x:f,y:g,w:p,h:_}),(d=u.label)!=null&&d.text){const x=u.label,m=x.center||"",b=String(x.text),v=i.measureText(b).width,y=parseFloat(n.font)||12;let T=f+(x.x||0),w=g+(x.y||0);m.indexOf("x")>-1&&(T+=(p-v)/2),m.indexOf("y")>-1&&(w+=(_-y)/2),i.text(b,T,w,{angle:x.rotated?-90:0,alpha:1,fill:x.color||a.labelColor})}}})}drawGridLines(t){const{ctx:n,painter:i,theme:{style:{axis:a,grid:s}}}=this,{config:o,scale:r,state:{height:l,margin:c,width:d}}=t,u=o.axis_rotated,h=c.left,f=c.left+d,g=c.top,p=c.top+l;s.lineColor&&i.withState(()=>{n.strokeStyle=s.lineColor,n.lineWidth=s.lineWidth,n.font=s.labelFont||a.labelFont,n.fillStyle=s.labelColor,n.textBaseline="middle",n.setLineDash([]);const _=(y,T,w,C=!1,A)=>{y&&i.text(y,T,w,Ks(Us({},A),{angle:C?-90:0}))},x=(y,T,w)=>{const C=od(this.theme.getGridLineStyle(T,y,"line"));i.strokePath(w,C)},m=(y,T)=>rd(this.theme.getGridLineStyle(y,T,"text")),b=y=>{if(y.value===void 0||!r.x)return;const T=pa(t,y.value);if(Ye(T))if(u){const w=c.top+T;x(y,"x",()=>{i.traceLine(h,w,f,w)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,io(y.position,h,f),w-5,!1,m("x",y))}else{const w=c.left+T;x(y,"x",()=>{i.traceLine(w,g,w,p)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,w-5,ao(y.position,g,p),!0,m("x",y))}},v=y=>{const T=y.axis==="y2"?r.y2:r.y,w=y.axis==="y2"?"y2":"y";if(y.value===void 0||!T)return;const C=Fn(t,y.value,w),A=T(C);if(Ye(A))if(u){const S=c.left+A;x(y,"y",()=>{i.traceLine(S,g,S,p)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,S-5,ao(y.position,g,p),!0,m("y",y))}else{const S=c.top+A;x(y,"y",()=>{i.traceLine(h,S,f,S)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,io(y.position,h,f),S-5,!1,m("y",y))}};(o.grid_x_lines||[]).forEach(b),(o.grid_y_lines||[]).forEach(v)})}drawAdditionalAxes(t){["x","y","y2"].forEach(n=>{const i=t.config[`axis_${n}_axes`]||[];!i.length||!t.scale[n]||!t.config[`axis_${n}_show`]||i.forEach((a,s)=>{var o;const r=Yu(t,n,a);if(!r)return;const l={scale:r,ticks:Hu(t,n,r,a),format:ju(t,a),index:s+1,outerTick:((o=a.tick)==null?void 0:o.outer)!==!1};n==="x"?this.drawXAxis(t,l):this.drawYAxis(t,n,l)})})}drawXAxis(t,n){var i;const{ctx:a,painter:s,theme:{style:{axis:o}}}=this,{axis:r,config:l,state:{current:c,margin:d,width:u,height:h}}=t,f=l.axis_rotated,g=n!=null&&n.index?t.getAxisSize("x")*n.index:0,p=(n==null?void 0:n.scale)||Kt(t),_=s.crisp(d.left-(f?g:0),o.lineWidth),x=s.crisp(d.top+h+(f?0:g),o.lineWidth),m=d.left,b=d.left+u,v=d.top,y=d.top+h,T=f?v:m,w=f?y:b,C=(n==null?void 0:n.ticks)||hi(t),A=(n==null?void 0:n.ticks)||Vu(t,C,o.tickWidth),S=(n==null?void 0:n.format)||r.getXAxisTickFormat(),k=n?n.outerTick:l.axis_x_tick_outer,L=f?l.axis_x_tick_inner?1:-1:l.axis_x_tick_inner?-1:1,E=to(f),D=la(f),R=l.axis_x_tick_text_position,P=f?0:((i=t.getAxisTickRotate)==null?void 0:i.call(t,"x"))||0;s.clipRect(f?ua(d,c.width,h):ca(d,u,c.height),()=>{if(a.strokeStyle=o.lineColor,a.lineWidth=o.lineWidth,s.strokePath(()=>{f?s.traceLine(_,v,_,y):s.traceLine(m,x,b,x),k&&(f?(s.traceLine(_,v,_+dt*E,v),s.traceLine(_,y,_+dt*E,y)):(s.traceLine(m,x,m,x+dt*E),s.traceLine(b,x,b,x+dt*E)))}),a.font=Bn(o,"x"),a.fillStyle=o.labelColor,a.textAlign=f?D>0?"left":"right":"center",a.textBaseline=f?"middle":D>0?"top":"bottom",a.strokeStyle=o.tickColor,a.lineWidth=o.tickWidth,l.axis_x_tick_show&&s.strokePath(()=>{for(const G of A){const Z=ia(t,G,p),et=d.left+Z,rt=d.top+Z;pi(f?rt:et,T,w)&&(f?s.traceLine(_,rt,_+dt*L,rt):s.traceLine(et,x,et,x+dt*L))}}),!n&&!l.axis_x_tick_text_show)return;const B=Bn(o,"x"),I=da(s,he(B)),X=fa(t,C,f,p);C.forEach((G,Z)=>{this.drawXAxisTickText(t,G,S,o.labelColor,{isRotated:f,rangeEnd:w,rangeStart:T,tickCount:C.length,tickFont:B,tickIndex:Z,tickLineHeight:I,tickTextDirection:D,tickTextWidth:X,tickRotate:P,tickTextPosition:R,targetScale:p,ticks:C,x:_,y:x})})})}drawFocusedXAxisTick(t,n){var i;const{painter:a,theme:{style:{axis:s}}}=this,{axis:o,config:r,state:{current:l,margin:c,width:d,height:u}}=t,h=(i=n==null?void 0:n[0])==null?void 0:i.x;if(h===void 0||!o||!r.axis_x_show||!r.axis_x_tick_text_show||!s.activeLabelColor||s.activeLabelColor===s.labelColor)return;const f=hi(t),g=f.findIndex(w=>On(w,h)),p=f[g];if(p===void 0)return;const _=r.axis_rotated,x=a.crisp(c.left,s.lineWidth),m=a.crisp(c.top+u,s.lineWidth),b=_?c.top:c.left,v=_?c.top+u:c.left+d,y=o.getXAxisTickFormat(),T=la(_);a.clipRect(_?ua(c,l.width,u):ca(c,d,l.height),()=>{var w;this.drawXAxisTickText(t,p,y,s.activeLabelColor,{isRotated:_,rangeEnd:v,rangeStart:b,targetScale:Kt(t),tickCount:f.length,tickIndex:g,tickTextDirection:T,tickRotate:_?0:((w=t.getAxisTickRotate)==null?void 0:w.call(t,"x"))||0,tickTextPosition:r.axis_x_tick_text_position,ticks:f,x,y:m})})}drawAxisTooltip(t,n){const{ctx:i,painter:a,theme:{style:{axis:s,grid:o}}}=this,{config:r,state:{margin:l,width:c,height:d}}=t;if(!r.axis_tooltip||!n)return;const u=r.axis_rotated,h=n[0]-l.left,f=n[1]-l.top,g=h>=0&&h<=c,p=f>=0&&f<=d;if(!g&&!p)return;const _=l.left+h,x=l.top+f,m=he(s.labelFont),b=m||10,v=(y,T,w,C,A)=>{const S=ld(t,y),k=S&&cd(t,y,T);if(!k)return;i.font=s.labelFont,i.textAlign=A,i.textBaseline="alphabetic";const L=i.measureText(k),E=L.width,D=L.actualBoundingBoxAscent||b*.8,R=L.actualBoundingBoxDescent||b*.2,P=Math.max(2,E*.15),B=Math.max(3,b*.25),I=A==="right"?w-E:A==="center"?w-E/2:w,X=C-D;i.fillStyle=S,i.fillRect(I-P,X-B,E+P*2,D+R+B*2),i.fillStyle="#fff",i.fillText(k,w,C)};a.withState(()=>{i.strokeStyle=o.lineColor,i.lineWidth=o.lineWidth,i.setLineDash([]),a.strokePath(()=>{g&&a.traceLine(_,l.top,_,l.top+d),p&&a.traceLine(l.left,x,l.left+c,x)}),i.setLineDash([]),u?(p&&r.axis_x_show&&v("x",f,l.left-m*.3,x+m*.4,"right"),g&&r.axis_y_show&&v("y",h,_-m*1.3,l.top+d+m*1.15,"left"),g&&r.axis_y2_show&&t.scale.y2&&v("y2",h,_-m*1.3,l.top-m*.4,"left")):(g&&r.axis_x_show&&v("x",h,_-m,l.top+d+m*1.15,"left"),p&&r.axis_y_show&&v("y",f,l.left-m*.4,x+m*.3,"right"),p&&r.axis_y2_show&&t.scale.y2&&v("y2",f,l.left+c+m*.4,x+m*.3,"left"))})}drawXAxisTickText(t,n,i,a,s){var o,r;const{ctx:l,painter:c,theme:{style:{axis:d}}}=this,{state:{margin:u}}=t,{isRotated:h,rangeEnd:f,rangeStart:g,tickTextDirection:p,tickRotate:_,tickTextPosition:x,targetScale:m,ticks:b,x:v,y}=s,T=pa(t,n,m),w=u.left+T,C=u.top+T;if(!pi(h?C:w,g,f))return;const S=(o=s.tickFont)!=null?o:Bn(d,"x");l.font=S,l.fillStyle=a;const k=Qs(t,c,i,n,b,h,m,s.tickTextWidth),L=(r=s.tickLineHeight)!=null?r:da(c,he(S));let E,D;if(h)E=v+(dt+Je)*p+(x.x||0),D=C+(x.y||0),l.textAlign=ga(t,s),l.textBaseline="middle";else if(_){const R=he(S),P=x.y?ha(x.y,R):.71*R,B=fd(_)+(x.x||0),I=hd(_)+P;l.textAlign=ga(t,s),l.textBaseline="alphabetic",c.withState(X=>{X.translate(w,y),X.rotate(_*Math.PI/180),k.forEach((G,Z)=>{X.fillText(G,B,I+Z*L)})});return}else E=w+(x.x||0),D=y+(dt+Je)*p+(x.y||0),l.textAlign=ga(t,s),l.textBaseline=p>0?"top":"bottom";c.withState(R=>{R.translate(E,D),_&&R.rotate(_*Math.PI/180),k.forEach((P,B)=>{R.fillText(P,0,B*L)})})}drawYAxis(t,n="y",i){var a,s,o,r,l,c,d,u;const{ctx:h,painter:f,theme:{style:{axis:g}}}=this,{config:p,scale:_,state:x}=t,{margin:m,width:b,height:v}=x,y=(i==null?void 0:i.margin)||m,T=(a=i==null?void 0:i.width)!=null?a:b,w=(s=i==null?void 0:i.height)!=null?s:v,C=(i==null?void 0:i.prefix)||`axis_${n}`,A=(i==null?void 0:i.scale)||_[n],S=n==="y2",k=p.axis_rotated,L=i!=null&&i.index?t.getAxisSize(n)*i.index:0,E=f.crisp(y.left+(S?T+(k?0:L):-L),g.lineWidth),D=f.crisp(y.top+(k?S?-L-1:w+L:0),g.lineWidth),R=y.left,P=y.left+T,B=y.top,I=y.top+w,X=(i==null?void 0:i.ticks)||$n(t,n),G=(i==null?void 0:i.ticks)||(p[`${C}_tick_culling`]&&p[`${C}_tick_culling_lines`]!==!1?$n(t,n,void 0,!1):X),Z=(i==null?void 0:i.format)||((l=(r=(o=t.axis)==null?void 0:o[n])==null?void 0:r.tickFormat)==null?void 0:l.call(r))||((c=p[`${C}_tick_format`])==null?void 0:c.bind(t.api))||(Pt=>Pt),et=i?i.outerTick:p[`${C}_tick_outer`],rt=k?S?p.axis_y2_tick_inner?1:-1:p.axis_y_tick_inner?-1:1:S?p.axis_y2_tick_inner?-1:1:p.axis_y_tick_inner?1:-1,xt=_d(p,k,S),gt=ad(k,S),Tt=(i==null?void 0:i.tickTextPosition)||p[`${C}_tick_text_position`]||p[`axis_${n}_tick_text_position`],_t=(d=i==null?void 0:i.tickShow)!=null?d:i?!0:p[`${C}_tick_show`],mt=(u=i==null?void 0:i.tickTextShow)!=null?u:i?!0:p[`${C}_tick_text_show`];f.withState(()=>{h.strokeStyle=g.lineColor,h.lineWidth=g.lineWidth,f.strokePath(()=>{k?f.traceLine(R,D,P,D):f.traceLine(E,B,E,I),et&&(k?(f.traceLine(R,D,R,D+dt*xt),f.traceLine(P,D,P,D+dt*xt)):(f.traceLine(E,B,E+dt*xt,B),f.traceLine(E,I,E+dt*xt,I)))});const Pt=Bn(g,n);h.font=Pt,h.fillStyle=g.labelColor,h.textAlign=k?"center":gt>0?"left":"right",h.textBaseline=k?gt>0?"top":"bottom":"middle",h.strokeStyle=g.tickColor,h.lineWidth=g.tickWidth;const Dt=[],Lt=[],$e=(Ht,Be)=>{const hn=Fn(t,Ht,n),Yi=y.left+A(hn),Hi=y.top+A(hn);Ye(k?Yi:Hi)&&Be.push({tick:Ht,tx:Yi,ty:Hi})};for(const Ht of X)$e(Ht,Dt);for(const Ht of G)$e(Ht,Lt);if(_t&&f.strokePath(()=>{for(const{tx:Ht,ty:Be}of Lt)k?f.traceLine(Ht,D,Ht,D+dt*rt):f.traceLine(E,Be,E+dt*rt,Be)}),mt)for(const{tick:Ht,tx:Be,ty:hn}of Dt)k?f.text(Js(Z,Ht),Be+(Tt.x||0),D+dt*gt+(Tt.y||0)):f.text(Js(Z,Ht),E+(dt+Je)*gt+(Tt.x||0),hn+(Tt.y||0))})}}const oe={canvas:"bb-canvas",overlay:"bb-canvas-overlay",legend:"bb-canvas-legend",legendBottom:"bb-canvas-legend-bottom",legendInset:"bb-canvas-legend-inset",legendItemInteractive:"bb-legend-item-interactive",legendItemTileCircle:"bb-legend-item-tile-circle",legendItemTitle:"bb-legend-item-title",legendRight:"bb-canvas-legend-right"};var Fm=oe,yd=Object.defineProperty,Td=(e,t,n)=>t in e?yd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mn=(e,t,n)=>Td(e,typeof t!="symbol"?t+"":t,n);class wd{constructor(){mn(this,"canvas"),mn(this,"ctx"),mn(this,"dpr",1),mn(this,"frame",null),mn(this,"frameCtx",null),mn(this,"frameValid",!1)}init(t,n,i){this.canvas=nt.createElement("canvas"),this.canvas.className=oe.canvas,this.canvas.style.display="block",t.appendChild(this.canvas),this.dpr=N.devicePixelRatio||1,this.ctx=this.canvas.getContext("2d"),this.resize(n,i)}resize(t,n){const i=Math.max(0,t),a=Math.max(0,n);this.dpr=N.devicePixelRatio||1,this.canvas.width=i*this.dpr,this.canvas.height=a*this.dpr,this.canvas.style.width=`${i}px`,this.canvas.style.height=`${a}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.frame=null,this.frameCtx=null,this.frameValid=!1}clearOverlay(){this.frameValid&&this.restoreFrame()}withOverlay(t){const{ctx:n}=this;this.frameValid?this.clearOverlay():this.captureFrame(),n.save(),n.setTransform(this.dpr,0,0,this.dpr,0,0);try{t(n)}finally{n.restore()}}beginFrame(t,n){const{ctx:i}=this;this.frameValid=!1,i.save(),i.setTransform(this.dpr,0,0,this.dpr,0,0),i.clearRect(0,0,t,n)}endFrame(){this.ctx.restore()}captureFrame(){const{canvas:t}=this;if(this.frameValid=!1,t.width&&t.height){let{frame:n,frameCtx:i}=this;if(!n){const a=nt.createElement("canvas");n=a,i=a.getContext("2d"),this.frame=n,this.frameCtx=i}if(!n||!i)return;i.setTransform(1,0,0,1,0,0),n.width!==t.width||n.height!==t.height?(n.width=t.width,n.height=t.height):i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),this.frameValid=!0}}restoreFrame(){if(!this.frameValid||!this.frame||!this.frameCtx)return;const{canvas:t,ctx:n}=this;n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.drawImage(this.frame,0,0),n.restore(),n.setTransform(this.dpr,0,0,this.dpr,0,0)}destroy(){var t;(t=this.canvas)==null||t.remove(),this.frame=null,this.frameCtx=null,this.frameValid=!1}}function _a(e){const{config:t,state:n}=e;return!!(t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&t.subchart_show&&t.subchart_brush_enabled===!1&&n.width2>0&&n.height2>0)}function so(e,t){var n;const{config:i,scale:a,state:s}=e,o=a.zoom||a.x,r=a.subX;if(!o||!r)return null;const l=i.axis_rotated?s.height2:s.width2,c=i.axis_rotated?s.height:s.width,d=(n=r.invert)==null?void 0:n.call(r,t);let u=d==null?NaN:o(d);return!Number.isFinite(u)&&l>0&&(u=Math.max(0,Math.min(1,t/l))*c),Number.isFinite(u)?Math.max(0,Math.min(c,u)):null}const xa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oo=/([aAcChHlLmMqQsStTvVzZ])|([-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?)/g;function Cd(e){const t=new Set;let n=-1,i=0,a=!1,s;for(oo.lastIndex=0;s=oo.exec(e);)if(s[1])a=s[1]==="a"||s[1]==="A",i=0;else if(n++,a){const o=i%7;(o===2||o===3||o===4)&&t.add(n),i++}return t}function Sd(e,t){const n=Cd(t),i=[],a=[];let s=0,o=-1,r=-1,l,c;const d=f=>{i[o]?i[o]+=f:i[++o]=f};xa.lastIndex=0;const u=xa,h=new RegExp(xa.source,"g");for(e+="",t+="";(l=u.exec(e))&&(c=h.exec(t));){if(r++,c.index>s&&d(t.slice(s,c.index)),l[0]===c[0])d(c[0]);else{const f=+l[0],g=+c[0],p=n.has(r);i[++o]=null,a.push({index:o,fn:p?_=>Math.round(f+(g-f)*_):_=>f+(g-f)*_})}s=h.lastIndex}if(s<t.length&&d(t.slice(s)),!a.length){const f=i.join("");return()=>f}return f=>{for(let g=0,p=a.length;g<p;g++){const{index:_,fn:x}=a[g];i[_]=String(x(f))}return i.join("")}}function _i(e){const{bar_radius:t,bar_radius_ratio:n}=e.config;return $(t)&&t>0?()=>t:$(n)?i=>i*n:null}function ma(e){const{config:t,data:n}=e,i=new Set;if(!t.data_groups.length)return i;const a=e.orderTargets(e.filterTargetsToShow(n.targets.filter(e.isBarType,e)));for(const s of t.data_groups){const o=new Set(s),r=new Map,l=new Map;for(const c of a)if(o.has(c.id))for(const d of c.values)d.value===null||d.value===0||(d.value>0?r:l).set(d.index,c.id);for(const[c,d]of r)i.add(`${d}:${c}`);for(const[c,d]of l)i.add(`${d}:${c}`)}return i}function Ad(e,t,n){return n?e?t?{tl:n,bl:n}:{tr:n,br:n}:t?{br:n,bl:n}:{tl:n,tr:n}:0}function kd(e,t,n,i){let a="";return n?i&&e[0]<t?a=`0 ${t-e[0]}px 0 0`:!i&&e[0]>t&&(a=`0 0 0 ${e[0]-t}px`):i&&e[1]>t?a=`${e[1]-t}px 0 0 0`:!i&&e[1]<t&&(a=`0 0 ${t-e[1]}px 0`),a?`inset(${a})`:null}function va(e,t,n,i,a,s){const{config:o,state:r}=e,l=o.axis_rotated,c=+l,d=+!c,u=t.value<0,h=o[`axis_${e.axis.getId(t.id)}_inverted`],f=!h&&u||h&&!u,g=e.isGrouped(t.id),p=i&&g&&t.value!==0?r.hiddenTargetIds.has(t.id)&&s?s(t):a.has(`${t.id}:${t.index}`):!1,_=[n[0][c],n[0][d]];let x=0;if(i){const b=l?d:c,v=Math.abs(n[2][b]-n[0][b]);x=Math.max(0,!g||p?i(v):0)}const m=l?n[1][c]+(f?x:-x):n[1][d]+(f?-x:x);return{radius:x,corners:Ad(l,f,x),clipPath:x?kd(_,m,l,f):null,indexX:c,indexY:d,isNegative:f,pos:m}}const ro="2 2";function lo(e,t,n){const i=e.axis.isTimeSeries(),a=(s,o)=>Ct(s)?o:i?Vt.call(e,s):s;return(n||[]).map(s=>{var o,r;return{start:a(s.start,(o=t[0])==null?void 0:o.x),end:a(s.end,(r=t[t.length-1])==null?void 0:r.x),style:s.style||{dasharray:ro}}})}function co(e,t){for(let n=0,i;i=t[n];n++)if(i.start<e&&e<=i.end)return i.style;return!1}function Ld(e){const t=String((e==null?void 0:e.dasharray)||ro).split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:[2,2]}function Rd(e,t,n,i,a){const s=e.config.axis_rotated,o=lo(e,t,a),r=[];for(let l=1;l<t.length;l++){const c=t[l-1],d=t[l];if(!q(c.value)||!q(d.value)){r.push({isBreak:!0});continue}const u=co(d.x,o),h=n(c.x),f=i(c.value),g=n(d.x),p=i(d.value);r.push({start:s?[f,h]:[h,f],end:s?[p,g]:[g,p],dash:u?Ld(u):[]})}return r}function xi(e,t){return e.config.axis_rotated?[t[1],t[0]]:[t[0],t[1]]}function uo(e,t,n=1){const i=t.map(h=>xi(e,h)),a=i.map(([h])=>h),s=i.map(([,h])=>h),o=Math.min(...a),r=Math.min(...s),l=Math.max(...a)-o,c=Math.max(...s)-r,d=Math.max(n,l),u=Math.max(n,c);return{x:o-(d-l)/2,y:r-(u-c)/2,w:d,h:u}}function zn(e,t){var n,i;const a=(n=e.isGrouped)!=null&&n.call(e,t.id)&&e.circleY?e.circleY(t,t.index):e.getYScaleById(t.id)(e.getBaseValue(t)),s=(i=e.xx(t))!=null?i:NaN;return e.config.axis_rotated?{x:a,y:s}:{x:s,y:a}}function Ed(e,t,n){return{x:e.cx(t,n),y:e.cy(t,n)}}function Pd(e,t){return{body:uo(e,[t[0],t[1]]),wickStart:xi(e,[t[2][0],t[2][1]]),wickEnd:xi(e,[t[2][0],t[2][2]])}}function vn(e,t,n,i=!1){if(t===n)return{x:0,y:0,w:e.state.width,h:0};const{scale:{x:a,y:s}}=e,o=a(t.x0),r=s(t.y0),l=a(t.x1)-o,c=s(t.y1)-r;return{x:o,y:r,w:i?Math.max(0,l):l,h:i?Math.max(0,c):c}}function Dd(e,t,n,i){const{config:a}=e,{id:s,value:o,ratio:r=0}=t,l=a.treemap_label_format,c=typeof l=="function"?l.bind(e.api)(o,r,s,{width:n,height:i}):`${s}
15
- ${(r*100).toFixed(2)}%`;return c==null?null:String(c)}var pt=wt(4),Id=Object.defineProperty,Md=Object.defineProperties,Fd=Object.getOwnPropertyDescriptors,ho=Object.getOwnPropertySymbols,Od=Object.prototype.hasOwnProperty,$d=Object.prototype.propertyIsEnumerable,fo=(e,t,n)=>t in e?Id(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,go=(e,t)=>{for(var n in t||(t={}))Od.call(t,n)&&fo(e,n,t[n]);if(ho)for(var n of ho(t))$d.call(t,n)&&fo(e,n,t[n]);return e},po=(e,t)=>Md(e,Fd(t));function _o(e,t){return t?n=>{var i;const a=(i=e.getSubchartCandlestickShapeValue)==null?void 0:i.call(e,n,!0);return a===void 0?e.getBaseValue(n):a}:n=>e.getBaseValue(n)}function xo(e,t,n){return n?t.map(i=>{var a;const s=(a=e.getSubchartCandlestickShapeValue)==null?void 0:a.call(e,i,n);return s===void 0?i:po(go({},i),{value:s})}):t}function Bd(e,t,n){return e.isStepType(t)?e.convertValuesToStep(n):n}function mo(e,t,n,i){const{config:a,scale:s}=e,o=a.line_connectNull,r=a.axis_rotated,l=e.generateGetLinePoints(t,n),c=e.getYScaleById.bind(e),d=_o(e,n),u=p=>(n?e.subxx:e.xx).call(e,p),h=(p,_)=>e.isGrouped(p.id)?l(p,_)[0][1]:c(p.id,n)(d(p));let f=(0,pt.line)();f=r?f.x(h).y(u):f.x(u).y(h),i&&(f=f.context(i)),o||(f=f.defined(p=>d(p)!==null));const g=n?s.subX:s.x;return p=>{const _=c(p.id,n);let x=o?e.filterRemoveNull(p.values):p.values,m=0,b=0,v;if(e.isLineType(p)){const y=a.data_regions[p.id];y&&!i&&e.lineWithRegions?(x=xo(e,x,n),e.isAreaRangeType(p)&&(x=x.map(T=>po(go({},T),{value:e.getRangedData(T,"mid")}))),e.isStepType(p)&&(x=e.convertValuesToStep(x)),v=e.lineWithRegions(x,s.zoom||g,_,y)):v=f.curve(e.getCurve(p))(Bd(e,p,x))}else x[0]&&(m=g(x[0].x),b=_(d(x[0]))),v=r?`M ${b} ${m}`:`M ${m} ${b}`;return v||(i?void 0:"M 0 0")}}function vo(e,t,n,i){const{config:a}=e,s=a.line_connectNull,o=a.axis_rotated,r=e.generateGetAreaPoints(t,n),l=e.getYScaleById.bind(e),c=_o(e,n),d=new Map,u=p=>{let _=d.get(p);return _===void 0&&(_=e.getShapeYMin(p,n),d.set(p,_)),_},h=p=>(n?e.subxx:e.xx).call(e,p),f=(p,_)=>e.isGrouped(p.id)?r(p,_)[0][1]:l(p.id,n)(e.isAreaRangeType(p)?e.getRangedData(p,"high"):u(p.id)),g=(p,_)=>e.isGrouped(p.id)?r(p,_)[1][1]:l(p.id,n)(e.isAreaRangeType(p)?e.getRangedData(p,"low"):c(p));return p=>{let _=s?e.filterRemoveNull(p.values):p.values,x=0,m=0,b;if(e.isAreaType(p)){let v=(0,pt.area)();v=o?v.y(h).x0(f).x1(g):v.x(h).y0(a.area_above?0:a.area_below?n?e.state.height2:e.state.height:f).y1(g),i&&(v=v.context(i)),s||(v=v.defined(y=>c(y)!==null)),_=xo(e,_,n),e.isStepType(p)&&(_=e.convertValuesToStep(_)),b=v.curve(e.getCurve(p))(_)}else _[0]&&(x=(n?e.scale.subX:e.scale.x)(_[0].x),m=e.getYScaleById(p.id,n)(c(_[0]))),b=o?`M ${m} ${x}`:`M ${x} ${m}`;return b||(i?void 0:"M 0 0")}}let Re;function mi(e,t){if(!$(t)||t>=1)return e;const n=e.match(/^#([\da-f]{3}|[\da-f]{6})$/i);if(n){const s=(n[1].length===3?n[1].split("").map(r=>r+r).join(""):n[1]).match(/.{2}/g);return s?`rgba(${s.map(r=>parseInt(r,16)).join(",")},${t})`:e}if(/^rgb\(/i.test(e))return e.replace(/^rgb\((.*)\)$/i,`rgba($1,${t})`);if(/^rgba\(/i.test(e))return e.replace(/^rgba\((.*),\s*([\d.]+)\)$/i,(a,s,o)=>`rgba(${s},${Number(o)*t})`);const i=zd(e);return i&&i!==e?mi(i,t):e}function zd(e){if(!N.document||(Re===void 0&&(Re=N.document.createElement("canvas").getContext("2d")),!Re))return null;Re.fillStyle="#000",Re.fillStyle=e;const t=Re.fillStyle;Re.fillStyle="#fff",Re.fillStyle=e;const n=Re.fillStyle;return t===n?t:null}function Nn(e,t,n,i){const a=t(n,i),s=uo(e,a);return yt(s.x,s.y)&&yt(s.x+s.w,s.y+s.h)?{points:a,rect:s}:null}function Xn(e,t,n,i){const a=t(n,i),{body:s,wickStart:o,wickEnd:r}=Pd(e,a);return yt(s.x,s.y)&&yt(s.x+s.w,s.y+s.h)&&yt(o[0],o[1])&&yt(r[0],r[1])?{body:s,points:a,wickStart:o,wickEnd:r}:null}const Nd=1.2;function ba(e,t){var n,i,a;let{value:s}=t;if((n=e.isBubbleZType)!=null&&n.call(e,t))s=e.getBubbleZData(s,"z");else if((i=e.isCandlestickType)!=null&&i.call(e,t)){const o=(a=e.getCandlestickData)==null?void 0:a.call(e,t);o&&(s=o.close)}return s}function bo(e,t){const n=e.dataLabelFormat(t.id)(ba(e,t),t.id,t.index,[]);return n==null?null:String(n)}function yo(e){return`${e.id}:${e.index}`}function ya(e,t,n){var i;if(!(t!=null&&t.length))return()=>!1;if(e.config.tooltip_grouped&&t.length>1){const s=(i=t[0])==null?void 0:i.index;return o=>s!==void 0&&o.index===s&&n(e,o)}const a=new Set(t.filter(s=>s&&n(e,s)).map(yo));return s=>a.has(yo(s))}function vi(e,t,n,i){const a=e.config.data_labels_position;let s;if(z(a))s=a.bind(e.api)(n,ba(e,t),t.id,t.index,i);else if(a){const o=t.id in a?a[t.id]:a;s=o==null?void 0:o[n]}return $(s)?s:0}function Xd(e,t){var n,i;const a=(n=e.config.data_labels)==null?void 0:n.image;if(z(a))return(i=a.call(e.api,ba(e,t),t.id,t.index))!=null?i:null;if(a){const{url:s="",width:o=0,height:r=0,pos:l}=a;return{url:s,width:o,height:r,pos:l}}return null}function Gd(e,t){return an(e.url,{ID:t.id})}function Vd(e,t,n,i,a,s){var o,r,l;const{width:c=0,height:d=0,pos:u}=t,h=c/2,f=d/2,g=Ta(e.canvasEngine.ctx,n,i,a).h,p=he(e.canvasEngine.ctx.font),_=i-h,x=a-f-((o=e.isTreemapType)!=null&&o.call(e,s)?p*.7:g/2);let m=i,b=a;return e.config.axis_rotated?m+=h:b+=f,{x:_+((r=u==null?void 0:u.x)!=null?r:0),y:x+((l=u==null?void 0:u.y)!=null?l:0),textX:m,textY:b}}function To(e,t,n){var i,a,s;const o=(i=e.updateTextColor)==null?void 0:i.call(e,t);return typeof o=="string"?o:(a=e.isTreemapType)!=null&&a.call(e,t)?n:((s=e.color)==null?void 0:s.call(e,t))||n}function Wd(e,t){var n;const i=e.config.data_labels_backgroundColors;if(!i)return null;if(Q(i))return i;if(z(i)){const s=(n=e.color)==null?void 0:n.call(e,t),o=i.bind(e.api)(s,t);return o==null?null:String(o)}const a=i[t.id];return a==null?null:String(a)}function Yd(e){var t,n,i;if(!e)return null;const a=tt(e)?e:{};return{padding:Es((t=a.padding)!=null?t:"3 5"),radius:$(a.radius)?a.radius:10,stroke:(n=a.stroke)!=null?n:"#000",strokeWidth:$(a.strokeWidth)?a.strokeWidth:1,fill:(i=a.fill)!=null?i:"none"}}function Ta(e,t,n,i,a={top:0,right:0,bottom:0,left:0}){var s,o;const r=t.split(`
16
- `),l=r.map(x=>e.measureText(x)),c=Math.max(...l.map(x=>x.width),0),d=he(e.font),u=d*Nd,h=l[0]?(l[0].fontBoundingBoxAscent||0)+(l[0].fontBoundingBoxDescent||0):0,f=l[0]&&(l[0].fontBoundingBoxDescent||l[0].actualBoundingBoxDescent)||0,g=r.length>1?u*r.length:Math.max(d,h,((s=l[0])==null?void 0:s.actualBoundingBoxAscent)+((o=l[0])==null?void 0:o.actualBoundingBoxDescent)||0);let p=n,_=i;return e.textAlign==="center"?p-=c/2:(e.textAlign==="right"||e.textAlign==="end")&&(p-=c),e.textBaseline==="middle"?_-=g/2:e.textBaseline==="alphabetic"?_-=g-f:(e.textBaseline==="bottom"||e.textBaseline==="ideographic")&&(_-=g),{x:p-a.left,y:_-a.top,w:c+a.left+a.right,h:g+a.top+a.bottom}}function wo(e,t,n,i,a,s){var o,r;const l=t.context,c=Wd(e,n),d=Yd((o=e.config.data_labels)==null?void 0:o.border),u=(r=d==null?void 0:d.padding)!=null?r:{top:0,right:0,bottom:0,left:0},h=Ta(l,i,a,s,u),f=e.config.data_labels.rotate;t.withState(g=>{var p;f&&(g.translate(a,s),g.rotate(f*Math.PI/180),h.x-=a,h.y-=s),c&&t.fillRoundRect(h,(p=d==null?void 0:d.radius)!=null?p:0,{fill:c}),d&&(d.fill!=="none"&&t.fillRoundRect(h,d.radius,{fill:d.fill}),t.strokeRoundRect(h,d.radius,{stroke:d.stroke,lineWidth:d.strokeWidth}))})}function Hd(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function jd(e){return e==="start"?"left":e==="end"?"right":"center"}function Ud(e,t,n,i){var a,s,o;const r=Hd(e.config.data_labels.rotate),l=e.config.axis_rotated,c=e.config[`axis_${(a=e.axis)==null?void 0:a.getId(t.id)}_inverted`],d=Wt(e,t),{value:u}=t,h=$(u)&&u<0||d&&!((o=(s=e.getCandlestickData)==null?void 0:s.call(e,t))!=null&&o._isUp),f=4,g=f*2;return l?r==="start"?(n+=h?0:g,i+=f):r==="middle"?(n+=g,i-=g):r==="end"&&(h&&(n-=g),i+=f):(r==="start"?(n+=f,h&&(i+=g*2)):r==="middle"?i-=g:r==="end"&&(n-=f,h&&(i+=g*2)),c&&(i+=h?-17:d?13:7)),{x:n,y:i,textAlign:jd(r)}}function Co(e,t,n,i,a){var s;if(e.config.axis_rotated)i+=6,t.textAlign="left",t.textBaseline="middle";else if(We(e,n))t.textAlign="center",t.textBaseline="middle";else{const{config:o,state:r}=e,l=o[`axis_${(s=e.axis)==null?void 0:s.getId(n.id)}_inverted`],c=n.value<0||n.value===0&&!r.hasPositiveValue&&r.hasNegativeValue;let d=3;$(o.point_r)&&o.point_r>5&&(xn(e,n)||Ve(e,n))&&(d+=o.point_r/2.3),t.textAlign="center",(l?!c:c)?(a+=d,t.textBaseline="top"):(a-=d*2,t.textBaseline="bottom")}return{x:i,y:a}}var Kd=Object.defineProperty,So=Object.getOwnPropertySymbols,Zd=Object.prototype.hasOwnProperty,qd=Object.prototype.propertyIsEnumerable,Ao=(e,t,n)=>t in e?Kd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ee=(e,t)=>{for(var n in t||(t={}))Zd.call(t,n)&&Ao(e,n,t[n]);if(So)for(var n of So(t))qd.call(t,n)&&Ao(e,n,t[n]);return e};const ko={x:0,y:0,w:8,h:8},wa=new Map,Lo=[1,0,0,1,0,0];function Jd(e){return e==="circle"||e==="rectangle"}function $t(e,t,n=0){const i=e.getAttribute(t),a=i===null?NaN:parseFloat(i);return Number.isFinite(a)?a:n}function Qd(e){const t=(e.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi)||[]).map(Number).filter(Number.isFinite),n=[];for(let i=0;i<t.length-1;i+=2)n.push([t[i],t[i+1]]);return n}function th(e){const t=(e==null?void 0:e.trim().split(/[\s,]+/).map(Number).filter(Number.isFinite))||[];return t.length===4?{x:t[0],y:t[1],w:t[2],h:t[3]}:null}function Ro(e){const t=e.map(([s])=>s),n=e.map(([,s])=>s),i=Math.min(...t),a=Math.min(...n);return{x:i,y:a,w:Math.max(...t)-i,h:Math.max(...n)-a}}function eh(e){const t=e.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)&&Number.isFinite(o.w)&&Number.isFinite(o.h));if(!t.length)return Ee({},ko);const n=Math.min(...t.map(o=>o.x)),i=Math.min(...t.map(o=>o.y)),a=Math.max(...t.map(o=>o.x+o.w)),s=Math.max(...t.map(o=>o.y+o.h));return{x:n,y:i,w:a-n,h:s-i}}function Gn(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function nh(e){let t=[...Lo];return((e==null?void 0:e.match(/[a-z]+\([^)]*\)/gi))||[]).forEach(n=>{var i;const[,a,s]=n.match(/^([a-z]+)\(([^)]*)\)$/i)||[],o=a==null?void 0:a.toLowerCase(),r=((s==null?void 0:s.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi))||[]).map(Number).filter(Number.isFinite);let l=null;if(o==="matrix"&&r.length>=6)l=r.slice(0,6);else if(o==="translate"&&r.length)l=[1,0,0,1,r[0],r[1]||0];else if(o==="scale"&&r.length)l=[r[0],0,0,(i=r[1])!=null?i:r[0],0,0];else if(o==="rotate"&&r.length){const c=r[0]*Math.PI/180,d=Math.cos(c),u=Math.sin(c),h=[d,u,-u,d,0,0];l=r.length>=3?Gn(Gn([1,0,0,1,r[1],r[2]],h),[1,0,0,1,-r[1],-r[2]]):h}else o==="skewx"&&r.length?l=[1,0,Math.tan(r[0]*Math.PI/180),1,0,0]:o==="skewy"&&r.length&&(l=[1,Math.tan(r[0]*Math.PI/180),0,1,0,0]);l&&(t=Gn(t,l))}),t}function He(e,t){const n=e.getAttribute("style"),i=e.getAttribute(t),a=n==null?void 0:n.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"));return((a==null?void 0:a[1])||i||"").trim()||null}function ih(e,t){const n=Ee({},t),i=He(e,"fill"),a=He(e,"stroke"),s=He(e,"stroke-width"),o=He(e,"opacity"),r=He(e,"fill-opacity"),l=He(e,"stroke-opacity");if(i&&(n.fill=i==="none"?null:i),a&&(n.stroke=a==="none"?null:a),s){const c=parseFloat(s);Number.isFinite(c)&&(n.lineWidth=c)}return[o,r,l].forEach(c=>{var d;const u=c===null?NaN:parseFloat(c);Number.isFinite(u)&&(n.alpha=((d=n.alpha)!=null?d:1)*u)}),n}function ah(e){const t=new Map;return Array.from(e.querySelectorAll("[id]")).forEach(n=>{const i=n.getAttribute("id");i&&t.set(i,n)}),t}function ve(e,t){const n=e==null?void 0:e.trim();return n?/%$/.test(n)?n:parseFloat(n):t}function be(e,t,n,i){if(typeof e=="number")return Number.isFinite(e)?e:i;if(typeof e=="string"&&/%$/.test(e)){const s=parseFloat(e);return Number.isFinite(s)?t+n*s/100:i}const a=parseFloat(e!=null?e:"");return Number.isFinite(a)?a:i}function sh(e){const t=(e==null?void 0:e.trim())||"0",n=parseFloat(t),i=/%$/.test(t)?n/100:n;return Math.max(0,Math.min(1,Number.isFinite(i)?i:0))}function oh(e){return Array.from(e.children||[]).filter(t=>t.tagName.toLowerCase()==="stop").map(t=>{const n=He(t,"stop-color")||"#000",i=He(t,"stop-opacity"),a=i===null?NaN:parseFloat(i);return{offset:sh(t.getAttribute("offset")),color:n,opacity:Number.isFinite(a)?a:void 0}})}function rh(e){const t=new Map;return e.forEach((n,i)=>{const a=n.tagName.toLowerCase(),s=oh(n);s.length&&(a==="lineargradient"?t.set(i,{type:"linearGradient",x1:ve(n.getAttribute("x1"),"0%"),y1:ve(n.getAttribute("y1"),"0%"),x2:ve(n.getAttribute("x2"),"100%"),y2:ve(n.getAttribute("y2"),"0%"),stops:s}):a==="radialgradient"&&t.set(i,{type:"radialGradient",cx:ve(n.getAttribute("cx"),"50%"),cy:ve(n.getAttribute("cy"),"50%"),r:ve(n.getAttribute("r"),"50%"),fx:ve(n.getAttribute("fx"),"50%"),fy:ve(n.getAttribute("fy"),"50%"),fr:ve(n.getAttribute("fr"),0),stops:s}))}),t}function Ca(e,t,n,i=Lo,a={},s=new Set){const o=e.tagName.toLowerCase(),r=Array.from(e.children||[]),l=ih(e,a),c=Gn(i,nh(e.getAttribute("transform"))),d={matrix:c,style:l};if(o==="defs")return[];if(o==="svg"||o==="g"||o==="symbol")return r.reduce((u,h)=>u.concat(Ca(h,t,n,c,l,s)),[]);if(o==="use"){const u=e.getAttribute("href")||e.getAttribute("xlink:href")||"",h=u.charAt(0)==="#"?u.slice(1):"",f=h&&n.get(h);if(!f||s.has(h))return[];const g=$t(e,"x",0),p=$t(e,"y",0),_=Gn(c,[1,0,0,1,g,p]);s.add(h);const x=Ca(f,t,n,_,l,s);return s.delete(h),x}if(o==="polygon"||o==="polyline"){const u=Qd(e.getAttribute("points")||"");return u.length?[Ee({type:o,points:u,box:Ro(u)},d)]:[]}if(o==="circle"){const u=$t(e,"cx",0),h=$t(e,"cy",0),f=$t(e,"r",0);return f>0?[Ee({type:"circle",cx:u,cy:h,r:f,box:{x:u-f,y:h-f,w:f*2,h:f*2}},d)]:[]}if(o==="ellipse"){const u=$t(e,"cx",0),h=$t(e,"cy",0),f=$t(e,"rx",0),g=$t(e,"ry",0);return f>0&&g>0?[Ee({type:"ellipse",cx:u,cy:h,rx:f,ry:g,box:{x:u-f,y:h-g,w:f*2,h:g*2}},d)]:[]}if(o==="rect"){const u=$t(e,"x",0),h=$t(e,"y",0),f=$t(e,"width",0),g=$t(e,"height",0);return f>0&&g>0?[Ee({type:"rect",x:u,y:h,w:f,h:g,box:{x:u,y:h,w:f,h:g}},d)]:[]}if(o==="line"){const u=$t(e,"x1",0),h=$t(e,"y1",0),f=$t(e,"x2",0),g=$t(e,"y2",0);return[Ee({type:"line",x1:u,y1:h,x2:f,y2:g,box:Ro([[u,h],[f,g]])},d)]}if(o==="path"){const u=e.getAttribute("d")||"";return u?[Ee({type:"path",d:u,box:t},d)]:[]}return[]}function lh(e){if(!/^</.test(e))return null;if(wa.has(e))return wa.get(e)||null;let t=null;try{const i=new N.DOMParser().parseFromString(ue(e),"image/svg+xml").documentElement,a=th(i.getAttribute("viewBox"))||ko,s=ah(i),o=Ca(i,a,s);o.length&&(t={shapes:o,box:i.tagName.toLowerCase()==="svg"?a:eh(o.map(r=>r.box)),paints:rh(s)})}catch(n){t=null}return wa.set(e,t),t}function ch(e,t){if(t.type==="polygon"||t.type==="polyline"){const[n,...i]=t.points;e.moveTo(n[0],n[1]),i.forEach(([a,s])=>e.lineTo(a,s)),t.type==="polygon"&&e.closePath()}else t.type==="circle"?(e.moveTo(t.cx+t.r,t.cy),e.arc(t.cx,t.cy,t.r,0,Math.PI*2)):t.type==="ellipse"?(e.moveTo(t.cx+t.rx,t.cy),e.ellipse(t.cx,t.cy,t.rx,t.ry,0,0,Math.PI*2)):t.type==="rect"?e.rect(t.x,t.y,t.w,t.h):t.type==="line"&&(e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2))}function bi(e){const t=e==null?void 0:e.match(/^url\(#([^)]+)\)$/);return(t==null?void 0:t[1])||null}function Eo(e,t,n){const{x:i,y:a,w:s,h:o}=n,r=t.type==="linearGradient"?e.createLinearGradient(be(t.x1,i,s,i),be(t.y1,a,o,a),be(t.x2,i,s,i+s),be(t.y2,a,o,a)):e.createRadialGradient(be(t.fx,i,s,i+s/2),be(t.fy,a,o,a+o/2),be(t.fr,i,Math.max(s,o),0),be(t.cx,i,s,i+s/2),be(t.cy,a,o,a+o/2),Math.max(.01,be(t.r,0,Math.max(s,o),Math.max(s,o)/2)));return t.stops.forEach(({offset:l,color:c,opacity:d})=>{r.addColorStop(l,d===void 0?c:mi(c,d))}),r}function uh(e,t,n,i,a){const s=Ee({},t||{});if(n.fill!==void 0)if(n.fill===null)delete s.fill;else if(bi(n.fill)){const o=i.get(bi(n.fill));o&&(s.fill=Eo(e,o,a))}else/^url\(/.test(n.fill)||(s.fill=n.fill);if(n.stroke!==void 0)if(n.stroke===null)delete s.stroke;else if(bi(n.stroke)){const o=i.get(bi(n.stroke));o&&(s.stroke=Eo(e,o,a))}else/^url\(/.test(n.stroke)||(s.stroke=n.stroke);return n.lineWidth!==void 0&&(s.lineWidth=n.lineWidth),{style:s,shouldFill:n.fill!==null&&(!s.stroke||s.fill!==void 0),shouldStroke:n.stroke!==null&&s.stroke!==void 0,alpha:n.alpha}}function Vn(e,t,n,i,a,s,o=a){if(Jd(t)){e.point(t,n,i,a,s);return}const r=lh(t);if(!r||a<=0){e.point("circle",n,i,a,s);return}e.withState(l=>{const{box:c,paints:d,shapes:u}=r,h=o>0?a/o:1,f=g=>{const{style:p,shouldFill:_,shouldStroke:x,alpha:m}=uh(l,s,g.style,d,c);if(l.save(),e.applyStyle(p),m!==void 0&&(l.globalAlpha*=m),l.transform(...g.matrix),l.beginPath(),g.type==="path"){if(N.Path2D){const b=g.path2D||(g.path2D=new N.Path2D(g.d));_&&l.fill(b),x&&l.stroke(b)}}else ch(l,g),_&&l.fill(),x&&l.stroke();l.restore()};l.translate(n-(c.x+c.w/2)*h,i-(c.y+c.h/2)*h),l.scale(h,h),u.forEach(f)})}var dh=Object.defineProperty,hh=Object.defineProperties,fh=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,gh=Object.prototype.hasOwnProperty,ph=Object.prototype.propertyIsEnumerable,Sa=(e,t,n)=>t in e?dh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Do=(e,t)=>{for(var n in t||(t={}))gh.call(t,n)&&Sa(e,n,t[n]);if(Po)for(var n of Po(t))ph.call(t,n)&&Sa(e,n,t[n]);return e},Io=(e,t)=>hh(e,fh(t)),bn=(e,t,n)=>Sa(e,typeof t!="symbol"?t+"":t,n);const _h=[Mn,ee,fe,Wt],xh=1e3,Mo=new WeakMap,Fo=new Map;function Oo(e,t){if(!t||t==="none")return;const n=t.match(/^matrix\(([^)]+)\)$/),i=t.match(/^matrix3d\(([^)]+)\)$/);if(n){const a=n[1].split(",").map(s=>Number(s.trim()));a.length===6&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[2],a[3],a[4],a[5])}else if(i){const a=i[1].split(",").map(s=>Number(s.trim()));a.length===16&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[4],a[5],a[12],a[13])}}function mh(e,t,n){const i=e.naturalWidth||e.width,a=e.naturalHeight||e.height;if(!i||!a||!t||!n)return{x:0,y:0,w:t,h:n};const s=Math.min(t/i,n/a),o=i*s,r=a*s;return{x:(t-o)/2,y:(n-r)/2,w:o,h:r}}function vh(e){const{state:t}=e;return t.hasFunnel||t.hasTreemap?{x:0,y:0}:{x:gn(t.margin.left),y:gn(t.margin.top)}}function $o(e,t,n,i,a=!1){i.strokePath(s=>{mo(e,n,a,s)(t)},{lineDash:[]})}function Bo(e,t,n,i,a=!1){i.fillPath(s=>{vo(e,n,a,s)(t)})}function zo(e,t){const n=ke(e,t);return n.start===0&&n.end===t.values.length?t:Io(Do({},t),{values:t.values.slice(n.start,n.end)})}function Aa(e,t){if(!(e!=null&&e.length)||!(t!=null&&t.id))return null;let n=Mo.get(e);if(!n){n=new Map;for(const i of e){if(!(i!=null&&i.id))continue;const a=`${i.id}:*`;n.has(a)||n.set(a,i),"index"in i&&n.set(`${i.id}:${i.index}`,i)}Mo.set(e,n)}return"index"in t?n.get(`${t.id}:${t.index}`)||null:n.get(`${t.id}:*`)||null}function bh(e,t){const n=N.Path2D;if(!n)return null;const i=`${e}:${t}`,a=Fo.get(i);if(a)return a;const s=new n(bs[e][t]);return Fo.set(i,s),s}function Wn(e,t){const n=e.config.color_onover;return!n||!t?null:tt(n)?t.id in n?n[t.id]:null:Q(n)?n:z(n)?n.call(e.api,t):null}function yh(e,t,n){const i=Aa(n,t);return Wn(e,i)||e.color(t.id)}function No(e){var t;return(e==null?void 0:e.id)||((t=e==null?void 0:e.data)==null?void 0:t.id)}function Xo(e,t){var n;const i=No(t);return!!i&&((n=e.state.focusedTargetIds)==null?void 0:n.has(i))}function ye(e,t){var n;const i=No(t);return i&&((n=e.state.defocusedTargetIds)!=null&&n.has(i))?e.canvasTheme.style.shape.targetDefocusedOpacity:1}function Th(e,t,n,i=!1){var a;const s=(a=e.generateGetAreaPoints)==null?void 0:a.call(e,n,i);if(!s)return null;const o=ke(e,t);let r=1/0,l=1/0,c=-1/0,d=-1/0;for(let u=o.start;u<o.end;u++){const h=t.values[u];Rt(e,h)&&s(h,u).forEach(([f,g])=>{yt(f,g)&&(r=Math.min(r,f),l=Math.min(l,g),c=Math.max(c,f),d=Math.max(d,g))})}return Number.isFinite(r)&&Number.isFinite(l)?{x:r,y:l,w:c-r,h:d-l}:null}function yi(e,t,n){return t+n*($(e)?e:0)}function Go(e,t,n,i,a,s){const o=e.config[`${i}_linearGradient`];if(!o||!a||!a.w||!a.h)return s;const r=e.config.axis_rotated,l=typeof o=="object"?o:{},c=l.x||(r?[1,0]:[0,0]),d=l.y||(r?[0,0]:[0,1]),u=Array.isArray(l.stops)?l.stops:[[0,s,1],[1,s,0]],h=t.createLinearGradient(yi(c[0],a.x,a.w),yi(d[0],a.y,a.h),yi(c[1],a.x,a.w),yi(d[1],a.y,a.h));return u.forEach(([f,g,p])=>{const _=z(g)?g.call(e.api,n.id):g,x=String(_||s),m=Number(f),b=Number.isFinite(m)?Math.max(0,Math.min(1,m)):0;h.addColorStop(b,mi(x,p))}),h}function Pe(e,t){return _n(e,t,_h)}function Ti(e,t){const n=e.config.point_opacity;return Number.isFinite(n)?n:Ve(e,t)||We(e,t)?.5:1}function Yn(e,t,n){var i,a;const s=e.config.point_r;return We(e,t)||z(s)?(a=(i=e.pointR)==null?void 0:i.call(e,n))!=null?a:2.5:s}function wh(e,t,n,i){return!i&&n==="circle"&&Ve(e,t)&&!z(e.config.point_r)&&t.values.length>Ms}function Ch(e,t){const{bar_connectLine:n}=e.config,i=tt(n)?n[t]:n;return/^(start|end)-(start|end)$/.test(i)?i:null}function Sh(e,t,n){const{indexX:i,indexY:a,pos:s}=n;return e.config.axis_rotated?{x:t[0][i],y:t[0][a],width:t[0][i]-s,height:t[2][a]-t[0][a]}:{x:t[0][i],y:s,width:t[2][i]-t[0][i],height:t[3][a]-s}}function Ah(e,t,n,i,a=1){if(i.length<2)return;const s=e.config.axis_rotated,o=/^start-(start|end)$/.test(n),r=/^end-(start|end)$/.test(n),l=/\w+-end$/.test(n),c=/\w+-start$/.test(n),d=f=>({x:s?r?f.x-f.width:f.x:f.x+f.width,y:s||o?f.y+f.height:f.y}),u=f=>({x:s?f.x-(l?f.width:0):f.x,y:s?f.y:f.y+(c?f.height:0)});let h=d(i[0]);t.strokePath(()=>{for(let f=1;f<i.length;f++){const g=u(i[f]);t.traceLine(h.x,h.y,g.x,g.y),f<i.length-1&&(h=d(i[f]))}},{alpha:a,stroke:e.canvasTheme.style.shape.barConnectLineColor,lineWidth:e.canvasTheme.style.shape.barConnectLineWidth,lineDash:[]})}function ka(e,t){var n;const{config:i}=e;if(We(e,t))return"circle";const a=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],s=Array.isArray(i.point_pattern)&&i.point_pattern.length?i.point_pattern:[i.point_type],o=Math.max(0,a.indexOf(t.id)),r=s[o%s.length];return/^rect(angle)?$/i.test(r)||r==="rectangle"?"rectangle":r||"circle"}function kh(e,t,n,i,a,s,o){const r=e.config.point_radialGradient;if(!r||!s)return o;const l=tt(r)?r:{},c=$(l.cx)?l.cx:.3,d=$(l.cy)?l.cy:.3,u=$(l.r)?l.r:.7,h=Array.isArray(l.stops)?l.stops:[[.1,null,1],[.9,null,0]],f=i+(c-.5)*s*2,g=a+(d-.5)*s*2,p=t.createRadialGradient(f,g,0,f,g,Math.max(1,s*u*2));return h.forEach(([_,x,m])=>{let b=z(x)?x.bind(e.api)(n.id):x;b||(b=o);const v=Number(_),y=Number.isFinite(v)?Math.max(0,Math.min(1,v)):0;p.addColorStop(y,mi(b,m))}),p}function Vo(e,t,n){const i=e.config.candlestick_color_down;return(n!=null&&n._isUp?e.color(t):i&&typeof i=="object"?i[t.id]:i)||e.color(t)}function Lh(e,t){return e.shouldDrawPointsForLine?e.shouldDrawPointsForLine(t):!0}function Rh(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function Eh(e,t,n){const{config:i,scale:a}=e,s=a.zoom||a.x,o=e.getYScaleById(t.id),r=i.line_connectNull?e.filterRemoveNull(t.values):t.values;let l=e.isAreaRangeType(t)?r.map(g=>Io(Do({},g),{value:e.getRangedData(g,"mid")})):r;e.isStepType(t)&&(l=e.convertValuesToStep(l));const c=Rd(e,l,s,o,i.data_regions[t.id]);let d=null,u=[];const h=()=>{if(u.length<2||!d){u=[];return}n.strokePath(g=>{const[p,..._]=u;g.moveTo(p[0],p[1]),_.forEach(x=>{g.lineTo(x[0],x[1])})},{lineDash:d}),u=[]},f=(g,p,_)=>{!d||!Rh(d,_)?(h(),d=_,u=[g,p]):u.push(p)};for(const{start:g,end:p,dash:_,isBreak:x}of c){if(x||!g||!p||!_){h(),d=null;continue}if(!yt(g[0],g[1])||!yt(p[0],p[1])){h(),d=null;continue}f(g,p,_)}h()}class Ph{constructor(t,n){bn(this,"engine",t),bn(this,"theme",n),bn(this,"painter"),bn(this,"labelImageCache",new Map),bn(this,"backgroundImageCache",new Map),bn(this,"backgroundClassStyleCache",new Map),this.painter=new Hs(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}destroy(){const t=n=>{n.image.onload=null,n.image.onerror=null};this.labelImageCache.forEach(t),this.backgroundImageCache.forEach(t),this.labelImageCache.clear(),this.backgroundImageCache.clear(),this.backgroundClassStyleCache.clear()}getLabelImage(t,n){if(!t||!N.Image)return null;let i=this.labelImageCache.get(t);if(!i){const a={image:new N.Image,loaded:!1,loading:!0};i=a,this.labelImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.redraw)==null||s.call(n)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundImage(t,n){if(!t||!N.Image)return null;let i=this.backgroundImageCache.get(t);if(!i){const a={image:new N.Image,loaded:!1,loading:!0};i=a,this.backgroundImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.renderCanvasFrame)==null||s.call(n,void 0,null,!1)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundClassStyle(t,n){if(!n||!N.document)return{};const i=this.backgroundClassStyleCache.get(n);if(i)return i;const a=N.document.createElement("div");a.className=n,a.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:1px;height:1px;",t.$el.chart.node().appendChild(a);const s=N.getComputedStyle(a),o=parseFloat(s.opacity),r={opacity:Number.isFinite(o)?o:void 0,transform:s.transform||void 0};return a.remove(),this.backgroundClassStyleCache.set(n,r),r}drawBackground(t){const n=t.config.background;if(!(n!=null&&n.imgUrl)&&!(n!=null&&n.color))return;const{ctx:i,painter:a}=this,{current:s,margin:o,width:r,height:l}=t.state,c=this.getBackgroundClassStyle(t,n.class);a.withState(()=>{if(c.opacity!==void 0&&(i.globalAlpha*=c.opacity),n.imgUrl){const d=this.getBackgroundImage(n.imgUrl,t);if(d!=null&&d.loaded){const u=vh(t),h=mh(d.image,s.width,s.height);i.translate(u.x,u.y),Oo(i,c.transform),i.drawImage(d.image,h.x,h.y,h.w,h.h)}}else n.color&&(Oo(i,c.transform),a.fillRect({x:o.left,y:o.top,w:r,h:l},{fill:n.color}))})}drawLabelImage(t,n,i,a,s){const o=Xd(t,n);if(!(o!=null&&o.url))return{x:a,y:s};const r=Gd(o,n),l=Vd(t,o,i,a,s,n),c=this.getLabelImage(r,t);return c!=null&&c.loaded&&this.ctx.drawImage(c.image,l.x,l.y,o.width,o.height),{x:l.textX,y:l.textY}}drawDataLabel(t,n,i,a,s){const{painter:o,theme:{style:r}}=this;if({x:a,y:s}=this.drawLabelImage(t,n,i,a,s),t.config.data_labels.rotate){const l=Ud(t,n,a,s);a=l.x,s=l.y,this.ctx.textAlign=l.textAlign}this.ctx.fillStyle=To(t,n,r.label.color),wo(t,o,n,i,a,s),o.textLines(i,a,s,{angle:t.config.data_labels.rotate})}drawFocusLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,theme:{style:s}}=this,o=n.filter(l=>l&&Rt(t,l)&&fe(t,l)&&Pe(t,{id:l.id})),r={size:()=>o.length};o.length&&(a.font=s.label.font,o.forEach(l=>{const c=bo(t,l);let{x:d,y:u}=zn(t,l);c&&({x:d,y:u}=Co(t,a,l,d,u),d+=vi(t,l,"x",r),u+=vi(t,l,"y",r),yt(d,u)&&this.drawDataLabel(t,l,c,d,u))}))}draw(t,n,i){if(t.state.hasTreemap){this.drawTreemaps(t);return}const{margin:a,width:s,height:o}=t.state,r=()=>{t.config.area_front||this.drawAreas(t,n,i),this.drawLines(t,n),t.config.area_front&&this.drawAreas(t,n,i),this.drawCircles(t,n,i)},l=()=>{t.config.bar_front||this.drawBars(t,n,i),this.drawCandlesticks(t,n,i),r(),t.config.bar_front&&this.drawBars(t,n,i),this.drawSelections(t,n),this.drawLabels(t,n)};t.config.clipPath===!1?l():this.painter.clipRect({x:a.left,y:a.top,w:s,h:o},l)}drawSubchart(t,n){const{config:i,state:a}=t;if(!i.subchart_show||!a.hasAxis||a.width2<=0||a.height2<=0)return;const{ctx:s,painter:o,theme:{style:r}}=this,{margin2:l,width2:c,height2:d}=a,u={x:l.left,y:l.top,w:c,h:d};t.withSubchartTypeContext(()=>{var h;const f=t.filterTargetsToShow().filter(Pe.bind(null,t)),g=t.getDrawShape();(h=t.updateSubchartYDomain)==null||h.call(t,f),o.withState(()=>{o.clipRect(u,()=>{o.withTranslation(u.x,u.y,()=>{var p,_,x,m,b,v;const y=f.filter(Mn.bind(null,t)),T=te(t,g,O.AREA,Mn.bind(null,t));for(const R of y)R.values.some(Rt.bind(null,t))&&(s.globalAlpha=r.shape.areaOpacity*ye(t,R),s.fillStyle=t.color(R.id),Bo(t,R,T,o,!0));s.globalAlpha=1;const w=f.filter(ee.bind(null,t)),C=te(t,g,O.BAR,ee.bind(null,t)),A=(p=t.generateGetBarPoints)==null?void 0:p.call(t,C,!0);if(A){for(const R of w)s.globalAlpha=r.shape.barOpacity*ye(t,R),s.fillStyle=t.color(R.id),R.values.forEach((P,B)=>{var I;if(!Rt(t,P))return;const X=Nn(t,A,P,B),G=((I=t.getSubchartCandlestickBarColor)==null?void 0:I.call(t,P,!0))||s.fillStyle;X&&o.fillRect(X.rect,{fill:G})});s.globalAlpha=1}const S=f.filter(Wt.bind(null,t)),k=te(t,g,O.CANDLESTICK,Wt.bind(null,t)),L=(_=t.generateGetCandlestickPoints)==null?void 0:_.call(t,k,!0);if(L){s.lineWidth=r.shape.candlestickLineWidth;for(const R of S){const P=ye(t,R);s.globalAlpha=P,R.values.forEach((B,I)=>{var X;const G=(X=t.getCandlestickData)==null?void 0:X.call(t,B),Z=G&&Xn(t,L,B,I);if(!Z)return;const et=Vo(t,{id:R.id},G);s.strokeStyle=et,s.fillStyle=et,o.strokePath(()=>{o.traceLine(Z.wickStart[0],Z.wickStart[1],Z.wickEnd[0],Z.wickEnd[1])}),o.fillRect(Z.body,{fill:s.fillStyle})})}}const E=f.filter(xn.bind(null,t)),D=te(t,g,O.LINE,xn.bind(null,t));s.globalAlpha=1;for(const R of E)R.values.some(Rt.bind(null,t))&&(s.globalAlpha=ye(t,R),s.lineWidth=Xo(t,R)?r.shape.lineFocusedWidth:r.shape.lineWidth,s.strokeStyle=t.color(R.id),$o(t,R,D,o,!0));if(s.globalAlpha=1,i.point_show&&!((x=t.isPointFocusOnly)!=null&&x.call(t))){const R=(m=t.updateCircleY)==null?void 0:m.call(t,!0),P=(b=t.subxx)==null?void 0:b.bind(t);if(P&&R){for(const B of f){if(!Ve(t,B)&&!We(t,B))continue;const I=t.color(B.id),X=r.shape.pointFillColor||I,G=r.shape.pointStrokeColor||I,Z=G?(v=r.shape.pointLineWidth)!=null?v:1:0,et=G&&Z>0?{fill:X,stroke:G,lineWidth:Z}:{fill:X};s.globalAlpha=Ti(t,B)*ye(t,B),B.values.forEach((rt,xt)=>{if(!Rt(t,rt))return;const gt=i.axis_rotated?R(rt,xt):P(rt),Tt=i.axis_rotated?P(rt):R(rt,xt),_t=Math.min(Yn(t,B,rt),3);yt(gt,Tt)&&Vn(o,"circle",gt,Tt,_t,et)})}s.globalAlpha=1}}})}),this.drawSubchartBrush(t)})})}drawSubchartBrush(t){var n,i;const{config:a,scale:s,state:o}=t,r=o.domain;if(!a.subchart_show||a.subchart_brush_enabled===!1||!(r!=null&&r.length)||!s.subX)return;const{margin2:l,width2:c,height2:d}=o,u=s.subX(r[0]),h=s.subX(r[1]),f=a.axis_rotated?d:c,g=(i=(n=t.axis)==null?void 0:n.getExtent)==null?void 0:i.call(n),p=Array.isArray(g)&&g.length>=2&&g.every(Number.isFinite)?g.slice(0,2):[0,f],_=Math.max(0,Math.min(f,Math.min(...p))),x=Math.max(0,Math.min(f,Math.max(...p))),m=Math.max(_,Math.min(x,Math.min(u,h))),b=Math.max(_,Math.min(x,Math.max(u,h))),v=b-m;if(v<=0)return;const y=a.axis_rotated?{x:l.left,y:l.top+m,w:c,h:v}:{x:l.left+m,y:l.top,w:v,h:d};this.painter.fillRect(y,{fill:this.theme.style.subchartBrush.fill,alpha:this.theme.style.subchartBrush.opacity}),a.subchart_showHandle&&(this.drawSubchartBrushHandle(t,m,"start"),this.drawSubchartBrushHandle(t,b,"end"))}drawSubchartBrushHandle(t,n,i){const{config:a,state:{margin2:s,width2:o,height2:r}}=t,{ctx:l,painter:c,theme:{style:d}}=this,u=a.axis_rotated,h=d.subchartBrush.handleFill,f=d.subchartBrush.handleStroke,g=u?s.left+o/2:s.left+n,p=u?s.top+n:s.top+r/2,_=bh(u?"y":"x",i);_&&c.withState(()=>{l.translate(g,p),l.fillStyle=h,l.strokeStyle=f,l.lineWidth=d.subchartBrush.handleLineWidth,l.globalAlpha=d.subchartBrush.handleOpacity,l.fill(_),l.globalAlpha=1,l.stroke(_)})}drawBars(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=ee.bind(null,t),l=ya(t,i,ee),c=t.filterTargetsToShow().filter(r).filter(Pe.bind(null,t)),d=t.generateGetBarPoints(te(t,n,O.BAR,r),!1),{margin:u}=t.state,h=_i(t),f=h?ma(t):new Set;d&&s.withTranslation(u.left,u.top,()=>{var g;for(const p of c){const _=ke(t,p),x=Ch(t,p.id),m=ye(t,p),b=[],v=[];for(let y=_.start;y<_.end;y++){const T=p.values[y];if(!Rt(t,T))continue;const w=Nn(t,d,T,y);if(!w)continue;const{points:C,rect:A}=w,S=va(t,T,C,h,f,(g=t.isStackingRadiusData)==null?void 0:g.bind(t));v.push({d:T,points:C,rect:A,radiusInfo:S}),x&&b.push(Sh(t,C,S))}x&&o.shape.barConnectLineWidth>0&&Ah(t,s,x,b,m);for(const{d:y,rect:T,radiusInfo:w}of v){const C=Wn(t,Aa(i,y)),A=C||t.color(p.id),k=(l(y)?o.shape.barExpandedOpacity:o.shape.barOpacity)*m;a.fillStyle=C?A:Go(t,a,p,"bar",T,A),h?s.fillRoundRect(T,w.corners,{alpha:k}):s.fillRect(T,{alpha:k}),o.shape.barLineWidth>0&&(a.strokeStyle=o.shape.barStrokeColor,a.lineWidth=o.shape.barLineWidth,h?s.strokeRoundRect(T,w.corners,{alpha:o.shape.barOpacity*m}):s.strokeRect(T,{alpha:o.shape.barOpacity*m}))}}})}drawCandlesticks(t,n,i){var a;const{ctx:s,painter:o,theme:{style:r}}=this,l=Wt.bind(null,t),c=ya(t,i,Wt),d=t.filterTargetsToShow().filter(l).filter(Pe.bind(null,t)),u=(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,te(t,n,O.CANDLESTICK,l),!1),{margin:h}=t.state;u&&o.withTranslation(h.left,h.top,()=>{var f;s.lineWidth=r.shape.candlestickLineWidth;for(const g of d){const p=ke(t,g),_=ye(t,g),x=r.shape.candlestickLineWidth,m=r.shape.candlestickStrokeColor||"#000";for(let b=p.start;b<p.end;b++){const v=g.values[b],y=(f=t.getCandlestickData)==null?void 0:f.call(t,v);if(!y)continue;const T=Xn(t,u,v,b);if(!T)continue;const{body:w,wickStart:C,wickEnd:A}=T;s.fillStyle=Wn(t,Aa(i,v))||Vo(t,v,y),s.strokeStyle=m,s.globalAlpha=_,x>0&&o.strokePath(()=>{o.traceLine(C[0],C[1],A[0],A[1])}),o.fillRect(w,{alpha:(c(v)?r.shape.candlestickExpandedOpacity:1)*_}),x>0&&o.strokeRect(w,{alpha:_,lineWidth:x,stroke:m})}}s.globalAlpha=1})}hasExpandedShapeFocus(t,n){return!!(n!=null&&n.some(i=>i&&(ee(t,i)||Wt(t,i))))}drawLines(t,n){const{ctx:i,painter:a,theme:{style:s}}=this,o=xn.bind(null,t),r=t.filterTargetsToShow().filter(o).filter(Pe.bind(null,t)),l=te(t,n,O.LINE,o),{margin:c}=t.state;t.generateGetLinePoints&&a.withTranslation(c.left,c.top,()=>{var d;for(const u of r){const h=zo(t,u);h.values.some(Rt.bind(null,t))&&(i.globalAlpha=ye(t,u),i.lineWidth=Xo(t,u)?s.shape.lineFocusedWidth:s.shape.lineWidth,i.strokeStyle=t.color(u.id),(d=t.config.data_regions)!=null&&d[h.id]?Eh(t,h,a):$o(t,h,l,a))}i.globalAlpha=1})}drawAreas(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=Mn.bind(null,t),l=t.filterTargetsToShow().filter(r).filter(Pe.bind(null,t)),c=te(t,n,O.AREA,r),{margin:d}=t.state;t.generateGetAreaPoints&&s.withTranslation(d.left,d.top,()=>{for(const u of l){const h=zo(t,u);if(!h.values.some(Rt.bind(null,t)))continue;const f=yh(t,h,i);a.globalAlpha=o.shape.areaOpacity*ye(t,u),a.fillStyle=Go(t,a,h,"area",t.config.area_linearGradient?Th(t,u,c):null,f),Bo(t,h,c,s)}a.globalAlpha=1})}drawCircles(t,n,i){var a;if(!t.config.point_show||(a=t.isPointFocusOnly)!=null&&a.call(t))return;const{ctx:s,painter:o,theme:{style:r}}=this,{cx:l,cy:c}=n.pos,{margin:d}=t.state,u=ya(t,i,fe),h=!!(i!=null&&i.some(f=>f&&fe(t,f)));!l||!c||o.withTranslation(d.left,d.top,()=>{var f,g,p;for(const _ of t.filterTargetsToShow()){if(!fe(t,_)||!Pe(t,_)||xn(t,_)&&!Lh(t,_))continue;const x=t.color(_.id),m=ka(t,_),b=ye(t,_),v=!!t.config.point_radialGradient,y=wh(t,_,m,v),T=ke(t,_),w=T.end-T.start,C=y?Os(t.state.width,t.state.height,Yn(t,_,_.values[T.start]||_.values[0])):null,A=Ti(t,_)*b;s.fillStyle=x,s.globalAlpha=A;const S=r.shape.pointFillColor||x,k=r.shape.pointStrokeColor||x,L=k?(f=r.shape.pointLineWidth)!=null?f:1:0,E=!!k&&L>0,D=E&&m==="circle"&&$(A)&&A<1&&S===k;if(!h&&!v&&m==="circle")if(s.fillStyle=S,E&&!D&&(s.strokeStyle=k,s.lineWidth=L),w>xh)for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=Yn(t,_,P),I=D?B+L/2:B,X=l(P,R),G=c(P,R);yt(X,G)&&(C&&!$s(C,X,G)||(s.beginPath(),s.arc(X,G,I,0,Math.PI*2),s.fill(),E&&!D&&s.stroke()))}else{s.beginPath();for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=Yn(t,_,P),I=D?B+L/2:B,X=l(P,R),G=c(P,R);yt(X,G)&&o.traceCircle(X,G,I)}s.fill(),E&&!D&&s.stroke()}else for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=u(P),I=Yn(t,_,P),X=B?(p=(g=t.pointExpandedR)==null?void 0:g.call(t,P))!=null?p:I*1.75:I,G=l(P,R),Z=c(P,R),et=Wn(t,P),rt=et||x,xt=r.shape.pointFillColor||rt,gt=r.shape.pointStrokeColor||rt,Tt=B&&(et||r.focusPoint.fill)||xt,_t=B?et||r.focusPoint.stroke||rt:gt,mt=B?r.focusPoint.lineWidth:L,Pt=Ti(t,P)*b,Dt=!!_t&&(mt!=null?mt:0)>0,Lt=m==="circle"&&Dt&&$(Pt)&&Pt<1&&Tt===_t,$e=Lt?X+(mt||0)/2:X;yt(G,Z)&&(s.fillStyle=v?kh(t,s,P,G,Z,X,rt):Tt,s.globalAlpha=Pt,Vn(o,m,G,Z,$e,Dt&&!Lt?{fill:s.fillStyle,stroke:_t,lineWidth:mt}:void 0,I))}}})}drawSelections(t,n){var i,a;const s=(i=t.getCanvasSelectedData)==null?void 0:i.call(t);if(!t.config.data_selection_enabled||!(s!=null&&s.length)||t.state.hasTreemap)return;const{ctx:o,painter:r,theme:{style:l}}=this,{margin:c}=t.state,d=ee.bind(null,t),u=Wt.bind(null,t),h=s.some(d)?t.generateGetBarPoints(te(t,n,O.BAR,d),!1):null,f=s.some(u)?(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,te(t,n,O.CANDLESTICK,u),!1):null,g=h?_i(t):null,p=g?ma(t):new Set;r.withTranslation(c.left,c.top,()=>{s.forEach(_=>{var x,m,b,v,y,T,w;const C=t.color(_.id);if(d(_)&&h){const A=Nn(t,h,_,_.index);if(!A)return;const{points:S,rect:k}=A,L=g?va(t,_,S,g,p).corners:0;g?r.fillRoundRect(k,L,{fill:"#fff",alpha:.3}):r.fillRect(k,{fill:"#fff",alpha:.3}),g?r.strokeRoundRect(k,L,{stroke:C,lineWidth:2}):r.strokeRect(k,{stroke:C,lineWidth:2})}else if(u(_)&&f){if(!((x=t.getCandlestickData)==null?void 0:x.call(t,_)))return;const S=Xn(t,f,_,_.index);if(!S)return;const{body:k,wickStart:L,wickEnd:E}=S;r.strokePath(()=>{r.traceLine(L[0],L[1],E[0],E[1])},{stroke:C,lineWidth:3}),r.fillRect(k,{fill:"#fff",alpha:.3}),r.strokeRect(k,{stroke:C,lineWidth:2})}else if(fe(t,_)){const A=ka(t,{id:_.id}),{x:S,y:k}=zn(t,_),L=(b=(m=t.pointR)==null?void 0:m.call(t,_))!=null?b:2.5,E=(y=(v=t.pointSelectR)==null?void 0:v.call(t,_))!=null?y:L*2;if(!yt(S,k))return;Vn(r,"circle",S,k,E,{fill:l.selectedPoint.fill,lineWidth:l.selectedPoint.lineWidth,stroke:l.selectedPoint.stroke||C}),(T=t.isPointFocusOnly)!=null&&T.call(t)||Vn(r,A,S,k,L,{fill:l.shape.pointFillColor||C,stroke:l.shape.pointStrokeColor||C,lineWidth:(w=l.shape.pointLineWidth)!=null?w:1})}}),o.globalAlpha=1})}drawLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,painter:s,theme:{style:o}}=this,{margin:r}=t.state,{cx:l,cy:c}=n.pos,d=n.indices[O.BAR]?t.generateGetBarPoints(n.indices[O.BAR],!1):null,u=t.generateGetCandlestickPoints?t.generateGetCandlestickPoints(te(t,n,O.CANDLESTICK,Wt.bind(null,t)),!1):null,h=t.filterTargetsToShow().filter(_=>(ee(t,_)||fe(t,_)||Mn(t,_)||Wt(t,_))&&Pe(t,_)),f=[];let g=0;h.forEach(_=>{const x=ke(t,_),m=t.labelishData(_),b=[];for(let v=0;v<m.length;v++){const y=m[v],T=bo(t,y);T&&y.index>=x.start&&y.index<x.end&&Rt(t,y)&&b.push({d:y,text:T})}g+=b.length,b.length&&f.push(b)});const p={size:()=>g};s.withTranslation(r.left,r.top,()=>{a.font=o.label.font,a.textAlign="center",f.forEach(_=>{var x,m;for(const{d:b,text:v}of _){let y,T;if(ee(t,b)&&d){const w=Nn(t,d,b,b.index);if(!w)continue;const{points:C,rect:A}=w,S=t.getBaseValue(b),k=xi(t,C[2]),L=S<0,E=Ta(a,v,0,0).h;y=t.config.axis_rotated&&!t.config.data_labels.centered?k[0]+(L?-4:4):A.x+A.w/2,T=t.config.data_labels.centered||t.config.axis_rotated?A.y+A.h/2:k[1]+(L?E-3:-3),a.textAlign=t.config.axis_rotated&&!t.config.data_labels.centered?L?"right":"left":"center",a.textBaseline=t.config.data_labels.centered||t.config.axis_rotated?"middle":"alphabetic"}else if(Wt(t,b)&&u){const w=(x=t.getCandlestickData)==null?void 0:x.call(t,b),C=Xn(t,u,b,b.index),A=w==null?void 0:w._isUp;if(!C)continue;const{wickEnd:S,wickStart:k}=C,L=t.config[`axis_${(m=t.axis)==null?void 0:m.getId(b.id)}_inverted`];y=t.config.axis_rotated?A?S[0]+4:k[0]-4:k[0],T=t.config.axis_rotated?k[1]+3:A?S[1]-3:k[1]+12,!t.config.axis_rotated&&L&&(T+=15*(A?1:-1)),a.textAlign=t.config.axis_rotated?A?"left":"right":"center",a.textBaseline="alphabetic"}else l&&c&&({x:y,y:T}=Ed(n.pos,b,b.index),{x:y,y:T}=Co(t,a,b,y,T));y+=vi(t,b,"x",p),T+=vi(t,b,"y",p),yt(y,T)&&this.drawDataLabel(t,b,v,y,T)}})})}drawEmptyLabel(t){const n=t.config.data_empty_label_text,i=t.filterTargetsToShow();if(!n||i.length)return;const{margin:a,width:s,height:o}=t.state,{style:r}=this.theme;this.painter.text(String(n),a.left+s/2,a.top+o/2,{fill:r.emptyLabel.color,font:r.emptyLabel.font,textAlign:"center",textBaseline:"middle"})}drawZoomBrush(t,n,i){const{axis_rotated:a}=t.config,{height:s,margin:o,width:r}=t.state,l=Math.min(n,i),c=Math.abs(i-n),d=a?{x:o.left,y:o.top+l,w:r,h:c}:{x:o.left+l,y:o.top,w:c,h:s};c<=0||this.painter.fillRect(d,{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawSelectionDragArea(t,n){const{margin:i,width:a,height:s}=t.state,o={x:i.left,y:i.top,w:a,h:s},r=Math.max(o.x,n.x),l=Math.max(o.y,n.y),c=Math.min(o.x+o.w,n.x+n.w),d=Math.min(o.y+o.h,n.y+n.h);c<=r||d<=l||this.painter.fillRect({x:r,y:l,w:c-r,h:d-l},{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawTreemaps(t){var n;const{ctx:i,painter:a,theme:{style:s}}=this,{config:o}=t,r=(n=t.getTreemapRoot)==null?void 0:n.call(t,t.data.targets),l=(r==null?void 0:r.children)||[];a.withState(()=>{var c;i.lineWidth=s.treemap.lineWidth,i.strokeStyle=s.treemap.stroke;for(const d of l){const{data:u}=d;if(!Qi(t,u))continue;const{x:h,y:f,w:g,h:p}=vn(t,d,r,!0);if(!yt(h,f)||!yt(h+g,f+p)||g<=0||p<=0)continue;const _={x:h,y:f,w:g,h:p};if(i.fillStyle=t.color(u.name),a.fillRect(_),a.strokeRect(_),!o.treemap_label_show||(u.ratio||0)<(o.treemap_label_threshold||0))continue;const x=Dd(t,u,g,p);if(!x)continue;const m=x.split(`
17
- `),b=!!o.data_labels.centered;i.font=s.label.font;const v=he(i.font),y=i.measureText((c=m[0])!=null?c:""),T=(y.fontBoundingBoxAscent||0)+(y.fontBoundingBoxDescent||0)||(y.actualBoundingBoxAscent||0)+(y.actualBoundingBoxDescent||0),w=Math.max(v,T)+(m.length-1)*v,C=b?f+p/2:f+w+5;let A=b?h+g/2:h+5,S=C-(m.length-1)*v/(b?2:1);i.textAlign=b?"center":"left",i.textBaseline=b?"middle":"alphabetic",{x:A,y:S}=this.drawLabelImage(t,u,x,A,S),i.fillStyle=To(t,u,s.label.color),wo(t,a,u,x,A,b?S+(m.length-1)*v/2:C),m.forEach((k,L)=>{a.text(k,A,S+L*v,{maxWidth:Math.max(0,g-8)})})}})}drawSubchartFocus(t,n){const{config:i,scale:a,state:s}=t,o=n==null?void 0:n.find(_=>_&&Rt(t,_));if(!o||!i.subchart_show||i.subchart_grid_focus_continuous||i.subchart_brush_enabled!==!1||i.grid_focus_show===!1||i.subchart_grid_focus===!1||!i.tooltip_show||i.axis_tooltip||!a.subX||s.width2<=0||s.height2<=0)return;const{margin2:r,width2:l,height2:c}=s,d=a.subX(o.x);if(!Number.isFinite(d))return;const{painter:u,theme:{style:h}}=this,f=h.axis.lineWidth,g=u.crisp(r.left+d,f),p=u.crisp(r.top+d,f);u.strokePath(()=>{i.axis_rotated?u.traceLine(r.left,p,r.left+l,p):u.traceLine(g,r.top,g,r.top+c)},{lineDash:h.focusGrid.dashArray,lineWidth:h.focusGrid.lineWidth,stroke:h.focusGrid.lineColor})}drawFocus(t,n){if(!(n!=null&&n.length))return;const{painter:i}=this,{style:a}=this.theme,{margin:s}=t.state,o=n.find(r=>r&&Rt(t,r));t.config.subchart_grid_focus!==!1&&!_a(t)&&this.drawSubchartFocus(t,n),i.withTranslation(s.left,s.top,()=>{if(t.config.tooltip_show&&t.config.grid_focus_show!==!1&&!t.config.axis_tooltip&&o){const{x:r,y:l}=zn(t,o),c=a.axis.lineWidth,d=t.config.axis_rotated,u=Number.isFinite(d?l:r),h=Number.isFinite(d?r:l),f=b=>i.crisp(s.left+b,c)-s.left,g=b=>i.crisp(s.top+b,c)-s.top,p=t.config.grid_focus_edge&&!t.config.tooltip_grouped,_=_a(t),x=_?t.state.margin2.left-s.left+t.state.width2:t.state.width,m=_?t.state.margin2.top-s.top+t.state.height2:t.state.height;u&&i.strokePath(()=>{var b,v;if(d){if(i.traceLine(f(0),l,p&&h?r:f(x),l),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const y=((b=t.axis)==null?void 0:b.getId(o.id))==="y2";i.traceLine(r,p&&!y?l:g(0),r,p&&y?l:g(t.state.height))}}else if(i.traceLine(r,p&&h?l:g(0),r,g(m)),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const y=((v=t.axis)==null?void 0:v.getId(o.id))==="y2";i.traceLine(p&&y?r:f(0),l,p&&!y?r:f(t.state.width),l)}},{lineDash:a.focusGrid.dashArray,lineWidth:a.focusGrid.lineWidth,stroke:a.focusGrid.lineColor})}t.config.point_show&&!t.state.canvasFocusMainRedraw&&n.filter(r=>r&&Rt(t,r)&&fe(t,r)&&Pe(t,{id:r.id})).forEach(r=>{var l,c,d,u;const h=ka(t,{id:r.id}),{x:f,y:g}=zn(t,r),p=(c=(l=t.pointR)==null?void 0:l.call(t,r))!=null?c:2.5,_=(u=(d=t.pointExpandedR)==null?void 0:d.call(t,r))!=null?u:p*1.75,x=Wn(t,r),m=x||t.color(r.id),b=x||a.focusPoint.fill||a.shape.pointFillColor||m,v=x||a.focusPoint.stroke||m,y=a.focusPoint.lineWidth,T=Ti(t,r),w=!!v&&(y!=null?y:0)>0,C=h==="circle"&&w&&$(T)&&T<1&&b===v;yt(f,g)&&Vn(i,h,f,g,C?_+(y||0)/2:_,w&&!C?{fill:b,lineWidth:y,stroke:v,alpha:T}:{fill:b,alpha:T},p)}),this.drawFocusLabels(t,n)})}}var Dh=Object.defineProperty,Wo=Object.getOwnPropertySymbols,Ih=Object.prototype.hasOwnProperty,Mh=Object.prototype.propertyIsEnumerable,Fh=(e,t,n)=>t in e?Dh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oh=(e,t)=>{var n={};for(var i in e)Ih.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&Wo)for(var i of Wo(e))t.indexOf(i)<0&&Mh.call(e,i)&&(n[i]=e[i]);return n},Hn=(e,t,n)=>Fh(e,typeof t!="symbol"?t+"":t,n);const Te="http://www.w3.org/2000/svg";function Y(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:"");return Number.isFinite(n)?n:t}function on(e,t){const n=Y(e.opacity,1),i=Y(e["fill-opacity"],1),a=n*i;return Number.isFinite(a)?a:t}function K(e,t){const n=e==null?void 0:e.trim();return n&&!/^(none|transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i.test(n)?n:t}function yn(e,t){const n=K(e,""),i=t?K(t,""):"";return n&&n!==i?n:void 0}function Tn(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:""),i=typeof t=="number"?t:parseFloat(t!=null?t:"");return Number.isFinite(n)&&(!Number.isFinite(i)||n!==i)?n:void 0}function jn(e){return Array.isArray(e)?e.filter(t=>Number.isFinite(t)&&t>0):(e||"").split(/[,\s]+/).map(t=>parseFloat(t)).filter(t=>Number.isFinite(t)&&t>0)}function $h(e,t){const n=e.getPropertyValue("font").trim();if(n)return n;const i=e.getPropertyValue("font-size").trim(),a=e.getPropertyValue("font-family").trim();if(!i||!a)return t;const s=e.getPropertyValue("font-style").trim(),o=e.getPropertyValue("font-variant").trim(),r=e.getPropertyValue("font-weight").trim(),l=e.getPropertyValue("line-height").trim(),c=l&&l!=="normal"?`${i}/${l}`:i;return[s&&s!=="normal"?s:"",o&&o!=="normal"?o:"",r&&!/^(normal|400)$/.test(r)?r:"",c,a].filter(Boolean).join(" ")}function we(e,t){var n;const i=t.replace(/-([a-z])/g,(a,s)=>s.toUpperCase());return(n=e[t])!=null?n:e[i]}function it(e,t){const n=we(e,t);return(n==null?"":K(String(n),""))||void 0}function Ft(e,t){const n=we(e,t),i=typeof n=="number"?n:parseFloat(String(n!=null?n:""));return Number.isFinite(i)?i:void 0}function je(e){const t=Ft(e,"opacity"),n=Ft(e,"fill-opacity");return t===void 0&&n===void 0?void 0:(t!=null?t:1)*(n!=null?n:1)}function La(e){const t=we(e,"stroke-dasharray"),n=t==null?[]:jn(t);return n.length?n:void 0}function ne(e){var t,n,i,a;const s=we(e,"font");if(s!=null&&String(s).trim())return String(s).trim();const o=we(e,"font-size"),r=we(e,"font-family");if(o==null||r==null)return;const l=String(o).trim(),c=String(r).trim();if(!l||!c)return;const d=String((t=we(e,"font-style"))!=null?t:"").trim(),u=String((n=we(e,"font-variant"))!=null?n:"").trim(),h=String((i=we(e,"font-weight"))!=null?i:"").trim(),f=String((a=we(e,"line-height"))!=null?a:"").trim();return[d&&d!=="normal"?d:"",u&&u!=="normal"?u:"",h&&!/^(normal|400)$/.test(h)?h:"",f&&f!=="normal"?`${l}/${f}`:l,c].filter(Boolean).join(" ")}function st(e,t,n){var i;const a=Object.keys(n).reduce((s,o)=>(n[o]!==void 0&&(s[o]=n[o]),s),{});Object.keys(a).length&&(e[t]=Ae((i=e[t])!=null?i:{},a))}function Yo(e){return e.split(",").map(t=>t.trim().replace(/\s*>\s*/g," ").replace(/\s+/g," ").replace(/^(?:svg)?\.bb\s+/,"").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g,"$1.")).filter(Boolean)}function Ra(e){return Object.keys(e).filter(t=>e[t]!==void 0)}function Ho(e,t,n){return Ra(t).forEach(i=>{n!=null&&n.has(i)||(e[i]=t[i])}),e}function jo(e){const t=e.split(" ");return t.every((n,i)=>n==="line"||n==="text"?i===t.length-1:/^(\.[A-Za-z_-][\w-]*)+$/.test(n))}function Uo(e){const t=e.split(" "),n=t[t.length-1];return n==="line"||n==="text"?n:null}function Bh(e){return(e||"").split(/\s+/).filter(Boolean)}function zh(e,t){const n=t==="text"?{labelColor:it(e,"fill"),labelFont:ne(e)}:{lineColor:it(e,"stroke"),lineWidth:Ft(e,"stroke-width"),dashArray:La(e)};return Ho({},n)}function Nh(e){const t=[];return Object.keys(e!=null?e:{}).forEach(n=>{Yo(n).forEach(i=>{const a=Uo(i)||"line",s=zh(e[n],a);jo(i)&&Ra(s).length&&t.push({selector:i,target:a,style:s})})}),t}function Xh(e,t,n,i){if(!jo(e))return!1;const a=Uo(e);if(a&&a!==i)return!1;if(!a&&i==="text")return!1;const s=Bh(n),o=`bb-${t}grid-line`,r=new Set(["bb-grid","bb-grid-lines",`bb-${t}grid-lines`,o,...s]),l=(e.match(/\.[A-Za-z_-][\w-]*/g)||[]).map(c=>c.slice(1));return!!l.length&&l.every(c=>r.has(c))&&(l.includes(o)||s.some(c=>l.includes(c)))}function Gh(e,t,n){switch(t){case".bb-axis path.domain":case".bb-axis .domain":case".bb-axis-x path.domain":case".bb-axis-x .domain":case".bb-axis-y path.domain":case".bb-axis-y .domain":case".bb-axis-y2 path.domain":case".bb-axis-y2 .domain":st(e,"axis",{lineColor:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-axis line":case".bb-axis .tick line":case".bb-axis-x line":case".bb-axis-x .tick line":case".bb-axis-y line":case".bb-axis-y .tick line":case".bb-axis-y2 line":case".bb-axis-y2 .tick line":st(e,"axis",{tickColor:it(n,"stroke"),tickWidth:Ft(n,"stroke-width")});break;case".bb-axis text":case".bb-axis .tick text":{const i=ne(n);st(e,"axis",{labelColor:it(n,"fill"),xTickFont:i,yTickFont:i,y2TickFont:i});break}case".bb-axis-x text":case".bb-axis-x .tick text":st(e,"axis",{labelColor:it(n,"fill"),xTickFont:ne(n)});break;case".bb-axis-y text":case".bb-axis-y .tick text":st(e,"axis",{labelColor:it(n,"fill"),yTickFont:ne(n)});break;case".bb-axis-y2 text":case".bb-axis-y2 .tick text":st(e,"axis",{labelColor:it(n,"fill"),y2TickFont:ne(n)});break;case".tick._active_ text":case".bb-axis .tick._active_ text":case".bb-axis-x .tick._active_ text":st(e,"axis",{activeLabelColor:it(n,"fill")});break;case".bb-axis-x-label":case".bb-axis-x .bb-axis-x-label":st(e,"axis",{labelFont:ne(n),xLabelColor:it(n,"fill")});break;case".bb-axis-y-label":case".bb-axis-y .bb-axis-y-label":st(e,"axis",{labelFont:ne(n),yLabelColor:it(n,"fill")});break;case".bb-axis-y2-label":case".bb-axis-y2 .bb-axis-y2-label":st(e,"axis",{labelFont:ne(n),y2LabelColor:it(n,"fill")});break;case".bb-grid line":case".bb-grid .bb-xgrid":case".bb-grid .bb-ygrid":case".bb-xgrid":case".bb-ygrid":st(e,"grid",{lineColor:it(n,"stroke"),lineWidth:Ft(n,"stroke-width"),dashArray:La(n)});break;case".bb-grid text":st(e,"grid",{labelColor:it(n,"fill"),labelFont:ne(n)});break;case".bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus":st(e,"focusGrid",{lineColor:it(n,"stroke"),lineWidth:Ft(n,"stroke-width"),dashArray:La(n)});break;case".bb-region rect":case".bb-region":st(e,"region",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-region text":st(e,"region",{labelColor:it(n,"fill"),labelFont:ne(n)});break;case".bb-bar":st(e,"shape",{barOpacity:je(n),barStrokeColor:it(n,"stroke"),barLineWidth:Ft(n,"stroke-width")});break;case".bb-bar._expanded_":st(e,"shape",{barExpandedOpacity:je(n)});break;case".bb-candlestick":st(e,"shape",{candlestickStrokeColor:it(n,"stroke"),candlestickLineWidth:Ft(n,"stroke-width")});break;case".bb-candlestick._expanded_":st(e,"shape",{candlestickExpandedOpacity:je(n)});break;case".bb-line":st(e,"shape",{barConnectLineColor:it(n,"stroke"),barConnectLineWidth:Ft(n,"stroke-width"),lineWidth:Ft(n,"stroke-width")});break;case".bb-target.bb-focused .bb-line":case".bb-target.bb-focused path.bb-line":st(e,"shape",{lineFocusedWidth:Ft(n,"stroke-width")});break;case".bb-target.bb-defocused":st(e,"shape",{targetDefocusedOpacity:Ft(n,"opacity")});break;case".bb-area":st(e,"shape",{areaOpacity:je(n)});break;case".bb-circle":st(e,"shape",{pointFillColor:it(n,"fill"),pointStrokeColor:it(n,"stroke"),pointLineWidth:Ft(n,"stroke-width")});break;case".bb-selected-circle":st(e,"selectedPoint",{fill:it(n,"fill"),stroke:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-circle._expanded_":st(e,"focusPoint",{fill:it(n,"fill"),stroke:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-zoom-brush":st(e,"zoomBrush",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-brush .extent":case".bb-brush .selection":st(e,"subchartBrush",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-brush .handle--custom":st(e,"subchartBrush",{handleFill:it(n,"fill"),handleOpacity:je(n),handleStroke:it(n,"stroke"),handleLineWidth:Ft(n,"stroke-width")});break;case".bb-chart-treemaps rect":case".bb-chart-treemaps":st(e,"treemap",{stroke:it(n,"stroke"),lineWidth:Ft(n,"stroke-width")});break;case".bb-text.bb-empty":case".bb-text .bb-empty":case".bb-empty":st(e,"emptyLabel",{color:it(n,"fill"),font:ne(n)});break;case".bb-text":st(e,"label",{color:it(n,"fill"),font:ne(n)});break;case".bb-title":st(e,"title",{color:it(n,"fill"),font:ne(n)});break}}function Vh(e){const t={};return Object.keys(e!=null?e:{}).forEach(n=>{Yo(n).forEach(i=>{Gh(t,i,e[n])})}),t}function Wh(e){if(!e)return{};const t=e,{selectors:n}=t,i=Oh(t,["selectors"]);return Ae({},Vh(n),i)}function Ko(e,t){try{return JSON.stringify({className:e.className,style:e.getAttribute("style")||"",override:t||null})}catch(n){return null}}class Yh{constructor(){Hn(this,"style"),Hn(this,"cacheContainer",null),Hn(this,"cacheKey",null),Hn(this,"gridLineSelectorOverrides",[]),Hn(this,"directGridOverrideKeys",new Set)}load(t,n){var i,a,s,o,r;const l=nt.createElementNS(Te,"svg");this.gridLineSelectorOverrides=Nh(n==null?void 0:n.selectors),this.directGridOverrideKeys=new Set(Object.keys((i=n==null?void 0:n.grid)!=null?i:{})),l.setAttribute("class","bb"),l.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden",t.appendChild(l);const c=(Mt,Gt)=>{const jt=N.getComputedStyle(Mt),qt={};for(const Bt of Gt)qt[Bt]=Bt==="font"?$h(jt,""):jt.getPropertyValue(Bt).trim();return qt},d=(Mt,Gt,jt)=>{const qt=nt.createElementNS(Te,Mt);qt.setAttribute("class",Gt),l.appendChild(qt);const Bt=c(qt,jt);return l.removeChild(qt),Bt},u=(Mt,Gt,jt,qt)=>{const Bt=nt.createElementNS(Te,"g"),le=nt.createElementNS(Te,Gt);Bt.setAttribute("class",Mt),jt&&le.setAttribute("class",jt),Bt.appendChild(le),l.appendChild(Bt);const ze=c(le,qt);return l.removeChild(Bt),ze},h=(Mt,Gt,jt,qt,Bt)=>{const le=nt.createElementNS(Te,"g"),ze=nt.createElementNS(Te,"g"),ni=nt.createElementNS(Te,jt);le.setAttribute("class",Mt),ze.setAttribute("class",Gt),qt&&ni.setAttribute("class",qt),ze.appendChild(ni),le.appendChild(ze),l.appendChild(le);const Im=c(ni,Bt);return l.removeChild(le),Im},f=(Mt,Gt,jt,qt="")=>{const Bt=nt.createElementNS(Te,"g"),le=nt.createElementNS(Te,"g"),ze=nt.createElementNS(Te,Gt);Bt.setAttribute("class",`bb-axis ${Mt}`),le.setAttribute("class",["tick",qt].filter(Boolean).join(" ")),ze.textContent=Gt==="text"?"0":"",le.appendChild(ze),Bt.appendChild(le),l.appendChild(Bt);const ni=c(ze,jt);return l.removeChild(Bt),ni},g="rgb(1, 2, 3)",p=(Mt,Gt)=>{const jt=nt.createElement("style");jt.textContent=`
15
+ `):e.config.axis_x_tick_multiline?Zf(c,r!=null?r:Vi(e,i,s,o),t):[c]}function Hi(e,t){const{isRotated:n,tickCount:a,tickIndex:i,tickRotate:s,tickTextDirection:o}=t,r=e.config.axis_x_tick_text_inner;let l=n?o>0?"left":"right":s?s>0?"left":"right":"center";return!n&&i===0&&(r===!0||r!=null&&r.first)?l="left":!n&&i===a-1&&(r===!0||r!=null&&r.last)&&(l="right"),l}function qf(e,t){var n,a;return((n=e==null?void 0:e.indexOf("center"))!=null?n:-1)>-1?{x:t/2,align:"center"}:((a=e==null?void 0:e.indexOf("right"))!=null?a:-1)>-1?{x:t,align:"right"}:{x:0,align:"left"}}function Qe(e){return Number.isFinite(e)}function Na(e,t,n){return Qe(e)&&e>=Math.min(t,n)&&e<=Math.max(t,n)}function xr(e){return e?-1:1}function Jf(e,t,n){return t?n?e.axis_y2_inner?1:-1:e.axis_y_inner?-1:1:n?e.axis_y2_inner?-1:1:e.axis_y_inner?1:-1}function Yi(e,t,n=ae(e)){return n(Ne(e,t))}function Qf(e,t){var n,a;return(a=(n=e.axis)==null?void 0:n.isCategorized)!=null&&a.call(n)&&typeof t=="string"&&Number.isNaN(Number(t))?e.config.axis_x_categories.indexOf(t):Ne(e,t)}function tg(e,t){var n,a;return!!((a=(n=e.axis)==null?void 0:n.isCategorized)!=null&&a.call(n)&&Number.isNaN(Number(t)))}function mr(e,t,n,a){var i,s;if(t===void 0)return n;let o=ae(e)(Qf(e,t));if(tg(e,t)){const r=ae(e),l=((s=(i=e.axis.x)==null?void 0:i.tickOffset)==null?void 0:s.call(i))||(r(1)-r(0))/2;o+=l*(a==="start"?-1:1)}return o}function vr(e,t,n="y"){return e.scale[n||"y"](aa(e,t,n))}function eg(e,t){const{config:n,scale:a,state:{width:i,height:s}}=e,o=t.axis||"x",r=n.axis_rotated;if(o==="x"){const h=mr(e,t.start,0,"start"),f=mr(e,t.end,r?s:i,"end"),p=Math.min(h,f),g=Math.abs(f-h);return r?{x:0,y:p,w:i,h:g}:{x:p,y:0,w:g,h:s}}if(!a[o])return null;const l=t.start===void 0?r?0:s:vr(e,t.start,o),c=t.end===void 0?r?i:0:vr(e,t.end,o),u=Math.min(l,c),d=Math.abs(c-l);return r?{x:u,y:0,w:d,h:s}:{x:0,y:u,w:i,h:d}}class ng{constructor(t,n){Bi(this,"engine",t),Bi(this,"theme",n),Bi(this,"painter"),this.painter=new $o(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}draw(t){var n,a,i;this.drawRegions(t),(i=(a=(n=t.getCanvasFeature)==null?void 0:n.call(t,"grid"))==null?void 0:a.draw)==null||i.call(t,this),this.drawAxis(t)}drawAxis(t){const{config:n}=t;n.axis_x_show&&this.drawXAxis(t),n.axis_y_show&&this.drawYAxis(t),n.axis_y2_show&&t.scale.y2&&this.drawYAxis(t,"y2"),this.drawAdditionalAxes(t),this.drawAxisLabels(t)}drawTitle(t){var n,a;const{ctx:i,painter:s,theme:{style:{title:o}}}=this,{config:r,state:{current:l}}=t;if(!r.title_text)return;const c=String(r.title_text).split(`
16
+ `),u=ce(o.font),d=u*1.5,{x:h,align:f}=qf(r.title_position,l.width),p=(a=(n=t.getCanvasTitleHeight)==null?void 0:n.call(t))!=null?a:u,g=(r.title_padding.top||0)+p;s.withState(()=>{i.font=o.font,i.fillStyle=o.color,i.textAlign=f,i.textBaseline="alphabetic",c.forEach((_,x)=>{i.fillText(_,h,g+(x?u+(x-1)*d:0))})})}drawAxisLabels(t){const{ctx:n,painter:a,theme:{style:{axis:i}}}=this,{axis:s,config:o}=t,r=ce(i.labelFont),l=["x","y","y2"],c={x:i.xLabelColor,y:i.yLabelColor,y2:i.y2LabelColor},u={start:"left",middle:"center",end:"right"};s&&a.withState(()=>{n.font=i.labelFont,n.textBaseline="alphabetic",l.forEach(d=>{const h=s.getLabelText(d);if(!h||!o[`axis_${d}_show`]||d==="y2"&&!t.scale.y2)return;const f=d==="x"&&o.axis_rotated||d!=="x"&&!o.axis_rotated,p=Yf(t,d),g=s.xForAxisLabel(d)+za(s.dxForAxisLabel(d),r),_=za(s.dyForAxisLabel(d),r),{x,y:m}=jf(p,g,_,f),v=s.textAnchorForAxisLabel(d);n.fillStyle=c[d]||i.labelColor,n.textAlign=u[v]||"center",a.text(String(h),x,m,{angle:f?-90:0})})})}drawRegions(t){const{ctx:n,painter:a,theme:{style:{region:i}}}=this,{config:s,state:{height:o,margin:r,width:l}}=t,c=s.regions||[];c.length&&a.clipRect({x:r.left,y:r.top,w:l,h:o},()=>{var u;n.fillStyle=i.fill,n.font=i.labelFont,n.textBaseline="top";for(const d of c){const h=eg(t,d);if(!h||!Qe(h.x)||!Qe(h.y)||!h.w||!h.h)continue;const f=r.left+h.x,p=r.top+h.y,g=h.w,_=h.h;if(n.globalAlpha=Number.isFinite(d.opacity)?d.opacity:i.opacity,a.fillRect({x:f,y:p,w:g,h:_}),(u=d.label)!=null&&u.text){const x=d.label,m=x.center||"",v=String(x.text),b=a.measureText(v).width,T=parseFloat(n.font)||12;let k=f+(x.x||0),w=p+(x.y||0);m.indexOf("x")>-1&&(k+=(g-b)/2),m.indexOf("y")>-1&&(w+=(_-T)/2),a.text(v,k,w,{angle:x.rotated?-90:0,alpha:1,fill:x.color||i.labelColor})}}})}drawAdditionalAxes(t){["x","y","y2"].forEach(n=>{const a=t.config[`axis_${n}_axes`]||[];!a.length||!t.scale[n]||!t.config[`axis_${n}_show`]||a.forEach((i,s)=>{var o;const r=Ff(t,n,i);if(!r)return;const l={scale:r,ticks:If(t,n,r,i),format:Bf(t,i),index:s+1,outerTick:((o=i.tick)==null?void 0:o.outer)!==!1};n==="x"?this.drawXAxis(t,l):this.drawYAxis(t,n,l)})})}drawXAxis(t,n){var a;const{ctx:i,painter:s,theme:{style:{axis:o}}}=this,{axis:r,config:l,state:{current:c,margin:u,width:d,height:h}}=t,f=l.axis_rotated,p=n!=null&&n.index?t.getAxisSize("x")*n.index:0,g=(n==null?void 0:n.scale)||ae(t),_=s.crisp(u.left-(f?p:0),o.lineWidth),x=s.crisp(u.top+h+(f?0:p),o.lineWidth),m=u.left,v=u.left+d,b=u.top,T=u.top+h,k=f?b:m,w=f?T:v,y=(n==null?void 0:n.ticks)||Fa(t),C=(n==null?void 0:n.ticks)||Of(t,y,o.tickWidth),A=(n==null?void 0:n.format)||r.getXAxisTickFormat(),S=n?n.outerTick:l.axis_x_tick_outer,L=f?l.axis_x_tick_inner?1:-1:l.axis_x_tick_inner?-1:1,P=xr(f),D=zi(f),R=l.axis_x_tick_text_position,E=f?0:((a=t.getAxisTickRotate)==null?void 0:a.call(t,"x"))||0;s.clipRect(f?Xi(u,c.width,h):Ni(u,d,c.height),()=>{if(i.strokeStyle=o.lineColor,i.lineWidth=o.lineWidth,s.strokePath(()=>{f?s.traceLine(_,b,_,T):s.traceLine(m,x,v,x),S&&(f?(s.traceLine(_,b,_+xt*P,b),s.traceLine(_,T,_+xt*P,T)):(s.traceLine(m,x,m,x+xt*P),s.traceLine(v,x,v,x+xt*P)))}),i.font=oa(o,"x"),i.fillStyle=o.labelColor,i.textAlign=f?D>0?"left":"right":"center",i.textBaseline=f?"middle":D>0?"top":"bottom",i.strokeStyle=o.tickColor,i.lineWidth=o.tickWidth,l.axis_x_tick_show&&s.strokePath(()=>{for(const I of C){const F=$i(t,I,g),V=u.left+F,Y=u.top+F;Na(f?Y:V,k,w)&&(f?s.traceLine(_,Y,_+xt*L,Y):s.traceLine(V,x,V,x+xt*L))}}),!n&&!l.axis_x_tick_text_show)return;const M=oa(o,"x"),O=Wi(s,ce(M)),$=Vi(t,y,f,g);y.forEach((I,F)=>{this.drawXAxisTickText(t,I,A,o.labelColor,{isRotated:f,rangeEnd:w,rangeStart:k,tickCount:y.length,tickFont:M,tickIndex:F,tickLineHeight:O,tickTextDirection:D,tickTextWidth:$,tickRotate:E,tickTextPosition:R,targetScale:g,ticks:y,x:_,y:x})})})}drawFocusedXAxisTick(t,n){var a;const{painter:i,theme:{style:{axis:s}}}=this,{axis:o,config:r,state:{current:l,margin:c,width:u,height:d}}=t,h=(a=n==null?void 0:n[0])==null?void 0:a.x;if(h===void 0||!o||!r.axis_x_show||!r.axis_x_tick_text_show||!s.activeLabelColor||s.activeLabelColor===s.labelColor)return;const f=Fa(t),p=f.findIndex(w=>ia(w,h)),g=f[p];if(g===void 0)return;const _=r.axis_rotated,x=i.crisp(c.left,s.lineWidth),m=i.crisp(c.top+d,s.lineWidth),v=_?c.top:c.left,b=_?c.top+d:c.left+u,T=o.getXAxisTickFormat(),k=zi(_);i.clipRect(_?Xi(c,l.width,d):Ni(c,u,l.height),()=>{var w;this.drawXAxisTickText(t,g,T,s.activeLabelColor,{isRotated:_,rangeEnd:b,rangeStart:v,targetScale:ae(t),tickCount:f.length,tickIndex:p,tickTextDirection:k,tickRotate:_?0:((w=t.getAxisTickRotate)==null?void 0:w.call(t,"x"))||0,tickTextPosition:r.axis_x_tick_text_position,ticks:f,x,y:m})})}drawAxisTooltip(t,n){const{ctx:a,painter:i,theme:{style:{axis:s,grid:o}}}=this,{config:r,state:{margin:l,width:c,height:u}}=t;if(!r.axis_tooltip||!n)return;const d=r.axis_rotated,h=n[0]-l.left,f=n[1]-l.top,p=h>=0&&h<=c,g=f>=0&&f<=u;if(!p&&!g)return;const _=l.left+h,x=l.top+f,m=ce(s.labelFont),v=m||10,b=(T,k,w,y,C)=>{const A=Vf(t,T),S=A&&Hf(t,T,k);if(!S)return;a.font=s.labelFont,a.textAlign=C,a.textBaseline="alphabetic";const L=a.measureText(S),P=L.width,D=L.actualBoundingBoxAscent||v*.8,R=L.actualBoundingBoxDescent||v*.2,E=Math.max(2,P*.15),M=Math.max(3,v*.25),O=C==="right"?w-P:C==="center"?w-P/2:w,$=y-D;a.fillStyle=A,a.fillRect(O-E,$-M,P+E*2,D+R+M*2),a.fillStyle="#fff",a.fillText(S,w,y)};i.withState(()=>{a.strokeStyle=o.lineColor,a.lineWidth=o.lineWidth,a.setLineDash([]),i.strokePath(()=>{p&&i.traceLine(_,l.top,_,l.top+u),g&&i.traceLine(l.left,x,l.left+c,x)}),a.setLineDash([]),d?(g&&r.axis_x_show&&b("x",f,l.left-m*.3,x+m*.4,"right"),p&&r.axis_y_show&&b("y",h,_-m*1.3,l.top+u+m*1.15,"left"),p&&r.axis_y2_show&&t.scale.y2&&b("y2",h,_-m*1.3,l.top-m*.4,"left")):(p&&r.axis_x_show&&b("x",h,_-m,l.top+u+m*1.15,"left"),g&&r.axis_y_show&&b("y",f,l.left-m*.4,x+m*.3,"right"),g&&r.axis_y2_show&&t.scale.y2&&b("y2",f,l.left+c+m*.4,x+m*.3,"left"))})}drawXAxisTickText(t,n,a,i,s){var o,r;const{ctx:l,painter:c,theme:{style:{axis:u}}}=this,{state:{margin:d}}=t,{isRotated:h,rangeEnd:f,rangeStart:p,tickTextDirection:g,tickRotate:_,tickTextPosition:x,targetScale:m,ticks:v,x:b,y:T}=s,k=Yi(t,n,m),w=d.left+k,y=d.top+k;if(!Na(h?y:w,p,f))return;const A=(o=s.tickFont)!=null?o:oa(u,"x");l.font=A,l.fillStyle=i;const S=_r(t,c,a,n,v,h,m,s.tickTextWidth),L=(r=s.tickLineHeight)!=null?r:Wi(c,ce(A));let P,D;if(h)P=b+(xt+fn)*g+(x.x||0),D=y+(x.y||0)+3-(S.length-1)*L/2,l.textAlign=Hi(t,s),l.textBaseline="alphabetic";else if(_){const R=ce(A),E=x.y?za(x.y,R):.71*R,M=Kf(_)+(x.x||0),O=Uf(_)+E;l.textAlign=Hi(t,s),l.textBaseline="alphabetic",c.withState($=>{$.translate(w,T),$.rotate(_*Math.PI/180),S.forEach((I,F)=>{$.fillText(I,M,O+F*L)})});return}else P=w+(x.x||0),D=T+(xt+fn)*g+(x.y||0),l.textAlign=Hi(t,s),l.textBaseline=g>0?"top":"bottom";c.withState(R=>{R.translate(P,D),_&&R.rotate(_*Math.PI/180),S.forEach((E,M)=>{R.fillText(E,0,M*L)})})}drawYAxis(t,n="y",a){var i,s,o,r,l,c,u,d;const{ctx:h,painter:f,theme:{style:{axis:p}}}=this,{config:g,scale:_,state:x}=t,{margin:m,width:v,height:b}=x,T=(a==null?void 0:a.margin)||m,k=(i=a==null?void 0:a.width)!=null?i:v,w=(s=a==null?void 0:a.height)!=null?s:b,y=(a==null?void 0:a.prefix)||`axis_${n}`,C=(a==null?void 0:a.scale)||_[n],A=n==="y2",S=g.axis_rotated,L=a!=null&&a.index?t.getAxisSize(n)*a.index:0,P=f.crisp(T.left+(A?k+(S?0:L):-L),p.lineWidth),D=f.crisp(T.top+(S?A?-L-1:w+L:0),p.lineWidth),R=T.left,E=T.left+k,M=T.top,O=T.top+w,$=(a==null?void 0:a.ticks)||sa(t,n),I=(a==null?void 0:a.ticks)||(g[`${y}_tick_culling`]&&g[`${y}_tick_culling_lines`]!==!1?sa(t,n,void 0,!1):$),F=(a==null?void 0:a.format)||((l=(r=(o=t.axis)==null?void 0:o[n])==null?void 0:r.tickFormat)==null?void 0:l.call(r))||((c=g[`${y}_tick_format`])==null?void 0:c.bind(t.api))||(_t=>_t),V=a?a.outerTick:g[`${y}_tick_outer`],Y=S?A?g.axis_y2_tick_inner?1:-1:g.axis_y_tick_inner?-1:1:A?g.axis_y2_tick_inner?-1:1:g.axis_y_tick_inner?1:-1,j=Jf(g,S,A),dt=Wf(S,A),it=(a==null?void 0:a.tickTextPosition)||g[`${y}_tick_text_position`]||g[`axis_${n}_tick_text_position`],ft=(u=a==null?void 0:a.tickShow)!=null?u:a?!0:g[`${y}_tick_show`],wt=(d=a==null?void 0:a.tickTextShow)!=null?d:a?!0:g[`${y}_tick_text_show`];f.withState(()=>{h.strokeStyle=p.lineColor,h.lineWidth=p.lineWidth,f.strokePath(()=>{S?f.traceLine(R,D,E,D):f.traceLine(P,M,P,O),V&&(S?(f.traceLine(R,D,R,D+xt*j),f.traceLine(E,D,E,D+xt*j)):(f.traceLine(P,M,P+xt*j,M),f.traceLine(P,O,P+xt*j,O)))});const _t=oa(p,n);h.font=_t,h.fillStyle=p.labelColor,h.textAlign=S?"center":dt>0?"left":"right",h.textBaseline=S?dt>0?"top":"bottom":"middle",h.strokeStyle=p.tickColor,h.lineWidth=p.tickWidth;const jt=[],It=[],Et=(Ut,xe)=>{const wn=aa(t,Ut,n),ma=T.left+C(wn),va=T.top+C(wn);Qe(S?ma:va)&&xe.push({tick:Ut,tx:ma,ty:va})};for(const Ut of $)Et(Ut,jt);for(const Ut of I)Et(Ut,It);if(ft&&f.strokePath(()=>{for(const{tx:Ut,ty:xe}of It)S?f.traceLine(Ut,D,Ut,D+xt*Y):f.traceLine(P,xe,P+xt*Y,xe)}),wt)for(const{tick:Ut,tx:xe,ty:wn}of jt)S&&dt>0?(h.textBaseline="alphabetic",f.text(Gi(F,Ut),xe+(it.x||0),D+Ao*dt+(it.y?za(it.y,ce(_t)):.71*ce(_t)))):S?f.text(Gi(F,Ut),xe+(it.x||0),D+xt*dt+(it.y||0)):f.text(Gi(F,Ut),P+(xt+fn)*dt+(it.x||0),wn+(it.y||0))})}}var ag=Object.defineProperty,ig=Object.defineProperties,sg=Object.getOwnPropertyDescriptors,br=Object.getOwnPropertySymbols,og=Object.prototype.hasOwnProperty,rg=Object.prototype.propertyIsEnumerable,yr=(e,t,n)=>t in e?ag(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lg=(e,t)=>{for(var n in t||(t={}))og.call(t,n)&&yr(e,n,t[n]);if(br)for(var n of br(t))rg.call(t,n)&&yr(e,n,t[n]);return e},cg=(e,t)=>ig(e,sg(t));function ug(e){return e?{stroke:e.lineColor,lineWidth:e.lineWidth,lineDash:e.dashArray}:void 0}function dg(e){return e?{fill:e.labelColor,font:e.labelFont}:void 0}function Tr(e,t,n){return e==="start"?t+4:e==="middle"?(t+n)/2:n-4}function wr(e,t,n){return e==="start"?n-4:e==="middle"?(t+n)/2:t+4}function kr(e,t){const{ctx:n,painter:a,theme:{style:{axis:i,grid:s}}}=e,{config:o,scale:r,state:{height:l,margin:c,width:u}}=t,d=o.axis_rotated,h=c.left,f=c.left+u,p=c.top,g=c.top+l;s.lineColor&&a.withState(()=>{n.strokeStyle=s.lineColor,n.lineWidth=s.lineWidth,n.font=s.labelFont||i.labelFont,n.fillStyle=s.labelColor,n.textBaseline="middle",n.setLineDash([]);const _=(T,k,w,y=!1,C)=>{T&&a.text(T,k,w,cg(lg({},C),{angle:y?-90:0}))},x=(T,k,w)=>{const y=ug(e.theme.getGridLineStyle(k,T,"line"));a.strokePath(w,y)},m=(T,k)=>dg(e.theme.getGridLineStyle(T,k,"text")),v=T=>{if(T.value===void 0||!r.x)return;const k=Yi(t,T.value);if(Qe(k))if(d){const w=c.top+k;x(T,"x",()=>{a.traceLine(h,w,f,w)}),n.textAlign=T.position==="start"?"left":T.position==="middle"?"center":"right",_(T.text,Tr(T.position,h,f),w-5,!1,m("x",T))}else{const w=c.left+k;x(T,"x",()=>{a.traceLine(w,p,w,g)}),n.textAlign=T.position==="start"?"left":T.position==="middle"?"center":"right",_(T.text,w-5,wr(T.position,p,g),!0,m("x",T))}},b=T=>{const k=T.axis==="y2"?r.y2:r.y,w=T.axis==="y2"?"y2":"y";if(T.value===void 0||!k)return;const y=aa(t,T.value,w),C=k(y);if(Qe(C))if(d){const A=c.left+C;x(T,"y",()=>{a.traceLine(A,p,A,g)}),n.textAlign=T.position==="start"?"left":T.position==="middle"?"center":"right",_(T.text,A-5,wr(T.position,p,g),!0,m("y",T))}else{const A=c.top+C;x(T,"y",()=>{a.traceLine(h,A,f,A)}),n.textAlign=T.position==="start"?"left":T.position==="middle"?"center":"right",_(T.text,Tr(T.position,h,f),A-5,!1,m("y",T))}};(o.grid_x_lines||[]).forEach(v),(o.grid_y_lines||[]).forEach(b)})}function hg(e,t){const{ctx:n,painter:a,theme:{style:{grid:i}}}=e,{config:s,scale:o,state:{height:r,margin:l,width:c}}=t;if(!i.lineColor)return;const u=s.axis_rotated,d=l.left,h=l.left+c,f=l.top,p=l.top+r;a.withState(()=>{n.strokeStyle=i.lineColor,n.lineWidth=i.lineWidth,i.dashArray.length&&n.setLineDash(i.dashArray),s.grid_x_show&&o.x&&a.strokePath(()=>{for(const g of Fa(t)){const _=Yi(t,g);Qe(_)&&(u?a.traceCrispLine(d,l.top+_,h,l.top+_,i.lineWidth):a.traceCrispLine(l.left+_,f,l.left+_,p,i.lineWidth))}}),s.grid_y_show&&o.y&&a.strokePath(()=>{for(const g of Nf(t)){const _=aa(t,g),x=o.y(_);Qe(x)&&(u?a.traceCrispLine(l.left+x,f,l.left+x,p,i.lineWidth):a.traceCrispLine(d,l.top+x,h,l.top+x,i.lineWidth))}}),!s.grid_lines_front&&kr(e,t)})}var fg={draw(e){hg(e,this)},drawLines(e){kr(e,this)}},gg=Object.defineProperty,pg=Object.defineProperties,_g=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertySymbols,xg=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable,Sr=(e,t,n)=>t in e?gg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vg=(e,t)=>{for(var n in t||(t={}))xg.call(t,n)&&Sr(e,n,t[n]);if(Cr)for(var n of Cr(t))mg.call(t,n)&&Sr(e,n,t[n]);return e},bg=(e,t)=>pg(e,_g(t));const yg={section:"heatmap",probe({probeIn:e,axisFont:t,toColor:n}){const a=e("bb-chart-heatmap","text","bb-heatmap-axis",["fill","font"]),i=e("bb-chart-heatmap","text","bb-heatmap-label",["font"]);return{axisFont:a.font||t,axisColor:n(a.fill,"#000"),labelFont:i.font||t}},selectors:{".bb-heatmap-axis":(e,{readColorValue:t,readFontValue:n})=>({axisColor:t(e,"fill"),axisFont:n(e)}),".bb-heatmap-label":(e,{readFontValue:t})=>({labelFont:t(e)})}},Tg={middle:.35,top:.71,bottom:0};function Ar(e,t,n){var a,i;const s=parseFloat((i=(a=/(\d+(?:\.\d+)?)px/.exec(n.font))==null?void 0:a[1])!=null?i:"10");e.painter.text(t.text,t.x,t.y+Tg[t.baseline]*s,bg(vg({},n),{textAlign:t.align,textBaseline:"alphabetic"}))}var wg={theme:yg,draw(e){const t=this,{painter:n,theme:{style:{heatmap:a,shape:i}}}=e,{config:s}=t,{cells:o,axisX:r,axisY:l,colorbar:c}=t.getHeatmapLayout(),u=s.heatmap_cell_radius,d=s.heatmap_cell_border_width;o.forEach(f=>{const p={x:f.x0,y:f.y0,w:Math.max(0,f.x1-f.x0),h:Math.max(0,f.y1-f.y0)},g=t.isHeatmapDefocused(f.id)?i.targetDefocusedOpacity:1;n.fillRoundRect(p,u,{fill:f.color,alpha:g}),d&&n.strokeRoundRect(p,u,{stroke:s.heatmap_cell_border_color,lineWidth:d,alpha:g});const _=t.getHeatmapLabel(f);_&&Ar(e,{text:_,x:(f.x0+f.x1)/2,y:(f.y0+f.y1)/2,align:"center",baseline:"middle"},{fill:t.getHeatmapLabelColor(f),alpha:g,font:a.labelFont})});const h=f=>Ar(e,f,{fill:a.axisColor,font:a.axisFont});if(r.forEach(h),l.forEach(h),c){const{x:f,y:p,width:g,height:_,stops:x,horizontal:m}=c,v=m?n.context.createLinearGradient(f,0,f+g,0):n.context.createLinearGradient(0,p,0,p+_);x.forEach(([b,T])=>v.addColorStop(b,T)),n.fillRect({x:f,y:p,w:g,h:_},{fill:v}),c.labels.forEach(h)}t.fitHeatmapHeight()},hits(e){const t=this;t.getHeatmapLayout().cells.forEach(n=>{n.value!==null&&e.addBar({x:n.x0,y:n.y0,w:Math.max(1,n.x1-n.x0),h:Math.max(1,n.y1-n.y0),data:t.getHeatmapCellData(n)})})}},kg={theme:{section:"sankey",probe({probeIn:e,axisFont:t,toColor:n,toNumber:a}){const i=e("bb-chart-sankey","path","bb-sankey-link",["stroke-opacity"]),s=e("bb-chart-sankey","text","bb-sankey-label",["fill","font"]);return{linkOpacity:a(i["stroke-opacity"],.4),labelFont:s.font||t,labelColor:n(s.fill,"#000")}},selectors:{".bb-sankey-link":(e,{readNumberValue:t})=>({linkOpacity:t(e,"stroke-opacity")}),".bb-sankey-label":(e,{readColorValue:t,readFontValue:n})=>({labelColor:t(e,"fill"),labelFont:n(e)})},normalize(e,{toNumber:t}){e.linkOpacity=t(e.linkOpacity,.4)}},draw(e){var t;const n=this,{painter:a,theme:{style:{sankey:i,shape:s}}}=e,{config:o}=n,{nodes:r,links:l}=n.getSankeyLayout(),c=o.sankey_rotated,u=(t=o.sankey_link_opacity)!=null?t:i.linkOpacity,d=o.sankey_node_border_width,h=f=>n.isSankeyDefocused(f)?s.targetDefocusedOpacity:1;l.forEach(f=>{const[p,g,_,x]=n.getSankeyLinkPoints(f),[m,v]=n.getSankeyLinkColors(f);let b=m;m!==v&&(b=c?a.context.createLinearGradient(0,p[1],0,x[1]):a.context.createLinearGradient(p[0],0,x[0],0),b.addColorStop(0,m),b.addColorStop(1,v)),a.strokePath(T=>{T.moveTo(p[0],p[1]),T.bezierCurveTo(g[0],g[1],_[0],_[1],x[0],x[1])},{stroke:b,lineWidth:Math.max(1,f.width),alpha:u*h(f)})}),r.forEach(f=>{const p=h(f),g={x:f.x0,y:f.y0,w:Math.max(1,f.x1-f.x0),h:Math.max(1,f.y1-f.y0)};a.fillRect(g,{fill:f.color,alpha:p}),d&&a.strokeRect(g,{stroke:o.sankey_node_border_color,lineWidth:d,alpha:p});const _=n.getSankeyLabel(f);_!=null&&_.text&&a.text(_.text,_.x,_.y,{fill:i.labelColor,alpha:p,font:i.labelFont,textAlign:_.align,textBaseline:_.baseline})})},hits(e){const t=this,{nodes:n,links:a}=t.getSankeyLayout();n.forEach(s=>{e.addBar({x:s.x0,y:s.y0,w:Math.max(1,s.x1-s.x0),h:Math.max(1,s.y1-s.y0),data:t.getSankeyNodeData(s)})});const i=t.config.sankey_rotated;a.slice().reverse().forEach(s=>{const[[o,r],,,[l,c]]=t.getSankeyLinkPoints(s,!0),u=Math.max(1,s.width)/2,d=Math.min(r,c)-u,h={f:o,c:d,df:l-o,dc:Math.max(r,c)+u-d};e.addBar({x:i?h.c:h.f,y:i?h.f:h.c,w:i?h.dc:h.df,h:i?h.df:h.dc,data:t.getSankeyLinkData(s),hit:(f,p)=>t.isSankeyLinkHit(s,f,p)})})}},B=kt(4);const ge={canvas:"bb-canvas",overlay:"bb-canvas-overlay",legend:"bb-canvas-legend",legendBottom:"bb-canvas-legend-bottom",legendInset:"bb-canvas-legend-inset",legendItemInteractive:"bb-legend-item-interactive",legendItemTileCircle:"bb-legend-item-tile-circle",legendItemTitle:"bb-legend-item-title",legendRight:"bb-canvas-legend-right"};var A0=ge,Cg=Object.defineProperty,Sg=(e,t,n)=>t in e?Cg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mn=(e,t,n)=>Sg(e,typeof t!="symbol"?t+"":t,n);class Ag{constructor(){Mn(this,"canvas"),Mn(this,"ctx"),Mn(this,"dpr",1),Mn(this,"frame",null),Mn(this,"frameCtx",null),Mn(this,"frameValid",!1)}init(t,n,a){this.canvas=rt.createElement("canvas"),this.canvas.className=ge.canvas,this.canvas.style.display="block",t.appendChild(this.canvas),this.dpr=W.devicePixelRatio||1,this.ctx=this.canvas.getContext("2d"),this.resize(n,a)}resize(t,n){const a=Math.max(0,t),i=Math.max(0,n);this.dpr=W.devicePixelRatio||1,this.canvas.width=a*this.dpr,this.canvas.height=i*this.dpr,this.canvas.style.width=`${a}px`,this.canvas.style.height=`${i}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.frame=null,this.frameCtx=null,this.frameValid=!1}clearOverlay(){this.frameValid&&this.restoreFrame()}withOverlay(t){const{ctx:n}=this;this.frameValid?this.clearOverlay():this.captureFrame(),n.save(),n.setTransform(this.dpr,0,0,this.dpr,0,0);try{t(n)}finally{n.restore()}}beginFrame(t,n){const{ctx:a}=this;this.frameValid=!1,a.save(),a.setTransform(this.dpr,0,0,this.dpr,0,0),a.clearRect(0,0,t,n)}endFrame(){this.ctx.restore()}captureFrame(){const{canvas:t}=this;if(this.frameValid=!1,t.width&&t.height){let{frame:n,frameCtx:a}=this;if(!n){const i=rt.createElement("canvas");n=i,a=i.getContext("2d"),this.frame=n,this.frameCtx=a}if(!n||!a)return;a.setTransform(1,0,0,1,0,0),n.width!==t.width||n.height!==t.height?(n.width=t.width,n.height=t.height):a.clearRect(0,0,t.width,t.height),a.drawImage(t,0,0),this.frameValid=!0}}restoreFrame(){if(!this.frameValid||!this.frame||!this.frameCtx)return;const{canvas:t,ctx:n}=this;n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.drawImage(this.frame,0,0),n.restore(),n.setTransform(this.dpr,0,0,this.dpr,0,0)}destroy(){var t;(t=this.canvas)==null||t.remove(),this.frame=null,this.frameCtx=null,this.frameValid=!1}}var Lg=Object.defineProperty,Lr=Object.getOwnPropertySymbols,Pg=Object.prototype.hasOwnProperty,Rg=Object.prototype.propertyIsEnumerable,Eg=(e,t,n)=>t in e?Lg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mg=(e,t)=>{var n={};for(var a in e)Pg.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Lr)for(var a of Lr(e))t.indexOf(a)<0&&Rg.call(e,a)&&(n[a]=e[a]);return n},Dn=(e,t,n)=>Eg(e,typeof t!="symbol"?t+"":t,n);const Ee="http://www.w3.org/2000/svg";function K(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:"");return Number.isFinite(n)?n:t}function pn(e,t){const n=K(e.opacity,1),a=K(e["fill-opacity"],1),i=n*a;return Number.isFinite(i)?i:t}function tt(e,t){const n=e==null?void 0:e.trim();return n&&!/^(none|transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i.test(n)?n:t}function On(e,t){const n=tt(e,""),a=t?tt(t,""):"";return n&&n!==a?n:void 0}function $n(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:""),a=typeof t=="number"?t:parseFloat(t!=null?t:"");return Number.isFinite(n)&&(!Number.isFinite(a)||n!==a)?n:void 0}function ra(e){return Array.isArray(e)?e.filter(t=>Number.isFinite(t)&&t>0):(e||"").split(/[,\s]+/).map(t=>parseFloat(t)).filter(t=>Number.isFinite(t)&&t>0)}function Dg(e,t){const n=e.getPropertyValue("font").trim();if(n)return n;const a=e.getPropertyValue("font-size").trim(),i=e.getPropertyValue("font-family").trim();if(!a||!i)return t;const s=e.getPropertyValue("font-style").trim(),o=e.getPropertyValue("font-variant").trim(),r=e.getPropertyValue("font-weight").trim(),l=e.getPropertyValue("line-height").trim(),c=l&&l!=="normal"?`${a}/${l}`:a;return[s&&s!=="normal"?s:"",o&&o!=="normal"?o:"",r&&!/^(normal|400)$/.test(r)?r:"",c,i].filter(Boolean).join(" ")}function Me(e,t){var n;const a=t.replace(/-([a-z])/g,(i,s)=>s.toUpperCase());return(n=e[t])!=null?n:e[a]}function ot(e,t){const n=Me(e,t);return(n==null?"":tt(String(n),""))||void 0}function $t(e,t){const n=Me(e,t),a=typeof n=="number"?n:parseFloat(String(n!=null?n:""));return Number.isFinite(a)?a:void 0}function tn(e){const t=$t(e,"opacity"),n=$t(e,"fill-opacity");return t===void 0&&n===void 0?void 0:(t!=null?t:1)*(n!=null?n:1)}function ji(e){const t=Me(e,"stroke-dasharray"),n=t==null?[]:ra(t);return n.length?n:void 0}function ie(e){var t,n,a,i;const s=Me(e,"font");if(s!=null&&String(s).trim())return String(s).trim();const o=Me(e,"font-size"),r=Me(e,"font-family");if(o==null||r==null)return;const l=String(o).trim(),c=String(r).trim();if(!l||!c)return;const u=String((t=Me(e,"font-style"))!=null?t:"").trim(),d=String((n=Me(e,"font-variant"))!=null?n:"").trim(),h=String((a=Me(e,"font-weight"))!=null?a:"").trim(),f=String((i=Me(e,"line-height"))!=null?i:"").trim();return[u&&u!=="normal"?u:"",d&&d!=="normal"?d:"",h&&!/^(normal|400)$/.test(h)?h:"",f&&f!=="normal"?`${l}/${f}`:l,c].filter(Boolean).join(" ")}function lt(e,t,n){var a;const i=Object.keys(n).reduce((s,o)=>(n[o]!==void 0&&(s[o]=n[o]),s),{});Object.keys(i).length&&(e[t]=Fe((a=e[t])!=null?a:{},i))}const Og={readColorValue:ot,readNumberValue:$t,readFontValue:ie};function Pr(e){return e.split(",").map(t=>t.trim().replace(/\s*>\s*/g," ").replace(/\s+/g," ").replace(/^(?:svg)?\.bb\s+/,"").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g,"$1.")).filter(Boolean)}function Ui(e){return Object.keys(e).filter(t=>e[t]!==void 0)}function Rr(e,t,n){return Ui(t).forEach(a=>{n!=null&&n.has(a)||(e[a]=t[a])}),e}function Er(e){const t=e.split(" ");return t.every((n,a)=>n==="line"||n==="text"?a===t.length-1:/^(\.[A-Za-z_-][\w-]*)+$/.test(n))}function Mr(e){const t=e.split(" "),n=t[t.length-1];return n==="line"||n==="text"?n:null}function $g(e){return(e||"").split(/\s+/).filter(Boolean)}function Fg(e,t){const n=t==="text"?{labelColor:ot(e,"fill"),labelFont:ie(e)}:{lineColor:ot(e,"stroke"),lineWidth:$t(e,"stroke-width"),dashArray:ji(e)};return Rr({},n)}function Ig(e){const t=[];return Object.keys(e!=null?e:{}).forEach(n=>{Pr(n).forEach(a=>{const i=Mr(a)||"line",s=Fg(e[n],i);Er(a)&&Ui(s).length&&t.push({selector:a,target:i,style:s})})}),t}function Bg(e,t,n,a){if(!Er(e))return!1;const i=Mr(e);if(i&&i!==a)return!1;if(!i&&a==="text")return!1;const s=$g(n),o=`bb-${t}grid-line`,r=new Set(["bb-grid","bb-grid-lines",`bb-${t}grid-lines`,o,...s]),l=(e.match(/\.[A-Za-z_-][\w-]*/g)||[]).map(c=>c.slice(1));return!!l.length&&l.every(c=>r.has(c))&&(l.includes(o)||s.some(c=>l.includes(c)))}function zg(e,t,n){switch(t){case".bb-axis path.domain":case".bb-axis .domain":case".bb-axis-x path.domain":case".bb-axis-x .domain":case".bb-axis-y path.domain":case".bb-axis-y .domain":case".bb-axis-y2 path.domain":case".bb-axis-y2 .domain":lt(e,"axis",{lineColor:ot(n,"stroke"),lineWidth:$t(n,"stroke-width")});break;case".bb-axis line":case".bb-axis .tick line":case".bb-axis-x line":case".bb-axis-x .tick line":case".bb-axis-y line":case".bb-axis-y .tick line":case".bb-axis-y2 line":case".bb-axis-y2 .tick line":lt(e,"axis",{tickColor:ot(n,"stroke"),tickWidth:$t(n,"stroke-width")});break;case".bb-axis text":case".bb-axis .tick text":{const a=ie(n);lt(e,"axis",{labelColor:ot(n,"fill"),xTickFont:a,yTickFont:a,y2TickFont:a});break}case".bb-axis-x text":case".bb-axis-x .tick text":lt(e,"axis",{labelColor:ot(n,"fill"),xTickFont:ie(n)});break;case".bb-axis-y text":case".bb-axis-y .tick text":lt(e,"axis",{labelColor:ot(n,"fill"),yTickFont:ie(n)});break;case".bb-axis-y2 text":case".bb-axis-y2 .tick text":lt(e,"axis",{labelColor:ot(n,"fill"),y2TickFont:ie(n)});break;case".tick._active_ text":case".bb-axis .tick._active_ text":case".bb-axis-x .tick._active_ text":lt(e,"axis",{activeLabelColor:ot(n,"fill")});break;case".bb-axis-x-label":case".bb-axis-x .bb-axis-x-label":lt(e,"axis",{labelFont:ie(n),xLabelColor:ot(n,"fill")});break;case".bb-axis-y-label":case".bb-axis-y .bb-axis-y-label":lt(e,"axis",{labelFont:ie(n),yLabelColor:ot(n,"fill")});break;case".bb-axis-y2-label":case".bb-axis-y2 .bb-axis-y2-label":lt(e,"axis",{labelFont:ie(n),y2LabelColor:ot(n,"fill")});break;case".bb-grid line":case".bb-grid .bb-xgrid":case".bb-grid .bb-ygrid":case".bb-xgrid":case".bb-ygrid":lt(e,"grid",{lineColor:ot(n,"stroke"),lineWidth:$t(n,"stroke-width"),dashArray:ji(n)});break;case".bb-grid text":lt(e,"grid",{labelColor:ot(n,"fill"),labelFont:ie(n)});break;case".bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus":lt(e,"focusGrid",{lineColor:ot(n,"stroke"),lineWidth:$t(n,"stroke-width"),dashArray:ji(n)});break;case".bb-region rect":case".bb-region":lt(e,"region",{fill:ot(n,"fill"),opacity:tn(n)});break;case".bb-region text":lt(e,"region",{labelColor:ot(n,"fill"),labelFont:ie(n)});break;case".bb-bar":lt(e,"shape",{barOpacity:tn(n),barStrokeColor:ot(n,"stroke"),barLineWidth:$t(n,"stroke-width")});break;case".bb-bar._expanded_":lt(e,"shape",{barExpandedOpacity:tn(n)});break;case".bb-candlestick":lt(e,"shape",{candlestickStrokeColor:ot(n,"stroke"),candlestickLineWidth:$t(n,"stroke-width")});break;case".bb-candlestick._expanded_":lt(e,"shape",{candlestickExpandedOpacity:tn(n)});break;case".bb-line":lt(e,"shape",{barConnectLineColor:ot(n,"stroke"),barConnectLineWidth:$t(n,"stroke-width"),lineWidth:$t(n,"stroke-width")});break;case".bb-target.bb-focused .bb-line":case".bb-target.bb-focused path.bb-line":lt(e,"shape",{lineFocusedWidth:$t(n,"stroke-width")});break;case".bb-target.bb-defocused":lt(e,"shape",{targetDefocusedOpacity:$t(n,"opacity")});break;case".bb-area":lt(e,"shape",{areaOpacity:tn(n)});break;case".bb-circle":lt(e,"shape",{pointFillColor:ot(n,"fill"),pointStrokeColor:ot(n,"stroke"),pointLineWidth:$t(n,"stroke-width")});break;case".bb-selected-circle":lt(e,"selectedPoint",{fill:ot(n,"fill"),stroke:ot(n,"stroke"),lineWidth:$t(n,"stroke-width")});break;case".bb-circle._expanded_":lt(e,"focusPoint",{fill:ot(n,"fill"),stroke:ot(n,"stroke"),lineWidth:$t(n,"stroke-width")});break;case".bb-zoom-brush":lt(e,"zoomBrush",{fill:ot(n,"fill"),opacity:tn(n)});break;case".bb-brush .extent":case".bb-brush .selection":lt(e,"subchartBrush",{fill:ot(n,"fill"),opacity:tn(n)});break;case".bb-brush .handle--custom":lt(e,"subchartBrush",{handleFill:ot(n,"fill"),handleOpacity:tn(n),handleStroke:ot(n,"stroke"),handleLineWidth:$t(n,"stroke-width")});break;case".bb-chart-treemaps rect":case".bb-chart-treemaps":lt(e,"treemap",{stroke:ot(n,"stroke"),lineWidth:$t(n,"stroke-width")});break;case".bb-text.bb-empty":case".bb-text .bb-empty":case".bb-empty":lt(e,"emptyLabel",{color:ot(n,"fill"),font:ie(n)});break;case".bb-text":lt(e,"label",{color:ot(n,"fill"),font:ie(n)});break;case".bb-title":lt(e,"title",{color:ot(n,"fill"),font:ie(n)});break}}function Ng(e,t){const n={};return Object.keys(e!=null?e:{}).forEach(a=>{Pr(a).forEach(i=>{var s;zg(n,i,e[a]);const o=(s=t==null?void 0:t.selectors)==null?void 0:s[i];o&&lt(n,t.section,o(e[a],Og))})}),n}function Xg(e,t){if(!e)return{};const n=e,{selectors:a}=n,i=Mg(n,["selectors"]);return Fe({},Ng(a,t),i)}function Dr(e,t){try{return JSON.stringify({className:e.className,style:e.getAttribute("style")||"",override:t||null})}catch(n){return null}}class Gg{constructor(){Dn(this,"style"),Dn(this,"cacheContainer",null),Dn(this,"cacheKey",null),Dn(this,"gridLineSelectorOverrides",[]),Dn(this,"directGridOverrideKeys",new Set),Dn(this,"extension")}load(t,n,a){var i,s,o,r,l,c;const u=rt.createElementNS(Ee,"svg");a&&(this.extension=a),this.gridLineSelectorOverrides=Ig(n==null?void 0:n.selectors),this.directGridOverrideKeys=new Set(Object.keys((i=n==null?void 0:n.grid)!=null?i:{})),u.setAttribute("class","bb"),u.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden",t.appendChild(u);const d=(Bt,Kt)=>{const Qt=W.getComputedStyle(Bt),oe={};for(const Xt of Kt)oe[Xt]=Xt==="font"?Dg(Qt,""):Qt.getPropertyValue(Xt).trim();return oe},h=(Bt,Kt,Qt)=>{const oe=rt.createElementNS(Ee,Bt);oe.setAttribute("class",Kt),u.appendChild(oe);const Xt=d(oe,Qt);return u.removeChild(oe),Xt},f=(Bt,Kt,Qt,oe)=>{const Xt=rt.createElementNS(Ee,"g"),me=rt.createElementNS(Ee,Kt);Xt.setAttribute("class",Bt),Qt&&me.setAttribute("class",Qt),Xt.appendChild(me),u.appendChild(Xt);const Ye=d(me,oe);return u.removeChild(Xt),Ye},p=(Bt,Kt,Qt,oe,Xt)=>{const me=rt.createElementNS(Ee,"g"),Ye=rt.createElementNS(Ee,"g"),ba=rt.createElementNS(Ee,Qt);me.setAttribute("class",Bt),Ye.setAttribute("class",Kt),oe&&ba.setAttribute("class",oe),Ye.appendChild(ba),me.appendChild(Ye),u.appendChild(me);const w0=d(ba,Xt);return u.removeChild(me),w0},g=(Bt,Kt,Qt,oe="")=>{const Xt=rt.createElementNS(Ee,"g"),me=rt.createElementNS(Ee,"g"),Ye=rt.createElementNS(Ee,Kt);Xt.setAttribute("class",`bb-axis ${Bt}`),me.setAttribute("class",["tick",oe].filter(Boolean).join(" ")),Ye.textContent=Kt==="text"?"0":"",me.appendChild(Ye),Xt.appendChild(me),u.appendChild(Xt);const ba=d(Ye,Qt);return u.removeChild(Xt),ba},_="rgb(1, 2, 3)",x=(Bt,Kt)=>{const Qt=rt.createElement("style");Qt.textContent=`
18
17
  .bb-shapes-canvas-probe .bb-circle {
19
- fill: ${g};
20
- stroke: ${g};
18
+ fill: ${_};
19
+ stroke: ${_};
21
20
  }
22
- `,nt.head.appendChild(jt);try{return u("bb-shapes bb-shapes-canvas-probe","circle",Mt,Gt)}finally{jt.remove()}},_=u("bb-axis bb-axis-x","path","domain",["stroke","stroke-width"]),x=f("bb-axis-x","line",["stroke","stroke-width"]),m=f("bb-axis-x","text",["fill","font"]),b=f("bb-axis-x","text",["fill"],"_active_"),v=f("bb-axis-y","text",["fill","font"]),y=f("bb-axis-y2","text",["fill","font"]),T=u("bb-axis bb-axis-x","text","bb-axis-x-label",["fill","font"]),w=u("bb-axis bb-axis-y","text","bb-axis-y-label",["fill","font"]),C=u("bb-axis bb-axis-y2","text","bb-axis-y2-label",["fill","font"]),A=d("circle","",["fill","stroke","stroke-width"]),S=u("bb-grid","line","bb-ygrid",["stroke","stroke-width","stroke-dasharray"]),k=u("bb-grid","text","",["fill","font"]),L=h("bb-grid","bb-xgrid-focus","line","bb-xgrid-focus",["stroke","stroke-width","stroke-dasharray"]),E=d("text","bb-text bb-empty",["fill","font"]),D=u("bb-region","rect","",["fill","fill-opacity"]),R=u("bb-region","text","",["fill","font"]),P=d("path","bb-bar",["opacity","fill-opacity","stroke","stroke-width"]),B=d("path","bb-bar _expanded_",["opacity","fill-opacity"]),I=d("path","bb-candlestick",["stroke","stroke-width"]),X=d("path","bb-candlestick _expanded_",["opacity","fill-opacity"]),G=d("path","bb-line",["stroke-width"]),Z=u("bb-target bb-focused","path","bb-line",["stroke-width"]),et=d("g","bb-target bb-defocused",["opacity"]),rt=d("path","bb-area",["opacity","fill-opacity"]),xt=d("circle","bb-circle",["fill","stroke","stroke-width"]),gt=d("circle","bb-selected-circle",["fill","stroke","stroke-width"]),Tt=p("bb-circle _expanded_",["fill","stroke","stroke-width"]),_t=d("rect","bb-zoom-brush",["fill","fill-opacity","opacity"]),mt=u("bb-brush","rect","extent",["fill","fill-opacity","opacity"]),Pt=u("bb-brush","rect","selection",["fill","fill-opacity","opacity"]),Dt=u("bb-brush","path","handle--custom",["fill","fill-opacity","opacity","stroke","stroke-width"]),Lt=u("bb-chart-treemaps","rect","",["stroke","stroke-width"]),$e=d("text","bb-text",["fill","font"]),Ht=u("","text","bb-title",["fill","font"]),Be=K(_t.fill,"#000"),hn=Y(_t["fill-opacity"]||_t.opacity,.1),Yi=K(Pt.fill,K(mt.fill,Be)),Hi=(r=(o=(s=(a=Tn(Pt["fill-opacity"],1))!=null?a:Tn(Pt.opacity,1))!=null?s:Tn(mt["fill-opacity"],1))!=null?o:Tn(mt.opacity,1))!=null?r:hn,ps=K(Dt.stroke,"transparent"),vt={axis:{lineColor:K(_.stroke,"#000"),lineWidth:Y(_["stroke-width"],1),tickColor:K(x.stroke,K(_.stroke,"#000")),tickWidth:Y(x["stroke-width"],Y(_["stroke-width"],1)),labelFont:w.font||v.font||"10px sans-serif",xTickFont:m.font||v.font||"10px sans-serif",yTickFont:v.font||"10px sans-serif",y2TickFont:y.font||v.font||"10px sans-serif",labelColor:K(v.fill,"#000"),xLabelColor:K(T.fill,K(m.fill,"#000")),yLabelColor:K(w.fill,K(v.fill,"#000")),y2LabelColor:K(C.fill,K(w.fill,K(v.fill,"#000"))),activeLabelColor:yn(b.fill,m.fill)||K(v.fill,"#000")},grid:{lineColor:K(S.stroke,"#aaa"),lineWidth:Y(S["stroke-width"],1),dashArray:jn(S["stroke-dasharray"]),labelFont:k.font||v.font||"10px sans-serif",labelColor:K(k.fill,"#aaa")},focusGrid:{lineColor:K(L.stroke,K(S.stroke,"#aaa")),lineWidth:Y(L["stroke-width"],Y(S["stroke-width"],1)),dashArray:jn(L["stroke-dasharray"]||S["stroke-dasharray"])},emptyLabel:{font:E.font||$e.font||v.font||"20px sans-serif",color:K(E.fill,"#808080")},region:{fill:K(D.fill,"steelblue"),opacity:Y(D["fill-opacity"],.1),labelFont:R.font||v.font||"10px sans-serif",labelColor:K(R.fill,"#000")},shape:{barOpacity:on(P,1),barExpandedOpacity:Y(on(B,on(P,1)),on(P,1)),barStrokeColor:K(P.stroke,"#000"),barLineWidth:Y(P["stroke-width"],0),barConnectLineColor:K(G.stroke,"#000"),barConnectLineWidth:Y(G["stroke-width"],1),candlestickStrokeColor:K(I.stroke,"#000"),candlestickLineWidth:Y(I["stroke-width"],1),candlestickExpandedOpacity:Y(on(X,1),1),lineWidth:Y(G["stroke-width"],1),lineFocusedWidth:Y(Z["stroke-width"],2),areaOpacity:on(rt,.2),targetDefocusedOpacity:Y(et.opacity,.3),pointFillColor:yn(xt.fill,A.fill),pointStrokeColor:yn(xt.stroke,A.stroke),pointLineWidth:Tn(xt["stroke-width"],A["stroke-width"])},selectedPoint:{fill:K(gt.fill,"#fff"),stroke:yn(gt.stroke),lineWidth:Y(gt["stroke-width"],2)},focusPoint:{fill:yn(Tt.fill,g),stroke:yn(Tt.stroke,g),lineWidth:Y(Tt["stroke-width"],1)},zoomBrush:{fill:Be,opacity:hn},subchartBrush:{fill:Yi,opacity:Hi,handleFill:K(Dt.fill,"transparent"),handleOpacity:on(Dt,1),handleStroke:ps,handleLineWidth:Y(Dt["stroke-width"],ps==="transparent"?0:1)},treemap:{stroke:K(Lt.stroke,"#fff"),lineWidth:Y(Lt["stroke-width"],1)},label:{font:$e.font||v.font||"10px sans-serif",color:K($e.fill,"#000")},title:{font:Ht.font||$e.font||v.font||"14px sans-serif",color:K(Ht.fill,"#000")}},Em=Wh(n),M=Ae(vt,Em),qe=n==null?void 0:n.axis,Pm=!!qe&&Object.prototype.hasOwnProperty.call(qe,"labelColor"),Dm=!!qe&&Object.prototype.hasOwnProperty.call(qe,"labelFont");if(M.axis.lineWidth=Y(M.axis.lineWidth,vt.axis.lineWidth),M.axis.tickWidth=Y(M.axis.tickWidth,M.axis.lineWidth),Dm){const Mt=qe,Gt=M.axis.labelFont;Mt.xTickFont===void 0&&(M.axis.xTickFont=Gt),Mt.yTickFont===void 0&&(M.axis.yTickFont=Gt),Mt.y2TickFont===void 0&&(M.axis.y2TickFont=Gt)}if(M.axis.labelFont=M.axis.labelFont||vt.axis.labelFont,M.axis.xTickFont=M.axis.xTickFont||M.axis.labelFont,M.axis.yTickFont=M.axis.yTickFont||M.axis.labelFont,M.axis.y2TickFont=M.axis.y2TickFont||M.axis.yTickFont,M.axis.labelColor=K(M.axis.labelColor,vt.axis.labelColor),Pm){const Mt=M.axis.labelColor;qe.xLabelColor===void 0&&(M.axis.xLabelColor=Mt),qe.yLabelColor===void 0&&(M.axis.yLabelColor=Mt),qe.y2LabelColor===void 0&&(M.axis.y2LabelColor=Mt)}M.axis.xLabelColor=K(M.axis.xLabelColor,M.axis.labelColor),M.axis.yLabelColor=K(M.axis.yLabelColor,M.axis.labelColor),M.axis.y2LabelColor=K(M.axis.y2LabelColor,M.axis.yLabelColor),M.axis.activeLabelColor=K(M.axis.activeLabelColor,M.axis.labelColor),M.grid.lineWidth=Y(M.grid.lineWidth,vt.grid.lineWidth),M.grid.dashArray=jn(M.grid.dashArray),M.focusGrid.lineWidth=Y(M.focusGrid.lineWidth,vt.focusGrid.lineWidth),M.focusGrid.dashArray=jn(M.focusGrid.dashArray),M.region.opacity=Y(M.region.opacity,vt.region.opacity),M.shape.barOpacity=Y(M.shape.barOpacity,vt.shape.barOpacity),M.shape.barExpandedOpacity=Y(M.shape.barExpandedOpacity,M.shape.barOpacity),M.shape.barLineWidth=Y(M.shape.barLineWidth,vt.shape.barLineWidth),M.shape.barConnectLineWidth=Y(M.shape.barConnectLineWidth,vt.shape.barConnectLineWidth),M.shape.candlestickLineWidth=Y(M.shape.candlestickLineWidth,vt.shape.candlestickLineWidth),M.shape.candlestickStrokeColor=K(M.shape.candlestickStrokeColor,vt.shape.candlestickStrokeColor),M.shape.candlestickExpandedOpacity=Y(M.shape.candlestickExpandedOpacity,vt.shape.candlestickExpandedOpacity),M.shape.lineWidth=Y(M.shape.lineWidth,vt.shape.lineWidth),M.shape.lineFocusedWidth=Y(M.shape.lineFocusedWidth,vt.shape.lineFocusedWidth),M.shape.areaOpacity=Y(M.shape.areaOpacity,vt.shape.areaOpacity),M.shape.targetDefocusedOpacity=Y(M.shape.targetDefocusedOpacity,vt.shape.targetDefocusedOpacity),M.shape.pointLineWidth=Tn(M.shape.pointLineWidth),M.selectedPoint.lineWidth=Y(M.selectedPoint.lineWidth,vt.selectedPoint.lineWidth),M.focusPoint.lineWidth=Y(M.focusPoint.lineWidth,vt.focusPoint.lineWidth),M.zoomBrush.opacity=Y(M.zoomBrush.opacity,vt.zoomBrush.opacity),M.subchartBrush.opacity=Y(M.subchartBrush.opacity,vt.subchartBrush.opacity),M.subchartBrush.handleOpacity=Y(M.subchartBrush.handleOpacity,vt.subchartBrush.handleOpacity),M.subchartBrush.handleLineWidth=Y(M.subchartBrush.handleLineWidth,vt.subchartBrush.handleLineWidth),M.treemap.lineWidth=Y(M.treemap.lineWidth,vt.treemap.lineWidth),this.style=M,this.cacheContainer=t,this.cacheKey=Ko(t,n),l.remove()}reload(t,n){const i=Ko(t,n);i!==null&&this.style&&this.cacheContainer===t&&this.cacheKey===i||this.load(t,n)}getGridLineStyle(t,n={},i="line"){const a={};for(const s of this.gridLineSelectorOverrides)Xh(s.selector,t,n.class,i)&&Ho(a,s.style,this.directGridOverrideKeys);return Ra(a).length?a:void 0}}var Hh=Object.defineProperty,jh=(e,t,n)=>t in e?Hh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ge=(e,t,n)=>jh(e,typeof t!="symbol"?t+"":t,n);const rn=24,Zo=64,Ea=[fe,ee,Wt];function wn(e,t){return Math.floor(e/t)}function qo(e,t,n){var i,a;const s=wn(t.x,n),o=wn(t.x+((i=t.w)!=null?i:0),n),r=wn(t.y,n),l=wn(t.y+((a=t.h)!=null?a:0),n);for(let c=s;c<=o;c++)for(let d=r;d<=l;d++){const u=`${c}:${d}`,h=e.get(u);h?h.push(t):e.set(u,[t])}}function Jo(e,t,n,i,a=0){const s=wn(t,i),o=wn(n,i),r=[];for(let l=-a;l<=a;l++)for(let c=-a;c<=a;c++){const d=e.get(`${s+l}:${o+c}`);if(d!=null&&d.length)for(let u=0;u<d.length;u++)r.push(d[u])}return r}function Uh(e,t){var n,i,a;const s=e.config.point_sensitivity;if(Number.isFinite(s))return s;(n=e.pointR)==null||n.call(e,t);const o=(a=(i=e.getPointSensitivity)==null?void 0:i.call(e,t))!=null?a:rn;return Number.isFinite(o)?o:rn}function Kh(e,t){return Ve(e,t)&&t.values.length>Ms&&!e.config.data_selection_enabled&&Number.isFinite(e.config.point_sensitivity)&&Number.isFinite(e.config.point_r)}class Zh{constructor(){ge(this,"bars",[]),ge(this,"points",[]),ge(this,"indices",[]),ge(this,"barGrid",new Map),ge(this,"pointGrid",new Map),ge(this,"plot",{x:0,y:0,w:0,h:0}),ge(this,"pointCellSize",rn),ge(this,"maxPointSensitivity",rn),ge(this,"grouped",!1),ge(this,"pointBased",!1),ge(this,"indexAxis","x")}rebuild(t,n){var i,a,s;const{current:o,margin:r,width:l,height:c}=t.state,d=t.filterTargetsToShow();this.bars=[],this.points=[],this.indices=[],this.barGrid=new Map,this.pointGrid=new Map,this.maxPointSensitivity=rn,this.indexAxis=t.config.axis_rotated?"y":"x",this.plot=t.state.hasTreemap?{x:0,y:0,w:o.width,h:o.height}:{x:r.left,y:r.top,w:l,h:c},this.grouped=!!t.config.tooltip_grouped&&!t.state.hasTreemap,this.pointBased=!(t.config.axis_x_forceAsSingle&&this.grouped)&&(!!((i=t.isMultipleX)!=null&&i.call(t))||d.some(_=>Ve(t,_)||We(t,_)));const h=this.grouped&&(!this.pointBased||t.config.data_selection_enabled&&t.config.data_selection_grouped)?new Map:null,f=(_,x,m)=>{var b,v;if(!h)return;const y=(v=(b=t.getXCacheKey)==null?void 0:b.call(t,m.x))!=null?v:m.index;Number.isFinite(m.index)&&!h.has(y)&&yt(_,x)&&h.set(y,{x:_,y:x,data:m})};if(t.state.hasTreemap){const _=(a=t.getTreemapRoot)==null?void 0:a.call(t,t.data.targets),x=(_==null?void 0:_.children)||[];for(const m of x){const{data:b}=m;if(!Qi(t,b))continue;const{x:v,y,w:T,h:w}=vn(t,m,_,!0);!yt(v,y)||!yt(v+T,y+w)||this.addBar({x:v,y,w:T,h:w,data:b})}this.indices=[];return}if(n.indices[O.BAR]||d.some(ee.bind(null,t))){const _=ee.bind(null,t),x=te(t,n,O.BAR,_),m=t.generateGetBarPoints(x,!1);d.filter(_).filter(b=>_n(t,b,Ea)).forEach(b=>{const v=ke(t,b);for(let y=v.start;y<v.end;y++){const T=b.values[y];if(!Rt(t,T))continue;const w=Nn(t,m,T,y);if(!w)continue;const{rect:C}=w,A=r.left+C.x,S=r.top+C.y,{w:k,h:L}=C;this.addBar({x:A,y:S,w:k,h:L,data:T}),f(A+k/2,S+L/2,T)}})}if(n.indices[O.CANDLESTICK]||d.some(Wt.bind(null,t))){const _=Wt.bind(null,t),x=te(t,n,O.CANDLESTICK,_),m=(s=t.generateGetCandlestickPoints)==null?void 0:s.call(t,x,!1);m&&d.filter(_).filter(b=>_n(t,b,Ea)).forEach(b=>{var v;const y=ke(t,b);for(let T=y.start;T<y.end;T++){const w=b.values[T];if(!((v=t.getCandlestickData)==null?void 0:v.call(t,w)))continue;const A=Xn(t,m,w,T);if(!A)continue;const{body:S}=A,k=r.left+S.x,L=r.top+S.y,{w:E,h:D}=S;this.addBar({x:k,y:L,w:Math.max(1,E),h:Math.max(1,D),data:w}),f(k+E/2,L+D/2,w)}})}const{cx:g,cy:p}=n.pos;g&&p&&d.filter(fe.bind(null,t)).filter(_=>_n(t,_,Ea)).forEach(_=>{const x=ke(t,_),m=Kh(t,_)?Os(l,c,t.config.point_r):null;for(let b=x.start;b<x.end;b++){const v=_.values[b];if(!Rt(t,v))continue;const y=r.left+g(v,b),T=r.top+p(v,b),w=Uh(t,v);yt(y,T)&&(m&&!$s(m,y-r.left,T-r.top)||(this.addPoint({x:y,y:T,sensitivity:w,data:v}),f(y,T,v)))}}),this.buildPointGrid(),this.indices=h?Array.from(h.values()).sort((_,x)=>_[this.indexAxis]-x[this.indexAxis]):[]}hitBar(t,n){for(const i of Jo(this.barGrid,t,n,Zo)){const{w:a=0,h:s=0}=i;if(t>=i.x&&t<=i.x+a&&n>=i.y&&n<=i.y+s)return i.data}return null}hitPoint(t,n){var i,a;let s=null,o=Number.POSITIVE_INFINITY;for(const r of Jo(this.pointGrid,t,n,this.pointCellSize,1)){const l=r.x-t,c=r.y-n,d=Math.sqrt(l*l+c*c),u=(i=r.sensitivity)!=null?i:rn;d<=u&&d<o&&(o=d,s=r)}return(a=s==null?void 0:s.data)!=null?a:null}findNearest(t,n){const i=this.hitBar(t,n);if(i)return i;if(!this.pointBased&&this.grouped&&this.isWithinPlot(t,n)){const a=this.findNearestIndexItem(t,n);if(a)return a.data}return this.hitPoint(t,n)}findNearestShape(t,n){var i;return(i=this.hitBar(t,n))!=null?i:this.hitPoint(t,n)}findNearestIndexByCoord(t,n){var i,a;return(a=(i=this.findNearestIndexItem(t,n))==null?void 0:i.data)!=null?a:null}findInRect(t,n=!1){const i=Math.min(t.x,t.x+t.w),a=Math.max(t.x,t.x+t.w),s=Math.min(t.y,t.y+t.h),o=Math.max(t.y,t.y+t.h),r=new Set,l=[],c=d=>{const u=d.data,h=`${u.id}:${u.index}`;r.has(h)||(r.add(h),l.push(u))};if(n){const d=this.indexAxis,u=d==="y"?s:i,h=d==="y"?o:a;return this.indices.filter(f=>f[d]>=u&&f[d]<=h).forEach(c),l}return this.bars.filter(d=>{var u,h;const f=(u=d.w)!=null?u:0,g=(h=d.h)!=null?h:0;return!(a<d.x||d.x+f<i)&&!(o<d.y||d.y+g<s)}).forEach(c),this.points.filter(d=>d.x>=i&&d.x<=a&&d.y>=s&&d.y<=o).forEach(c),l}addBar(t){this.bars.push(t),qo(this.barGrid,t,Zo)}addPoint(t){var n;const i=(n=t.sensitivity)!=null?n:rn;this.maxPointSensitivity=Math.max(this.maxPointSensitivity,i),this.points.push(t)}buildPointGrid(){this.pointCellSize=Math.max(1,this.maxPointSensitivity),this.pointGrid=new Map;for(const t of this.points)qo(this.pointGrid,t,this.pointCellSize)}isWithinPlot(t,n){const{plot:i}=this;return t>=i.x&&t<=i.x+i.w&&n>=i.y&&n<=i.y+i.h}findNearestIndexItem(t,n){const{indexAxis:i,indices:a}=this,s=i==="y"?n:t;if(!a.length)return null;let o=0,r=a.length-1;for(;o<r;){const d=o+r>>1;a[d][i]<s?o=d+1:r=d}const l=a[o],c=a[o-1];return c&&Math.abs(c[i]-s)<Math.abs(l[i]-s)?c:l}}var wi=wt(5),qh=Object.defineProperty,Qo=Object.getOwnPropertySymbols,Jh=Object.prototype.hasOwnProperty,Qh=Object.prototype.propertyIsEnumerable,tr=(e,t,n)=>t in e?qh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ft=(e,t)=>{for(var n in t||(t={}))Jh.call(t,n)&&tr(e,n,t[n]);if(Qo)for(var n of Qo(t))Qh.call(t,n)&&tr(e,n,t[n]);return e};const U={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},at={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"},Ci={area:"bb-area",areas:"bb-areas"},It={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"},ie={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},De={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},Nt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Pa={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},ln={dragarea:"bb-dragarea",INCLUDED:"_included_"},Un={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},ae={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"},j={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"},Ce={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},Ie={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},lt={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",xgridFocusContinuous:"bb-xgrid-focus-continuous",ygridFocus:"bb-ygrid-focus"},At={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"},Me={level:"bb-level",levels:"bb-levels"},er={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},Kn={region:"bb-region",regions:"bb-regions"},ut={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},kt={shape:"bb-shape",shapes:"bb-shapes"},nr={brush:"bb-brush",subchart:"bb-subchart"},Et={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"},Si={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},ir={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Da={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var V=ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft({},U),at),Ci),It),ie),De),Nt),Pa),ln),ae),j),Ce),Ie),lt),Un),At),Me),er),Kn),ut),kt),nr),Et),Si),ir),Da),tf={boost_useCssRule:!1,boost_useWorker:!1,boost_workerUrl:void 0},ef={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},nf={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},af={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:[]},sf={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},of={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},rf={data_x:void 0,data_idConverter:e=>e,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:""},lf={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},cf=Object.defineProperty,uf=(e,t,n)=>t in e?cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,df=(e,t,n)=>uf(e,typeof t!="symbol"?t+"":t,n);const ar=class Hc{static setOptions(t){for(let n=0;n<t.length;n++)Object.assign(this.data,t[n])}constructor(){return ku(af,tf,rf,ef,lf,nf,sf,of,Hc.data)}};df(ar,"data",{});let cn=ar;class hf{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 ff{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 sr={element:hf,state:ff};class gf{constructor(){Object.keys(sr).forEach(t=>{this[t]=new sr[t]})}getStore(t){return this[t]}}var pf=Object.defineProperty,_f=(e,t,n)=>t in e?pf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xf=(e,t,n)=>_f(e,typeof t!="symbol"?t+"":t,n);const W={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 mf{constructor(){xf(this,"cache",new Map)}add(t,n,i=!1){const a=i?this.cloneTarget(n):n;return this.cache.set(t,a),a}remove(t){const n=Q(t)?[t]:t;for(let i=0;i<n.length;i++)this.cache.delete(n[i])}get(t,n=!1){if(n&&Array.isArray(t)){const i=[];for(let a=0,s;s=t[a];a++)this.cache.has(s)&&i.push(this.cache.get(s));return i}else return this.cache.has(t)?this.cache.get(t):null}has(t){return this.cache.has(t)}getKeys(){return Array.from(this.cache.keys())}reset(t,n){t?this.cache.clear():this.cache.forEach((i,a)=>{/^\$/.test(a)&&(n!=null&&n.some(s=>a.startsWith(s))||this.cache.delete(a))})}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(n=>({x:n.x,value:n.value,id:n.id}))}}}const or="https://github.com/naver/billboard.js/blob/master/MODULE_IMPORTS.md";function vf(e){const t=e,{config:n}=t;let i="";if(se(n.data_type||n.data_types)&&!t[Ui.LINE])i="line";else for(const a in Ui){const s=O[a];if(t.hasType(s)&&!t[Ui[a]]){i=s;break}}i&&rr(`Please, make sure if %c${Au(i)}`,"module has been imported and specified correctly.",or)}function Om(e){const t=Qc[e];t&&rr(`Please, make sure if %c${t}`,"module has been imported and specified correctly.",or)}function rr(e,t,n){var i;const a="[billboard.js]";if((i=N.console)==null?void 0:i.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${a} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),n&&console.info("%c\u2139\uFE0F","font-size:15px",n)}throw Error(`${a} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const bf=/\s?(bb-)/g,yf=/\.+/g;function Tf(e){return e.replace(bf,".$1").replace(yf,".")}function lr(e,t,n=!1){const i=s=>s[e?"getBoundingClientRect":"getBBox"](),a=e?"rectClient":"rectBBox";return n?i(t):!(a in t)||t.hasAttribute("width")&&t[a].width!==+(t.getAttribute("width")||0)?t[a]=i(t):t[a]}function Cn(e,t,n=[-1,1],i=!1){if(!(!e||!Q(t)))if(t.indexOf(`
23
- `)===-1)e.text(t);else{const a=[e.text(),t].map(s=>s.replace(/[\s\n]/g,""));if(a[0]!==a[1]){const s=t.split(`
24
- `),o=i?s.length-1:1;e.html(""),s.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?n[0]*o:n[1]}em`).text(r)})}}}function cr(e){const{x:t,y:n,width:i,height:a}=Ue(e,!0);return[{x:t,y:n+a},{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+a}]}function ur(e){const{width:t,height:n}=ht(e),i=cr(e),a=i[0].x,s=Math.min(i[0].y,i[1].y);return{x:a,y:s,width:t,height:n}}function Zt(e,t){var n;const i=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let a=[0,0];try{a=(0,F.pointer)(i||e,t)}catch(s){}return a.map(s=>isNaN(s)?0:s)}function ht(e,t=!1){return lr(!0,e,t)}function Ue(e,t=!1){return lr(!1,e,t)}function wf(e,t,n){const{rootSelector:i="",sheet:a}=e,s=`${i} ${Tf(t)} {${n.join(";")}}`;return a[a.insertRule?"insertRule":"addRule"](s,a.cssRules.length)}function Cf(e){let t=[];return e.forEach(n=>{var i;try{n.cssRules&&n.cssRules.length&&(t=t.concat(nn(n.cssRules)))}catch(a){(i=N.console)==null||i.warn(`Error while reading rules from ${n.href}: ${String(a)}`)}}),t}function dr(e){var t,n,i,a,s,o;return{x:((n=(t=N.pageXOffset)!=null?t:N.scrollX)!=null?n:0)+((i=e.scrollLeft)!=null?i:0),y:((s=(a=N.pageYOffset)!=null?a:N.scrollY)!=null?s:0)+((o=e.scrollTop)!=null?o:0)}}function Ai(e,t=0,n=0,i=!0){const a=new DOMPoint(t,n),s=e.getScreenCTM(),o=a.matrixTransform(i?s==null?void 0:s.inverse():s);if(i===!1){const r=ht(e);o.x-=r.x,o.y-=r.y}return o}function Ia(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Ma(e,t){var n;const i=(n=e==null?void 0:e.getAttribute)==null?void 0:n.call(e,t);if(i)return parseFloat(i);const a=Ia(e);return t==="x"?a.e:a.f}function Fa(e){const t=e.attr("viewBox");return t?t.trim().split(/[\s,]+/).length===4:!1}function Sf(e,t,n=!1){const i=!!e.node;let a=!1;for(const[s,o]of Object.entries(t))if(a=i?e.style(s)===o:e.style[s]===o,n?!a:a)break;return a}function Zn(){var e,t;return((e=nt)==null?void 0:e.hidden)===!1||((t=nt)==null?void 0:t.visibilityState)==="visible"}function Af(e,t){const{DocumentTouch:n,matchMedia:i,navigator:a}=N,s=i==null?void 0:i("(pointer:coarse)").matches;let o=!1;if(t)if(a&&"maxTouchPoints"in a)o=a.maxTouchPoints>0;else if("ontouchmove"in N||n&&nt instanceof n)o=!0;else if(s)o=!0;else{const l=a.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!s&&(i==null?void 0:i("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function hr(e,t){e.pendingRaf!==null?(N.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=N.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=N.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}const Oa={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,i=e())=>{t.dispatchEvent(new MouseEvent(n,i))}}catch(t){return(n,i,a=e())=>{const s=nt.createEvent("MouseEvent");s.initMouseEvent(i,a.bubbles,a.cancelable,N,0,a.screenX,a.screenY,a.clientX,a.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(e,t,n)=>{const i=new Touch(Ae({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}},{setTimeout:kf,clearTimeout:Lf}=N;function Rf(e,t){const n=[];let i,a=null;const s=function(){s.clear(),t&&a===null&&(a=ys(()=>{a=null,t()})),e===!1?i=Ts(()=>{i=null,n.forEach(o=>o())},{timeout:200}):i=kf(()=>{i=null,n.forEach(o=>o())},$(e)?e:200)};return s.clear=()=>{i&&((e===!1?ou:Lf)(i),i=null)},s.clearLive=()=>{a!==null&&(su(a),a=null)},s.add=o=>n.push(o),s.remove=o=>{const r=n.indexOf(o);r!==-1&&n.splice(r,1)},s}function fr(){let e=[];const t=function(n,i){function a(){var s;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(s=l.empty)!=null&&s.call(l)){o++;continue}if(Zn()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}Ps(()=>{i==null||i()},a)};return t.add=function(n){ot(n)?e=e.concat(n):e.push(n)},t}const Se={},ki=new Set,un=new Map,Ef=5e3,gr=3;let Pf=0;function Df(){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(e){return""}}function $a(){const{Blob:e,Worker:t,URL:n}=N;return t&&e&&(n!=null&&n.createObjectURL)&&(n!=null&&n.revokeObjectURL)?{Blob:e,Worker:t,URL:n}:null}function pr(){return N.Worker||null}function If(e){var t,n;return typeof e=="number"?{timeout:e,workerUrl:""}:{timeout:(t=e==null?void 0:e.timeout)!=null?t:Ef,workerUrl:(n=e==null?void 0:e.workerUrl)!=null?n:""}}function _r(e,t=!1){var n,i;const a=Se[e];t&&ki.add(e),a&&((n=a.worker)==null||n.terminate(),a.revoke&&((i=$a())==null||i.URL.revokeObjectURL(a.src)),delete Se[e]);for(const s of un.keys())s.startsWith(`${e}:`)&&un.delete(s)}function Mf(e,t){if(e===t)return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return!0}}function Ff(e){const[t,...n]=e;return Array.isArray(t)?[t.slice(0,gr).map(i=>Array.isArray(i)?i.slice(0,gr+1):i),...n]:e}function xr(e,t,n,i){const a=++Pf;let s=!1,o;const r=new Promise((l,c)=>{const d=(g,p)=>{s||(s=!0,o(),g(p))},u=function(g){var p;((p=g.data)==null?void 0:p.id)===a&&(g.data.error?d(c,new Error(g.data.error)):d(l,g.data.result))},h=function(){d(c,new Error("worker error"))},f=setTimeout(()=>d(c,new Error("worker timeout")),i);o=()=>{clearTimeout(f),e.removeEventListener("message",u),e.removeEventListener("error",h)},e.addEventListener("message",u),e.addEventListener("error",h)});try{e.postMessage({args:n,id:a,op:t})}catch(l){throw s=!0,o(),l}return r}function Of(e,t,n,i,a,s){const o=Ff(a),r=xr(e,n,o,s).then(l=>Mf(l,i(...o)),()=>!1).then(l=>(l?un.set(t,!0):un.delete(t),l));return un.set(t,r),r}function $f(e,t=""){const n=!!pr(),i=t?null:$a(),a=t?"":Df(),s=t||"blob";if(!n||!t&&(!i||!a)||ki.has(s))return null;if(!(s in Se))try{if(t)Se[s]={revoke:!1,src:t,worker:null};else if(i){const o=new i.Blob([a],{type:"text/javascript"});Se[s]={revoke:!0,src:i.URL.createObjectURL(o),worker:null}}}catch(o){return null}return{key:s,src:Se[s].src}}function Bf(e,t){const n=Se[e],i=pr();if(!n||!i||ki.has(e))return null;if(!n.worker)try{n.worker=new i(t)}catch(a){return _r(e,!0),null}return n.worker}function Ba(e=!0,t,n,i,a){const{timeout:s,workerUrl:o}=If(a),r=function(...c){const d=n(...c);i(d)};let l=r;if(e){const c=$f(t,o),d=c?Bf(c.key,c.src):null;if(d&&c){const{key:u}=c;l=function(...h){var f;const g=()=>{_r(u,!0),l=r,r(...h)};try{const p=`${u}:${t}`,_=(f=un.get(p))!=null?f:Of(d,p,t,n,h,s);xr(d,t,h,s).then(x=>{_===!0?i(x):_.then(m=>m?i(x):g())},g)}catch(p){g()}}}}return l}function zf(){const e=$a();for(const t in Se){const n=Se[t];n.worker&&n.worker.terminate(),n.src&&n.revoke&&(e==null||e.URL.revokeObjectURL(n.src)),delete Se[t]}ki.clear(),un.clear()}const za=34,qn=10,Na=13;function mr(e){const t=e.charCodeAt(0);function n(a,s){const o=[];let r=a.length,l=0,c=0,d=r<=0,u=!1;a.charCodeAt(0)===65279&&l++,a.charCodeAt(r-1)===qn&&--r,a.charCodeAt(r-1)===Na&&--r;function h(){if(d)return null;if(u)return u=!1,null;const g=l;let p,_;if(a.charCodeAt(g)===za){for(;++l<r;)if(a.charCodeAt(l)===za){if(a.charCodeAt(l+1)!==za)break;l++}return(_=l++)>=r?d=!0:(p=a.charCodeAt(l++))===qn?u=!0:p===Na&&(u=!0,a.charCodeAt(l)===qn&&++l),a.slice(g+1,_).replace(/""/g,'"')}for(;l<r;){if((p=a.charCodeAt(_=l++))===qn)u=!0;else if(p===Na)u=!0,a.charCodeAt(l)===qn&&++l;else if(p!==t)continue;return a.slice(g,_)}return d=!0,a.slice(g,r)}let f;for(;(f=h())!==null;){const g=[];for(;f!==null;)g.push(f),f=h();if(s){const p=s(g,c++);p!=null&&o.push(p)}else o.push(g)}return o}function i(a,s){let o=[];return n(a,(r,l)=>{var c;if(l===0)return o=r,null;const d={};for(let u=0;u<o.length;u++)d[o[u]]=(c=r[u])!=null?c:"";return s?s(d,l-1,o):d})}return{parse:i,parseRows:n}}const vr=mr(","),br=mr(" "),Nf=vr.parse,Xf=vr.parseRows,Gf=br.parse,Vf=br.parseRows;function yr(e){const t=[];return e.forEach(function(n,i){const a=n[0];n.forEach(function(s,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof s=="undefined")throw new Error(`Source data is missing a component at (${i}, ${o})!`);t[o-1][a]=s}})}),t}function Tr(e){const t=e[0],n=[];return e.forEach(function(i,a){if(a>0){const s={};i.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${a}, ${r})!`);s[t[r]]=o}),n.push(s)}}),n}function wr(e,t){const n=[];let i,a;if(Array.isArray(e)){const s=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let d=o;return c.some(function(u){return!(d=d&&typeof d=="object"&&u in d?d[u]:void 0)}),d};t.x?i=t.value.concat(t.x):i=t.value,n.push(i),e.forEach(function(o){const r=i.map(function(l){let c=s(o,l);return typeof c=="undefined"&&(c=null),c});n.push(r)}),a=Tr(n)}else Object.keys(e).forEach(function(s){var o;const r=[].concat(e[s]);(o=r.unshift)==null||o.call(r,s),n.push(r)}),a=yr(n);return a}function Wf(e,t="csv",n,i,a){const s=new XMLHttpRequest,o={csv:Yf,tsv:Hf,json:wr};s.open("GET",e),n&&Object.keys(n).forEach(function(r){s.setRequestHeader(r,n[r])}),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){const r=s.responseText;r&&a.call(this,o[t](t==="json"?JSON.parse(r):r,i))}else throw new Error(`${e}: Something went wrong loading!`)},s.send()}function Cr(e,t){const n=e.rows(t);let i;return n.length===1?(i=[{}],n[0].forEach(a=>{i[0][a]=null})):i=e.parse(t),i}function Yf(e){return Cr({rows:Xf,parse:Nf},e)}function Hf(e){return Cr({rows:Vf,parse:Gf},e)}const jf=5e3;function Uf(e){var t,n;const i=e[0];if(ot(i)){let a=0;for(let s=0,o=e.length;s<o;s++)a+=(n=(t=e[s])==null?void 0:t.length)!=null?n:0;return a}return e.length*Object.keys(i!=null?i:{}).length}function Sr(e,t){const n=e||(t==null?void 0:t.data_keys);return n!=null&&n.x&&(t.data_x=n.x),n}function Kf(e,t,n){const i=this,{config:a}=i;let s;e.forEach(o=>{const r=i.getXKey(o);if(n.customX||n.timeSeries?n.xs.indexOf(r)>=0?s=(n.appendXs&&i.data.xs[o]||[]).concat(t.map((l,c)=>{const d=l[r];return q(d)?i.generateTargetX(d,o,c):!1}).filter(l=>l!==!1)):a.data_x?s=this.getOtherTargetXs():bt(a.data_xs)&&(s=i.getXValuesOfXKey(r,i.data.targets)):s=t.map((l,c)=>c),s)i.data.xs[o]=s;else throw new Error(`x is not defined for id = "${o}".`)})}var Zf={convertData(e,t){const{config:n}=this,i=o=>!(o!=null&&o.length)||se(o[0])?!1:n.boost_useWorker==="auto"?Uf(o)>=jf:!!n.boost_useWorker,a=n.boost_workerUrl?{workerUrl:n.boost_workerUrl}:void 0;let s=e;if(e.bindto&&(s={},["url","mimeType","headers","keys","json","rows","columns"].forEach(o=>{const r=`data_${o}`;r in e&&(s[o]=e[r])})),s.url&&t)Wf(s.url,s.mimeType,s.headers,Sr(s.keys,n),t);else if(s.json)Ba(i(s.json),"json",wr,t,a)(s.json,Sr(s.keys,n));else if(s.rows)Ba(i(s.rows),"rows",Tr,t,a)(s.rows);else if(s.columns)Ba(i(s.columns),"columns",yr,t,a)(s.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const n=this,{axis:i,config:a,state:s}=n,o=a.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((g,p)=>(n.isX.call(n,p)?g.xs.push(p):g.ids.push(p),g),{ids:[],xs:[]}):{ids:[],xs:[]},d={appendXs:t,xs:c,categorized:i==null?void 0:i.isCategorized(),timeSeries:i==null?void 0:i.isTimeSeries(),customX:i==null?void 0:i.isCustomX()};Kf.bind(n)(l,e,d);const u=d.customX&&d.categorized&&a.axis_x_categories.length?new Map(a.axis_x_categories.map((g,p)=>[g,p])):null,h=a.data_idConverter.bind(n.api),f=l.map((g,p)=>{const _=h(g),x=n.getXKey(g),m=d.customX&&d.categorized,b=m&&p===0&&(()=>{const T=Ds(a.axis_x_categories);return e.every(w=>T.has(w[x]))})(),v=e.__append__,y=x===null&&v?n.api.data.values(g).length:0;return{id:_,id_org:g,values:e.map((T,w)=>{var C;const A=T[x];let S=T[g],k;if(S=S!==null&&!isNaN(S)&&!tt(S)?+S:ot(S)||tt(S)?S:null,(m||s.hasRadar)&&p===0&&!Ct(A)){!b&&w===0&&!v&&(a.axis_x_categories=[],u&&u.clear());const L=String(A);k=(C=u==null?void 0:u.get(L))!=null?C:-1,k===-1&&(k=a.axis_x_categories.length,a.axis_x_categories.push(A),u==null||u.set(L,k))}else k=n.generateTargetX(A,g,y+w);return(Ct(S)||n.data.xs[g].length<=w)&&(k=void 0),{x:k,value:S,id:_,index:-1}}).filter(T=>ct(T.x))}});if(f.forEach(g=>{var p;a.data_xSort&&(g.values=g.values.sort((_,x)=>{const m=_.x||_.x===0?_.x:1/0,b=x.x||x.x===0?x.x:1/0;return m-b})),g.values.forEach((_,x)=>_.index=x),(p=n.data.xs[g.id])==null||p.sort((_,x)=>_-x)}),s.hasNegativeValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value<0)),s.hasPositiveValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value>0)),o&&n.isValidChartType(o)){const g=n.mapToIds(f).filter(p=>!(p in a.data_types)||!n.isValidChartType(a.data_types[p]));n.setTargetType(g,o)}return f.forEach(g=>n.cache.add(g.id_org,g,!0)),f}};const qf={areaRange:{high:0,mid:1,low:2},candlestick:{open:0,high:1,low:2,close:3,volume:4}};function Ar(e){return ot(e)?e:[e]}var Jf={isX(e){const t=this,{config:n}=t,i=n.data_x&&e===n.data_x,a=bt(n.data_xs)&&Su(n.data_xs,e);return i||a},isStackNormalized(){const{config:e}=this;return!!((e.data_stack_normalize===!0||Ut(e.data_stack_normalize))&&e.data_groups.length)},isStackNormalizedPerGroup(){var e;const{config:t}=this;return!!(Ut(t.data_stack_normalize)&&((e=t.data_stack_normalize)!=null&&e.perGroup)&&t.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(n=>n.indexOf(e)>=0&&n.length>1):t.length>0},hasAxisGroupedData(e){const t=this,{axis:n}=t;return t.data.targets.filter(s=>n.getId(s.id)===e).map(s=>s.id).some(s=>t.isGrouped(s))},getXKey(e){const t=this,{config:n}=t;return n.data_x?n.data_x:bt(n.data_xs)?n.data_xs[e]:null},getXValuesOfXKey(e,t){const n=this,i=t&&bt(t)?n.mapToIds(t):[];let a;return i.forEach(s=>{n.getXKey(s)===e&&(a=n.data.xs[s])}),a},getIndexByX(e,t){const n=this;return t?t.indexOf(Q(e)?e:+e):(n.filterByX(n.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const n=this;return e in n.data.xs&&n.data.xs[e]&&q(n.data.xs[e][t])?n.data.xs[e][t]:t},getOtherTargetXs(){const e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},getOtherTargetX(e){const t=this.getOtherTargetXs();return t&&e<t.length?t[e]:null},addXs(e){const t=this,{config:n}=t;Object.keys(e).forEach(i=>{n.data_xs[i]=e[i]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(bt(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:n}=t;let i;return e&&(i=n.data_names[e.id],e.name=i!==void 0?i:e.id),e},getAllValuesOnIndex(e,t=!1){const n=this;let i=n.filterTargetsToShow(n.data.targets).map(a=>n.addName(n.getValueOnIndex(a.values,e)));return t&&(i=i.filter(a=>a&&"value"in a&&q(a.value))),i},getValueOnIndex(e,t){var n;if(((n=e[t])==null?void 0:n.index)===t)return e[t];const i=e.filter(a=>a.index===t);return i.length?i[0]:null},updateTargetX(e,t){const n=this;e.forEach(i=>{i.values.forEach((a,s)=>{a.x=n.generateTargetX(t[s],i.id,s)}),n.data.xs[i.id]=t})},updateTargetXs(e,t){const n=this;e.forEach(i=>{t[i.id]&&n.updateTargetX([i],t[i.id])})},generateTargetX(e,t,n){const i=this,{axis:a}=i;let s=a!=null&&a.isCategorized()?n:e||n;if(a!=null&&a.isTimeSeries()){const o=Vt.bind(i);s=o(e||i.getXValue(t,n))}else a!=null&&a.isCustomX()&&!(a!=null&&a.isCategorized())&&(s=q(e)?+e:i.getXValue(t,n));return s},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return ct(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return ct(t)?t:null},getBaseValue(e){const t=this,{hasAxis:n}=t.state;let{value:i}=e;return i&&n&&(t.isAreaRangeType(e)?i=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(i=t.getBubbleZData(i,"y"))),i},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let n=1/0,i=-1/0;const a=e||this.data.targets.map(s=>s.values);for(let s=0;s<a.length;s++){const o=a[s];for(let r=0;r<o.length;r++){const l=t(o[r]);$(l)&&(l<n&&(n=l),l>i&&(i=l))}}return{min:n,max:i}},getMinMaxData(){const e=this,t=W.dataMinMax;let n=e.cache.get(t);if(!n){const i=e.data.targets.map(c=>c.values),a=e.getMinMaxValue(i),s=[],o=[],{min:r,max:l}=a;i.forEach(c=>{const d=e.getFilteredDataByValue(c,r),u=e.getFilteredDataByValue(c,l);if(d.length)for(let h=0;h<d.length;h++)s.push(d[h]);if(u.length)for(let h=0;h<u.length;h++)o.push(u[h])}),e.cache.add(t,n={min:s,max:o})}return n},getTotalPerIndex(e){const t=this,{config:n}=t,i=e?`${W.dataTotalPerIndex}-${e}`:W.dataTotalPerIndex,a=t.cache.get(i);let s=(a==null?void 0:a.generation)===t.state.dataGeneration?a.value:null;if((t.config.data_groups.length||t.isStackNormalized())&&!s){s=[];let{targets:o}=t.data;if(t.isStackNormalizedPerGroup()&&e){const r=n.data_groups.find(l=>l.indexOf(e)>=0);if(r)o=o.filter(l=>r.indexOf(l.id)>=0);else return null}o.forEach(r=>{r.values.forEach((l,c)=>{s[c]||(s[c]=0),s[c]+=$(l.value)?l.value:0})}),t.cache.add(i,{generation:t.state.dataGeneration,value:s})}return s},getVisibleTotalPerIndex(e){const t=this,{api:n,config:i,state:a,cache:s}=t;let o=s.get(W.visibleTotalPerIndex);if((!o||o.generation!==a.dataGeneration)&&(o=s.add(W.visibleTotalPerIndex,{generation:a.dataGeneration,values:new Map})),o.values.has(e))return o.values.get(e);const r=n.data.values.bind(n),{hiddenTargetIds:l}=a;let c=t.getTotalPerIndex(e);if(c===null)return o.values.set(e,c),c;if(l.size){let d=[...l];if(e){const u=i.data_groups.find(h=>h.indexOf(e)>=0);u&&(d=d.filter(h=>u.indexOf(h)>=0))}if(d.length){let u=r(d,!1);u.length&&(u=u.reduce((h,f)=>h.map((g,p)=>($(g)?g:0)+f[p])),c=c.map((h,f)=>h-u[f]))}}return o.values.set(e,c),c},getTotalDataSum(e){const t=this,n=W.dataTotalSum;let i=t.cache.get(n);return $(i)||(i=t.data.targets.reduce((a,s)=>a+s.values.reduce((o,r)=>{var l;return o+((l=r.value)!=null?l:0)},0),0),t.cache.add(n,i)),e&&(i-=t.getHiddenTotalDataSum()),i},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:n}}=e;let i=0;return n.size&&(i=t.data.values.bind(t)([...n]).reduce((a,s)=>a+s,0)),i},getFilteredDataByValue(e,t){return e.filter(n=>this.getBaseValue(n)===t)},getMaxDataCount(){const{targets:e}=this.data;let t=0;for(let n=0;n<e.length;n++)e[n].values.length>t&&(t=e[n].values.length);return t},getMaxDataCountTarget(){const e=this,{cache:t,state:n}=e,i=t.get(W.maxDataCountTarget);if(i&&i.generation===n.dataGeneration)return i.value;let a=e.filterTargetsToShow()||[];const s=a.length,o=e.config.axis_x_inverted;if(s>1){const r=[];for(let l=0;l<a.length;l++){const c=a[l].values;for(let d=0;d<c.length;d++)r.push(c[d].x)}a=r,a=pn(qi(a)).map((l,c,d)=>({x:l,index:o?d.length-c-1:c}))}else s&&(a=a[0].values.concat());return t.add(W.maxDataCountTarget,{value:a,generation:n.dataGeneration}),a},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?ot(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const n=this.mapToIds(e);for(let i=0,a;a=n[i];i++)if(a===t)return!0;return!1},isTargetToShow(e){return!this.state.hiddenTargetIds.has(e)},isLegendToShow(e){return!this.state.hiddenLegendIds.has(e)},getTargetsToShow(){var e;const{state:t}=this;return(e=t._targetsToShow)!=null?e:this.filterTargetsToShow()},filterTargetsToShow(e){const t=this;if(!e){const{cache:n,data:i,state:a}=t,s=W.filteredTargets,o=n.get(s);if(o&&o.generation===a.dataGeneration)return o.value;const r=i.targets.filter(l=>t.isTargetToShow(l.id));return n.add(s,{value:r,generation:a.dataGeneration}),r}return e.filter(n=>t.isTargetToShow(n.id))},mapTargetsToUniqueXs(e){const t=this,{axis:n}=t;let i=[];return e!=null&&e.length&&(i=qi(Lu(e.map(a=>a.values.map(s=>+s.x)))),i=n!=null&&n.isTimeSeries()?i.map(a=>new Date(+a)):i.map(Number)),pn(i)},addTargetIds(e,t){const{state:n}=this;Ar(t).forEach(i=>n[e].add(i))},removeTargetIds(e,t){const{state:n}=this;Ar(t).forEach(i=>n[e].delete(i))},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e),this.cache.remove(W.visibleTotalPerIndex)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e),this.cache.remove(W.visibleTotalPerIndex)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:n}=t.state,i={},a=t.isMultipleX();let s=null;if(a){const o=t.cache.get(W.valuesXIndexMap);if(o&&o.generation===t.state.dataGeneration)s=o.value;else{const r=t.mapTargetsToUniqueXs(t.data.targets).map(l=>Q(l)?l:+l);s=new Map(r.map((l,c)=>[l,c])),t.cache.add(W.valuesXIndexMap,{value:s,generation:t.state.dataGeneration})}}return e.forEach(o=>{const r=[];o.values.filter(({value:l})=>q(l)||l===null).forEach(l=>{let{value:c}=l;if(c!==null&&t.isCandlestickType(l)&&(c=ot(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),ot(c))r.push(...c);else if(tt(c)&&"high"in c)r.push(...Object.values(c));else if(t.isBubbleZType(l))r.push(n&&t.getBubbleZData(c,"y"));else if(a&&s){const d=Q(l.x)?l.x:+l.x,u=s.get(d);u!==void 0&&(r[u]=c)}else r.push(c)}),i[o.id]=r}),i},hasMultiTargets(){return this.filterTargetsToShow().length>1},orderTargets(e){const t=this,n=e.slice(),i=t.getSortCompareFn();return i&&n.sort(i),n},getSortCompareFn(e=!1){const t=this,{config:n}=t,i=n.data_order,a=/asc/i.test(i),s=/desc/i.test(i);let o;if(a||s){const r=(c,d)=>c+Math.abs(d.value),l=c=>$(c)?c:"values"in c?c.values.reduce(r,0):c.value;o=(c,d)=>{const u=l(c),h=l(d);return e?a?u-h:h-u:a?h-u:u-h}}else z(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return this.getValuesByX(e).get(this.getXCacheKey(t))||[]},filterNullish(e){const t=n=>q(n.value);return e&&e.filter(n=>"value"in n?t(n):n.values.some(t))},filterRemoveNull(e){return e.filter(t=>q(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(n=>({id:n.id,id_org:n.id_org,values:n.values.filter(i=>t[0]<=i.x&&i.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return tn(e)&&e||Ut(e)&&bt(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:n,config:i,state:{hasRadar:a,inputType:s,eventReceiver:{coords:o,rect:r}}}=t;let l;if(a){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const d=(0,F.select)(c).datum();l=d&&Object.keys(d).length===1?d.index:void 0}else{const c=i.axis_rotated,d=dr(n.chart.node()),u=s==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?u.clientY+d.y:u.clientX+d.x;if(Fa(n.svg)){const f=[h,0];c&&f.reverse(),h=Ai(n.eventRect.node(),...f)[c?"y":"x"]}else h-=c?r.top:r.left;l=Ji(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,n){var i,a,s;const o=this,r=1.3,l=[e,t].map(c=>o.dataLabelFormat()(c));if(o.config.render_mode==="canvas"&&!o.$el.svg){const c=(a=(i=o.$el.chart)==null?void 0:i.node)==null?void 0:a.call(i),d=c==null?void 0:c.ownerDocument,u=d==null?void 0:d.createElementNS("http://www.w3.org/2000/svg","svg");if(c&&u){const h=l.map(g=>{const p=d.createElementNS("http://www.w3.org/2000/svg","text");return p.textContent=g,u.appendChild(p),p});u.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",c.appendChild(u);const f=h.map(g=>g.getBoundingClientRect()[n]*r);return u.remove(),f}}return((s=o.getTextRect(l))==null?void 0:s.map(c=>c[n]*r))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const n=e[t].x,i=[];let a;for(a=t-1;a>=0&&n===e[a].x;a--)i.push(e[a]);for(a=t;a<e.length&&n===e[a].x;a++)i.push(e[a]);return i},getXCacheKey(e){return Q(e)?e:+e},getValuesByX(e){const t=this,{cache:n,state:i}=t,a=e.map(r=>{const{values:l}=r,c=l[0],d=l[l.length-1];return`${r.id}:${l.length}:${c?t.getXCacheKey(c.x):""}:${d?t.getXCacheKey(d.x):""}`}).join("|"),s=n.get(W.valuesByX);if(s&&s.generation===i.dataGeneration&&s.targetKey===a)return s.value;const o=new Map;for(let r=0;r<e.length;r++){const l=e[r].values;for(let c=0;c<l.length;c++){const d=l[c],u=t.getXCacheKey(d.x),h=o.get(u);h?h.push(d):o.set(u,[d])}}return n.add(W.valuesByX,{generation:i.dataGeneration,targetKey:a,value:o}),o},getClosestCandidates(e,t,n=!0){const i=this,{config:a,scale:s}=i,o=e.length,r=e[0];if(!n||o<200||!r||!a.data_xSort)return e;const l=i.isBarType(r.id),c=i.isCandlestickType(r.id),d=a.point_sensitivity;if(!(l||c)&&!$(d))return e;const u=s.zoom||s.x,h=t[+a.axis_rotated],f=u(e[0].x)<=u(e[o-1].x);let g=0,p=o-1;for(;g<p;){const v=g+p>>1,y=u(e[v].x);(f?y<h:y>h)?g=v+1:p=v}const _=[],x=new Set,m=v=>{v>=0&&v<o&&!x.has(v)&&(x.add(v),_.push(e[v]))},b=v=>{if(v<0||v>=o)return;const y=i.getXCacheKey(e[v].x);let T=v;for(;T>=0&&i.getXCacheKey(e[T].x)===y;)m(T--);for(T=v+1;T<o&&i.getXCacheKey(e[T].x)===y;)m(T++)};if(l||c)for(let v=g-2;v<=g+2;v++)b(v);else{const v=d,y=(T,w)=>{for(let C=T;C>=0&&C<o;C+=w){const A=e[C];if(Math.abs(u(A.x)-h)>v)break;m(C)}};y(g,1),y(g-1,-1)}return _},findClosestFromTargets(e,t){const n=this,i=[];for(let a=0;a<e.length;a++){const s=n.findClosest(e[a].values,t);s&&i.push(s)}return n.findClosest(i,t,!1)},findClosest(e,t,n=!0){const i=this,{$el:{main:a}}=i,s=i.getClosestCandidates(e,t,n);let o,r;for(let l=0;l<s.length;l++){const c=s[l];if(!c||!q(c.value))continue;const d=i.isBarType(c.id),u=i.isCandlestickType(c.id);if(d||u){const h=d?`.${ie.chartBar}.${U.target}${i.getTargetSelectorSuffix(c.id)} .${ie.bar}-${c.index}`:`.${De.chartCandlestick}.${U.target}${i.getTargetSelectorSuffix(c.id)} .${De.candlestick}-${c.index} path`;!r&&i.isWithinBar(a.select(h).node())&&(r=c)}else{const h=i.dist(c,t),f=i.getPointSensitivity(c);h<f&&(o===void 0||h<o)&&(o=h,r=c)}}return r},dist(e,t){const n=this,{config:{axis_rotated:i},scale:a}=n,s=+i,o=+!i,r=n.circleY(e,e.index),c=(a.zoom||a.x)(e.x)-t[s],d=r-t[o];return Math.sqrt(c*c+d*d)},convertValuesToStep(e){const t=this,{axis:n,config:i}=t,a=i.line_step_type,s=n?n.isCategorized():!1,o=ot(e)?e.concat():[e];if(!(s||/step\-(after|before)/.test(a)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:d}=r;o.unshift({x:--d,value:r.value,id:c}),s&&a==="step-after"&&o.unshift({x:d-1,value:r.value,id:c}),d=l.x,o.push({x:++d,value:l.value,id:c}),s&&a==="step-before"&&o.push({x:d+1,value:l.value,id:c})}return o},convertValuesToRange(e){const t=ot(e)?e.concat():[e],n=[];return t.forEach(i=>{const{x:a,id:s}=i;n.push({x:a,id:s,value:i.value[0]}),n.push({x:a,id:s,value:i.value[2]})}),n},updateDataAttributes(e,t){const n=this,{config:i}=n,a=i[`data_${e}`];return Ct(t)||(Object.keys(t).forEach(s=>{a[s]=t[s]}),n.redraw({withLegend:!0})),a},getRangedData(e,t="",n="areaRange"){var i,a;const s=e==null?void 0:e.value;if(ot(s)){if(n==="bar")return s.reduce((o,r)=>r-o);{const o=(a=(i=qf[n])==null?void 0:i[t])!=null?a:-1;return o>=0?s[o]:void 0}}else if(s&&t)return s[t];return s},setRatioForGroupedData(e){const t=this,{config:n}=t;if(n.data_groups.length&&e.some(i=>t.isGrouped(i.id))){const i=a=>t.getRatio("index",a,!0);e.forEach(a=>{"values"in a?a.values.forEach(i):i(a)})}},getRatio(e,t,n=!1){const i=this,{config:a,state:s}=i,o=i.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(i.pie.padAngle()())r=t.value/i.getTotalDataSum(!0);else{const l=a.gauge_fullCircle?i.getArcLength():i.getStartingAngle()*-2,c=i.hasType("gauge")?l:Math.PI*2;r=(t.endAngle-t.startAngle)/c}else if(e==="index"){const l=i.getVisibleTotalPerIndex(i.isStackNormalizedPerGroup()?t.id:void 0);if(l===null)return r;const c=l[t.index];t.ratio=$(t.value)&&l&&c?t.value/c:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/s.current.dataMax*a.radar_size_ratio;else if(e==="bar"){const c=i.getYScaleById.bind(i)(t.id).domain().reduce((d,u)=>u-d);r=c===0?0:Math.abs(i.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=i.getTotalDataSum(!0));return n&&r?r*100:r},updateDataIndexByX(e){const t=this,n=e.reduce((i,a,s)=>(i[Number(a.x)]=s,i),{});t.data.targets.forEach(i=>{i.values.forEach((a,s)=>{let o=n[Number(a.x)];o===void 0&&(o=s),a.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(tt(e.value)&&("z"in e.value||"y"in e.value)||ot(e.value)&&e.value.length>=2)},isBarRangeType(e){var t;const n=this,{value:i}=e;return n.isBarType(e)&&!((t=n.isSubchartSourceTypeOf)!=null&&t.call(n,e,O.CANDLESTICK))&&ot(i)&&i.length>=2&&i.every($)},getDataById(e){var t;const n=this.cache.get(e)||this.api.data(e);return(t=n==null?void 0:n[0])!=null?t:n}};function Li(e,t=!1){const n=this,{api:i}=n;t&&n.api.flush(!0),e==null||e.call(i)}var Qf={load(e,t){const n=this,{axis:i,data:a,org:s,scale:o}=n,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;if(c){t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(u=>{var h;const f=((h=t.types)==null?void 0:h[u.id])||t.type;n.setTargetType(u.id,f)});const d=new Map(c.map(u=>[u.id,u]));a.targets.forEach(u=>{const h=d.get(u.id);if(h){if(r){const f=h.values;for(let g=0;g<f.length;g++)u.values.push(f[g])}else u.values=h.values;d.delete(u.id)}}),d.forEach(u=>a.targets.push(u))}if(n.state.isCanvasMode){n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.updateTypesElements(),Li.call(n,t.done,t.resizeAfter);return}n.updateTargets(a.targets),o.zoom&&(l.x=i.isCategorized()?o.x.orgScale():(s.xScale||o.x).copy(),l.domain=n.getXDomain(a.targets),l.x.domain(l.domain),l.currentDomain=n.zoom.getDomain(),n.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,n.$el.eventRect.property("__zoom",null))),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(s.xDomain=l.domain,s.xScale=l.x,i.isCategorized()&&(l.currentDomain=n.getZoomDomainValue(l.currentDomain),s.xDomain=n.getZoomDomainValue(s.xDomain),s.xScale=l.x.domain(s.xDomain)),n.updateCurrentZoomTransform(l.x,l.currentDomain)):s.xScale&&s.xScale.domain(s.xDomain),n.updateTypesElements(),Li.call(n,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(!1,[W.filteredTargets,W.maxDataCountTarget,W.valuesXIndexMap,W.maxTickSize]),t.convertData(e,n=>{const i=e.data||n;e.append&&(i.__append__=!0),i&&t.load(t.convertDataToTargets.call(t,i),e)}))},unload(e,t){var n;const i=this,{state:a,$el:s,$T:o}=i,r=!!((n=i.hasLegendDefsPoint)!=null&&n.call(i));let l=t,c=e;if(i.cache.reset(!1,[W.filteredTargets,W.maxDataCountTarget,W.valuesXIndexMap,W.maxTickSize]),l||(l=()=>{}),c=c.filter(h=>i.hasTarget(i.data.targets,h)),c.length===0){l();return}const d=new Set(c);if(a.isCanvasMode){c.forEach(h=>{a.withoutFadeIn[h]=!1}),i.data.targets=i.data.targets.filter(h=>!d.has(h.id)),i.removeHiddenTargetIds(c),i.removeHiddenLegendIds(c),i.updateTypesElements(),l();return}c.forEach(h=>{var f;const g=i.getTargetSelectorSuffix(h);a.withoutFadeIn[h]=!1,s.legend&&s.legend.selectAll(`.${j.legendItem}${g}`).remove(),r&&((f=s.defs)==null||f.select(`#${i.getDefsPointId(g)}`).remove())}),i.data.targets=i.data.targets.filter(h=>!d.has(h.id)),a.hasFunnel&&i.updateFunnel(i.data.targets),a.hasTreemap&&i.updateTargetsForTreemap(i.data.targets),i.updateTypesElements();const u=s.svg.selectAll(c.map(h=>i.selectorTarget(h)));o(u).style("opacity","0").remove().call(ri,l)}},kr=wt(6),tg={setExpand(e,t,n){const i=this,{config:a,$el:{circle:s}}=i;s&&a.point_focus_expand_enabled&&i.expandCircles(e,t,n),i.expandBarTypeShapes(!0,e,t,n)},expandBarTypeShapes(e=!0,t,n,i){const a=this;["bar","candlestick"].filter(s=>a.$el[s]).forEach(s=>{i&&a.$el[s].classed(U.EXPANDED,!1),a.getShapeByIndex(s,t,n).classed(U.EXPANDED,e)})},setOverOut(e,t){const n=this,{config:i,state:{hasFunnel:a,hasRadar:s,hasTreemap:o},$el:{main:r}}=n,l=tt(t);if(l||t!==-1){const c=i[e?"data_onover":"data_onout"].bind(n.api);if(i.color_onover&&n.setOverColor(e,t,l),l){const d=n.getTargetSelectorSuffix(t.id),u=a||o?`${U.target+d} .${kt.shape}`:at.arc+d;c(t,r.select(`.${u}`).node())}else if(i.tooltip_grouped)e&&(s&&n.isPointFocusOnly()?n.showCircleFocus(n.getAllValuesOnIndex(t,!0)):n.setExpand(t,null,!0)),!n.isMultipleX()&&r.selectAll(`.${kt.shape}-${t}`).each(function(d){c(d,this)});else{const d=n.cache.get(W.setOverOut)||[],u=r.selectAll(`.${kt.shape}-${t}`).filter(function(f){return n.isWithinShape(this,f)}),h=u.filter(function(){return d.every(f=>f!==this)});if(!e||u.empty()||d.length===h.size()&&h.nodes().every((f,g)=>f!==d[g]))for(;d.length;){const f=d.pop();i.data_onout.bind(n.api)((0,F.select)(f).datum(),f)}h.each(function(){e&&(c((0,F.select)(this).datum(),this),d.push(this))}),n.cache.add(W.setOverOut,d)}}},callOverOutForTouch(e){const t=this,n=t.cache.get(W.callOverOutForTouch);(tt(e)&&n?e.id!==n.id:e!==n)&&((n||$(n))&&t.setOverOut(!1,n),(e||$(e))&&t.setOverOut(!0,e),t.cache.add(W.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:n}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,kr.drag)().on("drag",function(i){n.event=i,e.drag(Zt(i,this))}).on("start",function(i){n.event=i,e.dragstart(Zt(i,this))}).on("end",i=>{n.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,n){var i,a,s;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:d,hasRadar:u,hasTreemap:h},$el:{eventRect:f,funnel:g,radar:p,svg:_,treemap:x}}=o;let m=(s=(a=(d||h)&&l.rect||u&&p.axes.select(`.${It.axis}-${t} text`)||f||((i=o.getArcElementByIdOrIndex)==null?void 0:i.call(o,t)))==null?void 0:a.node)==null?void 0:s.call(a);if(m){const b=o.isMultipleX(),v=r.axis_rotated;let{width:y,left:T,top:w}=ht(m);if(c&&!u&&!b){const k=l.coords[t];k?(y=k.w,T+=k.x,w+=k.y):(y=0,T=0,w=0)}let C=T+(n?n[0]:0)+(b||v?0:y/2),A=w+(n?n[1]:0)+(v?4:0);if(Fa(_)&&o.$el.eventRect){const k=Ai(o.$el.eventRect.node(),C,A,!1);C=k.x,A=k.y}const S={screenX:C,screenY:A,clientX:C,clientY:A,bubbles:u};(d||h)&&(m=(g!=null?g:x).node()),Oa[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,S)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{canvas:t,eventRect:n,svg:i,zoomResetBtn:a}}=e;n==null||n.on(".zoom wheel.zoom .drag",null),t==null||t.on(".zoom wheel.zoom .drag",null),i==null||i.on("wheel",null),a==null||a.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:n,eventRect:i,legend:a,region:s,svg:o,treemap:r},brush:l}=t,c=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,i,s==null?void 0:s.list,l==null?void 0:l.getSelection(),n==null?void 0:n.selectAll("path"),a==null?void 0:a.selectAll("g"),r].forEach(d=>d==null?void 0:d.on(c,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},eg={categoryName(e){var t;const{axis_x_categories:n}=this.config;return(t=n==null?void 0:n[e])!=null?t:e}};const ng=/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g;var ig={generateClass(e,t){const n=this.state.generateClassCache,i=`${e}\0${t}`;let a=n.get(i);return a||(a=` ${e} ${e+this.getTargetSelectorSuffix(t)}`,n.set(i,a)),a},getClass(e,t){const n=/s$/.test(e),i=/^(area|arc|line|funnel|treemap)s?$/.test(e),a=n?"id":"index";return s=>{const o=s.data||s;return((t?this.generateClass(V[n?"shapes":"shape"],o[a]):"")+this.generateClass(V[e],o[i?"id":a])).trim()}},getChartClass(e){return t=>V[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],n=[];return function(i){var a;const s=i.id||((a=i.data)==null?void 0:a.id)||i;return n.indexOf(s)<0&&n.push(s),t[n.indexOf(s)%t.length]}},classRegion(e,t){return`${this.generateClass(V.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let n="";return t&&(n=` ${V.target}-${t}`),this.generateClass(V.target,e)+n},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.has(e.id)?V.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.has(e.id)?V.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(ng,"-")},selectorTarget(e,t="",n=""){const i=this.getTargetSelectorSuffix(e);return`${t}.${V.target+i} ${n}, ${t}.${V.circles+i} ${n}`},selectorTargets(e,t){const n=e||[];return n.length?n.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${V.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}};const ag=(e,t,n)=>{const i=(0,F.select)(e.cloneNode(!0));return i.attr("id",n).insert("rect",":first-child").attr("width",i.attr("width")).attr("height",i.attr("height")).style("fill",t),{id:n,node:i.node()}};function sg(e){const t=W.colorPattern,{body:n}=nt;let i=n[t];if(!i){const s=e.classed(Pa.colorPattern,!0).style("background-image");e.classed(Pa.colorPattern,!1),s.indexOf(";")>-1&&(i=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),n[t]=i)}return i}const og=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var rg={generateColor(){const e=this,{$el:t,config:n}=e,i=[],a=n.area_linearGradient||n.bar_linearGradient||n.point_radialGradient;let s=bt(n.color_pattern)?n.color_pattern:[...sg(t.chart)||og];const o=s;if(z(n.color_tiles)){const r=n.color_tiles.bind(e.api)(),l=s.map((c,d)=>{const u=c.replace(/[#\(\)\s,]/g,""),h=`${e.state.datetimeId}-pattern-${u}-${d}`;return ag(r[d%r.length],c,h)});s=l.map(c=>`url(#${c.id})`),e.patterns=l}return function(r){var l;const c=n.data_colors,d=n.data_color,u=r.id||((l=r.data)==null?void 0:l.id)||r,h=e.isTypeOf(u,["line","spline","step"])||!n.data_types[u];let f;if(z(c[u]))f=c[u].bind(e.api)(r);else if(c[u])f=c[u];else{let g=i.indexOf(u);g<0&&(i.push(u),g=i.length-1),f=h?o[g%o.length]:s[g%s.length],c[u]=f}if(f=z(d)?d.call(e.api,f,r):f,a&&t.defs){const g=e.$el.defs.selectAll(`[id$='-gradient${e.getTargetSelectorSuffix(u)}'] stop`);let p;g.each(function(_,x){p=x===0?this.style.stopColor:this.style.stopColor===p}),p===!0&&g.attr("stop-color",f)}return f}},generateLevelColor(){const e=this,{config:t}=e,n=t.color_pattern,i=t.color_threshold,a=i.unit==="value",s=i.max||100,o=i.values&&i.values.length?i.values:[];return bt(i)?function(r){const l=a?r:r*100/s;let c=n[n.length-1];for(let d=0,u=o.length;d<u;d++)if(l<=o[d]){c=n[d];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const n=this,{$el:{defs:i},state:a}=n;if(e){let s=[];Q(e)?s.push(""):tt(e)?s=Object.keys(e):z(e)&&(s=n.mapToTargetIds()),s.forEach(o=>{const r=`${a.datetimeId}-labels-bg${n.getTargetSelectorSuffix(o)}${Q(e)?n.getTargetSelectorSuffix(e):""}`,l=ue(o===""?e:(e==null?void 0:e[o])||"");if(i.select(`#${r}`).empty()){const c=i.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r);c.append("feFlood").attr("flood-color",l),c.append("feComposite").attr("in","SourceGraphic")}})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:n},state:{datetimeId:i},$el:{defs:a}}=e;n.forEach(s=>{const o=`${i}-gradient${e.getTargetSelectorSuffix(s.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(s)&&"area"||e.isBarType(s)&&"bar";if((r||l)&&a.select(`#${o}`).empty()){const c=e.color(s),d={defs:null,stops:[]};if(r){const{cx:u=.3,cy:h=.3,r:f=.7,stops:g=[[.1,c,0],[.9,c,1]]}=r;d.stops=g,d.defs=a.append("radialGradient").attr("id",`${o}`).attr("cx",u).attr("cy",h).attr("r",f)}else{const u=t.axis_rotated,{x:h=u?[1,0]:[0,0],y:f=u?[0,0]:[0,1],stops:g=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];d.stops=g,d.defs=a.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",f[0]).attr("y2",f[1])}d.stops.forEach(u=>{const[h,f,g]=u,p=z(f)?f.bind(e.api)(s.id):f;d.defs&&d.defs.append("stop").attr("offset",h).attr("stop-color",p||c).attr("stop-opacity",g)})}})},setOverColor(e,t){const n=this,{config:i,$el:{main:a}}=n,s=i.color_onover;let o=e?s:n.color;tt(o)?o=({id:r})=>r in s?s[r]:n.color(r):Q(o)?o=()=>s:z(s)&&(o=o.bind(n.api)),a.selectAll(tt(t)?`.${at.arc}${n.getTargetSelectorSuffix(t.id)}`:`.${kt.shape}-${t}`).style("fill",o)}},Ri=wt(7);function Lr(e){const{event:t,$el:n}=e,i=n.subchart.main||n.main;let a;return t&&t.type==="brush"?a=t.selection:i&&(a=i.select(".bb-brush").node())&&(a=(0,Ri.brushSelection)(a)),a}function Rr(e){const t=Lr(e);return t?t[0]===t[1]:!0}function Er(e,t){return t.map(n=>{var i,a,s,o,r,l,c,d,u;const{values:h}=n,f=h[0],g=h[h.length-1],p=f?(a=(i=e.getXCacheKey)==null?void 0:i.call(e,f.x))!=null?a:f.x:"",_=g?(o=(s=e.getXCacheKey)==null?void 0:s.call(e,g.x))!=null?o:g.x:"",x=(l=(r=e.getTargetType)==null?void 0:r.call(e,n))!=null?l:"",m=(u=(d=(c=e.state)==null?void 0:c.subchartSourceTypes)==null?void 0:d[n.id])!=null?u:"";return`${n.id}:${x}:${m}:${h.length}:${p}:${_}`}).join("|")}function Pr(e,t){var n;const i=(n=e.data)==null?void 0:n.targets;if(!i)return!1;for(let a=0;a<t.length;a++){const s=t[a],o=i.find(r=>r.id===s.id);if(!o||o.values!==s.values)return!1}return!0}function Xa(e,t){bt(t)&&((e.min===void 0||t<e.min)&&(e.min=t),(e.max===void 0||t>e.max)&&(e.max=t))}function Dr(e,t){for(let n=0;n<t.length;n++)Xa(e,t[n])}function lg(e,t){var n,i,a,s;const o={min:void 0,max:void 0},r=e.state.hasAxis;for(let l=0;l<t.length;l++){const c=t[l],d=(n=e.isCandlestickType)==null?void 0:n.call(e,c),u=!d&&!!((i=e.isSubchartSourceTypeOf)!=null&&i.call(e,c,O.CANDLESTICK)),{values:h}=c;for(let f=0;f<h.length;f++){const g=h[f];let p=g.value;if(!(q(p)||p===null))continue;const _=u?(a=e.getSubchartCandlestickShapeValue)==null?void 0:a.call(e,g,!0):void 0;$(_)?p=_:p!==null&&(d||u)&&(p=Array.isArray(p)?p.slice(0,4):[p.open,p.high,p.low,p.close]),Array.isArray(p)?Dr(o,p):tt(p)&&"high"in p?Dr(o,Object.values(p)):(s=e.isBubbleZType)!=null&&s.call(e,g)?Xa(o,r&&e.getBubbleZData(p,"y")):Xa(o,p)}}return[o.min,o.max]}function cg(e,t){let n;for(let i=0;i<e.length;i++){const{values:a}=e[i];for(let s=0;s<a.length;s++){const{x:o}=a[s];bt(o)&&(n===void 0||(t==="min"?o<n:o>n))&&(n=o)}}return n}var ug={getYDomainMinMaxBoth(e){const t=this,{axis:n,cache:i,config:a,state:s}=t,r=Pr(t,e)?`${W.domainMinMax}_y_${Er(t,e)}`:null,l=r&&i.get(r);if(l&&l.generation===s.dataGeneration)return l.value;const c=a.data_groups,d=t.mapToIds(e),u=Ds(d);let h;if(c.length>0){const f=t.getValuesAsIdKeyed(e),g=e.some(y=>y.values.some(T=>T.value<0)),p=e.some(y=>y.values.some(T=>T.value>0)),_=new Map(d.map(y=>[y,n.getId(y)])),x={},m={};for(const y in f)x[y]=f[y].slice(),m[y]=f[y].slice();c.forEach(y=>{const T=y.filter(w=>u.has(w));if(T.length){const w=T[0],C=_.get(w);x[w]&&g&&(x[w]=x[w].map(A=>A<0?A:0)),m[w]&&p&&(m[w]=m[w].map(A=>A>0?A:0)),T.filter((A,S)=>S>0).forEach(A=>{if(x[A]){const S=_.get(A);x[A].forEach((k,L)=>{const E=+k;S===C&&!(g&&E>0)&&(x[w][L]+=E)})}if(m[A]){const S=_.get(A);m[A].forEach((k,L)=>{const E=+k;S===C&&!(p&&E<0)&&(m[w][L]+=E)})}})}});const b=[],v=[];for(const y in x)b.push(de("min",x[y])),v.push(de("max",m[y]));h=[de("min",b),de("max",v)]}else h=lg(t,e);return r&&i.add(r,{generation:s.dataGeneration,value:h}),h},isHiddenTargetWithYDomain(e){const t=this;for(const n of t.state.hiddenTargetIds)if(t.axis.getId(n)===e)return!0;return!1},getYDomain(e,t,n){const i=this,{axis:a,config:s,scale:o}=i,r=`axis_${t}`;if(i.isStackNormalized()&&e.filter(D=>a.getId(D.id)===t).map(D=>D.id).some(D=>i.isGrouped(D)))return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(L=>a.getId(L.id)===t),d=n?i.filterByXDomain(c,n):c;if(d.length===0)return i.isHiddenTargetWithYDomain(t)?o[t].domain():t==="y2"?o.y.domain():i.getYDomain(e,"y2",n);const u=s[`${r}_min`],h=s[`${r}_max`],f=s[`${r}_center`],g=s[`${r}_inverted`],p=i.hasDataLabel()&&s.axis_rotated,_=i.hasDataLabel()&&!s.axis_rotated,[x,m]=i.getYDomainMinMaxBoth(d);let b=x,v=m,y=[O.BAR,O.BUBBLE,O.SCATTER,...ce.Line].some(L=>{const E=L.indexOf("area")>-1?"area":L;return i.hasType(L,d,!0)&&s[`${E}_zerobased`]});b=q(u)?u:q(h)?b<=h?b:h-10:b,v=q(h)?h:q(u)?u<=v?v:u+10:v,isNaN(b)&&(b=0),isNaN(v)&&(v=b),b===v&&(b<0?v=0:b=0);const T=b>=0&&v>=0,w=b<=0&&v<=0;(q(u)&&T||q(h)&&w)&&(y=!1),y&&(T&&(b=0),w&&(v=0));const C=Math.abs(v-b);let A={top:C*.1,bottom:C*.1};if(ct(f)){const L=Math.max(Math.abs(b),Math.abs(v));v=f+L,b=f-L}if(p){const L=en(o.y.range()),E=i.getDataLabelLength(b,v,"width").map(D=>{const R=D/L;return isFinite(R)?R:0});["bottom","top"].forEach((D,R)=>{A[D]+=C*(E[R]/(1-E[0]-E[1]))})}else if(_){const L=i.getDataLabelLength(b,v,"height");["bottom","top"].forEach((E,D)=>{A[E]+=i.convertPixelToScale("y",L[D],C)})}A=i.getResettedPadding(A);const S=s[`${r}_padding`];bt(S)&&["bottom","top"].forEach(L=>{A[L]=a.getPadding(S,L,A[L],C)}),y&&(T&&(A.bottom=b),w&&(A.top=-v));const k=l?[b,v].map(L=>L<0?0:L):[b-A.bottom,v+A.top];return g?k.reverse():k},getXDomainMinMax(e,t){var n;const i=this,{cache:a,state:s}=i,o=i.config[`axis_x_${t}`],l=Pr(i,e)?`${W.domainMinMax}_x_${t}_${Er(i,e)}`:null,c=l&&a.get(l);let d=(c==null?void 0:c.generation)===s.dataGeneration?c.value:void 0;d===void 0&&(d=cg(e,t),l&&a.add(l,{generation:s.dataGeneration,value:d}));let u=tt(o)?o.value:o;return u=ct(u)&&((n=i.axis)!=null&&n.isTimeSeries())?Vt.bind(this)(u):u,tt(o)&&o.fit&&(t==="min"&&u<d||t==="max"&&u>d)&&(u=void 0),ct(u)?u:d},getXDomainPadding(e,t){const n=this,{axis:i,config:a}=n,s=a.axis_x_padding,o=i.isTimeSeries()&&t,r=en(e);let l;if(i.isCategorized()||o)l=0;else if(n.hasType("bar")){const u=n.getMaxDataCount();l=u>1?r/(u-1)/2:.5}else l=n.getResettedPadding(r*.01);let{left:c=l,right:d=l}=$(s)?{left:s,right:s}:s;if(s.unit==="px"){const u=Math.abs(r+r*.2);c=i.getPadding(s,"left",l,u),d=i.getPadding(s,"right",l,u)}else{const u=r+c+d;if(o&&u){const h=r/t/u;c=c/u/h,d=d/u/h}}return{left:c,right:d}},getXDomain(e){const t=this,{axis:n,config:i,scale:{x:a}}=t,s=i.axis_x_inverted,o=[t.getXDomainMinMax(e,"min"),t.getXDomainMinMax(e,"max")];let[r=0,l=0]=o;if(a.type!=="log"){const c=n.isCategorized(),d=n.isTimeSeries(),u=t.getXDomainPadding(o);let[h,f]=o;h-f===0&&!c&&(d?(h=new Date(h.getTime()*.5),f=new Date(f.getTime()*1.5)):(h=h===0?1:h*.5,f=f===0?-1:f*1.5)),(h||h===0)&&(r=d?new Date(h.getTime()-u.left):h-u.left),(f||f===0)&&(l=d?new Date(f.getTime()+u.right):f+u.right)}return s?[l,r]:[r,l]},updateXDomain(e,t,n,i,a){var s;const o=this,{config:r,org:l,scale:{x:c,subX:d}}=o,u=r.zoom_enabled;if(n&&(c.domain(a||pn(o.getXDomain(e),!r.axis_x_inverted)),l.xDomain=c.domain(),d.domain(c.domain()),(s=o.brush)==null||s.scale(d)),t){const h=a||!o.brush||Rr(o)?l.xDomain:Lr(o).map(d.invert);c.domain(h)}return(n||t)&&u&&o.zoom.updateScaleExtent(),i&&c.domain(o.trimXDomain(c.orgDomain())),c.domain()},trimXDomain(e){const t=this,n=t.config.axis_x_inverted,i=t.getZoomDomain(),[a,s]=i;return(n?e[0]>=a:e[0]<=a)&&(e[1]=+e[1]+(a-e[0]),e[0]=a),(n?e[1]<=s:e[1]>=s)&&(e[0]=+e[0]-(e[1]-s),e[1]=s),e},getZoomDomain(e="zoom",t=!1){const n=this,{config:i,scale:a,org:s}=n;let[o,r]=t&&a[e]?a[e].domain():s.xDomain;return e==="zoom"&&(ct(i.zoom_x_min)&&(o=de("min",[o,i.zoom_x_min])),ct(i.zoom_x_max)&&(r=de("max",[r,i.zoom_x_max]))),[o,r]},getZoomDomainValue(e){const t=this,{config:n,axis:i}=t;if(i.isCategorized()&&Array.isArray(e)){const a=n.axis_x_inverted;return e.map((o,r)=>Number(o)+(r===0?+a:+!a))}return e},convertPixelToScale(e,t,n){const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r;return e==="x"?r=o?"height":"width":r=o?"width":"height",n*(t/s[r])},withinRange(e,t=[0,0],n){const a=this.config.axis_x_inverted,[s,o]=n;if(Array.isArray(e)){const r=a?e[1]:e[0],l=a?e[0]:e[1];if(r<l)return e.every((c,d)=>(d===0?a?+c<=s:+c>=s:a?+c>=o:+c<=o)&&!e.every((u,h)=>u===t[h]))}return!1}};function Ir(e,t,n){const{config:i}=e,a=`axis_${t}_tick_format`;return(i[a]?i[a]:e.defaultValueFormat).call(e.api,n)}var dg={yFormat(e){return Ir(this,"y",e)},y2Format(e){return Ir(this,"y2",e)},getDefaultValueFormat(){const e=this,{defaultArcValueFormat:t,yFormat:n,y2Format:i}=e,a=e.hasArcType(null,["gauge","polar","radar"]);return function(s,o,r){return(a?t:e.axis&&e.axis.getId(r)==="y2"?i:n).call(e,s,o)}},defaultValueFormat(e){return ot(e)?e.join("~"):q(e)?+e:""},defaultArcValueFormat(e,t){return`${(t*100).toFixed(1)}%`},defaultPolarValueFormat(e){return`${e}`},dataLabelFormat(e){const t=this,n=t.config.data_labels,i=s=>{let r=s;return ot(s)?r=s.join("~"):tt(s)&&(r=Object.values(s).join("~")),r};let a=i;return z(n.format)?a=n.format:Ut(n.format)&&(n.format[e]?a=n.format[e]===!0?i:n.format[e]:a=()=>""),a.bind(t.api)}};const Mr=10,hg=750;function Ei(e){const t=this,n=t.getDataById(e);return t.levelColor?t.levelColor(n.values[0].value):t.color(n)}function fg(e,t=!0){var n;const{config:i}=this;let a=(n=i.data_names[e])!=null?n:e;return t&&z(i.legend_format)&&(a=i.legend_format(a,e!==a?e:void 0)),a}function gg(e,t){var n;if(!t||t.empty())return;const i=(n=e.$el.legend)==null?void 0:n.selectAll(`.${j.legendItem}`);i&&!i.empty()&&(t=i);const a=[];t.each(function(o){a.push({id:o,node:this})});const s=Is(a,o=>o.id,o=>o.node);e.cache.add(W.legendItemMap,s)}function Fr(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function pg(e,t,n){const i=Fr(n);e.state.legendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function Or(e,t){const n=e.state.legendTouch,i=n&&Fr(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>Mr||Math.abs(i.clientY-n.y)>Mr)}function _g(e,t,n){Or(e,n);const i=e.state.legendTouch;return e.state.legendTouch=null,!!i&&i.id===t&&!i.moved}function xg(e,t){e.state.legendLastTouchClickId=t,e.state.legendLastTouchClickTime=Date.now()}function mg(e,t){const{state:n}=e,i=n.legendLastTouchClickId===t&&Date.now()-(n.legendLastTouchClickTime||0)<hg;return i&&(n.legendLastTouchClickId=null,n.legendLastTouchClickTime=0),i}function vg(e){var t;const n=(t=e.config.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}var bg={initLegend(){var e;const t=this,{config:n,$el:i}=t;if(t.legendItemTextBox={},t.state.legendHasRendered=!1,t.state.isCanvasMode){n.legend_show?(e=t.updateHtmlLegend)==null||e.call(t):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets));return}n.legend_show?(n.legend_contents_bindto||(i.legend=t.$el.svg.append("g").classed(j.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets))},updateLegend(e,t,n){var i;const a=this,{config:s,state:o,scale:r,$el:l}=a,c=t||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=Ne(c,"withTransition",!0),c.withTransitionForTransform=Ne(c,"withTransitionForTransform",!0),s.legend_contents_bindto&&s.legend_contents_template?a.updateLegendTemplate():o.hasTreemap||a.updateLegendElement(e||a.mapToIds(a.data.targets),c),(i=l.legend)==null||i.selectAll(`.${j.legendItem}`).classed(j.legendItemHidden,function(d){const u=!a.isTargetToShow(d);return u&&(this.style.opacity=null),u}),a.updateScales(!1,!r.zoom),a.updateSvgSize(),a.transformAll(c.withTransitionForTransform,n),o.legendHasRendered=!0},updateLegendTemplate(){const e=this,{config:t,$el:n}=e,i=(0,F.select)(t.legend_contents_bindto),a=t.legend_contents_template;if(!i.empty()){const s=e.mapToIds(e.data.targets),o=[];let r="";s.forEach(c=>{const d=z(a)?ue(a.call(e.api,c,e.color(c),e.api.data(c)[0].values)):an(a,{COLOR:e.color(c),TITLE:c});d&&(o.push(c),r+=d)});const l=i.html(ue(r)).selectAll(function(){return this.children}).data(o);e.setLegendItem(l),n.legend=i}},updateSizeForLegend(e){const t=this,{config:n,state:{isLegendTop:i,isLegendLeft:a,isLegendRight:s,isLegendInset:o,current:r}}=t,{width:l,height:c}=e,d={top:i?t.getCurrentPaddingByDirection("top")+n.legend_inset_y+5.5:r.height-c-t.getCurrentPaddingByDirection("bottom")-n.legend_inset_y,left:a?t.getCurrentPaddingByDirection("left")+n.legend_inset_x+.5:r.width-l-t.getCurrentPaddingByDirection("right")-n.legend_inset_x+.5};t.state.margin3={top:s?0:o?d.top:r.height-c,right:NaN,bottom:0,left:s?r.width-l:o?d.left:0}},transformLegend(e){const t=this,{$el:{legend:n},$T:i}=t;i(n,e).attr("transform",t.getTranslate("legend"))},updateLegendItemColor(e,t){const n=this,{legend:i}=n.$el;if(i){const a=n.getLegendItemById(e);a&&(0,F.select)(a).select("line").style("stroke",t)}},getLegendWidth(){const e=this,{current:{width:t},isLegendRight:n,isLegendInset:i,legendItemWidth:a,legendStep:s}=e.state;return e.config.legend_show?n||i?a*(s+1):t:0},getLegendHeight(){var e;const t=this,{current:n,isLegendRight:i,legendItemHeight:a,legendStep:s}=t.state,r=((e=t.config.padding)==null?void 0:e.mode)==="fit"?10:20;return t.config.legend_show?i?n.height:Math.max(r,a)*(s+1):0},opacityForUnfocusedLegend(e){return e.classed(j.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const n=this,{$el:{legend:i},$T:a}=n,s=n.mapToTargetIds(e);i&&a(i.selectAll(`.${j.legendItem}`).filter(o=>s.indexOf(o)>=0).classed(lt.legendItemFocused,t)).style("opacity",function(){return t?null:n.opacityForUnfocusedLegend.call(n,(0,F.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:n}=e;t&&n(t.selectAll(`.${j.legendItem}`).classed(lt.legendItemFocused,!1)).style("opacity",null)},showLegend(e){const t=this,{config:n,$el:i,$T:a}=t;n.legend_show||(n.legend_show=!0,i.legend?i.legend.style("visibility",null):t.initLegend(),!t.state.legendHasRendered&&t.updateLegend()),t.removeHiddenLegendIds(e),a(i.legend.selectAll(t.selectorLegends(e)).style("visibility",null)).style("opacity",null)},hideLegend(e){const t=this,{config:n,$el:{legend:i}}=t;n.legend_show&&se(e)&&(n.legend_show=!1,i==null||i.style("visibility","hidden")),t.addHiddenLegendIds(e),i==null||i.selectAll(t.selectorLegends(e)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(e,t){const n=this,{cache:i,state:a}=n;let s;const o=W.legendItemTextBox;return e&&(s=!a.redrawing&&i.get(o)||{},s[e]||(s[e]=n.getTextRect(t,j.legendItem),i.add(o,s)),s=s[e]),s},setLegendItem(e){const t=this,{$el:n,api:i,config:a,state:s}=t,o=s.inputType==="touch",r=t.hasType("gauge"),l=a.boost_useCssRule,c=a.legend_item_interaction,d=c.dblclick?"dblclick":"click",u=c||z(a.legend_item_onclick),h=o?vg(t):void 0,f=function(g,p){var _;if(!H(a.legend_item_onclick,i,p,!s.hiddenTargetIds.has(p))){const{altKey:x,type:m}=g,b=(0,F.select)(this);m==="dblclick"||x?s.hiddenTargetIds.size&&!b.classed(j.legendItemHidden)?i.show():(i.hide(),i.show(p)):(i.toggle(p),b.classed(lt.legendItemFocused,!1))}o&&(t.hideTooltip(),(_=t.hideGridFocus)==null||_.call(t,!0))};e.attr("class",function(g){const p=(0,F.select)(this);return(!p.empty()&&p.attr("class")||"")+t.generateClass(j.legendItem,g)}).style("visibility",g=>t.isLegendToShow(g)?null:"hidden"),a.interaction_enabled&&(l&&[[`.${j.legendItem}`,"cursor:pointer"],[`.${j.legendItem} text`,"pointer-events:none"],[`.${j.legendItemPoint} text`,"pointer-events:none"],[`.${j.legendItemTile}`,"pointer-events:none"],[`.${j.legendItemEvent}`,"fill-opacity:0"]].forEach(g=>{const[p,_]=g;t.setCssRule(!1,p,[_])(n.legend)}),e.on(d,u?function(g,p){o&&g.type==="click"&&mg(t,p)||f.call(this,g,p)}:null),o&&d==="click"&&u&&e.on("touchstart",function(g,p){pg(t,p,g)},h).on("touchmove",g=>{Or(t,g)},h).on("touchend",function(g,p){_g(t,p,g)&&(xg(t,p),f.call(this,g,p))},h),!o&&e.on("mouseout",c||z(a.legend_item_onout)?function(g,p){H(a.legend_item_onout,i,p,!s.hiddenTargetIds.has(p))||((0,F.select)(this).classed(lt.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${ae.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||z(a.legend_item_onover)?function(g,p){H(a.legend_item_onover,i,p,!s.hiddenTargetIds.has(p))||((0,F.select)(this).classed(lt.legendItemFocused,!0),r&&t.markOverlapped(p,t,`.${ae.gaugeValue}`),!s.transiting&&t.isTargetToShow(p)&&i.focus(p))}:null),!e.empty()&&e.on("click mouseout mouseover")&&e.style("cursor",t.getStylePropValue("pointer"))),gg(t,e)},getLegendItemById(e){var t;const n=this,i=n.cache.get(W.legendItemMap);if(i&&i instanceof Map)return i.get(e)||null;const a=(t=n.$el.legend)==null?void 0:t.selectAll(`.${j.legendItem}`).filter(s=>s===e);return(a==null?void 0:a.node())||null},updateLegendElement(e,t){const n=this,{config:i,state:a,$el:{legend:s},$T:o}=n,l=i.legend_item_tile_type!=="circle",c=i.legend_item_tile_r,d={width:l?i.legend_item_tile_width:c*2,height:l?i.legend_item_tile_height:c*2},u={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:d.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let f,g,p;const _=e.filter(C=>!ct(i.data_names[C])||i.data_names[C]!==null),x=t.withTransition,m=a.isLegendRight||a.isLegendInset,b=fg.bind(n),v=n.getUpdateLegendPositions(_,u,h,m);a.isLegendInset&&(u.step=i.legend_inset_step?i.legend_inset_step:_.length,a.legendStep=u.step),a.isLegendRight?(f=C=>u.max.width*h.steps[C],g=C=>h.margins[h.steps[C]]+h.offsets[C]):a.isLegendInset?(f=C=>u.max.width*h.steps[C]+10,g=C=>h.margins[h.steps[C]]+h.offsets[C]):(f=C=>h.margins[h.steps[C]]+h.offsets[C],g=C=>u.max.height*h.steps[C]);const y={xText:(C,A)=>f(C,A)+4+d.width,xRect:(C,A)=>f(C,A),x1Tile:(C,A)=>f(C,A)-2,x2Tile:(C,A)=>f(C,A)-2+d.width,yText:(C,A)=>g(C,A)+9,yRect:(C,A)=>g(C,A)-5,yTile:(C,A)=>g(C,A)+4};n.generateLegendItem(_,d,v,y,m,b),p=s.select(`.${j.legendBackground} rect`),a.isLegendInset&&u.max.width>0&&p.size()===0&&(p=s.insert("g",`.${j.legendItem}`).attr("class",j.legendBackground).append("rect")),i.legend_tooltip&&s.selectAll("title").data(_).text(C=>b(C,!1));const T=s.selectAll("text").data(_).text(C=>b(C)).each(function(C,A){v(this,C,A)});o(T,x).attr("x",y.xText).attr("y",y.yText);const w=s.selectAll(`rect.${j.legendItemEvent}`).data(_);o(w,x).attr("width",C=>h.widths[C]).attr("height",C=>h.heights[C]).attr("x",y.xRect).attr("y",y.yRect),n.updateLegendItemPos(_,x,y),p&&o(p,x).attr("height",n.getLegendHeight()-12).attr("width",u.max.width*(u.step+1)+10),a.legendItemWidth=u.max.width,a.legendItemHeight=u.max.height,a.legendStep=u.step},getUpdateLegendPositions(e,t,n,i){const a=this,{config:s,state:o}=a;return function(r,l,c){const d=c===0,u=c===e.length-1,h=a.getLegendItemTextBox(l,r),f=h.width+t.tileWidth+(u&&!i?0:t.padding.right)+s.legend_padding,g=h.height+t.padding.top,p=i?g:f,_=i?a.getLegendHeight():a.getLegendWidth();let x;const m=function(v,y){y||(x=(_-t.totalLength-p)/2,x<t.posMin&&(x=(_-p)/2,t.totalLength=0,t.step++)),n.steps[v]=t.step,n.margins[t.step]=o.isLegendInset?10:x,n.offsets[v]=t.totalLength,t.totalLength+=p};if(d&&(t.totalLength=0,t.step=0,t.max.width=0,t.max.height=0),s.legend_show&&!a.isLegendToShow(l)){n.widths[l]=0,n.heights[l]=0,n.steps[l]=0,n.offsets[l]=0;return}n.widths[l]=f,n.heights[l]=g,(!t.max.width||f>=t.max.width)&&(t.max.width=f),(!t.max.height||g>=t.max.height)&&(t.max.height=g);const b=i?t.max.height:t.max.width;if(s.legend_equally){for(const v in n.widths)n.widths[v]=t.max.width;for(const v in n.heights)n.heights[v]=t.max.height;x=(_-b*e.length)/2,x<t.posMin?(t.totalLength=0,t.step=0,e.forEach(v=>m(v))):m(l,!0)}else m(l)}},generateLegendItem(e,t,n,i,a,s){const o=this,{config:r,state:l,$el:{legend:c}}=o,d=r.legend_usePoint,u=r.legend_item_tile_r,h=r.legend_item_tile_type,f=h!=="circle",g=-200,p=c.selectAll(`.${j.legendItem}`).data(e).enter().append("g");if(o.setLegendItem(p),r.legend_tooltip&&p.append("title").text(_=>_),p.append("text").text(_=>s(_)).each(function(_,x){n(this,_,x)}).style("pointer-events",o.getStylePropValue("none")).attr("x",a?i.xText:g).attr("y",a?g:i.yText),p.append("rect").attr("class",j.legendItemEvent).style("fill-opacity",o.getStylePropValue("0")).attr("x",a?i.xRect:g).attr("y",a?g:i.yRect),d){const _=[],x=o.getValidPointPattern();p.append(m=>{_.indexOf(m)===-1&&_.push(m);let b=x[_.indexOf(m)%x.length];return b==="rectangle"&&(b="rect"),nt.createElementNS(F.namespaces.svg,"hasValidPointType"in o&&o.hasValidPointType(b)?b:"use")}).attr("class",j.legendItemPoint).style("fill",Ei.bind(o)).style("pointer-events",o.getStylePropValue("none")).attr("href",(m,b,v)=>{const T=v[b].nodeName.toLowerCase(),w=o.getTargetSelectorSuffix(m);return T==="use"?`#${l.datetimeId}-point${w}`:void 0})}else p.append(f?"line":h).attr("class",j.legendItemTile).style("stroke",Ei.bind(o)).style("pointer-events",o.getStylePropValue("none")).call(_=>{h==="circle"?_.attr("r",u).style("fill",Ei.bind(o)).attr("cx",a?i.x2Tile:g).attr("cy",a?g:i.yTile):f&&_.attr("stroke-width",t.height).attr("x1",a?i.x1Tile:g).attr("y1",a?g:i.yTile).attr("x2",a?i.x2Tile:g).attr("y2",a?g:i.yTile)})},updateLegendItemPos(e,t,n){const i=this,{config:a,$el:{legend:s},$T:o}=i,r=a.legend_usePoint,l=a.legend_item_tile_type,c=l!=="circle";if(r){const d=s.selectAll(`.${j.legendItemPoint}`).data(e),u=a.legend_item_tile_type!=="circle",h=u?a.legend_item_tile_width:a.legend_item_tile_r*2,f=u?a.legend_item_tile_height:a.legend_item_tile_r*2,g=h*.75,p=f*.75,_=h/8,x=f/8;o(d,t).each(function(){const m=this.nodeName.toLowerCase();let b="x",v="y",y=null,T=null,w=null;m==="circle"?(b="cx",v="cy",y=Math.min(g,p)/2):m==="rect"&&(T=g,w=p);const C=(0,F.select)(this).attr("transform",null).attr("x",null).attr("y",null).attr("cx",null).attr("cy",null).attr("r",y).attr("width",T).attr("height",w);m==="use"?C.attr("transform",A=>`translate(${n.x1Tile(A)} ${n.yTile(A)-f/2}) scale(${_} ${x})`):C.attr(b,A=>n.x1Tile(A)+(h-(T||0))/2).attr(v,A=>n.yTile(A)-(w||0)/2)})}else{const d=s.selectAll(`.${j.legendItemTile}`).data(e);o(d,t).style("stroke",Ei.bind(i)).call(u=>{l==="circle"?u.attr("cx",h=>{const f=n.x2Tile(h);return f-(f-n.x1Tile(h))/2}).attr("cy",n.yTile):c&&u.attr("x1",n.x1Tile).attr("y1",n.yTile).attr("x2",n.x2Tile).attr("y2",n.yTile)})}}},yg=wt(8),Tg={redraw(e={}){var t,n,i,a,s,o,r,l,c,d;const u=this,{config:h,state:f,$el:g}=u,{main:p,treemap:_}=g;f.redrawing=!0,f.redrawGeneration++,(f.dirty.data||f.dirty.visibility||e.initializing)&&f.dataGeneration++,(e.initializing||f.dirty.size||f.dirty.data||!f.rendered)&&u.cache.remove([W.svgLeft]);const x=u.filterTargetsToShow(u.data.targets);f._targetsToShow=x;const m={data:f.dirty.data,visibility:f.dirty.visibility,size:f.dirty.size};f.dirty.data=!1,f.dirty.visibility=!1,f.dirty.size=!1;const{flow:b,initializing:v}=e,y=u.getWithOption(e),T=y.Transition?h.transition_duration:0,w=y.TransitionForExit?T:0,C=y.TransitionForAxis?T:0,A=(t=u.axis)==null?void 0:t.generateTransitions(C),S=m.data||m.visibility||v;if(f.isCanvasMode&&(u.setContainerSize(),(n=u.updateHtmlLegend)==null||n.call(u)),u.updateSizes(v),f.isCanvasMode){const k=u.scale.zoom,L=k==null?void 0:k.domain();k&&(u.scale.zoom=null),u.updateScales(v,y.UpdateXDomain),k&&(k.range(u.scale.x.range()),L&&k.domain(L),u.scale.zoom=u.getCustomizedXScale(k),u.axis.x.scale(u.scale.zoom),u.scale.x.domain(h.zoom_rescale?L:u.org.xDomain),u.scale.subX.domain(u.org.xDomain)),f.hasAxis&&u.axis.syncAxisDomains(x,y,b),f.hasAxis&&((i=u.applyCanvasSubchartDomain)==null||i.call(u));const E=S?u.getDrawShape():f._cachedDrawShape||u.getDrawShape();S&&(f._cachedDrawShape=E),h.legend_show&&g.legend&&!(h.legend_contents_bindto&&h.legend_contents_template)&&((a=u.positionHtmlLegend)==null||a.call(u)),(s=u.resizeCanvas)==null||s.call(u),f.canvasFocusKey=null,u.renderCanvasFrame(E,null,!0),v&&u.updateTypesElements(),u.callPluginHook("$redraw",e,0),f.redrawing=!1,f._targetsToShow=null,f._cachedDrawShape=null,u.mapToIds(u.data.targets).forEach(D=>{f.withoutFadeIn[D]=!0}),H(h.onrendered,u.api);return}y.Legend&&h.legend_show?(e.withTransition=!!T,!_&&u.updateLegend(u.mapToIds(u.data.targets),e,A)):y.Dimension&&u.updateDimension(!0),h.data_empty_label_text&&p.select(`text.${Et.text}.${U.empty}`).attr("x",f.width/2).attr("y",f.height/2).text(h.data_empty_label_text).style("display",x.length?"none":null),(o=u.redrawTitle)==null||o.call(u),f.hasAxis?(u.axis.redrawAxis(x,y,A,b,v),(r=u.hasGrid)!=null&&r.call(u)&&u.updateGrid(),h.regions.length&&((l=u.updateRegion)==null||l.call(u)),["bar","candlestick","line","area"].forEach(k=>{const L=Ot(k);(/^(line|area)$/.test(k)&&u.hasTypeOf(L)||u.hasType(k))&&S&&u[`update${L}`](y.TransitionForExit)}),g.text&&p.selectAll(`.${ut.selectedCircles}`).filter(u.isBarType.bind(u)).selectAll("circle").remove(),h.interaction_enabled&&!b&&y.EventRect&&(u.redrawEventRect(),(c=u.bindZoomEvent)==null||c.call(u))):(g.arcs&&u.redrawArc(T,w,y.Transform),g.radar&&u.redrawRadar(),g.polar&&u.redrawPolar(),g.funnel&&u.redrawFunnel(),_&&u.updateTreemap(w)),!f.resizing&&!_&&(u.hasPointType()||f.hasRadar)?S&&u.updateCircle():(d=u.hasLegendDefsPoint)!=null&&d.call(u)&&u.data.targets.forEach(u.point("create",this)),u.hasDataLabel()&&!u.hasArcType(null,["radar"])&&S&&u.updateText(),v&&u.updateTypesElements(),u.generateRedrawList(x,b,T,y.Subchart,S),u.updateTooltipOnRedraw(),u.callPluginHook("$redraw",e,T)},generateRedrawList(e,t,n,i,a=!0){const s=this,{config:o,state:r}=s,l=a?s.getDrawShape():r._cachedDrawShape||s.getDrawShape();a&&(r._cachedDrawShape=l),r.hasAxis&&o.subchart_show&&s.redrawSubchart(i,n,l);const c=t&&s.generateFlow({targets:e,flow:t,duration:t.duration,shape:l,xv:s.xv.bind(s)}),d=(n||c)&&Zn(),u=s.getRedrawList(l,t,c,d),h=()=>{c&&c(),r.redrawing=!1,r._targetsToShow=null,r._cachedDrawShape=null,H(o.onrendered,s.api)};if(d&&u.length){const f=fr();(0,yg.transition)().duration(n).each(()=>{u.flatMap(g=>g).forEach(g=>f.add(g))}).call(f,h)}else r.transiting||h();s.mapToIds(s.data.targets).forEach(f=>{r.withoutFadeIn[f]=!0})},getRedrawList(e,t,n,i){const a=this,{config:s,state:{hasAxis:o,hasRadar:r,hasTreemap:l},$el:{grid:c}}=a,{cx:d,cy:u,xForText:h,yForText:f}=e.pos,g=[];if(o){a.redrawGrid&&(s.grid_x_lines.length||s.grid_y_lines.length)&&g.push(a.redrawGrid(i)),a.redrawRegion&&s.regions.length&&g.push(a.redrawRegion(i));for(const p in e.type){const _=Ot(p),x=e.type[p];(/^(area|line)$/.test(p)&&a.hasTypeOf(_)||a.hasType(p))&&g.push(a[`redraw${_}`](x,i))}!t&&c.main&&a.updateGridFocus&&g.push(a.updateGridFocus())}return(!a.hasArcType()||r)&&bt(s.data_labels)&&s.data_labels!==!1&&g.push(a.redrawText(h,f,t,i)),(a.hasPointType()||r)&&!a.isPointFocusOnly()&&a.redrawCircle&&g.push(a.redrawCircle(d,u,i,n)),l&&g.push(a.redrawTreemap(i)),g},updateAndRedraw(e={}){const t=this,{config:n,state:i}=t;let a;e.withTransition=Ne(e,"withTransition",!0),e.withTransform=Ne(e,"withTransform",!1),e.withLegend=Ne(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=Ne(e,"withTransitionForTransform",e.withTransition),e.withLegend&&n.legend_show||(i.hasAxis&&(a=t.axis.generateTransitions(e.withTransitionForAxis?n.transition_duration:0)),t.updateScales(),t.updateSvgSize(),t.transformAll(e.withTransitionForTransform,a)),t.redraw(e)}},wg={setContainerSize(){const e=this,{state:t}=e;t.current.width=e.getCurrentWidth(),t.current.height=e.getCurrentHeight()},getCurrentWidth(){const e=this;return e.config.size_width||e.getParentRectValue("width")},getCurrentHeight(){var e,t;const n=this,{config:i,state:a,$el:s}=n;let o=i.size_height;if(!o){const r=a.isCanvasMode?(e=s.chart)==null?void 0:e.node():null,l=r==null?void 0:r.style.minHeight;l&&(r.style.minHeight=""),o=n.getParentHeight(),l&&(r.style.minHeight=l);const c=r&&parseFloat((t=n.canvasEngine)==null?void 0:t.canvas.style.height)||0,d=a.current.height-c;d>0&&Math.round(o)===Math.round(c)&&(o+=d)}return o>0?o:320/(n.hasType("gauge")&&!i.gauge_fullCircle?2:1)},getParentRectValue(e){const t=`offset${Ot(e)}`;let n=this.$el.chart.node(),i=0;for(;i<30&&n&&n.tagName!=="BODY";){try{i=ht(n,!0)[e]}catch(s){t in n&&(i=n[t])}n=n.parentNode}const a=nt.body[t];return i>a&&(i=a),i},getParentHeight(){const e=this.$el.chart.style("height");let t=0;return e&&(t=/px$/.test(e)?parseInt(e,10):this.getParentRectValue("height")),t},getSvgLeft(e){var t,n,i;const a=this,{cache:s,config:o,state:{hasAxis:r},$el:l}=a;if(e){const A=s.get(W.svgLeft);if(A!==null)return A}const c=o.axis_rotated,d=c||!c&&!o.axis_y_inner,u=c?It.axisX:It.axisY,h=l.main.select(`.${u}`).node(),f=r&&o[`axis_${c?"x":"y"}_label`],p=r&&(Q(f)||Q(f.text)||/^inner-/.test(f==null?void 0:f.position))?l.main.select(`.${u}-label`):null,_=p&&!p.empty()?p.node():null,x=!e,m={label:_?ht(_,x):null,leftAxis:h&&d?ht(h,x):null,chart:ht(l.chart.node(),x)},b=(n=(t=m.label)==null?void 0:t.left)!=null?n:0,v=(i=m.leftAxis)!=null?i:{right:0},y=m.chart.left+b,T=a.hasArcType(),w=v.right-y-(T?0:a.getCurrentPaddingByDirection("left",e)),C=w>0?w:0;return s.add(W.svgLeft,C),C},previewResize(){var e,t,n;const i=this,{state:a,$el:s}=i,{current:o}=a,r=i.getCurrentWidth(),l=i.getCurrentHeight();if(!(!r||!l||!o.width||!o.height||r===o.width&&l===o.height)){if(a.isCanvasMode){const c=(e=i.canvasEngine)==null?void 0:e.canvas;if(!c)return;s.chart.style("min-height",`${l}px`),c.style.width=`${r}px`,c.style.height=`${Math.max(0,l-((n=(t=i.getCanvasBottomLegendHeight)==null?void 0:t.call(i))!=null?n:0))}px`}else if(s.svg)s.svg.attr("viewBox",`0 0 ${o.width} ${o.height}`).attr("preserveAspectRatio","none").attr("width",r).attr("height",l);else return;a.resizePreview=!0}},clearResizePreview(){const e=this,{config:t,state:n,$el:i}=e;n.resizePreview&&(n.resizePreview=!1,!n.isCanvasMode&&i.svg&&t.resize_auto!=="viewBox"&&i.svg.attr("viewBox",null).attr("preserveAspectRatio",null))},updateDimension(e){var t,n;const i=this,{config:a,state:{hasAxis:s,isCanvasMode:o},$el:r}=i;if(s&&!e&&i.axis.x&&a.axis_rotated&&((t=i.axis.subX)==null||t.create(r.axis.subX)),i.updateScales(e),o){(n=i.resizeCanvas)==null||n.call(i);return}i.updateSvgSize(),i.transformAll(!1)},updateSvgSize(){var e;const t=this,{config:n,state:{clip:i,current:a,hasAxis:s,width:o,height:r},$el:{svg:l}}=t;if(!l){(e=t.resizeCanvas)==null||e.call(t);return}if(t.clearResizePreview(),n.resize_auto==="viewBox"?l.attr("viewBox",`0 0 ${a.width} ${a.height}`):l.attr("width",a.width).attr("height",a.height),s){const c=l.select(`.${nr.brush} .overlay`),d={width:0,height:0};c.size()&&(d.width=+c.attr("width"),d.height=+c.attr("height")),l.selectAll([`#${i.id}`,`#${i.idGrid}`]).select("rect").attr("width",o).attr("height",r),l.select(`#${i.idXAxis}`).select("rect").call(t.setXAxisClipPath.bind(t)),l.select(`#${i.idYAxis}`).select("rect").call(t.setYAxisClipPath.bind(t)),i.idSubchart&&l.select(`#${i.idSubchart}`).select("rect").attr("width",o).attr("height",d.height)}},getCurrentPaddingByDirection(e,t=!1,n=!1){var i;const a=this,{config:s,$el:o,state:{hasAxis:r,isCanvasMode:l}}=a,c=s.axis_rotated,d=((i=s.padding)==null?void 0:i.mode)==="fit",u=$(s[`padding_${e}`])?s[`padding_${e}`]:void 0,h=r?{top:c?"y2":null,bottom:c?"y":"x",left:c?"x":"y",right:c?null:"y2"}[e]:null,f=/^(left|right)$/.test(e),g=h&&s[`axis_${h}_inner`],p=h&&s[`axis_${h}_show`],_=h?s[`axis_${h}_axes`].length:0;let x=h?f?a.getAxisWidthByAxisId(h,t):a.getHorizontalAxisHeight(h):0;const m=20;let b=0;!d&&f&&(x=eu(x));let v=r&&f&&(g||Ct(u)&&!p)?0:d?(p?x:0)+(u!=null?u:0):Ct(u)?x:u;return f&&r?(h&&(d||g)&&s[`axis_${h}_label`].text&&(v+=a.axis.getAxisLabelPosition(h).isOuter?m:0),e==="right"?(v+=c?!d&&Ct(u)?10:2:!p||g?d?2:1:0,v+=n?a.axis.getXAxisTickTextY2Overflow(m):0):e==="left"&&c&&Ct(u)&&(v=s.axis_x_show?d?x:Math.max(x,40):1)):e==="top"?((o.title&&o.title.node()||l&&s.title_text)&&(v+=a.getTitlePadding()),b=c&&!g?_:0):e==="bottom"&&r&&c&&!p&&(v+=1),v+x*_-b},getCurrentPadding(e=!1){const t=this,[n,i,a,s]=["top","bottom","left","right"].map(o=>t.getCurrentPaddingByDirection(o,null,e));return{top:n,bottom:i,left:a,right:s}},getResettedPadding(e){const t=this,{config:n}=t,i=$(e);let a=i?0:{};return n.padding===!1?!i&&Object.keys(e).forEach(s=>{a[s]=!se(n.data_labels)&&n.data_labels!==!1&&s==="top"?e[s]:0}):a=e,a},updateSizes(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:{legend:c}}=o,d=r.axis_rotated,u=o.hasArcType()||l.hasFunnel||l.hasTreemap,h=((t=r.padding)==null?void 0:t.mode)==="fit";!e&&o.setContainerSize();const f=c?o.getLegendWidth():0,g=c?o.getLegendHeight():0,p={width:f,height:g};!u&&r.axis_x_show&&r.axis_x_tick_autorotate&&o.updateXAxisTickClip();const _={right:r.legend_show&&l.isLegendRight?f+(h?0:20):0,bottom:!r.legend_show||l.isLegendRight||l.isLegendInset?0:g},x=d||u?0:o.getHorizontalAxisHeight("x"),m=r.subchart_axis_x_show&&r.subchart_axis_x_tick_text_show?x:30,b=r.subchart_show&&!u?r.subchart_size_height+m:0,v=o.hasType("gauge")&&r.arc_needle_show&&!r.gauge_fullCircle&&!r.gauge_label_show?10:0,y=o.getCurrentPadding(!0);if(l.margin=!u&&d?{top:y.top,right:u?0:y.right+_.right,bottom:_.bottom+y.bottom,left:b+(u?0:y.left)}:{top:(h?0:4)+y.top,right:u?0:y.right+_.right,bottom:v+b+_.bottom+y.bottom,left:u?0:y.left},l.margin=o.getResettedPadding(l.margin),l.margin2=d?{top:l.margin.top,right:NaN,bottom:20+_.bottom,left:o.state.rotatedPadding.left}:{top:l.current.height-b-_.bottom,right:NaN,bottom:m+_.bottom,left:l.margin.left},l.margin3={top:0,right:NaN,bottom:0,left:0},(n=o.updateSizeForLegend)==null||n.call(o,p),l.width=l.current.width-l.margin.left-l.margin.right,l.height=l.current.height-l.margin.top-l.margin.bottom,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l.width2=d?l.margin.left-l.rotatedPadding.left-l.rotatedPadding.right:l.width,l.height2=d?l.height:l.current.height-l.margin2.top-l.margin2.bottom,l.width2<0&&(l.width2=0),l.height2<0&&(l.height2=0),o.hasArcType()){const T=o.hasType("gauge"),w=r.legend_show&&l.isLegendRight,C=(i=l.hasRadar&&o.cache.get(W.radarTextWidth))!=null?i:0;l.arcWidth=l.width-(w?p.width+10:0)-C,l.arcHeight=l.height-(w&&!T?0:10),(a=r.arc_rangeText_values)!=null&&a.length&&(T?(l.arcWidth-=25,l.arcHeight-=10,l.margin.left+=10):(l.arcHeight-=20,l.margin.top+=10)),T&&!r.gauge_fullCircle&&(l.arcHeight+=l.height-o.getPaddingBottomForGauge()),(s=o.updateRadius)==null||s.call(o)}l.isLegendRight&&u&&(l.margin3.left=l.arcWidth/2+l.radiusExpanded*1.1)}},Cg={setCssRule(e,t,n,i){const a=this,{config:s,state:{cssRule:o,style:r}}=a;return s.boost_useCssRule?l=>{l.each(c=>{const d=i&&(i==null?void 0:i.call(a,c)),u=`${e?`.${kt.shapes+a.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[u]),a.state.cssRule[u]=wf(r,u,n.filter(Boolean).map(h=>Q(d)&&h.indexOf(":")===-1?`${h}: ${d}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:z(e)?e.bind(this):e}};function Sg(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function Ag(e,t,n,i,a){var s;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=$(r)&&r<0||l&&!((s=o.getCandlestickData(e))!=null&&s._isUp);let{x:d,y:u}=t;const h=4,f=h*2;return i?n==="start"?(d+=c?0:f,u+=h):n==="middle"?(d+=f,u-=f):n==="end"&&(c&&(d-=f),u+=h):(n==="start"?(d+=h,c&&(u+=f*2)):n==="middle"?u-=f:n==="end"&&(d-=h,c&&(u+=f*2)),a&&(u+=c?-17:l?13:7)),{x:d,y:u}}function $r(e,t){var n;const i=this.config.data_labels_position,{id:a,index:s,value:o}=e;return(n=z(i)?i.bind(this.api)(t,o,a,s,this.$el.text):(a in i?i[a]:i)[t])!=null?n:0}function kg(e,t,n){var i,a;const s=this,{config:o,$T:r}=s,l=o.axis_rotated,{border:{padding:c="3 5",radius:d=10,stroke:u="#000",strokeWidth:h=1,fill:f="none"}}=o.data_labels,g=Es(c),p=o.data_labels.border!==!0,_=Ue(e);let x=(0,F.select)(e.previousElementSibling);(x.empty()||((i=x.node())==null?void 0:i.tagName)!=="rect"||!((a=x.attr("class"))!=null&&a.includes(n)))&&(x=(0,F.select)(e.parentNode).insert("rect",()=>e).attr("class",`${Et.textBorderRect} ${n}`).attr("width",_.width+(p?g.left+g.right:0)).attr("height",_.height+(p?g.top+g.bottom:0)),p&&x.style("fill",f).style("stroke",u).style("stroke-width",`${h}px`).attr("rx",d).attr("ry",d)),r(x).attr("x",t.x-(p?g.left:0)-(l?0:_.width/2)).attr("y",t.y-(p?g.top:0)-_.height/4*3.2)}function Ga(e=0,t){const n=this,{config:i}=n,a=i[`${t}_label_threshold`]||0;return e>=a}function Br(){const e=this,{$el:{text:t},config:n}=e;(e.state.arcWidth?e.getArcLabelConfig("image"):n.data_labels.image)&&t.filter(function(){const a=this.previousElementSibling;return a?a.tagName!=="image"||!a.classList.contains(Et.textLabelImage):!0}).each(function(a){var s,o,r,l;const c=Lg.call(e,a);if(!c)return;const{url:d,width:u,height:h,pos:f}=c;if(d){const g=(0,F.select)(this.parentNode);g==null||g.insert("image",`${(o=(s=this.getAttribute("class"))==null?void 0:s.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",p=>an(d,{ID:"id"in p?p.id:p.data.id})).attr("class",Et.textLabelImage).style("pointer-events","none").attr("width",u).attr("height",h).attr("transform",f?`translate(${(r=f.x)!=null?r:0} ${(l=f.y)!=null?l:0})`:null)}})}function Lg(e){var t;const n=this,{config:i,state:a}=n,s=a.arcWidth?n.getArcLabelConfig("image"):i.data_labels.image;if(z(s))return(t=s.call(n.api,e.value,e.id,e.index))!=null?t:{url:"",width:0,height:0,pos:{x:0,y:0}};if(s){const{url:o="",width:r=0,height:l=0,pos:c}=s;return{url:o,width:r,height:l,pos:c}}return null}function zr(e,t,n){var i;const a=this,{config:s,state:{arcWidth:o,hasTreemap:r}}=a,l=s.axis_rotated,c=(0,F.select)(e.previousElementSibling),d=u=>{var h;const f=u.style.opacity!=="0"&&u.style.fillOpacity!=="0";return(o?u.textContent:f)&&((h=this.previousElementSibling)==null?void 0:h.tagName)!=="image"};if(!c.empty()&&((i=c.node())==null?void 0:i.tagName)==="image"){const u=n||ht(e),h=+c.attr("width")/2,f=+c.attr("height")/2;let g=t.x-h,p=t.y-f-u.height/2;l?t.x+=h:(r&&(g=-h,p=-(f*2+u.height)),a.hasType("pie")||a.hasType("polar")||(t.y+=f)),a.$T(c).style("opacity",d(e)?null:"0").attr("x",g).attr("y",p)}}function Rg(e){return Is(e,t=>t,t=>Ue(t,!0))}var Eg={opacityForText(e){const t=this;return t.isBarType(e)&&!Ga.call(t,Math.abs(t.getRatio("bar",e)),"bar")?"0":t.hasDataLabel()?null:"0"},initText(){const{$el:e}=this;e.main.select(`.${U.chart}`).append("g").attr("class",Et.chartTexts).style("pointer-events",e.funnel||e.treemap?"none":null)},updateTargetsForText(e){const t=this,n=t.getChartClass("Text"),i=t.getClass("texts","id"),a=t.classFocus.bind(t);t.$el.main.select(`.${Et.chartTexts}`).selectAll(`.${Et.chartText}`).data(t.filterNullish(e)).attr("class",r=>`${n(r)}${a(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",n).call(t.setCssRule(!0,` .${Et.text}`,["fill","pointer-events:none"],t.updateTextColor)).append("g").attr("class",i)},updateText(){const e=this,{$el:t,$T:n,config:i,axis:a}=e,s=e.getClass("text","index"),o=i.data_labels.centered,r=t.main.selectAll(`.${Et.texts}`).selectAll(`.${Et.text}`).data(e.labelishData.bind(e));n(r.exit()).style("fill-opacity","0").remove(),t.text=r.enter().append("text").merge(r).attr("class",s).attr("text-anchor",l=>{let d=i[`axis_${a==null?void 0:a.getId(l.id)}_inverted`]?l.value>0:l.value<0;if(e.isCandlestickType(l)){const u=e.getCandlestickData(l);d=!(u!=null&&u._isUp)}else if(e.isTreemapType(l))return o?"middle":"start";return i.axis_rotated?d?"end":"start":"middle"}).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each(function(l,c,d){const u=(0,F.select)(this);let{value:h}=l;if(e.isBubbleZType(l))h=e.getBubbleZData(h,"z");else if(e.isCandlestickType(l)){const f=e.getCandlestickData(l);f&&(h=f.close)}h=e.isTreemapType(l)?e.treemapDataLabelFormat(l)(u):e.dataLabelFormat(l.id)(h,l.id,l.index,d),$(h)?this.textContent=h:Cn(u,h,void 0,!0)}),Br.call(e)},updateTextColor(e){const t=this,{config:n}=t,i=n.data_labels_colors,a=t.isArcType(e)&&!t.isRadarType(e)||t.isFunnelType(e)||t.isTreemapType(e)?null:t.color(e);let s;if(Q(i))s=i;else if(tt(i)){const{id:o}=e.data||e;s=i[o]}else z(i)&&(s=i.bind(t.api)(a,e));if(t.isCandlestickType(e)&&!z(i)){const o=t.getCandlestickData(e);if(!(o!=null&&o._isUp)){const r=n.candlestick_color_down;s=tt(r)?r[e.id]:r}}return s||a},updateTextBGColor(e,t){const n=this,{$el:{defs:i}}=n;let a="";if(t){const s=Q(t)?"":n.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=i.select(["filter[id*='labels-bg","']"].join(s));if(o.size()&&(a=`url(#${o.attr("id")})`),z(t)){n.generateTextBGColorFilter(t);const r=n.color(e),l=t.bind(n.api)(r,e);l?o.select("feFlood").attr("flood-color",l):a=""}}return a||null},redrawText(e,t,n,i){const a=this,{$T:s,axis:o,config:r,state:{hasTreemap:l}}=a,c=me(!0),d=r.axis_rotated,u=r.data_labels.rotate,h=Sg(u),f=u?`rotate(${u})`:"",g=a.$el.text.style("fill",a.getStylePropValue(a.updateTextColor)).attr("filter",x=>a.updateTextBGColor.bind(a)(x,r.data_labels_backgroundColors)).style("fill-opacity",n?0:a.opacityForText.bind(a)),p=new Map,_=[];return g.each(function(x){const m=this;p.set(m,{rect:ht(m)}),r.data_labels.centered&&(a.isBarType(x)||a.isTreemapType(x))&&_.push(m)}),_.length>0&&Rg(_).forEach((x,m)=>{const b=p.get(m);b&&(b.bbox=x)}),g.each(function(x,m){var b;const v=p.get(this),y=s(l&&this.childElementCount?this.parentNode:this,!!(i&&(this.getAttribute("x")||this.getAttribute("transform"))),c),T=r[`axis_${o==null?void 0:o.getId(x.id)}_inverted`];let w={x:e.call(this,x,m,v),y:t.call(this,x,m,v)};u&&(w=Ag.bind(a)(x,w,h,d,T),y.attr("text-anchor",h)),zr.call(a,this,w,v==null?void 0:v.rect),this.childElementCount||u?y.attr("transform",`translate(${w.x} ${w.y}) ${f}`):(y.attr("x",w.x).attr("y",w.y),l&&((b=this.parentNode)==null||b.removeAttribute("transform"))),r.data_labels.border&&kg.call(a,y.node(),w,`${Et.textBorderRect}-${m}`)}),!0},getTextRect(e,t){var n,i;const a=this;let s,o,r;Array.isArray(e)?s=`${W.textRect}-${e.join("_")}`:(o=(i=(n=e.node)==null?void 0:n.call(e))!=null?i:e,/text/i.test(o.tagName)||(o=o.querySelector("text")),r=o.textContent,s=`${W.textRect}-${r.replace(/\W/g,"_")}`);const l=a.cache.get(s)||[];return l.length===0&&((a.$el.svg||a.$el.chart.select("svg")).selectAll(`.${U.dummy}`).data(r?[r]:e).enter().append("text").style("visibility","hidden").style("font",o?(0,F.select)(o).style("font"):null).classed(t||U.dummy,!0).text(c=>c).each(function(c,d){l[d]=ht(this)}).remove(),a.cache.add(s,l)),l.length>1?l:l[0]},generateXYForText(e,t){const n=this,{state:{hasRadar:i,hasFunnel:a,hasTreemap:s}}=n,o=Object.keys(e),r={},l=t?n.getXForText:n.getYForText;return a&&o.push("funnel"),i&&o.push("radar"),s&&o.push("treemap"),o.forEach(c=>{r[c]=n[`generateGet${Ot(c)}Points`](e[c],!1)}),function(c,d,u){const h=n.isAreaType(c)&&"area"||n.isBarType(c)&&"bar"||n.isCandlestickType(c)&&"candlestick"||n.isFunnelType(c)&&"funnel"||n.isRadarType(c)&&"radar"||n.isTreemapType(c)&&"treemap"||"line";return l.call(n,r[h](c,d),c,this,u)}},getCenteredTextPos(e,t,n,i,a){const s=this,{config:o}=s,r=o.axis_rotated,l=s.isBarType(e),c=s.isTreemapType(e);if(o.data_labels.centered&&(l||c)){const d=(a==null?void 0:a.bbox)||Ue(n);if(l){const u=s.getRangedData(e,null,"bar")>=0;if(r){const h=(u?t[1][1]-t[0][1]:t[0][1]-t[1][1])/2+d.width/2;return u?-h-3:h+2}else{const h=(u?t[0][1]-t[1][1]:t[1][1]-t[0][1])/2+d.height/2;return u?h:-h-2}}else if(c){const u=d.y-(n.childElementCount?0:+(n.getAttribute("y")||0));return i==="x"?(t[1][0]-t[0][0])/2:(t[1][1]-t[0][1])/2-u-d.height/2}}return 0},getXForText(e,t,n,i){var a,s,o;const r=this,{config:l}=r,c=l.axis_rotated,d=r.isFunnelType(t),u=r.isTreemapType(t);let h=e?e[0][0]:0;if(r.isCandlestickType(t))c?h=(a=r.getCandlestickData(t))!=null&&a._isUp?e[2][2]+4:e[2][1]-4:h+=(e[1][0]-h)/2;else if(d)if(e)h=(o=(s=e[2])==null?void 0:s[0])!=null?o:h;else return Ma(n,"x");else if(u)h+=l.data_labels.centered?0:5;else if(c){const f=l[`axis_${r.axis.getId(t.id)}_inverted`],g=r.isBarType(t)?4:6,p=t.value;h=e[2][1],h+=g*((f?p>0:p<0)?-1:1)}else h=r.hasType("bar")?(e[2][0]+e[0][0])/2:h;return(c||u||d)&&(h+=r.getCenteredTextPos(t,e,n,"x",i)),h+$r.call(this,t,"x")},getYForText(e,t,n,i){var a,s;const o=this,{axis:r,config:l,state:c}=o,d=l.axis_rotated,u=l[`axis_${r==null?void 0:r.getId(t.id)}_inverted`],h=o.isBarType(t),f=o.isFunnelType(t),g=o.isTreemapType(t),p=l.point_r,_=(i==null?void 0:i.rect)||ht(n);let{value:x}=t,m=3,b;if(o.isCandlestickType(t))x=o.getCandlestickData(t),d?(b=e[0][0],b+=(e[1][0]-b)/2+m):(b=x&&x._isUp?e[2][2]-m:e[2][1]+m*4,u&&(b+=15*(x._isUp?1:-1)));else if(f)if(e)b=((s=(a=e[2])==null?void 0:a[1])!=null?s:e[0][1])+_.height/2-3;else return Ma(n,"y");else if(g)b=e[0][1]+(l.data_labels.centered?0:_.height+5);else if(d)b=(e[0][0]+e[2][0]+_.height*.6)/2;else if(b=e[2][1],$(p)&&p>5&&(o.isLineType(t)||o.isScatterType(t))&&(m+=l.point_r/2.3),x<0||x===0&&!c.hasPositiveValue&&c.hasNegativeValue)b+=u?h?-3:-5:_.height+(h?-m:m);else{let v=-m*2;h?v=-m:o.isBubbleType(t)&&(v=m),u&&(v=h?10:15),b+=v}return(!d||g)&&(b+=o.getCenteredTextPos(t,e,n,"y",i)),b+$r.call(this,t,"y")},markOverlapped(e,t,n){const i=t.$el.arcs.selectAll(n),a=i.filter(d=>d.data.id!==e),s=i.filter(d=>d.data.id===e),o=Ia(s.node()),r=(d,u)=>Math.sqrt(d*d+u*u);if(!s.node())return;const l=parseInt(s.style("font-size"),10),c=[];a.each(function(){const d=Ia(this),u=r(o.e,o.f)>r(d.e,d.f)?s:(0,F.select)(this),h=Math.ceil(Math.abs(o.e-d.e))<Math.ceil(u.node().getComputedTextLength()),f=Math.ceil(Math.abs(o.f-d.f))<l;c.push({node:this,overlaps:h&&f})}),c.forEach(({node:d,overlaps:u})=>{(0,F.select)(d).classed(Et.TextOverlapping,u)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,F.selectAll)([this,this.previousSibling]).classed(Et.TextOverlapping,!1)})}};function Nr(e="left",t){const n=$(t);return e.includes("center")?n?t/2:"middle":e.includes("right")?n?t:"end":n?0:"start"}function Pg(e){var t,n,i,a,s,o,r,l;const{config:c,$el:d}=e,u=((i=(n=(t=e.canvasTheme)==null?void 0:t.style)==null?void 0:n.title)==null?void 0:i.font)||((o=(s=(a=e.canvasTheme)==null?void 0:a.style)==null?void 0:s.label)==null?void 0:o.font)||"14px sans-serif",h=(l=(r=d.chart)==null?void 0:r.node)==null?void 0:l.call(r),f=h==null?void 0:h.ownerDocument;if(h&&f&&c.title_text){const g=f.createElementNS("http://www.w3.org/2000/svg","svg"),p=f.createElementNS("http://www.w3.org/2000/svg","text");g.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",p.setAttribute("class",Et.title),p.style.font=u,p.textContent=String(c.title_text),g.appendChild(p),h.appendChild(g);const _=ht(p).height;if(g.remove(),_)return _}return c.title_text?parseFloat(u)||14:0}var Dg={initTitle(){const e=this,{config:t,$el:n}=e;if(t.title_text){n.title=n.svg.append("g");const i=n.title.append("text").style("text-anchor",Nr(t.title_position)).attr("class",Et.title);Cn(i,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:n},$el:{title:i}}=e;if(i){const a=Nr(t.title_position,n.width),s=(t.title_padding.top||0)+e.getTextRect(e.$el.title,Et.title).height;i.attr("transform",`translate(${a}, ${s})`)}},getCanvasTitleHeight(){return Pg(this)},getTitlePadding(){const e=this,{$el:{title:t},config:n,state:i}=e,a=n.title_padding.top||0,s=n.title_padding.bottom||0;if(i.isCanvasMode&&n.title_text)return a+e.getCanvasTitleHeight()+s;if(!(t!=null&&t.node()))return a+s;const o=t.node(),r=Ma(o,"y");if(r){const l=Ue(o);return r+l.y+l.height+s}return a+e.getTextRect(t,Et.title).height+s}};const Ig=/(\r?\n|\t)/g,Mg=/{{(.*)}}/;var Fg={initTooltip(){const e=this,{config:t,$el:n}=e;n.tooltip=(0,F.select)(t.tooltip_contents.bindto),n.tooltip.empty()&&(n.tooltip=n.chart.append("div").attr("class",Si.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.bindTooltipResizePos()},initShowTooltip(){var e;const t=this,{config:n,$el:i,state:{hasAxis:a,hasRadar:s}}=t;if(n.tooltip_init_show){const o=!(a||s);(e=t.axis)!=null&&e.isTimeSeries()&&Q(n.tooltip_init_x)&&(n.tooltip_init_x=Vt.call(t,n.tooltip_init_x)),t.api.tooltip.show({data:{[o?"index":"x"]:n.tooltip_init_x}});const r=n.tooltip_init_position;if(!n.tooltip_contents.bindto&&!se(r)){const{top:l=0,left:c=50}=r;i.tooltip.style("top",Q(l)?l:`${l}px`).style("left",Q(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:n,config:i}=t;return ue(z(i.tooltip_contents)?i.tooltip_contents.bind(n)(...e):t.getTooltipContent(...e))},getTooltipContent(e,t,n,i){var a;const s=this,{api:o,config:r,state:l,$el:c}=s,d=r.tooltip_format_title,u=r.tooltip_format_name,h=r.tooltip_format_value,f=z(d)?d.bind(o):t,g=z(u)?u.bind(o):(D=>D),p=z(h)?h.bind(o):null,_=(D,R,P,B)=>{let I=p;return I||(l.hasTreemap||s.isStackNormalized()&&(!s.isStackNormalizedPerGroup()||s.isGrouped(P))?I=(X,G)=>`${(G*100).toFixed(2)}%`:I=n),I(D,R,P,B)},x=r.tooltip_order,m=D=>s.axis&&s.isBubbleZType(D)?s.getBubbleZData(D.value,"z"):s.getBaseValue(D),b=s.levelColor?D=>s.levelColor(D.value):D=>i(D),v=r.tooltip_contents,y=v.template,T=s.mapToTargetIds();if(x===null&&r.data_groups.length){const D=s.orderTargets(s.data.targets).map(R=>R.id).reverse();e.sort((R,P)=>{let B=R?R.value:null,I=P?P.value:null;return B>0&&I>0&&(B=R.id?D.indexOf(R.id):null,I=P.id?D.indexOf(P.id):null),B-I})}else if(/^(asc|desc)$/.test(x)){const D=x==="asc";e.sort((R,P)=>{const B=R?m(R):null,I=P?m(P):null;return D?B-I:I-B})}else z(x)&&e.sort(x.bind(o));const w=s.getTooltipContentTemplate(y),C=e.length;let A,S,k,L,E;for(E=0;E<C;E++){S=e[E];const D=S&&m(S);if(!(!S||!(D||D===0))){if(Ct(A)){const R=(l.hasAxis||l.hasRadar)&&f(S.x);A=an(w[0],{CLASS_TOOLTIP:Si.tooltip,TITLE:q(R)?y?R:`<tr><th colspan="2">${R}</th></tr>`:""})}if(!S.ratio&&c.arcs&&(k=["arc",s.$el.arcs.select(`path.${at.arc}-${S.id}`).data()[0]],S.ratio=s.getRatio(...k)),k=[S.ratio,S.id,S.index],s.isAreaRangeType(S)){const[R,P]=["high","low"].map(I=>_(s.getRangedData(S,I),...k));L=`<b>Mid:</b> ${_(m(S),...k)} <b>High:</b> ${R} <b>Low:</b> ${P}`}else if(s.isCandlestickType(S)){const[R,P,B,I,X]=["open","high","low","close","volume"].map(G=>s.getRangedData(S,G,"candlestick")?_(s.getRangedData(S,G,"candlestick"),...k):void 0);L=`<b>Open:</b> ${R} <b>High:</b> ${P} <b>Low:</b> ${B} <b>Close:</b> ${I}${X?` <b>Volume:</b> ${X}`:""}`}else if(s.isBarRangeType(S)){const{value:R,id:P,index:B}=S;L=`${_(R,void 0,P,B)}`}else L=_(m(S),...k);if(L!==void 0){if(S.name===null)continue;const R=g((a=S.name)!=null?a:S.id,...k),P=b(S),B={CLASS_TOOLTIP_NAME:Si.tooltipName+s.getTargetSelectorSuffix(S.id),COLOR:y||!s.patterns?P:`<svg><rect style="fill:${P}" width="10" height="10"></rect></svg>`,NAME:R,VALUE:L};if(y&&tt(v.text)){const I=T.indexOf(S.id);Object.keys(v.text).forEach(X=>{B[X]=v.text[X][I]})}A+=an(w[1],B)}}}return`${A}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
21
+ `,rt.head.appendChild(Qt);try{return f("bb-shapes bb-shapes-canvas-probe","circle",Bt,Kt)}finally{Qt.remove()}},m=f("bb-axis bb-axis-x","path","domain",["stroke","stroke-width"]),v=g("bb-axis-x","line",["stroke","stroke-width"]),b=g("bb-axis-x","text",["fill","font"]),T=g("bb-axis-x","text",["fill"],"_active_"),k=g("bb-axis-y","text",["fill","font"]),w=g("bb-axis-y2","text",["fill","font"]),y=f("bb-axis bb-axis-x","text","bb-axis-x-label",["fill","font"]),C=f("bb-axis bb-axis-y","text","bb-axis-y-label",["fill","font"]),A=f("bb-axis bb-axis-y2","text","bb-axis-y2-label",["fill","font"]),S=h("circle","",["fill","stroke","stroke-width"]),L=f("bb-grid","line","bb-ygrid",["stroke","stroke-width","stroke-dasharray"]),P=f("bb-grid","text","",["fill","font"]),D=p("bb-grid","bb-xgrid-focus","line","bb-xgrid-focus",["stroke","stroke-width","stroke-dasharray"]),R=h("text","bb-text bb-empty",["fill","font"]),E=f("bb-region","rect","",["fill","fill-opacity"]),M=f("bb-region","text","",["fill","font"]),O=h("path","bb-bar",["opacity","fill-opacity","stroke","stroke-width"]),$=h("path","bb-bar _expanded_",["opacity","fill-opacity"]),I=h("path","bb-candlestick",["stroke","stroke-width"]),F=h("path","bb-candlestick _expanded_",["opacity","fill-opacity"]),V=h("path","bb-line",["stroke-width"]),Y=f("bb-target bb-focused","path","bb-line",["stroke-width"]),j=h("g","bb-target bb-defocused",["opacity"]),dt=h("path","bb-area",["opacity","fill-opacity"]),it=h("circle","bb-circle",["fill","stroke","stroke-width"]),ft=h("circle","bb-selected-circle",["fill","stroke","stroke-width"]),wt=x("bb-circle _expanded_",["fill","stroke","stroke-width"]),_t=h("rect","bb-zoom-brush",["fill","fill-opacity","opacity"]),jt=f("bb-brush","rect","extent",["fill","fill-opacity","opacity"]),It=f("bb-brush","rect","selection",["fill","fill-opacity","opacity"]),Et=f("bb-brush","path","handle--custom",["fill","fill-opacity","opacity","stroke","stroke-width"]),Ut=f("bb-chart-treemaps","rect","",["stroke","stroke-width"]),xe=h("text","bb-text",["fill","font"]),wn=f("","text","bb-title",["fill","font"]),ma=tt(_t.fill,"#000"),va=K(_t["fill-opacity"]||_t.opacity,.1),gd=tt(It.fill,tt(jt.fill,ma)),v0=(l=(r=(o=(s=$n(It["fill-opacity"],1))!=null?s:$n(It.opacity,1))!=null?o:$n(jt["fill-opacity"],1))!=null?r:$n(jt.opacity,1))!=null?l:va,pd=tt(Et.stroke,"transparent"),Tt={axis:{lineColor:tt(m.stroke,"#000"),lineWidth:K(m["stroke-width"],1),tickColor:tt(v.stroke,tt(m.stroke,"#000")),tickWidth:K(v["stroke-width"],K(m["stroke-width"],1)),labelFont:C.font||k.font||"10px sans-serif",xTickFont:b.font||k.font||"10px sans-serif",yTickFont:k.font||"10px sans-serif",y2TickFont:w.font||k.font||"10px sans-serif",labelColor:tt(k.fill,"#000"),xLabelColor:tt(y.fill,tt(b.fill,"#000")),yLabelColor:tt(C.fill,tt(k.fill,"#000")),y2LabelColor:tt(A.fill,tt(C.fill,tt(k.fill,"#000"))),activeLabelColor:On(T.fill,b.fill)||tt(k.fill,"#000")},grid:{lineColor:tt(L.stroke,"#aaa"),lineWidth:K(L["stroke-width"],1),dashArray:ra(L["stroke-dasharray"]),labelFont:P.font||k.font||"10px sans-serif",labelColor:tt(P.fill,"#aaa")},focusGrid:{lineColor:tt(D.stroke,tt(L.stroke,"#aaa")),lineWidth:K(D["stroke-width"],K(L["stroke-width"],1)),dashArray:ra(D["stroke-dasharray"]||L["stroke-dasharray"])},emptyLabel:{font:R.font||xe.font||k.font||"20px sans-serif",color:tt(R.fill,"#808080")},region:{fill:tt(E.fill,"steelblue"),opacity:K(E["fill-opacity"],.1),labelFont:M.font||k.font||"10px sans-serif",labelColor:tt(M.fill,"#000")},shape:{barOpacity:pn(O,1),barExpandedOpacity:K(pn($,pn(O,1)),pn(O,1)),barStrokeColor:tt(O.stroke,"#000"),barLineWidth:K(O["stroke-width"],0),barConnectLineColor:tt(V.stroke,"#000"),barConnectLineWidth:K(V["stroke-width"],1),candlestickStrokeColor:tt(I.stroke,"#000"),candlestickLineWidth:K(I["stroke-width"],1),candlestickExpandedOpacity:K(pn(F,1),1),lineWidth:K(V["stroke-width"],1),lineFocusedWidth:K(Y["stroke-width"],2),areaOpacity:pn(dt,.2),targetDefocusedOpacity:K(j.opacity,.3),pointFillColor:On(it.fill,S.fill),pointStrokeColor:On(it.stroke,S.stroke),pointLineWidth:$n(it["stroke-width"],S["stroke-width"])},selectedPoint:{fill:tt(ft.fill,"#fff"),stroke:On(ft.stroke),lineWidth:K(ft["stroke-width"],2)},focusPoint:{fill:On(wt.fill,_),stroke:On(wt.stroke,_),lineWidth:K(wt["stroke-width"],1)},zoomBrush:{fill:ma,opacity:va},subchartBrush:{fill:gd,opacity:v0,handleFill:tt(Et.fill,"transparent"),handleOpacity:pn(Et,1),handleStroke:pd,handleLineWidth:K(Et["stroke-width"],pd==="transparent"?0:1)},treemap:{stroke:tt(Ut.stroke,"#fff"),lineWidth:K(Ut["stroke-width"],1)},label:{font:xe.font||k.font||"10px sans-serif",color:tt(xe.fill,"#000")},title:{font:wn.font||xe.font||k.font||"14px sans-serif",color:tt(wn.fill,"#000")}},rn=this.extension;rn&&(Tt[rn.section]=rn.probe({probeIn:f,probeInNested:p,axisFont:k.font||"10px sans-serif",toColor:tt,toNumber:K}));const b0=Xg(n,rn),z=Fe(Tt,b0),ln=n==null?void 0:n.axis,y0=!!ln&&Object.prototype.hasOwnProperty.call(ln,"labelColor"),T0=!!ln&&Object.prototype.hasOwnProperty.call(ln,"labelFont");if(z.axis.lineWidth=K(z.axis.lineWidth,Tt.axis.lineWidth),z.axis.tickWidth=K(z.axis.tickWidth,z.axis.lineWidth),T0){const Bt=ln,Kt=z.axis.labelFont;Bt.xTickFont===void 0&&(z.axis.xTickFont=Kt),Bt.yTickFont===void 0&&(z.axis.yTickFont=Kt),Bt.y2TickFont===void 0&&(z.axis.y2TickFont=Kt)}if(z.axis.labelFont=z.axis.labelFont||Tt.axis.labelFont,z.axis.xTickFont=z.axis.xTickFont||z.axis.labelFont,z.axis.yTickFont=z.axis.yTickFont||z.axis.labelFont,z.axis.y2TickFont=z.axis.y2TickFont||z.axis.yTickFont,z.axis.labelColor=tt(z.axis.labelColor,Tt.axis.labelColor),y0){const Bt=z.axis.labelColor;ln.xLabelColor===void 0&&(z.axis.xLabelColor=Bt),ln.yLabelColor===void 0&&(z.axis.yLabelColor=Bt),ln.y2LabelColor===void 0&&(z.axis.y2LabelColor=Bt)}z.axis.xLabelColor=tt(z.axis.xLabelColor,z.axis.labelColor),z.axis.yLabelColor=tt(z.axis.yLabelColor,z.axis.labelColor),z.axis.y2LabelColor=tt(z.axis.y2LabelColor,z.axis.yLabelColor),z.axis.activeLabelColor=tt(z.axis.activeLabelColor,z.axis.labelColor),z.grid.lineWidth=K(z.grid.lineWidth,Tt.grid.lineWidth),z.grid.dashArray=ra(z.grid.dashArray),z.focusGrid.lineWidth=K(z.focusGrid.lineWidth,Tt.focusGrid.lineWidth),z.focusGrid.dashArray=ra(z.focusGrid.dashArray),z.region.opacity=K(z.region.opacity,Tt.region.opacity),z.shape.barOpacity=K(z.shape.barOpacity,Tt.shape.barOpacity),z.shape.barExpandedOpacity=K(z.shape.barExpandedOpacity,z.shape.barOpacity),z.shape.barLineWidth=K(z.shape.barLineWidth,Tt.shape.barLineWidth),z.shape.barConnectLineWidth=K(z.shape.barConnectLineWidth,Tt.shape.barConnectLineWidth),z.shape.candlestickLineWidth=K(z.shape.candlestickLineWidth,Tt.shape.candlestickLineWidth),z.shape.candlestickStrokeColor=tt(z.shape.candlestickStrokeColor,Tt.shape.candlestickStrokeColor),z.shape.candlestickExpandedOpacity=K(z.shape.candlestickExpandedOpacity,Tt.shape.candlestickExpandedOpacity),z.shape.lineWidth=K(z.shape.lineWidth,Tt.shape.lineWidth),z.shape.lineFocusedWidth=K(z.shape.lineFocusedWidth,Tt.shape.lineFocusedWidth),z.shape.areaOpacity=K(z.shape.areaOpacity,Tt.shape.areaOpacity),z.shape.targetDefocusedOpacity=K(z.shape.targetDefocusedOpacity,Tt.shape.targetDefocusedOpacity),z.shape.pointLineWidth=$n(z.shape.pointLineWidth),z.selectedPoint.lineWidth=K(z.selectedPoint.lineWidth,Tt.selectedPoint.lineWidth),z.focusPoint.lineWidth=K(z.focusPoint.lineWidth,Tt.focusPoint.lineWidth),z.zoomBrush.opacity=K(z.zoomBrush.opacity,Tt.zoomBrush.opacity),z.subchartBrush.opacity=K(z.subchartBrush.opacity,Tt.subchartBrush.opacity),z.subchartBrush.handleOpacity=K(z.subchartBrush.handleOpacity,Tt.subchartBrush.handleOpacity),z.subchartBrush.handleLineWidth=K(z.subchartBrush.handleLineWidth,Tt.subchartBrush.handleLineWidth),z.treemap.lineWidth=K(z.treemap.lineWidth,Tt.treemap.lineWidth),(c=rn==null?void 0:rn.normalize)==null||c.call(rn,z[rn.section],{toNumber:K}),this.style=z,this.cacheContainer=t,this.cacheKey=Dr(t,n),u.remove()}reload(t,n){const a=Dr(t,n);a!==null&&this.style&&this.cacheContainer===t&&this.cacheKey===a||this.load(t,n)}getGridLineStyle(t,n={},a="line"){const i={};for(const s of this.gridLineSelectorOverrides)Bg(s.selector,t,n.class,a)&&Rr(i,s.style,this.directGridOverrideKeys);return Ui(i).length?i:void 0}}var Wg=Object.defineProperty,Vg=(e,t,n)=>t in e?Wg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ce=(e,t,n)=>Vg(e,typeof t!="symbol"?t+"":t,n);const _n=24,Or=64,Ki=[ke,ue,qt];function Fn(e,t){return Math.floor(e/t)}function $r(e,t,n){var a,i;const s=Fn(t.x,n),o=Fn(t.x+((a=t.w)!=null?a:0),n),r=Fn(t.y,n),l=Fn(t.y+((i=t.h)!=null?i:0),n);for(let c=s;c<=o;c++)for(let u=r;u<=l;u++){const d=`${c}:${u}`,h=e.get(d);h?h.push(t):e.set(d,[t])}}function Fr(e,t,n,a,i=0){const s=Fn(t,a),o=Fn(n,a),r=[];for(let l=-i;l<=i;l++)for(let c=-i;c<=i;c++){const u=e.get(`${s+l}:${o+c}`);if(u!=null&&u.length)for(let d=0;d<u.length;d++)r.push(u[d])}return r}function Hg(e,t){var n,a,i;const s=e.config.point_sensitivity;if(Number.isFinite(s))return s;(n=e.pointR)==null||n.call(e,t);const o=(i=(a=e.getPointSensitivity)==null?void 0:a.call(e,t))!=null?i:_n;return Number.isFinite(o)?o:_n}function Yg(e,t){return Ke(e,t)&&t.values.length>Eo&&!e.config.data_selection_enabled&&Number.isFinite(e.config.point_sensitivity)&&Number.isFinite(e.config.point_r)}class jg{constructor(){Ce(this,"bars",[]),Ce(this,"points",[]),Ce(this,"indices",[]),Ce(this,"barGrid",new Map),Ce(this,"pointGrid",new Map),Ce(this,"plot",{x:0,y:0,w:0,h:0}),Ce(this,"pointCellSize",_n),Ce(this,"maxPointSensitivity",_n),Ce(this,"grouped",!1),Ce(this,"pointBased",!1),Ce(this,"indexAxis","x")}rebuild(t,n){var a,i,s,o,r,l,c,u;const{current:d,margin:h,width:f,height:p}=t.state,g=t.filterTargetsToShow();this.bars=[],this.points=[],this.indices=[],this.barGrid=new Map,this.pointGrid=new Map,this.maxPointSensitivity=_n,this.indexAxis=t.config.axis_rotated?"y":"x",this.plot=t.state.customType||t.state.hasTreemap?{x:0,y:0,w:d.width,h:d.height}:{x:h.left,y:h.top,w:f,h:p},this.grouped=!!t.config.tooltip_grouped&&!t.state.customType&&!t.state.hasTreemap,this.pointBased=!(t.config.axis_x_forceAsSingle&&this.grouped)&&(!!((a=t.isMultipleX)!=null&&a.call(t))||g.some(k=>Ke(t,k)||Ze(t,k)));const x=this.grouped&&(!this.pointBased||t.config.data_selection_enabled&&t.config.data_selection_grouped)?new Map:null,m=(k,w,y)=>{var C,A;if(!x)return;const S=(A=(C=t.getXCacheKey)==null?void 0:C.call(t,y.x))!=null?A:y.index;Number.isFinite(y.index)&&!x.has(S)&&At(k,w)&&x.set(S,{x:k,y:w,data:y})};if(t.state.customType){(o=(s=(i=t.getCustomTypeParts())==null?void 0:i.canvas)==null?void 0:s.hits)==null||o.call(t,this),this.indices=[];return}const v=(r=t.getCanvasTypeParts)==null?void 0:r.call(t).find(k=>k.exclusive);if(v){(l=v.hits)==null||l.call(t,this),this.indices=[];return}if(n.indices[X.BAR]||g.some(ue.bind(null,t))){const k=ue.bind(null,t),w=Gt(t,n,X.BAR,k),y=t.generateGetBarPoints(w,!1);g.filter(k).filter(C=>Ln(t,C,Ki)).forEach(C=>{const A=we(t,C);for(let S=A.start;S<A.end;S++){const L=C.values[S];if(!Dt(t,L))continue;const P=qn(t,y,L,S);if(!P)continue;const{rect:D}=P,R=h.left+D.x,E=h.top+D.y,{w:M,h:O}=D;this.addBar({x:R,y:E,w:M,h:O,data:L}),m(R+M/2,E+O/2,L)}})}if(n.indices[X.CANDLESTICK]||g.some(qt.bind(null,t))){const k=qt.bind(null,t),w=Gt(t,n,X.CANDLESTICK,k),y=(c=t.generateGetCandlestickPoints)==null?void 0:c.call(t,w,!1);y&&g.filter(k).filter(C=>Ln(t,C,Ki)).forEach(C=>{var A;const S=we(t,C);for(let L=S.start;L<S.end;L++){const P=C.values[L];if(!((A=t.getCandlestickData)==null?void 0:A.call(t,P)))continue;const R=Jn(t,y,P,L);if(!R)continue;const{body:E}=R,M=h.left+E.x,O=h.top+E.y,{w:$,h:I}=E;this.addBar({x:M,y:O,w:Math.max(1,$),h:Math.max(1,I),data:P}),m(M+$/2,O+I/2,P)}})}(u=t.getAxisTypeParts)==null||u.call(t).forEach(k=>{var w,y;return(y=(w=k.canvas)==null?void 0:w.hits)==null?void 0:y.call(t,this,{shape:n,targets:g,margin:h,addIndex:m})});const{cx:b,cy:T}=n.pos;b&&T&&g.filter(ke.bind(null,t)).filter(k=>Ln(t,k,Ki)).forEach(k=>{const w=we(t,k),y=Yg(t,k)?Do(f,p,t.config.point_r):null;for(let C=w.start;C<w.end;C++){const A=k.values[C];if(!Dt(t,A))continue;const S=h.left+b(A,C),L=h.top+T(A,C),P=Hg(t,A);At(S,L)&&(y&&!Oo(y,S-h.left,L-h.top)||(this.addPoint({x:S,y:L,sensitivity:P,data:A}),m(S,L,A)))}}),this.buildPointGrid(),this.indices=x?Array.from(x.values()).sort((k,w)=>k[this.indexAxis]-w[this.indexAxis]):[]}hitBar(t,n){for(const a of Fr(this.barGrid,t,n,Or)){const{w:i=0,h:s=0}=a;if(t>=a.x&&t<=a.x+i&&n>=a.y&&n<=a.y+s&&(!a.hit||a.hit(t,n)))return a.data}return null}hitPoint(t,n){var a,i;let s=null,o=Number.POSITIVE_INFINITY;for(const r of Fr(this.pointGrid,t,n,this.pointCellSize,1)){const l=r.x-t,c=r.y-n,u=Math.sqrt(l*l+c*c),d=(a=r.sensitivity)!=null?a:_n;u<=d&&u<o&&(o=u,s=r)}return(i=s==null?void 0:s.data)!=null?i:null}findNearest(t,n){const a=this.hitBar(t,n);if(a)return a;if(!this.pointBased&&this.grouped&&this.isWithinPlot(t,n)){const i=this.findNearestIndexItem(t,n);if(i)return i.data}return this.hitPoint(t,n)}findNearestShape(t,n){var a;return(a=this.hitBar(t,n))!=null?a:this.hitPoint(t,n)}findNearestIndexByCoord(t,n){var a,i;return(i=(a=this.findNearestIndexItem(t,n))==null?void 0:a.data)!=null?i:null}findInRect(t,n=!1){const a=Math.min(t.x,t.x+t.w),i=Math.max(t.x,t.x+t.w),s=Math.min(t.y,t.y+t.h),o=Math.max(t.y,t.y+t.h),r=new Set,l=[],c=u=>{const d=u.data,h=`${d.id}:${d.index}`;r.has(h)||(r.add(h),l.push(d))};if(n){const u=this.indexAxis,d=u==="y"?s:a,h=u==="y"?o:i;return this.indices.filter(f=>f[u]>=d&&f[u]<=h).forEach(c),l}return this.bars.filter(u=>{var d,h;const f=(d=u.w)!=null?d:0,p=(h=u.h)!=null?h:0;return!(i<u.x||u.x+f<a)&&!(o<u.y||u.y+p<s)}).forEach(c),this.points.filter(u=>u.x>=a&&u.x<=i&&u.y>=s&&u.y<=o).forEach(c),l}addBar(t){this.bars.push(t),$r(this.barGrid,t,Or)}addPoint(t){var n;const a=(n=t.sensitivity)!=null?n:_n;this.maxPointSensitivity=Math.max(this.maxPointSensitivity,a),this.points.push(t)}buildPointGrid(){this.pointCellSize=Math.max(1,this.maxPointSensitivity),this.pointGrid=new Map;for(const t of this.points)$r(this.pointGrid,t,this.pointCellSize)}isWithinPlot(t,n){const{plot:a}=this;return t>=a.x&&t<=a.x+a.w&&n>=a.y&&n<=a.y+a.h}findNearestIndexItem(t,n){const{indexAxis:a,indices:i}=this,s=a==="y"?n:t;if(!i.length)return null;let o=0,r=i.length-1;for(;o<r;){const u=o+r>>1;i[u][a]<s?o=u+1:r=u}const l=i[o],c=i[o-1];return c&&Math.abs(c[a]-s)<Math.abs(l[a]-s)?c:l}}var Xa=kt(5),Ug=Object.defineProperty,Ir=Object.getOwnPropertySymbols,Kg=Object.prototype.hasOwnProperty,Zg=Object.prototype.propertyIsEnumerable,Br=(e,t,n)=>t in e?Ug(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yt=(e,t)=>{for(var n in t||(t={}))Kg.call(t,n)&&Br(e,n,t[n]);if(Ir)for(var n of Ir(t))Zg.call(t,n)&&Br(e,n,t[n]);return e};const U={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},ct={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"},Ga={area:"bb-area",areas:"bb-areas"},Ft={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"},de={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},Xe={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},Vt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Zi={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},xn={dragarea:"bb-dragarea",INCLUDED:"_included_"},la={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},he={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"},J={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"},De={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},Ge={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},ut={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",xgridFocusContinuous:"bb-xgrid-focus-continuous",ygridFocus:"bb-ygrid-focus"},Lt={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"},We={level:"bb-level",levels:"bb-levels"},zr={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},ca={region:"bb-region",regions:"bb-regions"},gt={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},vt={shape:"bb-shape",shapes:"bb-shapes"},Nr={brush:"bb-brush",subchart:"bb-subchart"},Ot={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"},Wa={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},Xr={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},qi={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var H=yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt(yt({},U),ct),Ga),Ft),de),Xe),Vt),Zi),xn),he),J),De),Ge),ut),Lt),We),zr),ca),gt),vt),Nr),Ot),Wa),Xr),qi),qg={boost_useCssRule:!1,boost_useWorker:!1,boost_workerUrl:void 0},Jg={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},Qg={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},tp={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:[]},ep={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},np={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},ap={data_x:void 0,data_idConverter:e=>e,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:""},ip={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},sp=Object.defineProperty,op=(e,t,n)=>t in e?sp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rp=(e,t,n)=>op(e,typeof t!="symbol"?t+"":t,n);const Gr=class _d{static setOptions(t){for(let n=0;n<t.length;n++)Object.assign(this.data,t[n])}constructor(){return ah(tp,qg,ap,Jg,ip,Qg,ep,np,_d.data)}};rp(Gr,"data",{});let Oe=Gr;class lp{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 cp{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,customType:null,hasRadar:!1,hasTreemap:!1,isCanvasMode:!1,canvasShape:null,canvasFocusKey:null,canvasFocusData: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 Wr={element:lp,state:cp};class up{constructor(){Object.keys(Wr).forEach(t=>{this[t]=new Wr[t]})}getStore(t){return this[t]}}var dp=Object.defineProperty,hp=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fp=(e,t,n)=>hp(e,typeof t!="symbol"?t+"":t,n);const Z={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 gp{constructor(){fp(this,"cache",new Map)}add(t,n,a=!1){const i=a?this.cloneTarget(n):n;return this.cache.set(t,i),i}remove(t){const n=st(t)?[t]:t;for(let a=0;a<n.length;a++)this.cache.delete(n[a])}get(t,n=!1){if(n&&Array.isArray(t)){const a=[];for(let i=0,s;s=t[i];i++)this.cache.has(s)&&a.push(this.cache.get(s));return a}else return this.cache.has(t)?this.cache.get(t):null}has(t){return this.cache.has(t)}getKeys(){return Array.from(this.cache.keys())}reset(t,n){t?this.cache.clear():this.cache.forEach((a,i)=>{/^\$/.test(i)&&(n!=null&&n.some(s=>i.startsWith(s))||this.cache.delete(i))})}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(n=>({x:n.x,value:n.value,id:n.id}))}}}const Ji="https://github.com/naver/billboard.js/blob/master/MODULE_IMPORTS.md";function pp(e){const t=e,{config:n}=t,a=(le(n.data_types)?[n.data_type]:Object.values(n.data_types)).filter(s=>!le(s)),i=(a.length?a:["line"]).find(s=>Ro[s]&&!t[Ro[s]]);i&&ts(`Please, make sure if %c${nh(i)}`,"module has been imported and specified correctly.",Ji)}function Qi(e,t){return e[t]||ts(`Please, make sure if the module of %c${t}`,`is imported for render.mode='${e.config.render_mode}'. The modules of "billboard.js/canvas" draw only with render.mode='canvas'.`,Ji),e[t]}function L0(e){const t=gh[e];t&&ts(`Please, make sure if %c${t}`,"module has been imported and specified correctly.",Ji)}function ts(e,t,n){var a;const i="[billboard.js]";if((a=W.console)==null?void 0:a.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${i} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),n&&console.info("%c\u2139\uFE0F","font-size:15px",n)}throw Error(`${i} ${e.replace(/\%c([a-z-]+)/i,"'$1'")}${t?` ${t}`:""}`)}const _p=/\s?(bb-)/g,xp=/\.+/g;function mp(e){return e.replace(_p,".$1").replace(xp,".")}function Vr(e,t,n=!1){const a=s=>s[e?"getBoundingClientRect":"getBBox"](),i=e?"rectClient":"rectBBox";return n?a(t):!(i in t)||t.hasAttribute("width")&&t[i].width!==+(t.getAttribute("width")||0)?t[i]=a(t):t[i]}function In(e,t,n=[-1,1],a=!1){if(!(!e||!st(t)))if(t.indexOf(`
22
+ `)===-1)e.text(t);else{const i=[e.text(),t].map(s=>s.replace(/[\s\n]/g,""));if(i[0]!==i[1]){const s=t.split(`
23
+ `),o=a?s.length-1:1;e.html(""),s.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?n[0]*o:n[1]}em`).text(r)})}}}function Hr(e){const{x:t,y:n,width:a,height:i}=en(e,!0);return[{x:t,y:n+i},{x:t,y:n},{x:t+a,y:n},{x:t+a,y:n+i}]}function Yr(e){const{width:t,height:n}=mt(e),a=Hr(e),i=a[0].x,s=Math.min(a[0].y,a[1].y);return{x:i,y:s,width:t,height:n}}function se(e,t){var n;const a=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let i=[0,0];try{i=(0,B.pointer)(a||e,t)}catch(s){}return i.map(s=>isNaN(s)?0:s)}function mt(e,t=!1){return Vr(!0,e,t)}function en(e,t=!1){return Vr(!1,e,t)}function vp(e,t,n){const{rootSelector:a="",sheet:i}=e,s=`${a} ${mp(t)} {${n.join(";")}}`;return i[i.insertRule?"insertRule":"addRule"](s,i.cssRules.length)}function bp(e){let t=[];return e.forEach(n=>{var a;try{n.cssRules&&n.cssRules.length&&(t=t.concat(dn(n.cssRules)))}catch(i){(a=W.console)==null||a.warn(`Error while reading rules from ${n.href}: ${String(i)}`)}}),t}function jr(e){var t,n,a,i,s,o;return{x:((n=(t=W.pageXOffset)!=null?t:W.scrollX)!=null?n:0)+((a=e.scrollLeft)!=null?a:0),y:((s=(i=W.pageYOffset)!=null?i:W.scrollY)!=null?s:0)+((o=e.scrollTop)!=null?o:0)}}function ua(e,t=0,n=0,a=!0){const i=new DOMPoint(t,n),s=e.getScreenCTM(),o=i.matrixTransform(a?s==null?void 0:s.inverse():s);if(a===!1){const r=mt(e);o.x-=r.x,o.y-=r.y}return o}function es(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function da(e,t){var n;const a=(n=e==null?void 0:e.getAttribute)==null?void 0:n.call(e,t);if(a)return parseFloat(a);const i=es(e);return t==="x"?i.e:i.f}function ns(e){const t=e.attr("viewBox");return t?t.trim().split(/[\s,]+/).length===4:!1}function yp(e,t,n=!1){const a=!!e.node;let i=!1;for(const[s,o]of Object.entries(t))if(i=a?e.style(s)===o:e.style[s]===o,n?!i:i)break;return i}function ha(){var e,t;return((e=rt)==null?void 0:e.hidden)===!1||((t=rt)==null?void 0:t.visibilityState)==="visible"}function Tp(e,t){const{DocumentTouch:n,matchMedia:a,navigator:i}=W,s=a==null?void 0:a("(pointer:coarse)").matches;let o=!1;if(t)if(i&&"maxTouchPoints"in i)o=i.maxTouchPoints>0;else if("ontouchmove"in W||n&&rt instanceof n)o=!0;else if(s)o=!0;else{const l=i.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!s&&(a==null?void 0:a("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function Ur(e,t){e.pendingRaf!==null?(W.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=W.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=W.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}const as={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,a=e())=>{t.dispatchEvent(new MouseEvent(n,a))}}catch(t){return(n,a,i=e())=>{const s=rt.createEvent("MouseEvent");s.initMouseEvent(a,i.bubbles,i.cancelable,W,0,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(e,t,n)=>{const a=new Touch(Fe({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[a],targetTouches:[],changedTouches:[a]}))}},{setTimeout:wp,clearTimeout:kp}=W;function Cp(e,t){const n=[];let a,i=null;const s=function(){s.clear(),t&&i===null&&(i=eo(()=>{i=null,t()})),e===!1?a=no(()=>{a=null,n.forEach(o=>o())},{timeout:200}):a=wp(()=>{a=null,n.forEach(o=>o())},N(e)?e:200)};return s.clear=()=>{a&&((e===!1?Fd:kp)(a),a=null)},s.clearLive=()=>{i!==null&&($d(i),i=null)},s.add=o=>n.push(o),s.remove=o=>{const r=n.indexOf(o);r!==-1&&n.splice(r,1)},s}function Kr(){let e=[];const t=function(n,a){function i(){var s;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(s=l.empty)!=null&&s.call(l)){o++;continue}if(ha()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}ho(()=>{a==null||a()},i)};return t.add=function(n){et(n)?e=e.concat(n):e.push(n)},t}const $e={},Va=new Set,mn=new Map,Sp=5e3,Zr=3;let Ap=0;function Lp(){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(e){return""}}function is(){const{Blob:e,Worker:t,URL:n}=W;return t&&e&&(n!=null&&n.createObjectURL)&&(n!=null&&n.revokeObjectURL)?{Blob:e,Worker:t,URL:n}:null}function qr(){return W.Worker||null}function Pp(e){var t,n;return typeof e=="number"?{timeout:e,workerUrl:""}:{timeout:(t=e==null?void 0:e.timeout)!=null?t:Sp,workerUrl:(n=e==null?void 0:e.workerUrl)!=null?n:""}}function Jr(e,t=!1){var n,a;const i=$e[e];t&&Va.add(e),i&&((n=i.worker)==null||n.terminate(),i.revoke&&((a=is())==null||a.URL.revokeObjectURL(i.src)),delete $e[e]);for(const s of mn.keys())s.startsWith(`${e}:`)&&mn.delete(s)}function Rp(e,t){if(e===t)return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return!0}}function Ep(e){const[t,...n]=e;return Array.isArray(t)?[t.slice(0,Zr).map(a=>Array.isArray(a)?a.slice(0,Zr+1):a),...n]:e}function Qr(e,t,n,a){const i=++Ap;let s=!1,o;const r=new Promise((l,c)=>{const u=(p,g)=>{s||(s=!0,o(),p(g))},d=function(p){var g;((g=p.data)==null?void 0:g.id)===i&&(p.data.error?u(c,new Error(p.data.error)):u(l,p.data.result))},h=function(){u(c,new Error("worker error"))},f=setTimeout(()=>u(c,new Error("worker timeout")),a);o=()=>{clearTimeout(f),e.removeEventListener("message",d),e.removeEventListener("error",h)},e.addEventListener("message",d),e.addEventListener("error",h)});try{e.postMessage({args:n,id:i,op:t})}catch(l){throw s=!0,o(),l}return r}function Mp(e,t,n,a,i,s){const o=Ep(i),r=Qr(e,n,o,s).then(l=>Rp(l,a(...o)),()=>!1).then(l=>(l?mn.set(t,!0):mn.delete(t),l));return mn.set(t,r),r}function Dp(e,t=""){const n=!!qr(),a=t?null:is(),i=t?"":Lp(),s=t||"blob";if(!n||!t&&(!a||!i)||Va.has(s))return null;if(!(s in $e))try{if(t)$e[s]={revoke:!1,src:t,worker:null};else if(a){const o=new a.Blob([i],{type:"text/javascript"});$e[s]={revoke:!0,src:a.URL.createObjectURL(o),worker:null}}}catch(o){return null}return{key:s,src:$e[s].src}}function Op(e,t){const n=$e[e],a=qr();if(!n||!a||Va.has(e))return null;if(!n.worker)try{n.worker=new a(t)}catch(i){return Jr(e,!0),null}return n.worker}function ss(e=!0,t,n,a,i){const{timeout:s,workerUrl:o}=Pp(i),r=function(...c){const u=n(...c);a(u)};let l=r;if(e){const c=Dp(t,o),u=c?Op(c.key,c.src):null;if(u&&c){const{key:d}=c;l=function(...h){var f;const p=()=>{Jr(d,!0),l=r,r(...h)};try{const g=`${d}:${t}`,_=(f=mn.get(g))!=null?f:Mp(u,g,t,n,h,s);Qr(u,t,h,s).then(x=>{_===!0?a(x):_.then(m=>m?a(x):p())},p)}catch(g){p()}}}}return l}function $p(){const e=is();for(const t in $e){const n=$e[t];n.worker&&n.worker.terminate(),n.src&&n.revoke&&(e==null||e.URL.revokeObjectURL(n.src)),delete $e[t]}Va.clear(),mn.clear()}const os=34,fa=10,rs=13;function tl(e){const t=e.charCodeAt(0);function n(i,s){const o=[];let r=i.length,l=0,c=0,u=r<=0,d=!1;i.charCodeAt(0)===65279&&l++,i.charCodeAt(r-1)===fa&&--r,i.charCodeAt(r-1)===rs&&--r;function h(){if(u)return null;if(d)return d=!1,null;const p=l;let g,_;if(i.charCodeAt(p)===os){for(;++l<r;)if(i.charCodeAt(l)===os){if(i.charCodeAt(l+1)!==os)break;l++}return(_=l++)>=r?u=!0:(g=i.charCodeAt(l++))===fa?d=!0:g===rs&&(d=!0,i.charCodeAt(l)===fa&&++l),i.slice(p+1,_).replace(/""/g,'"')}for(;l<r;){if((g=i.charCodeAt(_=l++))===fa)d=!0;else if(g===rs)d=!0,i.charCodeAt(l)===fa&&++l;else if(g!==t)continue;return i.slice(p,_)}return u=!0,i.slice(p,r)}let f;for(;(f=h())!==null;){const p=[];for(;f!==null;)p.push(f),f=h();if(s){const g=s(p,c++);g!=null&&o.push(g)}else o.push(p)}return o}function a(i,s){let o=[];return n(i,(r,l)=>{var c;if(l===0)return o=r,null;const u={};for(let d=0;d<o.length;d++)u[o[d]]=(c=r[d])!=null?c:"";return s?s(u,l-1,o):u})}return{parse:a,parseRows:n}}const el=tl(","),nl=tl(" "),Fp=el.parse,Ip=el.parseRows,Bp=nl.parse,zp=nl.parseRows;function al(e){const t=[];return e.forEach(function(n,a){const i=n[0];n.forEach(function(s,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof s=="undefined")throw new Error(`Source data is missing a component at (${a}, ${o})!`);t[o-1][i]=s}})}),t}function il(e){const t=e[0],n=[];return e.forEach(function(a,i){if(i>0){const s={};a.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${i}, ${r})!`);s[t[r]]=o}),n.push(s)}}),n}function sl(e,t){const n=[];let a,i;if(Array.isArray(e)){const s=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let u=o;return c.some(function(d){return!(u=u&&typeof u=="object"&&d in u?u[d]:void 0)}),u};t.x?a=t.value.concat(t.x):a=t.value,n.push(a),e.forEach(function(o){const r=a.map(function(l){let c=s(o,l);return typeof c=="undefined"&&(c=null),c});n.push(r)}),i=il(n)}else Object.keys(e).forEach(function(s){var o;const r=[].concat(e[s]);(o=r.unshift)==null||o.call(r,s),n.push(r)}),i=al(n);return i}function Np(e,t="csv",n,a,i){const s=new XMLHttpRequest,o={csv:Xp,tsv:Gp,json:sl};s.open("GET",e),n&&Object.keys(n).forEach(function(r){s.setRequestHeader(r,n[r])}),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){const r=s.responseText;r&&i.call(this,o[t](t==="json"?JSON.parse(r):r,a))}else throw new Error(`${e}: Something went wrong loading!`)},s.send()}function ol(e,t){const n=e.rows(t);let a;return n.length===1?(a=[{}],n[0].forEach(i=>{a[0][i]=null})):a=e.parse(t),a}function Xp(e){return ol({rows:Ip,parse:Fp},e)}function Gp(e){return ol({rows:zp,parse:Bp},e)}const Wp=5e3;function Vp(e){var t,n;const a=e[0];if(et(a)){let i=0;for(let s=0,o=e.length;s<o;s++)i+=(n=(t=e[s])==null?void 0:t.length)!=null?n:0;return i}return e.length*Object.keys(a!=null?a:{}).length}function rl(e,t){const n=e||(t==null?void 0:t.data_keys);return n!=null&&n.x&&(t.data_x=n.x),n}function Hp(e,t,n){const a=this,{config:i}=a;let s;e.forEach(o=>{const r=a.getXKey(o);if(n.customX||n.timeSeries?n.xs.indexOf(r)>=0?s=(n.appendXs&&a.data.xs[o]||[]).concat(t.map((l,c)=>{const u=l[r];return nt(u)?a.generateTargetX(u,o,c):!1}).filter(l=>l!==!1)):i.data_x?s=this.getOtherTargetXs():St(i.data_xs)&&(s=a.getXValuesOfXKey(r,a.data.targets)):s=t.map((l,c)=>c),s)a.data.xs[o]=s;else throw new Error(`x is not defined for id = "${o}".`)})}var Yp={convertData(e,t){const{config:n}=this,a=o=>!(o!=null&&o.length)||le(o[0])?!1:n.boost_useWorker==="auto"?Vp(o)>=Wp:!!n.boost_useWorker,i=n.boost_workerUrl?{workerUrl:n.boost_workerUrl}:void 0;let s=e;if(e.bindto&&(s={},["url","mimeType","headers","keys","json","rows","columns"].forEach(o=>{const r=`data_${o}`;r in e&&(s[o]=e[r])})),s.url&&t)Np(s.url,s.mimeType,s.headers,rl(s.keys,n),t);else if(s.json)ss(a(s.json),"json",sl,t,i)(s.json,rl(s.keys,n));else if(s.rows)ss(a(s.rows),"rows",il,t,i)(s.rows);else if(s.columns)ss(a(s.columns),"columns",al,t,i)(s.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const n=this,{axis:a,config:i,state:s}=n,o=i.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((p,g)=>(n.isX.call(n,g)?p.xs.push(g):p.ids.push(g),p),{ids:[],xs:[]}):{ids:[],xs:[]},u={appendXs:t,xs:c,categorized:a==null?void 0:a.isCategorized(),timeSeries:a==null?void 0:a.isTimeSeries(),customX:a==null?void 0:a.isCustomX()};Hp.bind(n)(l,e,u);const d=u.customX&&u.categorized&&i.axis_x_categories.length?new Map(i.axis_x_categories.map((p,g)=>[p,g])):null,h=i.data_idConverter.bind(n.api),f=l.map((p,g)=>{const _=h(p),x=n.getXKey(p),m=u.customX&&u.categorized,v=m&&g===0&&(()=>{const k=fo(i.axis_x_categories);return e.every(w=>k.has(w[x]))})(),b=e.__append__,T=x===null&&b?n.api.data.values(p).length:0;return{id:_,id_org:p,values:e.map((k,w)=>{var y;const C=k[x];let A=k[p],S;if(A=A!==null&&!isNaN(A)&&!Q(A)?+A:et(A)||Q(A)?A:null,(m||s.hasRadar)&&g===0&&!Ct(C)){!v&&w===0&&!b&&(i.axis_x_categories=[],d&&d.clear());const L=String(C);S=(y=d==null?void 0:d.get(L))!=null?y:-1,S===-1&&(S=i.axis_x_categories.length,i.axis_x_categories.push(C),d==null||d.set(L,S))}else S=n.generateTargetX(C,p,T+w);return(Ct(A)||n.data.xs[p].length<=w)&&(S=void 0),{x:S,value:A,id:_,index:-1}}).filter(k=>ht(k.x))}});if(f.forEach(p=>{var g;i.data_xSort&&(p.values=p.values.sort((_,x)=>{const m=_.x||_.x===0?_.x:1/0,v=x.x||x.x===0?x.x:1/0;return m-v})),p.values.forEach((_,x)=>_.index=x),(g=n.data.xs[p.id])==null||g.sort((_,x)=>_-x)}),s.hasNegativeValue=f.some(p=>p.values.some(g=>g.value!==null&&g.value<0)),s.hasPositiveValue=f.some(p=>p.values.some(g=>g.value!==null&&g.value>0)),o&&n.isValidChartType(o)){const p=n.mapToIds(f).filter(g=>!(g in i.data_types)||!n.isValidChartType(i.data_types[g]));n.setTargetType(p,o)}return f.forEach(p=>n.cache.add(p.id_org,p,!0)),f}};const jp={areaRange:{high:0,mid:1,low:2},candlestick:{open:0,high:1,low:2,close:3,volume:4}};function ll(e){return et(e)?e:[e]}var Up={isX(e){const t=this,{config:n}=t,a=n.data_x&&e===n.data_x,i=St(n.data_xs)&&eh(n.data_xs,e);return a||i},isStackNormalized(){const{config:e}=this;return!!((e.data_stack_normalize===!0||ne(e.data_stack_normalize))&&e.data_groups.length)},isStackNormalizedPerGroup(){var e;const{config:t}=this;return!!(ne(t.data_stack_normalize)&&((e=t.data_stack_normalize)!=null&&e.perGroup)&&t.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(n=>n.indexOf(e)>=0&&n.length>1):t.length>0},hasAxisGroupedData(e){const t=this,{axis:n}=t;return t.data.targets.filter(s=>n.getId(s.id)===e).map(s=>s.id).some(s=>t.isGrouped(s))},getXKey(e){const t=this,{config:n}=t;return n.data_x?n.data_x:St(n.data_xs)?n.data_xs[e]:null},getXValuesOfXKey(e,t){const n=this,a=t&&St(t)?n.mapToIds(t):[];let i;return a.forEach(s=>{n.getXKey(s)===e&&(i=n.data.xs[s])}),i},getIndexByX(e,t){const n=this;return t?t.indexOf(st(e)?e:+e):(n.filterByX(n.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const n=this;return e in n.data.xs&&n.data.xs[e]&&nt(n.data.xs[e][t])?n.data.xs[e][t]:t},getOtherTargetXs(){const e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},getOtherTargetX(e){const t=this.getOtherTargetXs();return t&&e<t.length?t[e]:null},addXs(e){const t=this,{config:n}=t;Object.keys(e).forEach(a=>{n.data_xs[a]=e[a]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(St(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:n}=t;let a;return e&&(a=n.data_names[e.id],e.name=a!==void 0?a:e.id),e},getAllValuesOnIndex(e,t=!1){const n=this;let a=n.filterTargetsToShow(n.data.targets).map(i=>n.addName(n.getValueOnIndex(i.values,e)));return t&&(a=a.filter(i=>i&&"value"in i&&nt(i.value))),a},getValueOnIndex(e,t){var n;if(((n=e[t])==null?void 0:n.index)===t)return e[t];const a=e.filter(i=>i.index===t);return a.length?a[0]:null},updateTargetX(e,t){const n=this;e.forEach(a=>{a.values.forEach((i,s)=>{i.x=n.generateTargetX(t[s],a.id,s)}),n.data.xs[a.id]=t})},updateTargetXs(e,t){const n=this;e.forEach(a=>{t[a.id]&&n.updateTargetX([a],t[a.id])})},generateTargetX(e,t,n){const a=this,{axis:i}=a;let s=i!=null&&i.isCategorized()?n:e||n;if(i!=null&&i.isTimeSeries()){const o=Zt.bind(a);s=o(e||a.getXValue(t,n))}else i!=null&&i.isCustomX()&&!(i!=null&&i.isCategorized())&&(s=nt(e)?+e:a.getXValue(t,n));return s},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return ht(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return ht(t)?t:null},getBaseValue(e){const t=this,{hasAxis:n}=t.state;let{value:a}=e;return a&&n&&(t.isAreaRangeType(e)?a=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(a=t.getBubbleZData(a,"y"))),a},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let n=1/0,a=-1/0;const i=e||this.data.targets.map(s=>s.values);for(let s=0;s<i.length;s++){const o=i[s];for(let r=0;r<o.length;r++){const l=t(o[r]);N(l)&&(l<n&&(n=l),l>a&&(a=l))}}return{min:n,max:a}},getMinMaxData(){const e=this,t=Z.dataMinMax;let n=e.cache.get(t);if(!n){const a=e.data.targets.map(c=>c.values),i=e.getMinMaxValue(a),s=[],o=[],{min:r,max:l}=i;a.forEach(c=>{const u=e.getFilteredDataByValue(c,r),d=e.getFilteredDataByValue(c,l);if(u.length)for(let h=0;h<u.length;h++)s.push(u[h]);if(d.length)for(let h=0;h<d.length;h++)o.push(d[h])}),e.cache.add(t,n={min:s,max:o})}return n},getTotalPerIndex(e){const t=this,{config:n}=t,a=e?`${Z.dataTotalPerIndex}-${e}`:Z.dataTotalPerIndex,i=t.cache.get(a);let s=(i==null?void 0:i.generation)===t.state.dataGeneration?i.value:null;if((t.config.data_groups.length||t.isStackNormalized())&&!s){s=[];let{targets:o}=t.data;if(t.isStackNormalizedPerGroup()&&e){const r=n.data_groups.find(l=>l.indexOf(e)>=0);if(r)o=o.filter(l=>r.indexOf(l.id)>=0);else return null}o.forEach(r=>{r.values.forEach((l,c)=>{s[c]||(s[c]=0),s[c]+=N(l.value)?l.value:0})}),t.cache.add(a,{generation:t.state.dataGeneration,value:s})}return s},getVisibleTotalPerIndex(e){const t=this,{api:n,config:a,state:i,cache:s}=t;let o=s.get(Z.visibleTotalPerIndex);if((!o||o.generation!==i.dataGeneration)&&(o=s.add(Z.visibleTotalPerIndex,{generation:i.dataGeneration,values:new Map})),o.values.has(e))return o.values.get(e);const r=n.data.values.bind(n),{hiddenTargetIds:l}=i;let c=t.getTotalPerIndex(e);if(c===null)return o.values.set(e,c),c;if(l.size){let u=[...l];if(e){const d=a.data_groups.find(h=>h.indexOf(e)>=0);d&&(u=u.filter(h=>d.indexOf(h)>=0))}if(u.length){let d=r(u,!1);d.length&&(d=d.reduce((h,f)=>h.map((p,g)=>(N(p)?p:0)+f[g])),c=c.map((h,f)=>h-d[f]))}}return o.values.set(e,c),c},getTotalDataSum(e){const t=this,n=Z.dataTotalSum;let a=t.cache.get(n);return N(a)||(a=t.data.targets.reduce((i,s)=>i+s.values.reduce((o,r)=>{var l;return o+((l=r.value)!=null?l:0)},0),0),t.cache.add(n,a)),e&&(a-=t.getHiddenTotalDataSum()),a},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:n}}=e;let a=0;return n.size&&(a=t.data.values.bind(t)([...n]).reduce((i,s)=>i+s,0)),a},getFilteredDataByValue(e,t){return e.filter(n=>this.getBaseValue(n)===t)},getMaxDataCount(){const{targets:e}=this.data;let t=0;for(let n=0;n<e.length;n++)e[n].values.length>t&&(t=e[n].values.length);return t},getMaxDataCountTarget(){const e=this,{cache:t,state:n}=e,a=t.get(Z.maxDataCountTarget);if(a&&a.generation===n.dataGeneration)return a.value;let i=e.filterTargetsToShow()||[];const s=i.length,o=e.config.axis_x_inverted;if(s>1){const r=[];for(let l=0;l<i.length;l++){const c=i[l].values;for(let u=0;u<c.length;u++)r.push(c[u].x)}i=r,i=An(bi(i)).map((l,c,u)=>({x:l,index:o?u.length-c-1:c}))}else s&&(i=i[0].values.concat());return t.add(Z.maxDataCountTarget,{value:i,generation:n.dataGeneration}),i},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?et(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const n=this.mapToIds(e);for(let a=0,i;i=n[a];a++)if(i===t)return!0;return!1},isTargetToShow(e){return!this.state.hiddenTargetIds.has(e)},isLegendToShow(e){return!this.state.hiddenLegendIds.has(e)},getTargetsToShow(){var e;const{state:t}=this;return(e=t._targetsToShow)!=null?e:this.filterTargetsToShow()},filterTargetsToShow(e){const t=this;if(!e){const{cache:n,data:a,state:i}=t,s=Z.filteredTargets,o=n.get(s);if(o&&o.generation===i.dataGeneration)return o.value;const r=a.targets.filter(l=>t.isTargetToShow(l.id));return n.add(s,{value:r,generation:i.dataGeneration}),r}return e.filter(n=>t.isTargetToShow(n.id))},mapTargetsToUniqueXs(e){const t=this,{axis:n}=t;let a=[];return e!=null&&e.length&&(a=bi(ih(e.map(i=>i.values.map(s=>+s.x)))),a=n!=null&&n.isTimeSeries()?a.map(i=>new Date(+i)):a.map(Number)),An(a)},addTargetIds(e,t){const{state:n}=this;ll(t).forEach(a=>n[e].add(a))},removeTargetIds(e,t){const{state:n}=this;ll(t).forEach(a=>n[e].delete(a))},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e),this.cache.remove(Z.visibleTotalPerIndex)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e),this.cache.remove(Z.visibleTotalPerIndex)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:n}=t.state,a={},i=t.isMultipleX();let s=null;if(i){const o=t.cache.get(Z.valuesXIndexMap);if(o&&o.generation===t.state.dataGeneration)s=o.value;else{const r=t.mapTargetsToUniqueXs(t.data.targets).map(l=>st(l)?l:+l);s=new Map(r.map((l,c)=>[l,c])),t.cache.add(Z.valuesXIndexMap,{value:s,generation:t.state.dataGeneration})}}return e.forEach(o=>{var r,l;const c=[],u=(l=(r=t.getAxisTypeHooks)==null?void 0:r.call(t,o))==null?void 0:l.domainValues;o.values.filter(({value:d})=>nt(d)||d===null).forEach(d=>{let{value:h}=d;if(u&&(h=u(t,d)),h!==null&&t.isCandlestickType(d)&&(h=et(h)?h.slice(0,4):[h.open,h.high,h.low,h.close]),et(h))c.push(...h);else if(Q(h)&&"high"in h)c.push(...Object.values(h));else if(t.isBubbleZType(d))c.push(n&&t.getBubbleZData(h,"y"));else if(i&&s){const f=st(d.x)?d.x:+d.x,p=s.get(f);p!==void 0&&(c[p]=h)}else c.push(h)}),a[o.id]=c}),a},hasMultiTargets(){return this.filterTargetsToShow().length>1},orderTargets(e){const t=this,n=e.slice(),a=t.getSortCompareFn();return a&&n.sort(a),n},getSortCompareFn(e=!1){const t=this,{config:n}=t,a=n.data_order,i=/asc/i.test(a),s=/desc/i.test(a);let o;if(i||s){const r=(u,d)=>u+Math.abs(d.value),l=new WeakMap,c=u=>N(u)?u:(l.has(u)||l.set(u,"values"in u?u.values.reduce(r,0):u.value),l.get(u));o=(u,d)=>{const h=c(u),f=c(d);return e?i?h-f:f-h:i?f-h:h-f}}else G(a)&&(o=a.bind(t.api));return o||null},filterByX(e,t){return this.getValuesByX(e).get(this.getXCacheKey(t))||[]},filterNullish(e){const t=n=>nt(n.value);return e&&e.filter(n=>"value"in n?t(n):n.values.some(t))},filterRemoveNull(e){return e.filter(t=>nt(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(n=>({id:n.id,id_org:n.id_org,values:n.values.filter(a=>t[0]<=a.x&&a.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return cn(e)&&e||ne(e)&&St(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:n,config:a,state:{hasRadar:i,inputType:s,eventReceiver:{coords:o,rect:r}}}=t;let l;if(i){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const u=(0,B.select)(c).datum();l=u&&Object.keys(u).length===1?u.index:void 0}else{const c=a.axis_rotated,u=jr(n.chart.node()),d=s==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?d.clientY+u.y:d.clientX+u.x;if(ns(n.svg)){const f=[h,0];c&&f.reverse(),h=ua(n.eventRect.node(),...f)[c?"y":"x"]}else h-=c?r.top:r.left;l=yi(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,n){var a,i,s;const o=this,r=1.3,l=[e,t].map(c=>o.dataLabelFormat()(c));if(o.config.render_mode==="canvas"&&!o.$el.svg){const c=(i=(a=o.$el.chart)==null?void 0:a.node)==null?void 0:i.call(a),u=c==null?void 0:c.ownerDocument,d=u==null?void 0:u.createElementNS("http://www.w3.org/2000/svg","svg");if(c&&d){const h=l.map(p=>{const g=u.createElementNS("http://www.w3.org/2000/svg","text");return g.textContent=p,d.appendChild(g),g});d.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",c.appendChild(d);const f=h.map(p=>p.getBoundingClientRect()[n]*r);return d.remove(),f}}return((s=o.getTextRect(l))==null?void 0:s.map(c=>c[n]*r))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const n=e[t].x,a=[];let i;for(i=t-1;i>=0&&n===e[i].x;i--)a.push(e[i]);for(i=t;i<e.length&&n===e[i].x;i++)a.push(e[i]);return a},getXCacheKey(e){return st(e)?e:+e},getValuesByX(e){const t=this,{cache:n,state:a}=t,i=e.map(r=>{const{values:l}=r,c=l[0],u=l[l.length-1];return`${r.id}:${l.length}:${c?t.getXCacheKey(c.x):""}:${u?t.getXCacheKey(u.x):""}`}).join("|"),s=n.get(Z.valuesByX);if(s&&s.generation===a.dataGeneration&&s.targetKey===i)return s.value;const o=new Map;for(let r=0;r<e.length;r++){const l=e[r].values;for(let c=0;c<l.length;c++){const u=l[c],d=t.getXCacheKey(u.x),h=o.get(d);h?h.push(u):o.set(d,[u])}}return n.add(Z.valuesByX,{generation:a.dataGeneration,targetKey:i,value:o}),o},getClosestCandidates(e,t,n=!0){const a=this,{config:i,scale:s}=a,o=e.length,r=e[0];if(!n||o<200||!r||!i.data_xSort)return e;const l=a.isBarType(r.id),c=a.isCandlestickType(r.id),u=i.point_sensitivity;if(!(l||c)&&!N(u))return e;const d=s.zoom||s.x,h=t[+i.axis_rotated],f=d(e[0].x)<=d(e[o-1].x);let p=0,g=o-1;for(;p<g;){const b=p+g>>1,T=d(e[b].x);(f?T<h:T>h)?p=b+1:g=b}const _=[],x=new Set,m=b=>{b>=0&&b<o&&!x.has(b)&&(x.add(b),_.push(e[b]))},v=b=>{if(b<0||b>=o)return;const T=a.getXCacheKey(e[b].x);let k=b;for(;k>=0&&a.getXCacheKey(e[k].x)===T;)m(k--);for(k=b+1;k<o&&a.getXCacheKey(e[k].x)===T;)m(k++)};if(l||c)for(let b=p-2;b<=p+2;b++)v(b);else{const b=u,T=(k,w)=>{for(let y=k;y>=0&&y<o;y+=w){const C=e[y];if(Math.abs(d(C.x)-h)>b)break;m(y)}};T(p,1),T(p-1,-1)}return _},findClosestFromTargets(e,t){const n=this,a=[];for(let i=0;i<e.length;i++){const s=n.findClosest(e[i].values,t);s&&a.push(s)}return n.findClosest(a,t,!1)},findClosest(e,t,n=!0){var a;const i=this,{$el:{main:s}}=i,o=i.getClosestCandidates(e,t,n);let r,l;for(let c=0;c<o.length;c++){const u=o[c];if(!u||!nt(u.value))continue;const d=i.isBarType(u.id),h=i.isCandlestickType(u.id),f=(a=i.getAxisTypeHooks(u.id))==null?void 0:a.hit;if(d||h||f){const p=f?f(i,u):d?`.${de.chartBar}.${U.target}${i.getTargetSelectorSuffix(u.id)} .${de.bar}-${u.index}`:`.${Xe.chartCandlestick}.${U.target}${i.getTargetSelectorSuffix(u.id)} .${Xe.candlestick}-${u.index} path`;!l&&i.isWithinBar(s.select(p).node())&&(l=u)}else{const p=i.dist(u,t),g=i.getPointSensitivity(u);p<g&&(r===void 0||p<r)&&(r=p,l=u)}}return l},dist(e,t){const n=this,{config:{axis_rotated:a},scale:i}=n,s=+a,o=+!a,r=n.circleY(e,e.index),c=(i.zoom||i.x)(e.x)-t[s],u=r-t[o];return Math.sqrt(c*c+u*u)},convertValuesToStep(e){const t=this,{axis:n,config:a}=t,i=a.line_step_type,s=n?n.isCategorized():!1,o=et(e)?e.concat():[e];if(!(s||/step\-(after|before)/.test(i)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:u}=r;o.unshift({x:--u,value:r.value,id:c}),s&&i==="step-after"&&o.unshift({x:u-1,value:r.value,id:c}),u=l.x,o.push({x:++u,value:l.value,id:c}),s&&i==="step-before"&&o.push({x:u+1,value:l.value,id:c})}return o},convertValuesToRange(e){const t=et(e)?e.concat():[e],n=[];return t.forEach(a=>{const{x:i,id:s}=a;n.push({x:i,id:s,value:a.value[0]}),n.push({x:i,id:s,value:a.value[2]})}),n},updateDataAttributes(e,t){const n=this,{config:a}=n,i=a[`data_${e}`];return Ct(t)||(Object.keys(t).forEach(s=>{i[s]=t[s]}),n.redraw({withLegend:!0})),i},getRangedData(e,t="",n="areaRange"){var a,i;const s=e==null?void 0:e.value;if(et(s)){if(n==="bar")return s.reduce((o,r)=>r-o);{const o=(i=(a=jp[n])==null?void 0:a[t])!=null?i:-1;return o>=0?s[o]:void 0}}else if(s&&t)return s[t];return s},setRatioForGroupedData(e){const t=this,{config:n}=t;if(n.data_groups.length&&e.some(a=>t.isGrouped(a.id))){const a=i=>t.getRatio("index",i,!0);e.forEach(i=>{"values"in i?i.values.forEach(a):a(i)})}},getRatio(e,t,n=!1){const a=this,{config:i,state:s}=a,o=a.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(a.pie.padAngle()())r=t.value/a.getTotalDataSum(!0);else{const l=i.gauge_fullCircle?a.getArcLength():a.getStartingAngle()*-2,c=a.hasType("gauge")?l:Math.PI*2;r=(t.endAngle-t.startAngle)/c}else if(e==="index"){const l=a.getVisibleTotalPerIndex(a.isStackNormalizedPerGroup()?t.id:void 0);if(l===null)return r;const c=l[t.index];t.ratio=N(t.value)&&l&&c?t.value/c:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/s.current.dataMax*i.radar_size_ratio;else if(e==="bar"){const c=a.getYScaleById.bind(a)(t.id).domain().reduce((u,d)=>d-u);r=c===0?0:Math.abs(a.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=a.getTotalDataSum(!0));return n&&r?r*100:r},updateDataIndexByX(e){const t=this,n=e.reduce((a,i,s)=>(a[Number(i.x)]=s,a),{});t.data.targets.forEach(a=>{a.values.forEach((i,s)=>{let o=n[Number(i.x)];o===void 0&&(o=s),i.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(Q(e.value)&&("z"in e.value||"y"in e.value)||et(e.value)&&e.value.length>=2)},isBarRangeType(e){var t;const n=this,{value:a}=e;return n.isBarType(e)&&!((t=n.isSubchartSourceTypeOf)!=null&&t.call(n,e,X.CANDLESTICK))&&et(a)&&a.length>=2&&a.every(N)},getDataById(e){var t;const n=this.cache.get(e)||this.api.data(e);return(t=n==null?void 0:n[0])!=null?t:n}};function Ha(e,t=!1){const n=this,{api:a}=n;t&&n.api.flush(!0),e==null||e.call(a)}var Kp={load(e,t){const n=this,{axis:a,data:i,org:s,scale:o}=n,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;if(c){t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(d=>{var h;const f=((h=t.types)==null?void 0:h[d.id])||t.type;n.setTargetType(d.id,f)});const u=new Map(c.map(d=>[d.id,d]));i.targets.forEach(d=>{const h=u.get(d.id);if(h){if(r){const f=h.values;for(let p=0;p<f.length;p++)d.values.push(f[p])}else d.values=h.values;u.delete(d.id)}}),u.forEach(d=>i.targets.push(d))}if(n.state.isCanvasMode){n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.updateTypesElements(),Ha.call(n,t.done,t.resizeAfter);return}n.updateTargets(i.targets),o.zoom&&(l.x=a.isCategorized()?o.x.orgScale():(s.xScale||o.x).copy(),l.domain=n.getXDomain(i.targets),l.x.domain(l.domain),l.currentDomain=n.zoom.getDomain(),n.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,n.$el.eventRect.property("__zoom",null))),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(s.xDomain=l.domain,s.xScale=l.x,a.isCategorized()&&(l.currentDomain=n.getZoomDomainValue(l.currentDomain),s.xDomain=n.getZoomDomainValue(s.xDomain),s.xScale=l.x.domain(s.xDomain)),n.updateCurrentZoomTransform(l.x,l.currentDomain)):s.xScale&&s.xScale.domain(s.xDomain),n.updateTypesElements(),Ha.call(n,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(!1,[Z.filteredTargets,Z.maxDataCountTarget,Z.valuesXIndexMap,Z.maxTickSize]),t.convertData(e,n=>{const a=e.data||n;e.append&&(a.__append__=!0),a&&t.load(t.convertDataToTargets.call(t,a),e)}))},unload(e,t){var n,a,i;const s=this,{state:o,$el:r,$T:l}=s,c=!!((n=s.hasLegendDefsPoint)!=null&&n.call(s));let u=t,d=e;if(s.cache.reset(!1,[Z.filteredTargets,Z.maxDataCountTarget,Z.valuesXIndexMap,Z.maxTickSize]),u||(u=()=>{}),d=d.filter(p=>s.hasTarget(s.data.targets,p)),d.length===0){u();return}const h=new Set(d);if(o.isCanvasMode){d.forEach(p=>{o.withoutFadeIn[p]=!1}),s.data.targets=s.data.targets.filter(p=>!h.has(p.id)),s.removeHiddenTargetIds(d),s.removeHiddenLegendIds(d),s.updateTypesElements(),u();return}d.forEach(p=>{var g;const _=s.getTargetSelectorSuffix(p);o.withoutFadeIn[p]=!1,r.legend&&r.legend.selectAll(`.${J.legendItem}${_}`).remove(),c&&((g=r.defs)==null||g.select(`#${s.getDefsPointId(_)}`).remove())}),s.data.targets=s.data.targets.filter(p=>!h.has(p.id)),(i=(a=s.customTypeHooks)==null?void 0:a.afterUnload)==null||i.call(a,s),o.hasTreemap&&s.updateTargetsForTreemap(s.data.targets),s.updateTypesElements();const f=r.svg.selectAll(d.map(p=>s.selectorTarget(p)));l(f).style("opacity","0").remove().call(Aa,u)}},cl=kt(6),Zp={setExpand(e,t,n){const a=this,{config:i,$el:{circle:s}}=a;s&&i.point_focus_expand_enabled&&a.expandCircles(e,t,n),a.expandBarTypeShapes(!0,e,t,n)},expandBarTypeShapes(e=!0,t,n,a){const i=this;["bar","candlestick"].filter(s=>i.$el[s]).forEach(s=>{a&&i.$el[s].classed(U.EXPANDED,!1),i.getShapeByIndex(s,t,n).classed(U.EXPANDED,e)})},setOverOut(e,t,n){const a=this,{config:i,state:{customType:s,hasRadar:o,hasTreemap:r},$el:{main:l}}=a,c=Q(t);if(c||t!==-1){const u=i[e?"data_onover":"data_onout"].bind(a.api);if(i.color_onover&&a.setOverColor(e,t,c),c){const d=a.getTargetSelectorSuffix(t.id),h=s||r?`${U.target+d} .${vt.shape}`:ct.arc+d;u(t,n!=null?n:l.select(`.${h}`).node())}else if(i.tooltip_grouped)e&&(o&&a.isPointFocusOnly()?a.showCircleFocus(a.getAllValuesOnIndex(t,!0)):a.setExpand(t,null,!0)),!a.isMultipleX()&&l.selectAll(`.${vt.shape}-${t}`).each(function(d){u(d,this)});else{const d=a.cache.get(Z.setOverOut)||[],h=l.selectAll(`.${vt.shape}-${t}`).filter(function(p){return a.isWithinShape(this,p)}),f=h.filter(function(){return d.every(p=>p!==this)});if(!e||h.empty()||d.length===f.size()&&f.nodes().every((p,g)=>p!==d[g]))for(;d.length;){const p=d.pop();i.data_onout.bind(a.api)((0,B.select)(p).datum(),p)}f.each(function(){e&&(u((0,B.select)(this).datum(),this),d.push(this))}),a.cache.add(Z.setOverOut,d)}}},callOverOutForTouch(e){const t=this,n=t.cache.get(Z.callOverOutForTouch);(Q(e)&&n?e.id!==n.id:e!==n)&&((n||N(n))&&t.setOverOut(!1,n),(e||N(e))&&t.setOverOut(!0,e),t.cache.add(Z.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:n}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,cl.drag)().on("drag",function(a){n.event=a,e.drag(se(a,this))}).on("start",function(a){n.event=a,e.dragstart(se(a,this))}).on("end",a=>{n.event=a,e.dragend()}):()=>{}},dispatchEvent(e,t,n){var a,i,s,o;const r=this,{config:l,state:{eventReceiver:c,hasAxis:u,customType:d,hasRadar:h,hasTreemap:f},$el:{eventRect:p,radar:g,svg:_,treemap:x}}=r;let m=(s=(i=(d||f)&&c.rect||h&&g.axes.select(`.${Ft.axis}-${t} text`)||p||((a=r.getArcElementByIdOrIndex)==null?void 0:a.call(r,t)))==null?void 0:i.node)==null?void 0:s.call(i);if(m){const v=r.isMultipleX(),b=l.axis_rotated;let{width:T,left:k,top:w}=mt(m);if(u&&!h&&!v){const S=c.coords[t];S?(T=S.w,k+=S.x,w+=S.y):(T=0,k=0,w=0)}let y=k+(n?n[0]:0)+(v||b?0:T/2),C=w+(n?n[1]:0)+(b?4:0);if(ns(_)&&r.$el.eventRect){const S=ua(r.$el.eventRect.node(),y,C,!1);y=S.x,C=S.y}const A={screenX:y,screenY:C,clientX:y,clientY:C,bubbles:h};(d||f)&&(m=((o=r.$el[d])!=null?o:x).node()),as[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,A)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{canvas:t,eventRect:n,svg:a,zoomResetBtn:i}}=e;n==null||n.on(".zoom wheel.zoom .drag",null),t==null||t.on(".zoom wheel.zoom .drag",null),a==null||a.on("wheel",null),i==null||i.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:n,eventRect:a,legend:i,region:s,svg:o,treemap:r},brush:l,state:{customType:c}}=t,u=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,a,s==null?void 0:s.list,l==null?void 0:l.getSelection(),n==null?void 0:n.selectAll("path"),i==null?void 0:i.selectAll("g"),t.$el[c],r].forEach(d=>d==null?void 0:d.on(u,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},qp={categoryName(e){var t;const{axis_x_categories:n}=this.config;return(t=n==null?void 0:n[e])!=null?t:e}};const Jp=/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g;var Qp={generateClass(e,t){const n=this.state.generateClassCache,a=`${e}\0${t}`;let i=n.get(a);return i||(i=` ${e} ${e+this.getTargetSelectorSuffix(t)}`,n.set(a,i)),i},getClass(e,t,n){const a=/s$/.test(e),i=n!=null?n:/^(area|arc|line|treemap)s?$/.test(e),s=a?"id":"index";return o=>{const r=o.data||o;return((t?this.generateClass(H[a?"shapes":"shape"],r[s]):"")+this.generateClass(H[e],r[i?"id":s])).trim()}},getChartClass(e){return t=>H[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],n=[];return function(a){var i;const s=a.id||((i=a.data)==null?void 0:i.id)||a;return n.indexOf(s)<0&&n.push(s),t[n.indexOf(s)%t.length]}},classRegion(e,t){return`${this.generateClass(H.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let n="";return t&&(n=` ${H.target}-${t}`),this.generateClass(H.target,e)+n},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.has(e.id)?H.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.has(e.id)?H.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(Jp,"-")},selectorTarget(e,t="",n=""){const a=this.getTargetSelectorSuffix(e);return`${t}.${H.target+a} ${n}, ${t}.${H.circles+a} ${n}`},selectorTargets(e,t){const n=e||[];return n.length?n.map(a=>this.selectorTarget(a,t)):null},selectorLegend(e){return`.${H.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}};const t_=(e,t,n)=>{const a=(0,B.select)(e.cloneNode(!0));return a.attr("id",n).insert("rect",":first-child").attr("width",a.attr("width")).attr("height",a.attr("height")).style("fill",t),{id:n,node:a.node()}};function e_(e){const t=Z.colorPattern,{body:n}=rt;let a=n[t];if(!a){const s=e.classed(Zi.colorPattern,!0).style("background-image");e.classed(Zi.colorPattern,!1),s.indexOf(";")>-1&&(a=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),n[t]=a)}return a}const n_=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var a_={generateColor(){const e=this,{$el:t,config:n}=e,a=[],i=n.area_linearGradient||n.bar_linearGradient||n.point_radialGradient;let s=St(n.color_pattern)?n.color_pattern:[...e_(t.chart)||n_];const o=s;if(G(n.color_tiles)){const r=n.color_tiles.bind(e.api)(),l=s.map((c,u)=>{const d=c.replace(/[#\(\)\s,]/g,""),h=`${e.state.datetimeId}-pattern-${d}-${u}`;return t_(r[u%r.length],c,h)});s=l.map(c=>`url(#${c.id})`),e.patterns=l}return function(r){var l;const c=n.data_colors,u=n.data_color,d=r.id||((l=r.data)==null?void 0:l.id)||r,h=e.isTypeOf(d,["line","spline","step"])||!n.data_types[d];let f;if(G(c[d]))f=c[d].bind(e.api)(r);else if(c[d])f=c[d];else{let p=a.indexOf(d);p<0&&(a.push(d),p=a.length-1),f=h?o[p%o.length]:s[p%s.length],c[d]=f}if(f=G(u)?u.call(e.api,f,r):f,i&&t.defs){const p=e.$el.defs.selectAll(`[id$='-gradient${e.getTargetSelectorSuffix(d)}'] stop`);let g;p.each(function(_,x){g=x===0?this.style.stopColor:this.style.stopColor===g}),g===!0&&p.attr("stop-color",f)}return f}},generateLevelColor(){const e=this,{config:t}=e,n=t.color_pattern,a=t.color_threshold,i=a.unit==="value",s=a.max||100,o=a.values&&a.values.length?a.values:[];return St(a)?function(r){const l=i?r:r*100/s;let c=n[n.length-1];for(let u=0,d=o.length;u<d;u++)if(l<=o[u]){c=n[u];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const n=this,{$el:{defs:a},state:i}=n;if(e){let s=[];st(e)?s.push(""):Q(e)?s=Object.keys(e):G(e)&&(s=n.mapToTargetIds()),s.forEach(o=>{const r=`${i.datetimeId}-labels-bg${n.getTargetSelectorSuffix(o)}${st(e)?n.getTargetSelectorSuffix(e):""}`,l=ve(o===""?e:(e==null?void 0:e[o])||"");if(a.select(`#${r}`).empty()){const c=a.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r);c.append("feFlood").attr("flood-color",l),c.append("feComposite").attr("in","SourceGraphic")}})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:n},state:{datetimeId:a},$el:{defs:i}}=e;n.forEach(s=>{const o=`${a}-gradient${e.getTargetSelectorSuffix(s.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(s)&&"area"||e.isBarType(s)&&"bar";if((r||l)&&i.select(`#${o}`).empty()){const c=e.color(s),u={defs:null,stops:[]};if(r){const{cx:d=.3,cy:h=.3,r:f=.7,stops:p=[[.1,c,0],[.9,c,1]]}=r;u.stops=p,u.defs=i.append("radialGradient").attr("id",`${o}`).attr("cx",d).attr("cy",h).attr("r",f)}else{const d=t.axis_rotated,{x:h=d?[1,0]:[0,0],y:f=d?[0,0]:[0,1],stops:p=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];u.stops=p,u.defs=i.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",f[0]).attr("y2",f[1])}u.stops.forEach(d=>{const[h,f,p]=d,g=G(f)?f.bind(e.api)(s.id):f;u.defs&&u.defs.append("stop").attr("offset",h).attr("stop-color",g||c).attr("stop-opacity",p)})}})},setOverColor(e,t){const n=this,{config:a,$el:{main:i}}=n,s=a.color_onover;let o=e?s:n.color;Q(o)?o=({id:r})=>r in s?s[r]:n.color(r):st(o)?o=()=>s:G(s)&&(o=o.bind(n.api)),i.selectAll(Q(t)?`.${ct.arc}${n.getTargetSelectorSuffix(t.id)}`:`.${vt.shape}-${t}`).style("fill",o)}},Ya=kt(7);function ul(e){const{event:t,$el:n}=e,a=n.subchart.main||n.main;let i;return t&&t.type==="brush"?i=t.selection:a&&(i=a.select(".bb-brush").node())&&(i=(0,Ya.brushSelection)(i)),i}function dl(e){const t=ul(e);return t?t[0]===t[1]:!0}function hl(e,t){return t.map(n=>{var a,i,s,o,r,l,c,u,d;const{values:h}=n,f=h[0],p=h[h.length-1],g=f?(i=(a=e.getXCacheKey)==null?void 0:a.call(e,f.x))!=null?i:f.x:"",_=p?(o=(s=e.getXCacheKey)==null?void 0:s.call(e,p.x))!=null?o:p.x:"",x=(l=(r=e.getTargetType)==null?void 0:r.call(e,n))!=null?l:"",m=(d=(u=(c=e.state)==null?void 0:c.subchartSourceTypes)==null?void 0:u[n.id])!=null?d:"";return`${n.id}:${x}:${m}:${h.length}:${g}:${_}`}).join("|")}function fl(e,t){var n;const a=(n=e.data)==null?void 0:n.targets;if(!a)return!1;for(let i=0;i<t.length;i++){const s=t[i],o=a.find(r=>r.id===s.id);if(!o||o.values!==s.values)return!1}return!0}function ls(e,t){St(t)&&((e.min===void 0||t<e.min)&&(e.min=t),(e.max===void 0||t>e.max)&&(e.max=t))}function gl(e,t){for(let n=0;n<t.length;n++)ls(e,t[n])}function i_(e,t){var n,a,i,s,o,r;const l={min:void 0,max:void 0},c=e.state.hasAxis;for(let u=0;u<t.length;u++){const d=t[u],h=(n=e.isCandlestickType)==null?void 0:n.call(e,d),f=!h&&!!((a=e.isSubchartSourceTypeOf)!=null&&a.call(e,d,X.CANDLESTICK)),p=(s=(i=e.getAxisTypeHooks)==null?void 0:i.call(e,d))==null?void 0:s.domainValues,{values:g}=d;for(let _=0;_<g.length;_++){const x=g[_];let m=p?p(e,x):x.value;if(!(nt(m)||m===null))continue;const v=f?(o=e.getSubchartCandlestickShapeValue)==null?void 0:o.call(e,x,!0):void 0;N(v)?m=v:m!==null&&(h||f)&&(m=Array.isArray(m)?m.slice(0,4):[m.open,m.high,m.low,m.close]),Array.isArray(m)?gl(l,m):Q(m)&&"high"in m?gl(l,Object.values(m)):(r=e.isBubbleZType)!=null&&r.call(e,x)?ls(l,c&&e.getBubbleZData(m,"y")):ls(l,m)}}return[l.min,l.max]}function s_(e,t){let n;for(let a=0;a<e.length;a++){const{values:i}=e[a];for(let s=0;s<i.length;s++){const{x:o}=i[s];St(o)&&(n===void 0||(t==="min"?o<n:o>n))&&(n=o)}}return n}var o_={getYDomainMinMaxBoth(e){const t=this,{axis:n,cache:a,config:i,state:s}=t,r=fl(t,e)?`${Z.domainMinMax}_y_${hl(t,e)}`:null,l=r&&a.get(r);if(l&&l.generation===s.dataGeneration)return l.value;const c=i.data_groups,u=t.mapToIds(e),d=fo(u);let h;if(c.length>0){const f=t.getValuesAsIdKeyed(e),p=e.some(T=>T.values.some(k=>k.value<0)),g=e.some(T=>T.values.some(k=>k.value>0)),_=new Map(u.map(T=>[T,n.getId(T)])),x={},m={};for(const T in f)x[T]=f[T].slice(),m[T]=f[T].slice();c.forEach(T=>{const k=T.filter(w=>d.has(w));if(k.length){const w=k[0],y=_.get(w);x[w]&&p&&(x[w]=x[w].map(C=>C<0?C:0)),m[w]&&g&&(m[w]=m[w].map(C=>C>0?C:0)),k.filter((C,A)=>A>0).forEach(C=>{if(x[C]){const A=_.get(C);x[C].forEach((S,L)=>{const P=+S;A===y&&!(p&&P>0)&&(x[w][L]+=P)})}if(m[C]){const A=_.get(C);m[C].forEach((S,L)=>{const P=+S;A===y&&!(g&&P<0)&&(m[w][L]+=P)})}})}});const v=[],b=[];for(const T in x)v.push(be("min",x[T])),b.push(be("max",m[T]));h=[be("min",v),be("max",b)]}else h=i_(t,e);return r&&a.add(r,{generation:s.dataGeneration,value:h}),h},isHiddenTargetWithYDomain(e){const t=this;for(const n of t.state.hiddenTargetIds)if(t.axis.getId(n)===e)return!0;return!1},getYDomain(e,t,n){const a=this,{axis:i,config:s,scale:o}=a,r=`axis_${t}`;if(a.isStackNormalized()&&e.filter(D=>i.getId(D.id)===t).map(D=>D.id).some(D=>a.isGrouped(D)))return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(L=>i.getId(L.id)===t),u=n?a.filterByXDomain(c,n):c;if(u.length===0)return a.isHiddenTargetWithYDomain(t)?o[t].domain():t==="y2"?o.y.domain():a.getYDomain(e,"y2",n);const d=s[`${r}_min`],h=s[`${r}_max`],f=s[`${r}_center`],p=s[`${r}_inverted`],g=a.hasDataLabel()&&s.axis_rotated,_=a.hasDataLabel()&&!s.axis_rotated,[x,m]=a.getYDomainMinMaxBoth(u);let v=x,b=m,T=[X.BAR,X.BUBBLE,X.SCATTER,...Te.Line].some(L=>{const P=L.indexOf("area")>-1?"area":L;return a.hasType(L,u,!0)&&s[`${P}_zerobased`]});v=nt(d)?d:nt(h)?v<=h?v:h-10:v,b=nt(h)?h:nt(d)?d<=b?b:d+10:b,isNaN(v)&&(v=0),isNaN(b)&&(b=v),v===b&&(v<0?b=0:v=0);const k=v>=0&&b>=0,w=v<=0&&b<=0;(nt(d)&&k||nt(h)&&w)&&(T=!1),T&&(k&&(v=0),w&&(b=0));const y=Math.abs(b-v);let C={top:y*.1,bottom:y*.1};if(ht(f)){const L=Math.max(Math.abs(v),Math.abs(b));b=f+L,v=f-L}if(g){const L=un(o.y.range()),P=a.getDataLabelLength(v,b,"width").map(D=>{const R=D/L;return isFinite(R)?R:0});["bottom","top"].forEach((D,R)=>{C[D]+=y*(P[R]/(1-P[0]-P[1]))})}else if(_){const L=a.getDataLabelLength(v,b,"height");["bottom","top"].forEach((P,D)=>{C[P]+=a.convertPixelToScale("y",L[D],y)})}C=a.getResettedPadding(C);const A=s[`${r}_padding`];St(A)&&["bottom","top"].forEach(L=>{C[L]=i.getPadding(A,L,C[L],y)}),T&&(k&&(C.bottom=v),w&&(C.top=-b));const S=l?[v,b].map(L=>L<0?0:L):[v-C.bottom,b+C.top];return p?S.reverse():S},getXDomainMinMax(e,t){var n;const a=this,{cache:i,state:s}=a,o=a.config[`axis_x_${t}`],l=fl(a,e)?`${Z.domainMinMax}_x_${t}_${hl(a,e)}`:null,c=l&&i.get(l);let u=(c==null?void 0:c.generation)===s.dataGeneration?c.value:void 0;u===void 0&&(u=s_(e,t),l&&i.add(l,{generation:s.dataGeneration,value:u}));let d=Q(o)?o.value:o;return d=ht(d)&&((n=a.axis)!=null&&n.isTimeSeries())?Zt.bind(this)(d):d,Q(o)&&o.fit&&(t==="min"&&d<u||t==="max"&&d>u)&&(d=void 0),ht(d)?d:u},getXDomainPadding(e,t){var n;const a=this,{axis:i,config:s}=a,o=s.axis_x_padding,r=i.isTimeSeries()&&t,l=un(e);let c;if(i.isCategorized()||r)c=0;else if(a.hasType("bar")||(n=a.hasAxisTypePadding)!=null&&n.call(a)){const h=a.getMaxDataCount();c=h>1?l/(h-1)/2:.5}else c=a.getResettedPadding(l*.01);let{left:u=c,right:d=c}=N(o)?{left:o,right:o}:o;if(o.unit==="px"){const h=Math.abs(l+l*.2);u=i.getPadding(o,"left",c,h),d=i.getPadding(o,"right",c,h)}else{const h=l+u+d;if(r&&h){const f=l/t/h;u=u/h/f,d=d/h/f}}return{left:u,right:d}},getXDomain(e){const t=this,{axis:n,config:a,scale:{x:i}}=t,s=a.axis_x_inverted,o=[t.getXDomainMinMax(e,"min"),t.getXDomainMinMax(e,"max")];let[r=0,l=0]=o;if(i.type!=="log"){const c=n.isCategorized(),u=n.isTimeSeries(),d=t.getXDomainPadding(o);let[h,f]=o;h-f===0&&!c&&(u?(h=new Date(h.getTime()*.5),f=new Date(f.getTime()*1.5)):(h=h===0?1:h*.5,f=f===0?-1:f*1.5)),(h||h===0)&&(r=u?new Date(h.getTime()-d.left):h-d.left),(f||f===0)&&(l=u?new Date(f.getTime()+d.right):f+d.right)}return s?[l,r]:[r,l]},updateXDomain(e,t,n,a,i){var s;const o=this,{config:r,org:l,scale:{x:c,subX:u}}=o,d=r.zoom_enabled;if(n&&(c.domain(i||An(o.getXDomain(e),!r.axis_x_inverted)),l.xDomain=c.domain(),u.domain(c.domain()),(s=o.brush)==null||s.scale(u)),t){const h=i||!o.brush||dl(o)?l.xDomain:ul(o).map(u.invert);c.domain(h)}return(n||t)&&d&&o.zoom.updateScaleExtent(),a&&c.domain(o.trimXDomain(c.orgDomain())),c.domain()},trimXDomain(e){const t=this,n=t.config.axis_x_inverted,a=t.getZoomDomain(),[i,s]=a;return(n?e[0]>=i:e[0]<=i)&&(e[1]=+e[1]+(i-e[0]),e[0]=i),(n?e[1]<=s:e[1]>=s)&&(e[0]=+e[0]-(e[1]-s),e[1]=s),e},getZoomDomain(e="zoom",t=!1){const n=this,{config:a,scale:i,org:s}=n;let[o,r]=t&&i[e]?i[e].domain():s.xDomain;return e==="zoom"&&(ht(a.zoom_x_min)&&(o=be("min",[o,a.zoom_x_min])),ht(a.zoom_x_max)&&(r=be("max",[r,a.zoom_x_max]))),[o,r]},getZoomDomainValue(e){const t=this,{config:n,axis:a}=t;if(a.isCategorized()&&Array.isArray(e)){const i=n.axis_x_inverted;return e.map((o,r)=>Number(o)+(r===0?+i:+!i))}return e},convertPixelToScale(e,t,n){const a=this,{config:i,state:s}=a,o=i.axis_rotated;let r;return e==="x"?r=o?"height":"width":r=o?"width":"height",n*(t/s[r])},withinRange(e,t=[0,0],n){const i=this.config.axis_x_inverted,[s,o]=n;if(Array.isArray(e)){const r=i?e[1]:e[0],l=i?e[0]:e[1];if(r<l)return e.every((c,u)=>(u===0?i?+c<=s:+c>=s:i?+c>=o:+c<=o)&&!e.every((d,h)=>d===t[h]))}return!1}};function pl(e,t,n){const{config:a}=e,i=`axis_${t}_tick_format`;return(a[i]?a[i]:e.defaultValueFormat).call(e.api,n)}var r_={yFormat(e){return pl(this,"y",e)},y2Format(e){return pl(this,"y2",e)},getDefaultValueFormat(){const e=this,{defaultArcValueFormat:t,yFormat:n,y2Format:a}=e,i=e.hasArcType(null,["gauge","polar","radar"]);return function(s,o,r){return(i?t:e.axis&&e.axis.getId(r)==="y2"?a:n).call(e,s,o)}},defaultValueFormat(e){return et(e)?e.join("~"):nt(e)?+e:""},defaultArcValueFormat(e,t){return`${(t*100).toFixed(1)}%`},defaultPolarValueFormat(e){return`${e}`},dataLabelFormat(e){var t,n;const a=this,i=a.config.data_labels,s=r=>{let c=r;return et(r)?c=r.join("~"):Q(r)&&(c=Object.values(r).join("~")),c};let o=s;return G(i.format)?o=i.format:ne(i.format)&&(i.format[e]?o=i.format[e]===!0?s:i.format[e]:o=()=>""),a.state.customType&&((n=(t=a.customTypeHooks)==null?void 0:t.labelFormat)==null?void 0:n.call(t,a,e))||o.bind(a.api)}};const _l=10,l_=750;function ja(e){var t,n,a;const i=this,s=i.getDataById(e),o=i.levelColor?i.levelColor(s.values[0].value):i.color(s);return(a=(n=(t=i.customTypeHooks)==null?void 0:t.legendColor)==null?void 0:n.call(t,i,s))!=null?a:o}function c_(e,t=!0){var n;const{config:a}=this;let i=(n=a.data_names[e])!=null?n:e;return t&&G(a.legend_format)&&(i=a.legend_format(i,e!==i?e:void 0)),i}function u_(e,t){var n;if(!t||t.empty())return;const a=(n=e.$el.legend)==null?void 0:n.selectAll(`.${J.legendItem}`);a&&!a.empty()&&(t=a);const i=[];t.each(function(o){i.push({id:o,node:this})});const s=go(i,o=>o.id,o=>o.node);e.cache.add(Z.legendItemMap,s)}function xl(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function d_(e,t,n){const a=xl(n);e.state.legendTouch=a?{id:t,x:a.clientX,y:a.clientY,moved:!1}:null}function ml(e,t){const n=e.state.legendTouch,a=n&&xl(t);a&&(n.moved=n.moved||Math.abs(a.clientX-n.x)>_l||Math.abs(a.clientY-n.y)>_l)}function h_(e,t,n){ml(e,n);const a=e.state.legendTouch;return e.state.legendTouch=null,!!a&&a.id===t&&!a.moved}function f_(e,t){e.state.legendLastTouchClickId=t,e.state.legendLastTouchClickTime=Date.now()}function g_(e,t){const{state:n}=e,a=n.legendLastTouchClickId===t&&Date.now()-(n.legendLastTouchClickTime||0)<l_;return a&&(n.legendLastTouchClickId=null,n.legendLastTouchClickTime=0),a}function p_(e){var t;const n=(t=e.config.interaction_inputType_touch)==null?void 0:t.preventDefault,a=cn(n)&&n||!1,i=!isNaN(n)&&n||null;return{passive:!a&&i===null}}var __={initLegend(){var e;const t=this,{config:n,$el:a}=t;if(t.legendItemTextBox={},t.state.legendHasRendered=!1,t.state.isCanvasMode){n.legend_show?(e=t.updateHtmlLegend)==null||e.call(t):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets));return}n.legend_show?(n.legend_contents_bindto||(a.legend=t.$el.svg.append("g").classed(J.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets))},updateLegend(e,t,n){var a;const i=this,{config:s,state:o,scale:r,$el:l}=i,c=t||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=je(c,"withTransition",!0),c.withTransitionForTransform=je(c,"withTransitionForTransform",!0),s.legend_contents_bindto&&s.legend_contents_template?i.updateLegendTemplate():o.hasTreemap||i.updateLegendElement(e||i.mapToIds(i.data.targets),c),(a=l.legend)==null||a.selectAll(`.${J.legendItem}`).classed(J.legendItemHidden,function(u){const d=!i.isTargetToShow(u);return d&&(this.style.opacity=null),d}),i.updateScales(!1,!r.zoom),i.updateSvgSize(),i.transformAll(c.withTransitionForTransform,n),o.legendHasRendered=!0},updateLegendTemplate(){const e=this,{config:t,$el:n}=e,a=(0,B.select)(t.legend_contents_bindto),i=t.legend_contents_template;if(!a.empty()){const s=e.mapToIds(e.data.targets),o=[];let r="";s.forEach(c=>{const u=G(i)?ve(i.call(e.api,c,e.color(c),e.api.data(c)[0].values)):hn(i,{COLOR:e.color(c),TITLE:c});u&&(o.push(c),r+=u)});const l=a.html(ve(r)).selectAll(function(){return this.children}).data(o);e.setLegendItem(l),n.legend=a}},updateSizeForLegend(e){const t=this,{config:n,state:{isLegendTop:a,isLegendLeft:i,isLegendRight:s,isLegendInset:o,current:r}}=t,{width:l,height:c}=e,u={top:a?t.getCurrentPaddingByDirection("top")+n.legend_inset_y+5.5:r.height-c-t.getCurrentPaddingByDirection("bottom")-n.legend_inset_y,left:i?t.getCurrentPaddingByDirection("left")+n.legend_inset_x+.5:r.width-l-t.getCurrentPaddingByDirection("right")-n.legend_inset_x+.5};t.state.margin3={top:s?0:o?u.top:r.height-c,right:NaN,bottom:0,left:s?r.width-l:o?u.left:0}},transformLegend(e){const t=this,{$el:{legend:n},$T:a}=t;a(n,e).attr("transform",t.getTranslate("legend"))},updateLegendItemColor(e,t){const n=this,{legend:a}=n.$el;if(a){const i=n.getLegendItemById(e);i&&(0,B.select)(i).select("line").style("stroke",t)}},getLegendWidth(){const e=this,{current:{width:t},isLegendRight:n,isLegendInset:a,legendItemWidth:i,legendStep:s}=e.state;return e.config.legend_show?n||a?i*(s+1):t:0},getLegendHeight(){var e;const t=this,{current:n,isLegendRight:a,legendItemHeight:i,legendStep:s}=t.state,r=((e=t.config.padding)==null?void 0:e.mode)==="fit"?10:20;return t.config.legend_show?a?n.height:Math.max(r,i)*(s+1):0},opacityForUnfocusedLegend(e){return e.classed(J.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const n=this,{$el:{legend:a},$T:i}=n,s=n.mapToTargetIds(e);a&&i(a.selectAll(`.${J.legendItem}`).filter(o=>s.indexOf(o)>=0).classed(ut.legendItemFocused,t)).style("opacity",function(){return t?null:n.opacityForUnfocusedLegend.call(n,(0,B.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:n}=e;t&&n(t.selectAll(`.${J.legendItem}`).classed(ut.legendItemFocused,!1)).style("opacity",null)},showLegend(e){const t=this,{config:n,$el:a,$T:i}=t;n.legend_show||(n.legend_show=!0,a.legend?a.legend.style("visibility",null):t.initLegend(),!t.state.legendHasRendered&&t.updateLegend()),t.removeHiddenLegendIds(e),i(a.legend.selectAll(t.selectorLegends(e)).style("visibility",null)).style("opacity",null)},hideLegend(e){const t=this,{config:n,$el:{legend:a}}=t;n.legend_show&&le(e)&&(n.legend_show=!1,a==null||a.style("visibility","hidden")),t.addHiddenLegendIds(e),a==null||a.selectAll(t.selectorLegends(e)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(e,t){const n=this,{cache:a,state:i}=n;let s;const o=Z.legendItemTextBox;return e&&(s=!i.redrawing&&a.get(o)||{},s[e]||(s[e]=n.getTextRect(t,J.legendItem),a.add(o,s)),s=s[e]),s},setLegendItem(e){const t=this,{$el:n,api:a,config:i,state:s}=t,o=s.inputType==="touch",r=t.hasType("gauge"),l=i.boost_useCssRule,c=i.legend_item_interaction,u=c.dblclick?"dblclick":"click",d=c||G(i.legend_item_onclick),h=o?p_(t):void 0,f=function(p,g){var _;if(!q(i.legend_item_onclick,a,g,!s.hiddenTargetIds.has(g))){const{altKey:x,type:m}=p,v=(0,B.select)(this);m==="dblclick"||x?s.hiddenTargetIds.size&&!v.classed(J.legendItemHidden)?a.show():(a.hide(),a.show(g)):(a.toggle(g),v.classed(ut.legendItemFocused,!1))}o&&(t.hideTooltip(),(_=t.hideGridFocus)==null||_.call(t,!0))};e.attr("class",function(p){const g=(0,B.select)(this);return(!g.empty()&&g.attr("class")||"")+t.generateClass(J.legendItem,p)}).style("visibility",p=>t.isLegendToShow(p)?null:"hidden"),i.interaction_enabled&&(l&&[[`.${J.legendItem}`,"cursor:pointer"],[`.${J.legendItem} text`,"pointer-events:none"],[`.${J.legendItemPoint} text`,"pointer-events:none"],[`.${J.legendItemTile}`,"pointer-events:none"],[`.${J.legendItemEvent}`,"fill-opacity:0"]].forEach(p=>{const[g,_]=p;t.setCssRule(!1,g,[_])(n.legend)}),e.on(u,d?function(p,g){o&&p.type==="click"&&g_(t,g)||f.call(this,p,g)}:null),o&&u==="click"&&d&&e.on("touchstart",function(p,g){d_(t,g,p)},h).on("touchmove",p=>{ml(t,p)},h).on("touchend",function(p,g){h_(t,g,p)&&(f_(t,g),f.call(this,p,g))},h),!o&&e.on("mouseout",c||G(i.legend_item_onout)?function(p,g){q(i.legend_item_onout,a,g,!s.hiddenTargetIds.has(g))||((0,B.select)(this).classed(ut.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${he.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||G(i.legend_item_onover)?function(p,g){q(i.legend_item_onover,a,g,!s.hiddenTargetIds.has(g))||((0,B.select)(this).classed(ut.legendItemFocused,!0),r&&t.markOverlapped(g,t,`.${he.gaugeValue}`),!s.transiting&&t.isTargetToShow(g)&&a.focus(g))}:null),!e.empty()&&e.on("click mouseout mouseover")&&e.style("cursor",t.getStylePropValue("pointer"))),u_(t,e)},getLegendItemById(e){var t;const n=this,a=n.cache.get(Z.legendItemMap);if(a&&a instanceof Map)return a.get(e)||null;const i=(t=n.$el.legend)==null?void 0:t.selectAll(`.${J.legendItem}`).filter(s=>s===e);return(i==null?void 0:i.node())||null},updateLegendElement(e,t){const n=this,{config:a,state:i,$el:{legend:s},$T:o}=n,l=a.legend_item_tile_type!=="circle",c=a.legend_item_tile_r,u={width:l?a.legend_item_tile_width:c*2,height:l?a.legend_item_tile_height:c*2},d={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:u.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let f,p,g;const _=e.filter(y=>!ht(a.data_names[y])||a.data_names[y]!==null),x=t.withTransition,m=i.isLegendRight||i.isLegendInset,v=c_.bind(n),b=n.getUpdateLegendPositions(_,d,h,m);i.isLegendInset&&(d.step=a.legend_inset_step?a.legend_inset_step:_.length,i.legendStep=d.step),i.isLegendRight?(f=y=>d.max.width*h.steps[y],p=y=>h.margins[h.steps[y]]+h.offsets[y]):i.isLegendInset?(f=y=>d.max.width*h.steps[y]+10,p=y=>h.margins[h.steps[y]]+h.offsets[y]):(f=y=>h.margins[h.steps[y]]+h.offsets[y],p=y=>d.max.height*h.steps[y]);const T={xText:(y,C)=>f(y,C)+4+u.width,xRect:(y,C)=>f(y,C),x1Tile:(y,C)=>f(y,C)-2,x2Tile:(y,C)=>f(y,C)-2+u.width,yText:(y,C)=>p(y,C)+9,yRect:(y,C)=>p(y,C)-5,yTile:(y,C)=>p(y,C)+4};n.generateLegendItem(_,u,b,T,m,v),g=s.select(`.${J.legendBackground} rect`),i.isLegendInset&&d.max.width>0&&g.size()===0&&(g=s.insert("g",`.${J.legendItem}`).attr("class",J.legendBackground).append("rect")),a.legend_tooltip&&s.selectAll("title").data(_).text(y=>v(y,!1));const k=s.selectAll("text").data(_).text(y=>v(y)).each(function(y,C){b(this,y,C)});o(k,x).attr("x",T.xText).attr("y",T.yText);const w=s.selectAll(`rect.${J.legendItemEvent}`).data(_);o(w,x).attr("width",y=>h.widths[y]).attr("height",y=>h.heights[y]).attr("x",T.xRect).attr("y",T.yRect),n.updateLegendItemPos(_,x,T),g&&o(g,x).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(e,t,n,a){const i=this,{config:s,state:o}=i;return function(r,l,c){const u=c===0,d=c===e.length-1,h=i.getLegendItemTextBox(l,r),f=h.width+t.tileWidth+(d&&!a?0:t.padding.right)+s.legend_padding,p=h.height+t.padding.top,g=a?p:f,_=a?i.getLegendHeight():i.getLegendWidth();let x;const m=function(b,T){T||(x=(_-t.totalLength-g)/2,x<t.posMin&&(x=(_-g)/2,t.totalLength=0,t.step++)),n.steps[b]=t.step,n.margins[t.step]=o.isLegendInset?10:x,n.offsets[b]=t.totalLength,t.totalLength+=g};if(u&&(t.totalLength=0,t.step=0,t.max.width=0,t.max.height=0),s.legend_show&&!i.isLegendToShow(l)){n.widths[l]=0,n.heights[l]=0,n.steps[l]=0,n.offsets[l]=0;return}n.widths[l]=f,n.heights[l]=p,(!t.max.width||f>=t.max.width)&&(t.max.width=f),(!t.max.height||p>=t.max.height)&&(t.max.height=p);const v=a?t.max.height:t.max.width;if(s.legend_equally){for(const b in n.widths)n.widths[b]=t.max.width;for(const b in n.heights)n.heights[b]=t.max.height;x=(_-v*e.length)/2,x<t.posMin?(t.totalLength=0,t.step=0,e.forEach(b=>m(b))):m(l,!0)}else m(l)}},generateLegendItem(e,t,n,a,i,s){const o=this,{config:r,state:l,$el:{legend:c}}=o,u=r.legend_usePoint,d=r.legend_item_tile_r,h=r.legend_item_tile_type,f=h!=="circle",p=-200,g=c.selectAll(`.${J.legendItem}`).data(e).enter().append("g");if(o.setLegendItem(g),r.legend_tooltip&&g.append("title").text(_=>_),g.append("text").text(_=>s(_)).each(function(_,x){n(this,_,x)}).style("pointer-events",o.getStylePropValue("none")).attr("x",i?a.xText:p).attr("y",i?p:a.yText),g.append("rect").attr("class",J.legendItemEvent).style("fill-opacity",o.getStylePropValue("0")).attr("x",i?a.xRect:p).attr("y",i?p:a.yRect),u){const _=[],x=o.getValidPointPattern();g.append(m=>{_.indexOf(m)===-1&&_.push(m);let v=x[_.indexOf(m)%x.length];return v==="rectangle"&&(v="rect"),rt.createElementNS(B.namespaces.svg,"hasValidPointType"in o&&o.hasValidPointType(v)?v:"use")}).attr("class",J.legendItemPoint).style("fill",ja.bind(o)).style("pointer-events",o.getStylePropValue("none")).attr("href",(m,v,b)=>{const k=b[v].nodeName.toLowerCase(),w=o.getTargetSelectorSuffix(m);return k==="use"?`#${l.datetimeId}-point${w}`:void 0})}else g.append(f?"line":h).attr("class",J.legendItemTile).style("stroke",ja.bind(o)).style("pointer-events",o.getStylePropValue("none")).call(_=>{h==="circle"?_.attr("r",d).style("fill",ja.bind(o)).attr("cx",i?a.x2Tile:p).attr("cy",i?p:a.yTile):f&&_.attr("stroke-width",t.height).attr("x1",i?a.x1Tile:p).attr("y1",i?p:a.yTile).attr("x2",i?a.x2Tile:p).attr("y2",i?p:a.yTile)})},updateLegendItemPos(e,t,n){const a=this,{config:i,$el:{legend:s},$T:o}=a,r=i.legend_usePoint,l=i.legend_item_tile_type,c=l!=="circle";if(r){const u=s.selectAll(`.${J.legendItemPoint}`).data(e),d=i.legend_item_tile_type!=="circle",h=d?i.legend_item_tile_width:i.legend_item_tile_r*2,f=d?i.legend_item_tile_height:i.legend_item_tile_r*2,p=h*.75,g=f*.75,_=h/8,x=f/8;o(u,t).each(function(){const m=this.nodeName.toLowerCase();let v="x",b="y",T=null,k=null,w=null;m==="circle"?(v="cx",b="cy",T=Math.min(p,g)/2):m==="rect"&&(k=p,w=g);const y=(0,B.select)(this).attr("transform",null).attr("x",null).attr("y",null).attr("cx",null).attr("cy",null).attr("r",T).attr("width",k).attr("height",w);m==="use"?y.attr("transform",C=>`translate(${n.x1Tile(C)} ${n.yTile(C)-f/2}) scale(${_} ${x})`):y.attr(v,C=>n.x1Tile(C)+(h-(k||0))/2).attr(b,C=>n.yTile(C)-(w||0)/2)})}else{const u=s.selectAll(`.${J.legendItemTile}`).data(e);o(u,t).style("stroke",ja.bind(a)).call(d=>{l==="circle"?d.attr("cx",h=>{const f=n.x2Tile(h);return f-(f-n.x1Tile(h))/2}).attr("cy",n.yTile):c&&d.attr("x1",n.x1Tile).attr("y1",n.yTile).attr("x2",n.x2Tile).attr("y2",n.yTile)})}}},x_=kt(8),m_={redraw(e={}){var t,n,a,i,s,o,r,l,c,u,d,h,f,p;const g=this,{config:_,state:x,$el:m}=g,{main:v,treemap:b}=m;x.redrawing=!0,x.redrawGeneration++,(x.dirty.data||x.dirty.visibility||e.initializing)&&x.dataGeneration++,(e.initializing||x.dirty.size||x.dirty.data||!x.rendered)&&g.cache.remove([Z.svgLeft]);const T=g.filterTargetsToShow(g.data.targets);x._targetsToShow=T;const k={data:x.dirty.data,visibility:x.dirty.visibility,size:x.dirty.size};x.dirty.data=!1,x.dirty.visibility=!1,x.dirty.size=!1;const{flow:w,initializing:y}=e,C=g.getWithOption(e),A=C.Transition?_.transition_duration:0,S=C.TransitionForExit?A:0,L=C.TransitionForAxis?A:0,P=(t=g.axis)==null?void 0:t.generateTransitions(L),D=k.data||k.visibility||y;if(x.isCanvasMode&&(g.setContainerSize(),(n=g.updateHtmlLegend)==null||n.call(g)),g.updateSizes(y),x.isCanvasMode){const R=g.scale.zoom,E=(i=(a=R==null?void 0:R.orgDomain)==null?void 0:a.call(R))!=null?i:R==null?void 0:R.domain();R&&(g.scale.zoom=null),g.updateScales(y,C.UpdateXDomain),R&&(R.range(g.scale.x.range()),E&&R.domain(E),g.scale.zoom=g.getCustomizedXScale((o=(s=R.orgScale)==null?void 0:s.call(R))!=null?o:R),g.axis.x.scale(g.scale.zoom),g.scale.x.domain(_.zoom_rescale?E:g.org.xDomain),g.scale.subX.domain(g.org.xDomain)),x.hasAxis&&g.axis.syncAxisDomains(T,C,w),x.hasAxis&&((r=g.applyCanvasSubchartDomain)==null||r.call(g));const M=D?g.getDrawShape():x._cachedDrawShape||g.getDrawShape();D&&(x._cachedDrawShape=M),_.legend_show&&m.legend&&!(_.legend_contents_bindto&&_.legend_contents_template)&&((l=g.positionHtmlLegend)==null||l.call(g)),(c=g.resizeCanvas)==null||c.call(g),x.canvasFocusKey=null,g.renderCanvasFrame(M,null,!0),y&&g.updateTypesElements(),g.callPluginHook("$redraw",e,0),x.redrawing=!1,x._targetsToShow=null,x._cachedDrawShape=null,g.mapToIds(g.data.targets).forEach(O=>{x.withoutFadeIn[O]=!0}),q(_.onrendered,g.api);return}C.Legend&&_.legend_show?(e.withTransition=!!A,!b&&g.updateLegend(g.mapToIds(g.data.targets),e,P)):C.Dimension&&g.updateDimension(!0),_.data_empty_label_text&&v.select(`text.${Ot.text}.${U.empty}`).attr("x",x.width/2).attr("y",x.height/2).text(_.data_empty_label_text).style("display",T.length?"none":null),(u=g.redrawTitle)==null||u.call(g),x.hasAxis?(g.axis.redrawAxis(T,C,P,w,y),(d=g.hasGrid)!=null&&d.call(g)&&g.updateGrid(),_.regions.length&&((h=g.updateRegion)==null||h.call(g)),["bar","candlestick","line","area",...g.getAxisTypes()].forEach(R=>{const E=Mt(R);(/^(line|area)$/.test(R)&&g.hasTypeOf(E)||g.hasType(R))&&D&&g[`update${E}`](C.TransitionForExit)}),m.text&&v.selectAll(`.${gt.selectedCircles}`).filter(g.isBarType.bind(g)).selectAll("circle").remove(),_.interaction_enabled&&!w&&C.EventRect&&(g.redrawEventRect(),(f=g.bindZoomEvent)==null||f.call(g))):(m.arcs&&g.redrawArc(A,S,C.Transform),m.radar&&g.redrawRadar(),m.polar&&g.redrawPolar(),x.customType&&g[`redraw${Mt(x.customType)}`](C.Transition),b&&g.updateTreemap(S)),!x.resizing&&!b&&(g.hasPointType()||x.hasRadar)?D&&g.updateCircle(!1,!!w):(p=g.hasLegendDefsPoint)!=null&&p.call(g)&&g.data.targets.forEach(g.point("create",this)),g.hasDataLabel()&&!g.hasArcType(null,["radar"])&&D&&g.updateText(),y&&g.updateTypesElements(),g.generateRedrawList(T,w,A,C.Subchart,D),g.updateTooltipOnRedraw(),g.callPluginHook("$redraw",e,A)},generateRedrawList(e,t,n,a,i=!0){const s=this,{config:o,state:r}=s;r.hasAxis&&o.subchart_show&&s.redrawSubchart(a,n);const l=i?s.getDrawShape():r._cachedDrawShape||s.getDrawShape();i&&(r._cachedDrawShape=l);const c=t&&s.generateFlow({targets:e,flow:t,duration:t.duration,shape:l,xv:s.xv.bind(s)}),u=!c&&n&&ha(),d=s.getRedrawList(l,t,c,u),h=()=>{c&&c(),r.redrawing=!1,r._targetsToShow=null,r._cachedDrawShape=null,q(o.onrendered,s.api)};if(u&&d.length){const f=Kr();(0,x_.transition)().duration(n).each(()=>{d.flatMap(p=>p).forEach(p=>f.add(p))}).call(f,h)}else r.transiting||h();s.mapToIds(s.data.targets).forEach(f=>{r.withoutFadeIn[f]=!0})},getRedrawList(e,t,n,a){const i=this,{config:s,state:{hasAxis:o,hasRadar:r,hasTreemap:l},$el:{grid:c}}=i,{cx:u,cy:d,xForText:h,yForText:f}=e.pos,p=[];if(o){i.redrawGrid&&(s.grid_x_lines.length||s.grid_y_lines.length)&&p.push(i.redrawGrid(a)),i.redrawRegion&&s.regions.length&&p.push(i.redrawRegion(a));for(const g in e.type){const _=Mt(g),x=e.type[g];(/^(area|line)$/.test(g)&&i.hasTypeOf(_)||i.hasType(g))&&p.push(i[`redraw${_}`](x,a))}!t&&c.main&&i.updateGridFocus&&p.push(i.updateGridFocus())}return(!i.hasArcType()||r)&&St(s.data_labels)&&s.data_labels!==!1&&p.push(i.redrawText(h,f,t,a)),(i.hasPointType()||r)&&!i.isPointFocusOnly()&&i.redrawCircle&&p.push(i.redrawCircle(u,d,a,n)),l&&p.push(i.redrawTreemap(a)),p},updateAndRedraw(e={}){const t=this,{config:n,state:a}=t;let i;e.withTransition=je(e,"withTransition",!0),e.withTransform=je(e,"withTransform",!1),e.withLegend=je(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=je(e,"withTransitionForTransform",e.withTransition),e.withLegend&&n.legend_show||(a.hasAxis&&(i=t.axis.generateTransitions(e.withTransitionForAxis?n.transition_duration:0)),t.updateScales(),t.updateSvgSize(),t.transformAll(e.withTransitionForTransform,i)),t.redraw(e)}},v_={setContainerSize(){const e=this,{state:t}=e;t.current.width=e.getCurrentWidth(),t.current.height=e.getCurrentHeight()},getCurrentWidth(){const e=this;return e.config.size_width||e.getParentRectValue("width")},getCurrentHeight(){var e,t,n,a;const i=this,{config:s,state:o,$el:r}=i;let l=s.size_height||((t=(e=i.customTypeHooks)==null?void 0:e.currentHeight)==null?void 0:t.call(e,i));if(!l){const c=o.isCanvasMode?(n=r.chart)==null?void 0:n.node():null,u=c==null?void 0:c.style.minHeight;u&&(c.style.minHeight=""),l=i.getParentHeight(),u&&(c.style.minHeight=u);const d=c&&parseFloat((a=i.canvasEngine)==null?void 0:a.canvas.style.height)||0,h=o.current.height-d;h>0&&Math.round(l)===Math.round(d)&&(l+=h)}return l>0?l:320/(i.hasType("gauge")&&!s.gauge_fullCircle?2:1)},getParentRectValue(e){const t=`offset${Mt(e)}`;let n=this.$el.chart.node(),a=0;for(;a<30&&n&&n.tagName!=="BODY";){try{a=mt(n,!0)[e]}catch(s){t in n&&(a=n[t])}n=n.parentNode}const i=rt.body[t];return a>i&&(a=i),a},getParentHeight(){const e=this.$el.chart.style("height");let t=0;return e&&(t=/px$/.test(e)?parseInt(e,10):this.getParentRectValue("height")),t},getSvgLeft(e){var t,n,a;const i=this,{cache:s,config:o,state:{hasAxis:r},$el:l}=i;if(e){const C=s.get(Z.svgLeft);if(C!==null)return C}const c=o.axis_rotated,u=c||!c&&!o.axis_y_inner,d=c?Ft.axisX:Ft.axisY,h=l.main.select(`.${d}`).node(),f=r&&o[`axis_${c?"x":"y"}_label`],g=r&&(st(f)||st(f.text)||/^inner-/.test(f==null?void 0:f.position))?l.main.select(`.${d}-label`):null,_=g&&!g.empty()?g.node():null,x=!e,m={label:_?mt(_,x):null,leftAxis:h&&u?mt(h,x):null,chart:mt(l.chart.node(),x)},v=(n=(t=m.label)==null?void 0:t.left)!=null?n:0,b=(a=m.leftAxis)!=null?a:{right:0},T=m.chart.left+v,k=i.hasArcType(),w=b.right-T-(k?0:i.getCurrentPaddingByDirection("left",e)),y=w>0?w:0;return s.add(Z.svgLeft,y),y},previewResize(){var e,t,n;const a=this,{state:i,$el:s}=a,{current:o}=i,r=a.getCurrentWidth(),l=a.getCurrentHeight();if(!(!r||!l||!o.width||!o.height||r===o.width&&l===o.height)){if(i.isCanvasMode){const c=(e=a.canvasEngine)==null?void 0:e.canvas;if(!c)return;s.chart.style("min-height",`${l}px`),c.style.width=`${r}px`,c.style.height=`${Math.max(0,l-((n=(t=a.getCanvasBottomLegendHeight)==null?void 0:t.call(a))!=null?n:0))}px`}else if(s.svg)s.svg.attr("viewBox",`0 0 ${o.width} ${o.height}`).attr("preserveAspectRatio","none").attr("width",r).attr("height",l);else return;i.resizePreview=!0}},clearResizePreview(){const e=this,{config:t,state:n,$el:a}=e;n.resizePreview&&(n.resizePreview=!1,!n.isCanvasMode&&a.svg&&t.resize_auto!=="viewBox"&&a.svg.attr("viewBox",null).attr("preserveAspectRatio",null))},updateDimension(e){var t,n;const a=this,{config:i,state:{hasAxis:s,isCanvasMode:o},$el:r}=a;if(s&&!e&&a.axis.x&&i.axis_rotated&&((t=a.axis.subX)==null||t.create(r.axis.subX)),a.updateScales(e),o){(n=a.resizeCanvas)==null||n.call(a);return}a.updateSvgSize(),a.transformAll(!1)},updateSvgSize(){var e;const t=this,{config:n,state:{clip:a,current:i,hasAxis:s,width:o,height:r},$el:{svg:l}}=t;if(!l){(e=t.resizeCanvas)==null||e.call(t);return}if(t.clearResizePreview(),n.resize_auto==="viewBox"?l.attr("viewBox",`0 0 ${i.width} ${i.height}`):l.attr("width",i.width).attr("height",i.height),s){const c=l.select(`.${Nr.brush} .overlay`),u={width:0,height:0};c.size()&&(u.width=+c.attr("width"),u.height=+c.attr("height")),l.selectAll([`#${a.id}`,`#${a.idGrid}`]).select("rect").attr("width",o).attr("height",r),l.select(`#${a.idXAxis}`).select("rect").call(t.setXAxisClipPath.bind(t)),l.select(`#${a.idYAxis}`).select("rect").call(t.setYAxisClipPath.bind(t)),a.idSubchart&&l.select(`#${a.idSubchart}`).select("rect").attr("width",o).attr("height",u.height)}},getCurrentPaddingByDirection(e,t=!1,n=!1){var a;const i=this,{config:s,$el:o,state:{hasAxis:r,isCanvasMode:l}}=i,c=s.axis_rotated,u=((a=s.padding)==null?void 0:a.mode)==="fit",d=N(s[`padding_${e}`])?s[`padding_${e}`]:void 0,h=r?{top:c?"y2":null,bottom:c?"y":"x",left:c?"x":"y",right:c?null:"y2"}[e]:null,f=/^(left|right)$/.test(e),p=h&&s[`axis_${h}_inner`],g=h&&s[`axis_${h}_show`],_=h?s[`axis_${h}_axes`].length:0;let x=h?f?i.getAxisWidthByAxisId(h,t):i.getHorizontalAxisHeight(h):0;const m=20;let v=0;!u&&f&&(x=Ad(x));let b=r&&f&&(p||Ct(d)&&!g)?0:u?(g?x:0)+(d!=null?d:0):Ct(d)?x:d;return f&&r?(h&&(u||p)&&s[`axis_${h}_label`].text&&(b+=i.axis.getAxisLabelPosition(h).isOuter?m:0),e==="right"?(b+=c?!u&&Ct(d)?10:2:!g||p?u?2:1:0,b+=n?i.axis.getXAxisTickTextY2Overflow(m):0):e==="left"&&c&&Ct(d)&&(b=s.axis_x_show?u?x:Math.max(x,40):1)):e==="top"?((o.title&&o.title.node()||l&&s.title_text)&&(b+=i.getTitlePadding()),v=c&&!p?_:0):e==="bottom"&&r&&c&&!g&&(b+=1),b+x*_-v},getCurrentPadding(e=!1){const t=this,[n,a,i,s]=["top","bottom","left","right"].map(o=>t.getCurrentPaddingByDirection(o,null,e));return{top:n,bottom:a,left:i,right:s}},getResettedPadding(e){const t=this,{config:n}=t,a=N(e);let i=a?0:{};return n.padding===!1?!a&&Object.keys(e).forEach(s=>{i[s]=!le(n.data_labels)&&n.data_labels!==!1&&s==="top"?e[s]:0}):i=e,i},updateSizes(e){var t,n,a,i,s,o;const r=this,{config:l,state:c,$el:{legend:u}}=r,d=l.axis_rotated,h=r.hasArcType()||c.customType||c.hasTreemap,f=((t=l.padding)==null?void 0:t.mode)==="fit";!e&&r.setContainerSize();const p=u?r.getLegendWidth():0,g=u?r.getLegendHeight():0,_={width:p,height:g};!h&&l.axis_x_show&&l.axis_x_tick_autorotate&&r.updateXAxisTickClip();const x={right:l.legend_show&&c.isLegendRight?p+(f?0:20):0,bottom:!l.legend_show||c.isLegendRight||c.isLegendInset?0:g},m=d||h?0:r.getHorizontalAxisHeight("x"),v=l.subchart_axis_x_show&&l.subchart_axis_x_tick_text_show?m:30,b=l.subchart_show&&!h?l.subchart_size_height+v:0,T=r.hasType("gauge")&&l.arc_needle_show&&!l.gauge_fullCircle&&!l.gauge_label_show?10:0,k=r.getCurrentPadding(!0);if(c.margin=!h&&d?{top:k.top,right:h?0:k.right+x.right,bottom:x.bottom+k.bottom,left:b+(h?0:k.left)}:{top:(f?0:4)+k.top,right:h?0:k.right+x.right,bottom:T+b+x.bottom+k.bottom,left:h?0:k.left},c.margin=r.getResettedPadding(c.margin),c.margin2=d?{top:c.margin.top,right:NaN,bottom:20+x.bottom,left:r.state.rotatedPadding.left}:{top:c.current.height-b-x.bottom,right:NaN,bottom:v+x.bottom,left:c.margin.left},c.margin3={top:0,right:NaN,bottom:0,left:0},(n=r.updateSizeForLegend)==null||n.call(r,_),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=d?c.margin.left-c.rotatedPadding.left-c.rotatedPadding.right:c.width,c.height2=d?c.height:c.current.height-c.margin2.top-c.margin2.bottom,c.width2<0&&(c.width2=0),c.height2<0&&(c.height2=0),r.hasArcType()){const w=r.hasType("gauge"),y=l.legend_show&&c.isLegendRight,C=(a=c.hasRadar&&r.cache.get(Z.radarTextWidth))!=null?a:0;c.arcWidth=c.width-(y?_.width+10:0)-C,c.arcHeight=c.height-(y&&!w?0:10),(i=l.arc_rangeText_values)!=null&&i.length&&(w?(c.arcWidth-=25,c.arcHeight-=10,c.margin.left+=10):(c.arcHeight-=20,c.margin.top+=10)),w&&!l.gauge_fullCircle&&(c.arcHeight+=c.height-r.getPaddingBottomForGauge()),(s=r.updateRadius)==null||s.call(r)}c.isLegendRight&&h&&!((o=r.customTypeHooks)!=null&&o.ownLegendLayout)&&(c.margin3.left=c.arcWidth/2+c.radiusExpanded*1.1)}},b_={setCssRule(e,t,n,a){const i=this,{config:s,state:{cssRule:o,style:r}}=i;return s.boost_useCssRule?l=>{l.each(c=>{const u=a&&(a==null?void 0:a.call(i,c)),d=`${e?`.${vt.shapes+i.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[d]),i.state.cssRule[d]=vp(r,d,n.filter(Boolean).map(h=>st(u)&&h.indexOf(":")===-1?`${h}: ${u}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:G(e)?e.bind(this):e}};function y_(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function T_(e,t,n,a,i){var s;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=N(r)&&r<0||l&&!((s=o.getCandlestickData(e))!=null&&s._isUp);let{x:u,y:d}=t;const h=4,f=h*2;return a?n==="start"?(u+=c?0:f,d+=h):n==="middle"?(u+=f,d-=f):n==="end"&&(c&&(u-=f),d+=h):(n==="start"?(u+=h,c&&(d+=f*2)):n==="middle"?d-=f:n==="end"&&(u-=h,c&&(d+=f*2)),i&&(d+=c?-17:l?13:7)),{x:u,y:d}}function Bn(e,t){var n;const a=this.config.data_labels_position,{id:i,index:s,value:o}=e;return(n=G(a)?a.bind(this.api)(t,o,i,s,this.$el.text):(i in a?a[i]:a)[t])!=null?n:0}function w_(e,t,n){var a,i;const s=this,{config:o,$T:r}=s,l=o.axis_rotated,{border:{padding:c="3 5",radius:u=10,stroke:d="#000",strokeWidth:h=1,fill:f="none"}}=o.data_labels,p=uo(c),g=o.data_labels.border!==!0,_=en(e);let x=(0,B.select)(e.previousElementSibling);(x.empty()||((a=x.node())==null?void 0:a.tagName)!=="rect"||!((i=x.attr("class"))!=null&&i.includes(n)))&&(x=(0,B.select)(e.parentNode).insert("rect",()=>e).attr("class",`${Ot.textBorderRect} ${n}`).attr("width",_.width+(g?p.left+p.right:0)).attr("height",_.height+(g?p.top+p.bottom:0)),g&&x.style("fill",f).style("stroke",d).style("stroke-width",`${h}px`).attr("rx",u).attr("ry",u)),r(x).attr("x",t.x-(g?p.left:0)-(l?0:_.width/2)).attr("y",t.y-(g?p.top:0)-_.height/4*3.2)}function cs(e=0,t){const n=this,{config:a}=n,i=a[`${t}_label_threshold`]||0;return e>=i}function vl(){const e=this,{$el:{text:t},config:n}=e;(e.state.arcWidth?e.getArcLabelConfig("image"):n.data_labels.image)&&t.filter(function(){const i=this.previousElementSibling;return i?i.tagName!=="image"||!i.classList.contains(Ot.textLabelImage):!0}).each(function(i){var s,o,r,l;const c=k_.call(e,i);if(!c)return;const{url:u,width:d,height:h,pos:f}=c;if(u){const p=(0,B.select)(this.parentNode);p==null||p.insert("image",`${(o=(s=this.getAttribute("class"))==null?void 0:s.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",g=>hn(u,{ID:"id"in g?g.id:g.data.id})).attr("class",Ot.textLabelImage).style("pointer-events","none").attr("width",d).attr("height",h).attr("transform",f?`translate(${(r=f.x)!=null?r:0} ${(l=f.y)!=null?l:0})`:null)}})}function k_(e){var t;const n=this,{config:a,state:i}=n,s=i.arcWidth?n.getArcLabelConfig("image"):a.data_labels.image;if(G(s))return(t=s.call(n.api,e.value,e.id,e.index))!=null?t:{url:"",width:0,height:0,pos:{x:0,y:0}};if(s){const{url:o="",width:r=0,height:l=0,pos:c}=s;return{url:o,width:r,height:l,pos:c}}return null}function bl(e,t,n){var a;const i=this,{config:s,state:{arcWidth:o,hasTreemap:r}}=i,l=s.axis_rotated,c=(0,B.select)(e.previousElementSibling),u=d=>{var h;const f=d.style.opacity!=="0"&&d.style.fillOpacity!=="0";return(o?d.textContent:f)&&((h=this.previousElementSibling)==null?void 0:h.tagName)!=="image"};if(!c.empty()&&((a=c.node())==null?void 0:a.tagName)==="image"){const d=n||mt(e),h=+c.attr("width")/2,f=+c.attr("height")/2;let p=t.x-h,g=t.y-f-d.height/2;l?t.x+=h:(r&&(p=-h,g=-(f*2+d.height)),i.hasType("pie")||i.hasType("polar")||(t.y+=f)),i.$T(c).style("opacity",u(e)?null:"0").attr("x",p).attr("y",g)}}function C_(e){return go(e,t=>t,t=>en(t,!0))}var S_={opacityForText(e){const t=this;return t.isBarType(e)&&!cs.call(t,Math.abs(t.getRatio("bar",e)),"bar")?"0":t.hasDataLabel()?null:"0"},initText(){const{$el:e,state:t}=this;e.main.select(`.${U.chart}`).append("g").attr("class",Ot.chartTexts).style("pointer-events",t.customType||e.treemap?"none":null)},updateTargetsForText(e){const t=this,n=t.getChartClass("Text"),a=t.getClass("texts","id"),i=t.classFocus.bind(t);t.$el.main.select(`.${Ot.chartTexts}`).selectAll(`.${Ot.chartText}`).data(t.filterNullish(e)).attr("class",r=>`${n(r)}${i(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",n).call(t.setCssRule(!0,` .${Ot.text}`,["fill","pointer-events:none"],t.updateTextColor)).append("g").attr("class",a)},updateText(){const e=this,{$el:t,$T:n,config:a,axis:i}=e,s=e.getClass("text","index"),o=a.data_labels.centered,r=t.main.selectAll(`.${Ot.texts}`).selectAll(`.${Ot.text}`).data(e.labelishData.bind(e));n(r.exit()).style("fill-opacity","0").remove(),t.text=r.enter().append("text").merge(r).attr("class",s).attr("text-anchor",l=>{var c,u;let h=a[`axis_${i==null?void 0:i.getId(l.id)}_inverted`]?l.value>0:l.value<0;if(e.isCandlestickType(l)){const f=e.getCandlestickData(l);h=!(f!=null&&f._isUp)}else{if(e.isTreemapType(l))return o?"middle":"start";if(e.state.customType){const f=(u=(c=e.getCustomTypeHooks(l))==null?void 0:c.textAnchor)==null?void 0:u.call(c,e,l);if(f)return f}}return a.axis_rotated?h?"end":"start":"middle"}).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each(function(l,c,u){const d=(0,B.select)(this);let{value:h}=l;if(e.isBubbleZType(l))h=e.getBubbleZData(h,"z");else if(e.isCandlestickType(l)){const f=e.getCandlestickData(l);f&&(h=f.close)}h=e.isTreemapType(l)?e.treemapDataLabelFormat(l)(d):e.dataLabelFormat(l.id)(h,l.id,l.index,u),N(h)?this.textContent=h:In(d,h,void 0,!0)}),vl.call(e)},updateTextColor(e){var t;const n=this,{config:a}=n,i=a.data_labels_colors,s=n.isArcType(e)&&!n.isRadarType(e)||(t=n.getCustomTypeHooks(e))!=null&&t.themeTextColor||n.isTreemapType(e)?null:n.color(e);let o;if(st(i))o=i;else if(Q(i)){const{id:r}=e.data||e;o=i[r]}else G(i)&&(o=i.bind(n.api)(s,e));if(n.isCandlestickType(e)&&!G(i)){const r=n.getCandlestickData(e);if(!(r!=null&&r._isUp)){const l=a.candlestick_color_down;o=Q(l)?l[e.id]:l}}return o||s},updateTextBGColor(e,t){const n=this,{$el:{defs:a}}=n;let i="";if(t){const s=st(t)?"":n.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=a.select(["filter[id*='labels-bg","']"].join(s));if(o.size()&&(i=`url(#${o.attr("id")})`),G(t)){n.generateTextBGColorFilter(t);const r=n.color(e),l=t.bind(n.api)(r,e);l?o.select("feFlood").attr("flood-color",l):i=""}}return i||null},redrawText(e,t,n,a){const i=this,{$T:s,axis:o,config:r,state:{hasTreemap:l}}=i,c=ye(!0),u=r.axis_rotated,d=r.data_labels.rotate,h=y_(d),f=d?`rotate(${d})`:"",p=i.$el.text.style("fill",i.getStylePropValue(i.updateTextColor)).attr("filter",x=>i.updateTextBGColor.bind(i)(x,r.data_labels_backgroundColors)).style("fill-opacity",n?0:i.opacityForText.bind(i)),g=new Map,_=[];return p.each(function(x){const m=this;g.set(m,{rect:mt(m)}),r.data_labels.centered&&(i.isBarType(x)||i.isTreemapType(x))&&_.push(m)}),_.length>0&&C_(_).forEach((x,m)=>{const v=g.get(m);v&&(v.bbox=x)}),p.each(function(x,m){var v;const b=g.get(this),T=s(l&&this.childElementCount?this.parentNode:this,!!(a&&(this.getAttribute("x")||this.getAttribute("transform"))),c),k=r[`axis_${o==null?void 0:o.getId(x.id)}_inverted`];let w={x:e.call(this,x,m,b),y:t.call(this,x,m,b)};d&&(w=T_.bind(i)(x,w,h,u,k),T.attr("text-anchor",h)),bl.call(i,this,w,b==null?void 0:b.rect),this.childElementCount||d?T.attr("transform",`translate(${w.x} ${w.y}) ${f}`):(T.attr("x",w.x).attr("y",w.y),l&&((v=this.parentNode)==null||v.removeAttribute("transform"))),r.data_labels.border&&w_.call(i,T.node(),w,`${Ot.textBorderRect}-${m}`)}),!0},getTextRect(e,t){var n,a;const i=this;let s,o,r;Array.isArray(e)?s=`${Z.textRect}-${e.join("_")}`:(o=(a=(n=e.node)==null?void 0:n.call(e))!=null?a:e,/text/i.test(o.tagName)||(o=o.querySelector("text")),r=o.textContent,s=`${Z.textRect}-${r.replace(/\W/g,"_")}`);const l=i.cache.get(s)||[];return l.length===0&&((i.$el.svg||i.$el.chart.select("svg")).selectAll(`.${U.dummy}`).data(r?[r]:e).enter().append("text").style("visibility","hidden").style("font",o?(0,B.select)(o).style("font"):null).classed(t||U.dummy,!0).text(c=>c).each(function(c,u){l[u]=mt(this)}).remove(),i.cache.add(s,l)),l.length>1?l:l[0]},generateXYForText(e,t){const n=this,{state:{customType:a,hasRadar:i,hasTreemap:s}}=n,o=Object.keys(e),r={},l=t?n.getXForText:n.getYForText;return a&&o.push(a),i&&o.push("radar"),s&&o.push("treemap"),o.forEach(c=>{r[c]=n[`generateGet${Mt(c)}Points`](e[c],!1)}),function(c,u,d){const h=n.isAreaType(c)&&"area"||n.isBarType(c)&&"bar"||a&&n.isTypeOf(c,a)&&a||n.isCandlestickType(c)&&"candlestick"||n.isRadarType(c)&&"radar"||n.isTreemapType(c)&&"treemap"||"line";return l.call(n,r[h](c,u),c,this,d)}},getCenteredTextPos(e,t,n,a,i){const s=this,{config:o}=s,r=o.axis_rotated,l=s.isBarType(e),c=s.isTreemapType(e);if(o.data_labels.centered&&(l||c)){const u=(i==null?void 0:i.bbox)||en(n);if(l){const d=s.getRangedData(e,null,"bar")>=0;if(r){const h=(d?t[1][1]-t[0][1]:t[0][1]-t[1][1])/2+u.width/2;return d?-h-3:h+2}else{const h=(d?t[0][1]-t[1][1]:t[1][1]-t[0][1])/2+u.height/2;return d?h:-h-2}}else if(c){const d=u.y-(n.childElementCount?0:+(n.getAttribute("y")||0));return a==="x"?(t[1][0]-t[0][0])/2:(t[1][1]-t[0][1])/2-d-u.height/2}}return 0},getXForText(e,t,n,a){var i;const s=this,{config:o}=s,r=o.axis_rotated,l=s.isTreemapType(t);let c=e?e[0][0]:0;const u=s.getCustomTypeHooks(t);if(u)return u.textX(s,e,t,n,a);if(s.isCandlestickType(t))r?c=(i=s.getCandlestickData(t))!=null&&i._isUp?e[2][2]+4:e[2][1]-4:c+=(e[1][0]-c)/2;else if(l)c+=o.data_labels.centered?0:5;else if(r){const d=o[`axis_${s.axis.getId(t.id)}_inverted`],h=s.isBarType(t)?4:6,f=t.value;c=e[2][1],c+=h*((d?f>0:f<0)?-1:1)}else c=s.hasType("bar")?(e[2][0]+e[0][0])/2:c;return(r||l)&&(c+=s.getCenteredTextPos(t,e,n,"x",a)),c+Bn.call(this,t,"x")},getYForText(e,t,n,a){const i=this,{axis:s,config:o,state:r}=i,l=o.axis_rotated,c=o[`axis_${s==null?void 0:s.getId(t.id)}_inverted`],u=i.isBarType(t),d=i.isTreemapType(t),h=o.point_r,f=(a==null?void 0:a.rect)||mt(n);let{value:p}=t,g=3,_;const x=i.getCustomTypeHooks(t);if(x)return x.textY(i,e,t,n,f,a);if(i.isCandlestickType(t))p=i.getCandlestickData(t),l?(_=e[0][0],_+=(e[1][0]-_)/2+g):(_=p&&p._isUp?e[2][2]-g:e[2][1]+g*4,c&&(_+=15*(p._isUp?1:-1)));else if(d)_=e[0][1]+(o.data_labels.centered?0:f.height+5);else if(l)_=(e[0][0]+e[2][0]+f.height*.6)/2;else if(_=e[2][1],N(h)&&h>5&&(i.isLineType(t)||i.isScatterType(t))&&(g+=o.point_r/2.3),p<0||p===0&&!r.hasPositiveValue&&r.hasNegativeValue)_+=c?u?-3:-5:f.height+(u?-g:g);else{let m=-g*2;u?m=-g:i.isBubbleType(t)&&(m=g),c&&(m=u?10:15),_+=m}return(!l||d)&&(_+=i.getCenteredTextPos(t,e,n,"y",a)),_+Bn.call(this,t,"y")},markOverlapped(e,t,n){const a=t.$el.arcs.selectAll(n),i=a.filter(u=>u.data.id!==e),s=a.filter(u=>u.data.id===e),o=es(s.node()),r=(u,d)=>Math.sqrt(u*u+d*d);if(!s.node())return;const l=parseInt(s.style("font-size"),10),c=[];i.each(function(){const u=es(this),d=r(o.e,o.f)>r(u.e,u.f)?s:(0,B.select)(this),h=Math.ceil(Math.abs(o.e-u.e))<Math.ceil(d.node().getComputedTextLength()),f=Math.ceil(Math.abs(o.f-u.f))<l;c.push({node:this,overlaps:h&&f})}),c.forEach(({node:u,overlaps:d})=>{(0,B.select)(u).classed(Ot.TextOverlapping,d)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,B.selectAll)([this,this.previousSibling]).classed(Ot.TextOverlapping,!1)})}};function yl(e="left",t){const n=N(t);return e.includes("center")?n?t/2:"middle":e.includes("right")?n?t:"end":n?0:"start"}function A_(e){var t,n,a,i,s,o,r,l;const{config:c,$el:u}=e,d=((a=(n=(t=e.canvasTheme)==null?void 0:t.style)==null?void 0:n.title)==null?void 0:a.font)||((o=(s=(i=e.canvasTheme)==null?void 0:i.style)==null?void 0:s.label)==null?void 0:o.font)||"14px sans-serif",h=(l=(r=u.chart)==null?void 0:r.node)==null?void 0:l.call(r),f=h==null?void 0:h.ownerDocument;if(h&&f&&c.title_text){const p=f.createElementNS("http://www.w3.org/2000/svg","svg"),g=f.createElementNS("http://www.w3.org/2000/svg","text");p.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",g.setAttribute("class",Ot.title),g.style.font=d,g.textContent=String(c.title_text),p.appendChild(g),h.appendChild(p);const _=mt(g).height;if(p.remove(),_)return _}return c.title_text?parseFloat(d)||14:0}var L_={initTitle(){const e=this,{config:t,$el:n}=e;if(t.title_text){n.title=n.svg.append("g");const a=n.title.append("text").style("text-anchor",yl(t.title_position)).attr("class",Ot.title);In(a,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:n},$el:{title:a}}=e;if(a){const i=yl(t.title_position,n.width),s=(t.title_padding.top||0)+e.getTextRect(e.$el.title,Ot.title).height;a.attr("transform",`translate(${i}, ${s})`)}},getCanvasTitleHeight(){return A_(this)},getTitlePadding(){const e=this,{$el:{title:t},config:n,state:a}=e,i=n.title_padding.top||0,s=n.title_padding.bottom||0;if(a.isCanvasMode&&n.title_text)return i+e.getCanvasTitleHeight()+s;if(!(t!=null&&t.node()))return i+s;const o=t.node(),r=da(o,"y");if(r){const l=en(o);return r+l.y+l.height+s}return i+e.getTextRect(t,Ot.title).height+s}};const ga=15,P_=/(\r?\n|\t)/g,R_=/{{(.*)}}/;function us(e){return`<div style="display:inline-grid;grid-template-columns:auto auto;gap:0 .3em;text-align:left">${e.map(([t,n])=>`<b style="text-align:right">${t}:</b><span>${n}</span>`).join("")}</div>`}var E_={initTooltip(){const e=this,{config:t,$el:n}=e;n.tooltip=(0,B.select)(t.tooltip_contents.bindto),n.tooltip.empty()&&(n.tooltip=n.chart.append("div").attr("class",Wa.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.bindTooltipResizePos()},initShowTooltip(){var e;const t=this,{config:n,$el:a,state:{hasAxis:i,hasRadar:s}}=t;if(n.tooltip_init_show){const o=!(i||s);(e=t.axis)!=null&&e.isTimeSeries()&&st(n.tooltip_init_x)&&(n.tooltip_init_x=Zt.call(t,n.tooltip_init_x)),t.api.tooltip.show({data:{[o?"index":"x"]:n.tooltip_init_x}});const r=n.tooltip_init_position;if(!n.tooltip_contents.bindto&&!le(r)){const{top:l=0,left:c=50}=r;a.tooltip.style("top",st(l)?l:`${l}px`).style("left",st(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:n,config:a}=t;return ve(G(a.tooltip_contents)?a.tooltip_contents.bind(n)(...e):t.getTooltipContent(...e))},getTooltipContent(e,t,n,a){var i,s;const o=this,{api:r,config:l,state:c,$el:u}=o,d=l.tooltip_format_title,h=l.tooltip_format_name,f=l.tooltip_format_value,p=G(d)?d.bind(r):t,g=G(h)?h.bind(r):(E=>E),_=G(f)?f.bind(r):null,x=(E,M,O,$)=>{let I=_;return I||(c.hasTreemap||o.isStackNormalized()&&(!o.isStackNormalizedPerGroup()||o.isGrouped(O))?I=(F,V)=>`${(V*100).toFixed(2)}%`:I=n),I(E,M,O,$)},m=l.tooltip_order,v=E=>o.axis&&o.isBubbleZType(E)?o.getBubbleZData(E.value,"z"):o.getBaseValue(E),b=o.levelColor?E=>o.levelColor(E.value):E=>a(E),T=E=>{var M,O,$;return($=(O=(M=o.customTypeHooks)==null?void 0:M.tooltipColor)==null?void 0:O.call(M,o,E))!=null?$:b(E)},k=l.tooltip_contents,w=k.template,y=o.mapToTargetIds();if(m===null&&l.data_groups.length){const E=o.orderTargets(o.data.targets).map(M=>M.id).reverse();e.sort((M,O)=>{let $=M?M.value:null,I=O?O.value:null;return $>0&&I>0&&($=M.id?E.indexOf(M.id):null,I=O.id?E.indexOf(O.id):null),$-I})}else if(/^(asc|desc)$/.test(m)){const E=m==="asc";e.sort((M,O)=>{const $=M?v(M):null,I=O?v(O):null;return E?$-I:I-$})}else G(m)&&e.sort(m.bind(r));const C=o.getTooltipContentTemplate(w),A=e.length;let S,L,P,D,R;for(R=0;R<A;R++){L=e[R];const E=L&&v(L);if(!(!L||!(E||E===0))){if(Ct(S)){const M=(c.hasAxis||c.hasRadar)&&p(L.x);S=hn(C[0],{CLASS_TOOLTIP:Wa.tooltip,TITLE:nt(M)?w?M:`<tr><th colspan="2">${M}</th></tr>`:""})}if(!L.ratio&&u.arcs&&(P=["arc",o.$el.arcs.select(`path.${ct.arc}-${L.id}`).data()[0]],L.ratio=o.getRatio(...P)),P=[L.ratio,L.id,L.index],o.isAreaRangeType(L)){const[M,O]=["high","low"].map(I=>x(o.getRangedData(L,I),...P)),$=x(v(L),...P);D=us([["Mid",$],["High",M],["Low",O]])}else if(o.isCandlestickType(L)){const[M,O,$,I,F]=["open","high","low","close","volume"].map(V=>o.getRangedData(L,V,"candlestick")?x(o.getRangedData(L,V,"candlestick"),...P):void 0);D=us([["Open",M],["High",O],["Low",$],["Close",I],...F?[["Volume",F]]:[]])}else if((i=o.getAxisTypeHooks(L))!=null&&i.tooltipRows)D=us(o.getAxisTypeHooks(L).tooltipRows(o,L,x,P));else if(o.isBarRangeType(L)){const{value:M,id:O,index:$}=L;D=`${x(M,void 0,O,$)}`}else D=x(v(L),...P);if(D!==void 0){if(L.name===null)continue;const M=g((s=L.name)!=null?s:L.id,...P),O=T(L),$={CLASS_TOOLTIP_NAME:Wa.tooltipName+o.getTargetSelectorSuffix(L.id),COLOR:w||!o.patterns?O:`<svg><rect style="fill:${O}" width="10" height="10"></rect></svg>`,NAME:M,VALUE:D};if(w&&Q(k.text)){const I=y.indexOf(L.id);Object.keys(k.text).forEach(F=>{$[F]=k.text[F][I]})}S+=hn(C[1],$)}}}return`${S}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
25
24
  {=TITLE}
26
25
  {{<tr class="{=CLASS_TOOLTIP_NAME}">
27
26
  <td class="name">${this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>'}{=NAME}</td>
28
27
  <td class="value">{=VALUE}</td>
29
28
  </tr>}}
30
- </tbody></table>`).replace(Ig,"").split(Mg)},setTooltipPosition(e,t){var n,i;const a=this,{config:s,scale:o,state:r,$el:{eventRect:l,tooltip:c,svg:d}}=a,{bindto:u}=s.tooltip_contents,h=s.axis_rotated,f=c==null?void 0:c.datum();if(!u&&f){const g=e!=null?e:f.data,[p,_]=Zt(r.event,t!=null?t:l==null?void 0:l.node()),x={x:p,y:_};if(r.hasAxis&&o.x&&f&&"x"in f){const y=(T=0,w,C="y")=>{var A;const S=o[w?(A=a.axis)==null?void 0:A.getId(w):C];return S?S(T)+(h?r.margin.left:r.margin.top):0};x.xAxis=o.x(f.x)+(s.tooltip_position?h?r.margin.top:r.margin.left:0),g.length===1?x.yAxis=y(g[0].value,g[0].id):x.yAxis=y}const{width:m=0,height:b=0}=f,v=(i=(n=s.tooltip_position)==null?void 0:n.bind(a.api)(g,m,b,l==null?void 0:l.node(),x))!=null?i:d&&Fa(d)?a.getTooltipPositionViewBox.bind(a)(m,b,x):a.getTooltipPosition.bind(a)(m,b,x);["top","left"].forEach(y=>{const T=v[y];c.style(y,`${T}px`),y==="left"&&!f.xPosInPercent&&(f.xPosInPercent=T/r.current.width*100)})}},getTooltipPositionViewBox(e,t,n){var i,a;const s=this,{$el:{eventRect:o,svg:r},config:l,state:c}=s,d=l.axis_rotated,u=s.hasArcType()||c.hasFunnel||c.hasTreemap,h=(a=(i=u?r:o)==null?void 0:i.node())!=null?a:c.event.target;let{x:f,y:g}=n;c.hasAxis&&(f=d?f:n.xAxis,g=d?n.xAxis:g);const p=Ai(h,f,g,!1),_=ht(h),x=Ai(h,20,0,!1).x;let m=p.y,b=p.x+e/2+x;return u&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(b-=e/2+x,m+=t):(m+=_.height/2,b+=_.width/2-(e-x))),b+e>_.width&&(b=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:b}},getTooltipPosition(e,t,n){var i,a,s;const o=this,{config:r,scale:l,state:c}=o,{width:d,height:u,current:h,hasFunnel:f,hasRadar:g,hasTreemap:p,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,b=r.axis_rotated,v=o.hasArcType(),y=c.isCanvasMode?0:o.getSvgLeft(!0);let T=y+h.width-o.getCurrentPaddingByDirection("right");const w=20;let{x:C,y:A}=n;if(g)C+=C>=d/2?15:-(e+15),A+=15;else if(v){if(x!=="touch"){let L=(a=(i=o.getTitlePadding)==null?void 0:i.call(o))!=null?a:0;L&&m&&((s=r.arc_rangeText_values)!=null&&s.length)&&(L+=10),C+=(d-(_?o.getLegendWidth():0))/2,A+=(m?u:u/2+t)+L}}else if(f||p)A+=t;else{const k={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};b?(C+=y+k.left+w,A=k.top+n.xAxis+w,T-=y):(C=y+k.left+w+(l.zoom?C:n.xAxis),A+=k.top-5)}if(C+e+15>T&&(C-=e+(f||p||v?0:b?w*2:38)),A+t>h.height){const k=p?t+10:30;A-=m?t*1.5:t+k}const S={top:A,left:C};return S.top<0&&(S.top=0),S.left<0&&(S.left=0),S},showTooltip(e,t){const n=this,{config:i,$el:{tooltip:a}}=n;if(!a||!i.tooltip_show)return;let s=null,o=0,r=`${n.data.targets.length}:`,l;for(let u=0;u<e.length;u++){const h=e[u];u>0&&(r+=","),r+=`${h==null?void 0:h.index}|${h==null?void 0:h.id}|${h==null?void 0:h.value}`,!l&&h&&(l=h),h&&q(n.getBaseValue(h))?(o++,s==null||s.push(h)):s||(s=e.slice(0,u))}if(o===0||!l)return;const c=a.datum();let d=s;if(!c||c.current!==r){const{index:u,x:h}=l;d||(d=e.slice()),H(i.tooltip_onshow,n.api,e),a.html(n.getTooltipHTML(e,n.axis?n.axis.getXAxisTickFormat():n.categoryName.bind(n),n.getDefaultValueFormat(),n.color)).style("display",null).style("visibility",null),a.datum({index:u,x:h,current:r,data:e,width:a.property("offsetWidth"),height:a.property("offsetHeight")}),H(i.tooltip_onshown,n.api,e),n._handleLinkedCharts(!0,u)}n.setTooltipPosition(d||e,t)},bindTooltipResizePos(){const e=this,{resizeFunction:t,state:n,$el:{tooltip:i}}=e;t.add(()=>{if(i.style("display")==="block"){const{current:a}=n,{width:s,xPosInPercent:o}=i.datum();let r=a.width/100*o;const l=a.width-(r+s);l<0&&(r+=l),i.style("left",`${r}px`)}})},hideTooltip(e){var t;const n=this,{api:i,config:a,$el:{tooltip:s}}=n;if(s&&s.style("display")!=="none"&&(!a.tooltip_doNotHide||e)){const o=(t=s.datum().data)!=null?t:[];H(a.tooltip_onhide,i,o),s.style("display","none").datum(null),H(a.tooltip_onhidden,i,o)}},_handleLinkedCharts(e,t){const n=this,{charts:i,config:a,state:{event:s}}=n;if(s!=null&&s.isTrusted&&a.tooltip_linked&&i.length>1){const o=a.tooltip_linked_name;i.filter(r=>r!==n.api).forEach(r=>{var l,c;const{config:d,$el:u,state:h}=r.internal,f=d.tooltip_linked,g=d.tooltip_linked_name,p=nt.body.contains(u.chart.node());if(f&&o===g&&p){const _=u.tooltip.data()[0],x=t!==(_==null?void 0:_.index);try{e&&x&&h.isCanvasMode?(c=(l=r.internal).showCanvasLinkedTooltip)==null||c.call(l,t):r.tooltip[e&&x?"show":"hide"]({index:t})}catch(m){}}})}},updateTooltipOnRedraw(e,t){var n;const i=this,{config:a,$el:{eventRect:s,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:d,hasTreemap:u}}=i;if(!i.state.isCanvasMode&&(r==null?void 0:r.style("display"))==="block"&&l){const h=e!=null?e:(n=d?o:s)==null?void 0:n.node();if(c||d)if(i.isMultipleX())i.selectRectForMultipleXs(h,!1);else{const f=t!=null?t:i.getDataIndexFromEvent(l);t===-1?i.api.tooltip.hide():(i.selectRectForSingle(h,f),i.setExpand(f,null,!0))}else{const{clientX:f,clientY:g}=l;setTimeout(()=>{let p=[f,g].every(Number.isFinite)&&nt.elementFromPoint(f,g);const _=p&&(0,F.select)(p).datum();if(_){const x=i.hasArcType()?i.convertToArcData(i.updateAngle(_)):_==null?void 0:_.data;u&&(p=o.node()),x&&i.showTooltip([x],p)}else i.api.tooltip.hide()},a.transition_duration)}}}},Og={getTranslate(e,t=0){var n;const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r=0,l,c;if(t&&/^(x|y2?)$/.test(e)&&(r=i.getAxisSize(e)*t),e==="main")l=gn(s.margin.left),c=gn(s.margin.top);else if(e==="context")l=gn(s.margin2.left),c=gn(s.margin2.top);else if(e==="legend")l=s.margin3.left,c=s.margin3.top;else if(e==="x")l=o?-r:0,c=o?0:s.height+r;else if(e==="y")l=o?0:-r,c=o?s.height+r:0;else if(e==="y2")l=o?0:s.width+r,c=o?-r-1:0;else if(e==="subX")l=0,c=o?0:s.height2;else if(e==="subY")l=0,c=o?s.height2:0;else if(e==="subY2")l=o?0:s.width2,c=o?-1:0;else if(e==="arc")l=s.arcWidth/2,c=s.arcHeight/2,(n=a.arc_rangeText_values)!=null&&n.length&&(c+=5+(i.hasType("gauge")&&a.title_text?10:0));else if(e==="polar")l=s.arcWidth/2,c=s.arcHeight/2;else if(e==="radar"){const[d,u]=i.getRadarSize();l=s.width/2-d,c=s.height/2-u}return`translate(${l}, ${c})`},transformMain(e,t){const n=this,{$el:{main:i},$T:a}=n,s=t!=null&&t.axisX?t.axisX:a(i.select(`.${It.axisX}`),e),o=t!=null&&t.axisY?t.axisY:a(i.select(`.${It.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:a(i.select(`.${It.axisY2}`),e);a(i,e).attr("transform",n.getTranslate("main")),s.attr("transform",n.getTranslate("x")),o.attr("transform",n.getTranslate("y")),r.attr("transform",n.getTranslate("y2")),i.select(`.${at.chartArcs}`).attr("transform",n.getTranslate("arc"))},transformAll(e,t){const n=this,{config:i,state:{hasAxis:a,hasFunnel:s,hasTreemap:o,isCanvasMode:r},$el:l}=n;r||(!s&&!o&&n.transformMain(e,t),a&&i.subchart_show&&n.transformContext(e,t),l.legend&&n.transformLegend(e))}};const $g=new Set(["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"]);var Bg={isValidChartType(e){return!!(e&&Object.values(O).indexOf(e)>-1)},getSubchartTargetType(e){const t=this,{config:n}=t,i=Q(e)?e:e==null?void 0:e.id,a=n.subchart_types||{},s=n.subchart_type,o=n.data_types||{},r=i&&a[i];return r&&t.isValidChartType(r)?r:s&&t.isValidChartType(s)?s:i&&o[i]||n.data_type||O.LINE},getTargetType(e){var t;const{config:n}=this,i=Q(e)?e:e==null?void 0:e.id;return i&&((t=n.data_types)==null?void 0:t[i])||n.data_type||O.LINE},getSubchartSourceTargetType(e){const{state:t}=this,n=Q(e)?e:e==null?void 0:e.id,i=t.subchartSourceTypes;return n&&(i==null?void 0:i[n])||this.getTargetType(e)},isSubchartSourceTypeOf(e,t){const n=this.getSubchartSourceTargetType(e);return ot(t)?t.indexOf(n)>=0:n===t},withSubchartTypeContext(e){const t=this,{config:n,data:i,state:a}=t,s=n.data_type,o=n.data_types,r=a.current.types,l=a.subchartSourceTypes,c={},d={},u=n.subchart_type;t.mapToIds(i.targets).forEach(h=>{d[h]=t.getTargetType(h),c[h]=t.getSubchartTargetType(h)}),n.data_type=u&&t.isValidChartType(u)?u:s,n.data_types=c,a.current.types=[],a.subchartSourceTypes=d;try{return e()}finally{n.data_type=s,n.data_types=o,a.current.types=r,a.subchartSourceTypes=l}},setTargetType(e,t){const n=this,{config:i,state:{withoutFadeIn:a}}=n;n.mapToTargetIds(e).forEach(s=>{a[s]=t===i.data_types[s],i.data_types[s]=t}),e||(i.data_type=t)},updateTypesElements(){const e=this,{state:{current:t}}=e;Object.keys(O).forEach(n=>{const i=O[n],a=e.hasType(i,null,!0),s=t.types.indexOf(i);s===-1&&a?t.types.push(i):s>-1&&!a&&t.types.splice(s,1)}),e.setChartElements()},hasType(e,t,n=!1){var i;const a=this,{config:s,state:{current:o}}=a,r=s.data_types,l=t||a.data.targets;return!n&&((i=o.types)==null?void 0:i.indexOf(e))>-1?!0:l!=null&&l.length?l.some(c=>{const d=r[c.id];return d===e||!d&&e==="line"}):Object.keys(r).length?Object.values(r).some(c=>c===e):s.data_type===e},hasTypeOf(e,t,n=[]){return e in ce?!ce[e].filter(i=>n.indexOf(i)===-1).every(i=>!this.hasType(i,t)):!1},isTypeOf(e,t){const n=Q(e)?e:e.id,i=this.config&&this.getTargetType(n);return ot(t)?t.indexOf(i)>=0:i===t},hasPointType(){const e=this;return e.hasTypeOf("Line")||e.hasType("bubble")||e.hasType("scatter")},hasArcType(e,t){return this.hasTypeOf("Arc",e,t)},hasMultiArcGauge(){return this.hasType("gauge")&&this.config.gauge_type==="multi"},isLineType(e){const t=Q(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,ce.Line)},isStepType(e){return this.isTypeOf(e,ce.Step)},isSplineType(e){return this.isTypeOf(e,ce.Spline)},isAreaType(e){return this.isTypeOf(e,ce.Area)},isAreaRangeType(e){return this.isTypeOf(e,ce.AreaRange)},isBarType(e){return this.isTypeOf(e,"bar")},isBubbleType(e){return this.isTypeOf(e,"bubble")},isCandlestickType(e){return this.isTypeOf(e,"candlestick")},isScatterType(e){return this.isTypeOf(e,"scatter")},isTreemapType(e){return this.isTypeOf(e,"treemap")},isPieType(e){return this.isTypeOf(e,"pie")},isFunnelType(e){return this.isTypeOf(e,"funnel")},isGaugeType(e){return this.isTypeOf(e,"gauge")},isDonutType(e){return this.isTypeOf(e,"donut")},isPolarType(e){return this.isTypeOf(e,"polar")},isRadarType(e){return this.isTypeOf(e,"radar")},isArcType(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)||this.isPolarType(e)||this.isRadarType(e)},isCirclePoint(e){const{config:t}=this,n=t.point_pattern;return(e==null?void 0:e.tagName)==="circle"||t.point_type==="circle"&&(!n||ot(n)&&n.length===0)},lineData(e){return this.isLineType(e)?[e]:[]},arcData(e){return this.isArcType(e.data)?[e]:[]},labelishData(e){return this.isBarType(e)||this.isLineType(e)||this.isScatterType(e)||this.isBubbleType(e)||this.isCandlestickType(e)||this.isFunnelType(e)||this.isRadarType(e)||this.isTreemapType(e)?e.values.filter(t=>$(t.value)||!!t.value):[]},barLineBubbleData(e){return this.isBarType(e)||this.isLineType(e)||this.isBubbleType(e)?e.values:[]},isInterpolationType(e){return $g.has(e)}};const zg={basis:pt.curveBasis,"basis-closed":pt.curveBasisClosed,"basis-open":pt.curveBasisOpen,bundle:pt.curveBundle,cardinal:pt.curveCardinal,"cardinal-closed":pt.curveCardinalClosed,"cardinal-open":pt.curveCardinalOpen,"catmull-rom":pt.curveCatmullRom,"catmull-rom-closed":pt.curveCatmullRomClosed,"catmull-rom-open":pt.curveCatmullRomOpen,"monotone-x":pt.curveMonotoneX,"monotone-y":pt.curveMonotoneY,natural:pt.curveNatural,"linear-closed":pt.curveLinearClosed,linear:pt.curveLinear,step:pt.curveStep,"step-after":pt.curveStepAfter,"step-before":pt.curveStepBefore};function Va(e,t){var n,i;return e.isLineType(t)||((n=e.isScatterType)==null?void 0:n.call(e,t))||((i=e.isBubbleType)==null?void 0:i.call(e,t))}function Xr(e){return t=>Va(e,t)}function Wa(e,t,n){var i,a,s;const o=n?Pi(e,t,n):void 0;return $(o)?o:(i=e.isCandlestickType)!=null&&i.call(e,t)?(s=(a=e.getCandlestickData)==null?void 0:a.call(e,t))==null?void 0:s.close:e.getBaseValue(t)}function Pi(e,t,n){var i,a,s;if(!n||(i=e.isCandlestickType)!=null&&i.call(e,t)||!((a=e.isSubchartSourceTypeOf)!=null&&a.call(e,t,O.CANDLESTICK)))return;const o=(s=e.getCandlestickData)==null?void 0:s.call(e,t);if(o)return e.isBarType(t)?$(o.open)&&$(o.close)?o._isUp?o.close:o.open:void 0:$(o.close)?o.close:void 0}function Gr(e,t,n){const i=Pi(e,t,n);return $(i)&&e.isBarType(t)}function Ng(e,t,n){var i;if(!Gr(e,t,n))return null;const a=(i=e.getCandlestickData)==null?void 0:i.call(e,t);if(a!=null&&a._isUp)return e.color(t);const s=e.config.candlestick_color_down;return(s&&typeof s=="object"?s[t.id]:s)||e.color(t)}function Xg(e){var t,n;const i=this;let a;if(Va(i,e)){const s=Xr(i);a=i.generateGetLinePoints(i.getShapeIndices(s),!1,s)}else i.isBarType(e)?a=i.generateGetBarPoints(i.getShapeIndices(i.isBarType)):(t=i.isCandlestickType)!=null&&t.call(i,e)&&(a=(n=i.generateGetCandlestickPoints)==null?void 0:n.call(i,i.getShapeIndices(i.isCandlestickType)));return a}function Vr(e,t,n){return this.config[t]?this.getGradienColortUrl(e.id):n(e)}function Wr(e){const{$el:t}=this,{elKey:n,className:i,cssRules:a,position:s}=e,o=t.main.select(`.${V.chart}`);t[n]=s==="first"?o.insert("g",":first-child"):o.append("g"),t[n].attr("class",i),a!=null&&a.length&&t[n].call(this.setCssRule(!1,`.${i}`,a))}function Ya(e,t){const n=this,{$el:i}=n,{type:a,elKey:s,containerClass:o,itemClass:r,initFn:l,withFocus:c=!0,withStyles:d=!0}=t;i[s]||l.call(n);const u=n.getChartClass(a),h=c?n.classFocus.bind(n):()=>"",g=i.main.select(`.${o}`).selectAll(`.${r}`).data(n.filterNullish(e)).attr("class",p=>u(p)+h(p)).enter().append("g").attr("class",u);return d&&g.style("opacity","0").style("pointer-events",n.getStylePropValue("none")),g}var Gg={getDrawShape(){const e=this,t=e.config.axis_rotated,{hasRadar:n,hasTreemap:i}=e.state,a={type:{},indices:{},pos:{}};if(!i&&["bar","candlestick","line","area"].forEach(s=>{const o=Ot(s);if(e.hasType(s)||e.hasTypeOf(o)||s==="line"&&(e.hasType("bubble")||e.hasType("scatter"))){const r=e.getShapeIndices(e[`is${o}Type`]),l=e[`generateDraw${o}`];a.indices[s]=r,a.type[s]=l?l.bind(e)(r,!1):void 0}}),!e.hasArcType()||n||i){let s,o,r,l;i||(s=n?e.radarCircleX:t?e.circleY:e.circleX,o=n?e.radarCircleY:t?e.circleX:e.circleY),i&&e.state.isCanvasMode?r=l=function(){}:(r=e.generateXYForText(a.indices,!0),l=e.generateXYForText(a.indices,!1)),a.pos={xForText:r,yForText:l,cx:(s||function(){}).bind(e),cy:(o||function(){}).bind(e)}}return a},getShapeIndices(e){const t=this,{config:n}=t,i=n.data_xs,a=bt(i),s={};let o=a?{}:0;return a&&qi(Object.keys(i).map(r=>i[r])).forEach(r=>{o[r]=0,s[r]={}}),t.filterTargetsToShow(t.data.targets.filter(e,t)).forEach(r=>{var l;const c=r.id in i?i[r.id]:"",d=c?s[c]:s;for(let u=0,h;h=n.data_groups[u];u++)if(!(h.indexOf(r.id)<0))for(let f=0,g;g=h[f];f++){if(g in d){d[r.id]=d[g];break}r.id!==g&&c&&(d[g]=(l=d[r.id])!=null?l:o[c])}Ct(d[r.id])&&(d[r.id]=c?o[c]++:o++,d.__max__=(c?o[c]:o)-1)}),s},getIndices(e,t,n){const i=this,{data_xs:a,bar_indices_removeNull:s}=i.config,{id:o,index:r}=t;if(i.isBarType(o)&&s){const l={};return i.getAllValuesOnIndex(r,!0).forEach((c,d)=>{l[c.id]=d,l.__max__=d}),l}return bt(a)?e[a[o]]:e},getIndicesMax(e){if(!bt(this.config.data_xs))return e.__max__;let t=0;for(const n in e)t+=e[n].__max__||0;return t},getShapeX(e,t,n){const i=this,{config:a,scale:s}=i,o=n?s.subX:s.zoom||s.x,r=a.bar_overlap,l=a.bar_padding,c=(h,f)=>h+f,d=Ut(e)&&(e._$total.length?e._$total.reduce(c)/2:0),u=[];if(d&&Ut(e)&&e._$total.length){let h=0;for(const f of e._$total)h+=f,u.push(h)}return h=>{var f;const g=i.getIndices(t,h,"getShapeX"),p=h.id in g?g[h.id]:0,_=(g.__max__||0)+1;let x=0;if(bt(h.x)){const m=o(h.x,!0);if(d){const b=e[h.id]||e._$width;x=r?m-b/2:m-b+((f=u[p])!=null?f:e._$total.slice(0,p+1).reduce(c))-d}else x=m-($(e)?e:e._$width)*(_/2-(r?1:p))}return e&&x&&_>1&&l&&(p&&(x+=l*p),_>2?x-=(_-1)*l/2:_===2&&(x-=l/2)),x}},getShapeY(e){const t=this,n=t.isStackNormalized();return i=>{let{value:a}=i;const s=e?Pi(t,i,e):void 0;return $(i)?a=i:$(s)?a=s:t.isAreaRangeType(i)?a=t.getBaseValue(i,"mid"):n?a=t.getRatio("index",i,!0):t.isBubbleZType(i)?a=t.getBubbleZData(i.value,"y"):t.isBarRangeType(i)&&(a=a[1]),t.getYScaleById(i.id,e)(a)}},getShapeYMin(e,t=!1){const n=this,i=n.axis.getId(e),a=n.getYScaleById(e,t),[s]=a.domain(),o=n.config[`axis_${i}_inverted`];return!n.isGrouped(e)&&!o&&s>0?s:0},getShapeOffsetData(e,t){const n=this,i=n.orderTargets(n.filterTargetsToShow(n.data.targets.filter(e,n))),a=n.state.dataGeneration,s=i.map(h=>h.id).join("_"),o=`${W.shapeOffset}_${t?"sub":"main"}_${s}`,r=n.cache.get(o);if((r==null?void 0:r.generation)===a)return r;const l=n.isStackNormalized(),c=i.map(h=>{let f=h.values;const g={};n.isStepType(h)&&(f=n.convertValuesToStep(f));const p=f.reduce((_,x)=>{const m=Number(x.x),b=Wa(n,x,t);return _[m]=x,g[m]=l?n.getRatio("index",x,!0):b,_},{});return{id:h.id,rowValues:f,rowValueMapByXValue:p,values:g}}),d=i.reduce((h,{id:f},g)=>(h[f]=g,h),{}),u={generation:a,indexMapByTargetId:d,shapeOffsetTargets:c};return n.cache.add(o,u),u},getShapeOffset(e,t,n){const i=this,{shapeOffsetTargets:a,indexMapByTargetId:s}=i.getShapeOffsetData(e,n),o=i.config.data_groupsZeroAs;let r=null;if(!i.config.bar_indices_removeNull){r=new Map;for(const l of a){const c=i.getIndices(t,{id:l.id,index:0});r.set(l.id,a.filter(d=>d.id!==l.id&&c[d.id]===c[l.id]))}}return(l,c)=>{var d;const{id:u,value:h,x:f}=l,g=Wa(i,l,n),p=i.getIndices(t,l),_=i.getYScaleById(u,n);if(i.isBarRangeType(l))return _(h[0]);const x=Number(f),m=_(o==="zero"?0:i.getShapeYMin(u,n));let b=m;const v=(d=r==null?void 0:r.get(u))!=null?d:a.filter(y=>y.id!==u&&p[y.id]===p[u]);for(const y of v){const{id:T,rowValueMapByXValue:w,rowValues:C,values:A}=y;if(s[T]<s[u]){const S=A[x];let k=C[c];(!k||Number(k.x)!==x)&&(k=w[x]);const L=k&&Wa(i,k,n);$(L)&&$(g)&&L*g>=0&&$(S)&&(g!==0||o==="positive"&&S>0||o==="negative"&&S<0)&&(b+=_(S)-m)}}return b}},generateGetLinePoints(e,t,n){const i=this,{config:a}=i,s=i.getShapeX(0,e,t),o=i.getShapeY(t),r=i.getShapeOffset(n||i.isLineType,e,t),l=i.getYScaleById.bind(i),c=new Map;return(d,u)=>{let h=c.get(d.id);h===void 0&&(h=l.call(i,d.id,t)(i.getShapeYMin(d.id,t)),c.set(d.id,h));const f=r(d,u)||h,g=s(d);let p=o(d);a.axis_rotated&&(d.value>0&&p<h||d.value<0&&h<p)&&(p=h);const _=[g,p-(h-f)];return[_,_,_,_]}},generateGetAreaPoints(e,t){const n=this,{config:i}=n,a=n.getShapeX(0,e,t),s=n.getShapeY(!!t),o=n.getShapeOffset(n.isAreaType,e,t),r=n.getYScaleById.bind(n),l=new Map;return function(c,d){let u=l.get(c.id);u===void 0&&(u=r.call(n,c.id,t)(n.getShapeYMin(c.id,t)),l.set(c.id,u));const h=o(c,d)||u,f=a(c),g=c.value;let p=s(c);return i.axis_rotated&&(g>0&&p<u||g<0&&u<p)&&(p=u),[[f,h],[f,p-(u-h)],[f,p-(u-h)],[f,h]]}},generateGetBarPoints(e,t){const n=this,{config:i}=n,a=t?n.axis.subX:n.axis.x,s=n.getIndicesMax(e)+1,o=n.getBarW("bar",a,s),r=n.getShapeX(o,e,!!t),l=n.getShapeY(!!t),c=n.getShapeOffset(n.isBarType,e,!!t),d=n.getYScaleById.bind(n),u=new Map;return(h,f)=>{const{id:g}=h;let p=u.get(g);p||(p={y0:d.call(n,g,t)(n.getShapeYMin(g,t)),isInverted:i[`axis_${n.axis.getId(g)}_inverted`]},u.set(g,p));const{y0:_,isInverted:x}=p,m=c(h,f)||_,b=$(o)?o:o[h.id]||o._$width,v=h.value,y=r(h);let T=l(h);i.axis_rotated&&!x&&(v>0&&T<_||v<0&&_<T)&&(T=_),n.isBarRangeType(h)||(T-=_-m);const w=y+b;return[[y,m],[y,T],[w,T],[w,m]]}},circleY(e,t){const n=this,i=e.id;let a;return n.isGrouped(i)&&(a=Xg.bind(n)(e)),a?a(e,t)[0][1]:n.getYScaleById(i)(n.getBaseValue(e))},circleX(e){return this.xx(e)},updateCircleY(e=!1){const t=this,n=Xr(t),i=t.generateGetLinePoints(t.getShapeIndices(n),e,n),a=t.getShapeY(e);return(s,o)=>{const r=s.id;return t.isGrouped(r)&&Va(t,s)?i(s,o)[0][1]:a(s)}},getSubchartCandlestickShapeValue(e,t){return Pi(this,e,t)},isSubchartCandlestickBarValue(e,t){return Gr(this,e,t)},getSubchartCandlestickBarColor(e,t){return Ng(this,e,t)},pointR(e){const t=this,{config:n}=t,i=n.point_r;let a=i;return t.isBubbleType(e)?a=t.getBubbleR(e):z(i)&&(a=i.bind(t.api)(e)),e.r=a,a},pointExpandedR(e){const t=this,{config:n}=t,i=t.isBubbleType(e)?1.15:1.75;return n.point_focus_expand_enabled?n.point_focus_expand_r||t.pointR(e)*i:t.pointR(e)},pointSelectR(e){const t=this,n=t.config.point_select_r;return z(n)?n(e):n||t.pointR(e)*4},isPointFocusOnly(){const e=this;return e.config.point_focus_only&&!e.hasType("bubble")&&!e.hasType("scatter")&&!e.hasArcType(null,["radar"])},getPointSensitivity(e){const t=this;let n=t.config.point_sensitivity;if(e)z(n)?n=n.call(t.api,e):n==="radius"&&(n=e.r);else return n;return n},getBarW(e,t,n){var i,a,s,o,r;const l=this,{config:c,org:d,scale:u,state:h}=l,f=l.getMaxDataCount(),g=e==="bar"&&((i=c.data_groups)==null?void 0:i.length),p=`${e}_width`,{k:_}=(s=(a=l.getZoomTransform)==null?void 0:a.call(l))!=null?s:{k:1},x=[(o=c.axis_x_min)!=null?o:d.xDomain[0],(r=c.axis_x_max)!=null?r:d.xDomain[1]].map(y=>l.axis.isTimeSeries()?Vt.call(l,y):Number(y));let m=t.tickInterval(f);if(u.zoom&&!l.axis.isCategorized()&&_>1){const y=x.every((T,w)=>T===d.xDomain[w]);m=d.xDomain.map((T,w)=>{const C=y?T:T-Math.abs(x[w]);return u.zoom(C)}).reduce((T,w)=>Math.abs(T)+w)/f}const b=y=>{const T=y?c[p][y]:c[p],w=y?T.ratio:c[`${p}_ratio`],C=y?T.max:c[`${p}_max`],A=$(T)?T:z(T)?T.call(l,h.width,n,f):n?m*w/n:0;return C&&A>C?C:A};let v=b();return!g&&Ut(c[p])&&(v={_$width:v,_$total:[]},l.getTargetsToShow().forEach(y=>{c[p][y.id]&&(v[y.id]=b(y.id),v._$total.push(v[y.id]||v._$width))})),v},getShapeByIndex(e,t,n){const i=this,{$el:a}=i,s=q(t)?`-${t}`:"";let o=a[e];return o&&!o.empty()?o=o.filter(r=>n?r.id===n:!0).filter(r=>q(t)?r.index===t:!0):o=(n?a.main.selectAll(`.${V[`${e}s`]}${i.getTargetSelectorSuffix(n)}`):a.main).selectAll(`.${V[e]}${s}`),o},isWithinShape(e,t){var n;const i=this,a=(0,F.select)(e);let s;return i.isTargetToShow(t.id)?(n=i.hasValidPointType)!=null&&n.call(i,e.nodeName)?s=i.isStepType(t)?i.isWithinStep(e,i.getYScaleById(t.id)(i.getBaseValue(t))):i.isWithinCircle(e,i.isBubbleType(t)?i.pointSelectR(t)*1.5:0):e.nodeName==="path"&&(s=a.classed(V.bar)?i.isWithinBar(e):!0):s=!1,s},getInterpolate(e){const n=this.getInterpolateType(e);return zg[n]},getCurve(e){const t=this;return t.config.axis_rotated&&t.isStepType(e)?i=>{const a=t.getInterpolate(e)(i);return a.orgPoint=a.point,a.pointRotated=function(s,o){this._point===1&&(this._point=2);const r=this._y*(1-this._t)+o*this._t;this._context.lineTo(this._x,r),this._context.lineTo(s,r),this._x=s,this._y=o},a.point=function(s,o){this._point===0?this.orgPoint(s,o):this.pointRotated(s,o)},a}:t.getInterpolate(e)},getInterpolateType(e){const t=this,{config:n}=t,i=n.spline_interpolation_type,a=t.isInterpolationType(i)?i:"cardinal";return t.isSplineType(e)?a:t.isStepType(e)?n.line_step_type:"linear"},isWithinBar(e){const t=Zt(this.state.event,e),n=cr(e),[i,a,s]=n,o=Math.min(i.x,a.x),r=Math.min(i.y,a.y),l=this.config.bar_sensitivity,c=Math.abs(s.x-a.x),d=Math.abs(i.y-a.y),u=o-l,h=o+c+l,f=r+d+l,g=r-l;return u<t[0]&&t[0]<h&&g<t[1]&&t[1]<f}},Vg=Object.defineProperty,Wg=(e,t,n)=>t in e?Vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xt=(e,t,n)=>Wg(e,typeof t!="symbol"?t+"":t,n);function Yr(){var e,t,n;return(n=(t=(e=N.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function Yg(e){return e.hasArcType()?"arc charts":e.hasType("funnel")?"funnel chart":null}function Hg(e){var t,n;const{config:i}=e,a=i.render_mode==="canvas"?Yg(e):null;a&&((n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] render.mode='canvas' is ignored for ${a}; falling back to SVG.`),i.render_mode="svg")}class pe{constructor(t){Xt(this,"api"),Xt(this,"config"),Xt(this,"cache"),Xt(this,"$el"),Xt(this,"state"),Xt(this,"charts"),Xt(this,"data",{xs:{},targets:[]}),Xt(this,"axis"),Xt(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),Xt(this,"org",{xScale:null,xDomain:null}),Xt(this,"color"),Xt(this,"patterns"),Xt(this,"levelColor"),Xt(this,"point"),Xt(this,"brush"),Xt(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const n=this;n.api=t,n.config=new cn,n.cache=new mf;const i=new gf;n.$el=i.getStore("element"),n.state=i.getStore("state"),n.$T=n.$T.bind(n)}$T(t,n,i){const{config:a,state:s}=this,o=a.transition_duration,r=a.subchart_show;let l=t;return l&&("tagName"in l&&(l=(0,F.select)(l)),l=(n!==!1&&o||n)&&(!s.zooming||s.dragging)&&!s.resizing&&s.rendered&&!r?l.transition(i).duration(o):l),l}beforeInit(){const t=this;t.callPluginHook("$beforeInit"),H(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),H(t.config.onafterinit,t.api)}init(){const t=this,{config:n,state:i,$el:a}=t,{boost_useCssRule:s,bindto:o}=n;vf(t),Hg(t);const r=t.hasArcType();if(i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasFunnel=!i.hasAxis&&t.hasType("funnel"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!r&&!i.hasFunnel&&!i.hasTreemap,i.datetimeId=`bb-${+new Date*me()}`,s){const c=nt.createElement("style");c.type="text/css",nt.head.appendChild(c),i.style={rootSelector:`.${i.datetimeId}`,sheet:c.sheet},a.style=c}const l={element:o,classname:"bb"};tt(o)&&(l.element=o.element||"#chart",l.classname=o.classname||l.classname),a.chart=z(l.element.node)?o.element:(0,F.select)(l.element||[]),a.chart.empty()&&(a.chart=(0,F.select)(nt.body.appendChild(nt.createElement("div")))),a.chart.html("").classed(l.classname,!0).classed(i.datetimeId,s).style("position","relative"),t.initParams(),t.initToRender()}initToRender(t){const n=this,{config:i,state:a,$el:{chart:s}}=n,o=()=>Sf(s,{display:"none",visibility:"hidden"}),r=i.render.lazy===!1?!1:i.render.lazy||o(),l=N.MutationObserver;r&&l&&i.render.observe!==!1&&!t&&new l((c,d)=>{o()||(d.disconnect(),!a.rendered&&n.initToRender(!0))}).observe(s.node(),{attributes:!0,attributeFilter:["class","style"]}),(!r||t)&&n.convertData(i,c=>{n.initWithData(c),n.afterInit()})}initParams(){var t,n;const i=this,{config:a,format:s,state:o}=i;if(a.render_mode==="canvas"&&((t=i.prepareCanvasConfig)==null||t.call(i)),i.color=i.generateColor(),i.levelColor=i.generateLevelColor(),a.padding===!1&&(a.axis_x_show=!1,a.axis_y_show=!1,a.axis_y2_show=!1,a.subchart_show=!1),a.render_mode!=="canvas"&&(i.hasPointType()||(n=i.hasLegendDefsPoint)!=null&&n.call(i))&&(i.point=i.generatePoint()),o.hasAxis){i.initClip(),s.extraLineClasses=i.generateExtraLineClass(),s.dataTime=a.data_xLocaltime?wi.timeParse:wi.utcParse,s.axisTime=a.axis_x_localtime?wi.timeFormat:wi.utcFormat;const d=a.zoom_enabled&&a.zoom_type==="drag";s.defaultAxisTime=u=>{const{x:h,zoom:f}=i.scale,g=d?f:f&&h.orgDomain().toString()!==f.domain().toString(),p=u.getMilliseconds()&&".%L"||u.getSeconds()&&".:%S"||u.getMinutes()&&"%I:%M"||u.getHours()&&"%I %p"||u.getDate()!==1&&"%b %d"||g&&u.getDate()===1&&"%b'%y"||u.getMonth()&&"%-m/%-d"||"%Y";return s.axisTime(p)(u)}}const{legend_position:r,legend_inset_anchor:l,axis_rotated:c}=a;o.isLegendRight=r==="right",o.isLegendInset=r==="inset",o.isLegendTop=l==="top-left"||l==="top-right",o.isLegendLeft=l==="top-left"||l==="bottom-left",o.rotatedPadding.top=i.getResettedPadding(o.rotatedPadding.top),o.rotatedPadding.right=c&&!a.axis_x_show?0:30,o.inputType=Af(a.interaction_inputType_mouse,a.interaction_inputType_touch)}initWithData(t){var n,i,a,s,o,r;const l=this,{config:c,scale:d,state:u,$el:h,org:f}=l,{hasAxis:g,hasFunnel:p,hasTreemap:_}=u,x=c.interaction_enabled,m=l.hasType("polar"),b=c.data_labels_backgroundColors;if(g&&(l.axis=l.getAxisInstance(),c.zoom_enabled&&l.initZoom()),l.data.xs={},l.data.targets=l.convertDataToTargets(t),c.data_filter&&(l.data.targets=l.data.targets.filter(c.data_filter.bind(l.api))),c.data_hide&&l.addHiddenTargetIds(c.data_hide===!0?l.mapToIds(l.data.targets):c.data_hide),c.legend_hide&&l.addHiddenLegendIds(c.legend_hide===!0?l.mapToIds(l.data.targets):c.legend_hide),l.updateSizes(),l.updateScales(!0),g){const{x:T,y:w,y2:C,subX:A,subY:S,subY2:k}=d;T&&(T.domain(pn(l.getXDomain(l.data.targets),!c.axis_x_inverted)),A.domain(T.domain()),f.xDomain=T.domain()),w&&(w.domain(l.getYDomain(l.data.targets,"y")),S.domain(w.domain())),C&&(C.domain(l.getYDomain(l.data.targets,"y2")),k&&k.domain(C.domain()))}if(c.render_mode==="canvas"){if(!l.initCanvas)throw Error("[billboard.js] Please import and call canvas() to use render.mode='canvas'.");if(l.bindResize(),l.initCanvas(),c.tooltip_show&&l.initTooltip(),l.callPluginHook("$init"),H(c.oninit,l.api),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();H(c.data_onmin,l.api,T.min),H(c.data_onmax,l.api,T.max)}u.rendered=!0;return}if(h.svg=h.chart.append("svg").style("overflow","hidden").style("display","block"),x&&u.inputType){const T=u.inputType==="touch",{onclick:w,onover:C,onout:A}=c,S=(n=c.interaction_inputType_touch)==null?void 0:n.preventDefault,k=tn(S)&&S||!1,L=!isNaN(S)&&S||null,E=T?{passive:!k&&L===null}:void 0;h.svg.on("click",(w==null?void 0:w.bind(l.api))||null).on(T?"touchstart":"mouseenter",(C==null?void 0:C.bind(l.api))||null,E).on(T?"touchend":"mouseleave",(A==null?void 0:A.bind(l.api))||null)}c.svg_classname&&h.svg.attr("class",c.svg_classname);const v=z(c.color_tiles)&&l.patterns;(g||v||m||_||b||(i=l.hasLegendDefsPoint)!=null&&i.call(l))&&(h.defs=h.svg.append("defs"),g&&["id","idXAxis","idYAxis","idGrid"].forEach(T=>{l.appendClip(h.defs,u.clip[T])}),l.generateTextBGColorFilter(b),v&&l.patterns.forEach(T=>h.defs.append(()=>T.node))),l.updateSvgSize(),l.bindResize();const y=h.svg.append("g").classed(U.main,!0).attr("transform",p||_?null:l.getTranslate("main"));if(h.main=y,c.subchart_show&&l.initSubchart(),c.tooltip_show&&l.initTooltip(),c.title_text&&l.initTitle(),!_&&c.legend_show&&l.initLegend(),c.data_empty_label_text&&y.append("text").attr("class",`${Et.text} ${U.empty}`).attr("text-anchor","middle").attr("dominant-baseline","middle"),g&&(c.regions.length&&((a=l.initRegion)==null||a.call(l)),!c.clipPath&&l.axis.init()),y.append("g").classed(U.chart,!0).attr("clip-path",g?u.clip.path:null),l.callPluginHook("$init"),l.initChartElements(),g&&(x&&((s=l.initEventRect)==null||s.call(l)),(o=l.initGrid)==null||o.call(l),c.clipPath&&((r=l.axis)==null||r.init())),l.updateTargets(l.data.targets),l.updateDimension(),H(c.oninit,l.api),l.setBackground(),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();H(c.data_onmin,l.api,T.min),H(c.data_onmax,l.api,T.max)}c.tooltip_show&&l.initShowTooltip(),u.rendered=!0}initChartElements(){const t=this,{hasAxis:n,hasRadar:i,hasTreemap:a}=t.state,s=[];if(n){const o=["bar","bubble","candlestick","line"];t.config.bar_front&&o.push(o.shift());for(const r of o){const l=Ot(r);(r==="line"&&t.hasTypeOf(l)||t.hasType(r))&&s.push(l)}}else if(a)s.push("Treemap");else if(t.hasType("funnel"))s.push("Funnel");else{const o=t.hasType("polar"),r=t.hasType("gauge");i||s.push("Arc","Pie"),r?s.push("Gauge"):i?s.push("Radar"):o&&s.push("Polar")}for(const o of s)t[`init${o}`]();bt(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()}setChartElements(){const t=this,{$el:{chart:n,svg:i,defs:a,main:s,tooltip:o,legend:r,title:l,canvas:c,eventOverlay:d,grid:u,needle:h,arcs:f,circle:g,bar:p,candlestick:_,line:x,area:m,text:b}}=t;t.api.$={chart:n,svg:i,canvas:c,eventOverlay:d,defs:a,main:s,tooltip:o,legend:r,title:l,grid:u,arc:f,circles:g,bar:{bars:p},candlestick:_,line:{lines:x,areas:m},needle:h,text:{texts:b}}}setBackground(){const t=this,{config:{background:n},state:i,$el:{svg:a}}=t;if(bt(n)){const s=a.select("g").insert(n.imgUrl?"image":"rect",":first-child");n.imgUrl?s.attr("href",n.imgUrl):n.color&&s.style("fill",n.color).attr("clip-path",i.clip.path),s.attr("class",n.class||null).attr("width","100%").attr("height","100%")}}updateTargets(t){var n,i;const a=this,{hasAxis:s,hasFunnel:o,hasRadar:r,hasTreemap:l}=a.state,c=u=>a[`updateTargetsFor${u}`](t.filter(a[`is${u}Type`].bind(a)));if(a.updateTargetsForText(t),s){const u=["bar","candlestick","line"];for(const h of u){const f=Ot(h);(h==="line"&&a.hasTypeOf(f)||a.hasType(h))&&c(f)}(n=a.updateTargetsForSubchart)==null||n.call(a,t)}else if(a.hasArcType(t)){let u="Arc";r?u="Radar":a.hasType("polar")&&(u="Polar"),c(u)}else o?c("Funnel"):l&&c("Treemap");const d=a.hasType("bubble")||a.hasType("scatter");d&&((i=a.updateTargetForCircle)==null||i.call(a)),a.filterTargetsToShowAtInit(d)}filterTargetsToShowAtInit(t=!1){const n=this,{$el:{svg:i},$T:a}=n;let s=`.${U.target}`;t&&(s+=`, .${Nt.chartCircles} > .${Nt.circles}`),a(i.selectAll(s).filter(o=>n.isTargetToShow(o.id))).style("opacity",null)}getWithOption(t){const n={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};for(const[i,a]of Object.entries(n)){const s=Q(a)?n[a]:a;n[i]=Ne(t,`with${i}`,s)}return n}initialOpacity(t){const n=this,{withoutFadeIn:i}=n.state;return n.getBaseValue(t)!==null&&i[t.id]?null:"0"}bindResize(){var t,n;const i=this,{$el:a,config:s,state:o}=i,{resize_auto:r,resize_live:l}=s,c=/^(true|parent)$/.test(r),d=[],u=()=>{var g;const p=o.current.width,_=o.current.height;return i.setContainerSize(),!o.resizePreview&&p===o.current.width&&_===o.current.height?!1:(o.resizing=!0,o.dirty.size=!0,s.legend_show&&(i.updateSizes(),o.isCanvasMode?(g=i.updateHtmlLegend)==null||g.call(i):i.updateLegend()),i.api.flush(!1),!0)},h=()=>{if(o.resizeLiveScale===null&&(o.resizeLiveScale=o.resizeRedrawTime>ms),o.resizeLiveScale){i.previewResize();return}const g=Yr();u()&&(o.resizeRedrawTime=Yr()-g,o.resizeLiveScale=o.resizeRedrawTime>ms)},f=Rf(s.resize_timer,c&&l?h:void 0);d.push(()=>H(s.onresize,i.api)),c&&d.push(u),d.push(()=>{H(s.onresized,i.api),o.resizing=!1,o.resizeLiveScale=null}),d.forEach(g=>f.add(g)),i.resizeFunction=f,r==="parent"&&N.ResizeObserver?(i.resizeFunction.resizeObserver=new N.ResizeObserver(i.resizeFunction.bind(i))).observe(a.chart.node().parentNode):(r==="parent"&&((n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,"[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize.")),N.addEventListener("resize",i.resizeFunction))}callPluginHook(t,...n){this.config.plugins.forEach(i=>{t==="$beforeInit"&&(i.$$=this,this.api.plugins.push(i)),i[t](...n)})}}St(pe.prototype,[Zf,Jf,Qf,eg,ig,rg,ug,tg,dg,bg,Tg,Eu,Gg,wg,Cg,Eg,Dg,Fg,Og,Bg]);const Ha=[fe,ee,Wt,Qi],Hr=10,jg=750,jr=6,Ug=2,Kg=1e5,Zg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Di=new WeakMap;function Ur(e){var t,n;(n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] ${e}`)}function Ii(e,t){var n;const{config:i}=e,a=(n=i.data_names[t])!=null?n:t;return z(i.legend_format)?i.legend_format(a,t!==a?t:void 0):a}function qg(e){return`${e}`.replace(/[&<>"']/g,t=>Zg[t])}function Jg(e,t){var n,i;const{config:a}=e,s=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],o=((i=e.getValidPointPattern)==null?void 0:i.call(e))||(Array.isArray(a.point_pattern)&&a.point_pattern.length?a.point_pattern:[a.point_type]),r=Math.max(0,s.indexOf(t));return o[r%o.length]||"circle"}function Qg(e,t){const n=qg(e.color(t)),i=Jg(e,t),a='viewBox="0 0 8 8" aria-hidden="true" focusable="false" style="display:block;width:100%;height:100%;overflow:visible;pointer-events:none"',s=`fill="${n}" stroke="${n}"`;return/^rect(angle)?$/i.test(i)?`<svg ${a}><rect x="1" y="1" width="6" height="6" ${s}></rect></svg>`:!i||/^circle$/i.test(i)?`<svg ${a}><circle cx="4" cy="4" r="3" ${s}></circle></svg>`:`<svg ${a}><g ${s}>${ue(i)}</g></svg>`}function tp(e,t){const n=new Map;t.each(function(i){n.set(i,this)}),e.cache.add(W.legendItemMap,n)}function Kr(e,t){const{config:n}=e;t.attr("class",function(i){const s=`${(0,F.select)(this).attr("class")||""} ${e.generateClass(j.legendItem,i)}`;return Array.from(new Set(s.trim().split(/\s+/).filter(Boolean))).join(" ")}).style("visibility",i=>e.isLegendToShow(i)?null:"hidden").classed(j.legendItemHidden,i=>!e.isTargetToShow(i)).classed(oe.legendItemInteractive,!!n.interaction_enabled),tp(e,t)}function ep(e,t){var n;const{legend:i}=e.$el,a=((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t];i==null||i.selectAll(`.${j.legendItem}`).classed(lt.legendItemFocused,s=>a.indexOf(s)>=0).style("opacity",function(s){return a.indexOf(s)>=0?null:e.opacityForUnfocusedLegend.call(e,(0,F.select)(this))})}function np(e){const{legend:t}=e.$el;t==null||t.selectAll(`.${j.legendItem}`).classed(lt.legendItemFocused,!1).style("opacity",null)}function ip(e,t){var n,i,a;const{state:s}=e,r=(((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t]).filter(e.isTargetToShow,e),l=new Set(r),c=(((i=e.mapToTargetIds)==null?void 0:i.call(e))||[]).filter(d=>!l.has(d)&&e.isTargetToShow(d));s.focusedTargetIds=l,s.defocusedTargetIds=new Set(c),(a=e.renderCanvasFrame)==null||a.call(e,void 0,null,!1)}function Zr(e){var t,n,i;const{state:a}=e,s=!!((t=a.focusedTargetIds)!=null&&t.size)||!!((n=a.defocusedTargetIds)!=null&&n.size);a.focusedTargetIds=new Set,a.defocusedTargetIds=new Set,s&&((i=e.renderCanvasFrame)==null||i.call(e,void 0,null,!1))}function qr(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function ap(e,t,n){const i=qr(n);e.state.canvasLegendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function Jr(e,t){const n=e.state.canvasLegendTouch,i=n&&qr(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>Hr||Math.abs(i.clientY-n.y)>Hr)}function sp(e,t,n){Jr(e,n);const i=e.state.canvasLegendTouch;return e.state.canvasLegendTouch=null,!!i&&i.id===t&&!i.moved}function op(e,t){e.state.canvasLegendLastTouchClickId=t,e.state.canvasLegendLastTouchClickTime=Date.now()}function rp(e,t){const{state:n}=e,i=n.canvasLegendLastTouchClickId===t&&Date.now()-(n.canvasLegendLastTouchClickTime||0)<jg;return i&&(n.canvasLegendLastTouchClickId=null,n.canvasLegendLastTouchClickTime=0),i}function Qr(e,t){const{api:n,config:i,state:a}=e;if(t.on("click dblclick mouseover mouseout touchstart touchmove touchend",null),!i.interaction_enabled)return;const s=i.legend_item_interaction,o=typeof s=="object"&&(s!=null&&s.dblclick)?"dblclick":"click",r=a.inputType==="touch",l=s||z(i.legend_item_onclick),c=r?ol(i):void 0,d=function(u,h){var f;if(!H(i.legend_item_onclick,n,h,!a.hiddenTargetIds.has(h))){const g=(0,F.select)(this);u.type==="dblclick"||u.altKey?a.hiddenTargetIds.size&&!g.classed(j.legendItemHidden)?n.show():(n.hide(),n.show(h)):(n.toggle(h),g.classed(lt.legendItemFocused,!1)),Zr(e)}r&&((f=e.hideTooltip)==null||f.call(e))};t.on(o,l?function(u,h){r&&u.type==="click"&&rp(e,h)||d.call(this,u,h)}:null),r&&o==="click"&&l&&t.on("touchstart",function(u,h){ap(e,h,u)},c).on("touchmove",u=>{Jr(e,u)},c).on("touchend",function(u,h){sp(e,h,u)&&(op(e,h),d.call(this,u,h))},c),!r&&t.on("mouseover",s||z(i.legend_item_onover)?function(u,h){H(i.legend_item_onover,n,h,!a.hiddenTargetIds.has(h))||!a.transiting&&e.isTargetToShow(h)&&(ep(e,h),ip(e,h))}:null).on("mouseout",s||z(i.legend_item_onout)?function(u,h){H(i.legend_item_onout,n,h,!a.hiddenTargetIds.has(h))||(np(e),Zr(e))}:null)}function lp(e,t){var n,i;const a=(i=(n=e.$el.chart)==null?void 0:n.node)==null?void 0:i.call(n),s=a==null?void 0:a.ownerDocument;if(!a||!s)return null;const o=s.createElementNS("http://www.w3.org/2000/svg","svg"),r=s.createElementNS("http://www.w3.org/2000/svg","g"),l=s.createElementNS("http://www.w3.org/2000/svg","text");o.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",r.setAttribute("class",j.legendItem),l.textContent=t,r.appendChild(l),o.appendChild(r),a.appendChild(o);const c=ht(l);return o.remove(),c}function tl(e){return/^(indexed|category|log|timeseries)$/.test(e)}function Mi(e){return/^(indexed|log|timeseries)$/.test(e)}function cp(e){var t,n;const i=e;return((t=i.changedTouches)==null?void 0:t[0])||((n=i.touches)==null?void 0:n[0])||("clientX"in e?e:null)}function up(e,t,n=!1){var i,a;const s=Jn(e,t);return s?n?(a=(i=e.hitDetector).findNearestShape)==null?void 0:a.call(i,s[0],s[1]):e.hitDetector.findNearest(s[0],s[1]):null}function dp(e,t){var n;const{config:i,state:a}=e,{height:s,margin:o,width:r,xAxisHeight:l}=a,[c,d]=t,u=o.left,h=o.left+r,f=o.top,g=o.top+s,p=i.axis_x_show?Math.max(l||0,24):0;return(n=e.isMultipleX)!=null&&n.call(e)||a.hasTreemap?!1:i.axis_rotated?d>=f&&d<=g&&c>=u-p&&c<=h:c>=u&&c<=h&&d>=f&&d<=g+p}function hp(e,t){const{state:{height:n,margin:i,width:a}}=e,[s,o]=t;return s>=i.left&&s<=i.left+a&&o>=i.top&&o<=i.top+n}function fp(e,t){var n,i;return e.hitDetector.findNearest(t[0],t[1])||(dp(e,t)?(i=(n=e.hitDetector).findNearestIndexByCoord)==null?void 0:i.call(n,t[0],t[1]):null)}function el(e,t){var n;const{config:i,state:a}=e,s=e.filterTargetsToShow(e.data.targets),o=sl(e,t),r=i.tooltip_grouped&&!a.hasTreemap&&!o?(n=e.filterByX)==null?void 0:n.call(e,s,t.x):null;return(a.hasTreemap?[t]:o?[t]:i.tooltip_grouped?r!=null&&r.length?r:s.map(l=>l.values[t.index]).filter(Boolean):[t]).map(l=>{var c;return((c=e.addName)==null?void 0:c.call(e,l))||l})}function gp(e,t,n){var i,a;return(i=e.isMultipleX)!=null&&i.call(e)&&!sl(e,t)?[((a=e.addName)==null?void 0:a.call(e,t))||t]:n}function Jn(e,t){const n=cp(t);if(!n)return null;const i=e.$el.canvas.node(),a=ht(i,!0);return[n.clientX-a.left,n.clientY-a.top]}function ja(e,t){var n,i;if(!Array.isArray(t)||t.length<2)return null;const a=t.slice(0,2);return(i=(n=e.axis)==null?void 0:n.isTimeSeries)!=null&&i.call(n)?a.map(s=>Vt.call(e,s)):a}function Qn(e){const{config:t,state:n}=e;return!t.subchart_show||!n.hasAxis||n.width2<=0||n.height2<=0?null:{x:n.margin2.left,y:n.margin2.top,w:n.width2,h:n.height2}}function nl(e,t){const n=Qn(e);return!!n&&t[0]>=n.x&&t[0]<=n.x+n.w&&t[1]>=n.y&&t[1]<=n.y+n.h}function pp(e,t){const{config:n,state:i}=e,a=Qn(e);if(n.subchart_brush_enabled!==!1||!a||!nl(e,t))return null;const s=so(e,n.axis_rotated?t[1]-a.y:t[0]-a.x);return s===null?null:n.axis_rotated?[i.margin.left+i.width/2,i.margin.top+s]:[i.margin.left+s,i.margin.top+i.height/2]}function Fi(e){var t,n;const i=Qn(e),a=i?e.config.axis_rotated?i.h:i.w:0,s=(n=(t=e.axis)==null?void 0:t.getExtent)==null?void 0:n.call(t),o=Array.isArray(s)?s.slice(0,2):[];if(o.length===2&&o.every(Number.isFinite)){const r=Math.max(0,Math.min(a,o[0])),l=Math.max(0,Math.min(a,o[1]));return[Math.min(r,l),Math.max(r,l)]}return[0,a]}function Ua(e,t,n=!1){const i=Jn(e,t),a=i&&Qn(e);if(!i||!a||!nl(e,i))return null;const s=e.config.axis_rotated?i[1]-a.y:i[0]-a.x,[o,r]=Fi(e);return!n&&(s<o||s>r)?null:Math.max(o,Math.min(r,s))}function _p(e,t,n){const i=Math.min(t,n),a=Math.max(t,n);return[e.scale.subX.invert(i),e.scale.subX.invert(a)]}function il(e){const{scale:t,state:n}=e,i=n.domain;if(!(i!=null&&i.length)||!t.subX)return null;const a=Qn(e),s=t.subX(i[0]),o=t.subX(i[1]);if(!a||!Number.isFinite(s)||!Number.isFinite(o))return null;const[r,l]=Fi(e);return[Math.max(r,Math.min(l,Math.min(s,o))),Math.max(r,Math.min(l,Math.max(s,o)))]}function al(e,t){const n=il(e);if(!n)return"select";const[i,a]=n;return Math.abs(t-i)<=jr?"resize-start":Math.abs(t-a)<=jr?"resize-end":t>i&&t<a?"move":"select"}function Ka(e,t,n){const[i,a]=Fi(e);return[Math.max(i,Math.min(a,t)),Math.max(i,Math.min(a,n))]}function xp(e,t){return/^resize/.test(t)?e.config.axis_rotated?"ns-resize":"ew-resize":t==="move"?"move":"crosshair"}function Ke(e){return e?`${e.id}:${e.index}`:null}function mp(e,t){const n=e.state.canvasSelectionDragIncluded,i=Di.get(e)||new Map,a=new Map,s=new Set,o=[];return t.filter(r=>Za(e,r)).forEach(r=>{const l=Ke(r);l&&(s.add(l),!a.has(l)&&a.set(l,r))}),a.forEach((r,l)=>{!n.has(l)&&o.push(r)}),i.forEach((r,l)=>{!s.has(l)&&o.push(r)}),Di.set(e,a),{included:s,rows:o}}function vp(e){return e?Array.isArray(e)?e:[e]:null}function Za(e,t){return t&&Rt(e,t)&&_n(e,t,Ha)&&Ha.some(n=>n(e,t))&&e.config.data_selection_isselectable.bind(e.api)(t)}function qa(e,t){e.filterTargetsToShow(e.data.targets).filter(n=>_n(e,n,Ha)).forEach(n=>{n.values.forEach(i=>{Za(e,i)&&t(i)})})}function sl(e,t){return!(e.config.axis_x_forceAsSingle&&e.config.tooltip_grouped)&&(Ve(e,t)||We(e,t))}function bp(e){return e.interaction_inputType_touch!==!1}function ol(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}function yp(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;let s;return o=>{var r,l;const c=((r=o.changedTouches)==null?void 0:r[0])||((l=o.touches)==null?void 0:l[0]);if(!c)return;const d=c[`client${e.axis_rotated?"Y":"X"}`];o.type==="touchstart"?i?o.preventDefault():a!==null&&(s=d):o.type==="touchmove"&&(i||s===!0||a!==null&&Math.abs(s-d)>=a)&&(s=!0,o.preventDefault())}}function Sn(e,t){return t.pointerType!=="mouse"&&e.state.inputType!=="touch"}function Tp(e,t){const{state:n}=e,i=Ke(t),a=i&&n.canvasLastInputClickKey===i&&Date.now()-(n.canvasLastInputClickTime||0)<750;return a&&(n.canvasLastInputClickKey=null,n.canvasLastInputClickTime=0),!!a}function wp(e,t){e.state.canvasLastInputClickKey=Ke(t),e.state.canvasLastInputClickTime=Date.now()}function Cp(){var e,t,n;return(n=(t=(e=N.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function rl(e,t=!1){return Array.isArray(e)&&e.length>=2&&e.every(n=>Number.isFinite(+n)&&(!t||+n>0))}function Sp(e,t,n,i=!1){return e.slice(0,2).map((a,s)=>{const o=i?Math.exp(Math.log(+a)+(Math.log(+t[s])-Math.log(+a))*n):+a+(+t[s]-+a)*n;return a instanceof Date||t[s]instanceof Date?new Date(o):o})}function Ap(e){return e.data.targets.reduce((t,n)=>t+n.values.length,0)}function kp(e){const{scale:t}=e,n=e.filterTargetsToShow(e.data.targets);["y","y2"].forEach(i=>{var a;(a=t[i])==null||a.domain(e.getYDomain(n,i))}),e.withSubchartTypeContext(()=>{var i,a;(i=t.subY)==null||i.domain(e.getYDomain(n,"y")),(a=t.subY2)==null||a.domain(e.getYDomain(n,"y2"))})}const Lp={prepareCanvasConfig(){var e,t;const{config:n,state:i}=this;this.warnUnsupportedCanvasOptions(),(e=i.orgConfig)!=null&&e.transition&&Object.prototype.hasOwnProperty.call(i.orgConfig.transition,"duration")&&i.orgConfig.transition.duration&&Ur("canvas mode: transition.duration is ignored; canvas redraws synchronously."),n.transition_duration=0,tl(n.axis_x_type)||(n.axis_x_type="indexed"),Mi(n.axis_y_type)||(n.axis_y_type="indexed"),Mi(n.axis_y2_type)||(n.axis_y2_type="indexed"),(t=this.hasType)!=null&&t.call(this,"bubble")&&(n.point_show=!0,n.point_type="circle")},applyCanvasSubchartDomain(){const e=this,{axis:t,config:n,scale:i,state:a}=e;if(!n.subchart_show||!a.hasAxis||!i.subX)return;!a.rendered&&!a.domain&&n.subchart_init_range&&(a.domain=ja(e,n.subchart_init_range));const s=ja(e,a.domain);!s||!e.withinRange(s,e.getZoomDomain("subX",!0),e.getZoomDomain("subX"))||(a.domain=s,i.x.domain(s),t.x.scale(i.x))},setCanvasSubchartDomain(e,t=!0,n=!1){const i=this,{config:a,scale:s,state:o}=i,r=ja(i,e);if(!(!a.subchart_show||!r||!i.withinRange(r,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))))return o.domain=r,s.zoom=null,t&&i.redraw({withTransition:!1,withY:a.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),n&&a.subchart_onbrush.bind(i.api)(o.domain),o.domain},clearCanvasSubchartDomain(e=!0,t=!1){var n;const i=this,{axis:a,config:s,org:o,scale:r,state:l}=i;s.subchart_show&&(l.domain=void 0,r.zoom=null,(n=o.xDomain)!=null&&n.length&&(r.x.domain(o.xDomain),a.x.scale(r.x)),e&&i.redraw({withTransition:!1,withUpdateXDomain:!0,withUpdateOrgXDomain:!1,withY:s.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t&&s.subchart_onbrush.bind(i.api)(r.x.orgDomain()))},flushCanvasFlow(){var e,t;const{state:n}=this;n.canvasFlowFinish&&(n.canvasFlowFrame!==null&&((t=(e=N).cancelAnimationFrame)==null||t.call(e,n.canvasFlowFrame)),n.canvasFlowFrame=null,n.canvasFlowFinish())},animateCanvasFlow(e){var t,n,i,a,s,o,r,l,c,d,u;const h=this,{axis:f,data:g,org:p,scale:_,state:x}=h,{done:m=()=>{},duration:b,length:v,orgDataCount:y}=e,T=(t=N.requestAnimationFrame)==null?void 0:t.bind(N),w=!!((n=f.isLog)!=null&&n.call(f,"x"));if(!T||!b||!v||!y||Ap(h)>Kg)return!1;const C=_.x.domain().slice(0,2),A=(a=(i=p.xDomain)==null?void 0:i.slice)==null?void 0:a.call(i),S=(l=(o=(s=_.subX)==null?void 0:s.domain)==null?void 0:(r=o.call(s)).slice)==null?void 0:l.call(r);if(!rl(C,w))return!1;const k=g.targets.map(I=>I.values.splice(0,v));h.updateXDomain(h.filterTargetsToShow(g.targets),!0,!0);const L=_.x.domain().slice(0,2),E=(d=(c=p.xDomain)==null?void 0:c.slice)==null?void 0:d.call(c);if(g.targets.forEach((I,X)=>{I.values.unshift(...k[X])}),!rl(L,w))return A&&(p.xDomain=A),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),!1;kp(h);let D=!1;const R=Cp(),P=()=>{var I,X;D||(D=!0,g.targets.forEach(G=>{G.values.splice(0,v)}),E&&(p.xDomain=E),_.x.domain(L),(X=(I=_.subX)==null?void 0:I.domain)==null||X.call(I,E!=null?E:L),f.x.scale(_.x),x.dirty.data=!0,x._eventRectFingerprint=null,x.canvasShape=null,x._cachedDrawShape=null,h.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),h.updateTypesElements(),x.canvasFlowFrame=null,x.canvasFlowFinish=null,x.flowing=!1,m.call(h.api))},B=I=>{const X=Math.min(1,Math.max(0,(I-R)/b)),G=Sp(C,L,X,w);_.x.domain(G),f.x.scale(_.x),x.canvasShape=null,x._cachedDrawShape=null,x._canvasVisibleRangeCache=null,x._canvasXTickValuesCache=null,h.renderCanvasFrame(void 0,null,!1),X<1?x.canvasFlowFrame=T(B):P()};return A&&(p.xDomain=A),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),x.flowing=!0,x.cancelClick=!0,(u=h.hideTooltip)==null||u.call(h),x.canvasFlowFinish=P,x.canvasFlowFrame=T(B),!0},initCanvas(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.chart.node();i.isCanvasMode=!0,i.canvasInlineStyle.minHeight=s.style.minHeight,N.getComputedStyle(s).position==="static"&&a.chart.style("position","relative"),a.chart.style("min-height",`${i.current.height}px`),t.canvasEngine=new wd,t.canvasEngine.init(s,i.current.width,t.getCanvasSurfaceHeight()),a.canvas=(0,F.select)(t.canvasEngine.canvas),t.canvasTheme=new Yh,t.canvasTheme.load(s,n.canvas_theme),t.canvasAxisRenderer=new bd(t.canvasEngine,t.canvasTheme),t.canvasRenderer=new Ph(t.canvasEngine,t.canvasTheme),t.hitDetector=new Zh,t.bindCanvasEvents(),n.zoom_enabled&&((e=t.bindZoomEvent)==null||e.call(t))},warnUnsupportedCanvasOptions(){var e,t,n,i;const{config:a}=this;[[!tl(a.axis_x_type),"axis.x.type other than indexed/category/log/timeseries"],[!Mi(a.axis_y_type),"axis.y.type other than indexed/log/timeseries"],[!Mi(a.axis_y2_type),"axis.y2.type other than indexed/log/timeseries"],[a.boost_useCssRule,"boost.useCssRule"],[(e=this.hasArcType)==null?void 0:e.call(this),"arc charts"],[(t=this.hasType)==null?void 0:t.call(this,"radar"),"radar chart"],[(n=this.hasType)==null?void 0:n.call(this,"polar"),"polar chart"],[(i=this.hasType)==null?void 0:i.call(this,"funnel"),"funnel chart"]].forEach(([o,r])=>{o&&Ur(`canvas mode: ${r} is not yet supported.`)})},bindCanvasEvents(){const e=this,{config:t,state:n,$el:i}=e,a=i.canvas.node(),s=yp(t),o=ol(t);a.addEventListener("mousemove",e.onCanvasMouseMove.bind(e)),a.addEventListener("mouseenter",r=>{var l;n.event=r,(l=t.onover)==null||l.bind(e.api)(r)}),a.addEventListener("mouseout",e.onCanvasMouseOut.bind(e)),a.addEventListener("mouseleave",r=>{var l;n.event=r,(l=t.onout)==null||l.bind(e.api)(r)}),a.addEventListener("mousedown",r=>{var l;(l=e.onCanvasSubchartBrushStart)!=null&&l.call(e,r)||e.onCanvasSelectionDragStart(r)}),a.addEventListener("click",e.onCanvasClick.bind(e)),a.addEventListener("pointerdown",e.onCanvasPointerDown.bind(e)),a.addEventListener("pointerenter",e.onCanvasPointerEnter.bind(e)),a.addEventListener("pointermove",e.onCanvasPointerMove.bind(e)),a.addEventListener("pointerup",e.onCanvasPointerUp.bind(e)),a.addEventListener("pointerleave",e.onCanvasPointerOut.bind(e)),a.addEventListener("pointercancel",e.onCanvasPointerCancel.bind(e)),bp(t)&&(a.addEventListener("touchstart",r=>{s(r),e.onCanvasTouchStart(r)},o),a.addEventListener("touchmove",r=>{s(r),e.onCanvasTouchMove(r)},o),a.addEventListener("touchend",e.onCanvasTouchEnd.bind(e),o),a.addEventListener("touchcancel",e.onCanvasTouchCancel.bind(e),o))},updateHtmlLegend(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();if(!i.legend_show||a.hasTreemap){a.hasTreemap?((e=s.legend)==null||e.remove(),s.legend=null):(t=s.legend)==null||t.style("visibility","hidden"),a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0;return}const r=n.mapToIds(n.data.targets).filter(u=>i.data_names[u]!==null);if(i.legend_contents_bindto&&i.legend_contents_template){n.updateHtmlLegendTemplate(r)?(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0,a.legendHasRendered=!0):(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0);return}s.legend||(s.legend=(0,F.select)(o).append("div").classed(j.legend,!0).classed(oe.legend,!0)),s.legend.style("visibility",null);const l=s.legend.selectAll(`button.${j.legendItem}`).data(r,u=>u);l.exit().remove();const c=l.enter().append("button").attr("type","button").attr("data-id",u=>u);c.append("span").classed(j.legendItemTile,!0),c.append("span").classed(oe.legendItemTitle,!0);const d=c.merge(l).attr("class",u=>n.generateClass(j.legendItem,u).trim());Kr(n,d),d.select(`.${j.legendItemTile}`).classed(oe.legendItemTileCircle,!i.legend_usePoint&&i.legend_item_tile_type==="circle").style("background-color",u=>i.legend_usePoint?null:n.color(u)).html(u=>i.legend_usePoint?Qg(n,u):""),d.select(`.${oe.legendItemTitle}`).text(u=>Ii(n,u)),i.legend_tooltip&&d.attr("title",u=>Ii(n,u)),Qr(n,d),n.updateHtmlLegendSize(r),n.positionHtmlLegend(),a.legendHasRendered=!0},updateHtmlLegendTemplate(e){const t=this,{api:n,config:i,$el:a}=t,s=(0,F.select)(i.legend_contents_bindto),o=i.legend_contents_template,r=[];let l="";if(s.empty())return!1;e.forEach(d=>{const u=z(o)?ue(o.call(n,d,t.color(d),n.data(d)[0].values)):an(o,{COLOR:t.color(d),TITLE:d});u&&(r.push(d),l+=u)});const c=s.html(ue(l)).classed(j.legend,!0).classed(oe.legend,!1).style("visibility",null).selectAll(function(){return this.children}).data(r);return Kr(t,c),Qr(t,c),a.legend=s,!0},updateHtmlLegendSize(e){const t=this,{config:n,state:i,$el:a}=t,s=[],o={};let r=0,l=0,c=0;const d=n.legend_contents_bindto&&n.legend_contents_template;if(d)a.legend.selectAll(`.${j.legendItem}`).each(function(u){const h=ht(this,!0),f=`${Ii(t,u)}`,g=Math.max(32,f.length*7+24),p=20,_=Math.ceil(h.width||g),x=Math.ceil(h.height||p);s.push(_),r=Math.max(r,_),l=Math.max(l,x)});else if(e.length){const u=i.isLegendRight||i.isLegendInset,h=n.legend_item_tile_type!=="circle",f={width:h?n.legend_item_tile_width:n.legend_item_tile_r*2,height:h?n.legend_item_tile_height:n.legend_item_tile_r*2},g={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},p={offsets:{},widths:{},heights:{},margins:[0],steps:{}},_=e.map((w,C)=>{const A=`${Ii(t,w)}`,S=lp(t,A),k=Math.max(32,A.length*7),L=12,E=C===e.length-1,D=n.legend_show&&!t.isLegendToShow(w),R=D?0:((S==null?void 0:S.width)||k)+g.tileWidth+(E&&!u?0:g.padding.right)+n.legend_padding,P=D?0:((S==null?void 0:S.height)||L)+g.padding.top;return g.max.width=Math.max(g.max.width,R),g.max.height=Math.max(g.max.height,P),{id:w,hidden:D,width:R,height:P}}),x=u?t.getLegendHeight():t.getLegendWidth(),m=(w,C,A=!1)=>{let S;A||(S=(x-g.totalLength-C)/2,S<g.posMin&&(S=(x-C)/2,g.totalLength=0,g.step++)),p.steps[w]=g.step,p.margins[g.step]=i.isLegendInset?10:S,p.offsets[w]=g.totalLength,g.totalLength+=C};i.isLegendInset&&(g.step=n.legend_inset_step?n.legend_inset_step:e.length,i.legendStep=g.step),_.forEach(({id:w,hidden:C,width:A,height:S})=>{const k=n.legend_equally&&!C?g.max.width:A,L=n.legend_equally&&!C?g.max.height:S,E=u?L:k;if(p.widths[w]=k,p.heights[w]=L,s.push(k),r=Math.max(r,k),l=Math.max(l,L),C){p.steps[w]=0,p.offsets[w]=0;return}m(w,E)});const b=i.isLegendRight?w=>g.max.width*p.steps[w]:i.isLegendInset?w=>g.max.width*p.steps[w]+10:w=>p.margins[p.steps[w]]+p.offsets[w],v=i.isLegendRight||i.isLegendInset?w=>p.margins[p.steps[w]]+p.offsets[w]:w=>g.max.height*p.steps[w],y=4+f.width,T=9;_.forEach(({id:w,hidden:C})=>{const A=C?0:b(w),S=C?0:v(w);o[w]={item:{x:A,y:S-5,width:p.widths[w],height:p.heights[w]},title:{x:y,y:0,height:p.heights[w]},tile:{x:-2,y:T-f.height/2,width:f.width,height:f.height}}}),c=g.step}if(!e.length){i.legendItemWidth=0,i.legendItemHeight=0,i.legendStep=0;return}if(d){const u=Math.max(1,i.current.width),h=10;let f=1,g=0;s.forEach(p=>{g&&g+h+p>u?(f++,g=p):g+=(g?h:0)+p}),i.legendStep=Math.max(0,f-1)}else i.legendStep=c;i.legendItemWidth=r,i.legendItemHeight=Math.max(12,l),d||a.legend.selectAll(`button.${j.legendItem}`).each(function(u){const h=o[u],f=(0,F.select)(this);h&&(f.style("left",`${h.item.x}px`).style("top",`${h.item.y}px`).style("width",`${h.item.width}px`).style("height",`${h.item.height}px`),f.select(`.${oe.legendItemTitle}`).style("left",`${h.title.x}px`).style("top",`${h.title.y}px`).style("height",`${h.title.height}px`).style("line-height",`${h.title.height}px`),f.select(`.${j.legendItemTile}`).style("left",`${h.tile.x}px`).style("top",`${h.tile.y}px`).style("width",`${h.tile.width}px`).style("height",`${h.tile.height}px`))})},getCanvasBottomLegendHeight(){var e;const t=this,{config:n,state:i,$el:a}=t;if(!n.legend_show||i.isLegendRight||i.isLegendInset||i.hasTreemap||!a.legend||!i.legendItemHeight)return 0;const s=ht(a.legend.node(),!0).height,o=i.legendItemHeight*(i.legendStep+1);return Math.ceil(Math.max(((e=t.getLegendHeight)==null?void 0:e.call(t))||0,s||o))},getCanvasSurfaceHeight(){const e=this;return Math.max(0,e.state.current.height-e.getCanvasBottomLegendHeight())},positionHtmlLegend(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.legend;if(s.classed(oe.legendBottom,!i.isLegendRight&&!i.isLegendInset).classed(oe.legendRight,i.isLegendRight).classed(oe.legendInset,i.isLegendInset).style("top",null).style("right",null).style("bottom",null).style("left",null).style("width",null).style("height",null).style("min-height",null),i.isLegendRight)s.style("top",`${i.margin3.top}px`).style("right","0").style("bottom",`${i.margin3.bottom}px`).style("width",`${Math.max(0,t.getLegendWidth())}px`);else if(i.isLegendInset){if(i.isLegendInset){const o=i.isLegendTop,r=i.isLegendLeft;s.style(o?"top":"bottom",`${n.legend_inset_y}px`).style(r?"left":"right",`${n.legend_inset_x}px`).style("width",`${Math.max(0,i.legendItemWidth*(i.legendStep+1)+20)}px`)}}else{const o=((e=t.getLegendHeight)==null?void 0:e.call(t))||0;s.style("top",`${Math.max(0,i.current.height-o)}px`).style("right","0").style("bottom","auto").style("left","0")}},getCanvasSelectedData(e){const t=this,n=t.state.canvasSelection,i=[];return!t.config.data_selection_enabled||!(n!=null&&n.size)||qa(t,a=>{(!e||a.id===e)&&n.has(Ke(a))&&i.push(a)}),i},setCanvasSelection(e=!1,t,n,i){var a;const s=this,{config:o,state:r}=s,l=r.canvasSelection,c=o.data_selection_grouped;let d=vp(t),u=!1;const h=e&&!o.data_selection_multiple;let f=!h;if(o.data_selection_enabled){if(h&&(n=n!=null&&n.length?[n[0]]:[0],!c))if(d)d=d.slice(0,1);else{const[g]=s.filterTargetsToShow(s.data.targets);d=g?[g.id]:[]}qa(s,g=>{const p=Ke(g),_=c||!d||d.indexOf(g.id)>=0,x=!n||n.indexOf(g.index)>=0,m=l.has(p);if(e)if(_&&x&&(!m||h)){if(f||(s.setCanvasSelection(!1),f=!0),l.has(p))return;l.add(p),H(o.data_onselected,s.api,g,s.canvasEngine.canvas),u=!0}else(!h||f)&&i&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),u=!0);else _&&x&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),u=!0)}),u&&((a=s.renderCanvasFrame)==null||a.call(s,void 0,null,!1))}},toggleCanvasSelection(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelection;let o=!1;i.data_selection_enabled&&(e.filter(r=>Za(n,r)).forEach(r=>{const l=Ke(r),c=s.has(l);i.data_selection_multiple||qa(n,d=>{const u=Ke(d);(i.data_selection_grouped?d.id===r.id:u!==l)&&s.has(u)&&(s.delete(u),H(i.data_onunselected,n.api,d,n.canvasEngine.canvas),o=!0)}),c&&s.has(l)?(s.delete(l),H(i.data_onunselected,n.api,r,n.canvasEngine.canvas)):(s.add(l),H(i.data_onselected,n.api,r,n.canvasEngine.canvas)),o=!0}),o&&((t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1)))},canStartCanvasSelectionDrag(e){const t=this,{config:n}=t,i=e;return!!(n.interaction_enabled&&n.data_selection_enabled&&n.data_selection_draggable&&n.data_selection_multiple&&!n.zoom_enabled&&(i.button===void 0||i.button===0))},getCanvasSelectionDragData(e){const t=this,{config:n}=t,i=t.hitDetector.findInRect(e,n.data_selection_grouped);if(!n.data_selection_grouped)return i;const a=new Set(i.map(s=>s.index));return t.filterTargetsToShow(t.data.targets).flatMap(s=>s.values.filter(o=>a.has(o.index)))},startCanvasSelectionDrag(e){var t,n;const i=this,{state:a}=i,s=Jn(i,e);return!s||!i.canStartCanvasSelectionDrag(e)?!1:(a.dragStart=s,a.canvasSelectionDragStart=s,a.canvasSelectionDragIncluded=new Set,a.canvasSelectionDragging=!0,a.canvasSelectionDragMoved=!1,Di.set(i,new Map),i.setDragStatus(!0),(t=i.hideTooltip)==null||t.call(i),(n=e.preventDefault)==null||n.call(e),!0)},updateCanvasSelectionDrag(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelectionDragStart,o=Jn(n,e);if(!a.canvasSelectionDragging||!s||!o)return!1;const[r,l]=s,[c,d]=o,u=Math.min(r,c),h=Math.max(r,c),f=i.data_selection_grouped?a.margin.top:Math.min(l,d),g=i.data_selection_grouped?a.margin.top+a.height:Math.max(l,d),p={x:u,y:f,w:h-u,h:g-f},_=Math.abs(c-r)>4||Math.abs(d-l)>4;if(a.canvasSelectionDragMoved=a.canvasSelectionDragMoved||_,_){const{included:x,rows:m}=mp(n,n.getCanvasSelectionDragData(p));m.length&&n.toggleCanvasSelection(m),a.canvasSelectionDragIncluded=x,a.cancelClick=!0}return n.renderCanvasSelectionDrag(p),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSelectionDrag(e){var t;const n=this,{state:i}=n;return i.canvasSelectionDragging?(n.updateCanvasSelectionDrag(e),i.cancelClick=i.cancelClick||i.canvasSelectionDragMoved,i.dragStart=null,i.canvasSelectionDragStart=null,i.canvasSelectionDragIncluded=new Set,i.canvasSelectionDragging=!1,i.canvasSelectionDragMoved=!1,Di.delete(n),n.setDragStatus(!1),n.clearCanvasFocus(),(t=e.preventDefault)==null||t.call(e),!0):!1},dispatchCanvasDataOut(e){const t=this,{config:n,state:i}=t,a=i.canvasDataHover;a&&(i.canvasDataHover=null,i.canvasDataHoverKey=null,n.interaction_enabled&&H(n.data_onout,t.api,a,e))},dispatchCanvasDataOver(e,t){const n=this,{config:i,state:a}=n,s=Ke(e);a.canvasDataHoverKey!==s&&(n.dispatchCanvasDataOut(t),a.canvasDataHover=e,a.canvasDataHoverKey=s,i.interaction_enabled&&e&&H(i.data_onover,n.api,e,t))},dispatchCanvasDataClick(e,t=!1){var n;const i=this,{config:a,$el:s}=i,o=s.canvas.node(),r=up(i,e,!0);if(!r||Tp(i,r))return r;if(a.interaction_enabled){const l=a.data_selection_grouped?i.filterTargetsToShow(i.data.targets).map(c=>c.values[r.index]).filter(Boolean):[r];(n=i.toggleCanvasSelection)==null||n.call(i,l),l.forEach(c=>H(a.data_onclick,i.api,c,o)),t&&wp(i,r)}return r},updateCanvasSubchartBrush(e){var t,n;const i=this,{config:a,state:s}=i,o=s.canvasSubchartBrushStart,r=s.canvasSubchartBrushOrigin,l=s.canvasSubchartBrushMode,c=Ua(i,e,!0);if(a.subchart_brush_enabled===!1||!s.canvasSubchartBrushDragging||o===null||c===null||!l)return!1;const d=c-o;if(Math.abs(d)>Ug&&(s.canvasSubchartBrushMoved=!0),!s.canvasSubchartBrushMoved)return(t=e.preventDefault)==null||t.call(e),!0;let u;if(l==="move"&&r){const[f,g]=Fi(i),p=r[1]-r[0];let _=r[0]+d,x=r[1]+d;_<f&&(x+=f-_,_=f),x>g&&(_-=x-g,x=g),u=[Math.max(f,Math.min(g-p,_)),Math.min(g,Math.max(f+p,x))]}else l==="resize-start"&&r?u=Ka(i,c,r[1]):l==="resize-end"&&r?u=Ka(i,r[0],c):u=Ka(i,o,c);const h=_p(i,u[0],u[1]);return i.setCanvasSubchartDomain(h,!0),s.cancelClick=!0,(n=e.preventDefault)==null||n.call(e),!0},updateCanvasSubchartCursor(e){const t=this,n=t.$el.canvas.node();if(t.config.subchart_brush_enabled===!1)return n.style.cursor="",!1;const i=Ua(t,e);if(i===null)return n.style.cursor="",!1;const a=al(t,i);return n.style.cursor=xp(t,a),!0},startCanvasSubchartBrush(e){var t;const n=this,{state:i}=n;if(n.config.subchart_brush_enabled===!1)return!1;const a=Ua(n,e);if(a===null)return!1;const s=al(n,a);return i.event=e,i.canvasSubchartBrushDragging=!0,i.canvasSubchartBrushMode=s,i.canvasSubchartBrushStart=a,i.canvasSubchartBrushOrigin=il(n),i.canvasSubchartBrushMoved=!1,i.cancelClick=!0,n.setDragStatus(!0),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSubchartBrush(e){var t,n,i;const a=this,{state:s}=a;if(!s.canvasSubchartBrushDragging)return!1;a.updateCanvasSubchartBrush(e);const o=s.canvasSubchartBrushMode==="select"&&!s.canvasSubchartBrushMoved,r=s.canvasSubchartBrushMoved||o;return o?(t=a.clearCanvasSubchartDomain)==null||t.call(a,!0,!0):r&&a.config.subchart_onbrush.bind(a.api)((n=s.domain)!=null?n:a.scale.x.orgDomain()),s.canvasSubchartBrushDragging=!1,s.canvasSubchartBrushMode=null,s.canvasSubchartBrushStart=null,s.canvasSubchartBrushOrigin=null,s.canvasSubchartBrushMoved=!1,a.setDragStatus(!1),(i=e.preventDefault)==null||i.call(e),!0},cancelCanvasSubchartBrush(e){var t;const n=this,{state:i}=n;return i.canvasSubchartBrushDragging?(i.canvasSubchartBrushDragging=!1,i.canvasSubchartBrushMode=null,i.canvasSubchartBrushStart=null,i.canvasSubchartBrushOrigin=null,i.canvasSubchartBrushMoved=!1,n.setDragStatus(!1),(t=e.preventDefault)==null||t.call(e),!0):!1},onCanvasSubchartBrushStart(e){const t=this;if(!t.startCanvasSubchartBrush(e))return!1;const n=a=>{t.updateCanvasSubchartBrush(a)},i=a=>{t.endCanvasSubchartBrush(a),N.removeEventListener("mousemove",n),N.removeEventListener("mouseup",i)};return N.addEventListener("mousemove",n),N.addEventListener("mouseup",i),!0},onCanvasClick(e){var t;const n=this,{config:i,state:a}=n;if(a.event=e,a.flowing||a.cancelClick){a.cancelClick=!1;return}n.dispatchCanvasDataClick(e),(t=i.onclick)==null||t.bind(n.api)(e)},onCanvasSelectionDragStart(e){const t=this,{state:n}=t;if(!t.startCanvasSelectionDrag(e))return;const i=s=>{t.updateCanvasSelectionDrag(s)},a=s=>{t.endCanvasSelectionDrag(s),N.removeEventListener("mousemove",i),N.removeEventListener("mouseup",a),n.canvasSelectionDragMoveHandler=null,n.canvasSelectionDragEndHandler=null};n.canvasSelectionDragMoveHandler=i,n.canvasSelectionDragEndHandler=a,N.addEventListener("mousemove",i),N.addEventListener("mouseup",a)},onCanvasPointerDown(e){var t;if(!Sn(this,e))return;const n=this,i=n.$el.canvas.node();if(!n.startCanvasSubchartBrush(e))return;const a=e.pointerId,s=d=>d.pointerId===a,o=d=>{s(d)&&n.updateCanvasSubchartBrush(d)},r=d=>{s(d)&&(n.endCanvasSubchartBrush(d),c())},l=d=>{s(d)&&(n.cancelCanvasSubchartBrush(d),c())};function c(){var d;N.removeEventListener("pointermove",o),N.removeEventListener("pointerup",r),N.removeEventListener("pointercancel",l);try{(d=i.releasePointerCapture)==null||d.call(i,a)}catch(u){}}try{(t=i.setPointerCapture)==null||t.call(i,a)}catch(d){}N.addEventListener("pointermove",o),N.addEventListener("pointerup",r),N.addEventListener("pointercancel",l)},onCanvasPointerEnter(e){var t;Sn(this,e)&&(this.state.event=e,(t=this.config.onover)==null||t.bind(this.api)(e))},onCanvasPointerMove(e){Sn(this,e)&&(this.updateCanvasSubchartBrush(e)||this.onCanvasMouseMove(e))},onCanvasPointerUp(e){var t;if(Sn(this,e)){if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node())}},onCanvasPointerOut(e){var t;Sn(this,e)&&(this.state.canvasSubchartBrushDragging||(this.state.event=e,this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)))},onCanvasPointerCancel(e){var t;if(Sn(this,e)){if(this.state.event=e,this.cancelCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.onCanvasPointerOut(e)}},onCanvasTouchStart(e){var t;e.touches.length>1||(this.state.event=e,!this.startCanvasSubchartBrush(e)&&(this.startCanvasSelectionDrag(e)||((t=this.config.onover)==null||t.bind(this.api)(e),this.onCanvasMouseMove(e))))},onCanvasTouchMove(e){e.touches.length>1||this.updateCanvasSubchartBrush(e)||this.updateCanvasSelectionDrag(e)||this.onCanvasMouseMove(e)},onCanvasTouchEnd(e){var t,n,i;if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}if(this.endCanvasSelectionDrag(e)){(n=this.config.onout)==null||n.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node()),(i=this.config.onout)==null||i.bind(this.api)(e)},onCanvasTouchCancel(e){var t;this.state.event=e,this.cancelCanvasSubchartBrush(e),this.endCanvasSelectionDrag(e),this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)},onCanvasMouseMove(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:c}=o,d=c.canvas.node();if(l.event=e,l.flowing||l.canvasSelectionDragging)return;if((t=o.updateCanvasSubchartCursor)!=null&&t.call(o,e)){o.dispatchCanvasDataOut(d),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),(n=o.hideTooltip)==null||n.call(o);return}const u=Jn(o,e),h=u&&(pp(o,u)||u),f=h?fp(o,h):null;if(!f){if(o.dispatchCanvasDataOut(d),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),u&&r.axis_tooltip&&hp(o,u)){o.renderCanvasAxisTooltip(u),(i=o.hideTooltip)==null||i.call(o);return}(a=o.hideTooltip)==null||a.call(o);return}o.dispatchCanvasDataOver(f,d);const g=el(o,f),p=gp(o,f,g),_=p.map(x=>`${x.id}:${x.index}`).join("|");(l.canvasFocusKey!==_||r.axis_tooltip)&&(l.canvasFocusKey=_,o.renderCanvasFocus(p,h)),(s=o.showTooltip)==null||s.call(o,g,d)},onCanvasMouseOut(){var e;const t=this.$el.canvas.node();t.style.cursor="",this.dispatchCanvasDataOut(t),this.state.canvasFocusKey?(this.state.canvasFocusKey=null,this.clearCanvasFocus()):this.config.axis_tooltip&&this.clearCanvasFocus(),(e=this.hideTooltip)==null||e.call(this)},showCanvasLinkedTooltip(e){var t,n,i,a;const s=this,{$el:o,state:r}=s,l=(t=o.canvas)==null?void 0:t.node(),d=s.filterTargetsToShow(s.data.targets).map(x=>x.values[e]).find(Boolean);if(!l||!d)return(n=s.hideTooltip)==null||n.call(s),!1;const u=el(s,d),h=u.find(x=>x&&Rt(s,x))||u[0];if(!u.length||!h)return(i=s.hideTooltip)==null||i.call(s),!1;const{left:f,top:g}=ht(l,!0),p=zn(s,h),_=[r.margin.left+p.x,r.margin.top+p.y];return r.event={clientX:f+_[0],clientY:g+_[1],currentTarget:l,target:l},r.canvasFocusKey=u.map(x=>`${x.id}:${x.index}`).join("|"),s.renderCanvasFocus(u,_),(a=s.showTooltip)==null||a.call(s,u,l),!0},renderCanvasZoomBrush(e,t){const n=this;n.canvasEngine.withOverlay(i=>{n.canvasRenderer.withContext(i,()=>{n.canvasRenderer.drawZoomBrush(n,e,t)})})},clearCanvasZoomBrush(){this.canvasEngine.clearOverlay()},renderCanvasSelectionDrag(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasRenderer.withContext(n,()=>{t.canvasRenderer.drawSelectionDragArea(t,e)})})},renderCanvasFrame(e,t,n=!1){const i=this,{state:a}=i,s=e||a.canvasShape||i.getDrawShape();a.canvasShape=s,a._canvasVisibleRangeCache=null,a._canvasXTickValuesCache=null,i.canvasEngine.beginFrame(a.current.width,i.getCanvasSurfaceHeight());try{i.canvasRenderer.drawBackground(i),i.canvasAxisRenderer.drawTitle(i),a.hasAxis&&i.canvasAxisRenderer.draw(i),i.canvasRenderer.draw(i,s),a.hasAxis&&i.config.grid_lines_front&&i.canvasAxisRenderer.drawGridLines(i),i.canvasRenderer.drawSubchart(i,s),a.hasAxis&&i.canvasAxisRenderer.drawSubXAxis(i),a.hasAxis&&i.canvasAxisRenderer.drawSubYAxes(i),i.canvasRenderer.drawEmptyLabel(i),n&&i.hitDetector.rebuild(i,s)}finally{i.canvasEngine.endFrame()}i.canvasEngine.clearOverlay(),a.canvasFocusMainRedraw=!1,t&&i.renderCanvasFocus(t)},renderCanvasFocus(e,t){var n,i;const a=this,{state:s}=a,o=(i=(n=a.canvasRenderer).hasExpandedShapeFocus)==null?void 0:i.call(n,a,e);if(o){const r=s.canvasShape||a.getDrawShape();a.canvasEngine.beginFrame(s.current.width,a.getCanvasSurfaceHeight());try{a.canvasRenderer.drawBackground(a),a.canvasAxisRenderer.drawTitle(a),s.hasAxis&&a.canvasAxisRenderer.draw(a),a.canvasRenderer.draw(a,r,e),s.hasAxis&&a.config.grid_lines_front&&a.canvasAxisRenderer.drawGridLines(a),a.canvasRenderer.drawSubchart(a,r),s.hasAxis&&a.canvasAxisRenderer.drawSubXAxis(a),s.hasAxis&&a.canvasAxisRenderer.drawSubYAxes(a),a.canvasRenderer.drawEmptyLabel(a)}finally{a.canvasEngine.endFrame()}}s.canvasFocusMainRedraw=!!o,a.canvasEngine.withOverlay(r=>{a.canvasRenderer.withContext(r,()=>{a.canvasRenderer.drawFocus(a,e)}),a.canvasAxisRenderer.withContext(r,()=>{a.canvasAxisRenderer.drawFocusedXAxisTick(a,e),t&&a.canvasAxisRenderer.drawAxisTooltip(a,t)})})},renderCanvasAxisTooltip(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasAxisRenderer.withContext(n,()=>{t.canvasAxisRenderer.drawAxisTooltip(t,e)})})},clearCanvasFocus(){var e;const t=this;t.state.canvasFocusMainRedraw?(t.state.canvasFocusMainRedraw=!1,t.renderCanvasFrame(void 0,null,!1)):(e=t.canvasEngine)==null||e.clearOverlay()},resizeCanvas(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();n.clearResizePreview(),s.chart.style("min-height",`${a.current.height}px`),(e=n.canvasEngine)==null||e.resize(a.current.width,n.getCanvasSurfaceHeight()),(t=n.canvasTheme)==null||t.reload(o,i.canvas_theme)}};let ll=()=>(St(pe.prototype,Lp),(ll=()=>"canvas")());var cl={category(e,t){const n=this.internal,{config:i}=n;return arguments.length>1&&(i.axis_x_categories[e]=t,n.state.dirty.data=!0,n.redraw()),i.axis_x_categories[e]},categories(e){const t=this.internal,{config:n}=t;if(!e||!Array.isArray(e)){const i=n.axis_x_categories;return se(i)?Object.values(t.data.xs)[0]:i}return n.axis_x_categories=e,t.state.dirty.data=!0,t.redraw(),n.axis_x_categories}};function Rp(e){const t=this.config;let n,i,a;const s=()=>{const o=i.shift();if(o&&n&&Ut(n)&&o in n)return n=n[o],s();if(!o)return n};Object.keys(t).forEach(o=>{n=e,i=o.split("_"),a=s(),ct(a)&&(t[o]=a)}),this.api&&(this.state.orgConfig=e)}var Ep={resize(e){const t=this.internal,{config:n,state:i}=t;i.rendered&&(n.size_width=e?e.width:null,n.size_height=e?e.height:null,i.resizing=!0,i.dirty.size=!0,this.flush(!1),t.resizeFunction())},flush(e){var t,n;const i=this.internal,{state:a,$el:{zoomResetBtn:s}}=i;a.rendered?(a.resizing?(t=i.brush)==null||t.updateResize():(n=i.axis)==null||n.setOrient(),s==null||s.style("display","none"),i.scale.zoom&&(a.current.zoomDomain=i.scale.zoom.domain()),i.scale.zoom=null,a.resizing||(a.dirty.data=!0),e?i.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):i.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1}),!a.resizing&&i.brush&&(i.brush.getSelection().call(i.brush.move),i.unselectRect()),a.current.zoomDomain&&(i.api.zoom(a.current.zoomDomain),a.current.zoomDomain=null)):i.initToRender(!0)},destroy(){var e,t,n,i,a,s,o,r,l,c,d,u;const h=this.internal,{state:f,$el:{chart:g,style:p,svg:_}}=h;if(bt(h)){h.callPluginHook("$willDestroy"),(e=h.cache)==null||e.remove(["setOverOut","callOverOutForTouch"]),h.charts.splice(h.charts.indexOf(this),1),h.charts.length===0&&zf(),h.unbindAllEvents(),_==null||_.select("*").interrupt(),f.canvasFlowFrame!==null&&((n=(t=N).cancelAnimationFrame)==null||n.call(t,f.canvasFlowFrame)),f.canvasFlowFrame=null,f.canvasFlowFinish=null,f.pendingRaf!==null&&((a=(i=N).cancelAnimationFrame)==null||a.call(i,f.pendingRaf)),f.pendingRaf=null,(s=h.canvasRenderer)==null||s.destroy(),(o=h.canvasEngine)==null||o.destroy(),(r=h.resizeFunction)==null||r.clear(),(c=(l=h.resizeFunction)==null?void 0:l.clearLive)==null||c.call(l),(u=(d=h.resizeFunction)==null?void 0:d.resizeObserver)==null||u.disconnect(),h.resizeFunction&&N.removeEventListener("resize",h.resizeFunction),g.classed("bb",!1).style("position",null),f.isCanvasMode&&g.style("min-height",f.canvasInlineStyle.minHeight||null),g.selectChildren().remove(),p&&p.parentNode.removeChild(p),Object.keys(this).forEach(x=>{x==="internal"&&Object.keys(h).forEach(m=>{h[m]=null}),this[x]=null,delete this[x]});for(const x in this)this[x]=()=>{}}return null},config(e,t,n){const i=this.internal,{config:a,state:s}=i,o=e==null?void 0:e.replace(/\./g,"_");let r;return e&&o in a?ct(t)?(a[o]=t,r=t,n&&this.flush()):r=a[o]:(arguments.length===0||se(e))&&(r=s.orgConfig),r}},Pp={color(e){return this.internal.color(e)}};const ul=function(e){const{targets:t}=this.internal.data;if(!Ct(e)){const n=ot(e)?e:[e];return t.filter(i=>n.some(a=>a===i.id))}return t};St(ul,{shown:function(e){return this.internal.filterTargetsToShow(this.data(e))},values:function(e,t=!0){let n=null;if(e){const i=this.data(e);ot(i)&&(n=[],i.forEach(a=>{t?a.values.forEach(s=>n.push(s.value)):n.push(a.values.map(s=>s.value))}))}return n},names:function(e){return this.internal.updateDataAttributes("names",e)},colors:function(e){return this.internal.updateDataAttributes("colors",e)},axes:function(e){return this.internal.updateDataAttributes("axes",e)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});var Dp={data:ul},Ip={focus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n),r=new Set(o),l=n.mapToTargetIds().filter(c=>!r.has(c)&&n.isTargetToShow(c));n.revertLegend(),n.toggleFocusLegend(l,!1),n.toggleFocusLegend(o,!0),i.focusedTargetIds=r,i.defocusedTargetIds=new Set(l),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}const s=n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n)));this.revert(),this.defocus(),s.classed(lt.focused,!0).classed(lt.defocused,!1),n.hasArcType()&&!i.hasRadar&&(n.expandArc(a),n.hasType("gauge")&&n.markOverlapped(e,n,`.${ae.gaugeValue}`)),n.toggleFocusLegend(a,!0),i.focusedTargetIds=new Set(a),a.forEach(o=>i.defocusedTargetIds.delete(o))},defocus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n);n.toggleFocusLegend(o,!1),o.forEach(r=>i.focusedTargetIds.delete(r)),i.defocusedTargetIds=new Set(o),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n))).classed(lt.focused,!1).classed(lt.defocused,!0),n.hasArcType(null,["polar"])&&(n.unexpandArc(a),n.hasType("gauge")&&n.undoMarkOverlapped(n,`.${ae.gaugeValue}`)),n.toggleFocusLegend(a,!1),a.forEach(o=>i.focusedTargetIds.delete(o)),i.defocusedTargetIds=new Set(a)},revert(e){var t,n,i;const a=this.internal,{config:s,state:o,$el:r}=a,l=a.mapToTargetIds(e),c=()=>{s.legend_show&&(a.showLegend(l.filter(a.isLegendToShow.bind(a))),r.legend.selectAll(a.selectorLegends(l)).filter(function(){return(0,F.select)(this).classed(lt.legendItemFocused)}).classed(lt.legendItemFocused,!1))};if(o.isCanvasMode){const u=!!((t=o.focusedTargetIds)!=null&&t.size)||!!((n=o.defocusedTargetIds)!=null&&n.size);c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set,u&&((i=a.renderCanvasFrame)==null||i.call(a,void 0,null,!1));return}r.svg.selectAll(a.selectorTargets(l)).classed(lt.focused,!1).classed(lt.defocused,!1),a.hasArcType(null,["polar"])&&a.unexpandArc(l),c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set}},Mp={legend:{show:function(e){const t=this.internal;t.showLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})},hide:function(e){const t=this.internal;t.hideLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})}}},Fp={load(e){const t=this.internal,{config:n}=t;t.state.dirty.data=!0,t.state._eventRectFingerprint=null,e.xs&&t.addXs(e.xs),"names"in e&&this.data.names(e.names),"classes"in e&&Object.keys(e.classes).forEach(s=>{n.data_classes[s]=e.classes[s]}),"categories"in e&&t.axis.isCategorized()&&(n.axis_x_categories=e.categories),"axes"in e&&Object.keys(e.axes).forEach(s=>{n.data_axes[s]=e.axes[s]}),"colors"in e&&Object.keys(e.colors).forEach(s=>{n.data_colors[s]=e.colors[s]}),"regions"in e&&(n.data_regions=e.regions||{});const i=["data","columns","rows","json","url"].some(s=>s in e),a="unload"in e&&e.unload!==!1;if("regions"in e&&!i&&!a){t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),Li.call(t,e.done,e.resizeAfter);return}if(a){const s=t.mapToTargetIds(e.unload===!0?null:e.unload);t.unload(s,()=>{!t.config||!t.cache||(t.cache.remove(s),Ts(()=>t.loadFromArgs(e)))})}else t.loadFromArgs(e)},unload(e){const t=this.internal;let n=e||{};se(n)&&this.tooltip.hide(),ot(n)?n={ids:n}:Q(n)&&(n={ids:[n]});const i=t.mapToTargetIds(n.ids);t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.unload(i,()=>{!t.config||!t.cache||(t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.cache.remove(i),Li.call(t,n.done,n.resizeAfter))})}};function Oi(e,t,n,i=!1){var a;const s=this.internal,o=s.mapToTargetIds(t),r=new Set(o),l=[...s.state.hiddenTargetIds].filter(u=>r.has(u));if(s.state.toggling=!0,s.state.dirty.visibility=!0,s[`${e?"remove":"add"}HiddenTargetIds`](o),s.state.isCanvasMode){e&&l.length?H(s.config.data_onshown,this,l):!e&&l.length===0&&H((a=s.config)==null?void 0:a.data_onhidden,this,o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1;return}const c=s.$el.svg.selectAll(s.selectorTargets(o)),d=e?null:"0";e&&l.length&&(c.style("display",null),H(s.config.data_onshown,this,l)),s.$T(c).style("opacity",d,"important").call(ri,()=>{var u;!e&&l.length===0&&(c.style("display","none"),H((u=s.config)==null?void 0:u.data_onhidden,this,o)),c.style("opacity",d)}),n.withLegend&&s[`${e?"show":"hide"}Legend`](o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1}var Op={show(e,t={}){Oi.call(this,!0,e,t)},hide(e,t={}){Oi.call(this,!1,e,t)},toggle(e,t={}){const n=this.internal,i={show:[],hide:[]};n.mapToTargetIds(e).forEach(a=>i[n.isTargetToShow(a)?"hide":"show"].push(a)),i.show.length&&i.hide.length?(Oi.call(this,!0,i.show,t,!0),Oi.call(this,!1,i.hide,t)):(i.show.length&&this.show(i.show,t),i.hide.length&&this.hide(i.hide,t))}},$p={tooltip:{show:function(e){var t,n,i,a,s,o,r,l,c,d,u,h;const f=this.internal,{$el:g,config:p,state:{eventReceiver:_,hasFunnel:x,hasTreemap:m,inputType:b}}=f;let v,y;if(e.mouse&&(y=e.mouse),e.data){const{data:T}=e,w=(t=f.getYScaleById(T.id))==null?void 0:t(T.value);if((x||m)&&T.id){const C=f.selectorTarget(T.id,void 0,`.${kt.shape}`);_.rect=g.main.select(C)}else f.isMultipleX()?y=[f.xx(T),w]:(p.tooltip_grouped||(y=[0,w]),v=(i=T.index)!=null?i:f.hasArcType()&&T.id?(n=f.getArcElementByIdOrIndex(T.id))==null?void 0:n.datum().index:f.getIndexByX(T.x))}else ct(e.x)?v=f.getIndexByX(e.x):ct(e.index)&&(v=e.index);if(f.state.isCanvasMode){const T=((a=f.filterTargetsToShow)==null?void 0:a.call(f))||f.data.targets,w=(s=e.data)!=null&&s.id&&!p.tooltip_grouped?T.filter(L=>L.id===e.data.id).map(L=>L.values[v!=null?v:e.data.index]).filter(Boolean):T.map(L=>L.values[v]).filter(Boolean),C=(r=(o=g.canvas)==null?void 0:o.node)==null?void 0:r.call(o),A=f.state.canvasShape||((l=f.getDrawShape)==null?void 0:l.call(f)),S=w[0],k=y||(S&&((c=A==null?void 0:A.pos)!=null&&c.cx)&&((d=A==null?void 0:A.pos)!=null&&d.cy)?[f.state.margin.left+A.pos.cx(S),f.state.margin.top+A.pos.cy(S)]:void 0);if(!w.length||!C)return;f.state.canvasFocusKey=w.map(L=>`${L.id}:${L.index}`).join("|"),(u=f.renderCanvasFocus)==null||u.call(f,w,k),(h=f.showTooltip)==null||h.call(f,w,C);return}(b==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(T=>{f.dispatchEvent(T,v,y)})},hide:function(){var e,t,n,i,a;const s=this.internal,{state:{inputType:o,isCanvasMode:r},$el:{tooltip:l}}=s,c=l==null?void 0:l.datum();if(r){s.state.canvasFocusKey=null,s.hideTooltip(!0),(e=s.clearCanvasFocus)==null||e.call(s);return}if((t=c==null?void 0:c.data)!=null&&t[0]){const{index:d}=c.data[0];(o==="mouse"?["mouseout"]:["touchend"]).forEach(u=>{s.dispatchEvent(u,d)})}o==="touch"&&s.callOverOutForTouch(),s.hideTooltip(!0),(n=s.hideGridFocus)==null||n.call(s),(i=s.unexpandCircles)==null||i.call(s),(a=s.expandBarTypeShapes)==null||a.call(s,!1)}}},Bp=Object.defineProperty,zp=(e,t,n)=>t in e?Bp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dl=(e,t,n)=>zp(e,typeof t!="symbol"?t+"":t,n);class Yt{constructor(t){dl(this,"plugins",[]),dl(this,"internal");const n=new pe(this);this.internal=n,(function i(a,s,o){Object.keys(a).forEach(r=>{const l=z(a[r]),c=s!==o,d=bt(a[r]),u=d&&Object.keys(a[r]).length>0;l&&(!c&&u||c)?s[r]=a[r].bind(o):d&&!l?s[r]={}:s[r]=a[r],u&&i(a[r],s[r],o)})})(Yt.prototype,this,this),Rp.call(n,t),n.beforeInit(),n.init()}}St(Yt.prototype,[Ep,Pp,Dp,Ip,Mp,Fp,Op,$p]);let hl=()=>(Yt.prototype.category=cl.category,Yt.prototype.categories=cl.categories,(hl=()=>({}))());const Np=e=>{var t,n;return(n=(t=N).btoa)==null?void 0:n.call(t,encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(i,a)=>String.fromCharCode(+`0x${a}`)))};function Xp(e,t,n){const{width:i,height:a}=t||n,s=new XMLSerializer,o=e.cloneNode(!0),r=Cf(nn(nt.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",F.namespaces.xhtml),o.style.margin="0",o.style.padding="0",t.preserveFontStyle&&o.querySelectorAll("text").forEach(h=>{h.innerHTML=""});const l=s.serializeToString(o),c=nt.createElement("style");c.appendChild(nt.createTextNode(r.join(`
31
- `)));const d=s.serializeToString(c),u=`<svg xmlns="${F.namespaces.svg}" width="${i}" height="${a}"
29
+ </tbody></table>`).replace(P_,"").split(R_)},setTooltipPosition(e,t){var n,a;const i=this,{config:s,scale:o,state:r,$el:{eventRect:l,tooltip:c,svg:u}}=i,{bindto:d}=s.tooltip_contents,h=s.axis_rotated,f=c==null?void 0:c.datum();if(!d&&f){const p=e!=null?e:f.data,[g,_]=se(r.event,t!=null?t:l==null?void 0:l.node()),x={x:g,y:_};if(r.hasAxis&&o.x&&f&&"x"in f){const T=(k=0,w,y="y")=>{var C;const A=o[w?(C=i.axis)==null?void 0:C.getId(w):y];return A?A(k)+(h?r.margin.left:r.margin.top):0};x.xAxis=o.x(f.x)+(s.tooltip_position?h?r.margin.top:r.margin.left:0),p.length===1?x.yAxis=T(p[0].value,p[0].id):x.yAxis=T}const{width:m=0,height:v=0}=f,b=(a=(n=s.tooltip_position)==null?void 0:n.bind(i.api)(p,m,v,l==null?void 0:l.node(),x))!=null?a:u&&ns(u)?i.getTooltipPositionViewBox.bind(i)(m,v,x):i.getTooltipPosition.bind(i)(m,v,x);["top","left"].forEach(T=>{const k=b[T];c.style(T,`${k}px`),T==="left"&&!f.xPosInPercent&&(f.xPosInPercent=k/r.current.width*100)})}},getTooltipPositionViewBox(e,t,n){var a,i;const s=this,{$el:{eventRect:o,svg:r},config:l,state:c}=s,u=l.axis_rotated,d=s.hasArcType()||c.customType||c.hasTreemap,h=(i=(a=d?r:o)==null?void 0:a.node())!=null?i:c.event.target;let{x:f,y:p}=n;c.hasAxis&&(f=u?f:n.xAxis,p=u?n.xAxis:p);const g=ua(h,f,p,!1),_=mt(h),x=ua(h,20,0,!1).x,m=ua(h,ga,0,!1).x;let v=g.y,b=g.x+e/2+x;return d&&(c.customType||c.hasTreemap||c.hasRadar?(b-=e/2+x,v+=m):(v+=_.height/2,b+=_.width/2-(e-x))),b+e>_.width&&(b=_.width-e-x),v+t>_.height&&(v-=d&&(c.customType||c.hasTreemap||c.hasRadar)?t+m*2:t*2),{top:v,left:b}},getTooltipPosition(e,t,n){var a,i,s;const o=this,{config:r,scale:l,state:c}=o,{width:u,height:d,current:h,customType:f,hasRadar:p,hasTreemap:g,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,v=r.axis_rotated,b=o.hasArcType(),T=c.isCanvasMode?0:o.getSvgLeft(!0);let k=T+h.width-o.getCurrentPaddingByDirection("right");const w=20;let{x:y,y:C}=n;if(p)y+=y>=u/2?15:-(e+15),C+=15;else if(b){if(x!=="touch"){let L=(i=(a=o.getTitlePadding)==null?void 0:a.call(o))!=null?i:0;L&&m&&((s=r.arc_rangeText_values)!=null&&s.length)&&(L+=10),y+=(u-(_?o.getLegendWidth():0))/2,C+=(m?d:d/2)+L+ga}}else if(f||g)C+=ga;else{const S={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};v?(y+=T+S.left+w,C=S.top+n.xAxis+w,k-=T):(y=T+S.left+w+(l.zoom?y:n.xAxis),C+=S.top-5)}y+e+15>k&&(y-=e+(f||g||b?0:v?w*2:38)),C+t>h.height&&(C-=m?t*1.5+ga:t+ga*2);const A={top:C,left:y};return A.top<0&&(A.top=0),A.left<0&&(A.left=0),A},showTooltip(e,t){const n=this,{config:a,$el:{tooltip:i}}=n;if(!i||!a.tooltip_show)return;let s=null,o=0,r=`${n.data.targets.length}:`,l;for(let d=0;d<e.length;d++){const h=e[d];d>0&&(r+=","),r+=`${h==null?void 0:h.index}|${h==null?void 0:h.id}|${h==null?void 0:h.value}`,!l&&h&&(l=h),h&&nt(n.getBaseValue(h))?(o++,s==null||s.push(h)):s||(s=e.slice(0,d))}if(o===0||!l)return;const c=i.datum();let u=s;if(!c||c.current!==r){const{index:d,x:h}=l;u||(u=e.slice()),q(a.tooltip_onshow,n.api,e),i.html(n.getTooltipHTML(e,n.axis?n.axis.getXAxisTickFormat():n.categoryName.bind(n),n.getDefaultValueFormat(),n.color)).style("display",null).style("visibility",null),i.datum({index:d,x:h,current:r,data:e,width:i.property("offsetWidth"),height:i.property("offsetHeight")}),q(a.tooltip_onshown,n.api,e),n._handleLinkedCharts(!0,d)}n.setTooltipPosition(u||e,t)},bindTooltipResizePos(){const e=this,{resizeFunction:t,state:n,$el:{tooltip:a}}=e;t.add(()=>{if(a.style("display")==="block"){const{current:i}=n,{width:s,xPosInPercent:o}=a.datum();let r=i.width/100*o;const l=i.width-(r+s);l<0&&(r+=l),a.style("left",`${r}px`)}})},hideTooltip(e){var t;const n=this,{api:a,config:i,$el:{tooltip:s}}=n;if(s&&s.style("display")!=="none"&&(!i.tooltip_doNotHide||e)){const o=(t=s.datum().data)!=null?t:[];q(i.tooltip_onhide,a,o),s.style("display","none").datum(null),q(i.tooltip_onhidden,a,o)}},_handleLinkedCharts(e,t){const n=this,{charts:a,config:i,state:{event:s}}=n;if(s!=null&&s.isTrusted&&i.tooltip_linked&&a.length>1){const o=i.tooltip_linked_name;a.filter(r=>r!==n.api).forEach(r=>{var l,c;const{config:u,$el:d,state:h}=r.internal,f=u.tooltip_linked,p=u.tooltip_linked_name,g=rt.body.contains(d.chart.node());if(f&&o===p&&g){const _=d.tooltip.data()[0],x=t!==(_==null?void 0:_.index);try{e&&x&&h.isCanvasMode?(c=(l=r.internal).showCanvasLinkedTooltip)==null||c.call(l,t):r.tooltip[e&&x?"show":"hide"]({index:t})}catch(m){}}})}},updateTooltipOnRedraw(e,t){var n;const a=this,{config:i,$el:{eventRect:s,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:u,hasTreemap:d}}=a;if(!(a.state.isCanvasMode||a.state.flowing)&&(r==null?void 0:r.style("display"))==="block"&&l){const h=e!=null?e:(n=u?o:s)==null?void 0:n.node();if(c||u)if(a.isMultipleX())a.selectRectForMultipleXs(h,!1);else{const f=t!=null?t:a.getDataIndexFromEvent(l);t===-1?a.api.tooltip.hide():(a.selectRectForSingle(h,f),a.setExpand(f,null,!0))}else{const{clientX:f,clientY:p}=l;setTimeout(()=>{let g=[f,p].every(Number.isFinite)&&rt.elementFromPoint(f,p);const _=g&&(0,B.select)(g).datum();if(_){const x=a.hasArcType()?a.convertToArcData(a.updateAngle(_)):_==null?void 0:_.data;d&&(g=o.node()),x&&a.showTooltip([x],g)}else a.api.tooltip.hide()},i.transition_duration)}}}},M_={getTranslate(e,t=0){var n;const a=this,{config:i,state:s}=a,o=i.axis_rotated;let r=0,l,c;if(t&&/^(x|y2?)$/.test(e)&&(r=a.getAxisSize(e)*t),e==="main")l=Sn(s.margin.left),c=Sn(s.margin.top);else if(e==="context")l=Sn(s.margin2.left),c=Sn(s.margin2.top);else if(e==="legend")l=s.margin3.left,c=s.margin3.top;else if(e==="x")l=o?-r:0,c=o?0:s.height+r;else if(e==="y")l=o?0:-r,c=o?s.height+r:0;else if(e==="y2")l=o?0:s.width+r,c=o?-r-1:0;else if(e==="subX")l=0,c=o?0:s.height2;else if(e==="subY")l=0,c=o?s.height2:0;else if(e==="subY2")l=o?0:s.width2,c=o?-1:0;else if(e==="arc")l=s.arcWidth/2,c=s.arcHeight/2,(n=i.arc_rangeText_values)!=null&&n.length&&(c+=5+(a.hasType("gauge")&&i.title_text?10:0));else if(e==="polar")l=s.arcWidth/2,c=s.arcHeight/2;else if(e==="radar"){const[u,d]=a.getRadarSize();l=s.width/2-u,c=s.height/2-d}return`translate(${l}, ${c})`},transformMain(e,t){const n=this,{$el:{main:a},$T:i}=n,s=t!=null&&t.axisX?t.axisX:i(a.select(`.${Ft.axisX}`),e),o=t!=null&&t.axisY?t.axisY:i(a.select(`.${Ft.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:i(a.select(`.${Ft.axisY2}`),e);i(a,e).attr("transform",n.getTranslate("main")),s.attr("transform",n.getTranslate("x")),o.attr("transform",n.getTranslate("y")),r.attr("transform",n.getTranslate("y2")),a.select(`.${ct.chartArcs}`).attr("transform",n.getTranslate("arc"))},transformAll(e,t){const n=this,{config:a,state:{customType:i,hasAxis:s,hasTreemap:o,isCanvasMode:r},$el:l}=n;r||(!i&&!o&&n.transformMain(e,t),s&&a.subchart_show&&n.transformContext(e,t),l.legend&&n.transformLegend(e))}};const D_=new Set(["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"]);var O_={isValidChartType(e){var t;return!!(e&&(Object.values(X).indexOf(e)>-1||e===this.state.customType||(t=this.axisTypes)!=null&&t[e]))},getAxisTypes(){return Object.keys(this.axisTypes||{})},getAxisTypeParts(){return Object.values(this.axisTypes||{})},hasAxisTypePadding(){const e=this.axisTypes;return!!e&&Object.keys(e).some(t=>e[t].padded&&this.hasType(t))},getAxisTypeHooks(e){const t=this.axisTypes;if(t){for(const n in t)if(this.isTypeOf(e,n))return t[n]}},getSubchartTargetType(e){const t=this,{config:n}=t,a=st(e)?e:e==null?void 0:e.id,i=n.subchart_types||{},s=n.subchart_type,o=n.data_types||{},r=a&&i[a];return r&&t.isValidChartType(r)?r:s&&t.isValidChartType(s)?s:a&&o[a]||n.data_type||X.LINE},getTargetType(e){var t;const{config:n}=this,a=st(e)?e:e==null?void 0:e.id;return a&&((t=n.data_types)==null?void 0:t[a])||n.data_type||X.LINE},getSubchartSourceTargetType(e){const{state:t}=this,n=st(e)?e:e==null?void 0:e.id,a=t.subchartSourceTypes;return n&&(a==null?void 0:a[n])||this.getTargetType(e)},isSubchartSourceTypeOf(e,t){const n=this.getSubchartSourceTargetType(e);return et(t)?t.indexOf(n)>=0:n===t},withSubchartTypeContext(e){const t=this,{config:n,data:a,state:i}=t,s=n.data_type,o=n.data_types,r=i.current.types,l=i.subchartSourceTypes,c={},u={},d=n.subchart_type;t.mapToIds(a.targets).forEach(h=>{u[h]=t.getTargetType(h),c[h]=t.getSubchartTargetType(h)}),n.data_type=d&&t.isValidChartType(d)?d:s,n.data_types=c,i.current.types=[],i.subchartSourceTypes=u;try{return e()}finally{n.data_type=s,n.data_types=o,i.current.types=r,i.subchartSourceTypes=l}},setTargetType(e,t){const n=this,{config:a,state:{withoutFadeIn:i}}=n;n.mapToTargetIds(e).forEach(s=>{i[s]=t===a.data_types[s],a.data_types[s]=t}),e||(a.data_type=t)},updateTypesElements(){const e=this,{state:{current:t,customType:n}}=e,a=Object.values(X);n&&a.push(n),a.forEach(i=>{const s=e.hasType(i,null,!0),o=t.types.indexOf(i);o===-1&&s?t.types.push(i):o>-1&&!s&&t.types.splice(o,1)}),e.setChartElements()},hasType(e,t,n=!1){var a;const i=this,{config:s,state:{current:o}}=i,r=s.data_types,l=t||i.data.targets;return!n&&((a=o.types)==null?void 0:a.indexOf(e))>-1?!0:l!=null&&l.length?l.some(c=>{const u=r[c.id];return u===e||!u&&e==="line"}):Object.keys(r).length?Object.values(r).some(c=>c===e):s.data_type===e},hasTypeOf(e,t,n=[]){return e in Te?!Te[e].filter(a=>n.indexOf(a)===-1).every(a=>!this.hasType(a,t)):!1},isTypeOf(e,t){const n=st(e)?e:e.id,a=this.config&&this.getTargetType(n);return et(t)?t.indexOf(a)>=0:a===t},hasPointType(){const e=this;return e.hasTypeOf("Line")||e.hasType("bubble")||e.hasType("scatter")},hasArcType(e,t){return this.hasTypeOf("Arc",e,t)},hasMultiArcGauge(){return this.hasType("gauge")&&this.config.gauge_type==="multi"},isLineType(e){const t=st(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,Te.Line)},isStepType(e){return this.isTypeOf(e,Te.Step)},isSplineType(e){return this.isTypeOf(e,Te.Spline)},isAreaType(e){return this.isTypeOf(e,Te.Area)},isAreaRangeType(e){return this.isTypeOf(e,Te.AreaRange)},isBarType(e){return this.isTypeOf(e,"bar")},isBubbleType(e){return this.isTypeOf(e,"bubble")},getCustomType(){const e=this.customTypes;return e&&Object.keys(e).find(t=>this.hasType(t))||null},getCustomTypeParts(){var e;const{customType:t}=this.state;return t?(e=this.customTypes)==null?void 0:e[t]:void 0},getCustomTypeHooks(e){var t,n;const{customType:a}=this.state;return a&&this.isTypeOf(e,a)&&(n=(t=this.getCustomTypeParts())==null?void 0:t.hooks)!=null?n:null},isCandlestickType(e){return this.isTypeOf(e,"candlestick")},isScatterType(e){return this.isTypeOf(e,"scatter")},isTreemapType(e){return this.isTypeOf(e,"treemap")},isPieType(e){return this.isTypeOf(e,"pie")},isGaugeType(e){return this.isTypeOf(e,"gauge")},isDonutType(e){return this.isTypeOf(e,"donut")},isPolarType(e){return this.isTypeOf(e,"polar")},isRadarType(e){return this.isTypeOf(e,"radar")},isArcType(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)||this.isPolarType(e)||this.isRadarType(e)},isCirclePoint(e){const{config:t}=this,n=t.point_pattern;return(e==null?void 0:e.tagName)==="circle"||t.point_type==="circle"&&(!n||et(n)&&n.length===0)},lineData(e){return this.isLineType(e)?[e]:[]},arcData(e){return this.isArcType(e.data)?[e]:[]},labelishData(e){var t,n;const a=this.getCustomTypeHooks(e);return a?(n=(t=a.labelData)==null?void 0:t.call(a,this,e))!=null?n:[]:this.isBarType(e)||this.isLineType(e)||this.isScatterType(e)||this.isBubbleType(e)||this.isCandlestickType(e)||this.isRadarType(e)||this.isTreemapType(e)?e.values.filter(i=>N(i.value)||!!i.value):[]},barLineBubbleData(e){return this.isBarType(e)||this.isLineType(e)||this.isBubbleType(e)?e.values:[]},isInterpolationType(e){return D_.has(e)}};const $_={basis:bt.curveBasis,"basis-closed":bt.curveBasisClosed,"basis-open":bt.curveBasisOpen,bundle:bt.curveBundle,cardinal:bt.curveCardinal,"cardinal-closed":bt.curveCardinalClosed,"cardinal-open":bt.curveCardinalOpen,"catmull-rom":bt.curveCatmullRom,"catmull-rom-closed":bt.curveCatmullRomClosed,"catmull-rom-open":bt.curveCatmullRomOpen,"monotone-x":bt.curveMonotoneX,"monotone-y":bt.curveMonotoneY,natural:bt.curveNatural,"linear-closed":bt.curveLinearClosed,linear:bt.curveLinear,step:bt.curveStep,"step-after":bt.curveStepAfter,"step-before":bt.curveStepBefore};function ds(e,t){var n,a;return e.isLineType(t)||((n=e.isScatterType)==null?void 0:n.call(e,t))||((a=e.isBubbleType)==null?void 0:a.call(e,t))}function Tl(e){return t=>ds(e,t)}function hs(e,t,n){var a,i,s;const o=n?Ua(e,t,n):void 0;return N(o)?o:(a=e.isCandlestickType)!=null&&a.call(e,t)?(s=(i=e.getCandlestickData)==null?void 0:i.call(e,t))==null?void 0:s.close:e.getBaseValue(t)}function Ua(e,t,n){var a,i,s;if(!n||(a=e.isCandlestickType)!=null&&a.call(e,t)||!((i=e.isSubchartSourceTypeOf)!=null&&i.call(e,t,X.CANDLESTICK)))return;const o=(s=e.getCandlestickData)==null?void 0:s.call(e,t);if(o)return e.isBarType(t)?N(o.volume)?o.volume:N(o.open)&&N(o.close)?o._isUp?o.close:o.open:void 0:N(o.close)?o.close:void 0}function wl(e,t,n){const a=Ua(e,t,n);return N(a)&&e.isBarType(t)}function F_(e,t,n){var a;if(!wl(e,t,n))return null;const i=(a=e.getCandlestickData)==null?void 0:a.call(e,t);if(i!=null&&i._isUp)return e.color(t);const s=e.config.candlestick_color_down;return(s&&typeof s=="object"?s[t.id]:s)||e.color(t)}function I_(e){var t,n;const a=this;let i;if(ds(a,e)){const s=Tl(a);i=a.generateGetLinePoints(a.getShapeIndices(s),!1,s)}else a.isBarType(e)?i=a.generateGetBarPoints(a.getShapeIndices(a.isBarType)):(t=a.isCandlestickType)!=null&&t.call(a,e)&&(i=(n=a.generateGetCandlestickPoints)==null?void 0:n.call(a,a.getShapeIndices(a.isCandlestickType)));return i}function kl(e,t,n){return this.config[t]?this.getGradienColortUrl(e.id):n(e)}function Cl(e){const{$el:t}=this,{elKey:n,className:a,cssRules:i,position:s}=e,o=t.main.select(`.${H.chart}`);t[n]=s==="first"?o.insert("g",":first-child"):o.append("g"),t[n].attr("class",a),i!=null&&i.length&&t[n].call(this.setCssRule(!1,`.${a}`,i))}function fs(e,t){const n=this,{$el:a}=n,{type:i,elKey:s,containerClass:o,itemClass:r,initFn:l,withFocus:c=!0,withStyles:u=!0}=t;a[s]||l.call(n);const d=n.getChartClass(i),h=c?n.classFocus.bind(n):()=>"",p=a.main.select(`.${o}`).selectAll(`.${r}`).data(n.filterNullish(e)).attr("class",g=>d(g)+h(g)).enter().append("g").attr("class",d);return u&&p.style("opacity","0").style("pointer-events",n.getStylePropValue("none")),p}var B_={getDrawShape(){const e=this,t=e.config.axis_rotated,{hasRadar:n,hasTreemap:a}=e.state,i={type:{},indices:{},pos:{}};if(!a&&["bar","candlestick","line","area",...e.getAxisTypes()].forEach(s=>{const o=Mt(s);if(e.hasType(s)||e.hasTypeOf(o)||s==="line"&&(e.hasType("bubble")||e.hasType("scatter"))){const r=e.getShapeIndices(e[`is${o}Type`]),l=e[`generateDraw${o}`];i.indices[s]=r,i.type[s]=l?l.bind(e)(r,!1):void 0}}),!e.hasArcType()||n||a){let s,o,r,l;a||(s=n?e.radarCircleX:t?e.circleY:e.circleX,o=n?e.radarCircleY:t?e.circleX:e.circleY),a&&e.state.isCanvasMode?r=l=function(){}:(r=e.generateXYForText(i.indices,!0),l=e.generateXYForText(i.indices,!1)),i.pos={xForText:r,yForText:l,cx:(s||function(){}).bind(e),cy:(o||function(){}).bind(e)}}return i},getShapeIndices(e){const t=this,{config:n}=t,a=n.data_xs,i=St(a),s={};let o=i?{}:0;return i&&bi(Object.keys(a).map(r=>a[r])).forEach(r=>{o[r]=0,s[r]={}}),t.filterTargetsToShow(t.data.targets.filter(e,t)).forEach(r=>{var l;const c=r.id in a?a[r.id]:"",u=c?s[c]:s;for(let d=0,h;h=n.data_groups[d];d++)if(!(h.indexOf(r.id)<0))for(let f=0,p;p=h[f];f++){if(p in u){u[r.id]=u[p];break}r.id!==p&&c&&(u[p]=(l=u[r.id])!=null?l:o[c])}Ct(u[r.id])&&(u[r.id]=c?o[c]++:o++,u.__max__=(c?o[c]:o)-1)}),s},getIndices(e,t,n){const a=this,{data_xs:i,bar_indices_removeNull:s}=a.config,{id:o,index:r}=t;if(a.isBarType(o)&&s){const l={};return a.getAllValuesOnIndex(r,!0).forEach((c,u)=>{l[c.id]=u,l.__max__=u}),l}return St(i)?e[i[o]]:e},getIndicesMax(e){if(!St(this.config.data_xs))return e.__max__;let t=0;for(const n in e)t+=e[n].__max__||0;return t},getShapeX(e,t,n){const a=this,{config:i,scale:s}=a,o=n?s.subX:s.zoom||s.x,r=i.bar_overlap,l=i.bar_padding,c=(h,f)=>h+f,u=ne(e)&&(e._$total.length?e._$total.reduce(c)/2:0),d=[];if(u&&ne(e)&&e._$total.length){let h=0;for(const f of e._$total)h+=f,d.push(h)}return h=>{var f;const p=a.getIndices(t,h,"getShapeX"),g=h.id in p?p[h.id]:0,_=(p.__max__||0)+1;let x=0;if(St(h.x)){const m=o(h.x,!0);if(u){const v=e[h.id]||e._$width;x=r?m-v/2:m-v+((f=d[g])!=null?f:e._$total.slice(0,g+1).reduce(c))-u}else x=m-(N(e)?e:e._$width)*(_/2-(r?1:g))}return e&&x&&_>1&&l&&(g&&(x+=l*g),_>2?x-=(_-1)*l/2:_===2&&(x-=l/2)),x}},getShapeY(e){const t=this,n=t.isStackNormalized();return a=>{let{value:i}=a;const s=e?Ua(t,a,e):void 0;return N(a)?i=a:N(s)?i=s:t.isAreaRangeType(a)?i=t.getBaseValue(a,"mid"):n?i=t.getRatio("index",a,!0):t.isBubbleZType(a)?i=t.getBubbleZData(a.value,"y"):t.isBarRangeType(a)&&(i=i[1]),t.getYScaleById(a.id,e)(i)}},getShapeYMin(e,t=!1){const n=this,a=n.axis.getId(e),i=n.getYScaleById(e,t),[s]=i.domain(),o=n.config[`axis_${a}_inverted`];return!n.isGrouped(e)&&!o&&s>0?s:0},getShapeOffsetData(e,t){const n=this,a=n.orderTargets(n.filterTargetsToShow(n.data.targets.filter(e,n))),i=n.state.dataGeneration,s=a.map(h=>h.id).join("_"),o=`${Z.shapeOffset}_${t?"sub":"main"}_${s}`,r=n.cache.get(o);if((r==null?void 0:r.generation)===i)return r;const l=n.isStackNormalized(),c=a.map(h=>{let f=h.values;const p={};n.isStepType(h)&&(f=n.convertValuesToStep(f));const g=f.reduce((_,x)=>{const m=Number(x.x),v=hs(n,x,t);return _[m]=x,p[m]=l?n.getRatio("index",x,!0):v,_},{});return{id:h.id,rowValues:f,rowValueMapByXValue:g,values:p}}),u=a.reduce((h,{id:f},p)=>(h[f]=p,h),{}),d={generation:i,indexMapByTargetId:u,shapeOffsetTargets:c};return n.cache.add(o,d),d},getShapeOffset(e,t,n){const a=this,{shapeOffsetTargets:i,indexMapByTargetId:s}=a.getShapeOffsetData(e,n),o=a.config.data_groupsZeroAs;let r=null;if(!a.config.bar_indices_removeNull){r=new Map;for(const l of i){const c=a.getIndices(t,{id:l.id,index:0});r.set(l.id,i.filter(u=>u.id!==l.id&&c[u.id]===c[l.id]))}}return(l,c)=>{var u;const{id:d,value:h,x:f}=l,p=hs(a,l,n),g=a.getIndices(t,l),_=a.getYScaleById(d,n);if(a.isBarRangeType(l))return _(h[0]);const x=Number(f),m=_(o==="zero"?0:a.getShapeYMin(d,n));let v=m;const b=(u=r==null?void 0:r.get(d))!=null?u:i.filter(T=>T.id!==d&&g[T.id]===g[d]);for(const T of b){const{id:k,rowValueMapByXValue:w,rowValues:y,values:C}=T;if(s[k]<s[d]){const A=C[x];let S=y[c];(!S||Number(S.x)!==x)&&(S=w[x]);const L=S&&hs(a,S,n);N(L)&&N(p)&&L*p>=0&&N(A)&&(p!==0||o==="positive"&&A>0||o==="negative"&&A<0)&&(v+=_(A)-m)}}return v}},generateGetLinePoints(e,t,n){const a=this,{config:i}=a,s=a.getShapeX(0,e,t),o=a.getShapeY(t),r=a.getShapeOffset(n||a.isLineType,e,t),l=a.getYScaleById.bind(a),c=new Map;return(u,d)=>{let h=c.get(u.id);h===void 0&&(h=l.call(a,u.id,t)(a.getShapeYMin(u.id,t)),c.set(u.id,h));const f=r(u,d)||h,p=s(u);let g=o(u);i.axis_rotated&&(u.value>0&&g<h||u.value<0&&h<g)&&(g=h);const _=[p,g-(h-f)];return[_,_,_,_]}},generateGetAreaPoints(e,t){const n=this,{config:a}=n,i=n.getShapeX(0,e,t),s=n.getShapeY(!!t),o=n.getShapeOffset(n.isAreaType,e,t),r=n.getYScaleById.bind(n),l=new Map;return function(c,u){let d=l.get(c.id);d===void 0&&(d=r.call(n,c.id,t)(n.getShapeYMin(c.id,t)),l.set(c.id,d));const h=o(c,u)||d,f=i(c),p=c.value;let g=s(c);return a.axis_rotated&&(p>0&&g<d||p<0&&d<g)&&(g=d),[[f,h],[f,g-(d-h)],[f,g-(d-h)],[f,h]]}},generateGetBarPoints(e,t){const n=this,{config:a}=n,i=t?n.axis.subX:n.axis.x,s=n.getIndicesMax(e)+1,o=n.getBarW("bar",i,s),r=n.getShapeX(o,e,!!t),l=n.getShapeY(!!t),c=n.getShapeOffset(n.isBarType,e,!!t),u=n.getYScaleById.bind(n),d=new Map;return(h,f)=>{const{id:p}=h;let g=d.get(p);g||(g={y0:u.call(n,p,t)(n.getShapeYMin(p,t)),isInverted:a[`axis_${n.axis.getId(p)}_inverted`]},d.set(p,g));const{y0:_,isInverted:x}=g,m=c(h,f)||_,v=N(o)?o:o[h.id]||o._$width,b=h.value,T=r(h);let k=l(h);a.axis_rotated&&!x&&(b>0&&k<_||b<0&&_<k)&&(k=_),n.isBarRangeType(h)||(k-=_-m);const w=T+v;return[[T,m],[T,k],[w,k],[w,m]]}},circleY(e,t){const n=this,a=e.id;let i;return n.isGrouped(a)&&(i=I_.bind(n)(e)),i?i(e,t)[0][1]:n.getYScaleById(a)(n.getBaseValue(e))},circleX(e){return this.xx(e)},updateCircleY(e=!1){const t=this,n=Tl(t),a=t.generateGetLinePoints(t.getShapeIndices(n),e,n),i=t.getShapeY(e);return(s,o)=>{const r=s.id;return t.isGrouped(r)&&ds(t,s)?a(s,o)[0][1]:i(s)}},getSubchartCandlestickShapeValue(e,t){return Ua(this,e,t)},isSubchartCandlestickBarValue(e,t){return wl(this,e,t)},getSubchartCandlestickBarColor(e,t){return F_(this,e,t)},pointR(e){const t=this,{config:n}=t,a=n.point_r;let i=a;return t.isBubbleType(e)?i=t.getBubbleR(e):G(a)&&(i=a.bind(t.api)(e)),e.r=i,i},pointExpandedR(e){const t=this,{config:n}=t,a=t.isBubbleType(e)?1.15:1.75;return n.point_focus_expand_enabled?n.point_focus_expand_r||t.pointR(e)*a:t.pointR(e)},pointSelectR(e){const t=this,n=t.config.point_select_r;return G(n)?n(e):n||t.pointR(e)*4},isPointFocusOnly(){const e=this;return e.config.point_focus_only&&!e.hasType("bubble")&&!e.hasType("scatter")&&!e.hasArcType(null,["radar"])},getPointSensitivity(e){const t=this;let n=t.config.point_sensitivity;if(e)G(n)?n=n.call(t.api,e):n==="radius"&&(n=e.r);else return n;return n},getBarW(e,t,n){var a,i,s,o;const r=this,{config:l,org:c,scale:u,state:d}=r,h=r.getMaxDataCount(),f=e==="bar"&&((a=l.data_groups)==null?void 0:a.length),p=`${e}_width`,g=[(i=l.axis_x_min)!=null?i:c.xDomain[0],(s=l.axis_x_max)!=null?s:c.xDomain[1]].map(k=>r.axis.isTimeSeries()?Zt.call(r,k):Number(k));let _=t.tickInterval(h);const x=(o=u.zoom)!=null?o:u.x,m=([k,w])=>Math.abs(+w-+k);if(t!==r.axis.subX&&!r.axis.isCategorized()&&m(x.domain())<m(c.xDomain)){const k=g.every((w,y)=>w===c.xDomain[y]);_=c.xDomain.map((w,y)=>{const C=k?w:w-Math.abs(g[y]);return x(C)}).reduce((w,y)=>Math.abs(w)+y)/h}const b=k=>{const w=k?l[p][k]:l[p],y=k?w.ratio:l[`${p}_ratio`],C=k?w.max:l[`${p}_max`],A=N(w)?w:G(w)?w.call(r,d.width,n,h):n?_*y/n:0;return C&&A>C?C:A};let T=b();return!f&&ne(l[p])&&(T={_$width:T,_$total:[]},r.getTargetsToShow().forEach(k=>{l[p][k.id]&&(T[k.id]=b(k.id),T._$total.push(T[k.id]||T._$width))})),T},getShapeByIndex(e,t,n){const a=this,{$el:i}=a,s=nt(t)?`-${t}`:"";let o=i[e];return o&&!o.empty()?o=o.filter(r=>n?r.id===n:!0).filter(r=>nt(t)?r.index===t:!0):o=(n?i.main.selectAll(`.${H[`${e}s`]}${a.getTargetSelectorSuffix(n)}`):i.main).selectAll(`.${H[e]}${s}`),o},isWithinShape(e,t){var n;const a=this,i=(0,B.select)(e);let s;return a.isTargetToShow(t.id)?(n=a.hasValidPointType)!=null&&n.call(a,e.nodeName)?s=a.isStepType(t)?a.isWithinStep(e,a.getYScaleById(t.id)(a.getBaseValue(t))):a.isWithinCircle(e,a.isBubbleType(t)?a.pointSelectR(t)*1.5:0):e.nodeName==="path"&&(s=i.classed(H.bar)?a.isWithinBar(e):!0):s=!1,s},getInterpolate(e){const n=this.getInterpolateType(e);return $_[n]},getCurve(e){const t=this;return t.config.axis_rotated&&t.isStepType(e)?a=>{const i=t.getInterpolate(e)(a);return i.orgPoint=i.point,i.pointRotated=function(s,o){this._point===1&&(this._point=2);const r=this._y*(1-this._t)+o*this._t;this._context.lineTo(this._x,r),this._context.lineTo(s,r),this._x=s,this._y=o},i.point=function(s,o){this._point===0?this.orgPoint(s,o):this.pointRotated(s,o)},i}:t.getInterpolate(e)},getInterpolateType(e){const t=this,{config:n}=t,a=n.spline_interpolation_type,i=t.isInterpolationType(a)?a:"cardinal";return t.isSplineType(e)?i:t.isStepType(e)?n.line_step_type:"linear"},isWithinBar(e){const t=se(this.state.event,e),n=Hr(e),[a,i,s]=n,o=Math.min(a.x,i.x),r=Math.min(a.y,i.y),l=this.config.bar_sensitivity,c=Math.abs(s.x-i.x),u=Math.abs(a.y-i.y),d=o-l,h=o+c+l,f=r+u+l,p=r-l;return d<t[0]&&t[0]<h&&p<t[1]&&t[1]<f}},z_=Object.defineProperty,N_=(e,t,n)=>t in e?z_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ht=(e,t,n)=>N_(e,typeof t!="symbol"?t+"":t,n);function Sl(){var e,t,n;return(n=(t=(e=W.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function X_(e){var t,n,a,i;if(e.hasArcType())return"arc charts";if(e.state.customType){const s=(t=e.customTypeHooks)==null?void 0:t.canvasUnsupported;if(s)return s;if(!((n=e.getCustomTypeParts())!=null&&n.canvas))return`${e.state.customType} chart without its canvas module`}return(i=(a=e.getUnsupportedCanvasPart)==null?void 0:a.call(e))!=null?i:null}function G_(e){var t,n;const{config:a}=e,i=a.render_mode==="canvas"?X_(e):null;i&&((n=(t=W.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] render.mode='canvas' is ignored for ${i}; falling back to SVG.`),a.render_mode="svg")}class Rt{constructor(t){Ht(this,"api"),Ht(this,"config"),Ht(this,"cache"),Ht(this,"$el"),Ht(this,"state"),Ht(this,"charts"),Ht(this,"data",{xs:{},targets:[]}),Ht(this,"axis"),Ht(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),Ht(this,"org",{xScale:null,xDomain:null}),Ht(this,"color"),Ht(this,"patterns"),Ht(this,"levelColor"),Ht(this,"point"),Ht(this,"brush"),Ht(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const n=this;n.api=t,n.config=new Oe,n.cache=new gp;const a=new up;n.$el=a.getStore("element"),n.state=a.getStore("state"),n.$T=n.$T.bind(n)}$T(t,n,a){const{config:i,state:s}=this,o=i.transition_duration,r=i.subchart_show;let l=t;return l&&("tagName"in l&&(l=(0,B.select)(l)),l=(n!==!1&&o||n)&&(!s.zooming||s.dragging)&&!s.resizing&&s.rendered&&!r?l.transition(a).duration(o):l),l}beforeInit(){const t=this;t.callPluginHook("$beforeInit"),q(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),q(t.config.onafterinit,t.api)}get customTypeHooks(){var t;const n=this;return n.state&&((t=n.getCustomTypeParts())==null?void 0:t.hooks)}init(){const t=this,{config:n,state:a,$el:i}=t,{boost_useCssRule:s,bindto:o}=n;a.customType=t.getCustomType(),pp(t),G_(t);const r=t.hasArcType();if(a.hasRadar=!a.hasAxis&&t.hasType("radar"),a.hasTreemap=!a.hasAxis&&t.hasType("treemap"),a.hasAxis=!r&&!a.customType&&!a.hasTreemap,a.datetimeId=`bb-${+new Date*ye()}`,s){const c=rt.createElement("style");c.type="text/css",rt.head.appendChild(c),a.style={rootSelector:`.${a.datetimeId}`,sheet:c.sheet},i.style=c}const l={element:o,classname:"bb"};Q(o)&&(l.element=o.element||"#chart",l.classname=o.classname||l.classname),i.chart=G(l.element.node)?o.element:(0,B.select)(l.element||[]),i.chart.empty()&&(i.chart=(0,B.select)(rt.body.appendChild(rt.createElement("div")))),i.chart.html("").classed(l.classname,!0).classed(a.datetimeId,s).style("position","relative"),t.initParams(),t.initToRender()}initToRender(t){const n=this,{config:a,state:i,$el:{chart:s}}=n,o=()=>yp(s,{display:"none",visibility:"hidden"}),r=a.render.lazy===!1?!1:a.render.lazy||o(),l=W.MutationObserver;r&&l&&a.render.observe!==!1&&!t&&new l((c,u)=>{o()||(u.disconnect(),!i.rendered&&n.initToRender(!0))}).observe(s.node(),{attributes:!0,attributeFilter:["class","style"]}),(!r||t)&&n.convertData(a,c=>{n.initWithData(c),n.afterInit()})}initParams(){var t,n;const a=this,{config:i,format:s,state:o}=a;if(i.render_mode==="canvas"&&((t=a.prepareCanvasConfig)==null||t.call(a)),a.color=a.generateColor(),a.levelColor=a.generateLevelColor(),i.padding===!1&&(i.axis_x_show=!1,i.axis_y_show=!1,i.axis_y2_show=!1,i.subchart_show=!1),i.render_mode!=="canvas"&&(a.hasPointType()||(n=a.hasLegendDefsPoint)!=null&&n.call(a))&&(a.point=Qi(a,"generatePoint").call(a)),o.hasAxis){a.initClip(),s.extraLineClasses=a.generateExtraLineClass(),s.dataTime=i.data_xLocaltime?Xa.timeParse:Xa.utcParse,s.axisTime=i.axis_x_localtime?Xa.timeFormat:Xa.utcFormat;const u=i.zoom_enabled&&i.zoom_type==="drag";s.defaultAxisTime=d=>{const{x:h,zoom:f}=a.scale,p=u?f:f&&h.orgDomain().toString()!==f.domain().toString(),g=d.getMilliseconds()&&".%L"||d.getSeconds()&&".:%S"||d.getMinutes()&&"%I:%M"||d.getHours()&&"%I %p"||d.getDate()!==1&&"%b %d"||p&&d.getDate()===1&&"%b'%y"||d.getMonth()&&"%-m/%-d"||"%Y";return s.axisTime(g)(d)}}const{legend_position:r,legend_inset_anchor:l,axis_rotated:c}=i;o.isLegendRight=r==="right",o.isLegendInset=r==="inset",o.isLegendTop=l==="top-left"||l==="top-right",o.isLegendLeft=l==="top-left"||l==="bottom-left",o.rotatedPadding.top=a.getResettedPadding(o.rotatedPadding.top),o.rotatedPadding.right=c&&!i.axis_x_show?0:30,o.inputType=Tp(i.interaction_inputType_mouse,i.interaction_inputType_touch)}initWithData(t){var n,a,i,s,o,r;const l=this,{config:c,scale:u,state:d,$el:h,org:f}=l,{customType:p,hasAxis:g,hasTreemap:_}=d,x=c.interaction_enabled,m=l.hasType("polar"),v=c.data_labels_backgroundColors;if(g&&(l.axis=l.getAxisInstance(),c.zoom_enabled&&l.initZoom()),l.data.xs={},l.data.targets=l.convertDataToTargets(t),c.data_filter&&(l.data.targets=l.data.targets.filter(c.data_filter.bind(l.api))),c.data_hide&&l.addHiddenTargetIds(c.data_hide===!0?l.mapToIds(l.data.targets):c.data_hide),c.legend_hide&&l.addHiddenLegendIds(c.legend_hide===!0?l.mapToIds(l.data.targets):c.legend_hide),l.updateSizes(),l.updateScales(!0),g){const{x:k,y:w,y2:y,subX:C,subY:A,subY2:S}=u;k&&(k.domain(An(l.getXDomain(l.data.targets),!c.axis_x_inverted)),C.domain(k.domain()),f.xDomain=k.domain()),w&&(w.domain(l.getYDomain(l.data.targets,"y")),A.domain(w.domain())),y&&(y.domain(l.getYDomain(l.data.targets,"y2")),S&&S.domain(y.domain()))}if(c.render_mode==="canvas"){if(!l.initCanvas)throw Error("[billboard.js] Please import and call canvas() to use render.mode='canvas'.");if(l.bindResize(),l.initCanvas(),c.tooltip_show&&l.initTooltip(),l.callPluginHook("$init"),q(c.oninit,l.api),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const k=l.getMinMaxData();q(c.data_onmin,l.api,k.min),q(c.data_onmax,l.api,k.max)}d.rendered=!0;return}if(h.svg=h.chart.append("svg").style("overflow","hidden").style("display","block"),x&&d.inputType){const k=d.inputType==="touch",{onclick:w,onover:y,onout:C}=c,A=(n=c.interaction_inputType_touch)==null?void 0:n.preventDefault,S=cn(A)&&A||!1,L=!isNaN(A)&&A||null,P=k?{passive:!S&&L===null}:void 0;h.svg.on("click",(w==null?void 0:w.bind(l.api))||null).on(k?"touchstart":"mouseenter",(y==null?void 0:y.bind(l.api))||null,P).on(k?"touchend":"mouseleave",(C==null?void 0:C.bind(l.api))||null)}c.svg_classname&&h.svg.attr("class",c.svg_classname);const b=G(c.color_tiles)&&l.patterns;(g||b||m||_||v||(a=l.hasLegendDefsPoint)!=null&&a.call(l))&&(h.defs=h.svg.append("defs"),g&&["id","idXAxis","idYAxis","idY2Axis","idGrid"].forEach(k=>{l.appendClip(h.defs,d.clip[k])}),l.generateTextBGColorFilter(v),b&&l.patterns.forEach(k=>h.defs.append(()=>k.node))),l.updateSvgSize(),l.bindResize();const T=h.svg.append("g").classed(U.main,!0).attr("transform",p||_?null:l.getTranslate("main"));if(h.main=T,c.subchart_show&&l.initSubchart(),c.tooltip_show&&l.initTooltip(),c.title_text&&l.initTitle(),!_&&c.legend_show&&l.initLegend(),c.data_empty_label_text&&T.append("text").attr("class",`${Ot.text} ${U.empty}`).attr("text-anchor","middle").attr("dominant-baseline","middle"),g&&(c.regions.length&&((i=l.initRegion)==null||i.call(l)),!c.clipPath&&l.axis.init()),T.append("g").classed(U.chart,!0).attr("clip-path",g?d.clip.path:null),l.callPluginHook("$init"),l.initChartElements(),g&&(x&&((s=l.initEventRect)==null||s.call(l)),(o=l.initGrid)==null||o.call(l),c.clipPath&&((r=l.axis)==null||r.init())),l.updateTargets(l.data.targets),l.updateDimension(),q(c.oninit,l.api),l.setBackground(),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const k=l.getMinMaxData();q(c.data_onmin,l.api,k.min),q(c.data_onmax,l.api,k.max)}c.tooltip_show&&l.initShowTooltip(),d.rendered=!0}initChartElements(){const t=this,{hasAxis:n,hasRadar:a,hasTreemap:i}=t.state,s=[];if(n){const o=["bar","bubble","candlestick","line",...t.getAxisTypes()];t.config.bar_front&&o.push(o.shift());for(const r of o){const l=Mt(r);(r==="line"&&t.hasTypeOf(l)||t.hasType(r))&&s.push(l)}}else if(i)s.push("Treemap");else if(t.state.customType)s.push(Mt(t.state.customType));else{const o=t.hasType("polar"),r=t.hasType("gauge");a||s.push("Arc","Pie"),r?s.push("Gauge"):a?s.push("Radar"):o&&s.push("Polar")}for(const o of s)Qi(t,`init${o}`).call(t);St(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()}setChartElements(){const t=this,{$el:{chart:n,svg:a,defs:i,main:s,tooltip:o,legend:r,title:l,canvas:c,eventOverlay:u,grid:d,needle:h,arcs:f,circle:p,bar:g,candlestick:_,line:x,area:m,text:v}}=t;t.api.$={chart:n,svg:a,canvas:c,eventOverlay:u,defs:i,main:s,tooltip:o,legend:r,title:l,grid:d,arc:f,circles:p,bar:{bars:g},candlestick:_,line:{lines:x,areas:m},needle:h,text:{texts:v}}}setBackground(){const t=this,{config:{background:n},state:a,$el:{svg:i}}=t;if(St(n)){const s=i.select("g").insert(n.imgUrl?"image":"rect",":first-child");n.imgUrl?s.attr("href",n.imgUrl):n.color&&s.style("fill",n.color).attr("clip-path",a.clip.path),s.attr("class",n.class||null).attr("width","100%").attr("height","100%")}}updateTargets(t){var n,a;const i=this,{customType:s,hasAxis:o,hasRadar:r,hasTreemap:l}=i.state,c=d=>Qi(i,`updateTargetsFor${d}`).call(i,t.filter(i[`is${d}Type`].bind(i)));if(i.updateTargetsForText(t),o){const d=["bar","candlestick","line",...i.getAxisTypes()];for(const h of d){const f=Mt(h);(h==="line"&&i.hasTypeOf(f)||i.hasType(h))&&c(f)}(n=i.updateTargetsForSubchart)==null||n.call(i,t)}else if(i.hasArcType(t)){let d="Arc";r?d="Radar":i.hasType("polar")&&(d="Polar"),c(d)}else s?c(Mt(s)):l&&c("Treemap");const u=i.hasType("bubble")||i.hasType("scatter");u&&((a=i.updateTargetForCircle)==null||a.call(i)),i.filterTargetsToShowAtInit(u)}filterTargetsToShowAtInit(t=!1){const n=this,{$el:{svg:a},$T:i}=n;let s=`.${U.target}`;t&&(s+=`, .${Vt.chartCircles} > .${Vt.circles}`),i(a.selectAll(s).filter(o=>n.isTargetToShow(o.id))).style("opacity",null)}getWithOption(t){const n={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};for(const[a,i]of Object.entries(n)){const s=st(i)?n[i]:i;n[a]=je(t,`with${a}`,s)}return n}initialOpacity(t){const n=this,{withoutFadeIn:a}=n.state;return n.getBaseValue(t)!==null&&a[t.id]?null:"0"}bindResize(){var t,n;const a=this,{$el:i,config:s,state:o}=a,{resize_auto:r,resize_live:l}=s,c=/^(true|parent)$/.test(r),u=[],d=()=>{var p;const g=o.current.width,_=o.current.height;return a.setContainerSize(),!o.resizePreview&&g===o.current.width&&_===o.current.height?!1:(o.resizing=!0,o.dirty.size=!0,s.legend_show&&(a.updateSizes(),o.isCanvasMode?(p=a.updateHtmlLegend)==null||p.call(a):a.updateLegend()),a.api.flush(!1),!0)},h=()=>{if(o.resizeLiveScale===null&&(o.resizeLiveScale=o.resizeRedrawTime>So),o.resizeLiveScale){a.previewResize();return}const p=Sl();d()&&(o.resizeRedrawTime=Sl()-p,o.resizeLiveScale=o.resizeRedrawTime>So)},f=Cp(s.resize_timer,c&&l?h:void 0);u.push(()=>q(s.onresize,a.api)),c&&u.push(d),u.push(()=>{q(s.onresized,a.api),o.resizing=!1,o.resizeLiveScale=null}),u.forEach(p=>f.add(p)),a.resizeFunction=f,r==="parent"&&W.ResizeObserver?(a.resizeFunction.resizeObserver=new W.ResizeObserver(a.resizeFunction.bind(a))).observe(i.chart.node().parentNode):(r==="parent"&&((n=(t=W.console)==null?void 0:t.warn)==null||n.call(t,"[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize.")),W.addEventListener("resize",a.resizeFunction))}callPluginHook(t,...n){this.config.plugins.forEach(a=>{t==="$beforeInit"&&(a.$$=this,this.api.plugins.push(a)),a[t](...n)})}}pt(Rt.prototype,[Yp,Up,Kp,qp,Qp,a_,o_,Zp,r_,__,m_,wf,B_,v_,b_,S_,L_,E_,M_,O_]);const Al=10,W_=750,V_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function gs(e){var t,n;(n=(t=W.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] ${e}`)}function Ka(e,t){var n;const{config:a}=e,i=(n=a.data_names[t])!=null?n:t;return G(a.legend_format)?a.legend_format(i,t!==i?t:void 0):i}function H_(e){return`${e}`.replace(/[&<>"']/g,t=>V_[t])}function Y_(e,t){var n,a;const{config:i}=e,s=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],o=((a=e.getValidPointPattern)==null?void 0:a.call(e))||(Array.isArray(i.point_pattern)&&i.point_pattern.length?i.point_pattern:[i.point_type]),r=Math.max(0,s.indexOf(t));return o[r%o.length]||"circle"}function j_(e,t){const n=H_(e.color(t)),a=Y_(e,t),i='viewBox="0 0 8 8" aria-hidden="true" focusable="false" style="display:block;width:100%;height:100%;overflow:visible;pointer-events:none"',s=`fill="${n}" stroke="${n}"`;return/^rect(angle)?$/i.test(a)?`<svg ${i}><rect x="1" y="1" width="6" height="6" ${s}></rect></svg>`:!a||/^circle$/i.test(a)?`<svg ${i}><circle cx="4" cy="4" r="3" ${s}></circle></svg>`:`<svg ${i}><g ${s}>${ve(a)}</g></svg>`}function U_(e,t){const n=new Map;t.each(function(a){n.set(a,this)}),e.cache.add(Z.legendItemMap,n)}function Ll(e,t){const{config:n}=e;t.attr("class",function(a){const s=`${(0,B.select)(this).attr("class")||""} ${e.generateClass(J.legendItem,a)}`;return Array.from(new Set(s.trim().split(/\s+/).filter(Boolean))).join(" ")}).style("visibility",a=>e.isLegendToShow(a)?null:"hidden").classed(J.legendItemHidden,a=>!e.isTargetToShow(a)).classed(ge.legendItemInteractive,!!n.interaction_enabled),U_(e,t)}function K_(e,t){var n;const{legend:a}=e.$el,i=((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t];a==null||a.selectAll(`.${J.legendItem}`).classed(ut.legendItemFocused,s=>i.indexOf(s)>=0).style("opacity",function(s){return i.indexOf(s)>=0?null:e.opacityForUnfocusedLegend.call(e,(0,B.select)(this))})}function Z_(e){const{legend:t}=e.$el;t==null||t.selectAll(`.${J.legendItem}`).classed(ut.legendItemFocused,!1).style("opacity",null)}function q_(e,t){var n,a,i;const{state:s}=e,r=(((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t]).filter(e.isTargetToShow,e),l=new Set(r),c=(((a=e.mapToTargetIds)==null?void 0:a.call(e))||[]).filter(u=>!l.has(u)&&e.isTargetToShow(u));s.focusedTargetIds=l,s.defocusedTargetIds=new Set(c),(i=e.renderCanvasFrame)==null||i.call(e,void 0,null,!1)}function Pl(e){var t,n,a;const{state:i}=e,s=!!((t=i.focusedTargetIds)!=null&&t.size)||!!((n=i.defocusedTargetIds)!=null&&n.size);i.focusedTargetIds=new Set,i.defocusedTargetIds=new Set,s&&((a=e.renderCanvasFrame)==null||a.call(e,void 0,null,!1))}function Rl(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function J_(e,t,n){const a=Rl(n);e.state.canvasLegendTouch=a?{id:t,x:a.clientX,y:a.clientY,moved:!1}:null}function El(e,t){const n=e.state.canvasLegendTouch,a=n&&Rl(t);a&&(n.moved=n.moved||Math.abs(a.clientX-n.x)>Al||Math.abs(a.clientY-n.y)>Al)}function Q_(e,t,n){El(e,n);const a=e.state.canvasLegendTouch;return e.state.canvasLegendTouch=null,!!a&&a.id===t&&!a.moved}function tx(e,t){e.state.canvasLegendLastTouchClickId=t,e.state.canvasLegendLastTouchClickTime=Date.now()}function ex(e,t){const{state:n}=e,a=n.canvasLegendLastTouchClickId===t&&Date.now()-(n.canvasLegendLastTouchClickTime||0)<W_;return a&&(n.canvasLegendLastTouchClickId=null,n.canvasLegendLastTouchClickTime=0),a}function Ml(e,t){const{api:n,config:a,state:i}=e;if(t.on("click dblclick mouseover mouseout touchstart touchmove touchend",null),!a.interaction_enabled)return;const s=a.legend_item_interaction,o=typeof s=="object"&&(s!=null&&s.dblclick)?"dblclick":"click",r=i.inputType==="touch",l=s||G(a.legend_item_onclick),c=r?Fl(a):void 0,u=function(d,h){var f;if(!q(a.legend_item_onclick,n,h,!i.hiddenTargetIds.has(h))){const p=(0,B.select)(this);d.type==="dblclick"||d.altKey?i.hiddenTargetIds.size&&!p.classed(J.legendItemHidden)?n.show():(n.hide(),n.show(h)):(n.toggle(h),p.classed(ut.legendItemFocused,!1)),Pl(e)}r&&((f=e.hideTooltip)==null||f.call(e))};t.on(o,l?function(d,h){r&&d.type==="click"&&ex(e,h)||u.call(this,d,h)}:null),r&&o==="click"&&l&&t.on("touchstart",function(d,h){J_(e,h,d)},c).on("touchmove",d=>{El(e,d)},c).on("touchend",function(d,h){Q_(e,h,d)&&(tx(e,h),u.call(this,d,h))},c),!r&&t.on("mouseover",s||G(a.legend_item_onover)?function(d,h){q(a.legend_item_onover,n,h,!i.hiddenTargetIds.has(h))||!i.transiting&&e.isTargetToShow(h)&&(K_(e,h),q_(e,h))}:null).on("mouseout",s||G(a.legend_item_onout)?function(d,h){q(a.legend_item_onout,n,h,!i.hiddenTargetIds.has(h))||(Z_(e),Pl(e))}:null)}function nx(e,t){var n,a;const i=(a=(n=e.$el.chart)==null?void 0:n.node)==null?void 0:a.call(n),s=i==null?void 0:i.ownerDocument;if(!i||!s)return null;const o=s.createElementNS("http://www.w3.org/2000/svg","svg"),r=s.createElementNS("http://www.w3.org/2000/svg","g"),l=s.createElementNS("http://www.w3.org/2000/svg","text");o.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",r.setAttribute("class",J.legendItem),l.textContent=t,r.appendChild(l),o.appendChild(r),i.appendChild(o);const c=mt(l),u=o.getBoundingClientRect().top-c.top;return o.remove(),{width:c.width,height:c.height,ascent:u}}function Dl(e){return/^(indexed|category|log|timeseries)$/.test(e)}function Za(e){return/^(indexed|log|timeseries)$/.test(e)}function ax(e){var t,n;const a=e;return((t=a.changedTouches)==null?void 0:t[0])||((n=a.touches)==null?void 0:n[0])||("clientX"in e?e:null)}function ix(e,t,n=!1){var a,i;const s=pa(e,t);return s?n?(i=(a=e.hitDetector).findNearestShape)==null?void 0:i.call(a,s[0],s[1]):e.hitDetector.findNearest(s[0],s[1]):null}function sx(e,t){var n;const{config:a,state:i}=e,{height:s,margin:o,width:r,xAxisHeight:l}=i,[c,u]=t,d=o.left,h=o.left+r,f=o.top,p=o.top+s,g=a.axis_x_show?Math.max(l||0,24):0;return(n=e.isMultipleX)!=null&&n.call(e)||i.customType||i.hasTreemap?!1:a.axis_rotated?u>=f&&u<=p&&c>=d-g&&c<=h:c>=d&&c<=h&&u>=f&&u<=p+g}function ox(e,t){const{state:{height:n,margin:a,width:i}}=e,[s,o]=t;return s>=a.left&&s<=a.left+i&&o>=a.top&&o<=a.top+n}function rx(e,t){var n,a;return e.hitDetector.findNearest(t[0],t[1])||(sx(e,t)?(a=(n=e.hitDetector).findNearestIndexByCoord)==null?void 0:a.call(n,t[0],t[1]):null)}function Ol(e,t){var n,a;const{config:i,state:s}=e,o=e.filterTargetsToShow(e.data.targets),r=$l(e,t),l=s.customType&&((n=e.customTypeHooks)!=null&&n.namedData)?u=>u:u=>{var d;return((d=e.addName)==null?void 0:d.call(e,u))||u},c=i.tooltip_grouped&&!s.customType&&!s.hasTreemap&&!r?(a=e.filterByX)==null?void 0:a.call(e,o,t.x):null;return(s.customType||s.hasTreemap?[t]:r?[t]:i.tooltip_grouped?c!=null&&c.length?c:o.map(u=>u.values[t.index]).filter(Boolean):[t]).map(l)}function lx(e,t,n){var a,i;return(a=e.isMultipleX)!=null&&a.call(e)&&!$l(e,t)?[((i=e.addName)==null?void 0:i.call(e,t))||t]:n}function pa(e,t){const n=ax(t);if(!n)return null;const a=e.$el.canvas.node(),i=mt(a,!0);return[n.clientX-i.left,n.clientY-i.top]}function nn(e){return e?`${e.id}:${e.index}`:null}function $l(e,t){return!(e.config.axis_x_forceAsSingle&&e.config.tooltip_grouped)&&(Ke(e,t)||Ze(e,t))}function cx(e){return e.interaction_inputType_touch!==!1}function Fl(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,a=cn(n)&&n||!1,i=!isNaN(n)&&n||null;return{passive:!a&&i===null}}function ux(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,a=cn(n)&&n||!1,i=!isNaN(n)&&n||null;let s;return o=>{var r,l;const c=((r=o.changedTouches)==null?void 0:r[0])||((l=o.touches)==null?void 0:l[0]);if(!c)return;const u=c[`client${e.axis_rotated?"Y":"X"}`];o.type==="touchstart"?a?o.preventDefault():i!==null&&(s=u):o.type==="touchmove"&&(a||s===!0||i!==null&&Math.abs(s-u)>=i)&&(s=!0,o.preventDefault())}}function zn(e,t){return t.pointerType!=="mouse"&&e.state.inputType!=="touch"}function dx(e,t){const{state:n}=e,a=nn(t),i=a&&n.canvasLastInputClickKey===a&&Date.now()-(n.canvasLastInputClickTime||0)<750;return i&&(n.canvasLastInputClickKey=null,n.canvasLastInputClickTime=0),!!i}function hx(e,t){e.state.canvasLastInputClickKey=nn(t),e.state.canvasLastInputClickTime=Date.now()}const fx=["treemap"],gx={getUnsupportedCanvasPart(){const e=fx.find(t=>{var n;return this.hasType(t)&&!((n=this.canvasTypes)!=null&&n[t])});return e?`${e} chart without its canvas module`:null},getCanvasFeature(e){var t;return(t=this.canvasFeatures)==null?void 0:t[e]},getCanvasTypeParts(){const e=this.canvasTypes;return e?Object.keys(e).filter(t=>this.hasType(t)).map(t=>e[t]):[]},warnMissingCanvasFeatures(){var e,t;const{config:n}=this;[["grid",this.initGrid,n.grid_x_show||n.grid_y_show||((e=n.grid_x_lines)==null?void 0:e.length)||((t=n.grid_y_lines)==null?void 0:t.length)],["subchart",this.initSubchart,n.subchart_show],["selection",this.selectPoint,n.data_selection_enabled]].forEach(([i,s,o])=>{var r;s&&o&&!((r=this.canvasFeatures)!=null&&r[i])&&gs(`canvas mode: ${i} is not drawn, because it is not imported from "billboard.js/canvas".`)})},prepareCanvasConfig(){var e,t;const{config:n,state:a}=this;this.warnUnsupportedCanvasOptions(),this.warnMissingCanvasFeatures(),(e=a.orgConfig)!=null&&e.transition&&Object.prototype.hasOwnProperty.call(a.orgConfig.transition,"duration")&&a.orgConfig.transition.duration&&gs("canvas mode: transition.duration is ignored; canvas redraws synchronously."),n.transition_duration=0,Dl(n.axis_x_type)||(n.axis_x_type="indexed"),Za(n.axis_y_type)||(n.axis_y_type="indexed"),Za(n.axis_y2_type)||(n.axis_y2_type="indexed"),(t=this.hasType)!=null&&t.call(this,"bubble")&&(n.point_show=!0,n.point_type="circle")},initCanvas(){var e,t,n,a,i,s,o;const r=this,{config:l,state:c,$el:u}=r,d=u.chart.node();c.isCanvasMode=!0,c.canvasInlineStyle.minHeight=d.style.minHeight,W.getComputedStyle(d).position==="static"&&u.chart.style("position","relative"),u.chart.style("min-height",`${c.current.height}px`),r.canvasEngine=new Ag,r.canvasEngine.init(d,c.current.width,r.getCanvasSurfaceHeight()),u.canvas=(0,B.select)(r.canvasEngine.canvas),r.canvasTheme=new Gg,r.canvasTheme.load(d,l.canvas_theme,(s=(n=(t=(e=r.getCustomTypeParts)==null?void 0:e.call(r))==null?void 0:t.canvas)==null?void 0:n.theme)!=null?s:(i=(a=r.getAxisTypeParts)==null?void 0:a.call(r).find(h=>{var f;return(f=h.canvas)==null?void 0:f.theme}))==null?void 0:i.canvas.theme),r.canvasAxisRenderer=new ng(r.canvasEngine,r.canvasTheme),r.canvasRenderer=new hf(r.canvasEngine,r.canvasTheme),r.hitDetector=new jg,r.bindCanvasEvents(),l.zoom_enabled&&((o=r.bindZoomEvent)==null||o.call(r))},warnUnsupportedCanvasOptions(){var e,t,n;const{config:a}=this;[[!Dl(a.axis_x_type),"axis.x.type other than indexed/category/log/timeseries"],[!Za(a.axis_y_type),"axis.y.type other than indexed/log/timeseries"],[!Za(a.axis_y2_type),"axis.y2.type other than indexed/log/timeseries"],[a.boost_useCssRule,"boost.useCssRule"],[(e=this.hasArcType)==null?void 0:e.call(this),"arc charts"],[(t=this.hasType)==null?void 0:t.call(this,"radar"),"radar chart"],[(n=this.hasType)==null?void 0:n.call(this,"polar"),"polar chart"]].forEach(([s,o])=>{s&&gs(`canvas mode: ${o} is not yet supported.`)})},bindCanvasEvents(){const e=this,{config:t,state:n,$el:a}=e,i=a.canvas.node(),s=ux(t),o=Fl(t);i.addEventListener("mousemove",e.onCanvasMouseMove.bind(e)),i.addEventListener("mouseenter",r=>{var l;n.event=r,(l=t.onover)==null||l.bind(e.api)(r)}),i.addEventListener("mouseout",e.onCanvasMouseOut.bind(e)),i.addEventListener("mouseleave",r=>{var l;n.event=r,(l=t.onout)==null||l.bind(e.api)(r)}),i.addEventListener("mousedown",r=>{var l,c;(l=e.onCanvasSubchartBrushStart)!=null&&l.call(e,r)||(c=e.onCanvasSelectionDragStart)==null||c.call(e,r)}),i.addEventListener("click",e.onCanvasClick.bind(e)),i.addEventListener("pointerdown",e.onCanvasPointerDown.bind(e)),i.addEventListener("pointerenter",e.onCanvasPointerEnter.bind(e)),i.addEventListener("pointermove",e.onCanvasPointerMove.bind(e)),i.addEventListener("pointerup",e.onCanvasPointerUp.bind(e)),i.addEventListener("pointerleave",e.onCanvasPointerOut.bind(e)),i.addEventListener("pointercancel",e.onCanvasPointerCancel.bind(e)),cx(t)&&(i.addEventListener("touchstart",r=>{s(r),e.onCanvasTouchStart(r)},o),i.addEventListener("touchmove",r=>{s(r),e.onCanvasTouchMove(r)},o),i.addEventListener("touchend",e.onCanvasTouchEnd.bind(e),o),i.addEventListener("touchcancel",e.onCanvasTouchCancel.bind(e),o))},updateHtmlLegend(){var e,t;const n=this,{config:a,state:i,$el:s}=n,o=s.chart.node();if(!a.legend_show||i.hasTreemap){i.hasTreemap?((e=s.legend)==null||e.remove(),s.legend=null):(t=s.legend)==null||t.style("visibility","hidden"),i.legendItemWidth=0,i.legendItemHeight=0,i.legendStep=0;return}const r=n.mapToIds(n.data.targets).filter(d=>a.data_names[d]!==null);if(a.legend_contents_bindto&&a.legend_contents_template){n.updateHtmlLegendTemplate(r)?(i.legendItemWidth=0,i.legendItemHeight=0,i.legendStep=0,i.legendHasRendered=!0):(i.legendItemWidth=0,i.legendItemHeight=0,i.legendStep=0);return}s.legend||(s.legend=(0,B.select)(o).append("div").classed(J.legend,!0).classed(ge.legend,!0)),s.legend.style("visibility",null);const l=s.legend.selectAll(`button.${J.legendItem}`).data(r,d=>d);l.exit().remove();const c=l.enter().append("button").attr("type","button").attr("data-id",d=>d);c.append("span").classed(J.legendItemTile,!0),c.append("span").classed(ge.legendItemTitle,!0);const u=c.merge(l).attr("class",d=>n.generateClass(J.legendItem,d).trim());Ll(n,u),u.select(`.${J.legendItemTile}`).classed(ge.legendItemTileCircle,!a.legend_usePoint&&a.legend_item_tile_type==="circle").style("background-color",d=>a.legend_usePoint?null:n.color(d)).html(d=>a.legend_usePoint?j_(n,d):""),u.select(`.${ge.legendItemTitle}`).text(d=>Ka(n,d)),a.legend_tooltip&&u.attr("title",d=>Ka(n,d)),Ml(n,u),n.updateHtmlLegendSize(r),n.positionHtmlLegend(),i.legendHasRendered=!0},updateHtmlLegendTemplate(e){const t=this,{api:n,config:a,$el:i}=t,s=(0,B.select)(a.legend_contents_bindto),o=a.legend_contents_template,r=[];let l="";if(s.empty())return!1;e.forEach(u=>{const d=G(o)?ve(o.call(n,u,t.color(u),n.data(u)[0].values)):hn(o,{COLOR:t.color(u),TITLE:u});d&&(r.push(u),l+=d)});const c=s.html(ve(l)).classed(J.legend,!0).classed(ge.legend,!1).style("visibility",null).selectAll(function(){return this.children}).data(r);return Ll(t,c),Ml(t,c),i.legend=s,!0},updateHtmlLegendSize(e){const t=this,{config:n,state:a,$el:i}=t,s=[],o={};let r=0,l=0,c=0;const u=n.legend_contents_bindto&&n.legend_contents_template;if(u)i.legend.selectAll(`.${J.legendItem}`).each(function(d){const h=mt(this,!0),f=`${Ka(t,d)}`,p=Math.max(32,f.length*7+24),g=20,_=Math.ceil(h.width||p),x=Math.ceil(h.height||g);s.push(_),r=Math.max(r,_),l=Math.max(l,x)});else if(e.length){const d=a.isLegendRight||a.isLegendInset,h=n.legend_item_tile_type!=="circle",f={width:h?n.legend_item_tile_width:n.legend_item_tile_r*2,height:h?n.legend_item_tile_height:n.legend_item_tile_r*2},p={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},g={offsets:{},widths:{},heights:{},margins:[0],steps:{}},_=e.map((y,C)=>{const A=`${Ka(t,y)}`,S=nx(t,A),L=Math.max(32,A.length*7),P=12,D=C===e.length-1,R=n.legend_show&&!t.isLegendToShow(y),E=R?0:((S==null?void 0:S.width)||L)+p.tileWidth+(D&&!d?0:p.padding.right)+n.legend_padding,M=R?0:((S==null?void 0:S.height)||P)+p.padding.top;return p.max.width=Math.max(p.max.width,E),p.max.height=Math.max(p.max.height,M),{id:y,hidden:R,width:E,height:M,text:S}}),x=d?t.getLegendHeight():t.getLegendWidth(),m=(y,C,A=!1)=>{let S;A||(S=(x-p.totalLength-C)/2,S<p.posMin&&(S=(x-C)/2,p.totalLength=0,p.step++)),g.steps[y]=p.step,g.margins[p.step]=a.isLegendInset?10:S,g.offsets[y]=p.totalLength,p.totalLength+=C};a.isLegendInset&&(p.step=n.legend_inset_step?n.legend_inset_step:e.length,a.legendStep=p.step),_.forEach(({id:y,hidden:C,width:A,height:S})=>{const L=n.legend_equally&&!C?p.max.width:A,P=n.legend_equally&&!C?p.max.height:S,D=d?P:L;if(g.widths[y]=L,g.heights[y]=P,s.push(L),r=Math.max(r,L),l=Math.max(l,P),C){g.steps[y]=0,g.offsets[y]=0;return}m(y,D)});const v=a.isLegendRight?y=>p.max.width*g.steps[y]:a.isLegendInset?y=>p.max.width*g.steps[y]+10:y=>g.margins[g.steps[y]]+g.offsets[y],b=a.isLegendRight||a.isLegendInset?y=>g.margins[g.steps[y]]+g.offsets[y]:y=>p.max.height*g.steps[y],T=4+f.width,k=9,w=(y,C)=>C?14-C.ascent-(g.heights[y]-C.height)/2:0;_.forEach(({id:y,hidden:C,text:A})=>{const S=C?0:v(y),L=C?0:b(y);o[y]={item:{x:S,y:L-5,width:g.widths[y],height:g.heights[y]},title:{x:T,y:C?0:w(y,A),height:g.heights[y]},tile:{x:-2,y:k-f.height/2,width:f.width,height:f.height}}}),c=p.step}if(!e.length){a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0;return}if(u){const d=Math.max(1,a.current.width),h=10;let f=1,p=0;s.forEach(g=>{p&&p+h+g>d?(f++,p=g):p+=(p?h:0)+g}),a.legendStep=Math.max(0,f-1)}else a.legendStep=c;a.legendItemWidth=r,a.legendItemHeight=Math.max(12,l),u||i.legend.selectAll(`button.${J.legendItem}`).each(function(d){const h=o[d],f=(0,B.select)(this);h&&(f.style("left",`${h.item.x}px`).style("top",`${h.item.y}px`).style("width",`${h.item.width}px`).style("height",`${h.item.height}px`),f.select(`.${ge.legendItemTitle}`).style("left",`${h.title.x}px`).style("top",`${h.title.y}px`).style("height",`${h.title.height}px`).style("line-height",`${h.title.height}px`),f.select(`.${J.legendItemTile}`).style("left",`${h.tile.x}px`).style("top",`${h.tile.y}px`).style("width",`${h.tile.width}px`).style("height",`${h.tile.height}px`))})},getCanvasBottomLegendHeight(){var e;const t=this,{config:n,state:a,$el:i}=t;if(!n.legend_show||a.isLegendRight||a.isLegendInset||a.hasTreemap||!i.legend||!a.legendItemHeight)return 0;const s=mt(i.legend.node(),!0).height,o=a.legendItemHeight*(a.legendStep+1);return Math.ceil(Math.max(((e=t.getLegendHeight)==null?void 0:e.call(t))||0,s||o))},getCanvasSurfaceHeight(){const e=this;return Math.max(0,e.state.current.height-e.getCanvasBottomLegendHeight())},positionHtmlLegend(){var e;const t=this,{config:n,state:a,$el:i}=t,s=i.legend;if(s.classed(ge.legendBottom,!a.isLegendRight&&!a.isLegendInset).classed(ge.legendRight,a.isLegendRight).classed(ge.legendInset,a.isLegendInset).style("top",null).style("right",null).style("bottom",null).style("left",null).style("width",null).style("height",null).style("min-height",null),a.isLegendRight)s.style("top",`${a.margin3.top}px`).style("right","0").style("bottom",`${a.margin3.bottom}px`).style("width",`${Math.max(0,t.getLegendWidth())}px`);else if(a.isLegendInset){if(a.isLegendInset){const o=a.isLegendTop,r=a.isLegendLeft;s.style(o?"top":"bottom",`${n.legend_inset_y}px`).style(r?"left":"right",`${n.legend_inset_x}px`).style("width",`${Math.max(0,a.legendItemWidth*(a.legendStep+1)+20)}px`)}}else{const o=((e=t.getLegendHeight)==null?void 0:e.call(t))||0;s.style("top",`${Math.max(0,a.current.height-o)}px`).style("right","0").style("bottom","auto").style("left","0")}},dispatchCanvasDataOut(e){const t=this,{config:n,state:a}=t,i=a.canvasDataHover;i&&(a.canvasDataHover=null,a.canvasDataHoverKey=null,n.interaction_enabled&&q(n.data_onout,t.api,i,e))},dispatchCanvasDataOver(e,t){const n=this,{config:a,state:i}=n,s=nn(e);i.canvasDataHoverKey!==s&&(n.dispatchCanvasDataOut(t),i.canvasDataHover=e,i.canvasDataHoverKey=s,a.interaction_enabled&&e&&q(a.data_onover,n.api,e,t))},dispatchCanvasDataClick(e,t=!1){var n;const a=this,{config:i,$el:s}=a,o=s.canvas.node(),r=ix(a,e,!0);if(!r||dx(a,r))return r;if(i.interaction_enabled){const l=i.data_selection_grouped?a.filterTargetsToShow(a.data.targets).map(c=>c.values[r.index]).filter(Boolean):[r];(n=a.toggleCanvasSelection)==null||n.call(a,l),l.forEach(c=>q(i.data_onclick,a.api,c,o)),t&&hx(a,r)}return r},onCanvasClick(e){var t;const n=this,{config:a,state:i}=n;if(i.event=e,i.flowing||i.cancelClick){i.cancelClick=!1;return}n.dispatchCanvasDataClick(e),(t=a.onclick)==null||t.bind(n.api)(e)},onCanvasPointerDown(e){var t,n;if(!zn(this,e))return;const a=this,i=a.$el.canvas.node();if(!((t=a.startCanvasSubchartBrush)!=null&&t.call(a,e)))return;const s=e.pointerId,o=d=>d.pointerId===s,r=d=>{var h;o(d)&&((h=a.updateCanvasSubchartBrush)==null||h.call(a,d))},l=d=>{var h;o(d)&&((h=a.endCanvasSubchartBrush)==null||h.call(a,d),u())},c=d=>{var h;o(d)&&((h=a.cancelCanvasSubchartBrush)==null||h.call(a,d),u())};function u(){var d;W.removeEventListener("pointermove",r),W.removeEventListener("pointerup",l),W.removeEventListener("pointercancel",c);try{(d=i.releasePointerCapture)==null||d.call(i,s)}catch(h){}}try{(n=i.setPointerCapture)==null||n.call(i,s)}catch(d){}W.addEventListener("pointermove",r),W.addEventListener("pointerup",l),W.addEventListener("pointercancel",c)},onCanvasPointerEnter(e){var t;zn(this,e)&&(this.state.event=e,(t=this.config.onover)==null||t.bind(this.api)(e))},onCanvasPointerMove(e){var t;zn(this,e)&&((t=this.updateCanvasSubchartBrush)!=null&&t.call(this,e)||this.onCanvasMouseMove(e))},onCanvasPointerUp(e){var t,n;if(zn(this,e)){if(this.state.event=e,(t=this.endCanvasSubchartBrush)!=null&&t.call(this,e)){(n=this.config.onout)==null||n.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node())}},onCanvasPointerOut(e){var t;zn(this,e)&&(this.state.canvasSubchartBrushDragging||(this.state.event=e,this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)))},onCanvasPointerCancel(e){var t,n;if(zn(this,e)){if(this.state.event=e,(t=this.cancelCanvasSubchartBrush)!=null&&t.call(this,e)){(n=this.config.onout)==null||n.bind(this.api)(e);return}this.onCanvasPointerOut(e)}},onCanvasTouchStart(e){var t,n,a;e.touches.length>1||(this.state.event=e,!((t=this.startCanvasSubchartBrush)!=null&&t.call(this,e))&&((n=this.startCanvasSelectionDrag)!=null&&n.call(this,e)||((a=this.config.onover)==null||a.bind(this.api)(e),this.onCanvasMouseMove(e))))},onCanvasTouchMove(e){var t,n;e.touches.length>1||(t=this.updateCanvasSubchartBrush)!=null&&t.call(this,e)||(n=this.updateCanvasSelectionDrag)!=null&&n.call(this,e)||this.onCanvasMouseMove(e)},onCanvasTouchEnd(e){var t,n,a,i,s;if(this.state.event=e,(t=this.endCanvasSubchartBrush)!=null&&t.call(this,e)){(n=this.config.onout)==null||n.bind(this.api)(e);return}if((a=this.endCanvasSelectionDrag)!=null&&a.call(this,e)){(i=this.config.onout)==null||i.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node()),(s=this.config.onout)==null||s.bind(this.api)(e)},onCanvasTouchCancel(e){var t,n,a;this.state.event=e,(t=this.cancelCanvasSubchartBrush)==null||t.call(this,e),(n=this.endCanvasSelectionDrag)==null||n.call(this,e),this.onCanvasMouseOut(),(a=this.config.onout)==null||a.bind(this.api)(e)},onCanvasMouseMove(e){var t,n,a,i,s,o;const r=this,{config:l,state:c,$el:u}=r,d=u.canvas.node();if(c.event=e,c.flowing||c.canvasSelectionDragging)return;if((t=r.updateCanvasSubchartCursor)!=null&&t.call(r,e)){r.dispatchCanvasDataOut(d),c.canvasFocusKey&&(c.canvasFocusKey=null,r.clearCanvasFocus()),(n=r.hideTooltip)==null||n.call(r);return}const h=pa(r,e),f=h&&(((a=r.getCanvasMainPointFromSubchart)==null?void 0:a.call(r,h))||h),p=f?rx(r,f):null;if(!p){if(r.dispatchCanvasDataOut(d),c.canvasFocusKey&&(c.canvasFocusKey=null,r.clearCanvasFocus()),h&&l.axis_tooltip&&ox(r,h)){r.renderCanvasAxisTooltip(h),(i=r.hideTooltip)==null||i.call(r);return}(s=r.hideTooltip)==null||s.call(r);return}r.dispatchCanvasDataOver(p,d);const g=Ol(r,p),_=lx(r,p,g),x=_.map(m=>`${m.id}:${m.index}`).join("|");(c.canvasFocusKey!==x||l.axis_tooltip)&&(c.canvasFocusKey=x,r.renderCanvasFocus(_,f)),(o=r.showTooltip)==null||o.call(r,g,d)},onCanvasMouseOut(){var e;const t=this.$el.canvas.node();t.style.cursor="",this.dispatchCanvasDataOut(t),this.state.canvasFocusKey?(this.state.canvasFocusKey=null,this.clearCanvasFocus()):this.config.axis_tooltip&&this.clearCanvasFocus(),(e=this.hideTooltip)==null||e.call(this)},showCanvasLinkedTooltip(e){var t,n,a,i;const s=this,{$el:o,state:r}=s,l=(t=o.canvas)==null?void 0:t.node(),u=s.filterTargetsToShow(s.data.targets).map(x=>x.values[e]).find(Boolean);if(!l||!u)return(n=s.hideTooltip)==null||n.call(s),!1;const d=Ol(s,u),h=d.find(x=>x&&Dt(s,x))||d[0];if(!d.length||!h)return(a=s.hideTooltip)==null||a.call(s),!1;const{left:f,top:p}=mt(l,!0),g=Kn(s,h),_=[r.margin.left+g.x,r.margin.top+g.y];return r.event={clientX:f+_[0],clientY:p+_[1],currentTarget:l,target:l},r.canvasFocusKey=d.map(x=>`${x.id}:${x.index}`).join("|"),s.renderCanvasFocus(d,_),(i=s.showTooltip)==null||i.call(s,d,l),!0},renderCanvasZoomBrush(e,t){const n=this;n.canvasEngine.withOverlay(a=>{n.canvasRenderer.withContext(a,()=>{n.canvasRenderer.drawZoomBrush(n,e,t)})})},clearCanvasZoomBrush(){this.canvasEngine.clearOverlay()},renderCanvasFrame(e,t,n=!1){var a,i,s,o,r,l,c,u;const d=this,{state:h}=d,f=e||h.canvasShape||d.getDrawShape();h.canvasShape=f,h._canvasVisibleRangeCache=null,h._canvasXTickValuesCache=null,d.canvasEngine.beginFrame(h.current.width,d.getCanvasSurfaceHeight());try{d.canvasRenderer.drawBackground(d),d.canvasAxisRenderer.drawTitle(d),h.hasAxis&&d.canvasAxisRenderer.draw(d),d.canvasRenderer.draw(d,f),h.hasAxis&&d.config.grid_lines_front&&((i=(a=d.getCanvasFeature)==null?void 0:a.call(d,"grid"))==null||i.drawLines.call(d,d.canvasAxisRenderer)),(o=(s=d.getCanvasFeature)==null?void 0:s.call(d,"subchart"))==null||o.draw.call(d,d.canvasRenderer,f),h.hasAxis&&((l=(r=d.getCanvasFeature)==null?void 0:r.call(d,"subchart"))==null||l.drawXAxis.call(d,d.canvasAxisRenderer)),h.hasAxis&&((u=(c=d.getCanvasFeature)==null?void 0:c.call(d,"subchart"))==null||u.drawYAxes.call(d,d.canvasAxisRenderer)),d.canvasRenderer.drawEmptyLabel(d),n&&d.hitDetector.rebuild(d,f)}finally{d.canvasEngine.endFrame()}d.canvasEngine.clearOverlay(),h.canvasFocusMainRedraw=!1,t&&d.renderCanvasFocus(t)},renderCanvasFocus(e,t){var n,a,i,s,o,r,l,c,u,d;const h=this,{state:f}=h,p=(a=(n=h.canvasRenderer).hasExpandedShapeFocus)==null?void 0:a.call(n,h,e);if(f.canvasFocusData=e,p||f.canvasFocusMainRedraw){const g=f.canvasShape||h.getDrawShape();h.canvasEngine.beginFrame(f.current.width,h.getCanvasSurfaceHeight());try{h.canvasRenderer.drawBackground(h),h.canvasAxisRenderer.drawTitle(h),f.hasAxis&&h.canvasAxisRenderer.draw(h),h.canvasRenderer.draw(h,g,p?e:void 0),f.hasAxis&&h.config.grid_lines_front&&((s=(i=h.getCanvasFeature)==null?void 0:i.call(h,"grid"))==null||s.drawLines.call(h,h.canvasAxisRenderer)),(r=(o=h.getCanvasFeature)==null?void 0:o.call(h,"subchart"))==null||r.draw.call(h,h.canvasRenderer,g),f.hasAxis&&((c=(l=h.getCanvasFeature)==null?void 0:l.call(h,"subchart"))==null||c.drawXAxis.call(h,h.canvasAxisRenderer)),f.hasAxis&&((d=(u=h.getCanvasFeature)==null?void 0:u.call(h,"subchart"))==null||d.drawYAxes.call(h,h.canvasAxisRenderer)),h.canvasRenderer.drawEmptyLabel(h)}finally{h.canvasEngine.endFrame()}}f.canvasFocusMainRedraw=!!p,h.canvasEngine.withOverlay(g=>{h.canvasRenderer.withContext(g,()=>{h.canvasRenderer.drawFocus(h,e)}),h.canvasAxisRenderer.withContext(g,()=>{h.canvasAxisRenderer.drawFocusedXAxisTick(h,e),t&&h.canvasAxisRenderer.drawAxisTooltip(h,t)})})},renderCanvasAxisTooltip(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasAxisRenderer.withContext(n,()=>{t.canvasAxisRenderer.drawAxisTooltip(t,e)})})},clearCanvasFocus(){var e;const t=this;t.state.canvasFocusMainRedraw?(t.state.canvasFocusMainRedraw=!1,t.renderCanvasFrame(void 0,null,!1)):(e=t.canvasEngine)==null||e.clearOverlay()},resizeCanvas(){var e,t;const n=this,{config:a,state:i,$el:s}=n,o=s.chart.node();n.clearResizePreview(),s.chart.style("min-height",`${i.current.height}px`),(e=n.canvasEngine)==null||e.resize(i.current.width,n.getCanvasSurfaceHeight()),(t=n.canvasTheme)==null||t.reload(o,a.canvas_theme)}};let Il=()=>(pt(Rt.prototype,gx),(Il=()=>"canvas")());const ps=[ke,ue,qt,Ti],qa=new WeakMap;function px(e,t){const n=e.state.canvasSelectionDragIncluded,a=qa.get(e)||new Map,i=new Map,s=new Set,o=[];return t.filter(r=>_s(e,r)).forEach(r=>{const l=nn(r);l&&(s.add(l),!i.has(l)&&i.set(l,r))}),i.forEach((r,l)=>{!n.has(l)&&o.push(r)}),a.forEach((r,l)=>{!s.has(l)&&o.push(r)}),qa.set(e,i),{included:s,rows:o}}function _x(e){return e?Array.isArray(e)?e:[e]:null}function _s(e,t){return t&&Dt(e,t)&&Ln(e,t,ps)&&ps.some(n=>n(e,t))&&e.config.data_selection_isselectable.bind(e.api)(t)}function xs(e,t){e.filterTargetsToShow(e.data.targets).filter(n=>Ln(e,n,ps)).forEach(n=>{n.values.forEach(a=>{_s(e,a)&&t(a)})})}function xx(e,t,n){var a,i;const s=(a=t.getCanvasSelectedData)==null?void 0:a.call(t);if(!t.config.data_selection_enabled||!(s!=null&&s.length)||t.state.customType||t.state.hasTreemap)return;const{ctx:o,painter:r,theme:{style:l}}=e,{margin:c}=t.state,u=ue.bind(null,t),d=qt.bind(null,t),h=s.some(u)?t.generateGetBarPoints(Gt(t,n,X.BAR,u),!1):null,f=s.some(d)?(i=t.generateGetCandlestickPoints)==null?void 0:i.call(t,Gt(t,n,X.CANDLESTICK,d),!1):null,p=h?ka(t):null,g=p?_i(t):new Set;r.withTranslation(c.left,c.top,()=>{s.forEach(_=>{var x,m,v,b,T,k,w;const y=t.color(_.id);if(u(_)&&h){const C=qn(t,h,_,_.index);if(!C)return;const{points:A,rect:S}=C,L=p?xi(t,_,A,p,g).corners:0;p?r.fillRoundRect(S,L,{fill:"#fff",alpha:.3}):r.fillRect(S,{fill:"#fff",alpha:.3}),p?r.strokeRoundRect(S,L,{stroke:y,lineWidth:2}):r.strokeRect(S,{stroke:y,lineWidth:2})}else if(d(_)&&f){if(!((x=t.getCandlestickData)==null?void 0:x.call(t,_)))return;const A=Jn(t,f,_,_.index);if(!A)return;const{body:S,wickStart:L,wickEnd:P}=A;r.strokePath(()=>{r.traceLine(L[0],L[1],P[0],P[1])},{stroke:y,lineWidth:3}),r.fillRect(S,{fill:"#fff",alpha:.3}),r.strokeRect(S,{stroke:y,lineWidth:2})}else if(ke(t,_)){const C=Ei(t,{id:_.id}),{x:A,y:S}=Kn(t,_),L=(v=(m=t.pointR)==null?void 0:m.call(t,_))!=null?v:2.5,P=(T=(b=t.pointSelectR)==null?void 0:b.call(t,_))!=null?T:L*2;if(!At(A,S))return;ta(r,"circle",A,S,P,{fill:l.selectedPoint.fill,lineWidth:l.selectedPoint.lineWidth,stroke:l.selectedPoint.stroke||y}),(k=t.isPointFocusOnly)!=null&&k.call(t)||ta(r,C,A,S,L,{fill:l.shape.pointFillColor||y,stroke:l.shape.pointStrokeColor||y,lineWidth:(w=l.shape.pointLineWidth)!=null?w:1})}}),o.globalAlpha=1})}function Bl(e,t,n){const{margin:a,width:i,height:s}=t.state,o={x:a.left,y:a.top,w:i,h:s},r=Math.max(o.x,n.x),l=Math.max(o.y,n.y),c=Math.min(o.x+o.w,n.x+n.w),u=Math.min(o.y+o.h,n.y+n.h);c<=r||u<=l||e.painter.fillRect({x:r,y:l,w:c-r,h:u-l},{fill:e.theme.style.zoomBrush.fill,alpha:e.theme.style.zoomBrush.opacity})}var mx={getCanvasSelectedData(e){const t=this,n=t.state.canvasSelection,a=[];return!t.config.data_selection_enabled||!(n!=null&&n.size)||xs(t,i=>{(!e||i.id===e)&&n.has(nn(i))&&a.push(i)}),a},setCanvasSelection(e=!1,t,n,a){var i;const s=this,{config:o,state:r}=s,l=r.canvasSelection,c=o.data_selection_grouped;let u=_x(t),d=!1;const h=e&&!o.data_selection_multiple;let f=!h;if(o.data_selection_enabled){if(h&&(n=n!=null&&n.length?[n[0]]:[0],!c))if(u)u=u.slice(0,1);else{const[p]=s.filterTargetsToShow(s.data.targets);u=p?[p.id]:[]}xs(s,p=>{const g=nn(p),_=c||!u||u.indexOf(p.id)>=0,x=!n||n.indexOf(p.index)>=0,m=l.has(g);if(e)if(_&&x&&(!m||h)){if(f||(s.setCanvasSelection(!1),f=!0),l.has(g))return;l.add(g),q(o.data_onselected,s.api,p,s.canvasEngine.canvas),d=!0}else(!h||f)&&a&&m&&(l.delete(g),q(o.data_onunselected,s.api,p,s.canvasEngine.canvas),d=!0);else _&&x&&m&&(l.delete(g),q(o.data_onunselected,s.api,p,s.canvasEngine.canvas),d=!0)}),d&&((i=s.renderCanvasFrame)==null||i.call(s,void 0,null,!1))}},toggleCanvasSelection(e){var t;const n=this,{config:a,state:i}=n,s=i.canvasSelection;let o=!1;a.data_selection_enabled&&(e.filter(r=>_s(n,r)).forEach(r=>{const l=nn(r),c=s.has(l);a.data_selection_multiple||xs(n,u=>{const d=nn(u);(a.data_selection_grouped?u.id===r.id:d!==l)&&s.has(d)&&(s.delete(d),q(a.data_onunselected,n.api,u,n.canvasEngine.canvas),o=!0)}),c&&s.has(l)?(s.delete(l),q(a.data_onunselected,n.api,r,n.canvasEngine.canvas)):(s.add(l),q(a.data_onselected,n.api,r,n.canvasEngine.canvas)),o=!0}),o&&((t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1)))},canStartCanvasSelectionDrag(e){const t=this,{config:n}=t,a=e;return!!(n.interaction_enabled&&n.data_selection_enabled&&n.data_selection_draggable&&n.data_selection_multiple&&!n.zoom_enabled&&(a.button===void 0||a.button===0))},getCanvasSelectionDragData(e){const t=this,{config:n}=t,a=t.hitDetector.findInRect(e,n.data_selection_grouped);if(!n.data_selection_grouped)return a;const i=new Set(a.map(s=>s.index));return t.filterTargetsToShow(t.data.targets).flatMap(s=>s.values.filter(o=>i.has(o.index)))},startCanvasSelectionDrag(e){var t,n;const a=this,{state:i}=a,s=pa(a,e);return!s||!a.canStartCanvasSelectionDrag(e)?!1:(i.dragStart=s,i.canvasSelectionDragStart=s,i.canvasSelectionDragIncluded=new Set,i.canvasSelectionDragging=!0,i.canvasSelectionDragMoved=!1,qa.set(a,new Map),a.setDragStatus(!0),(t=a.hideTooltip)==null||t.call(a),(n=e.preventDefault)==null||n.call(e),!0)},updateCanvasSelectionDrag(e){var t;const n=this,{config:a,state:i}=n,s=i.canvasSelectionDragStart,o=pa(n,e);if(!i.canvasSelectionDragging||!s||!o)return!1;const[r,l]=s,[c,u]=o,d=Math.min(r,c),h=Math.max(r,c),f=a.data_selection_grouped?i.margin.top:Math.min(l,u),p=a.data_selection_grouped?i.margin.top+i.height:Math.max(l,u),g={x:d,y:f,w:h-d,h:p-f},_=Math.abs(c-r)>4||Math.abs(u-l)>4;if(i.canvasSelectionDragMoved=i.canvasSelectionDragMoved||_,_){const{included:x,rows:m}=px(n,n.getCanvasSelectionDragData(g));m.length&&n.toggleCanvasSelection(m),i.canvasSelectionDragIncluded=x,i.cancelClick=!0}return n.renderCanvasSelectionDrag(g),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSelectionDrag(e){var t;const n=this,{state:a}=n;return a.canvasSelectionDragging?(n.updateCanvasSelectionDrag(e),a.cancelClick=a.cancelClick||a.canvasSelectionDragMoved,a.dragStart=null,a.canvasSelectionDragStart=null,a.canvasSelectionDragIncluded=new Set,a.canvasSelectionDragging=!1,a.canvasSelectionDragMoved=!1,qa.delete(n),n.setDragStatus(!1),n.clearCanvasFocus(),(t=e.preventDefault)==null||t.call(e),!0):!1},onCanvasSelectionDragStart(e){const t=this,{state:n}=t;if(!t.startCanvasSelectionDrag(e))return;const a=s=>{t.updateCanvasSelectionDrag(s)},i=s=>{t.endCanvasSelectionDrag(s),window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",i),n.canvasSelectionDragMoveHandler=null,n.canvasSelectionDragEndHandler=null};n.canvasSelectionDragMoveHandler=a,n.canvasSelectionDragEndHandler=i,window.addEventListener("mousemove",a),window.addEventListener("mouseup",i)},renderCanvasSelectionDrag(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasRenderer.withContext(n,()=>{Bl(t.canvasRenderer,t,e)})})}};const vx={draw(e,t){xx(e,this,t)},drawDragArea(e,t){Bl(e,this,t)}};var bx=Object.defineProperty,yx=Object.defineProperties,Tx=Object.getOwnPropertyDescriptors,zl=Object.getOwnPropertySymbols,wx=Object.prototype.hasOwnProperty,kx=Object.prototype.propertyIsEnumerable,Nl=(e,t,n)=>t in e?bx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cx=(e,t)=>{for(var n in t||(t={}))wx.call(t,n)&&Nl(e,n,t[n]);if(zl)for(var n of zl(t))kx.call(t,n)&&Nl(e,n,t[n]);return e},Sx=(e,t)=>yx(e,Tx(t));const Xl=6,Ax=2,Gl=new Map;function ms(e,t){var n,a;if(!Array.isArray(t)||t.length<2)return null;const i=t.slice(0,2);return(a=(n=e.axis)==null?void 0:n.isTimeSeries)!=null&&a.call(n)?i.map(s=>Zt.call(e,s)):i}function _a(e){const{config:t,state:n}=e;return!t.subchart_show||!n.hasAxis||n.width2<=0||n.height2<=0?null:{x:n.margin2.left,y:n.margin2.top,w:n.width2,h:n.height2}}function Wl(e,t){const n=_a(e);return!!n&&t[0]>=n.x&&t[0]<=n.x+n.w&&t[1]>=n.y&&t[1]<=n.y+n.h}function Lx(e,t){const{config:n,state:a}=e,i=_a(e);if(n.subchart_brush_enabled!==!1||!i||!Wl(e,t))return null;const s=Qs(e,n.axis_rotated?t[1]-i.y:t[0]-i.x);return s===null?null:n.axis_rotated?[a.margin.left+a.width/2,a.margin.top+s]:[a.margin.left+s,a.margin.top+a.height/2]}function Ja(e){var t,n;const a=_a(e),i=a?e.config.axis_rotated?a.h:a.w:0,s=(n=(t=e.axis)==null?void 0:t.getExtent)==null?void 0:n.call(t),o=Array.isArray(s)?s.slice(0,2):[];if(o.length===2&&o.every(Number.isFinite)){const r=Math.max(0,Math.min(i,o[0])),l=Math.max(0,Math.min(i,o[1]));return[Math.min(r,l),Math.max(r,l)]}return[0,i]}function vs(e,t,n=!1){const a=pa(e,t),i=a&&_a(e);if(!a||!i||!Wl(e,a))return null;const s=e.config.axis_rotated?a[1]-i.y:a[0]-i.x,[o,r]=Ja(e);return!n&&(s<o||s>r)?null:Math.max(o,Math.min(r,s))}function Px(e,t,n){const a=Math.min(t,n),i=Math.max(t,n);return[e.scale.subX.invert(a),e.scale.subX.invert(i)]}function Vl(e){const{scale:t,state:n}=e,a=n.domain;if(!(a!=null&&a.length)||!t.subX)return null;const i=_a(e),s=t.subX(a[0]),o=t.subX(a[1]);if(!i||!Number.isFinite(s)||!Number.isFinite(o))return null;const[r,l]=Ja(e);return[Math.max(r,Math.min(l,Math.min(s,o))),Math.max(r,Math.min(l,Math.max(s,o)))]}function Hl(e,t){const n=Vl(e);if(!n)return"select";const[a,i]=n;return Math.abs(t-a)<=Xl?"resize-start":Math.abs(t-i)<=Xl?"resize-end":t>a&&t<i?"move":"select"}function bs(e,t,n){const[a,i]=Ja(e);return[Math.max(a,Math.min(i,t)),Math.max(a,Math.min(i,n))]}function Rx(e,t){return/^resize/.test(t)?e.config.axis_rotated?"ns-resize":"ew-resize":t==="move"?"move":"crosshair"}function Ex(e,t){const n=W.Path2D;if(!n)return null;const a=`${e}:${t}`,i=Gl.get(a);if(i)return i;const s=new n(Po[e][t]);return Gl.set(a,s),s}function Mx(e,t){var n,a,i;const s=t==="y2"?"subY2":"subY",o=(i=(a=(n=e.axis)==null?void 0:n[s])==null?void 0:a.tickFormat)==null?void 0:i.call(a),r=e.config[`subchart_axis_${t}_tick_format`]||e.config[`axis_${t}_tick_format`];return o||(typeof r=="function"?r.bind(e.api):(l=>l))}function Dx(e,t,n){const{config:a,state:i}=t;if(!a.subchart_show||!i.hasAxis||i.width2<=0||i.height2<=0)return;const{ctx:s,painter:o,theme:{style:r}}=e,{margin2:l,width2:c,height2:u}=i,d={x:l.left,y:l.top,w:c,h:u};t.withSubchartTypeContext(()=>{var h;const f=t.filterTargetsToShow().filter(Re.bind(null,t)),p=t.getDrawShape();(h=t.updateSubchartYDomain)==null||h.call(t,f),o.withState(()=>{o.clipRect(d,()=>{o.withTranslation(d.x,d.y,()=>{var g,_,x,m,v,b;const T=f.filter(Zn.bind(null,t)),k=Gt(t,p,X.AREA,Zn.bind(null,t));for(const R of T)R.values.some(Dt.bind(null,t))&&(s.globalAlpha=r.shape.areaOpacity*fe(t,R),s.fillStyle=t.color(R.id),Jo(t,R,k,o,!0));s.globalAlpha=1;const w=f.filter(ue.bind(null,t)),y=Gt(t,p,X.BAR,ue.bind(null,t)),C=(g=t.generateGetBarPoints)==null?void 0:g.call(t,y,!0);if(C){for(const R of w)s.globalAlpha=r.shape.barOpacity*fe(t,R),s.fillStyle=t.color(R.id),R.values.forEach((E,M)=>{var O;if(!Dt(t,E))return;const $=qn(t,C,E,M),I=((O=t.getSubchartCandlestickBarColor)==null?void 0:O.call(t,E,!0))||s.fillStyle;$&&o.fillRect($.rect,{fill:I})});s.globalAlpha=1}const A=f.filter(qt.bind(null,t)),S=Gt(t,p,X.CANDLESTICK,qt.bind(null,t)),L=(_=t.generateGetCandlestickPoints)==null?void 0:_.call(t,S,!0);if(L){s.lineWidth=r.shape.candlestickLineWidth;for(const R of A){const E=fe(t,R);s.globalAlpha=E,R.values.forEach((M,O)=>{var $;const I=($=t.getCandlestickData)==null?void 0:$.call(t,M),F=I&&Jn(t,L,M,O);if(!F)return;const V=ar(t,{id:R.id},I);s.strokeStyle=V,s.fillStyle=V,o.strokePath(()=>{o.traceLine(F.wickStart[0],F.wickStart[1],F.wickEnd[0],F.wickEnd[1])}),o.fillRect(F.body,{fill:s.fillStyle})})}}const P=f.filter(Pn.bind(null,t)),D=Gt(t,p,X.LINE,Pn.bind(null,t));s.globalAlpha=1;for(const R of P)R.values.some(Dt.bind(null,t))&&(s.globalAlpha=fe(t,R),s.lineWidth=er(t,R)?r.shape.lineFocusedWidth:r.shape.lineWidth,s.strokeStyle=t.color(R.id),qo(t,R,D,o,!0));if(s.globalAlpha=1,a.point_show&&!((x=t.isPointFocusOnly)!=null&&x.call(t))){const R=(m=t.updateCircleY)==null?void 0:m.call(t,!0),E=(v=t.subxx)==null?void 0:v.bind(t);if(E&&R){for(const M of f){if(!Ke(t,M)&&!Ze(t,M))continue;const O=t.color(M.id),$=r.shape.pointFillColor||O,I=r.shape.pointStrokeColor||O,F=I?(b=r.shape.pointLineWidth)!=null?b:1:0,V=I&&F>0?{fill:$,stroke:I,lineWidth:F}:{fill:$};s.globalAlpha=Oa(t,M)*fe(t,M),M.values.forEach((Y,j)=>{if(!Dt(t,Y))return;const dt=a.axis_rotated?R(Y,j):E(Y),it=a.axis_rotated?E(Y):R(Y,j),ft=Math.min(na(t,M,Y),3);At(dt,it)&&ta(o,"circle",dt,it,ft,V)})}s.globalAlpha=1}}})}),Yl(e,t)})})}function Yl(e,t){var n,a;const{config:i,scale:s,state:o}=t,r=o.domain;if(!i.subchart_show||i.subchart_brush_enabled===!1||!(r!=null&&r.length)||!s.subX)return;const{margin2:l,width2:c,height2:u}=o,d=s.subX(r[0]),h=s.subX(r[1]),f=i.axis_rotated?u:c,p=(a=(n=t.axis)==null?void 0:n.getExtent)==null?void 0:a.call(n),g=Array.isArray(p)&&p.length>=2&&p.every(Number.isFinite)?p.slice(0,2):[0,f],_=Math.max(0,Math.min(f,Math.min(...g))),x=Math.max(0,Math.min(f,Math.max(...g))),m=Math.max(_,Math.min(x,Math.min(d,h))),v=Math.max(_,Math.min(x,Math.max(d,h))),b=v-m;if(b<=0)return;const T=i.axis_rotated?{x:l.left,y:l.top+m,w:c,h:b}:{x:l.left+m,y:l.top,w:b,h:u};e.painter.fillRect(T,{fill:e.theme.style.subchartBrush.fill,alpha:e.theme.style.subchartBrush.opacity}),i.subchart_showHandle&&(ys(e,t,m,"start"),ys(e,t,v,"end"))}function ys(e,t,n,a){const{config:i,state:{margin2:s,width2:o,height2:r}}=t,{ctx:l,painter:c,theme:{style:u}}=e,d=i.axis_rotated,h=u.subchartBrush.handleFill,f=u.subchartBrush.handleStroke,p=d?s.left+o/2:s.left+n,g=d?s.top+n:s.top+r/2,_=Ex(d?"y":"x",a);_&&c.withState(()=>{l.translate(p,g),l.fillStyle=h,l.strokeStyle=f,l.lineWidth=u.subchartBrush.handleLineWidth,l.globalAlpha=u.subchartBrush.handleOpacity,l.fill(_),l.globalAlpha=1,l.stroke(_)})}function Ox(e,t,n){const{config:a,scale:i,state:s}=t,o=n==null?void 0:n.find(_=>_&&Dt(t,_));if(!o||!a.subchart_show||a.subchart_grid_focus_continuous||a.subchart_brush_enabled!==!1||a.grid_focus_show===!1||a.subchart_grid_focus===!1||!a.tooltip_show||a.axis_tooltip||!i.subX||s.width2<=0||s.height2<=0)return;const{margin2:r,width2:l,height2:c}=s,u=i.subX(o.x);if(!Number.isFinite(u))return;const{painter:d,theme:{style:h}}=e,f=h.axis.lineWidth,p=d.crisp(r.left+u,f),g=d.crisp(r.top+u,f);d.strokePath(()=>{a.axis_rotated?d.traceLine(r.left,g,r.left+l,g):d.traceLine(p,r.top,p,r.top+c)},{lineDash:h.focusGrid.dashArray,lineWidth:h.focusGrid.lineWidth,stroke:h.focusGrid.lineColor})}function $x(e,t){var n,a,i,s;const{ctx:o,painter:r,theme:{style:{axis:l}}}=e,{config:c,format:u,scale:d,state:{current:h,margin2:f,width2:p,height2:g}}=t;if(!c.subchart_show||!c.subchart_axis_x_show||!d.subX||p<=0||g<=0)return;const _=c.axis_rotated,x=r.crisp(f.left,l.lineWidth),m=r.crisp(f.top+g,l.lineWidth),v=f.left,b=f.left+p,T=f.top,k=f.top+g,w=_?T:v,y=_?k:b,C=dr(t),A=$f(t,C,l.tickWidth),S=(n=c.subchart_axis_x_tick_outer)!=null?n:c.axis_x_tick_outer,L=_?c.axis_x_tick_inner?1:-1:c.axis_x_tick_inner?-1:1,P=xr(_),D=zi(_),R=c.axis_x_tick_text_position,E=_?0:((a=t.getAxisTickRotate)==null?void 0:a.call(t,"x"))||0,M=u.subXAxisTick||((s=(i=t.axis)==null?void 0:i.getXAxisTickFormat)==null?void 0:s.call(i,!0));r.clipRect(_?Xi(f,h.width,g):Sx(Cx({},Ni(f,p,h.height-f.top)),{y:f.top}),()=>{o.globalAlpha=1,o.strokeStyle=l.lineColor,o.lineWidth=l.lineWidth,o.setLineDash([]),r.strokePath(()=>{_?r.traceLine(x,T,x,k):r.traceLine(v,m,b,m),S&&(_?(r.traceLine(x,T,x+xt*P,T),r.traceLine(x,k,x+xt*P,k)):(r.traceLine(v,m,v,m+xt*P),r.traceLine(b,m,b,m+xt*P)))});const O=oa(l,"x");o.font=O,o.fillStyle=l.labelColor,o.textAlign=_?D>0?"left":"right":"center",o.textBaseline=_?"middle":D>0?"top":"bottom",o.strokeStyle=l.tickColor,o.lineWidth=l.tickWidth;const $=Wi(r,ce(O)),I=Vi(t,C,_,d.subX);if(c.subchart_axis_x_tick_show)for(const F of A){const V=d.subX(Ne(t,F)),Y=f.left+V,j=f.top+V;Na(_?j:Y,w,y)&&r.strokePath(()=>{_?r.traceLine(x,j,x+xt*L,j):r.traceLine(Y,m,Y,m+xt*L)})}for(const F of C){const V=d.subX(Ne(t,F)),Y=f.left+V,j=f.top+V;if(!Na(_?j:Y,w,y)||!c.subchart_axis_x_tick_text_show)continue;const it=_r(t,r,M,F,C,_,d.subX,I);let ft,wt;_?(ft=x+(xt+fn)*D+(R.x||0),wt=j+(R.y||0),o.textAlign=D>0?"left":"right",o.textBaseline="middle"):(ft=Y+(R.x||0),wt=m+(xt+fn)*D+(R.y||0),o.textAlign=E?E>0?"left":"right":"center",o.textBaseline=D>0?"top":"bottom"),r.withState(_t=>{_t.translate(ft,wt),E&&_t.rotate(E*Math.PI/180),it.forEach((jt,It)=>{_t.fillText(jt,0,It*$)})})}})}function Fx(e,t){const{config:n,scale:a,state:{margin2:i,width2:s,height2:o}}=t;!n.subchart_show||s<=0||o<=0||["y","y2"].forEach(r=>{var l;const c=r==="y2"?a.subY2:a.subY;!n[`subchart_axis_${r}_show`]||!c||e.drawYAxis(t,r,{scale:c,ticks:sa(t,r,void 0,!0,c,`subchart_axis_${r}`),format:Mx(t,r),index:0,outerTick:(l=n[`subchart_axis_${r}_tick_outer`])!=null?l:n[`axis_${r}_tick_outer`],margin:i,width:s,height:o,prefix:`subchart_axis_${r}`,tickShow:n[`subchart_axis_${r}_tick_show`],tickTextShow:n[`subchart_axis_${r}_tick_text_show`],tickTextPosition:n[`axis_${r}_tick_text_position`]})})}var Ix={getCanvasMainPointFromSubchart(e){return Lx(this,e)},applyCanvasSubchartDomain(){const e=this,{axis:t,config:n,scale:a,state:i}=e;if(!n.subchart_show||!i.hasAxis||!a.subX)return;!i.rendered&&!i.domain&&n.subchart_init_range&&(i.domain=ms(e,n.subchart_init_range));const s=ms(e,i.domain);!s||!e.withinRange(s,e.getZoomDomain("subX",!0),e.getZoomDomain("subX"))||(i.domain=s,a.x.domain(s),t.x.scale(a.x))},setCanvasSubchartDomain(e,t=!0,n=!1){const a=this,{config:i,scale:s,state:o}=a,r=ms(a,e);if(!(!i.subchart_show||!r||!a.withinRange(r,a.getZoomDomain("subX",!0),a.getZoomDomain("subX"))))return o.domain=r,s.zoom=null,t&&a.redraw({withTransition:!1,withY:i.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),n&&i.subchart_onbrush.bind(a.api)(o.domain),o.domain},clearCanvasSubchartDomain(e=!0,t=!1){var n;const a=this,{axis:i,config:s,org:o,scale:r,state:l}=a;s.subchart_show&&(l.domain=void 0,r.zoom=null,(n=o.xDomain)!=null&&n.length&&(r.x.domain(o.xDomain),i.x.scale(r.x)),e&&a.redraw({withTransition:!1,withUpdateXDomain:!0,withUpdateOrgXDomain:!1,withY:s.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t&&s.subchart_onbrush.bind(a.api)(r.x.orgDomain()))},updateCanvasSubchartBrush(e){var t,n;const a=this,{config:i,state:s}=a,o=s.canvasSubchartBrushStart,r=s.canvasSubchartBrushOrigin,l=s.canvasSubchartBrushMode,c=vs(a,e,!0);if(i.subchart_brush_enabled===!1||!s.canvasSubchartBrushDragging||o===null||c===null||!l)return!1;const u=c-o;if(Math.abs(u)>Ax&&(s.canvasSubchartBrushMoved=!0),!s.canvasSubchartBrushMoved)return(t=e.preventDefault)==null||t.call(e),!0;let d;if(l==="move"&&r){const[f,p]=Ja(a),g=r[1]-r[0];let _=r[0]+u,x=r[1]+u;_<f&&(x+=f-_,_=f),x>p&&(_-=x-p,x=p),d=[Math.max(f,Math.min(p-g,_)),Math.min(p,Math.max(f+g,x))]}else l==="resize-start"&&r?d=bs(a,c,r[1]):l==="resize-end"&&r?d=bs(a,r[0],c):d=bs(a,o,c);const h=Px(a,d[0],d[1]);return a.setCanvasSubchartDomain(h,!0),s.cancelClick=!0,(n=e.preventDefault)==null||n.call(e),!0},updateCanvasSubchartCursor(e){const t=this,n=t.$el.canvas.node();if(t.config.subchart_brush_enabled===!1)return n.style.cursor="",!1;const a=vs(t,e);if(a===null)return n.style.cursor="",!1;const i=Hl(t,a);return n.style.cursor=Rx(t,i),!0},startCanvasSubchartBrush(e){var t;const n=this,{state:a}=n;if(n.config.subchart_brush_enabled===!1)return!1;const i=vs(n,e);if(i===null)return!1;const s=Hl(n,i);return a.event=e,a.canvasSubchartBrushDragging=!0,a.canvasSubchartBrushMode=s,a.canvasSubchartBrushStart=i,a.canvasSubchartBrushOrigin=Vl(n),a.canvasSubchartBrushMoved=!1,a.cancelClick=!0,n.setDragStatus(!0),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSubchartBrush(e){var t,n,a;const i=this,{state:s}=i;if(!s.canvasSubchartBrushDragging)return!1;i.updateCanvasSubchartBrush(e);const o=s.canvasSubchartBrushMode==="select"&&!s.canvasSubchartBrushMoved,r=s.canvasSubchartBrushMoved||o;return o?(t=i.clearCanvasSubchartDomain)==null||t.call(i,!0,!0):r&&i.config.subchart_onbrush.bind(i.api)((n=s.domain)!=null?n:i.scale.x.orgDomain()),s.canvasSubchartBrushDragging=!1,s.canvasSubchartBrushMode=null,s.canvasSubchartBrushStart=null,s.canvasSubchartBrushOrigin=null,s.canvasSubchartBrushMoved=!1,i.setDragStatus(!1),(a=e.preventDefault)==null||a.call(e),!0},cancelCanvasSubchartBrush(e){var t;const n=this,{state:a}=n;return a.canvasSubchartBrushDragging?(a.canvasSubchartBrushDragging=!1,a.canvasSubchartBrushMode=null,a.canvasSubchartBrushStart=null,a.canvasSubchartBrushOrigin=null,a.canvasSubchartBrushMoved=!1,n.setDragStatus(!1),(t=e.preventDefault)==null||t.call(e),!0):!1},onCanvasSubchartBrushStart(e){const t=this;if(!t.startCanvasSubchartBrush(e))return!1;const n=i=>{t.updateCanvasSubchartBrush(i)},a=i=>{t.endCanvasSubchartBrush(i),W.removeEventListener("mousemove",n),W.removeEventListener("mouseup",a)};return W.addEventListener("mousemove",n),W.addEventListener("mouseup",a),!0}};const Bx={draw(e,t){Dx(e,this,t)},drawXAxis(e){$x(e,this)},drawYAxes(e){Fx(e,this)},drawBrush(e){Yl(e,this)},drawBrushHandle(e,t,n){ys(e,this,t,n)},drawFocus(e,t){Ox(e,this,t)}};var zx={exclusive:!0,draw(e){var t;const n=this,{ctx:a,painter:i,theme:{style:s}}=e,{config:o}=n,r=(t=n.getTreemapRoot)==null?void 0:t.call(n,n.data.targets),l=(r==null?void 0:r.children)||[];i.withState(()=>{var c;a.lineWidth=s.treemap.lineWidth,a.strokeStyle=s.treemap.stroke;for(const u of l){const{data:d}=u;if(!Ti(n,d))continue;const{x:h,y:f,w:p,h:g}=Cn(n,u,r,!0);if(!At(h,f)||!At(h+p,f+g)||p<=0||g<=0)continue;const _={x:h,y:f,w:p,h:g};if(a.fillStyle=n.color(d.name),i.fillRect(_),i.strokeRect(_),!o.treemap_label_show||(d.ratio||0)<(o.treemap_label_threshold||0))continue;const x=Sd(n,d,p,g);if(!x)continue;const m=x.split(`
30
+ `),v=!!o.data_labels.centered;a.font=s.label.font;const b=ce(a.font),T=a.measureText((c=m[0])!=null?c:""),k=(T.fontBoundingBoxAscent||0)+(T.fontBoundingBoxDescent||0)||(T.actualBoundingBoxAscent||0)+(T.actualBoundingBoxDescent||0),w=Math.max(b,k)+(m.length-1)*b,y=v?f+g/2:f+w+5;let C=v?h+p/2:h+5,A=y-(m.length-1)*b/(v?2:1);a.textAlign=v?"center":"left",a.textBaseline=v?"middle":"alphabetic",{x:C,y:A}=e.drawLabelImage(n,d,x,C,A),a.fillStyle=Io(n,d,s.label.color),Bo(n,i,d,x,C,v?A+(m.length-1)*b/2:y),m.forEach((S,L)=>{i.text(S,C,A+L*b,{maxWidth:Math.max(0,p-8)})})}})},hits(e){var t;const n=this,a=(t=n.getTreemapRoot)==null?void 0:t.call(n,n.data.targets),i=(a==null?void 0:a.children)||[];for(const s of i){const{data:o}=s;if(!Ti(n,o))continue;const{x:r,y:l,w:c,h:u}=Cn(n,s,a,!0);!At(r,l)||!At(r+c,l+u)||e.addBar({x:r,y:l,w:c,h:u,data:o})}}},Nx=Object.defineProperty,jl=Object.getOwnPropertySymbols,Xx=Object.prototype.hasOwnProperty,Gx=Object.prototype.propertyIsEnumerable,Ul=(e,t,n)=>t in e?Nx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qa=(e,t)=>{for(var n in t||(t={}))Xx.call(t,n)&&Ul(e,n,t[n]);if(jl)for(var n of jl(t))Gx.call(t,n)&&Ul(e,n,t[n]);return e};function Wx(e,t){const n=Rt.prototype,a=n.canvasTypes||(n.canvasTypes={});a[e]=Qa(Qa({},a[e]),t)}function Ts(e,t){const n=Rt.prototype,a=n.canvasFeatures||(n.canvasFeatures={});a[e]=Qa(Qa({},a[e]),t)}var Kl={category(e,t){const n=this.internal,{config:a}=n;return arguments.length>1&&(a.axis_x_categories[e]=t,n.state.dirty.data=!0,n.redraw()),a.axis_x_categories[e]},categories(e){const t=this.internal,{config:n}=t;if(!e||!Array.isArray(e)){const a=n.axis_x_categories;return le(a)?Object.values(t.data.xs)[0]:a}return n.axis_x_categories=e,t.state.dirty.data=!0,t.redraw(),n.axis_x_categories}};function Vx(e){const t=this.config;let n,a,i;const s=()=>{const o=a.shift();if(o&&n&&ne(n)&&o in n)return n=n[o],s();if(!o)return n};Object.keys(t).forEach(o=>{n=e,a=o.split("_"),i=s(),ht(i)&&(t[o]=i)}),this.api&&(this.state.orgConfig=e)}var Hx={resize(e){const t=this.internal,{config:n,state:a}=t;a.rendered&&(n.size_width=e?e.width:null,n.size_height=e?e.height:null,a.resizing=!0,a.dirty.size=!0,this.flush(!1),t.resizeFunction())},flush(e){var t,n,a,i;const s=this.internal,{state:o,$el:{zoomResetBtn:r}}=s;o.rendered?(o.resizing?(t=s.brush)==null||t.updateResize():(n=s.axis)==null||n.setOrient(),r==null||r.style("display","none"),s.scale.zoom&&(o.current.zoomDomain=(i=(a=s.zoom)==null?void 0:a.getDomain())!=null?i:s.scale.zoom.domain()),s.scale.zoom=null,o.resizing||(o.dirty.data=!0),e?s.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):s.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1}),!o.resizing&&s.brush&&(s.brush.getSelection().call(s.brush.move),s.unselectRect()),o.current.zoomDomain&&(s.api.zoom(o.current.zoomDomain),o.current.zoomDomain=null)):s.initToRender(!0)},destroy(){var e,t,n,a,i,s,o,r,l,c,u,d;const h=this.internal,{state:f,$el:{chart:p,style:g,svg:_}}=h;if(St(h)){h.callPluginHook("$willDestroy"),(e=h.cache)==null||e.remove(["setOverOut","callOverOutForTouch"]),h.charts.splice(h.charts.indexOf(this),1),h.charts.length===0&&$p(),h.unbindAllEvents(),_==null||_.select("*").interrupt(),f.canvasFlowFrame!==null&&((n=(t=W).cancelAnimationFrame)==null||n.call(t,f.canvasFlowFrame)),f.canvasFlowFrame=null,f.canvasFlowFinish=null,f.pendingRaf!==null&&((i=(a=W).cancelAnimationFrame)==null||i.call(a,f.pendingRaf)),f.pendingRaf=null,(s=h.canvasRenderer)==null||s.destroy(),(o=h.canvasEngine)==null||o.destroy(),(r=h.resizeFunction)==null||r.clear(),(c=(l=h.resizeFunction)==null?void 0:l.clearLive)==null||c.call(l),(d=(u=h.resizeFunction)==null?void 0:u.resizeObserver)==null||d.disconnect(),h.resizeFunction&&W.removeEventListener("resize",h.resizeFunction),p.classed("bb",!1).style("position",null),f.isCanvasMode&&p.style("min-height",f.canvasInlineStyle.minHeight||null),p.selectChildren().remove(),g&&g.parentNode.removeChild(g),Object.keys(this).forEach(x=>{x==="internal"&&Object.keys(h).forEach(m=>{h[m]=null}),this[x]=null,delete this[x]});for(const x in this)this[x]=()=>{}}return null},config(e,t,n){const a=this.internal,{config:i,state:s}=a,o=e==null?void 0:e.replace(/\./g,"_");let r;return e&&o in i?ht(t)?(i[o]=t,r=t,n&&this.flush()):r=i[o]:(arguments.length===0||le(e))&&(r=s.orgConfig),r}},Yx={color(e){return this.internal.color(e)}};const Zl=function(e){const{targets:t}=this.internal.data;if(!Ct(e)){const n=et(e)?e:[e];return t.filter(a=>n.some(i=>i===a.id))}return t};pt(Zl,{shown:function(e){return this.internal.filterTargetsToShow(this.data(e))},values:function(e,t=!0){let n=null;if(e){const a=this.data(e);et(a)&&(n=[],a.forEach(i=>{t?i.values.forEach(s=>n.push(s.value)):n.push(i.values.map(s=>s.value))}))}return n},names:function(e){return this.internal.updateDataAttributes("names",e)},colors:function(e){return this.internal.updateDataAttributes("colors",e)},axes:function(e){return this.internal.updateDataAttributes("axes",e)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});var jx={data:Zl},Ux={focus(e){var t,n,a;const i=this.internal,{state:s}=i,o=i.mapToTargetIds(e);if(s.isCanvasMode){const l=o.filter(i.isTargetToShow,i),c=new Set(l),u=i.mapToTargetIds().filter(d=>!c.has(d)&&i.isTargetToShow(d));i.revertLegend(),i.toggleFocusLegend(u,!1),i.toggleFocusLegend(l,!0),s.focusedTargetIds=c,s.defocusedTargetIds=new Set(u),(t=i.renderCanvasFrame)==null||t.call(i,void 0,null,!1);return}const r=i.$el.svg.selectAll(i.selectorTargets(o.filter(i.isTargetToShow,i)));this.revert(),this.defocus(),r.classed(ut.focused,!0).classed(ut.defocused,!1),i.hasArcType()&&!s.hasRadar&&(i.expandArc(o),i.hasType("gauge")&&i.markOverlapped(e,i,`.${he.gaugeValue}`)),i.toggleFocusLegend(o,!0),s.focusedTargetIds=new Set(o),o.forEach(l=>s.defocusedTargetIds.delete(l)),(a=(n=i.customTypeHooks)==null?void 0:n.afterFocus)==null||a.call(n,i)},defocus(e){var t,n,a;const i=this.internal,{state:s}=i,o=i.mapToTargetIds(e);if(s.isCanvasMode){const l=o.filter(i.isTargetToShow,i);i.toggleFocusLegend(l,!1),l.forEach(c=>s.focusedTargetIds.delete(c)),s.defocusedTargetIds=new Set(l),(t=i.renderCanvasFrame)==null||t.call(i,void 0,null,!1);return}i.$el.svg.selectAll(i.selectorTargets(o.filter(i.isTargetToShow,i))).classed(ut.focused,!1).classed(ut.defocused,!0),i.hasArcType(null,["polar"])&&(i.unexpandArc(o),i.hasType("gauge")&&i.undoMarkOverlapped(i,`.${he.gaugeValue}`)),i.toggleFocusLegend(o,!1),o.forEach(l=>s.focusedTargetIds.delete(l)),s.defocusedTargetIds=new Set(o),(a=(n=i.customTypeHooks)==null?void 0:n.afterFocus)==null||a.call(n,i)},revert(e){var t,n,a,i,s;const o=this.internal,{config:r,state:l,$el:c}=o,u=o.mapToTargetIds(e),d=()=>{r.legend_show&&(o.showLegend(u.filter(o.isLegendToShow.bind(o))),c.legend.selectAll(o.selectorLegends(u)).filter(function(){return(0,B.select)(this).classed(ut.legendItemFocused)}).classed(ut.legendItemFocused,!1))};if(l.isCanvasMode){const f=!!((t=l.focusedTargetIds)!=null&&t.size)||!!((n=l.defocusedTargetIds)!=null&&n.size);d(),l.focusedTargetIds=new Set,l.defocusedTargetIds=new Set,f&&((a=o.renderCanvasFrame)==null||a.call(o,void 0,null,!1));return}c.svg.selectAll(o.selectorTargets(u)).classed(ut.focused,!1).classed(ut.defocused,!1),o.hasArcType(null,["polar"])&&o.unexpandArc(u),d(),l.focusedTargetIds=new Set,l.defocusedTargetIds=new Set,(s=(i=o.customTypeHooks)==null?void 0:i.afterFocus)==null||s.call(i,o)}},Kx={legend:{show:function(e){const t=this.internal;t.showLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})},hide:function(e){const t=this.internal;t.hideLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})}}},Zx={load(e){const t=this.internal,{config:n}=t;t.state.dirty.data=!0,t.state._eventRectFingerprint=null,e.xs&&t.addXs(e.xs),"names"in e&&this.data.names(e.names),"classes"in e&&Object.keys(e.classes).forEach(s=>{n.data_classes[s]=e.classes[s]}),"categories"in e&&t.axis.isCategorized()&&(n.axis_x_categories=e.categories),"axes"in e&&Object.keys(e.axes).forEach(s=>{n.data_axes[s]=e.axes[s]}),"colors"in e&&Object.keys(e.colors).forEach(s=>{n.data_colors[s]=e.colors[s]}),"regions"in e&&(n.data_regions=e.regions||{});const a=["data","columns","rows","json","url"].some(s=>s in e),i="unload"in e&&e.unload!==!1;if("regions"in e&&!a&&!i){t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),Ha.call(t,e.done,e.resizeAfter);return}if(i){const s=t.mapToTargetIds(e.unload===!0?null:e.unload);t.unload(s,()=>{!t.config||!t.cache||(t.cache.remove(s),no(()=>t.loadFromArgs(e)))})}else t.loadFromArgs(e)},unload(e){const t=this.internal;let n=e||{};le(n)&&this.tooltip.hide(),et(n)?n={ids:n}:st(n)&&(n={ids:[n]});const a=t.mapToTargetIds(n.ids);t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.unload(a,()=>{!t.config||!t.cache||(t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.cache.remove(a),Ha.call(t,n.done,n.resizeAfter))})}};function ti(e,t,n,a=!1){var i;const s=this.internal,o=s.mapToTargetIds(t),r=new Set(o),l=[...s.state.hiddenTargetIds].filter(d=>r.has(d));if(s.state.toggling=!0,s.state.dirty.visibility=!0,s[`${e?"remove":"add"}HiddenTargetIds`](o),s.state.isCanvasMode){e&&l.length?q(s.config.data_onshown,this,l):!e&&l.length===0&&q((i=s.config)==null?void 0:i.data_onhidden,this,o),a||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1;return}const c=s.$el.svg.selectAll(s.selectorTargets(o)),u=e?null:"0";e&&l.length&&(c.style("display",null),q(s.config.data_onshown,this,l)),s.$T(c).style("opacity",u,"important").call(Aa,()=>{var d;!e&&l.length===0&&(c.style("display","none"),q((d=s.config)==null?void 0:d.data_onhidden,this,o)),c.style("opacity",u)}),n.withLegend&&s[`${e?"show":"hide"}Legend`](o),a||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1}var qx={show(e,t={}){ti.call(this,!0,e,t)},hide(e,t={}){ti.call(this,!1,e,t)},toggle(e,t={}){const n=this.internal,a={show:[],hide:[]};n.mapToTargetIds(e).forEach(i=>a[n.isTargetToShow(i)?"hide":"show"].push(i)),a.show.length&&a.hide.length?(ti.call(this,!0,a.show,t,!0),ti.call(this,!1,a.hide,t)):(a.show.length&&this.show(a.show,t),a.hide.length&&this.hide(a.hide,t))}},Jx=Object.defineProperty,Qx=Object.defineProperties,tm=Object.getOwnPropertyDescriptors,ql=Object.getOwnPropertySymbols,em=Object.prototype.hasOwnProperty,nm=Object.prototype.propertyIsEnumerable,Jl=(e,t,n)=>t in e?Jx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,am=(e,t)=>{for(var n in t||(t={}))em.call(t,n)&&Jl(e,n,t[n]);if(ql)for(var n of ql(t))nm.call(t,n)&&Jl(e,n,t[n]);return e},im=(e,t)=>Qx(e,tm(t)),sm={tooltip:{show:function(e){var t,n,a,i,s,o,r,l,c,u,d,h,f,p,g,_,x,m,v,b,T,k;const w=this.internal,{$el:y,config:C,state:{customType:A,eventReceiver:S,hasTreemap:L,inputType:P,isCanvasMode:D}}=w;let R,E;if(A&&!D&&!e.data){const M=(n=(t=w.customTypeHooks)==null?void 0:t.tooltipTarget)==null?void 0:n.call(t,w,e).data[0];M&&(e=im(am({},e),{data:{id:M.id},index:(a=e.index)!=null?a:M.index}))}if(e.mouse&&(E=e.mouse),e.data){const{data:M}=e,O=(i=w.getYScaleById(M.id))==null?void 0:i(M.value);if((A||L)&&M.id){if(!D){const $=`.${vt.shape}`,I=(c=(s=e.index)!=null?s:M.index)!=null?c:ht(e.x)?(l=(r=(o=w.customTypeHooks)==null?void 0:o.tooltipTarget)==null?void 0:r.call(o,w,e).data[0])==null?void 0:l.index:void 0,F=ht(I)?y.main.select(w.selectorTarget(M.id,void 0,`${$}${$}-${I}`)):null;S.rect=F!=null&&F.node()?F:y.main.select(w.selectorTarget(M.id,void 0,$))}}else w.isMultipleX()?E=[w.xx(M),O]:(C.tooltip_grouped||(E=[0,O]),R=(d=M.index)!=null?d:w.hasArcType()&&M.id?(u=w.getArcElementByIdOrIndex(M.id))==null?void 0:u.datum().index:w.getIndexByX(M.x))}else ht(e.x)?R=w.getIndexByX(e.x):ht(e.index)&&(R=e.index);if(w.state.isCanvasMode){const M=((h=w.filterTargetsToShow)==null?void 0:h.call(w))||w.data.targets,O=A?(p=(f=w.customTypeHooks)==null?void 0:f.tooltipTarget)==null?void 0:p.call(f,w,e):null,$=O?O.data:(g=e.data)!=null&&g.id&&!C.tooltip_grouped?M.filter(j=>j.id===e.data.id).map(j=>j.values[R!=null?R:e.data.index]).filter(Boolean):M.map(j=>j.values[R]).filter(Boolean),I=(x=(_=y.canvas)==null?void 0:_.node)==null?void 0:x.call(_),F=w.state.canvasShape||((m=w.getDrawShape)==null?void 0:m.call(w)),V=$[0],Y=E||(O?O.point:V&&((v=F==null?void 0:F.pos)!=null&&v.cx)&&((b=F==null?void 0:F.pos)!=null&&b.cy)?[w.state.margin.left+F.pos.cx(V),w.state.margin.top+F.pos.cy(V)]:void 0);if(!$.length||!I)return;if(O&&Y){const j=I.getBoundingClientRect();w.state.event={clientX:j.left+Y[0],clientY:j.top+Y[1]}}w.state.canvasFocusKey=$.map(j=>`${j.id}:${j.index}`).join("|"),(T=w.renderCanvasFocus)==null||T.call(w,$,Y),(k=w.showTooltip)==null||k.call(w,$,I);return}(P==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(M=>{w.dispatchEvent(M,R,E)})},hide:function(){var e,t,n,a,i;const s=this.internal,{state:{inputType:o,isCanvasMode:r},$el:{tooltip:l}}=s,c=l==null?void 0:l.datum();if(r){s.state.canvasFocusKey=null,s.hideTooltip(!0),(e=s.clearCanvasFocus)==null||e.call(s);return}if((t=c==null?void 0:c.data)!=null&&t[0]){const{index:u}=c.data[0];(o==="mouse"?["mouseout"]:["touchend"]).forEach(d=>{s.dispatchEvent(d,u)})}o==="touch"&&s.callOverOutForTouch(),s.hideTooltip(!0),(n=s.hideGridFocus)==null||n.call(s),(a=s.unexpandCircles)==null||a.call(s),(i=s.expandBarTypeShapes)==null||i.call(s,!1)}}},om=Object.defineProperty,rm=(e,t,n)=>t in e?om(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ql=(e,t,n)=>rm(e,typeof t!="symbol"?t+"":t,n);class Jt{constructor(t){Ql(this,"plugins",[]),Ql(this,"internal");const n=new Rt(this);this.internal=n,(function a(i,s,o){Object.keys(i).forEach(r=>{const l=G(i[r]),c=s!==o,u=St(i[r]),d=u&&Object.keys(i[r]).length>0;l&&(!c&&d||c)?s[r]=i[r].bind(o):u&&!l?s[r]={}:s[r]=i[r],d&&a(i[r],s[r],o)})})(Jt.prototype,this,this),Vx.call(n,t),n.beforeInit(),n.init()}}pt(Jt.prototype,[Hx,Yx,jx,Ux,Kx,Zx,qx,sm]);let tc=()=>(Jt.prototype.category=Kl.category,Jt.prototype.categories=Kl.categories,(tc=()=>({}))());var lm=Object.defineProperty,ec=Object.getOwnPropertySymbols,cm=Object.prototype.hasOwnProperty,um=Object.prototype.propertyIsEnumerable,nc=(e,t,n)=>t in e?lm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ei=(e,t)=>{for(var n in t||(t={}))cm.call(t,n)&&nc(e,n,t[n]);if(ec)for(var n of ec(t))um.call(t,n)&&nc(e,n,t[n]);return e};function vn(e,t){const n=Rt.prototype,a=n.customTypes||(n.customTypes={});a[e]=ei(ei({},a[e]),t)}function ac(e,t){const n=Rt.prototype,a=n.axisTypes||(n.axisTypes={});a[e]=ei(ei({},a[e]),t)}const dm=e=>{var t,n;return(n=(t=W).btoa)==null?void 0:n.call(t,encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(a,i)=>String.fromCharCode(+`0x${i}`)))};function hm(e,t,n){const{width:a,height:i}=t||n,s=new XMLSerializer,o=e.cloneNode(!0),r=bp(dn(rt.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",B.namespaces.xhtml),o.style.margin="0",o.style.padding="0",t.preserveFontStyle&&o.querySelectorAll("text").forEach(h=>{h.innerHTML=""});const l=s.serializeToString(o),c=rt.createElement("style");c.appendChild(rt.createTextNode(r.join(`
31
+ `)));const u=s.serializeToString(c),d=`<svg xmlns="${B.namespaces.svg}" width="${a}" height="${i}"
32
32
  viewBox="0 0 ${n.width} ${n.height}"
33
33
  preserveAspectRatio="${(t==null?void 0:t.preserveAspectRatio)===!1?"none":"xMinYMid meet"}">
34
34
  <foreignObject width="100%" height="100%">
35
- ${d}
35
+ ${u}
36
36
  ${l.replace(/(url\()[^#]+/g,"$1")}
37
- </foreignObject></svg>`;return`data:image/svg+xml;base64,${Np(u)}`}function Gp(e,t){const{top:n,left:i}=t,{x:a,y:s}=Ue(e,!0),{a:o,b:r,c:l,d:c,e:d,f:u}=e.getScreenCTM(),{width:h,height:f}=ht(e,!0);return{x:o*a+l*s+d-i,y:r*a+c*s+u-n+(f-Math.round(f/4)),width:h,height:f}}function Vp(e){const{left:t,top:n}=ht(e),i=s=>s.textContent||s.childElementCount,a=[];return nn(e.querySelectorAll("text")).filter(i).forEach(s=>{const o=r=>{const{fill:l,fontFamily:c,fontSize:d,textAnchor:u,transform:h}=N.getComputedStyle(r),{x:f,y:g,width:p,height:_}=Gp(r,{left:t,top:n});return{[r.textContent]:{x:f,y:g,width:p,height:_,fill:l,fontFamily:c,fontSize:d,textAnchor:u,transform:h}}};s.childElementCount>1?nn(s.querySelectorAll("tspan")).filter(i).forEach(r=>{a.push(o(r))}):a.push(o(s))}),a}function Wp(e,t){t.forEach(n=>{Object.keys(n).forEach(i=>{const{x:a,y:s,width:o,height:r,fill:l,fontFamily:c,fontSize:d,transform:u}=n[i];if(e.save(),e.font=`${d} ${c}`,e.fillStyle=l,u==="none")e.fillText(i,a,s);else{const h=u.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(f=>+f==0)?(h.push(a+o-o/4),h.push(s-r+r/3)):(h.push(a),h.push(s)),e.transform(...h),e.fillText(i,0,0)}e.restore()})})}function Yp(e,t,n){const{width:i,height:a}=t||n,s=nt.createElement("canvas"),o=s.getContext("2d");if(s.width=i,s.height=a,o){let l=0,c=i,d=a;if((t==null?void 0:t.preserveAspectRatio)!==!1){const u=Math.min(i/n.width,a/n.height);c=n.width*u,d=n.height*u,l=(a-d)/2}o.drawImage(e,0,0,e.width,e.height,0,l,c,d)}return s.toDataURL(t.mimeType)}var Hp={export(e,t){var n;const i=this.internal,{state:a,$el:{chart:s,svg:o}}=i,r=(n=i.canvasEngine)==null?void 0:n.canvas,l=a.isCanvasMode&&r?ht(r,!0):null,{width:c,height:d}=l&&l.width&&l.height?{width:l.width,height:l.height}:a.current,u=Ae(Object.create(null),{width:c,height:d,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e);if(a.isCanvasMode&&r){const g=Yp(r,u,{width:c,height:d});return t==null||t.bind(this)(g),g}const h=Xp(s.node(),u,{width:c,height:d}),f=u.preserveFontStyle?Vp(o.node()):[];if(t&&z(t)){const g=new Image;g.crossOrigin="Anonymous",g.onload=()=>{const p=nt.createElement("canvas"),_=p.getContext("2d");p.width=u.width||c,p.height=u.height||d,_.drawImage(g,0,0),f.length&&(Wp(_,f),f.length=0),t.bind(this)(p.toDataURL(u.mimeType))},g.src=h}return h}};let fl=()=>(Yt.prototype.export=Hp.export,(fl=()=>({}))());var jp={flow(e){const t=this.internal;let n;(e.json||e.rows||e.columns)&&t.convertData(e,a=>{n=a,i()});function i(){var a,s,o;let r,l=0,c=0,d,u;if(t.state.redrawing||!n||!Zn())return;(a=t.flushCanvasFlow)==null||a.call(t);const h=[],f=t.getMaxDataCount(),g=t.convertDataToTargets(n,!0),p=t.axis.isTimeSeries();t.data.targets.forEach(m=>{let b=!1;for(let v=0;v<g.length;v++)if(m.id===g[v].id){b=!0,m.values[m.values.length-1]&&(c=m.values[m.values.length-1].index+1);const y=g[v].values;l=y.length;for(let T=0;T<l;T++)y[T].index=c+T,p||(y[T].x=c+T),m.values.push(y[T]);g.splice(v,1);break}!b&&h.push(m.id)}),t.data.targets.forEach(m=>{for(let b=0;b<h.length;b++)if(m.id===h[b]){if(!m.values[m.values.length-1])continue;c=m.values[m.values.length-1].index+1;for(let v=0;v<l;v++)m.values.push({id:m.id,index:c+v,x:p?t.getOtherTargetX(c+v):c+v,value:null})}}),t.data.targets.length&&g.forEach(m=>{const b=t.data.targets[0].values[0].index,v=m.values,y=v.length,T=Math.max(c-b,0);if(T){v.length=y+T;for(let w=y-1;w>=0;w--)v[w+T]=v[w];for(let w=0;w<T;w++){const C=b+w;v[w]={id:m.id,index:C,x:p?t.getOtherTargetX(C):C,value:null}}}for(let w=T;w<v.length;w++){const C=v[w];C.index+=c,p||(C.x+=c)}});for(let m=0;m<g.length;m++)t.data.targets.push(g[m]);const _=t.data.targets[0],x=_.values[0];if(ct(e.to)?(l=0,u=p?Vt.call(t,e.to):e.to,_.values.forEach(m=>{m.x<u&&l++})):ct(e.length)&&(l=e.length),f?f===1&&p&&(d=(_.values[_.values.length-1].x-x.x)/2,r=[new Date(+x.x-d),new Date(+x.x+d)]):(p?d=_.values.length>1?_.values[_.values.length-1].x-x.x:x.x-t.getXDomain(t.data.targets)[0]:d=1,r=[x.x-d,x.x]),r&&t.updateXDomain(null,!0,!0,!1,r),t.state.isCanvasMode){const m=q(e.duration)?e.duration:t.config.transition_duration;if((s=t.animateCanvasFlow)==null?void 0:s.call(t,{done:e.done,duration:m,length:l,orgDataCount:f}))return;l&&f&&t.data.targets.forEach(v=>{v.values.splice(0,l)}),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),t.updateTypesElements(),(o=e.done)==null||o.call(t.api);return}t.updateTargets(t.data.targets),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({flow:{index:x.index,length:l,duration:q(e.duration)?e.duration:t.config.transition_duration,done:e.done,orgDataCount:f},withLegend:!0,withTransition:f>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}},Up={generateFlow(e){const t=this,{data:n,state:i,$el:a}=t;return function(){var s;const o=e.flow.length;i.flowing=!0,n.targets.forEach(l=>{l.values.splice(0,o)}),i.dataGeneration++,t.updateXGrid&&t.updateXGrid(!0);const r={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(l=>{const c=l.split(".");let d=a[c[0]];d&&c.length>1&&(d=d[c[1]]),d!=null&&d.size()&&(r[l]=d)}),(s=t.hideGridFocus)==null||s.call(t),t.setFlowList(r,e)}},setFlowList(e,t){const n=this,{flow:i,targets:a}=t,{duration:s=t.duration,index:o,length:r,orgDataCount:l}=i,c=n.getFlowTransform(a,l,o,r),d=fr();let u;d.add(Object.keys(e).map(h=>(u=e[h].transition().ease(f=>+f).duration(s),h==="axis.x"?u=u.call(f=>{n.axis.x.setTransition(f).create(f)}):h==="region.list"?u=u.filter(n.isRegionOnX).attr("transform",c):u=u.attr("transform",c),u))),u.call(d,()=>{n.cleanUpFlow(e,t)})},cleanUpFlow(e,t){const n=this,{config:i,state:a,$el:{svg:s}}=n,o=i.axis_rotated,{flow:r,shape:l,xv:c}=t,{cx:d,cy:u,xForText:h,yForText:f}=l.pos,{done:g=()=>{},length:p}=r;p&&(["circle","text","shape","eventRect"].forEach(_=>{const x=[];for(let m=0;m<p;m++)x.push(`.${V[_]}-${m}`);s.selectAll(`.${V[`${_}s`]}`).selectAll(x).remove()}),s.select(`.${V.xgrid}`).remove()),Object.keys(e).forEach(_=>{const x=e[_];if(_!=="axis.x"&&x.attr("transform",null),_==="grid.x")x.attr(a.xgridAttr);else if(_==="gridLines.x")x.attr("x1",o?0:c).attr("x2",o?a.width:c),x.select("text").attr("x",o?a.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(_))x.attr("d",l.type[_]);else if(_==="text")x.attr("x",h).attr("y",f).style("fill-opacity",n.opacityForText.bind(n));else if(_==="circle")if(n.isCirclePoint())x.attr("cx",d).attr("cy",u);else{const m=v=>d(v)-i.point_r,b=v=>u(v)-i.point_r;x.attr("x",m).attr("y",b)}else _==="region.list"&&x.select("rect").filter(n.isRegionOnX).attr("x",n.regionX.bind(n)).attr("width",n.regionWidth.bind(n))}),i.interaction_enabled&&n.redrawEventRect(),g.call(n.api),a.flowing=!1},getFlowTransform(e,t,n,i){const a=this,{data:s,scale:{x:o}}=a,r=s.targets[0].values;let l=a.getValueOnIndex(r,n),c=a.getValueOnIndex(r,n+i),d;const u=o.domain(),h=a.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?d=o(u[0])-o(h[0]):d=a.axis.isTimeSeries()?o(u[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?d=o(u[0])-o(h[0]):a.axis.isTimeSeries()?(l=a.getValueOnIndex(r,0),c=a.getValueOnIndex(r,r.length-1),d=o(l.x)-o(c.x)):d=en(h)/2;const f=en(u)/en(h);return`translate(${d},0) scale(${f},1)`}};let gl=()=>(St(pe.prototype,Up),Yt.prototype.flow=jp.flow,(gl=()=>({}))());function pl(e){return Array.isArray(e)?e:[e]}function _l(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function Ja(e,t){const n=this.internal,{config:i}=n,a=i.transition_duration&&Zn(),s=`grid_${t}_lines`;return e?(i[s]=pl(e),n.state.isCanvasMode?(_l(n),i[s]):(n.updateGrid(),n.redrawGrid(a),i[s])):i[s]}function xl(e,t){const n=`grid_${t}_lines`;return Ja.bind(this)(this.internal.config[n].concat(e?pl(e):[]),t)}function ml(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){const a=((n=i.getGridFilterToRemove)==null?void 0:n.call(i,e))||(()=>!0),s=`grid_${t?"x":"y"}_lines`;i.config[s]=i.config[s].filter(o=>!a(o)),_l(i);return}i.removeGridLines(e,t)}const vl=function(e){return Ja.bind(this)(e,"x")};St(vl,{add(e){return xl.bind(this)(e,"x")},remove(e){return ml.bind(this)(e,!0)}});const bl=function(e){return Ja.bind(this)(e,"y")};St(bl,{add(e){return xl.bind(this)(e,"y")},remove(e){return ml.bind(this)(e,!1)}});var yl={xgrids:vl,ygrids:bl};const Kp=`line.${lt.xgridFocus}:not(.${lt.xgridFocusContinuous}), line.${lt.ygridFocus}`,Zp=e=>q(e.position)||"end",qp=e=>e.position==="start"?4:e.position==="middle"?0:-4;function Tl(e){var t;const{state:n,$el:{main:i}}=e,a=n._gridFocusEl,s=i.node(),o=((t=a==null?void 0:a.nodes)==null?void 0:t.call(a))||[];return o.length&&o.every(r=>s==null?void 0:s.contains(r))?a:n._gridFocusEl=i.selectAll(Kp)}function wl(e){e.$el.main.select(`line.${lt.xgridFocusContinuous}`).style("visibility","hidden")}function Cl(e,t,n){return i=>{let a=e?0:t;return i.position==="start"?a=e?-n:0:i.position==="middle"&&(a=(e?-n:t)/2),a}}function Sl(e,t){t==="grid"&&e.each(function(){const n=(0,F.select)(this);["x1","x2","y1","y2"].forEach(i=>n.attr(i,+n.attr(i)))})}var Jp={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:n},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${U.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",n.pathGrid).attr("class",`${At.grid} ${At.gridLines}`),i.gridLines.main.append("g").attr("class",At.xgridLines),i.gridLines.main.append("g").attr("class",At.ygridLines),i.gridLines.x=(0,F.selectAll)([]))},updateXGrid(e){const t=this,{config:n,scale:i,state:a,$el:{main:s,grid:o}}=t,r=n.axis_rotated,l=t.generateGridData(n.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,d=u=>(i.zoom||i.x)(u)+c*(r?-1:1);a.xgridAttr=r?{x1:0,x2:a.width,y1:d,y2:d}:{x1:d,x2:d,y1:0,y2:a.height},o.x=s.select(`.${At.xgrids}`).selectAll(`.${At.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",At.xgrid).merge(o.x),e||o.x.each(function(){const u=(0,F.select)(this);Object.keys(a.xgridAttr).forEach(h=>{u.attr(h,a.xgridAttr[h])}),u.style("opacity",()=>+u.attr(r?"y1":"x1")===(r?a.height:0)?"0":null)})},updateYGrid(){const e=this,{axis:t,config:n,scale:i,state:a,$el:{grid:s,main:o}}=e,r=n.axis_rotated,l=u=>i.y(u),c=t.y.getGeneratedTicks(n.grid_y_ticks),d=c!=null&&c.length?c:e.scale.y.ticks(n.grid_y_ticks);s.y=o.select(`.${At.ygrids}`).selectAll(`.${At.ygrid}`).data(d),s.y.exit().remove(),s.y=s.y.enter().append("line").attr("class",At.ygrid).merge(s.y),s.y.attr("x1",r?l:0).attr("x2",r?l:a.width).attr("y1",r?0:l).attr("y2",r?a.height:l),Sl(s.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:n}}=e;!n.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:n,$el:{gridLines:i,main:a},$T:s}=t,o=n.axis_rotated,r=e==="x";n[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=a.select(`.${At[`${e}gridLines`]}`).selectAll(`.${At[`${e}gridLine`]}`).data(n[`grid_${e}_lines`]);s(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(d){const u=(0,F.select)(this);u.select("text").empty()&&d.text&&u.append("text").style("opacity","0")}),s(l.attr("class",d=>`${At[`${e}gridLine`]} ${d.class||""}`.trim()).select("text").attr("text-anchor",Zp).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",qp).attr("dy",-5)).text(function(d){var u;return(u=d.text)!=null?u:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:n},state:{width:i,height:a},$el:{gridLines:s},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=s.x.select("line"),d=s.x.select("text"),u=s.y.select("line"),h=s.y.select("text");return c=o(c,e).attr("x1",n?0:r).attr("x2",n?i:r).attr("y1",n?r:0).attr("y2",n?r:a),d=o(d,e).attr("x",Cl(!n,i,a)).attr("y",r),u=o(u,e).attr("x1",n?l:0).attr("x2",n?l:i).attr("y1",n?0:l).attr("y2",n?a:l),h=o(h,e).attr("x",Cl(n,i,a)).attr("y",l),[c.style("opacity",null),d.style("opacity",null),u.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:n,state:{clip:i},$el:a}=e;n._gridFocusEl=null;const s=t.grid_front,o=`.${s&&a.gridLines.main?At.gridLines:U.chart}${s?" + *":""}`,r=a.main.insert("g",o).attr("clip-path",i.pathGrid).attr("class",At.grid);if(a.grid.main=r,t.grid_x_show&&r.append("g").attr("class",At.xgrids),t.grid_y_show&&r.append("g").attr("class",At.ygrids),t.axis_tooltip){const l=r.append("g").attr("class","bb-axis-tooltip");l.append("line").attr("class","bb-axis-tooltip-x"),l.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(r.append("g").attr("class",lt.xgridFocus).append("line").attr("class",lt.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&r.append("g").attr("class",lt.ygridFocus).append("line").attr("class",lt.ygridFocus),t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&a.main.insert("g",o).attr("class",lt.xgridFocusContinuous).append("line").attr("class",`${lt.xgridFocus} ${lt.xgridFocusContinuous}`).style("visibility","hidden"))},showAxisGridFocus(){var e,t;const n=this,{config:i,format:a,state:{event:s,width:o,height:r}}=n,l=i.axis_rotated,[c,d]=Zt(s,(e=n.$el.eventRect)==null?void 0:e.node()),u={x:c,y:d};for(const[h,f]of Object.entries(n.$el.axisTooltip)){const g=h==="x"&&!l||h!=="x"&&l?"x":"y",p=u[g];let _=(t=n.scale[h])==null?void 0:t.invert(p);_&&(_=h==="x"&&n.axis.isTimeSeries()?a.xAxisTick(_):_==null?void 0:_.toFixed(2),f==null||f.attr(g,p).text(_))}n.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,f){const g=(0,F.select)(this);f===0?g.attr("x1",c).attr("x2",c).attr("y1",f?0:r).attr("y2",f?r:0):g.attr("x1",f?0:o).attr("x2",f?o:0).attr("y1",d).attr("y2",d)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll(`line.${It.axisTooltipX}, line.${It.axisTooltipY}`).style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const n=this,{config:i,state:{width:a,height:s}}=n,o=i.axis_rotated,r=Tl(n),l=(e||[r.datum()]).filter(u=>u&&q(n.getBaseValue(u)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&n.hasType("bubble")||n.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,d=n.xx.bind(n);r.style("visibility",null).data(l.concat(l)).each(function(u){const h=(0,F.select)(this),f={x:d(u),y:n.getYScaleById(u.id)(u.value)};let g;if(h.classed(lt.xgridFocus))g=o?[null,f.x,c?f.y:a,f.x]:[f.x,c?f.y:null,f.x,s];else{const p=n.axis.getId(u.id)==="y2";g=o?[f.y,c&&!p?f.x:null,f.y,c&&p?f.x:s]:[c&&p?f.x:null,f.y,c&&!p?f.x:a,f.y]}["x1","y1","x2","y2"].forEach((p,_)=>h.attr(p,g[_]))}),Sl(r,"grid"),(t=n.showCircleFocus)==null||t.call(n,e)},hideGridFocus(e=!1){var t;const n=this,{state:{inputType:i,resizing:a}}=n;(e||i==="mouse"||!a)&&(Tl(n).style("visibility","hidden"),wl(n),(t=n.hideCircleFocus)==null||t.call(n))},updateGridFocus(){var e;const t=this,{state:{inputType:n,width:i,height:a,resizing:s},$el:{grid:o}}=t,r=o.main.select(`line.${lt.xgridFocus}`);if(n==="touch")r.empty()?s&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:a),wl(t)}return!0},generateGridData(e,t){const n=this,i=n.$el.main.select(`.${It.axisX}`).selectAll(".tick").size();let a=[];if(e==="year"){const s=n.getXDomain(n.data.targets),[o,r]=s.map(l=>l.getFullYear());for(let l=o;l<=r;l++)a.push(new Date(`${l}-01-01 00:00:00`))}else a=t.ticks(xe),a.length>i&&(a=a.filter(s=>String(s).indexOf(".")<0));return a},getGridFilterToRemove(e){return e?t=>{let n=!1;return(ot(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(n=!0)}),n}:()=>!0},removeGridLines(e,t){const n=this,{config:i,$T:a}=n,s=n.getGridFilterToRemove(e),o=d=>!s(d),r=t?At.xgridLines:At.ygridLines,l=t?At.xgridLine:At.ygridLine;a(n.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(s)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},Qp={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 Al=()=>(St(pe.prototype,Jp),Yt.prototype.xgrids=yl.xgrids,Yt.prototype.ygrids=yl.ygrids,cn.setOptions([Qp]),(Al=()=>({}))());function kl(e,t,n,i){const a=this,{config:s,$el:{main:o}}=a,r=s.data_selection_grouped,l=s.data_selection_isselectable.bind(a.api),c=ct(t)?[].concat(t):null,d=e&&!s.data_selection_multiple;let u=!d;const h=(f,g,p)=>{a.unselectPoint(f,g,p),f.interrupt().remove()};a.getTargetsToShow().forEach(f=>{const{id:g}=f,p=r||!c||c.indexOf(g)>=0,_=o.select(`.${ut.selectedCircles}${a.getTargetSelectorSuffix(g)}`);f.values.forEach(x=>{const{index:m}=x,b=!n||n.indexOf(m)>=0,v=_.selectAll(`.${ut.selectedCircle}-${m}`),y=!v.empty();e?p&&b&&l(x)&&(!y||d)?(u||(kl.call(a,!1),u=!0),a.selectPoint(null,x,m)):(!d||u)&&ct(i)&&i&&y&&h(v,x,m):p&&b&&y&&h(v,x,m)})})}function Qa(e=!1,t,n,i){var a;const s=this,{config:o,$el:{main:r}}=s,l=o.data_selection_grouped,c=o.data_selection_isselectable.bind(s.api),d=e&&!o.data_selection_multiple;let u=!d;if(o.data_selection_enabled){if(d&&(n=n!=null&&n.length?[n[0]]:[0],l||(t=(ct(t)?[].concat(t):s.getTargetsToShow().map(f=>f.id)).slice(0,1))),(a=s.isPointFocusOnly)!=null&&a.call(s)){kl.call(s,e,t,n,i);return}r.selectAll(`.${kt.shapes}`).selectAll(`.${kt.shape}`).each(function(h){const f=(0,F.select)(this),{id:g,index:p}=h.data?h.data:h,_=l||!t||t.indexOf(g)>=0,x=!n||n.indexOf(p)>=0;if(f.classed(Ce.line)||f.classed(Ci.area))return;const m=s.getToggle(this,h).bind(s),b=f.classed(ut.SELECTED);e?_&&x&&c(h)&&(!b||d)?(u||(Qa.call(s,!1),u=!0),!f.classed(ut.SELECTED)&&m(!0,f.classed(ut.SELECTED,!0),h,p)):(!d||u)&&ct(i)&&i&&b&&m(!1,f.classed(ut.SELECTED,!1),h,p):_&&x&&c(h)&&b&&m(!1,f.classed(ut.SELECTED,!1),h,p)})}}var t_={selected(e){var t,n;const i=this.internal,a=[];return i.state.isCanvasMode?((t=i.getCanvasSelectedData)==null?void 0:t.call(i,e))||a:(n=i.isPointFocusOnly)!=null&&n.call(i)?(i.$el.main.selectAll(`.${ut.selectedCircles+i.getTargetSelectorSuffix(e)}`).selectAll(`.${ut.selectedCircle}`).each(s=>a.push(s)),a):(i.$el.main.selectAll(`.${kt.shapes+i.getTargetSelectorSuffix(e)}`).selectAll(`.${kt.shape}`).filter(function(){return(0,F.select)(this).classed(ut.SELECTED)}).each(s=>a.push(s)),a)},select(e,t,n){var i;const a=this.internal;if(a.state.isCanvasMode){(i=a.setCanvasSelection)==null||i.call(a,!0,e,t,n);return}Qa.bind(a)(!0,e,t,n)},unselect(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){(n=i.setCanvasSelection)==null||n.call(i,!1,e,t);return}Qa.bind(i)(!1,e,t)}},e_={drag(e){const t=this,{config:n,state:i,$el:{main:a}}=t,s=n.data_selection_grouped,o=n.interaction_enabled&&n.data_selection_isselectable;if(t.hasArcType()||!n.data_selection_enabled||n.zoom_enabled&&!t.zoom.altDomain||!n.data_selection_multiple)return;const[r,l]=i.dragStart||[0,0],[c,d]=e,u=Math.min(r,c),h=Math.max(r,c),f=s?i.margin.top:Math.min(l,d),g=s?i.height:Math.max(l,d),p=()=>{!t||!t.$el||!t.$el.main||(a.select(`.${ln.dragarea}`).attr("x",u).attr("y",f).attr("width",h-u).attr("height",g-f),a.selectAll(`.${kt.shapes}`).selectAll(`.${kt.shape}`).filter(_=>o==null?void 0:o.bind(t.api)(_)).each(function(_,x){const m=(0,F.select)(this),b=m.classed(ut.SELECTED),v=m.classed(ln.INCLUDED);let y,T;if(m.classed(Nt.circle)){const w=+m.attr("cx"),C=+m.attr("cy");T=t.togglePoint,y=u<w&&w<h&&f<C&&C<g}else if(m.classed(ie.bar)){const{x:w,y:C,width:A,height:S}=ur(this);T=t.togglePath,y=!(h<w||w+A<u)&&!(g<C||C+S<f)}else return;y^v&&(m.classed(ln.INCLUDED,!v),m.classed(ut.SELECTED,!b),T.call(t,!b,m,_,x))}))};hr(t.state,p)},dragstart(e){const t=this,{config:n,state:i,$el:{main:a}}=t;t.hasArcType()||!n.data_selection_enabled||(i.dragStart=e,a.select(`.${U.chart}`).append("rect").attr("class",ln.dragarea).style("opacity","0.1"),t.setDragStatus(!0))},dragend(){const e=this,{config:t,$el:{main:n},$T:i}=e;e.hasArcType()||!t.data_selection_enabled||(i(n.select(`.${ln.dragarea}`)).style("opacity","0").remove(),n.selectAll(`.${kt.shape}`).classed(ln.INCLUDED,!1),e.setDragStatus(!1))}},n_=Object.defineProperty,i_=Object.defineProperties,a_=Object.getOwnPropertyDescriptors,Ll=Object.getOwnPropertySymbols,s_=Object.prototype.hasOwnProperty,o_=Object.prototype.propertyIsEnumerable,Rl=(e,t,n)=>t in e?n_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r_=(e,t)=>{for(var n in t||(t={}))s_.call(t,n)&&Rl(e,n,t[n]);if(Ll)for(var n of Ll(t))o_.call(t,n)&&Rl(e,n,t[n]);return e},l_=(e,t)=>i_(e,a_(t)),c_=l_(r_({},e_),{selectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i,r=a.axis_rotated,l=(r?i.circleY:i.circleX).bind(i),c=(r?i.circleX:i.circleY).bind(i),d=i.pointSelectR.bind(i);H(a.data_onselected,i.api,t,e==null?void 0:e.node()),o(s.select(`.${ut.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${ut.selectedCircle}-${n}`).data([t]).enter().append("circle").attr("class",()=>i.generateClass(ut.selectedCircle,n)).attr("cx",l).attr("cy",c).attr("stroke",i.color).attr("r",u=>i.pointSelectR(u)*1.4)).attr("r",d)},unselectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i;H(a.data_onunselected,i.api,t,e==null?void 0:e.node()),o(s.select(`.${ut.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${ut.selectedCircle}-${n}`)).attr("r",0).remove()},togglePoint(e,t,n,i){this[`${e?"":"un"}selectPoint`](t,n,i)},selectPath(e,t){const n=this,{config:i}=n;H(i.data_onselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter","brightness(1.25)")},unselectPath(e,t){const n=this,{config:i}=n;H(i.data_onunselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter",null)},togglePath(e,t,n,i){this[`${e?"":"un"}selectPath`](t,n,i)},getToggle(e,t){const n=this;return e.nodeName==="path"?n.togglePath:n.isStepType(t)?()=>{}:n.togglePoint},toggleShape(e,t,n){var i;const a=this,{config:s,$el:{main:o}}=a;if(s.data_selection_enabled&&s.data_selection_isselectable.bind(a.api)(t)){const r=(0,F.select)(e),l=r.classed(ut.SELECTED),c=a.getToggle(e,t).bind(a);let d;if(!s.data_selection_multiple){const u=(i=a.isPointFocusOnly)==null?void 0:i.call(a);let h=`.${u?ut.selectedCircles:kt.shapes}`;s.data_selection_grouped&&(h+=a.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(u?`.${ut.selectedCircle}`:`.${kt.shape}.${ut.SELECTED}`).classed(ut.SELECTED,!1).each(function(f){const g=(0,F.select)(this);d=g,c(!1,g,f,f.index)})}(!d||d.node()!==r.node())&&(r.classed(ut.SELECTED,!l),c(!l,r,t,n))}}}),u_={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 El=()=>(St(pe.prototype,c_),St(Yt.prototype,t_),cn.setOptions([u_]),(El=()=>!0)());const Pl=function(e){var t,n;const i=this.internal,{axis:a,brush:s,config:o,scale:{x:r,subX:l},state:c}=i;let d;return c.isCanvasMode?(o.subchart_show&&(d=e,Array.isArray(d)?(d=a.isTimeSeries()?d.map(u=>Vt.bind(i)(u)):d,d=i.setCanvasSubchartDomain(d)||c.domain):d=(t=c.domain)!=null?t:r.orgDomain()),d):(o.subchart_show&&(d=e,Array.isArray(d)?(a.isTimeSeries()&&(d=d.map(h=>Vt.bind(i)(h))),i.withinRange(d,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))&&(c.domain=d.slice(),s.move(s.getSelection(),d.map(l)))):d=(n=c.domain)!=null?n:r.orgDomain()),d)};St(Pl,{show(){var e,t,n;const i=this.internal,{$el:{subchart:a},config:s}=i,o=s.subchart_show;if(!o){if(i.state.isCanvasMode){(e=i.unbindZoomEvent)==null||e.call(i),s.subchart_show=!0,this.resize();return}i.unbindZoomEvent(),s.subchart_show=!o,!a.main&&i.initSubchart();let r=a.main.selectAll(`.${U.target}`);i.data.targets.length!==r.size()&&(i.updateSizes(),i.updateTargetsForSubchart(i.data.targets),r=(t=a.main)==null?void 0:t.selectAll(`.${U.target}`)),r==null||r.style("opacity",null),(n=a.main)==null||n.style("display",null),this.resize()}},hide(){var e;const t=this.internal,{$el:{subchart:{main:n}},config:i}=t;if(t.state.isCanvasMode){i.subchart_show&&(i.subchart_show=!1,this.resize(),(e=t.bindZoomEvent)==null||e.call(t));return}i.subchart_show&&(n==null?void 0:n.style("display"))!=="none"&&(i.subchart_show=!1,n.style("display","none"),this.resize())},toggle(){const e=this.internal,{config:t}=e;this.subchart[t.subchart_show?"hide":"show"]()},reset(){var e;const t=this.internal,{brush:n}=t;if(t.state.isCanvasMode){(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1);return}n.clear(n.getSelection())}});var d_={subchart:Pl};const Dl=["bar","line","bubble","candlestick","scatter"],h_=["opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width"];function Il(e,t){var n,i;const a=(i=(n=e.$el.grid)==null?void 0:n.main)==null?void 0:i.select(`line.${V.xgridFocus}`).node();if(!a||!N.getComputedStyle)return;const s=N.getComputedStyle(a);h_.forEach(o=>{const r=s.getPropertyValue(o);r&&t.style(o,r)})}function An(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function f_(e){var t,n;if(!_a(e))return!1;const{config:i,state:a,$el:s}=e,o=(n=(t=s.grid)==null?void 0:t.main)==null?void 0:n.select(`line.${V.xgridFocus}:not(.${V.xgridFocusContinuous})`),r=s.main.select(`line.${V.xgridFocusContinuous}`);if(!(o!=null&&o.node())||!r.node())return!1;const l=a.margin2.left-a.margin.left+a.width2,c=a.margin2.top-a.margin.top+a.height2;return Il(e,r),i.axis_rotated?r.attr("x1",An(o.attr("x1"),0)).attr("x2",l).attr("y1",An(o.attr("y1"),-10)).attr("y2",An(o.attr("y2"),-10)):r.attr("x1",An(o.attr("x1"),-10)).attr("x2",An(o.attr("x2"),-10)).attr("y1",An(o.attr("y1"),0)).attr("y2",c),r.style("visibility",null),o.style("visibility","hidden"),!0}function g_(e){var t;(t=e.$el.main)==null||t.select(`line.${V.xgridFocusContinuous}`).style("visibility","hidden")}function p_(e,t,n){const{config:i,state:a}=e,[s,o]=Zt(t,n),r=so(e,i.axis_rotated?o:s);return r===null?null:i.axis_rotated?[a.width/2,r]:[r,a.height/2]}function ts(e,t,n,i){var a,s;const o=(s=(a=e.$el.eventRect)==null?void 0:a.node)==null?void 0:s.call(a);if(!o)return;const r=p_(e,n,i)||[0,0],l=ht(o,!0),c=l.left+r[0],d=l.top+r[1],u={bubbles:!0,cancelable:!0,screenX:c,screenY:d,clientX:c,clientY:d};/^touch/.test(t)?Oa.touch(o,t,u):Oa.mouse(o,t,u)}var __={isSubchartBrushEnabled(){const{config:e}=this;return e.subchart_show&&e.subchart_brush_enabled!==!1},bindSubchartEventRect(e){const t=this,{config:n,state:i}=t;e.on("mouseover mousemove mouseout touchstart touchmove touchend",null),n.interaction_enabled&&(i.inputType==="mouse"?e.on("mouseover mousemove",function(a){t.isSubchartBrushEnabled()||ts(t,a.type,a,this)}).on("mouseout",function(a){t.isSubchartBrushEnabled()||ts(t,"mouseout",a,this)}):i.inputType==="touch"&&e.on("touchstart touchmove touchend",function(a){var s;t.isSubchartBrushEnabled()||((s=a.touches)==null?void 0:s.length)>1||ts(t,a.type,a,this)}))},initBrush(){const e=this,{config:t,scale:n,$el:{subchart:i},state:a}=e,s=t.axis_rotated,o=t.subchart_size_height;let r,l,c;e.brush=(s?(0,Ri.brushY)():(0,Ri.brushX)()).handleSize(5),e.brush.on("start brush end",d=>{const{selection:u,sourceEvent:h,target:f,type:g}=d;g==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?u:null),/(start|brush)/.test(g)&&(g==="brush"&&h&&a.domain&&(l==null||l.forEach((p,_)=>{p!==u[_]&&(a.domain[_]=n.x.orgDomain()[_])})),e.redrawForBrush(g!=="start")),g==="end"&&(r=n.x.orgDomain()),f!=null&&f.handle&&(u===null?e.brush.handle.attr("display","none"):e.brush.handle.attr("display",null).attr("transform",(p,_)=>{const x=[u[_],o/2];return`translate(${s?x.reverse():x})`}))}),e.brush.updateResize=function(){c&&clearTimeout(c),c=setTimeout(()=>{const d=this.getSelection();r&&(0,Ri.brushSelection)(d.node())&&this.move(d,r.map(n.subX.orgScale()))},0)},e.brush.update=function(){var d;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((d=i.main)==null||d.select(`.${V.brush}`).call(this)),this},e.brush.scale=function(d){const u=t.subchart_size_height;let h=e.axis.getExtent();!h&&d.range?h=[[0,0],[d.range()[1],u]]:ot(h)&&(h=h.map((f,g)=>[f,g>0?u:g])),s&&h[1].reverse(),this.extent(h),this.update()},e.brush.getSelection=()=>i.main?i.main.select(`.${V.brush}`):(0,F.select)([])},initSubchart(){const e=this,{config:t,state:{clip:n,hasAxis:i},$el:{defs:a,svg:s,subchart:o,axis:r}}=e;if(!i)return;const l=t.subchart_show?null:"hidden",c=`${n.id}-subchart`,d=e.getClipPath(c);n.idSubchart=c,e.appendClip(a,c),e.initBrush(),o.main=s.append("g").classed(V.subchart,!0).attr("transform",e.getTranslate("context"));const{main:u}=o;u.style("visibility",l),u.append("g").attr("clip-path",d).attr("class",V.chart),e.withSubchartTypeContext(()=>{Dl.forEach(f=>{const g=Ot(/^(bubble|scatter)$/.test(f)?"circle":f);if(e.hasType(f)||e.hasTypeOf(g)){const p=u.select(`.${V.chart}`),_=V[`chart${g}s`];p.select(`.${_}`).empty()&&p.append("g").attr("class",_)}})});const h=u.append("g").attr("clip-path",d).attr("class",V.brush).style("pointer-events",e.isSubchartBrushEnabled()?null:"none").call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),o.eventRect=u.append("g").attr("clip-path",d).attr("class",`${V.eventRects} ${V.eventRects}-subchart`).style("fill-opacity","0").style("pointer-events",e.isSubchartBrushEnabled()?"none":"all").append("rect").attr("class",`${V.eventRect} ${V.eventRect}-subchart`).attr("width",e.state.width2).attr("height",e.state.height2),e.bindSubchartEventRect(o.eventRect),u.append("g").attr("clip-path",d).attr("class",V.xgridFocus).append("line").attr("class",V.xgridFocus).style("visibility","hidden"),r.subX=u.append("g").attr("class",V.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",t.axis_rotated?"":n.pathXAxis).style("visibility",t.subchart_axis_x_show?l:"hidden"),r.subY=u.append("g").attr("class",V.axisY).attr("transform",e.getTranslate("subY")).style("visibility",t.subchart_axis_y_show?l:"hidden"),r.subY2=u.append("g").attr("class",V.axisY2).attr("transform",e.getTranslate("subY2")).style("visibility",t.subchart_axis_y2_show?l:"hidden")},addBrushHandle(e){const t=this,{config:n}=t,i=n.axis_rotated,a=n.subchart_init_range,s="handle--custom",o=bs[i?"y":"x"];t.brush.handle=e.selectAll(`.${s}`).data(i?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",s).attr("cursor",`${i?"ns":"ew"}-resize`).attr("d",r=>o[/[se]/.test(r.type)?"end":"start"]).attr("display",a?null:"none")},updateTargetsForSubchart(e){var t;const n=this,{config:i,state:a,$el:{subchart:{main:s}}}=n;i.subchart_show&&(n.withSubchartTypeContext(()=>{Dl.filter(o=>n.hasType(o)||n.hasTypeOf(Ot(o))).forEach(o=>{const r=/^(bubble|scatter)$/.test(o),l=Ot(r?"circle":o),c=n.getChartClass(l,!0),d=n.getClass(r?"circles":`${o}s`,!0),u=s.select(`.${V[`chart${`${l}s`}`]}`);if(r){const h=u.selectAll(`.${V.circles}`).data(e.filter(n[`is${Ot(o)}Type`].bind(n))).attr("class",d);h.exit().remove(),h.enter().append("g").attr("class",d)}else{const h=u.selectAll(`.${V[`chart${l}`]}`).attr("class",c).data(e.filter(n[`is${l}Type`].bind(n))),f=h.enter().append("g").style("opacity","0").attr("class",c).append("g").attr("class",d);h.exit().remove(),o==="line"&&n.hasTypeOf("Area")&&f.append("g").attr("class",n.getClass("areas",!0))}})}),s.selectAll(`.${V.brush} rect`).attr(i.axis_rotated?"width":"height",i.axis_rotated?a.width2:a.height2),(t=n.$el.subchart.eventRect)==null||t.attr("width",a.width2).attr("height",a.height2).style("pointer-events",n.isSubchartBrushEnabled()?"none":"all"))},updateSubchartYDomain(e){var t,n;const i=this,{scale:a}=i,s=e||i.filterTargetsToShow(i.data.targets);(t=a.subY)==null||t.domain(i.getYDomain(s,"y")),(n=a.subY2)==null||n.domain(i.getYDomain(s,"y2"))},redrawSubchart(e,t){var n,i,a,s;const o=this,{config:r,$el:{subchart:{main:l}},state:c}=o,d=!!t;if(l.style("visibility",r.subchart_show?null:"hidden"),l.select(`.${V.brush}`).style("pointer-events",o.isSubchartBrushEnabled()?null:"none"),(n=o.$el.subchart.eventRect)==null||n.style("pointer-events",o.isSubchartBrushEnabled()?"none":"all"),(i=o.$el.axis.subY)==null||i.style("visibility",r.subchart_axis_y_show?null:"hidden"),(a=o.$el.axis.subY2)==null||a.style("visibility",r.subchart_axis_y2_show?null:"hidden"),r.subchart_show&&(((s=c.event)==null?void 0:s.type)==="zoom"&&o.brush.update(),e)){const u=r.subchart_init_range;!Rr(o)&&o.brush.update(),o.withSubchartTypeContext(()=>{const h=c._targetsToShow||o.filterTargetsToShow(o.data.targets);o.updateSubchartYDomain(h);const f=o.getDrawShape();if(Object.keys(f.type).forEach(g=>{const p=Ot(g),_=o[`generateDraw${p}`](f.indices[g],!0);o[`update${p}`](d,!0),o[`redraw${p}`](_,d,!0)}),o.hasType("bubble")||o.hasType("scatter")){const{cx:g}=f.pos,p=o.updateCircleY(!0);o.updateCircle(!0),o.redrawCircle(g,p,d,void 0,!0)}}),!c.rendered&&u&&(c.domain=u,o.brush.move(o.brush.getSelection(),u.map(o.scale.x)))}},showSubchartGridFocus(e){const t=this,{config:n,state:i,$el:{subchart:{main:a}}}=t;if(!a||!n.subchart_show||t.isSubchartBrushEnabled()||n.grid_focus_show===!1||n.subchart_grid_focus===!1||!n.tooltip_show||n.axis_tooltip)return;const o=(Array.isArray(e)?e:[e]).find(c=>c&&t.getBaseValue(c)!=null);if(!o){t.hideSubchartGridFocus();return}const r=t.scale.subX(o.x);if(!Number.isFinite(r)){t.hideSubchartGridFocus();return}const l=a.select(`g.${V.xgridFocus} line.${V.xgridFocus}`);if(f_(t)){l.style("visibility","hidden");return}Il(t,l),n.axis_rotated?l.attr("x1",0).attr("x2",i.width2).attr("y1",r).attr("y2",r):l.attr("x1",r).attr("x2",r).attr("y1",0).attr("y2",i.height2),l.style("visibility",null)},hideSubchartGridFocus(){var e;g_(this),(e=this.$el.subchart.main)==null||e.select(`g.${V.xgridFocus} line.${V.xgridFocus}`).style("visibility","hidden")},redrawForBrush(e=!0){var t;const n=this,{config:{subchart_onbrush:i,zoom_rescale:a},scale:s,state:o}=n;n.redraw({withTransition:!1,withY:a,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e&&o.rendered&&i.bind(n.api)((t=o.domain)!=null?t:s.x.orgDomain())},transformContext(e,t){const n=this,{$el:{subchart:i},$T:a}=n,s=t!=null&&t.axisSubX?t.axisSubX:a(i.main.select(`.${V.axisX}`),e),o=t!=null&&t.axisSubY?t.axisSubY:a(i.main.select(`.${V.axisY}`),e),r=t!=null&&t.axisSubY2?t.axisSubY2:a(i.main.select(`.${V.axisY2}`),e);i.main.attr("transform",n.getTranslate("context")),s.attr("transform",n.getTranslate("subX")),o.attr("transform",n.getTranslate("subY")),r.attr("transform",n.getTranslate("subY2"))}},x_={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 Ml=()=>(St(pe.prototype,__),St(Yt.prototype,d_),cn.setOptions([x_]),(Ml=()=>!0)());var re=wt(9);const Fl=function(e){var t,n;const i=this.internal,{axis:a,config:s,org:o,scale:r,state:l}=i;let c;if(!a)return;const d=a.isCategorized();if(s.zoom_enabled)if(c=e,Array.isArray(c)){if(a.isTimeSeries()&&(c=c.map(h=>Vt.bind(i)(h))),i.withinRange(c,i.getZoomDomain("zoom",!0),i.getZoomDomain("zoom"))){if(l.domain=c.slice(),c=i.getZoomDomainValue(c),i.api.tooltip.hide(),s.subchart_show)if(l.isCanvasMode)(t=i.setCanvasSubchartDomain)==null||t.call(i,c,!0,!1);else{const h=r.zoom||r.x;i.brush.getSelection().call(i.brush.move,c.map(h))}else{const h=d?r.x.orgScale():o.xScale||r.x;i.updateCurrentZoomTransform(h,c)}i.setZoomResetButton()}}else c=i.zoom.getDomain();return(n=l.domain)!=null?n:c};St(Fl,{enable(e){var t;const n=this.internal,{axis:i,config:a}=n;if(!i){a.zoom_enabled=!1;return}/^(drag|wheel)$/.test(e)&&(a.zoom_type=e),a.zoom_enabled=!!e,n.zoom?e===!1&&n.bindZoomEvent(!1):n.initZoom(),e!==!1&&(a.zoom_type==="drag"&&!n.zoomBehaviour&&((t=n.initZoomBehaviour)==null||t.call(n)),n.bindZoomEvent()),n.updateAndRedraw()},max(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_max=de("max",[i[1],e])),n.zoom_x_max},min(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_min=de("min",[i[0],e])),n.zoom_x_min},range(e){const t=this.zoom;if(tt(e)){const{min:n,max:i}=e;ct(n)&&t.min(n),ct(i)&&t.max(i)}return{min:t.min(),max:t.max()}}});var m_={zoom:Fl,unzoom(){var e;const t=this.internal,{config:n,$el:{canvas:i,eventRect:a,zoomResetBtn:s},scale:{zoom:o},state:r}=t,l=r.isCanvasMode?i:a;(o||r.isCanvasMode&&n.subchart_show&&r.domain)&&(n.subchart_show?r.isCanvasMode?(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1):t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(re.zoomIdentity),t.updateZoom(!0),s==null||s.style("display","none"),l!=null&&l.node()&&(0,re.zoomTransform)(l.node())!==re.zoomIdentity&&t.zoom.transform(l,re.zoomIdentity),r.domain=void 0)}};function $i(e){return e.state.isCanvasMode?e.$el.canvas:e.$el.eventRect}function Ol(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return re.zoomIdentity.translate(t.x+(t.k-1)*n.left,t.y+(t.k-1)*n.top).scale(t.k)}function $l(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return re.zoomIdentity.translate(t.x-(t.k-1)*n.left,t.y-(t.k-1)*n.top).scale(t.k)}function Bl(e,t,n){const i=Zt(t,n);if(e.state.isCanvasMode){const{margin:a}=e.state;i[0]-=a.left,i[1]-=a.top}return i}var v_={initZoom(){const e=this;e.scale.zoom=null,e.generateZoom(),e.config.zoom_type==="drag"&&e.initZoomBehaviour()},bindZoomEvent(e=!0){const t=this,{config:n}=t;n.zoom_enabled&&e?!n.subchart_show&&t.bindZoomOnEventRect():e===!1&&(t.api.unzoom(),t.unbindZoomEvent())},generateZoom(){const e=this,{config:t,org:n,scale:i}=e,a=(0,re.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));a.orgScaleExtent=()=>{const s=t.zoom_extent||[1,10];return[s[0],Math.max(e.getMaxDataCount()/s[1],s[1])]},a.updateScaleExtent=function(){const s=en(e.scale.x.orgDomain())/en(e.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*s,o[1]*s]),this},a.updateTransformScale=(s,o)=>{var r,l;const c=t.axis_rotated,d=Ol(e,s);(r=n.xScale)==null||r.range(i.x.range());const u=d[c?"rescaleY":"rescaleX"](n.xScale||i.x);if(u.domain().some(g=>/(Invalid Date|NaN)/.test(g.toString())))return;const h=e.trimXDomain(u.domain()),f=t.zoom_rescale;if(u.domain(h,n.xDomain),o){const g=u(i.x.domain()[0]),p=c?d.x:g,_=c?g:d.y,x=$l(e,re.zoomIdentity.translate(p,_).scale(s.k));(l=$i(e))==null||l.property("__zoom",x)}i.zoom=e.getCustomizedXScale(u),e.axis.x.scale(i.zoom),f?(!n.xScale&&(n.xScale=i.x.copy()),i.x.domain(h)):n.xScale&&(i.x.domain(n.xScale.domain()),n.xScale=null)},a.getDomain=()=>{const s=i[i.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(s[1]-=2),s},e.zoom=a},onZoomStart(e){const t=this,{sourceEvent:n}=e;n&&(t.zoom.startEvent=n,t.state.zooming=!0,H(t.config.zoom_onzoomstart,t.api,e))},onZoom(e){const t=this,{config:n,scale:i,state:a,org:s}=t,{sourceEvent:o}=e,r=(e==null?void 0:e.transform)===re.zoomIdentity;if(!n.zoom_enabled||t.filterTargetsToShow(t.data.targets).length===0||!i.zoom&&(o==null?void 0:o.type.indexOf("touch"))>-1&&(o==null?void 0:o.touches.length)===1)return;e.sourceEvent&&(a.zooming=!0,a.domain=void 0);const l=(o==null?void 0:o.type)==="mousemove",c=(o==null?void 0:o.wheelDelta)<0,{transform:d}=e;!l&&c&&i.x.domain().every((g,p)=>g!==s.xDomain[p])&&i.x.domain(s.xDomain),t.zoom.updateTransformScale(d,n.zoom_type==="wheel"&&o);const u=n.transition_duration>0&&!n.subchart_show&&(a.dragging||r||!e.sourceEvent),h=o&&l&&n.zoom_type!=="wheel",f=()=>{var g;t.config&&(t.redraw({withTransition:u,withY:n.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.state.cancelClick=l,!r&&H(n.zoom_onzoom,t.api,(g=t.state.domain)!=null?g:t.zoom.getDomain()))};h?hr(t.state,f):f()},onZoomEnd(e){var t,n;const i=this,{config:a,state:s}=i,o=i.zoom;if(!o)return;let{startEvent:r}=o,l=e==null?void 0:e.sourceEvent;const c=(e==null?void 0:e.transform)===re.zoomIdentity;(r==null?void 0:r.type.indexOf("touch"))>-1&&(r=r.changedTouches[0],l=(t=l==null?void 0:l.changedTouches)==null?void 0:t[0]),!(a.zoom_type==="drag"&&l&&r.clientX===l.clientX&&r.clientY===l.clientY)&&(s.zooming=!1,!s.isCanvasMode&&i.redrawEventRect(),i.updateZoom(),!c&&(l||s.dragging)&&H(a.zoom_onzoomend,i.api,(n=i.state.domain)!=null?n:i.zoom.getDomain()))},updateZoom(e){const t=this,{subX:n,x:i,zoom:a}=t.scale;if(a){const s=a.domain(),o=n.domain(),r=.015,l=t.config.axis_x_inverted?(s[0]>=o[0]||s[0]+r>=o[0])&&(o[1]>=s[1]||o[1]>=s[1]+r):(s[0]<=o[0]||s[0]-r<=o[0])&&(o[1]<=s[1]||o[1]<=s[1]-r);(e||l)&&(t.axis.x.scale(n),i.domain(n.orgDomain()),t.scale.zoom=null)}},updateCurrentZoomTransform(e,t){var n;const i=this,{config:a}=i,s=a.axis_rotated,o=[-e(t[0]),0],r=re.zoomIdentity.scale(e.range()[1]/(e(t[1])-e(t[0]))).translate(...s?o.reverse():o);(n=$i(i))==null||n.call(i.zoom.transform,$l(i,r))},bindZoomOnEventRect(){var e,t;const n=this,{config:i,$el:{svg:a}}=n,s=$i(n),o=i.zoom_type==="drag"?n.zoomBehaviour:n.zoom;n.state.isCanvasMode&&((e=o==null?void 0:o.touchable)==null||e.call(o,()=>i.interaction_inputType_touch!==!1)),!n.state.isCanvasMode&&N.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((t=N.navigator)==null?void 0:t.userAgent)&&a.on("wheel",()=>{}),s==null||s.call(o).on("dblclick.zoom",null)},initZoomBehaviour(){const e=this,{config:t,state:n}=e,i=t.axis_rotated;let a=0,s=0,o,r;const l={axis:i?"y":"x",attr:i?"height":"width",index:i?1:0},c=d=>{const[u,h]=r!=null?r:[0,i?n.height:n.width];return Math.min(Math.max(d,u),h)};e.zoomBehaviour=(0,kr.drag)().touchable(()=>!n.isCanvasMode||t.interaction_inputType_touch!==!1).clickDistance(4).on("start",function(d){var u;r=e.scale.zoom?null:e.axis.getExtent(),n.event=d,e.setDragStatus(!0),e.unselectRect(),!n.isCanvasMode&&!o&&(o=e.$el.main.append("rect").attr("clip-path",n.clip.path).attr("class",Da.zoomBrush).attr("width",i?n.width:0).attr("height",i?0:n.height)),o==null||o.attr(i?"width":"height",i?n.width:n.height),a=c(Bl(e,d,this)[l.index]),s=a,n.isCanvasMode?(u=e.renderCanvasZoomBrush)==null||u.call(e,a,s):o.attr(l.axis,a).attr(l.attr,0),e.onZoomStart(d)}).on("drag",function(d){var u;s=c(Bl(e,d,this)[l.index]),n.isCanvasMode?(u=e.renderCanvasZoomBrush)==null||u.call(e,a,s):o.attr(l.axis,Math.min(a,s)).attr(l.attr,Math.abs(s-a))}).on("end",d=>{var u;const h=e.scale.zoom||e.scale.x;n.event=d,s=c(s),n.isCanvasMode?(u=e.clearCanvasZoomBrush)==null||u.call(e):o.attr(l.axis,0).attr(l.attr,0),a>s&&([a,s]=[s,a]),a<0&&(s+=Math.abs(a),a=0),a!==s&&e.api.zoom([a,s].map(f=>h.invert(f))),e.setDragStatus(!1)})},setZoomResetButton(){const e=this,{config:t,$el:n}=e,i=t.zoom_resetButton;i&&t.zoom_type==="drag"&&(n.zoomResetBtn?n.zoomResetBtn.style("display",null):n.zoomResetBtn=e.$el.chart.append("div").classed(U.button,!0).append("span").on("click",function(){z(i.onclick)&&i.onclick.bind(e.api)(this),e.api.unzoom()}).classed(Da.buttonZoomReset,!0).text(i.text||"Reset Zoom"))},getZoomTransform(){const e=this,t=$i(e),n=t==null?void 0:t.node();return n?Ol(e,(0,re.zoomTransform)(n)):{k:1}}},b_={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 zl=()=>(St(pe.prototype,v_),St(Yt.prototype,m_),cn.setOptions([b_]),(zl=()=>!0)());function Nl(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function Xl(e,t=!1){const n=this.internal,{config:i}=n,a=i.transition_duration&&Zn();return e?(i.regions=t?i.regions.concat(e):e,n.state.isCanvasMode?(Nl(n),i.regions):(n.updateRegion(),n.redrawRegion(a),i.regions)):i.regions}const Gl=function(e){return Xl.bind(this)(e)};St(Gl,{add:function(e){return Xl.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:n,$T:i}=t,a=e||{},s=Ne(a,"classes",[Kn.region]);let o=n.regions;if(t.state.isCanvasMode)return Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(d=>{s.indexOf(d)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],Nl(t),n.regions;const r=t.$el.main.select(`.${Kn.regions}`).selectAll(s.map(l=>`.${l}`));return i(r).style("opacity","0").remove(),Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(d=>{s.indexOf(d)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],o}});var y_={regions:Gl},T_={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",Kn.regions)},updateRegion(){const e=this,{config:t,$el:{region:n},$T:i}=e;n.main||e.initRegion(),n.main.style("visibility",e.hasArcType()?"hidden":null);const a=n.main.selectAll(`.${Kn.region}`).data(t.regions);i(a.exit()).style("opacity","0").remove();const s=a.enter().append("g");s.append("rect").style("fill-opacity","0"),n.list=s.merge(a).attr("class",e.classRegion.bind(e)),n.list.each(function(o){var r;(0,F.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,F.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:n},$T:i}=t,a=t.regionX.bind(t),s=t.regionY.bind(t),o=["width","height"];let r=n.list.select("rect"),l=n.list.selectAll("text");return r=i(r,e).attr("x",a).attr("y",s).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),l=i(l,e).text(c=>{var d;return(d=c.label)==null?void 0:d.text}).attr("transform",({label:c})=>c.rotated?" rotate(-90)":null).attr("transform",function(c){var d;const{x:u=0,y:h=0,center:f=!1,rotated:g=!1}=(d=c.label)!=null?d:{},p=this.previousElementSibling,_={x:0,y:0};return Q(f)&&["x","y"].forEach((x,m)=>{f.indexOf(x)>-1&&(_[x]=(+p.getAttribute(o[m])-ht(this)[o[m]])/2)}),`translate(${a(c)+_.x+u}, ${s(c)+_.y+h})${g?" rotate(-90)":""}`}).attr("text-anchor",({label:c})=>c!=null&&c.rotated?"end":null).attr("dy","1em").style("fill",({label:c})=>{var d;return(d=c==null?void 0:c.color)!=null?d:null}),[r.style("fill-opacity",c=>q(c.opacity)?c.opacity:null).on("end",function(){(0,F.select)(this.parentNode).selectAll("rect:not([x])").remove()}),l.style("opacity",null)]},regionX(e){return this.getRegionSize("x",e)},regionY(e){return this.getRegionSize("y",e)},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},getRegionSize(e,t){const n=this,{config:i,scale:a,state:s}=n,o=i.axis_rotated,r=/(x|y|y2)/.test(e),l=r?e==="x":e==="width",c=!r&&n[l?"regionX":"regionY"](t);let d=r?"start":"end",u=r?0:s[e],h;if(t.axis==="y"||t.axis==="y2"?(!r&&!l?d="start":r&&!l&&(d="end"),(l?o:!o)&&d in t&&(h=a[t.axis])):(l?!o:o)&&d in t&&(h=a.zoom||a.x),h){let f=0;u=t[d],n.axis.isTimeSeries(t.axis)?u=Vt.call(n,u):/(x|width)/.test(e)&&n.axis.isCategorized()&&isNaN(u)&&(u=i.axis_x_categories.indexOf(u),f=n.axis.x.tickOffset()*(d==="start"?-1:1)),u=h(u)+f}return r?u:u<c?0:u-c},isRegionOnX(e){return!e.axis||e.axis==="x"}};let Vl=()=>(St(pe.prototype,T_),Yt.prototype.regions=y_.regions,(Vl=()=>({}))());var kn={initArea(e){const t=this,{config:n}=t;e.insert("g",`.${n.area_front?Nt.circles:Ce.lines}`).attr("class",t.getClass("areas",!0))},updateAreaColor(e){const t=this;return Vr.call(t,e,"area_linearGradient",t.color)},updateArea(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,state:a,$el:s,$T:o}=n,r=t?s.subchart:s;i.area_linearGradient&&n.updateLinearGradient();const l=r.main.selectAll(`.${Ci.areas}`).selectAll(`.${Ci.area}`).data(n.lineData.bind(n));o(l.exit(),e).style("opacity","0").remove(),r.area=l.enter().append("path").attr("class",n.getClass("area",!0)).style("fill",n.updateAreaColor.bind(n)).style("opacity",function(){return a.orgAreaOpacity=(0,F.select)(this).style("opacity"),"0"}).merge(l),l.style("opacity",a.orgAreaOpacity),n.setRatioForGroupedData(r.area.data())},redrawArea(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{area:a}=n?this.$el.subchart:this.$el,{orgAreaOpacity:s}=i.state;return[i.$T(a,t,me()).attr("d",e).style("fill",i.updateAreaColor.bind(i)).style("opacity",o=>String(i.isAreaRangeType(o)?s/1.75:s))]},generateDrawArea(e,t){return vo(this,e,t)}},Ln={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},es={spline_interpolation_type:"cardinal"};function w_(e){return Ut(e)&&z(e.create)&&z(e.update)}function C_(e,t){var n;const i=this,a=(l,c)=>{const d=l.attributes;for(let u=0,h;h=d[u];u++)h=h.name,c.setAttribute(h,l.getAttribute(h))},o=new DOMParser().parseFromString(ue(e),"image/svg+xml").documentElement,r=nt.createElementNS(F.namespaces.svg,o.nodeName.toLowerCase());if(r.id=t,r.style.fill="inherit",r.style.stroke="inherit",a(o,r),(n=o.childNodes)!=null&&n.length){const l=(0,F.select)(r);"innerHTML"in r?l.html(ue(o.innerHTML)):nn(o.childNodes).forEach(c=>{a(c,l.append(c.tagName).node())})}i.$el.defs.node().appendChild(r)}var Rn={hasValidPointType(e){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(e||this.config.point_type)},hasLegendDefsPoint(){var e;const{config:t}=this;return t.legend_show&&((e=t.point_pattern)==null?void 0:e.length)&&t.legend_usePoint},getDefsPointId(e){const{state:{datetimeId:t}}=this;return`${t}-point${e}`},getValidPointPattern(){const{config:e}=this,t=/^(circle|rect(angle)?)$/i.test(e.point_type)?e.point_type:"circle";return bt(e.point_pattern)?e.point_pattern:[t]},generatePoint(){const e=this,{$el:t,config:n}=e,i=[],a=e.getValidPointPattern();return function(s,o,...r){return function(l){var c,d,u,h;const f=e.getTargetSelectorSuffix(l.id||((c=l.data)==null?void 0:c.id)||l),g=(0,F.select)(this);i.indexOf(f)<0&&i.push(f);let p=a[i.indexOf(f)%a.length];if(e.hasValidPointType(p))p=e[p];else if(!w_(p||n.point_type)){const _=e.getDefsPointId(f);if(t.defs.select(`#${_}`).size()<1&&C_.call(e,p,_),s==="create")return(d=e.custom)==null?void 0:d.create.bind(o)(g,_,...r);if(s==="update")return(u=e.custom)==null?void 0:u.update.bind(o)(g,...r)}return(h=p[s])==null?void 0:h.bind(o)(g,...r)}}}};function S_(e,t,n,i=!1){const a=e?[e,0]:n;for(let s=e||n.reduce((o,r)=>o+r);s<=t;)n.forEach(o=>{s+o<=t&&a.push(o),s+=o});return a.length%2!==0&&a.push(i?n[1]:0),{dash:a.join(" "),length:a.reduce((s,o)=>s+o,0)}}var A_={initLine(){Wr.call(this,{elKey:"line",className:Ce.chartLines,cssRules:["pointer-events:none"]})},updateTargetsForLine(e){const t=this,{$el:{area:n,main:i}}=t,a=t.getClass("lines",!0),s=e.filter(r=>!(t.isScatterType(r)||t.isBubbleType(r))),o=Ya.call(t,s,{type:"Line",elKey:"line",containerClass:Ce.chartLines,itemClass:Ce.chartLine,initFn:t.initLine});if(o.append("g").attr("class",a),t.hasTypeOf("Area")){const r=i.select(`.${Ce.chartLines}`).selectAll(`.${Ce.chartLine}`),l=(!n&&o.empty()?r:o).filter(t.isAreaType.bind(t));t.initArea(l)}t.updateTargetForCircle(s,o)},updateLine(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{format:{extraLineClasses:i},$el:a,$T:s}=n,o=t?a.subchart:a,r=o.main.selectAll(`.${Ce.lines}`).selectAll(`.${Ce.line}`).data(n.lineData.bind(n));s(r.exit(),e).style("opacity","0").remove(),o.line=r.enter().append("path").attr("class",l=>`${n.getClass("line",!0)(l)} ${i(l)||""}`).style("stroke",n.color).merge(r).style("opacity",n.initialOpacity.bind(n)).attr("transform",null)},redrawLine(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{$el:a,$T:s}=i,{line:o}=n?a.subchart:a;return[s(o,t,me()).attr("d",e).style("stroke",this.color).style("opacity",null)]},generateDrawLine(e,t){return mo(this,e,t)},lineWithRegions(e,t,n,i){const a=this,{config:s}=a,o=s.axis_rotated,r=a.axis.isTimeSeries(),l="2 2",c=lo(a,e,i),d=a.hasNullDataValue(e);let u,h,f,g;const p=o?S=>n(S.value):S=>t(S.x),_=o?S=>t(S.x):S=>n(S.value),x=S=>`M${S[0][0]},${S[0][1]}L${S[1][0]},${S[1][1]}`,m=r?(S,k,L,E)=>{const D=S.x.getTime(),R=k.x-S.x,P=new Date(D+R*L),B=new Date(D+R*(L+E)),I=o?[[n(h(L)),t(P)],[n(h(L+f)),t(B)]]:[[t(P),n(h(L))],[t(B),n(h(L+f))]];return x(I)}:(S,k,L,E)=>{const D=t(k.x,!o),R=n(k.value,o),P=L+E,B=t(u(L),!o),I=n(h(L),o);let X=t(u(P),!o),G=n(h(P),o);X>D&&(X=D),S.value>k.value&&(o?G<R:G>R)&&(G=R);const Z=[[B,I],[X,G]];return o&&Z.forEach(et=>et.reverse()),x(Z)},b={x:a.axis.getAxisType("x"),y:a.axis.getAxisType("y")};let v="";if(!e.length)return v;const y=a.$el.line.filter(({id:S})=>S===e[0].id),T=y.clone().style("display","none"),w=(S,k)=>S.attr("d",k).node().getTotalLength(),C={dash:[],lastLength:0};let A=!1;for(let S=0,k;k=e[S];S++){const L=e[S-1],E=L&&q(L.value);let D=a.isWithinRegions(k.x,c);if(q(k.value)){if(Ct(c)||!D||!E)v+=`${S&&E?"L":"M"}${p(k)},${_(k)}`;else if(E)if(D=((D==null?void 0:D.dasharray)||l).split(" ").map(Number),u=Xe(b.x,L.x,k.x),h=Xe(b.y,L.value,k.value),d){const R=t(k.x)-t(L.x),P=n(k.value)-n(L.value),B=Math.sqrt(R*R+P*P);f=D[0]/B,g=f*D[1];for(let I=f;I<=1;I+=g)v+=m(L,k,I,f),I+g>=1&&(v+=m(L,k,1,0))}else{let R;if(A=k.x===e[e.length-1].x,r){const X=+L.x,G=new Date(X),Z=new Date(X+(+k.x-X));R=[[t(G),n(h(0))],[t(Z),n(h(1))]]}else R=[[t(u(0)),n(h(0))],[t(u(1)),n(h(1))]];o&&R.forEach(X=>X.reverse());const P=w(T,v),B=w(T,v+=`L${R[1].join(",")}`),I=S_(P-C.lastLength,B-C.lastLength,D,A);C.lastLength+=I.length,C.dash.push(I.dash)}}}return C.dash.length&&(!A&&C.dash.push(w(T,v)),y.attr("stroke-dasharray",C.dash.join(" "))),T.remove(),v},isWithinRegions(e,t){return co(e,t)},isWithinStep(e,t){return Math.abs(t-Zt(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||ot(t)&&t.indexOf(e.id)!==-1}};const En=()=>me(),Wl=new WeakMap;function Yl(e){const t=e.getAttribute("height"),n=e.getAttribute("width"),i=e.getAttribute("href")||e.getAttribute("xlink:href"),a=Wl.get(e);if(a&&a.attrHeight===t&&a.attrWidth===n&&a.href===i)return a;const{width:s,height:o}=Ue(e),r={attrHeight:t,attrWidth:n,height:o,href:i,width:s};return Wl.set(e,r),r}var Bi={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:n}}=this;let i=t.point_opacity;return Ct(i)&&(i=this.getBaseValue(e)!==null&&n[e.id]?this.opacityForCircle(e):"0"),i},opacityForCircle(e){var t;const{config:n}=this;let i=n.point_opacity;return Ct(i)&&(i=n.point_show&&!((t=this.isPointFocusOnly)!=null&&t.call(this))?null:"0",i=q(this.getBaseValue(e))?this.isBubbleType(e)||this.isScatterType(e)?"0.5":i:"0"),i},initCircle(){const e=this,{$el:{main:t}}=e;!e.point&&(e.point=e.generatePoint()),(e.hasType("bubble")||e.hasType("scatter"))&&t.select(`.${U.chart} > .${Nt.chartCircles}`).empty()&&t.select(`.${U.chart}`).append("g").attr("class",Nt.chartCircles)},updateTargetForCircle(e,t){const n=this,{config:i,data:a,$el:s}=n,o=i.interaction_enabled&&i.data_selection_enabled,r=o&&i.data_selection_isselectable,l=n.getClass("circles",!0);if(!i.point_show)return;n.initCircle();let c=e,d=t;if(!c){c=n.filterNullish(a.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const u=s.main.select(`.${Nt.chartCircles}`).style("pointer-events","none").selectAll(`.${Nt.circles}`).data(c);u.exit().remove(),d=u.enter()}o&&d.append("g").attr("class",u=>n.generateClass(ut.selectedCircles,u.id)),d.append("g").attr("class",l).call(u=>{n.setCssRule(!0,`.${Nt.circles}`,["cursor:pointer"],r)(u),n.setCssRule(!0,` .${Nt.circle}`,["fill","stroke"],n.color)(u)}).style("opacity",function(){return(0,F.select)(this.parentNode).classed(Nt.chartCircles)?"0":null}),o&&c.forEach(u=>{s.main.selectAll(`.${ut.selectedCircles}${n.getTargetSelectorSuffix(u.id)}`).selectAll(`${ut.selectedCircle}`).each(h=>{h.value=u.values[h.index].value})})},updateCircle(e=!1){const t=this,{config:n,state:i,$el:a}=t,s=t.isPointFocusOnly(),o=e?a.subchart:a;if(n.point_show&&!i.toggling){n.point_radialGradient&&t.updateLinearGradient();const r=o.main.selectAll(`.${Nt.circles}`).selectAll(`.${Nt.circle}`).data(u=>{const h=t.isLineType(u)&&t.shouldDrawPointsForLine(u)||t.isBubbleType(u)||t.isRadarType(u)||t.isScatterType(u)?s?[u.values[0]]:u.values:[];return t.filterNullish(h)});r.exit().remove();const l=t.pointR.bind(t),c=t.generateUpdateCircleColor(),d=t.initialOpacityForCircle.bind(t);r.enter().filter(Boolean).append(t.point("create",this,l,c)),o.circle=o.main.selectAll(`.${Nt.circles} .${Nt.circle}`).style("stroke",t.getStylePropValue(t.color)).style("opacity",d)}},generateUpdateCircleColor(){const e=this,t=e.getStylePropValue(e.color);return n=>e.config.point_radialGradient?e.getGradienColortUrl(n.id):t?t(n):null},updateCircleColor(e){return this.generateUpdateCircleColor()(e)},redrawCircle(e,t,n,i,a=!1){const s=this,{state:{rendered:o},$el:r,$T:l}=s,c=a?r.subchart:r,d=c.main.selectAll(`.${ut.selectedCircle}`);if(!s.config.point_show)return[];const u=s.isCirclePoint()?"c":"",h=me(),f=s.opacityForCircle.bind(s),g=s.generateUpdateCircleColor();if(s.isCirclePoint()){const x=c.circle;return s.hasType("bubble")&&x.attr("r",s.pointR.bind(s)),n?(i&&x.attr("cx",e),l(x.filter(function(){return!!this.getAttribute("cx")}),!0,`${h}-pos`).attr("cx",e).attr("cy",t).style("fill",g),x.filter(function(){return!this.getAttribute("cx")}).attr("cx",e).attr("cy",t).style("fill",g)):x.attr("cx",e).attr("cy",t).style("fill",g),[[l(x,n||!o,h).style("opacity",f)],l(d,n).attr("cx",e).attr("cy",t)]}const p=s.point("update",s,e,t,g,n,i,d),_=[];return c.circle.each(function(x){let m=p.bind(this)(x);m=l(m,n||!o,h).style("opacity",f),_.push(m)}),[_,l(d,n).attr(`${u}x`,e).attr(`${u}y`,t)]},showCircleFocus(e){const t=this,{state:{hasRadar:n,resizing:i,toggling:a,transiting:s},$el:o}=t;let{circle:r}=o;if(s===!1&&r&&t.isPointFocusOnly()){const l=(n?t.radarCircleX:t.circleX).bind(t),c=(n?t.radarCircleY:t.circleY).bind(t),d=a||Ct(e),u=t.point("update",t,l,c,t.getStylePropValue(t.color),i?!1:d);e&&(r=r.filter(function(h){var f;const g=(f=e.filter)==null?void 0:f.call(e,p=>p.id===h.id);return g.length?(0,F.select)(this).datum(g[0]):!1})),r.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:f,index:g,value:p}=h;let _="hidden";q(p)&&(u.bind(this)(h),t.expandCircles(g,f),_=""),this.style.visibility=_})}},hideCircleFocus(){const e=this,{$el:{circle:t}}=e;e.isPointFocusOnly()&&t&&(e.unexpandCircles(),t.style("visibility","hidden"))},expandCircles(e,t,n){const i=this,a=i.pointExpandedR.bind(i);n&&i.unexpandCircles();const s=i.getShapeByIndex("circle",e,t).classed(U.EXPANDED,!0),o=a(s)/i.config.point_r,r=1-o;i.isCirclePoint()?s.attr("r",a):s.each(function(){const l=(0,F.select)(this);if(this.tagName==="circle")l.attr("r",a);else{const{width:c,height:d}=Yl(this),u=r*(+l.attr("x")+c/2),h=r*(+l.attr("y")+d/2);l.attr("transform",`translate(${u} ${h}) scale(${o})`)}})},unexpandCircles(e){const t=this,n=t.pointR.bind(t),i=t.getShapeByIndex("circle",e).filter(function(){return(0,F.select)(this).classed(U.EXPANDED)}).classed(U.EXPANDED,!1);if(i.attr("r",n),!t.isCirclePoint()){const a=n(i)/t.config.point_r;i.attr("transform",a!==1?`scale(${a})`:null)}},isWithinCircle(e,t){const{state:n}=this,i=Zt(n.event,e),a=(0,F.select)(e),s=this.isCirclePoint(e)?"c":"",o=this.getPointSensitivity(a==null?void 0:a.datum());let r=+a.attr(`${s}x`),l=+a.attr(`${s}y`);if(!(r||l)&&e.nodeType===1){const{x:u,y:h}=ht(e);r=u,l=h}const c=r-i[0],d=l-i[1];return Math.sqrt(c*c+d*d)<(t||o)},updatePointClass(e){const t=this,{circle:n}=t.$el;let i=!1;return(tt(e)||n)&&(i=e===!0?n.each(function(a){let s=t.getClass("circle",!0)(a);this.getAttribute("class").indexOf(U.EXPANDED)>-1&&(s+=` ${U.EXPANDED}`),this.setAttribute("class",s)}):t.getClass("circle",!0)(e)),i},custom:{create(e,t,n){return e.append("use").attr("xlink:href",`#${t}`).attr("class",this.updatePointClass.bind(this)).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,{width:l,height:c}=Yl(e.node()),d=f=>q(f.value)?t(f)-l/2:0,u=f=>q(f.value)?n(f)-c/2:0;let h=e;return a&&(s&&h.attr("x",d),h=r.$T(h,a,En()),o&&r.$T(o,a,En())),h.attr("x",d).attr("y",u).style("fill",i)}},circle:{create(e,t,n){return e.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",t).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this;let l=e;return r.hasType("bubble")&&l.attr("r",r.pointR.bind(r)),a&&(s&&l.attr("cx",t),l.attr("cx")&&(l=r.$T(l,a,En())),o&&r.$T(o,a,En())),l.attr("cx",t).attr("cy",n).style("fill",i)}},rectangle:{create(e,t,n){const i=a=>t(a)*2;return e.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",i).attr("height",i).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,l=r.config.point_r,c=h=>t(h)-l,d=h=>n(h)-l;let u=e;return a&&(s&&u.attr("x",c),u=r.$T(u,a,En()),o&&r.$T(o,a,En())),u.attr("x",c).attr("y",d).style("fill",i)}}},dn={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"},k_={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0};function Hl(e,t,n){const{config:i}=e,a=(s,o)=>{const r=$(o)?o:o===!1?void 0:null;r!==null&&(i[`axis_${s}_${t}`]=r)};ct(n)&&(Ut(n)?Object.keys(n).forEach(s=>{a(s,n[s])}):($(n)||n===!1)&&["y","y2"].forEach(s=>{a(s,n)}),e.state.dirty.data=!0,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function jl(e,t){const{config:n}=e;return{x:n[`axis_x_${t}`],y:n[`axis_y_${t}`],y2:n[`axis_y2_${t}`]}}var L_={axis:{labels:function(e){var t;const n=this.internal;let i;return e&&(Object.keys(e).forEach(a=>{n.axis.setLabelText(a,e[a])}),n.state.isCanvasMode?(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1):n.axis.updateLabels()),["x","y","y2"].forEach(a=>{const s=n.axis.getLabelText(a);s&&(!i&&(i={}),i[a]=s)}),i},min:function(e){const t=this.internal;return q(e)||e===!1?Hl(t,"min",e):jl(t,"min")},max:function(e){const t=this.internal;return q(e)||e===!1?Hl(t,"max",e):jl(t,"max")},range:function(e){const{axis:t}=this;if(arguments.length){const{min:n,max:i}=e;ct(i)&&t.max(i),ct(n)&&t.min(n)}else return{max:t.max(),min:t.min()}}}},R_={groups(e){const t=this.internal,{config:n}=t;return Ct(e)||(n.data_groups=e,t.state.dirty.data=!0,t.redraw()),n.data_groups}},E_={x(e){const t=this.internal,{axis:n,data:i}=t,a=n.isCustomX()&&n.isCategorized();return ot(e)&&(a?this.categories(e):(t.updateTargetX(i.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),a?this.categories():i.xs},xs(e){const t=this.internal;return tt(e)&&(t.updateTargetXs(t.data.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},P_=Object.defineProperty,D_=(e,t,n)=>t in e?P_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zi=(e,t,n)=>D_(e,typeof t!="symbol"?t+"":t,n);class I_{constructor(t){zi(this,"owner"),zi(this,"config"),zi(this,"scale"),zi(this,"charSize",{});const n=Xe(),{config:i,params:a}=t;this.owner=t,this.config=i,this.scale=n,(i.noTransition||!a.config.transition_duration)&&(i.withoutTransition=!0),i.range=this.scaleExtent((a.orgXScale||n).range())}getSizeFor1Char(t,n,i=!0){const a={w:5.5,h:11.5};return this.charSize[t]&&i?this.charSize[t]:(!n.empty()&&n.text("0").call(s=>{try{const{width:o,height:r}=Ue(s.node(),!0);o&&r&&(a.w=o,a.h=r)}finally{s.text("")}}),this.charSize[t]=a,a)}getTickTransformSetter(t){const{config:n}=this,i=t==="x"?a=>`translate(${a+n.tickOffset},0)`:a=>`translate(0,${a})`;return(a,s)=>{a.attr("transform",o=>{const r=s(o);return q(o)?i(r):null})}}scaleExtent(t){const n=t[0],i=t[t.length-1];return n<i?[n,i]:[i,n]}generateTicks(t,n){const{tickStepSize:i}=this.owner.params,[a,s]=t.domain();let o=[];if(n&&i){let r=Math.round(a);for(;r<=s;)o.push(r),r+=i}else if(t.ticks){const{tickArguments:r}=this.config;if(t.type==="log"&&!r){const l=Xe("_log").domain([a>0?a:1,s]).range(t.range());o=l.ticks();for(let c=s.toFixed().length;o.length>15;c--)o=l.ticks(c);o.splice(0,1,a),o.splice(o.length-1,1,s)}else o=t.ticks(...this.config.tickArguments||[])}return o}copyScale(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t}textFormatted(t){const n=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+String(t).replace(/0+\d$/,""):t,a=n?n(i):i;return ct(a)?a:""}transitionise(t){const{config:n}=this;let i=t;if(n.withoutTransition)i=t.interrupt();else if(n.transition||!this.owner.params.noTransition)try{i=t.transition(n.transition)}catch(a){}return i}}var M_=Object.defineProperty,F_=(e,t,n)=>t in e?M_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ti=(e,t,n)=>F_(e,typeof t!="symbol"?t+"":t,n);function Ni(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function O_(e){const t=Ni(e);return/^sub/.test(e)?`subchart_axis_${t}`:`axis_${t}`}class Ul{constructor(t={}){ti(this,"helper"),ti(this,"config"),ti(this,"params"),ti(this,"g"),ti(this,"generatedTicks",[]);const n={innerTickSize:dt,outerTickSize:t.outerTick?dt:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:tu,tickOffset:0,tickPadding:Je,tickValues:null,transition:null,noTransition:t.noTransition};n.tickLength=Math.max(n.innerTickSize,0)+n.tickPadding,this.config=n,this.params=t,this.helper=new I_(this)}canReuseTickTextOnResize(t){const{config:n,params:i}=this,{config:a,id:s,owner:o}=i,r=/^(x|subX)$/.test(s),l=Ni(s),c=/^sub/.test(s)?a[`subchart_axis_${l}_tick_format`]||a[`axis_${l}_tick_format`]:a[`axis_${l}_tick_format`],d=i.tickMultiline&&i.isCategory&&!t&&!(i.tickWidth>0);return!!(o.state.resizing&&!o.state.flowing&&!z(a.axis_evalTextSize)&&!c&&!i.tickTitle&&!(r&&a.axis_x_tick_autorotate)&&!d&&n.withoutTransition)}canReuseTickNodesOnResize(t,n,i,a){if(a.tick||!a.text||!this.canReuseTickTextOnResize(i)||t.size()!==n.length)return!1;const s=t.nodes();for(let o=0;o<n.length;o++){const r=s[o].__data__,l=n[o];if(r instanceof Date||l instanceof Date){if(+r!=+l)return!1}else if(r!==l)return!1}return!0}create(t){const n=this,{config:i,helper:a,params:s}=n,{scale:o}=a,{orient:r}=i,l=this.splitTickText.bind(n),c=/^(left|right)$/.test(r),d=/^(top|bottom)$/.test(r),u=a.getTickTransformSetter(d?"x":"y"),h=u===a.axisX?"y":"x",f=/^(top|left)$/.test(r)?-1:1,g=s.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():a.scaleExtent((s.orgXScale||o).range());const{innerTickSize:p,tickLength:_,range:x}=i,m=s.id,b=Ni(m),{isSubAxes:v}=s,y=!v&&b&&/^(x|y|y2)$/.test(b)?s.config[`axis_${b}_tick_text_position`]:{x:0,y:0},T=O_(m),w=s.config[`${T}_show`],C=v?{tick:!0,text:!0}:{tick:w?s.config[`${T}_tick_show`]:!1,text:w?s.config[`${T}_tick_text_show`]:!1},A=s.config.axis_evalTextSize;let S;t.each(function(){const k=(0,F.select)(this);let L=this.__chart__||o,E=a.copyScale();S=k,this.__chart__=E,i.tickOffset=s.isCategory?(E(1)-E(0))/2:0;const D=k.selectAll(".domain").data([0]);if(D.enter().append("path").attr("class","domain").merge(D).attr("d",()=>{const R=i.outerTickSize*f;return d?`M${x[0]},${R}V0H${x[1]}V${R}`:`M${R},${x[0]}H0V${x[1]}H${R}`}),C.tick||C.text){const R=i.tickValues||a.generateTicks(E,c||s.config.axis_rotated);n.generatedTicks=R;let P=k.selectAll(".tick");if(n.canReuseTickNodesOnResize(P,R,c||s.config.axis_rotated,C))u(P,E);else{P=P.data(R,E);const I=P.enter().insert("g",".domain").attr("class","tick"),X=P.exit().remove();P=I.merge(P),C.tick&&I.append("line"),C.text&&I.append("text");const G=!I.empty()||!X.empty(),Z=C.text&&!G&&n.canReuseTickTextOnResize(c||s.config.axis_rotated);let et={w:0,h:0},rt=P.selectAll("text.__bb-empty");if(C.text&&!Z){const gt=P.select("text"),Tt=[];rt=gt,z(A)&&(et=A.bind(n.params.owner.api)(gt.node(),m),this.classList.contains(U.dummy)&&(this.sizeFor1Char=et)),(!et||et.w===0||et.h===0)&&(et=n.helper.getSizeFor1Char(r,gt,!!A));let _t=gt.selectAll("tspan").data((mt,Pt)=>{let Dt;if(s.tickMultiline)Dt=l(mt,E,R,c,et.w);else{const Lt=a.textFormatted(mt);Dt=ot(Lt)?Lt.concat():[Lt]}return Tt[Pt]=Dt.length,Dt.map(Lt=>({index:Pt,splitted:Lt}))});_t.exit().remove(),_t=_t.enter().append("tspan").merge(_t).text(mt=>mt.splitted),_t.attr("x",d?0:_*f).attr("dx",(()=>{let mt=0;return/(top|bottom)/.test(r)&&g&&(mt=8*Math.sin(Math.PI*(g/180))*(r==="top"?-1:1)),mt+(y.x||0)})()).attr("dy",(mt,Pt)=>{const Dt=".71em";let Lt=0;return r!=="top"&&(Lt=et.h,Pt===0&&(Lt=c?-((Tt[mt.index]-1)*(et.h/2)-3):y.y===0?Dt:0)),$(Lt)&&y.y?Lt+y.y:Lt||Dt})}const xt=P.select("line");if(I.select("line").attr(`${h}2`,p*f),I.select("text").attr(h,_*f),n.setTickLineTextPosition(xt,rt,et),s.tickTitle){const gt=rt.select("title"),Tt=s.tickTitle;(gt.empty()?rt.append("title"):gt).text(_t=>Tt[Number(_t)])}if(E.bandwidth){const gt=E,Tt=gt.bandwidth()/2;L=_t=>gt(_t)+Tt,E=L}else L.bandwidth?L=E:u(X,E);P=s.owner.state.flowing?a.transitionise(P):s.owner.$T(P),u(I,L),u(P.style("opacity",null),E)}}}),this.g=S}getGeneratedTicks(t){var n;const i=((n=this.generatedTicks)==null?void 0:n.length)-1;let a=this.generatedTicks;if(i>t){const s=Math.round(i/t+.1);a=this.generatedTicks.map((o,r)=>r%s===0?o:null).filter(o=>o!==null).splice(0,t)}return a}getTickXY(){const{config:t}=this,n={x:0,y:0};return this.params.isCategory&&(n.x=t.tickCentered?0:t.tickOffset,n.y=t.tickCentered?t.tickOffset:0),n}getTickSize(t){const{scale:n}=this.helper,{config:i}=this,{innerTickSize:a,range:s}=i,o=n(t)+(i.tickCentered?0:i.tickOffset);return s[0]<o&&o<s[1]?a:0}setTickLineTextPosition(t,n,i){const a=this.getTickXY(),{innerTickSize:s,orient:o,tickLength:r,tickOffset:l}=this.config,c=this.params.id,d=this.params.tickTextRotate,u=6,h=i.h/2-u,f=b=>{const v=["start","end"];return o==="top"&&v.reverse(),b?v[b>0?0:1]:"middle"},g=b=>b?`rotate(${b})`:null,p=b=>{const v=b/(o==="bottom"?15:23);return b?11.5-2.5*v*(b>0?1:-1):r},{config:{axis_rotated:_,axis_x_tick_text_inner:x}}=this.params.owner,m=this.params.config[`axis_${Ni(c)}_tick_inner`];switch(o){case"bottom":t.attr("x1",a.x).attr("x2",a.x).attr("y2",b=>this.getTickSize.bind(this)(b)*(m?-1:1)),n.attr("x",0).attr("y",p(d)).style("text-anchor",(b,v,{length:y})=>!_&&v===0&&(x===!0||x.first)?"start":!_&&v===y-1&&(x===!0||x.last)?"end":f(d)).attr("transform",g(d));break;case"top":t.attr("x2",0).attr("y2",m?s:-s),n.attr("x",0).attr("y",-(p(d)+h+u)).style("text-anchor",f(d)).attr("transform",g(d));break;case"left":t.attr("x2",m?s:-s).attr("y1",a.y).attr("y2",a.y),n.attr("x",-r).attr("y",l+(_?h/4:h)).style("text-anchor","end");break;case"right":t.attr("x2",m?-s:s).attr("y2",0),n.attr("x",r).attr("y",h).style("text-anchor","start")}}splitTickText(t,n,i,a,s){const{params:o}=this,r=this.helper.textFormatted(t),l=Q(r)&&r.indexOf(`
37
+ </foreignObject></svg>`;return`data:image/svg+xml;base64,${dm(d)}`}function fm(e,t){const{top:n,left:a}=t,{x:i,y:s}=en(e,!0),{a:o,b:r,c:l,d:c,e:u,f:d}=e.getScreenCTM(),{width:h,height:f}=mt(e,!0);return{x:o*i+l*s+u-a,y:r*i+c*s+d-n+(f-Math.round(f/4)),width:h,height:f}}function gm(e){const{left:t,top:n}=mt(e),a=s=>s.textContent||s.childElementCount,i=[];return dn(e.querySelectorAll("text")).filter(a).forEach(s=>{const o=r=>{const{fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}=W.getComputedStyle(r),{x:f,y:p,width:g,height:_}=fm(r,{left:t,top:n});return{[r.textContent]:{x:f,y:p,width:g,height:_,fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}}};s.childElementCount>1?dn(s.querySelectorAll("tspan")).filter(a).forEach(r=>{i.push(o(r))}):i.push(o(s))}),i}function pm(e,t){t.forEach(n=>{Object.keys(n).forEach(a=>{const{x:i,y:s,width:o,height:r,fill:l,fontFamily:c,fontSize:u,transform:d}=n[a];if(e.save(),e.font=`${u} ${c}`,e.fillStyle=l,d==="none")e.fillText(a,i,s);else{const h=d.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(f=>+f==0)?(h.push(i+o-o/4),h.push(s-r+r/3)):(h.push(i),h.push(s)),e.transform(...h),e.fillText(a,0,0)}e.restore()})})}function _m(e,t,n){const{width:a,height:i}=t||n,s=rt.createElement("canvas"),o=s.getContext("2d");if(s.width=a,s.height=i,o){let l=0,c=a,u=i;if((t==null?void 0:t.preserveAspectRatio)!==!1){const d=Math.min(a/n.width,i/n.height);c=n.width*d,u=n.height*d,l=(i-u)/2}o.drawImage(e,0,0,e.width,e.height,0,l,c,u)}return s.toDataURL(t.mimeType)}var xm={export(e,t){var n;const a=this.internal,{state:i,$el:{chart:s,svg:o}}=a,r=(n=a.canvasEngine)==null?void 0:n.canvas,l=i.isCanvasMode&&r?mt(r,!0):null,{width:c,height:u}=l&&l.width&&l.height?{width:l.width,height:l.height}:i.current,d=Fe(Object.create(null),{width:c,height:u,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e);if(i.isCanvasMode&&r){const p=_m(r,d,{width:c,height:u});return t==null||t.bind(this)(p),p}const h=hm(s.node(),d,{width:c,height:u}),f=d.preserveFontStyle?gm(o.node()):[];if(t&&G(t)){const p=new Image;p.crossOrigin="Anonymous",p.onload=()=>{const g=rt.createElement("canvas"),_=g.getContext("2d");g.width=d.width||c,g.height=d.height||u,_.drawImage(p,0,0),f.length&&(pm(_,f),f.length=0),t.bind(this)(g.toDataURL(d.mimeType))},p.src=h}return h}};let ic=()=>(Jt.prototype.export=xm.export,(ic=()=>({}))());var mm={flow(e){const t=this.internal;let n;(e.json||e.rows||e.columns)&&t.convertData(e,i=>{n=i,a()});function a(){var i,s,o,r,l;let c,u=0,d=0,h,f;if(t.state.redrawing||!n||!ha())return;(i=t.flushCanvasFlow)==null||i.call(t);const p=[],g=t.getMaxDataCount(),_=t.convertDataToTargets(n,!0),x=t.axis.isTimeSeries(),m=!x&&t.axis.isCustomX()&&!t.axis.isCategorized(),v=x||m,b=(s=t.data.targets.find(A=>A.values.length))==null?void 0:s.values[0],T=b?b.x-b.index:0,k=A=>x?t.getOtherTargetX(A):A+T,w=[];t.data.targets.forEach(A=>{let S=!1;for(let L=0;L<_.length;L++)if(A.id===_[L].id){S=!0,A.values[A.values.length-1]&&(d=A.values[A.values.length-1].index+1);const P=_[L].values;u=P.length;for(let D=0;D<u;D++)P[D].index=d+D,v||(P[D].x=k(d+D)),w[D]=P[D].x,A.values.push(P[D]);_.splice(L,1);break}!S&&p.push(A.id)}),t.data.targets.forEach(A=>{for(let S=0;S<p.length;S++)if(A.id===p[S]){if(!A.values[A.values.length-1])continue;d=A.values[A.values.length-1].index+1;for(let L=0;L<u;L++)A.values.push({id:A.id,index:d+L,x:m?w[L]:k(d+L),value:null})}}),t.data.targets.length&&_.forEach(A=>{var S;const L=t.data.targets[0].values[0].index,P=A.values,D=P.length,R=Math.max(d-L,0);if(R){P.length=D+R;for(let E=D-1;E>=0;E--)P[E+R]=P[E];for(let E=0;E<R;E++){const M=L+E;P[E]={id:A.id,index:M,x:m?(S=t.data.targets[0].values[E])==null?void 0:S.x:k(M),value:null}}}for(let E=R;E<P.length;E++){const M=P[E];M.index+=d,v||(M.x=k(M.index))}});for(let A=0;A<_.length;A++)t.data.targets.push(_[A]);const y=t.data.targets[0],C=y.values[0];if(ht(e.to)?(u=0,f=x?Zt.call(t,e.to):e.to,y.values.forEach(A=>{A.x<f&&u++})):ht(e.length)&&(u=e.length),g?g===1&&x&&(h=(y.values[y.values.length-1].x-C.x)/2,c=[new Date(+C.x-h),new Date(+C.x+h)]):(x?h=y.values.length>1?y.values[y.values.length-1].x-C.x:C.x-t.getXDomain(t.data.targets)[0]:h=1,c=[C.x-h,C.x]),c&&t.updateXDomain(null,!0,!0,!1,c),t.state.isCanvasMode){const A=nt(e.duration)?e.duration:t.config.transition_duration;if((o=t.animateCanvasFlow)==null?void 0:o.call(t,{done:e.done,duration:A,length:u,orgDataCount:g}))return;u&&g&&t.data.targets.forEach(L=>{L.values.splice(0,u)}),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),t.updateTypesElements(),(r=t.updateCanvasFlowFocus)==null||r.call(t),(l=e.done)==null||l.call(t.api);return}t.updateTargets(t.data.targets),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({flow:{length:u,duration:nt(e.duration)?e.duration:t.config.transition_duration,done:e.done,orgDataCount:g},withLegend:!0,withTransition:g>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}},vm={generateFlow(e){const t=this,{config:n,data:a,state:i,$el:s}=t;return function(){var o;if(!t.$el)return;const r=e.flow.length;i.flowing=!0,a.targets.forEach(c=>{c.values.splice(0,r)}),i.dataGeneration++,t.updateXGrid&&t.updateXGrid(!0);const l={};if(["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(c=>{const u=c.split(".");let d=s[u[0]];d&&u.length>1&&(d=d[u[1]]),d!=null&&d.size()&&(l[c]=d)}),n.axis_rotated)(o=t.hideGridFocus)==null||o.call(t);else{const c=s.main.selectAll(`line.${H.xgridFocus}:not(.${H.xgridFocusContinuous})`);c.size()&&(l["gridFocus.x"]=c),s.main.selectAll(`line.${H.ygridFocus}`).style("visibility","hidden")}t.setFlowList(l,e)}},setFlowList(e,t){const n=this,{flow:a,targets:i}=t,{duration:s=t.duration,orgDataCount:o}=a,r=n.getFlowTransform(i,o),l=Kr();let c;l.add(Object.keys(e).map(u=>(c=e[u].transition().ease(d=>+d).duration(s),u==="axis.x"?c=c.call(d=>{n.axis.x.setTransition(d).create(d)}):u==="region.list"?c=c.filter(n.isRegionOnX).attr("transform",r):c=c.attr("transform",r),c))),c.call(l,()=>{n.cleanUpFlow(e,t)})},cleanUpFlow(e,t){var n,a;const i=this;if(!i.$el)return;const{config:s,state:o,$el:{svg:r}}=i,l=s.axis_rotated,{flow:c,shape:u,xv:d}=t,{cx:h,cy:f,xForText:p,yForText:g}=u.pos,{done:_=()=>{},length:x}=c;if(x){const m=i.isPointFocusOnly()?v=>{var b;return(b=v.parentElement)==null?void 0:b.classList.contains(H.circles)}:()=>!1;["circle","text","shape","eventRect"].forEach(v=>{const b=[];for(let T=0;T<x;T++)b.push(`.${H[v]}-${T}`);r.selectAll(`.${H[`${v}s`]}`).selectAll(b).filter(function(){return!m(this)}).remove()}),r.select(`.${H.xgrid}`).remove()}Object.keys(e).forEach(m=>{const v=e[m];if(m!=="axis.x"&&v.attr("transform",null),m==="grid.x")v.attr(o.xgridAttr);else if(m==="gridLines.x")v.attr("x1",l?0:d).attr("x2",l?o.width:d),v.select("text").attr("x",l?o.width:0).attr("y",d);else if(/^(area|bar|line)$/.test(m))v.attr("d",u.type[m]);else if(m==="text")v.attr("x",p).attr("y",g).style("fill-opacity",i.opacityForText.bind(i));else if(m==="circle")if(i.isCirclePoint())v.attr("cx",h).attr("cy",f);else{const b=k=>h(k)-s.point_r,T=k=>f(k)-s.point_r;v.attr("x",b).attr("y",T)}else m==="region.list"&&v.select("rect").filter(i.isRegionOnX).attr("x",i.regionX.bind(i)).attr("width",i.regionWidth.bind(i))}),s.interaction_enabled&&i.redrawEventRect(),o.flowing=!1,((n=i.$el.tooltip)==null?void 0:n.style("display"))==="block"?i.updateTooltipOnRedraw():(a=i.hideGridFocus)==null||a.call(i),_.call(i.api)},getFlowTransform(e,t){const n=this,{data:a,scale:{x:i}}=n,s=a.targets[0].values;let o;const r=i.domain(),l=n.updateXDomain(e,!0,!0);if(t)o=i(r[0])-i(l[0]);else if(s.length!==1)o=i(r[0])-i(l[0]);else if(n.axis.isTimeSeries()){const u=n.getValueOnIndex(s,0),d=n.getValueOnIndex(s,s.length-1);o=i(u.x)-i(d.x)}else o=un(l)/2;const c=un(r)/un(l);return`translate(${o},0) scale(${c},1)`}};let sc=()=>(pt(Rt.prototype,vm),Jt.prototype.flow=mm.flow,(sc=()=>({}))());function oc(e){return Array.isArray(e)?e:[e]}function rc(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function ws(e,t){const n=this.internal,{config:a}=n,i=a.transition_duration&&ha(),s=`grid_${t}_lines`;return e?(a[s]=oc(e),n.state.isCanvasMode?(rc(n),a[s]):(n.updateGrid(),n.redrawGrid(i),a[s])):a[s]}function lc(e,t){const n=`grid_${t}_lines`;return ws.bind(this)(this.internal.config[n].concat(e?oc(e):[]),t)}function cc(e,t){var n;const a=this.internal;if(a.state.isCanvasMode){const i=((n=a.getGridFilterToRemove)==null?void 0:n.call(a,e))||(()=>!0),s=`grid_${t?"x":"y"}_lines`;a.config[s]=a.config[s].filter(o=>!i(o)),rc(a);return}a.removeGridLines(e,t)}const uc=function(e){return ws.bind(this)(e,"x")};pt(uc,{add(e){return lc.bind(this)(e,"x")},remove(e){return cc.bind(this)(e,!0)}});const dc=function(e){return ws.bind(this)(e,"y")};pt(dc,{add(e){return lc.bind(this)(e,"y")},remove(e){return cc.bind(this)(e,!1)}});var hc={xgrids:uc,ygrids:dc};const bm=`line.${ut.xgridFocus}:not(.${ut.xgridFocusContinuous}), line.${ut.ygridFocus}`,ym=e=>nt(e.position)||"end",Tm=e=>e.position==="start"?4:e.position==="middle"?0:-4;function fc(e){var t;const{state:n,$el:{main:a}}=e,i=n._gridFocusEl,s=a.node(),o=((t=i==null?void 0:i.nodes)==null?void 0:t.call(i))||[];return o.length&&o.every(r=>s==null?void 0:s.contains(r))?i:n._gridFocusEl=a.selectAll(bm)}function gc(e){e.$el.main.select(`line.${ut.xgridFocusContinuous}`).style("visibility","hidden")}function pc(e,t,n){return a=>{let i=e?0:t;return a.position==="start"?i=e?-n:0:a.position==="middle"&&(i=(e?-n:t)/2),i}}function _c(e,t){t==="grid"&&e.each(function(){const n=(0,B.select)(this);["x1","x2","y1","y2"].forEach(a=>n.attr(a,+n.attr(a)))})}var wm={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:n},$el:a}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(a.gridLines.main=a.main.insert("g",`.${U.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",n.pathGrid).attr("class",`${Lt.grid} ${Lt.gridLines}`),a.gridLines.main.append("g").attr("class",Lt.xgridLines),a.gridLines.main.append("g").attr("class",Lt.ygridLines),a.gridLines.x=(0,B.selectAll)([]))},updateXGrid(e){const t=this,{config:n,scale:a,state:i,$el:{main:s,grid:o}}=t,r=n.axis_rotated,l=t.generateGridData(n.grid_x_type,a.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,u=d=>(a.zoom||a.x)(d)+c*(r?-1:1);i.xgridAttr=r?{x1:0,x2:i.width,y1:u,y2:u}:{x1:u,x2:u,y1:0,y2:i.height},o.x=s.select(`.${Lt.xgrids}`).selectAll(`.${Lt.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",Lt.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,B.select)(this);Object.keys(i.xgridAttr).forEach(h=>{d.attr(h,i.xgridAttr[h])}),d.style("opacity",()=>+d.attr(r?"y1":"x1")===(r?i.height:0)?"0":null)})},updateYGrid(){const e=this,{axis:t,config:n,scale:a,state:i,$el:{grid:s,main:o}}=e,r=n.axis_rotated,l=d=>a.y(d),c=t.y.getGeneratedTicks(n.grid_y_ticks),u=c!=null&&c.length?c:e.scale.y.ticks(n.grid_y_ticks);s.y=o.select(`.${Lt.ygrids}`).selectAll(`.${Lt.ygrid}`).data(u),s.y.exit().remove(),s.y=s.y.enter().append("line").attr("class",Lt.ygrid).merge(s.y),s.y.attr("x1",r?l:0).attr("x2",r?l:i.width).attr("y1",r?0:l).attr("y2",r?i.height:l),_c(s.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:n}}=e;!n.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:n,$el:{gridLines:a,main:i},$T:s}=t,o=n.axis_rotated,r=e==="x";n[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=i.select(`.${Lt[`${e}gridLines`]}`).selectAll(`.${Lt[`${e}gridLine`]}`).data(n[`grid_${e}_lines`]);s(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(u){const d=(0,B.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),s(l.attr("class",u=>`${Lt[`${e}gridLine`]} ${u.class||""}`.trim()).select("text").attr("text-anchor",ym).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",Tm).attr("dy",-5)).text(function(u){var d;return(d=u.text)!=null?d:this.remove()}),a[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:n},state:{width:a,height:i},$el:{gridLines:s},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=s.x.select("line"),u=s.x.select("text"),d=s.y.select("line"),h=s.y.select("text");return c=o(c,e).attr("x1",n?0:r).attr("x2",n?a:r).attr("y1",n?r:0).attr("y2",n?r:i),u=o(u,e).attr("x",pc(!n,a,i)).attr("y",r),d=o(d,e).attr("x1",n?l:0).attr("x2",n?l:a).attr("y1",n?0:l).attr("y2",n?i:l),h=o(h,e).attr("x",pc(n,a,i)).attr("y",l),[c.style("opacity",null),u.style("opacity",null),d.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:n,state:{clip:a},$el:i}=e;n._gridFocusEl=null;const s=t.grid_front,o=`.${s&&i.gridLines.main?Lt.gridLines:U.chart}${s?" + *":""}`,r=i.main.insert("g",o).attr("clip-path",a.pathGrid).attr("class",Lt.grid);if(i.grid.main=r,t.grid_x_show&&r.append("g").attr("class",Lt.xgrids),t.grid_y_show&&r.append("g").attr("class",Lt.ygrids),t.axis_tooltip){const l=r.append("g").attr("class","bb-axis-tooltip");l.append("line").attr("class","bb-axis-tooltip-x"),l.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(r.append("g").attr("class",ut.xgridFocus).append("line").attr("class",ut.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&r.append("g").attr("class",ut.ygridFocus).append("line").attr("class",ut.ygridFocus),t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&i.main.insert("g",o).attr("class",ut.xgridFocusContinuous).append("line").attr("class",`${ut.xgridFocus} ${ut.xgridFocusContinuous}`).style("visibility","hidden"))},showAxisGridFocus(){var e,t;const n=this,{config:a,format:i,state:{event:s,width:o,height:r}}=n,l=a.axis_rotated,[c,u]=se(s,(e=n.$el.eventRect)==null?void 0:e.node()),d={x:c,y:u};for(const[h,f]of Object.entries(n.$el.axisTooltip)){const p=h==="x"&&!l||h!=="x"&&l?"x":"y",g=d[p];let _=(t=n.scale[h])==null?void 0:t.invert(g);_&&(_=h==="x"&&n.axis.isTimeSeries()?i.xAxisTick(_):_==null?void 0:_.toFixed(2),f==null||f.attr(p,g).text(_))}n.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,f){const p=(0,B.select)(this);f===0?p.attr("x1",c).attr("x2",c).attr("y1",f?0:r).attr("y2",f?r:0):p.attr("x1",f?0:o).attr("x2",f?o:0).attr("y1",u).attr("y2",u)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll(`line.${Ft.axisTooltipX}, line.${Ft.axisTooltipY}`).style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const n=this,{config:a,state:{width:i,height:s}}=n,o=a.axis_rotated,r=fc(n),l=(e||[r.datum()]).filter(d=>d&&nt(n.getBaseValue(d)));if(!a.tooltip_show||l.length===0||!a.axis_x_forceAsSingle&&n.hasType("bubble")||n.hasArcType())return;const c=a.grid_focus_edge&&!a.tooltip_grouped,u=n.xx.bind(n);r.style("visibility",null).data(l.concat(l)).each(function(d){const h=(0,B.select)(this),f={x:u(d),y:n.getYScaleById(d.id)(d.value)};let p;if(h.classed(ut.xgridFocus))p=o?[null,f.x,c?f.y:i,f.x]:[f.x,c?f.y:null,f.x,s];else{const g=n.axis.getId(d.id)==="y2";p=o?[f.y,c&&!g?f.x:null,f.y,c&&g?f.x:s]:[c&&g?f.x:null,f.y,c&&!g?f.x:i,f.y]}["x1","y1","x2","y2"].forEach((g,_)=>h.attr(g,p[_]))}),_c(r,"grid"),(t=n.showCircleFocus)==null||t.call(n,e)},hideGridFocus(e=!1){var t;const n=this,{state:{inputType:a,resizing:i}}=n;(e||a==="mouse"||!i)&&(fc(n).style("visibility","hidden"),gc(n),(t=n.hideCircleFocus)==null||t.call(n))},updateGridFocus(){var e;const t=this,{state:{inputType:n,width:a,height:i,resizing:s},$el:{grid:o}}=t,r=o.main.select(`line.${ut.xgridFocus}`);if(n==="touch")r.empty()?s&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?a:-10).attr("y1",l?-10:0).attr("y2",l?-10:i),gc(t)}return!0},generateGridData(e,t){const n=this,a=n.$el.main.select(`.${Ft.axisX}`).selectAll(".tick").size();let i=[];if(e==="year"){const s=n.getXDomain(n.data.targets),[o,r]=s.map(l=>l.getFullYear());for(let l=o;l<=r;l++)i.push(new Date(`${l}-01-01 00:00:00`))}else i=t.ticks(Ae),i.length>a&&(i=i.filter(s=>String(s).indexOf(".")<0));return i},getGridFilterToRemove(e){return e?t=>{let n=!1;return(et(e)?e.concat():[e]).forEach(a=>{("value"in a&&t.value===a.value||"class"in a&&t.class===a.class)&&(n=!0)}),n}:()=>!0},removeGridLines(e,t){const n=this,{config:a,$T:i}=n,s=n.getGridFilterToRemove(e),o=u=>!s(u),r=t?Lt.xgridLines:Lt.ygridLines,l=t?Lt.xgridLine:Lt.ygridLine;i(n.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(s)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;a[c]=a[c].filter(o)}},km={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 xc=()=>(pt(Rt.prototype,wm),Jt.prototype.xgrids=hc.xgrids,Jt.prototype.ygrids=hc.ygrids,Oe.setOptions([km]),(xc=()=>({}))());function mc(e,t,n,a){const i=this,{config:s,$el:{main:o}}=i,r=s.data_selection_grouped,l=s.data_selection_isselectable.bind(i.api),c=ht(t)?[].concat(t):null,u=e&&!s.data_selection_multiple;let d=!u;const h=(f,p,g)=>{i.unselectPoint(f,p,g),f.interrupt().remove()};i.getTargetsToShow().forEach(f=>{const{id:p}=f,g=r||!c||c.indexOf(p)>=0,_=o.select(`.${gt.selectedCircles}${i.getTargetSelectorSuffix(p)}`);f.values.forEach(x=>{const{index:m}=x,v=!n||n.indexOf(m)>=0,b=_.selectAll(`.${gt.selectedCircle}-${m}`),T=!b.empty();e?g&&v&&l(x)&&(!T||u)?(d||(mc.call(i,!1),d=!0),i.selectPoint(null,x,m)):(!u||d)&&ht(a)&&a&&T&&h(b,x,m):g&&v&&T&&h(b,x,m)})})}function ks(e=!1,t,n,a){var i;const s=this,{config:o,$el:{main:r}}=s,l=o.data_selection_grouped,c=o.data_selection_isselectable.bind(s.api),u=e&&!o.data_selection_multiple;let d=!u;if(o.data_selection_enabled){if(u&&(n=n!=null&&n.length?[n[0]]:[0],l||(t=(ht(t)?[].concat(t):s.getTargetsToShow().map(f=>f.id)).slice(0,1))),(i=s.isPointFocusOnly)!=null&&i.call(s)){mc.call(s,e,t,n,a);return}r.selectAll(`.${vt.shapes}`).selectAll(`.${vt.shape}`).each(function(h){const f=(0,B.select)(this),{id:p,index:g}=h.data?h.data:h,_=l||!t||t.indexOf(p)>=0,x=!n||n.indexOf(g)>=0;if(f.classed(De.line)||f.classed(Ga.area))return;const m=s.getToggle(this,h).bind(s),v=f.classed(gt.SELECTED);e?_&&x&&c(h)&&(!v||u)?(d||(ks.call(s,!1),d=!0),!f.classed(gt.SELECTED)&&m(!0,f.classed(gt.SELECTED,!0),h,g)):(!u||d)&&ht(a)&&a&&v&&m(!1,f.classed(gt.SELECTED,!1),h,g):_&&x&&c(h)&&v&&m(!1,f.classed(gt.SELECTED,!1),h,g)})}}var Cm={selected(e){var t,n;const a=this.internal,i=[];return a.state.isCanvasMode?((t=a.getCanvasSelectedData)==null?void 0:t.call(a,e))||i:(n=a.isPointFocusOnly)!=null&&n.call(a)?(a.$el.main.selectAll(`.${gt.selectedCircles+a.getTargetSelectorSuffix(e)}`).selectAll(`.${gt.selectedCircle}`).each(s=>i.push(s)),i):(a.$el.main.selectAll(`.${vt.shapes+a.getTargetSelectorSuffix(e)}`).selectAll(`.${vt.shape}`).filter(function(){return(0,B.select)(this).classed(gt.SELECTED)}).each(s=>i.push(s)),i)},select(e,t,n){var a;const i=this.internal;if(i.state.isCanvasMode){(a=i.setCanvasSelection)==null||a.call(i,!0,e,t,n);return}ks.bind(i)(!0,e,t,n)},unselect(e,t){var n;const a=this.internal;if(a.state.isCanvasMode){(n=a.setCanvasSelection)==null||n.call(a,!1,e,t);return}ks.bind(a)(!1,e,t)}},Sm={drag(e){const t=this,{config:n,state:a,$el:{main:i}}=t,s=n.data_selection_grouped,o=n.interaction_enabled&&n.data_selection_isselectable;if(t.hasArcType()||!n.data_selection_enabled||n.zoom_enabled&&!t.zoom.altDomain||!n.data_selection_multiple)return;const[r,l]=a.dragStart||[0,0],[c,u]=e,d=Math.min(r,c),h=Math.max(r,c),f=s?a.margin.top:Math.min(l,u),p=s?a.height:Math.max(l,u),g=()=>{!t||!t.$el||!t.$el.main||(i.select(`.${xn.dragarea}`).attr("x",d).attr("y",f).attr("width",h-d).attr("height",p-f),i.selectAll(`.${vt.shapes}`).selectAll(`.${vt.shape}`).filter(_=>o==null?void 0:o.bind(t.api)(_)).each(function(_,x){const m=(0,B.select)(this),v=m.classed(gt.SELECTED),b=m.classed(xn.INCLUDED);let T,k;if(m.classed(Vt.circle)){const w=+m.attr("cx"),y=+m.attr("cy");k=t.togglePoint,T=d<w&&w<h&&f<y&&y<p}else if(m.classed(de.bar)){const{x:w,y,width:C,height:A}=Yr(this);k=t.togglePath,T=!(h<w||w+C<d)&&!(p<y||y+A<f)}else return;T^b&&(m.classed(xn.INCLUDED,!b),m.classed(gt.SELECTED,!v),k.call(t,!v,m,_,x))}))};Ur(t.state,g)},dragstart(e){const t=this,{config:n,state:a,$el:{main:i}}=t;t.hasArcType()||!n.data_selection_enabled||(a.dragStart=e,i.select(`.${U.chart}`).append("rect").attr("class",xn.dragarea).style("opacity","0.1"),t.setDragStatus(!0))},dragend(){const e=this,{config:t,$el:{main:n},$T:a}=e;e.hasArcType()||!t.data_selection_enabled||(a(n.select(`.${xn.dragarea}`)).style("opacity","0").remove(),n.selectAll(`.${vt.shape}`).classed(xn.INCLUDED,!1),e.setDragStatus(!1))}},Am=Object.defineProperty,Lm=Object.defineProperties,Pm=Object.getOwnPropertyDescriptors,vc=Object.getOwnPropertySymbols,Rm=Object.prototype.hasOwnProperty,Em=Object.prototype.propertyIsEnumerable,bc=(e,t,n)=>t in e?Am(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mm=(e,t)=>{for(var n in t||(t={}))Rm.call(t,n)&&bc(e,n,t[n]);if(vc)for(var n of vc(t))Em.call(t,n)&&bc(e,n,t[n]);return e},Dm=(e,t)=>Lm(e,Pm(t)),Om=Dm(Mm({},Sm),{selectPoint(e,t,n){const a=this,{config:i,$el:{main:s},$T:o}=a,r=i.axis_rotated,l=(r?a.circleY:a.circleX).bind(a),c=(r?a.circleX:a.circleY).bind(a),u=a.pointSelectR.bind(a);q(i.data_onselected,a.api,t,e==null?void 0:e.node()),o(s.select(`.${gt.selectedCircles}${a.getTargetSelectorSuffix(t.id)}`).selectAll(`.${gt.selectedCircle}-${n}`).data([t]).enter().append("circle").attr("class",()=>a.generateClass(gt.selectedCircle,n)).attr("cx",l).attr("cy",c).attr("stroke",a.color).attr("r",d=>a.pointSelectR(d)*1.4)).attr("r",u)},unselectPoint(e,t,n){const a=this,{config:i,$el:{main:s},$T:o}=a;q(i.data_onunselected,a.api,t,e==null?void 0:e.node()),o(s.select(`.${gt.selectedCircles}${a.getTargetSelectorSuffix(t.id)}`).selectAll(`.${gt.selectedCircle}-${n}`)).attr("r",0).remove()},togglePoint(e,t,n,a){this[`${e?"":"un"}selectPoint`](t,n,a)},selectPath(e,t){const n=this,{config:a}=n;q(a.data_onselected,n.api,t,e.node()),a.interaction_brighten&&e.style("filter","brightness(1.25)")},unselectPath(e,t){const n=this,{config:a}=n;q(a.data_onunselected,n.api,t,e.node()),a.interaction_brighten&&e.style("filter",null)},togglePath(e,t,n,a){this[`${e?"":"un"}selectPath`](t,n,a)},getToggle(e,t){const n=this;return e.nodeName==="path"?n.togglePath:n.isStepType(t)?()=>{}:n.togglePoint},toggleShape(e,t,n){var a;const i=this,{config:s,$el:{main:o}}=i;if(s.data_selection_enabled&&s.data_selection_isselectable.bind(i.api)(t)){const r=(0,B.select)(e),l=r.classed(gt.SELECTED),c=i.getToggle(e,t).bind(i);let u;if(!s.data_selection_multiple){const d=(a=i.isPointFocusOnly)==null?void 0:a.call(i);let h=`.${d?gt.selectedCircles:vt.shapes}`;s.data_selection_grouped&&(h+=i.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(d?`.${gt.selectedCircle}`:`.${vt.shape}.${gt.SELECTED}`).classed(gt.SELECTED,!1).each(function(f){const p=(0,B.select)(this);u=p,c(!1,p,f,f.index)})}(!u||u.node()!==r.node())&&(r.classed(gt.SELECTED,!l),c(!l,r,t,n))}}}),$m={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 yc=()=>(pt(Rt.prototype,Om),pt(Jt.prototype,Cm),Oe.setOptions([$m]),(yc=()=>!0)());const Tc=function(e){var t,n,a;const i=this.internal,{axis:s,brush:o,config:r,scale:{x:l,subX:c},state:u}=i;let d;return u.isCanvasMode?(r.subchart_show&&(d=e,Array.isArray(d)?(d=s.isTimeSeries()?d.map(h=>Zt.bind(i)(h)):d,d=((t=i.setCanvasSubchartDomain)==null?void 0:t.call(i,d))||u.domain):d=(n=u.domain)!=null?n:l.orgDomain()),d):(r.subchart_show&&(d=e,Array.isArray(d)?(s.isTimeSeries()&&(d=d.map(f=>Zt.bind(i)(f))),i.withinRange(d,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))&&(u.domain=d.slice(),o.move(o.getSelection(),d.map(c)))):d=(a=u.domain)!=null?a:l.orgDomain()),d)};pt(Tc,{show(){var e,t,n;const a=this.internal,{$el:{subchart:i},config:s}=a,o=s.subchart_show;if(!o){if(a.state.isCanvasMode){(e=a.unbindZoomEvent)==null||e.call(a),s.subchart_show=!0,this.resize();return}a.unbindZoomEvent(),s.subchart_show=!o,!i.main&&a.initSubchart();let r=i.main.selectAll(`.${U.target}`);a.data.targets.length!==r.size()&&(a.updateSizes(),a.updateTargetsForSubchart(a.data.targets),r=(t=i.main)==null?void 0:t.selectAll(`.${U.target}`)),r==null||r.style("opacity",null),(n=i.main)==null||n.style("display",null),this.resize()}},hide(){var e;const t=this.internal,{$el:{subchart:{main:n}},config:a}=t;if(t.state.isCanvasMode){a.subchart_show&&(a.subchart_show=!1,this.resize(),(e=t.bindZoomEvent)==null||e.call(t));return}a.subchart_show&&(n==null?void 0:n.style("display"))!=="none"&&(a.subchart_show=!1,n.style("display","none"),this.resize())},toggle(){const e=this.internal,{config:t}=e;this.subchart[t.subchart_show?"hide":"show"]()},reset(){var e;const t=this.internal,{brush:n}=t;if(t.state.isCanvasMode){(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1);return}n.clear(n.getSelection())}});var Fm={subchart:Tc};const wc=["bar","line","bubble","candlestick","scatter"],Im=["opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width"];function kc(e,t){var n,a;const i=(a=(n=e.$el.grid)==null?void 0:n.main)==null?void 0:a.select(`line.${H.xgridFocus}`).node();if(!i||!W.getComputedStyle)return;const s=W.getComputedStyle(i);Im.forEach(o=>{const r=s.getPropertyValue(o);r&&t.style(o,r)})}function Nn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Bm(e){var t,n;if(!gi(e))return!1;const{config:a,state:i,$el:s}=e,o=(n=(t=s.grid)==null?void 0:t.main)==null?void 0:n.select(`line.${H.xgridFocus}:not(.${H.xgridFocusContinuous})`),r=s.main.select(`line.${H.xgridFocusContinuous}`);if(!(o!=null&&o.node())||!r.node())return!1;const l=i.margin2.left-i.margin.left+i.width2,c=i.margin2.top-i.margin.top+i.height2;return kc(e,r),a.axis_rotated?r.attr("x1",Nn(o.attr("x1"),0)).attr("x2",l).attr("y1",Nn(o.attr("y1"),-10)).attr("y2",Nn(o.attr("y2"),-10)):r.attr("x1",Nn(o.attr("x1"),-10)).attr("x2",Nn(o.attr("x2"),-10)).attr("y1",Nn(o.attr("y1"),0)).attr("y2",c),r.style("visibility",null),o.style("visibility","hidden"),!0}function zm(e){var t;(t=e.$el.main)==null||t.select(`line.${H.xgridFocusContinuous}`).style("visibility","hidden")}function Nm(e,t,n){const{config:a,state:i}=e,[s,o]=se(t,n),r=Qs(e,a.axis_rotated?o:s);return r===null?null:a.axis_rotated?[i.width/2,r]:[r,i.height/2]}function Cs(e,t,n,a){var i,s;const o=(s=(i=e.$el.eventRect)==null?void 0:i.node)==null?void 0:s.call(i);if(!o)return;const r=Nm(e,n,a)||[0,0],l=mt(o,!0),c=l.left+r[0],u=l.top+r[1],d={bubbles:!0,cancelable:!0,screenX:c,screenY:u,clientX:c,clientY:u};/^touch/.test(t)?as.touch(o,t,d):as.mouse(o,t,d)}var Xm={isSubchartBrushEnabled(){const{config:e}=this;return e.subchart_show&&e.subchart_brush_enabled!==!1},bindSubchartEventRect(e){const t=this,{config:n,state:a}=t;e.on("mouseover mousemove mouseout touchstart touchmove touchend",null),n.interaction_enabled&&(a.inputType==="mouse"?e.on("mouseover mousemove",function(i){t.isSubchartBrushEnabled()||Cs(t,i.type,i,this)}).on("mouseout",function(i){t.isSubchartBrushEnabled()||Cs(t,"mouseout",i,this)}):a.inputType==="touch"&&e.on("touchstart touchmove touchend",function(i){var s;t.isSubchartBrushEnabled()||((s=i.touches)==null?void 0:s.length)>1||Cs(t,i.type,i,this)}))},initBrush(){const e=this,{config:t,scale:n,$el:{subchart:a},state:i}=e,s=t.axis_rotated,o=t.subchart_size_height;let r,l,c;e.brush=(s?(0,Ya.brushY)():(0,Ya.brushX)()).handleSize(5),e.brush.on("start brush end",u=>{const{selection:d,sourceEvent:h,target:f,type:p}=u;p==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?d:null),/(start|brush)/.test(p)&&(p==="brush"&&h&&i.domain&&(l==null||l.forEach((g,_)=>{g!==d[_]&&(i.domain[_]=n.x.orgDomain()[_])})),e.redrawForBrush(p!=="start")),p==="end"&&(r=n.x.orgDomain()),f!=null&&f.handle&&(d===null?e.brush.handle.attr("display","none"):e.brush.handle.attr("display",null).attr("transform",(g,_)=>{const x=[d[_],o/2];return`translate(${s?x.reverse():x})`}))}),e.brush.updateResize=function(){c&&clearTimeout(c),c=setTimeout(()=>{const u=this.getSelection();r&&(0,Ya.brushSelection)(u.node())&&this.move(u,r.map(n.subX.orgScale()))},0)},e.brush.update=function(){var u;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((u=a.main)==null||u.select(`.${H.brush}`).call(this)),this},e.brush.scale=function(u){const d=t.subchart_size_height;let h=e.axis.getExtent();!h&&u.range?h=[[0,0],[u.range()[1],d]]:et(h)&&(h=h.map((f,p)=>[f,p>0?d:p])),s&&h[1].reverse(),this.extent(h),this.update()},e.brush.getSelection=()=>a.main?a.main.select(`.${H.brush}`):(0,B.select)([])},initSubchart(){const e=this,{config:t,state:{clip:n,hasAxis:a},$el:{defs:i,svg:s,subchart:o,axis:r}}=e;if(!a)return;const l=t.subchart_show?null:"hidden",c=`${n.id}-subchart`,u=e.getClipPath(c);n.idSubchart=c,e.appendClip(i,c),e.initBrush(),o.main=s.append("g").classed(H.subchart,!0).attr("transform",e.getTranslate("context"));const{main:d}=o;d.style("visibility",l),d.append("g").attr("clip-path",u).attr("class",H.chart),e.withSubchartTypeContext(()=>{wc.forEach(f=>{const p=Mt(/^(bubble|scatter)$/.test(f)?"circle":f);if(e.hasType(f)||e.hasTypeOf(p)){const g=d.select(`.${H.chart}`),_=H[`chart${p}s`];g.select(`.${_}`).empty()&&g.append("g").attr("class",_)}})});const h=d.append("g").attr("clip-path",u).attr("class",H.brush).style("pointer-events",e.isSubchartBrushEnabled()?null:"none").call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),o.eventRect=d.append("g").attr("clip-path",u).attr("class",`${H.eventRects} ${H.eventRects}-subchart`).style("fill-opacity","0").style("pointer-events",e.isSubchartBrushEnabled()?"none":"all").append("rect").attr("class",`${H.eventRect} ${H.eventRect}-subchart`).attr("width",e.state.width2).attr("height",e.state.height2),e.bindSubchartEventRect(o.eventRect),d.append("g").attr("clip-path",u).attr("class",H.xgridFocus).append("line").attr("class",H.xgridFocus).style("visibility","hidden"),r.subX=d.append("g").attr("class",H.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",t.axis_rotated?"":n.pathXAxis).style("visibility",t.subchart_axis_x_show?l:"hidden"),r.subY=d.append("g").attr("class",H.axisY).attr("transform",e.getTranslate("subY")).style("visibility",t.subchart_axis_y_show?l:"hidden"),r.subY2=d.append("g").attr("class",H.axisY2).attr("transform",e.getTranslate("subY2")).style("visibility",t.subchart_axis_y2_show?l:"hidden")},addBrushHandle(e){const t=this,{config:n}=t,a=n.axis_rotated,i=n.subchart_init_range,s="handle--custom",o=Po[a?"y":"x"];t.brush.handle=e.selectAll(`.${s}`).data(a?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",s).attr("cursor",`${a?"ns":"ew"}-resize`).attr("d",r=>o[/[se]/.test(r.type)?"end":"start"]).attr("display",i?null:"none")},updateTargetsForSubchart(e){var t;const n=this,{config:a,state:i,$el:{subchart:{main:s}}}=n;a.subchart_show&&(n.withSubchartTypeContext(()=>{wc.filter(o=>n.hasType(o)||n.hasTypeOf(Mt(o))).forEach(o=>{const r=/^(bubble|scatter)$/.test(o),l=Mt(r?"circle":o),c=n.getChartClass(l,!0),u=n.getClass(r?"circles":`${o}s`,!0),d=s.select(`.${H[`chart${`${l}s`}`]}`);if(r){const h=d.selectAll(`.${H.circles}`).data(e.filter(n[`is${Mt(o)}Type`].bind(n))).attr("class",u);h.exit().remove(),h.enter().append("g").attr("class",u)}else{const h=d.selectAll(`.${H[`chart${l}`]}`).attr("class",c).data(e.filter(n[`is${l}Type`].bind(n))),f=h.enter().append("g").style("opacity","0").attr("class",c).append("g").attr("class",u);h.exit().remove(),o==="line"&&n.hasTypeOf("Area")&&f.append("g").attr("class",n.getClass("areas",!0))}})}),s.selectAll(`.${H.brush} rect`).attr(a.axis_rotated?"width":"height",a.axis_rotated?i.width2:i.height2),(t=n.$el.subchart.eventRect)==null||t.attr("width",i.width2).attr("height",i.height2).style("pointer-events",n.isSubchartBrushEnabled()?"none":"all"))},updateSubchartYDomain(e){var t,n;const a=this,{scale:i}=a,s=e||a.filterTargetsToShow(a.data.targets);(t=i.subY)==null||t.domain(a.getYDomain(s,"y")),(n=i.subY2)==null||n.domain(a.getYDomain(s,"y2"))},redrawSubchart(e,t){var n,a,i,s;const o=this,{config:r,$el:{subchart:{main:l}},state:c}=o,u=!!t;if(l.style("visibility",r.subchart_show?null:"hidden"),l.select(`.${H.brush}`).style("pointer-events",o.isSubchartBrushEnabled()?null:"none"),(n=o.$el.subchart.eventRect)==null||n.style("pointer-events",o.isSubchartBrushEnabled()?"none":"all"),(a=o.$el.axis.subY)==null||a.style("visibility",r.subchart_axis_y_show?null:"hidden"),(i=o.$el.axis.subY2)==null||i.style("visibility",r.subchart_axis_y2_show?null:"hidden"),r.subchart_show&&(((s=c.event)==null?void 0:s.type)==="zoom"&&o.brush.update(),e)){const d=r.subchart_init_range;!dl(o)&&o.brush.update(),o.withSubchartTypeContext(()=>{const h=c._targetsToShow||o.filterTargetsToShow(o.data.targets);o.updateSubchartYDomain(h);const f=o.getDrawShape();if(Object.keys(f.type).forEach(p=>{const g=Mt(p),_=o[`generateDraw${g}`](f.indices[p],!0);o[`update${g}`](u,!0),o[`redraw${g}`](_,u,!0)}),o.hasType("bubble")||o.hasType("scatter")){const{cx:p}=f.pos,g=o.updateCircleY(!0);o.updateCircle(!0),o.redrawCircle(p,g,u,void 0,!0)}}),!c.rendered&&d&&(c.domain=d,o.brush.move(o.brush.getSelection(),d.map(o.scale.x)))}},showSubchartGridFocus(e){const t=this,{config:n,state:a,$el:{subchart:{main:i}}}=t;if(!i||!n.subchart_show||t.isSubchartBrushEnabled()||n.grid_focus_show===!1||n.subchart_grid_focus===!1||!n.tooltip_show||n.axis_tooltip)return;const o=(Array.isArray(e)?e:[e]).find(c=>c&&t.getBaseValue(c)!=null);if(!o){t.hideSubchartGridFocus();return}const r=t.scale.subX(o.x);if(!Number.isFinite(r)){t.hideSubchartGridFocus();return}const l=i.select(`g.${H.xgridFocus} line.${H.xgridFocus}`);if(Bm(t)){l.style("visibility","hidden");return}kc(t,l),n.axis_rotated?l.attr("x1",0).attr("x2",a.width2).attr("y1",r).attr("y2",r):l.attr("x1",r).attr("x2",r).attr("y1",0).attr("y2",a.height2),l.style("visibility",null)},hideSubchartGridFocus(){var e;zm(this),(e=this.$el.subchart.main)==null||e.select(`g.${H.xgridFocus} line.${H.xgridFocus}`).style("visibility","hidden")},redrawForBrush(e=!0){var t;const n=this,{config:{subchart_onbrush:a,zoom_rescale:i},scale:s,state:o}=n;n.redraw({withTransition:!1,withY:i,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e&&o.rendered&&a.bind(n.api)((t=o.domain)!=null?t:s.x.orgDomain())},transformContext(e,t){const n=this,{$el:{subchart:a},$T:i}=n,s=t!=null&&t.axisSubX?t.axisSubX:i(a.main.select(`.${H.axisX}`),e),o=t!=null&&t.axisSubY?t.axisSubY:i(a.main.select(`.${H.axisY}`),e),r=t!=null&&t.axisSubY2?t.axisSubY2:i(a.main.select(`.${H.axisY2}`),e);a.main.attr("transform",n.getTranslate("context")),s.attr("transform",n.getTranslate("subX")),o.attr("transform",n.getTranslate("subY")),r.attr("transform",n.getTranslate("subY2"))}},Gm={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 Cc=()=>(pt(Rt.prototype,Xm),pt(Jt.prototype,Fm),Oe.setOptions([Gm]),(Cc=()=>!0)());var pe=kt(9);const Sc=function(e){var t,n;const a=this.internal,{axis:i,config:s,org:o,scale:r,state:l}=a;let c;if(!i)return;const u=i.isCategorized();if(s.zoom_enabled)if(c=e,Array.isArray(c)){if(i.isTimeSeries()&&(c=c.map(h=>Zt.bind(a)(h))),a.withinRange(c,a.getZoomDomain("zoom",!0),a.getZoomDomain("zoom"))){if(l.domain=c.slice(),c=a.getZoomDomainValue(c),a.api.tooltip.hide(),s.subchart_show)if(l.isCanvasMode)(t=a.setCanvasSubchartDomain)==null||t.call(a,c,!0,!1);else{const h=r.zoom||r.x;a.brush.getSelection().call(a.brush.move,c.map(h))}else{const h=u?r.x.orgScale():o.xScale||r.x;a.updateCurrentZoomTransform(h,c)}a.setZoomResetButton()}}else c=a.zoom.getDomain();return(n=l.domain)!=null?n:c};pt(Sc,{enable(e){var t;const n=this.internal,{axis:a,config:i}=n;if(!a){i.zoom_enabled=!1;return}/^(drag|wheel)$/.test(e)&&(i.zoom_type=e),i.zoom_enabled=!!e,n.zoom?e===!1&&n.bindZoomEvent(!1):n.initZoom(),e!==!1&&(i.zoom_type==="drag"&&!n.zoomBehaviour&&((t=n.initZoomBehaviour)==null||t.call(n)),n.bindZoomEvent()),n.updateAndRedraw()},max(e){const t=this.internal,{config:n,org:{xDomain:a}}=t;return(e===0||e)&&(n.zoom_x_max=be("max",[a[1],e])),n.zoom_x_max},min(e){const t=this.internal,{config:n,org:{xDomain:a}}=t;return(e===0||e)&&(n.zoom_x_min=be("min",[a[0],e])),n.zoom_x_min},range(e){const t=this.zoom;if(Q(e)){const{min:n,max:a}=e;ht(n)&&t.min(n),ht(a)&&t.max(a)}return{min:t.min(),max:t.max()}}});var Wm={zoom:Sc,unzoom(){var e;const t=this.internal,{config:n,$el:{canvas:a,eventRect:i,zoomResetBtn:s},scale:{zoom:o},state:r}=t,l=r.isCanvasMode?a:i;(o||r.isCanvasMode&&n.subchart_show&&r.domain)&&(n.subchart_show?r.isCanvasMode?(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1):t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(pe.zoomIdentity),t.updateZoom(!0),s==null||s.style("display","none"),l!=null&&l.node()&&(0,pe.zoomTransform)(l.node())!==pe.zoomIdentity&&t.zoom.transform(l,pe.zoomIdentity),r.domain=void 0)}};function ni(e){return e.state.isCanvasMode?e.$el.canvas:e.$el.eventRect}function Ac(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return pe.zoomIdentity.translate(t.x+(t.k-1)*n.left,t.y+(t.k-1)*n.top).scale(t.k)}function Lc(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return pe.zoomIdentity.translate(t.x-(t.k-1)*n.left,t.y-(t.k-1)*n.top).scale(t.k)}function Pc(e,t,n){const a=se(t,n);if(e.state.isCanvasMode){const{margin:i}=e.state;a[0]-=i.left,a[1]-=i.top}return a}var Vm={initZoom(){const e=this;e.scale.zoom=null,e.generateZoom(),e.config.zoom_type==="drag"&&e.initZoomBehaviour()},bindZoomEvent(e=!0){const t=this,{config:n}=t;n.zoom_enabled&&e?!n.subchart_show&&t.bindZoomOnEventRect():e===!1&&(t.api.unzoom(),t.unbindZoomEvent())},generateZoom(){const e=this,{config:t,org:n,scale:a}=e,i=(0,pe.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));i.orgScaleExtent=()=>{const s=t.zoom_extent||[1,10];return[s[0],Math.max(e.getMaxDataCount()/s[1],s[1])]},i.updateScaleExtent=function(){const s=un(e.scale.x.orgDomain())/un(e.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*s,o[1]*s]),this},i.updateTransformScale=(s,o)=>{var r,l;const c=t.axis_rotated,u=Ac(e,s);(r=n.xScale)==null||r.range(a.x.range());const d=u[c?"rescaleY":"rescaleX"](n.xScale||a.x);if(d.domain().some(p=>/(Invalid Date|NaN)/.test(p.toString())))return;const h=e.trimXDomain(d.domain()),f=t.zoom_rescale;if(d.domain(h,n.xDomain),o){const p=d(a.x.domain()[0]),g=c?u.x:p,_=c?p:u.y,x=Lc(e,pe.zoomIdentity.translate(g,_).scale(s.k));(l=ni(e))==null||l.property("__zoom",x)}a.zoom=e.getCustomizedXScale(d),e.axis.x.scale(a.zoom),f?(!n.xScale&&(n.xScale=a.x.copy()),a.x.domain(h)):n.xScale&&(a.x.domain(n.xScale.domain()),n.xScale=null)},i.getDomain=()=>{const s=a[a.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(s[1]-=2),s},e.zoom=i},onZoomStart(e){const t=this,{sourceEvent:n}=e;n&&(t.zoom.startEvent=n,t.state.zooming=!0,q(t.config.zoom_onzoomstart,t.api,e))},onZoom(e){const t=this,{config:n,scale:a,state:i,org:s}=t,{sourceEvent:o}=e,r=(e==null?void 0:e.transform)===pe.zoomIdentity;if(!n.zoom_enabled||t.filterTargetsToShow(t.data.targets).length===0||!a.zoom&&(o==null?void 0:o.type.indexOf("touch"))>-1&&(o==null?void 0:o.touches.length)===1)return;e.sourceEvent&&(i.zooming=!0,i.domain=void 0);const l=(o==null?void 0:o.type)==="mousemove",c=(o==null?void 0:o.wheelDelta)<0,{transform:u}=e;!l&&c&&a.x.domain().every((p,g)=>p!==s.xDomain[g])&&a.x.domain(s.xDomain),t.zoom.updateTransformScale(u,n.zoom_type==="wheel"&&o);const d=n.transition_duration>0&&!n.subchart_show&&(i.dragging||r||!e.sourceEvent),h=o&&l&&n.zoom_type!=="wheel",f=()=>{var p;t.config&&(t.redraw({withTransition:d,withY:n.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.state.cancelClick=l,!r&&q(n.zoom_onzoom,t.api,(p=t.state.domain)!=null?p:t.zoom.getDomain()))};h?Ur(t.state,f):f()},onZoomEnd(e){var t,n;const a=this,{config:i,state:s}=a,o=a.zoom;if(!o)return;let{startEvent:r}=o,l=e==null?void 0:e.sourceEvent;const c=(e==null?void 0:e.transform)===pe.zoomIdentity;(r==null?void 0:r.type.indexOf("touch"))>-1&&(r=r.changedTouches[0],l=(t=l==null?void 0:l.changedTouches)==null?void 0:t[0]),!(i.zoom_type==="drag"&&l&&r.clientX===l.clientX&&r.clientY===l.clientY)&&(s.zooming=!1,!s.isCanvasMode&&a.redrawEventRect(),a.updateZoom(),!c&&(l||s.dragging)&&q(i.zoom_onzoomend,a.api,(n=a.state.domain)!=null?n:a.zoom.getDomain()))},updateZoom(e){const t=this,{subX:n,x:a,zoom:i}=t.scale;if(i){const s=i.domain(),o=n.domain(),r=.015,l=t.config.axis_x_inverted?(s[0]>=o[0]||s[0]+r>=o[0])&&(o[1]>=s[1]||o[1]>=s[1]+r):(s[0]<=o[0]||s[0]-r<=o[0])&&(o[1]<=s[1]||o[1]<=s[1]-r);(e||l)&&(t.axis.x.scale(n),a.domain(n.orgDomain()),t.scale.zoom=null)}},updateCurrentZoomTransform(e,t){var n;const a=this,{config:i}=a,s=i.axis_rotated,o=[-e(t[0]),0],r=pe.zoomIdentity.scale(e.range()[1]/(e(t[1])-e(t[0]))).translate(...s?o.reverse():o);(n=ni(a))==null||n.call(a.zoom.transform,Lc(a,r))},bindZoomOnEventRect(){var e,t;const n=this,{config:a,$el:{svg:i}}=n,s=ni(n),o=a.zoom_type==="drag"?n.zoomBehaviour:n.zoom;n.state.isCanvasMode&&((e=o==null?void 0:o.touchable)==null||e.call(o,()=>a.interaction_inputType_touch!==!1)),!n.state.isCanvasMode&&W.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((t=W.navigator)==null?void 0:t.userAgent)&&i.on("wheel",()=>{}),s==null||s.call(o).on("dblclick.zoom",null)},initZoomBehaviour(){const e=this,{config:t,state:n}=e,a=t.axis_rotated;let i=0,s=0,o,r;const l={axis:a?"y":"x",attr:a?"height":"width",index:a?1:0},c=u=>{const[d,h]=r!=null?r:[0,a?n.height:n.width];return Math.min(Math.max(u,d),h)};e.zoomBehaviour=(0,cl.drag)().touchable(()=>!n.isCanvasMode||t.interaction_inputType_touch!==!1).clickDistance(4).on("start",function(u){var d;r=e.scale.zoom?null:e.axis.getExtent(),n.event=u,e.setDragStatus(!0),e.unselectRect(),!n.isCanvasMode&&!o&&(o=e.$el.main.append("rect").attr("clip-path",n.clip.path).attr("class",qi.zoomBrush).attr("width",a?n.width:0).attr("height",a?0:n.height)),o==null||o.attr(a?"width":"height",a?n.width:n.height),i=c(Pc(e,u,this)[l.index]),s=i,n.isCanvasMode?(d=e.renderCanvasZoomBrush)==null||d.call(e,i,s):o.attr(l.axis,i).attr(l.attr,0),e.onZoomStart(u)}).on("drag",function(u){var d;s=c(Pc(e,u,this)[l.index]),n.isCanvasMode?(d=e.renderCanvasZoomBrush)==null||d.call(e,i,s):o.attr(l.axis,Math.min(i,s)).attr(l.attr,Math.abs(s-i))}).on("end",u=>{var d;const h=e.scale.zoom||e.scale.x;n.event=u,s=c(s),n.isCanvasMode?(d=e.clearCanvasZoomBrush)==null||d.call(e):o.attr(l.axis,0).attr(l.attr,0),i>s&&([i,s]=[s,i]),i<0&&(s+=Math.abs(i),i=0),i!==s&&e.api.zoom([i,s].map(f=>h.invert(f))),e.setDragStatus(!1)})},setZoomResetButton(){const e=this,{config:t,$el:n}=e,a=t.zoom_resetButton;a&&t.zoom_type==="drag"&&(n.zoomResetBtn?n.zoomResetBtn.style("display",null):n.zoomResetBtn=e.$el.chart.append("div").classed(U.button,!0).append("span").on("click",function(){G(a.onclick)&&a.onclick.bind(e.api)(this),e.api.unzoom()}).classed(qi.buttonZoomReset,!0).text(a.text||"Reset Zoom"))},getZoomTransform(){const e=this,t=ni(e),n=t==null?void 0:t.node();return n?Ac(e,(0,pe.zoomTransform)(n)):{k:1}}},Hm={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 Rc=()=>(pt(Rt.prototype,Vm),pt(Jt.prototype,Wm),Oe.setOptions([Hm]),(Rc=()=>!0)());function Ec(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function Mc(e,t=!1){const n=this.internal,{config:a}=n,i=a.transition_duration&&ha();return e?(a.regions=t?a.regions.concat(e):e,n.state.isCanvasMode?(Ec(n),a.regions):(n.updateRegion(),n.redrawRegion(i),a.regions)):a.regions}const Dc=function(e){return Mc.bind(this)(e)};pt(Dc,{add:function(e){return Mc.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:n,$T:a}=t,i=e||{},s=je(i,"classes",[ca.region]);let o=n.regions;if(t.state.isCanvasMode)return Object.keys(i).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(u=>{s.indexOf(u)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],Ec(t),n.regions;const r=t.$el.main.select(`.${ca.regions}`).selectAll(s.map(l=>`.${l}`));return a(r).style("opacity","0").remove(),Object.keys(i).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(u=>{s.indexOf(u)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],o}});var Ym={regions:Dc},jm={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",ca.regions)},updateRegion(){const e=this,{config:t,$el:{region:n},$T:a}=e;n.main||e.initRegion(),n.main.style("visibility",e.hasArcType()?"hidden":null);const i=n.main.selectAll(`.${ca.region}`).data(t.regions);a(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",e.classRegion.bind(e)),n.list.each(function(o){var r;(0,B.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,B.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:n},$T:a}=t,i=t.regionX.bind(t),s=t.regionY.bind(t),o=["width","height"];let r=n.list.select("rect"),l=n.list.selectAll("text");return r=a(r,e).attr("x",i).attr("y",s).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),l=a(l,e).text(c=>{var u;return(u=c.label)==null?void 0:u.text}).attr("transform",({label:c})=>c.rotated?" rotate(-90)":null).attr("transform",function(c){var u;const{x:d=0,y:h=0,center:f=!1,rotated:p=!1}=(u=c.label)!=null?u:{},g=this.previousElementSibling,_={x:0,y:0};return st(f)&&["x","y"].forEach((x,m)=>{f.indexOf(x)>-1&&(_[x]=(+g.getAttribute(o[m])-mt(this)[o[m]])/2)}),`translate(${i(c)+_.x+d}, ${s(c)+_.y+h})${p?" rotate(-90)":""}`}).attr("text-anchor",({label:c})=>c!=null&&c.rotated?"end":null).attr("dy","1em").style("fill",({label:c})=>{var u;return(u=c==null?void 0:c.color)!=null?u:null}),[r.style("fill-opacity",c=>nt(c.opacity)?c.opacity:null).on("end",function(){(0,B.select)(this.parentNode).selectAll("rect:not([x])").remove()}),l.style("opacity",null)]},regionX(e){return this.getRegionSize("x",e)},regionY(e){return this.getRegionSize("y",e)},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},getRegionSize(e,t){const n=this,{config:a,scale:i,state:s}=n,o=a.axis_rotated,r=/(x|y|y2)/.test(e),l=r?e==="x":e==="width",c=!r&&n[l?"regionX":"regionY"](t);let u=r?"start":"end",d=r?0:s[e],h;if(t.axis==="y"||t.axis==="y2"?(!r&&!l?u="start":r&&!l&&(u="end"),(l?o:!o)&&u in t&&(h=i[t.axis])):(l?!o:o)&&u in t&&(h=i.zoom||i.x),h){let f=0;d=t[u],n.axis.isTimeSeries(t.axis)?d=Zt.call(n,d):/(x|width)/.test(e)&&n.axis.isCategorized()&&isNaN(d)&&(d=a.axis_x_categories.indexOf(d),f=n.axis.x.tickOffset()*(u==="start"?-1:1)),d=h(d)+f}return r?d:d<c?0:d-c},isRegionOnX(e){return!e.axis||e.axis==="x"}};let Oc=()=>(pt(Rt.prototype,jm),Jt.prototype.regions=Ym.regions,(Oc=()=>({}))());var Xn={initArea(e){const t=this,{config:n}=t;e.insert("g",`.${n.area_front?Vt.circles:De.lines}`).attr("class",t.getClass("areas",!0))},updateAreaColor(e){const t=this;return kl.call(t,e,"area_linearGradient",t.color)},updateArea(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:a,state:i,$el:s,$T:o}=n,r=t?s.subchart:s;a.area_linearGradient&&n.updateLinearGradient();const l=r.main.selectAll(`.${Ga.areas}`).selectAll(`.${Ga.area}`).data(n.lineData.bind(n));o(l.exit(),e).style("opacity","0").remove(),r.area=l.enter().append("path").attr("class",n.getClass("area",!0)).style("fill",n.updateAreaColor.bind(n)).style("opacity",function(){return i.orgAreaOpacity=(0,B.select)(this).style("opacity"),"0"}).merge(l),l.style("opacity",i.orgAreaOpacity),n.setRatioForGroupedData(r.area.data())},redrawArea(e,t,n=!1){const a=this;if(a.state.isCanvasMode)return[];const{area:i}=n?this.$el.subchart:this.$el,{orgAreaOpacity:s}=a.state;return[a.$T(i,t,ye()).attr("d",e).style("fill",a.updateAreaColor.bind(a)).style("opacity",o=>String(a.isAreaRangeType(o)?s/1.75:s))]},generateDrawArea(e,t){return Co(this,e,t)}},Gn={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},Ss={spline_interpolation_type:"cardinal"};function Um(e){return ne(e)&&G(e.create)&&G(e.update)}function Km(e,t){var n;const a=this,i=(l,c)=>{const u=l.attributes;for(let d=0,h;h=u[d];d++)h=h.name,c.setAttribute(h,l.getAttribute(h))},o=new DOMParser().parseFromString(ve(e),"image/svg+xml").documentElement,r=rt.createElementNS(B.namespaces.svg,o.nodeName.toLowerCase());if(r.id=t,r.style.fill="inherit",r.style.stroke="inherit",i(o,r),(n=o.childNodes)!=null&&n.length){const l=(0,B.select)(r);"innerHTML"in r?l.html(ve(o.innerHTML)):dn(o.childNodes).forEach(c=>{i(c,l.append(c.tagName).node())})}a.$el.defs.node().appendChild(r)}var bn={hasValidPointType(e){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(e||this.config.point_type)},hasLegendDefsPoint(){var e;const{config:t}=this;return t.legend_show&&((e=t.point_pattern)==null?void 0:e.length)&&t.legend_usePoint},getDefsPointId(e){const{state:{datetimeId:t}}=this;return`${t}-point${e}`},getValidPointPattern(){const{config:e}=this,t=/^(circle|rect(angle)?)$/i.test(e.point_type)?e.point_type:"circle";return St(e.point_pattern)?e.point_pattern:[t]},generatePoint(){const e=this,{$el:t,config:n}=e,a=[],i=e.getValidPointPattern();return function(s,o,...r){return function(l){var c,u,d,h;const f=e.getTargetSelectorSuffix(l.id||((c=l.data)==null?void 0:c.id)||l),p=(0,B.select)(this);a.indexOf(f)<0&&a.push(f);let g=i[a.indexOf(f)%i.length];if(e.hasValidPointType(g))g=e[g];else if(!Um(g||n.point_type)){const _=e.getDefsPointId(f);if(t.defs.select(`#${_}`).size()<1&&Km.call(e,g,_),s==="create")return(u=e.custom)==null?void 0:u.create.bind(o)(p,_,...r);if(s==="update")return(d=e.custom)==null?void 0:d.update.bind(o)(p,...r)}return(h=g[s])==null?void 0:h.bind(o)(p,...r)}}}};function Zm(e,t,n,a=!1){const i=e?[e,0]:n;for(let s=e||n.reduce((o,r)=>o+r);s<=t;)n.forEach(o=>{s+o<=t&&i.push(o),s+=o});return i.length%2!==0&&i.push(a?n[1]:0),{dash:i.join(" "),length:i.reduce((s,o)=>s+o,0)}}var qm={initLine(){Cl.call(this,{elKey:"line",className:De.chartLines,cssRules:["pointer-events:none"]})},updateTargetsForLine(e){const t=this,{$el:{area:n,main:a}}=t,i=t.getClass("lines",!0),s=e.filter(r=>!(t.isScatterType(r)||t.isBubbleType(r))),o=fs.call(t,s,{type:"Line",elKey:"line",containerClass:De.chartLines,itemClass:De.chartLine,initFn:t.initLine});if(o.append("g").attr("class",i),t.hasTypeOf("Area")){const r=a.select(`.${De.chartLines}`).selectAll(`.${De.chartLine}`),l=(!n&&o.empty()?r:o).filter(t.isAreaType.bind(t));t.initArea(l)}t.updateTargetForCircle(s,o)},updateLine(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{format:{extraLineClasses:a},$el:i,$T:s}=n,o=t?i.subchart:i,r=o.main.selectAll(`.${De.lines}`).selectAll(`.${De.line}`).data(n.lineData.bind(n));s(r.exit(),e).style("opacity","0").remove(),o.line=r.enter().append("path").attr("class",l=>`${n.getClass("line",!0)(l)} ${a(l)||""}`).style("stroke",n.color).merge(r).style("opacity",n.initialOpacity.bind(n)).attr("transform",null)},redrawLine(e,t,n=!1){const a=this;if(a.state.isCanvasMode)return[];const{$el:i,$T:s}=a,{line:o}=n?i.subchart:i;return[s(o,t,ye()).attr("d",e).style("stroke",this.color).style("opacity",null)]},generateDrawLine(e,t){return ko(this,e,t)},lineWithRegions(e,t,n,a){const i=this,{config:s}=i,o=s.axis_rotated,r=i.axis.isTimeSeries(),l="2 2",c=_o(i,e,a),u=i.hasNullDataValue(e);let d,h,f,p;const g=o?A=>n(A.value):A=>t(A.x),_=o?A=>t(A.x):A=>n(A.value),x=A=>`M${A[0][0]},${A[0][1]}L${A[1][0]},${A[1][1]}`,m=r?(A,S,L,P)=>{const D=A.x.getTime(),R=S.x-A.x,E=new Date(D+R*L),M=new Date(D+R*(L+P)),O=o?[[n(h(L)),t(E)],[n(h(L+f)),t(M)]]:[[t(E),n(h(L))],[t(M),n(h(L+f))]];return x(O)}:(A,S,L,P)=>{const D=t(S.x,!o),R=n(S.value,o),E=L+P,M=t(d(L),!o),O=n(h(L),o);let $=t(d(E),!o),I=n(h(E),o);$>D&&($=D),A.value>S.value&&(o?I<R:I>R)&&(I=R);const F=[[M,O],[$,I]];return o&&F.forEach(V=>V.reverse()),x(F)},v={x:i.axis.getAxisType("x"),y:i.axis.getAxisType("y")};let b="";if(!e.length)return b;const T=i.$el.line.filter(({id:A})=>A===e[0].id),k=T.clone().style("display","none"),w=(A,S)=>A.attr("d",S).node().getTotalLength(),y={dash:[],lastLength:0};let C=!1;for(let A=0,S;S=e[A];A++){const L=e[A-1],P=L&&nt(L.value);let D=i.isWithinRegions(S.x,c);if(nt(S.value)){if(Ct(c)||!D||!P)b+=`${A&&P?"L":"M"}${g(S)},${_(S)}`;else if(P)if(D=((D==null?void 0:D.dasharray)||l).split(" ").map(Number),d=Je(v.x,L.x,S.x),h=Je(v.y,L.value,S.value),u){const R=t(S.x)-t(L.x),E=n(S.value)-n(L.value),M=Math.sqrt(R*R+E*E);f=D[0]/M,p=f*D[1];for(let O=f;O<=1;O+=p)b+=m(L,S,O,f),O+p>=1&&(b+=m(L,S,1,0))}else{let R;if(C=S.x===e[e.length-1].x,r){const $=+L.x,I=new Date($),F=new Date($+(+S.x-$));R=[[t(I),n(h(0))],[t(F),n(h(1))]]}else R=[[t(d(0)),n(h(0))],[t(d(1)),n(h(1))]];o&&R.forEach($=>$.reverse());const E=w(k,b),M=w(k,b+=`L${R[1].join(",")}`),O=Zm(E-y.lastLength,M-y.lastLength,D,C);y.lastLength+=O.length,y.dash.push(O.dash)}}}return y.dash.length&&(!C&&y.dash.push(w(k,b)),T.attr("stroke-dasharray",y.dash.join(" "))),k.remove(),b},isWithinRegions(e,t){return xo(e,t)},isWithinStep(e,t){return Math.abs(t-se(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||et(t)&&t.indexOf(e.id)!==-1}};const Wn=()=>ye(),$c=new WeakMap;function Fc(e){const t=e.getAttribute("height"),n=e.getAttribute("width"),a=e.getAttribute("href")||e.getAttribute("xlink:href"),i=$c.get(e);if(i&&i.attrHeight===t&&i.attrWidth===n&&i.href===a)return i;const{width:s,height:o}=en(e),r={attrHeight:t,attrWidth:n,height:o,href:a,width:s};return $c.set(e,r),r}var ai={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:n}}=this;let a=t.point_opacity;return Ct(a)&&(a=this.getBaseValue(e)!==null&&n[e.id]?this.opacityForCircle(e):"0"),a},opacityForCircle(e){var t;const{config:n}=this;let a=n.point_opacity;return Ct(a)&&(a=n.point_show&&!((t=this.isPointFocusOnly)!=null&&t.call(this))?null:"0",a=nt(this.getBaseValue(e))?this.isBubbleType(e)||this.isScatterType(e)?"0.5":a:"0"),a},initCircle(){const e=this,{$el:{main:t}}=e;!e.point&&(e.point=e.generatePoint()),(e.hasType("bubble")||e.hasType("scatter"))&&t.select(`.${U.chart} > .${Vt.chartCircles}`).empty()&&t.select(`.${U.chart}`).append("g").attr("class",Vt.chartCircles)},updateTargetForCircle(e,t){const n=this,{config:a,data:i,$el:s}=n,o=a.interaction_enabled&&a.data_selection_enabled,r=o&&a.data_selection_isselectable,l=n.getClass("circles",!0);if(!a.point_show)return;n.initCircle();let c=e,u=t;if(!c){c=n.filterNullish(i.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const d=s.main.select(`.${Vt.chartCircles}`).style("pointer-events","none").selectAll(`.${Vt.circles}`).data(c);d.exit().remove(),u=d.enter()}o&&u.append("g").attr("class",d=>n.generateClass(gt.selectedCircles,d.id)),u.append("g").attr("class",l).call(d=>{n.setCssRule(!0,`.${Vt.circles}`,["cursor:pointer"],r)(d),n.setCssRule(!0,` .${Vt.circle}`,["fill","stroke"],n.color)(d)}).style("opacity",function(){return(0,B.select)(this.parentNode).classed(Vt.chartCircles)?"0":null}),o&&c.forEach(d=>{s.main.selectAll(`.${gt.selectedCircles}${n.getTargetSelectorSuffix(d.id)}`).selectAll(`${gt.selectedCircle}`).each(h=>{h.value=d.values[h.index].value})})},updateCircle(e=!1,t=!1){const n=this,{config:a,state:i,$el:s}=n,o=n.isPointFocusOnly(),r=e?s.subchart:s;if(a.point_show&&!i.toggling){a.point_radialGradient&&n.updateLinearGradient();const l=r.main.selectAll(`.${Vt.circles}`).selectAll(`.${Vt.circle}`).data(f=>{const p=n.isLineType(f)&&n.shouldDrawPointsForLine(f)||n.isBubbleType(f)||n.isRadarType(f)||n.isScatterType(f)?o?[f.values[0]]:f.values:[];return n.filterNullish(p)});l.exit().remove();const c=n.pointR.bind(n),u=n.generateUpdateCircleColor(),d=n.initialOpacityForCircle.bind(n),h=l.enter().filter(Boolean).append(n.point("create",this,c,u));r.circle=r.main.selectAll(`.${Vt.circles} .${Vt.circle}`).style("stroke",n.getStylePropValue(n.color)),(o&&t?h:r.circle).style("opacity",d)}},generateUpdateCircleColor(){const e=this,t=e.getStylePropValue(e.color);return n=>e.config.point_radialGradient?e.getGradienColortUrl(n.id):t?t(n):null},updateCircleColor(e){return this.generateUpdateCircleColor()(e)},redrawCircle(e,t,n,a,i=!1){const s=this,{state:{rendered:o},$el:r,$T:l}=s,c=i?r.subchart:r,u=c.main.selectAll(`.${gt.selectedCircle}`);if(!s.config.point_show)return[];const d=s.isCirclePoint()?"c":"",h=ye(),f=s.opacityForCircle.bind(s),p=s.generateUpdateCircleColor();if(s.isCirclePoint()){const x=c.circle;return s.hasType("bubble")&&x.attr("r",s.pointR.bind(s)),n?(a&&x.attr("cx",e),l(x.filter(function(){return!!this.getAttribute("cx")}),!0,`${h}-pos`).attr("cx",e).attr("cy",t).style("fill",p),x.filter(function(){return!this.getAttribute("cx")}).attr("cx",e).attr("cy",t).style("fill",p)):x.attr("cx",e).attr("cy",t).style("fill",p),[[l(x,n||!o,h).style("opacity",f)],l(u,n).attr("cx",e).attr("cy",t)]}const g=s.point("update",s,e,t,p,n,a,u),_=[];return c.circle.each(function(x){let m=g.bind(this)(x);m=l(m,n||!o,h).style("opacity",f),_.push(m)}),[_,l(u,n).attr(`${d}x`,e).attr(`${d}y`,t)]},showCircleFocus(e){const t=this,{state:{hasRadar:n,resizing:a,toggling:i,transiting:s},$el:o}=t;let{circle:r}=o;if(s===!1&&r&&t.isPointFocusOnly()){const l=(n?t.radarCircleX:t.circleX).bind(t),c=(n?t.radarCircleY:t.circleY).bind(t),u=i||Ct(e),d=t.point("update",t,l,c,t.getStylePropValue(t.color),a?!1:u);e&&(r=r.filter(function(h){var f;const p=(f=e.filter)==null?void 0:f.call(e,g=>g.id===h.id);return p.length?(0,B.select)(this).datum(p[0]):!1})),r.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:f,index:p,value:g}=h;let _="hidden";nt(g)&&(d.bind(this)(h),t.expandCircles(p,f),_=""),this.style.visibility=_})}},hideCircleFocus(){const e=this,{$el:{circle:t}}=e;e.isPointFocusOnly()&&t&&(e.unexpandCircles(),t.style("visibility","hidden"))},expandCircles(e,t,n){const a=this,i=a.pointExpandedR.bind(a);n&&a.unexpandCircles();const s=a.getShapeByIndex("circle",e,t).classed(U.EXPANDED,!0),o=i(s)/a.config.point_r,r=1-o;a.isCirclePoint()?s.attr("r",i):s.each(function(){const l=(0,B.select)(this);if(this.tagName==="circle")l.attr("r",i);else{const{width:c,height:u}=Fc(this),d=r*(+l.attr("x")+c/2),h=r*(+l.attr("y")+u/2);l.attr("transform",`translate(${d} ${h}) scale(${o})`)}})},unexpandCircles(e){const t=this,n=t.pointR.bind(t),a=t.getShapeByIndex("circle",e).filter(function(){return(0,B.select)(this).classed(U.EXPANDED)}).classed(U.EXPANDED,!1);if(a.attr("r",n),!t.isCirclePoint()){const i=n(a)/t.config.point_r;a.attr("transform",i!==1?`scale(${i})`:null)}},isWithinCircle(e,t){const{state:n}=this,a=se(n.event,e),i=(0,B.select)(e),s=this.isCirclePoint(e)?"c":"",o=this.getPointSensitivity(i==null?void 0:i.datum());let r=+i.attr(`${s}x`),l=+i.attr(`${s}y`);if(!(r||l)&&e.nodeType===1){const{x:d,y:h}=mt(e);r=d,l=h}const c=r-a[0],u=l-a[1];return Math.sqrt(c*c+u*u)<(t||o)},updatePointClass(e){const t=this,{circle:n}=t.$el;let a=!1;return(Q(e)||n)&&(a=e===!0?n.each(function(i){let s=t.getClass("circle",!0)(i);this.getAttribute("class").indexOf(U.EXPANDED)>-1&&(s+=` ${U.EXPANDED}`),this.setAttribute("class",s)}):t.getClass("circle",!0)(e)),a},custom:{create(e,t,n){return e.append("use").attr("xlink:href",`#${t}`).attr("class",this.updatePointClass.bind(this)).style("fill",n).node()},update(e,t,n,a,i,s,o){const r=this,{width:l,height:c}=Fc(e.node()),u=f=>nt(f.value)?t(f)-l/2:0,d=f=>nt(f.value)?n(f)-c/2:0;let h=e;return i&&(s&&h.attr("x",u),h=r.$T(h,i,Wn()),o&&r.$T(o,i,Wn())),h.attr("x",u).attr("y",d).style("fill",a)}},circle:{create(e,t,n){return e.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",t).style("fill",n).node()},update(e,t,n,a,i,s,o){const r=this;let l=e;return r.hasType("bubble")&&l.attr("r",r.pointR.bind(r)),i&&(s&&l.attr("cx",t),l.attr("cx")&&(l=r.$T(l,i,Wn())),o&&r.$T(o,i,Wn())),l.attr("cx",t).attr("cy",n).style("fill",a)}},rectangle:{create(e,t,n){const a=i=>t(i)*2;return e.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",a).attr("height",a).style("fill",n).node()},update(e,t,n,a,i,s,o){const r=this,l=r.config.point_r,c=h=>t(h)-l,u=h=>n(h)-l;let d=e;return i&&(s&&d.attr("x",c),d=r.$T(d,i,Wn()),o&&r.$T(o,i,Wn())),d.attr("x",c).attr("y",u).style("fill",a)}}},an={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"},Jm={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0};function Ic(e,t,n){const{config:a}=e,i=(s,o)=>{const r=N(o)?o:o===!1?void 0:null;r!==null&&(a[`axis_${s}_${t}`]=r)};ht(n)&&(ne(n)?Object.keys(n).forEach(s=>{i(s,n[s])}):(N(n)||n===!1)&&["y","y2"].forEach(s=>{i(s,n)}),e.state.dirty.data=!0,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function Bc(e,t){const{config:n}=e;return{x:n[`axis_x_${t}`],y:n[`axis_y_${t}`],y2:n[`axis_y2_${t}`]}}var Qm={axis:{labels:function(e){var t;const n=this.internal;let a;return e&&(Object.keys(e).forEach(i=>{n.axis.setLabelText(i,e[i])}),n.state.isCanvasMode?(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1):n.axis.updateLabels()),["x","y","y2"].forEach(i=>{const s=n.axis.getLabelText(i);s&&(!a&&(a={}),a[i]=s)}),a},min:function(e){const t=this.internal;return nt(e)||e===!1?Ic(t,"min",e):Bc(t,"min")},max:function(e){const t=this.internal;return nt(e)||e===!1?Ic(t,"max",e):Bc(t,"max")},range:function(e){const{axis:t}=this;if(arguments.length){const{min:n,max:a}=e;ht(a)&&t.max(a),ht(n)&&t.min(n)}else return{max:t.max(),min:t.min()}}}},tv={groups(e){const t=this.internal,{config:n}=t;return Ct(e)||(n.data_groups=e,t.state.dirty.data=!0,t.redraw()),n.data_groups}},ev={x(e){const t=this.internal,{axis:n,data:a}=t,i=n.isCustomX()&&n.isCategorized();return et(e)&&(i?this.categories(e):(t.updateTargetX(a.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),i?this.categories():a.xs},xs(e){const t=this.internal;return Q(e)&&(t.updateTargetXs(t.data.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},nv=Object.defineProperty,av=(e,t,n)=>t in e?nv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ii=(e,t,n)=>av(e,typeof t!="symbol"?t+"":t,n);const zc=new WeakMap;class iv{constructor(t){ii(this,"owner"),ii(this,"config"),ii(this,"scale"),ii(this,"charSize",{});const n=Je(),{config:a,params:i}=t;this.owner=t,this.config=a,this.scale=n,(a.noTransition||!i.config.transition_duration)&&(a.withoutTransition=!0),a.range=this.scaleExtent((i.orgXScale||n).range())}getSizeFor1Char(t,n,a=!0){var i;const s={w:5.5,h:11.5};if(this.charSize[t]&&a)return this.charSize[t];const o=n.node();if(o){const r=this.owner.params.owner,l=window.getComputedStyle(o),c=[t,l.fontStyle,l.fontWeight,l.fontSize,l.fontFamily,l.letterSpacing].join(" "),u=(i=zc.get(r))!=null?i:{},d=u[c];zc.set(r,u);try{if(d)s.w=d.w,s.h=d.h;else{o.textContent="0";const{width:h,height:f}=en(o,!0);h&&f&&(s.w=h,s.h=f,u[c]={w:h,h:f})}}finally{n.text("")}}return this.charSize[t]=s,s}getTickTransformSetter(t){const{config:n}=this,a=t==="x"?i=>`translate(${i+n.tickOffset},0)`:i=>`translate(0,${i})`;return(i,s)=>{i.attr("transform",o=>{const r=s(o);return nt(o)?a(r):null})}}scaleExtent(t){const n=t[0],a=t[t.length-1];return n<a?[n,a]:[a,n]}generateTicks(t,n){const{tickStepSize:a}=this.owner.params,[i,s]=t.domain();let o=[];if(n&&a){let r=Math.round(i);for(;r<=s;)o.push(r),r+=a}else if(t.ticks){const{tickArguments:r}=this.config;if(t.type==="log"&&!r){const l=Je("_log").domain([i>0?i:1,s]).range(t.range());o=l.ticks();for(let c=s.toFixed().length;o.length>15;c--)o=l.ticks(c);o.splice(0,1,i),o.splice(o.length-1,1,s)}else o=t.ticks(...this.config.tickArguments||[])}return o}copyScale(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t}textFormatted(t){const n=this.config.tickFormat,a=/\d+\.\d+0{5,}\d$/.test(t)?+String(t).replace(/0+\d$/,""):t,i=n?n(a):a;return ht(i)?i:""}transitionise(t){const{config:n}=this;let a=t;if(n.withoutTransition&&!n.transition)a=t.interrupt();else if(n.transition||!this.owner.params.noTransition)try{a=t.transition(n.transition)}catch(i){}return a}}var sv=Object.defineProperty,ov=(e,t,n)=>t in e?sv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xa=(e,t,n)=>ov(e,typeof t!="symbol"?t+"":t,n);function si(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function rv(e){const t=si(e);return/^sub/.test(e)?`subchart_axis_${t}`:`axis_${t}`}class Nc{constructor(t={}){xa(this,"helper"),xa(this,"config"),xa(this,"params"),xa(this,"g"),xa(this,"generatedTicks",[]);const n={innerTickSize:xt,outerTickSize:t.outerTick?xt:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:Ao,tickOffset:0,tickPadding:fn,tickValues:null,transition:null,noTransition:t.noTransition};n.tickLength=Math.max(n.innerTickSize,0)+n.tickPadding,this.config=n,this.params=t,this.helper=new iv(this)}canReuseTickTextOnResize(t){const{config:n,params:a}=this,{config:i,id:s,owner:o}=a,r=/^(x|subX)$/.test(s),l=si(s),c=/^sub/.test(s)?i[`subchart_axis_${l}_tick_format`]||i[`axis_${l}_tick_format`]:i[`axis_${l}_tick_format`],u=a.tickMultiline&&a.isCategory&&!t&&!(a.tickWidth>0);return!!(o.state.resizing&&!o.state.flowing&&!G(i.axis_evalTextSize)&&!c&&!a.tickTitle&&!(r&&i.axis_x_tick_autorotate)&&!u&&n.withoutTransition)}canReuseTickNodesOnResize(t,n,a,i){if(i.tick||!i.text||!this.canReuseTickTextOnResize(a)||t.size()!==n.length)return!1;const s=t.nodes();for(let o=0;o<n.length;o++){const r=s[o].__data__,l=n[o];if(r instanceof Date||l instanceof Date){if(+r!=+l)return!1}else if(r!==l)return!1}return!0}create(t){const n=this,{config:a,helper:i,params:s}=n,{scale:o}=i,{orient:r}=a,l=this.splitTickText.bind(n),c=/^(left|right)$/.test(r),u=/^(top|bottom)$/.test(r),d=i.getTickTransformSetter(u?"x":"y"),h=d===i.axisX?"y":"x",f=/^(top|left)$/.test(r)?-1:1,p=s.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():i.scaleExtent((s.orgXScale||o).range());const{innerTickSize:g,tickLength:_,range:x}=a,m=s.id,v=si(m),{isSubAxes:b}=s,T=!b&&v&&/^(x|y|y2)$/.test(v)?s.config[`axis_${v}_tick_text_position`]:{x:0,y:0},k=rv(m),w=s.config[`${k}_show`],y=b?{tick:!0,text:!0}:{tick:w?s.config[`${k}_tick_show`]:!1,text:w?s.config[`${k}_tick_text_show`]:!1},C=s.config.axis_evalTextSize;let A;t.each(function(){const S=(0,B.select)(this);let L=this.__chart__||o,P=i.copyScale();A=S,this.__chart__=P,a.tickOffset=s.isCategory?(P(1)-P(0))/2:0;const D=S.selectAll(".domain").data([0]);if(D.enter().append("path").attr("class","domain").merge(D).attr("d",()=>{const R=a.outerTickSize*f;return u?`M${x[0]},${R}V0H${x[1]}V${R}`:`M${R},${x[0]}H0V${x[1]}H${R}`}),y.tick||y.text){const R=S.select(".domain").node(),E=a.tickValues||i.generateTicks(P,c||s.config.axis_rotated);n.generatedTicks=E;let M=S.selectAll(".tick");if(n.canReuseTickNodesOnResize(M,E,c||s.config.axis_rotated,y))d(M,P);else{M=M.data(E,P);const $=M.enter().insert("g",()=>R).attr("class","tick"),I=M.exit().remove();M=$.merge(M),y.tick&&$.append("line"),y.text&&$.append("text");const F=!$.empty()||!I.empty(),V=y.text&&!F&&n.canReuseTickTextOnResize(c||s.config.axis_rotated);let Y={w:0,h:0},j=M.selectAll("text.__bb-empty");if(y.text&&!V){const it=M.select("text"),ft=[];j=it,G(C)&&(Y=C.bind(n.params.owner.api)(it.node(),m),this.classList.contains(U.dummy)&&(this.sizeFor1Char=Y)),(!Y||Y.w===0||Y.h===0)&&(Y=n.helper.getSizeFor1Char(r,it,!!C));let wt=it.selectAll("tspan").data((_t,jt)=>{let It;if(s.tickMultiline)It=l(_t,P,E,c,Y.w);else{const Et=i.textFormatted(_t);It=et(Et)?Et.concat():[Et]}return ft[jt]=It.length,It.map(Et=>({index:jt,splitted:Et}))});wt.exit().remove(),wt=wt.enter().append("tspan").merge(wt).each(function(_t){this.textContent!==_t.splitted&&(this.textContent=_t.splitted)}),wt.attr("x",u?0:_*f).attr("dx",(()=>{let _t=0;return/(top|bottom)/.test(r)&&p&&(_t=8*Math.sin(Math.PI*(p/180))*(r==="top"?-1:1)),_t+(T.x||0)})()).attr("dy",(_t,jt)=>{const It=".71em";let Et=0;return r!=="top"&&(Et=Y.h,jt===0&&(Et=c?-((ft[_t.index]-1)*(Y.h/2)-3):T.y===0?It:0)),N(Et)&&T.y?Et+T.y:Et||It})}const dt=M.select("line");if($.select("line").attr(`${h}2`,g*f),$.select("text").attr(h,_*f),n.setTickLineTextPosition(dt,j,Y),s.tickTitle){const it=j.select("title"),ft=s.tickTitle;(it.empty()?j.append("title"):it).text(wt=>ft[Number(wt)])}if(P.bandwidth){const it=P,ft=it.bandwidth()/2;L=wt=>it(wt)+ft,P=L}else L.bandwidth?L=P:d(I,P);M=s.owner.state.flowing?i.transitionise(M):s.owner.$T(M),d($,L),d(M.style("opacity",null),P)}}}),this.g=A}getGeneratedTicks(t){var n;const a=((n=this.generatedTicks)==null?void 0:n.length)-1;let i=this.generatedTicks;if(a>t){const s=Math.round(a/t+.1);i=this.generatedTicks.map((o,r)=>r%s===0?o:null).filter(o=>o!==null).splice(0,t)}return i}getTickXY(){const{config:t}=this,n={x:0,y:0};return this.params.isCategory&&(n.x=t.tickCentered?0:t.tickOffset,n.y=t.tickCentered?t.tickOffset:0),n}getTickSize(t){const{scale:n}=this.helper,{config:a}=this,{innerTickSize:i,range:s}=a,o=n(t)+(a.tickCentered?0:a.tickOffset);return s[0]<o&&o<s[1]?i:0}setTickLineTextPosition(t,n,a){const i=this.getTickXY(),{innerTickSize:s,orient:o,tickLength:r,tickOffset:l}=this.config,c=this.params.id,u=this.params.tickTextRotate,d=6,h=a.h/2-d,f=v=>{const b=["start","end"];return o==="top"&&b.reverse(),v?b[v>0?0:1]:"middle"},p=v=>v?`rotate(${v})`:null,g=v=>{const b=v/(o==="bottom"?15:23);return v?11.5-2.5*b*(v>0?1:-1):r},{config:{axis_rotated:_,axis_x_tick_text_inner:x}}=this.params.owner,m=this.params.config[`axis_${si(c)}_tick_inner`];switch(o){case"bottom":t.attr("x1",i.x).attr("x2",i.x).attr("y2",v=>this.getTickSize.bind(this)(v)*(m?-1:1)),n.attr("x",0).attr("y",g(u)).style("text-anchor",(v,b,{length:T})=>!_&&b===0&&(x===!0||x.first)?"start":!_&&b===T-1&&(x===!0||x.last)?"end":f(u)).attr("transform",p(u));break;case"top":t.attr("x2",0).attr("y2",m?s:-s),n.attr("x",0).attr("y",-(g(u)+h+d)).style("text-anchor",f(u)).attr("transform",p(u));break;case"left":t.attr("x2",m?s:-s).attr("y1",i.y).attr("y2",i.y),n.attr("x",-r).attr("y",l+(_?h/4:h)).style("text-anchor","end");break;case"right":t.attr("x2",m?-s:s).attr("y2",0),n.attr("x",r).attr("y",h).style("text-anchor","start")}}splitTickText(t,n,a,i,s){const{params:o}=this,r=this.helper.textFormatted(t),l=st(r)&&r.indexOf(`
38
38
  `)>-1?r.split(`
39
- `):[];if(l.length)return l;if(ot(r))return r;let c=o.tickWidth;(!c||c<=0)&&(c=a?95:o.isCategory?(o.isInverted?n(i[0])-n(i[1]):n(i[1])-n(i[0]))-12:110);function d(u,h){let f,g,p;for(let _=1;_<h.length;_++)if(h.charAt(_)===" "&&(g=_),f=h.substr(0,_+1),p=s*f.length,c<p)return d(u.concat(h.substr(0,g||_)),h.slice(g?g+1:_));return u.concat(h)}return d(l,String(r))}scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?String(t):"bottom",this):this.config.orient}tickFormat(t){const{config:n}=this;return arguments.length?(n.tickFormat=t,this):n.tickFormat}tickCentered(t){const{config:n}=this;return arguments.length?(n.tickCentered=t,this):n.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(t){var n,i,a;const{outerTickSize:s,tickOffset:o,tickValues:r}=this.config;let l;if(this.params.isCategory){const c=(n=this.params.owner.scale.zoom)!=null?n:this.helper.scale;l=o*2||Math.abs(c(1)-c(0))}else{const c=(i=this.params.owner.scale.zoom)!=null?i:this.helper.scale;if(l=(this.g?this.g.select("path.domain").node().getTotalLength()-s*2:Math.abs(c.range()[1]-c.range()[0]))/(t||((a=this.g)==null?void 0:a.selectAll("line").size())||1),r)for(let u=0;u<r.length-1;u++){const h=c(r[u+1])-c(r[u]);h&&h<l&&(l=h)}}return l===1/0?0:l}ticks(...t){const{config:n}=this;return t.length?(n.tickArguments=nn(t),this):n.tickArguments}tickCulling(t){const{config:n}=this;return arguments.length?(n.tickCulling=t,this):n.tickCulling}tickValues(t){const{config:n}=this;if(z(t))n.tickValues=()=>t(this.helper.scale.domain());else{if(!arguments.length)return n.tickValues;n.tickValues=t}return this}setTransition(t){return this.config.transition=t,this}}var $_=Object.defineProperty,B_=Object.defineProperties,z_=Object.getOwnPropertyDescriptors,Kl=Object.getOwnPropertySymbols,N_=Object.prototype.hasOwnProperty,X_=Object.prototype.propertyIsEnumerable,ns=(e,t,n)=>t in e?$_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G_=(e,t)=>{for(var n in t||(t={}))N_.call(t,n)&&ns(e,n,t[n]);if(Kl)for(var n of Kl(t))X_.call(t,n)&&ns(e,n,t[n]);return e},V_=(e,t)=>B_(e,z_(t)),_e=(e,t,n)=>ns(e,typeof t!="symbol"?t+"":t,n);function is(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function Xi(e){return/^sub/.test(e)}function Ze(e,t,n){const i=is(t),a=e[`subchart_axis_${i}_tick_${n}`];return Xi(t)&&a!==void 0?a:e[`axis_${i}_tick_${n}`]}function W_(e){var t,n;const i=[e[0],e[e.length-1]];let a=0,s=null;for(const r of e){const l=(n=(t=r.textContent)==null?void 0:t.length)!=null?n:0;l>a&&(a=l,s=r)}s&&!i.includes(s)&&i.push(s);const o=e[Math.floor(e.length/2)];return i.includes(o)||i.push(o),i}const Gi=50,as=Symbol("tickWidthFallback");function Y_(e){var t,n,i;const a=e.select("line").node(),s=(n=(t=a==null?void 0:a.ownerDocument)==null?void 0:t.defaultView)!=null&&n.getComputedStyle?parseFloat(a.ownerDocument.defaultView.getComputedStyle(a).strokeWidth):parseFloat((i=a==null?void 0:a.getAttribute)==null?void 0:i.call(a,"stroke-width"));return Number.isFinite(s)&&s>0?s:1}function H_(e,t,n){var i;const a=(i=e==null?void 0:e.scale)==null?void 0:i.call(e);if(!a||t.length<2)return!1;const s=Math.max(1,n)/2,o=t.map(l=>+a(l)).filter(Number.isFinite).sort((l,c)=>l-c);if(o.length<2)return!1;let r=o[0]+s;for(let l=1;l<o.length;l++){const c=o[l]-s,d=o[l]+s;if(c<=r+vs)return!0;r=Math.max(r,d)}return!1}function j_(e,t){if(e.length<=Gi)return e;const n=new Map,i=r=>{r>=0&&r<e.length&&n.set(r,e[r])};i(0),i(e.length-1),i(Math.floor(e.length/2));const a=Math.max(1,Math.floor(e.length/(Gi-3)));let s=-1,o=0;for(let r=0;r<e.length;r+=a){i(r);const l=e[r],c=t?t(l):l,d=Array.isArray(c)?c.join("").length:String(c!=null?c:"").length;d>s&&(s=d,o=r)}return i(o),Array.from(n.keys()).sort((r,l)=>r-l).map(r=>n.get(r))}function U_(e){return z(e)?ql(e):!Array.isArray(e)||e.length<=Gi?e:{length:e.length,first:e[0],middle:e[Math.floor(e.length/2)],last:e[e.length-1]}}function ss(e){return e[as]}function Vi(e,t){$(t)?Object.defineProperty(e,as,{configurable:!0,value:t,writable:!0}):delete e[as]}function os(e){e.length=0,Vi(e)}function K_(e,t,n){os(e),e.length=t,Vi(e,n)}function Z_(e){const t=[];return t.length=e.length,Object.keys(e).forEach(n=>{const i=+n;t[i]=e[i]}),Vi(t,ss(e)),t}function q_(e,t){os(e),e.length=t.length,Object.keys(t).forEach(n=>{const i=+n;e[i]=t[i]}),Vi(e,ss(t))}function J_(e,t,n){const i=e[t];if($(i))return i;const a=Number(i);return Number.isFinite(a)?a:n}const Zl=new WeakMap;let Q_=0;function ql(e){if(!e||!/^(function|object)$/.test(typeof e))return`${typeof e}:${String(e)}`;let t=Zl.get(e);return t||(t=++Q_,Zl.set(e,t)),`${typeof e}:${t}`}function rs(e){return e instanceof Date?`date:${+e}`:Array.isArray(e)?`[${e.map(t=>rs(t)).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${t}:${rs(e[t])}`).join(",")}}`:typeof e=="function"?ql(e):`${typeof e}:${String(e)}`}function ls(e){return e instanceof Date?new Date(+e):Array.isArray(e)?e.map(t=>ls(t)):e}function tx(e){return{width:e.width,height:e.height,ticks:e.ticks&&Z_(e.ticks),clipPath:e.clipPath,domain:ls(e.domain)}}function ex(e,t){return e.width=t.width,e.height=t.height,e.clipPath=t.clipPath,e.domain=ls(t.domain),e.ticks&&t.ticks&&q_(e.ticks,t.ticks),e}var nx={getAxisInstance:function(){return this.axis||new ix(this)}};class ix{constructor(t){_e(this,"owner"),_e(this,"x"),_e(this,"subX"),_e(this,"subY"),_e(this,"subY2"),_e(this,"y"),_e(this,"y2"),_e(this,"axesList",{}),_e(this,"tick",{x:null,y:null,y2:null}),_e(this,"xs",[]),_e(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom",subY:"left",subY2:"right"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${It.axis} ${It[`axis${Ot(t)}`]}`}isHorizontal(t,n){const i=t.config.axis_rotated;return n?i:!i}isCategorized(){const{config:t,state:n}=this.owner;return t.axis_x_type.indexOf("category")>=0||n.hasRadar}isCustomX(){const{config:t}=this.owner;return!this.isTimeSeries()&&(t.data_x||bt(t.data_xs))}isTimeSeries(t="x"){return this.owner.config[`axis_${t}_type`]==="timeseries"}isLog(t="x"){return this.owner.config[`axis_${t}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(t="x"){let n="linear";return this.isTimeSeries(t)?n=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(n="log"),n}getExtent(){const t=this.owner,{config:n,scale:i}=t;let a=n.axis_x_extent;if(a){if(z(a))a=a.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(this.isTimeSeries()&&a.every(isNaN)){const s=Vt.bind(t);a=a.map(o=>i.subX(s(o)))}}return a}init(){const t=this.owner,{config:n,$el:{main:i,axis:a},state:{clip:s}}=t,o=["x","y"];n.axis_y2_show&&o.push("y2"),o.forEach(r=>{const l=this.getAxisClassName(r);a[r]=i.append("g").attr("class",l).attr("clip-path",()=>{let c=null;return r==="x"?c=s.pathXAxis:r==="y"&&(c=s.pathYAxis),c}).attr("transform",t.getTranslate(r)).style("visibility",n[`axis_${r}_show`]?null:"hidden"),this.generateAxes(r)})}setOrient(){const t=this.owner,{axis_rotated:n,axis_y_inner:i,axis_y2_inner:a}=t.config;this.orient={x:n?"left":"bottom",y:n?i?"top":"bottom":i?"right":"left",y2:n?a?"bottom":"top":a?"left":"right",subX:n?"left":"bottom",subY:n?i?"top":"bottom":i?"right":"left",subY2:n?a?"bottom":"top":a?"left":"right"}}generateAxes(t){const n=this.owner,{config:i}=n,a=[],s=i[`axis_${t}_axes`],o=i.axis_rotated;let r;t==="x"?r=o?"left":"bottom":t==="y"?r=o?"bottom":"left":t==="y2"&&(r=o?"top":"right"),s.length&&s.forEach(l=>{const c=l.tick||{},d=n.scale[t].copy();l.domain&&d.domain(l.domain);const u=new Ul({outerTick:c.outer!==!1,noTransition:!1,config:i,id:t,isSubAxes:!0,owner:n}).scale(d).orient(r).tickFormat(z(c.format)?c.format.bind(n.api):(h=>h));q(c.count)&&u.ticks(c.count),c.values&&u.tickValues(c.values),a.push(u)}),this.axesList[t]=a}updateAxes(){const t=this.owner,{config:n,$el:{main:i},$T:a}=t;Object.keys(this.axesList).forEach(s=>{const o=n[`axis_${s}_axes`],r=t.scale[s].copy(),l=r.range();this.axesList[s].forEach((c,d)=>{const u=c.scale().range();l.every((g,p)=>g===u[p])||c.scale().range(l);const h=`${this.getAxisClassName(s)}-${d+1}`;let f=i.select(`.${h.replace(/\s/,".")}`);f.empty()?(f=i.append("g").attr("class",h).style("visibility",n[`axis_${s}_show`]?null:"hidden"),c.create(f)):(o[d].domain&&r.domain(o[d].domain),c.scale(r).create(a(f))),f.attr("transform",t.getTranslate(s,d+1))})})}setAxis(t,n,i,a){const s=this.owner,o=is(t);Xi(t)||(this.tick[o]=this.getTickValues(o)),this[t]=this.getAxis(t,n,i,t==="x"&&(s.scale.zoom||s.config.subchart_show||s.state.resizing)?!0:a)}getAxis(t,n,i,a,s){const o=this.owner,{config:r}=o,l=/^(x|subX)$/.test(t),c=is(t),d=l&&this.isCategorized(),u=this.orient[t],h=s?0:o.getAxisTickRotate(c);let f;if(l)f=t==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const m=Xi(t)?r[`subchart_axis_${c}_tick_format`]||r[`axis_${c}_tick_format`]:r[`axis_${c}_tick_format`];z(m)&&(f=m.bind(o.api))}let g=Xi(t)?this.getTickValues(c,!0):this.tick[c];const p=Ae({outerTick:i,noTransition:a,config:r,id:t,tickTextRotate:h,owner:o},l&&{isCategory:d,isInverted:r.axis_x_inverted,tickMultiline:r.axis_x_tick_multiline,tickWidth:r.axis_x_tick_width,tickTitle:d&&r.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new Ul(p).scale(l&&o.scale.zoom||n).orient(u);if(l&&this.isTimeSeries()&&g&&!z(g)){const m=Vt.bind(o);g=g.map(b=>m(b))}else!l&&this.isTimeSeriesY()&&(_.ticks(r.axis_y_tick_time_value),g=null);g&&_.tickValues(g),_.tickFormat(f||!l&&o.isStackNormalized()&&o.hasAxisGroupedData(c)&&(m=>`${m}%`)),d&&(_.tickCentered(r.axis_x_tick_centered),se(r.axis_x_tick_culling)&&(r.axis_x_tick_culling=!1));const x=Ze(r,t,"count");return x&&_.ticks(x),_}updateXAxisTickValues(t,n){var i;const a=this.owner,{config:s}=a,o=s.axis_x_tick_fit,r=(c=s.axis_x_tick_count)=>{let d=c,u;return o&&(u=a.mapTargetsToUniqueXs(t),this.isCategorized()&&d>u.length&&(d=u.length),u=this.generateTickValues(u,d,this.isTimeSeries())),u},l=r();if(n)n.tickValues(l);else if(this.x){const c=this.getTickValues("x",!0),d=Ze(s,"subX","count"),u=c!=null?c:d!==s.axis_x_tick_count?r(d):l;this.x.tickValues(l),(i=this.subX)==null||i.tickValues(u)}return l}getId(t){const{config:n,scale:i}=this.owner;let a=n.data_axes[t];return(!a||!i[a])&&(a="y"),a}getXAxisTickFormat(t){const n=this.owner,{config:i,format:a}=n,s=t&&i.subchart_axis_x_tick_format||i.axis_x_tick_format,o=this.isTimeSeries(),r=this.isCategorized();let l;return s?z(s)?l=s.bind(n.api):o&&(l=c=>c?a.axisTime(s)(c):""):l=o?a.defaultAxisTime:r?n.categoryName:c=>c<0?c.toFixed(0):c,z(l)?c=>l.apply(n,r?[c,n.categoryName(c)]:[c]):l}getTickValues(t,n=!1){const i=this.owner,a=n?Ze(i.config,`sub${Ot(t)}`,"values"):i.config[`axis_${t}_tick_values`],s=z(a)?a.call(i.api):a,o=i[`${t}Axis`];return n?s!=null?s:void 0:s||(o?o.tickValues():void 0)}getLabelOptionByAxisId(t){return this.owner.config[`axis_${t}_label`]}getLabelText(t){const n=this.getLabelOptionByAxisId(t);return Q(n)?n:n?n.text:null}setLabelText(t,n){const i=this.owner,{config:a}=i,s=this.getLabelOptionByAxisId(t);Q(s)?a[`axis_${t}_label`]=n:s&&(s.text=n)}getLabelPosition(t,n){const i=this.owner.config.axis_rotated,a=this.getLabelOptionByAxisId(t),s=Ut(a)&&a.position?a.position:n[+!i],o=r=>!!~s.indexOf(r);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(t){return this.getLabelPosition(t,t==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}xForAxisLabel(t){const n=this.owner,{state:{width:i,height:a}}=n,s=this.getAxisLabelPosition(t);let o=s.isMiddle?-a/2:0;return this.isHorizontal(n,t!=="x")?o=s.isLeft?0:s.isCenter?i/2:i:s.isBottom&&(o=-a),o}textAnchorForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isMiddle?"middle":"end";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(a="start"),a}dxForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isBottom?"0.5em":"0";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(a="-0.5em"),a}dyForAxisLabel(t){const n=this.owner,{config:i}=n,a=i.axis_rotated,s=this.getAxisLabelPosition(t).isInner,o=i[`axis_${t}_tick_rotate`]?n.getHorizontalAxisHeight(t):0,{width:r}=this.getMaxTickSize(t);let l;if(t==="x"){const c=i.axis_x_height;a?l=s?"1.2em":-25-r:s?l="-0.5em":c?l=c-10:o?l=o-10:l="3em"}else l={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],a?s?l=l[0]:o?l=o*(t==="y2"?-1:1)-l[1]:l=l[2]:l=s?l[3]:(l[4]+(i[`axis_${t}_inner`]?0:r+l[4]))*(t==="y"?-1:1);return l}getTickFormatCacheValue(t){const n=this.owner,{config:i}=n;return t==="x"?{format:i.axis_x_tick_format,type:i.axis_x_type,localtime:i.axis_x_localtime,categories:i.axis_x_categories}:{format:i[`axis_${t}_tick_format`],normalized:n.isStackNormalized(),grouped:n.hasAxisGroupedData(t),type:i[`axis_${t}_type`]}}getMaxTickSizeFingerprint(t,n,i,a,s,o){var r;const l=this.owner,{config:c,state:d}=l,u=t==="x",h=u?"axis_x":`axis_${t}`,f=a.tickValues();return rs({id:t,withoutRecompute:!!o,dataGeneration:d.dataGeneration,size:[d.current.width,d.current.height],range:(r=n.range)==null?void 0:r.call(n),domain:i,type:n.type,orient:this.orient[t],axisRotated:c.axis_rotated,evalTextSize:c.axis_evalTextSize,format:this.getTickFormatCacheValue(t),ticks:{values:U_(f),rawValues:c[`${h}_tick_values`],arguments:a.ticks(),count:c[`${h}_tick_count`],rotate:s,show:c[`${h}_tick_show`],textShow:c[`${h}_tick_text_show`],textPosition:c[`${h}_tick_text_position`],inner:c[`${h}_tick_inner`],culling:c[`${h}_tick_culling`],cullingMax:c[`${h}_tick_culling_max`],cullingLines:c[`${h}_tick_culling_lines`],cullingReverse:c[`${h}_tick_culling_reverse`],stepSize:!u&&c[`${h}_tick_stepSize`],timeValue:!u&&c[`${h}_tick_time_value`],fit:u&&c.axis_x_tick_fit,autorotate:u&&c.axis_x_tick_autorotate,centered:u&&c.axis_x_tick_centered,inverted:u&&c.axis_x_inverted,multiline:u&&c.axis_x_tick_multiline,width:u&&c.axis_x_tick_width}})}getMaxTickSize(t,n){var i;const a=this.owner,{config:s,state:o,$el:{svg:r,chart:l}}=a,{current:c,resizing:d}=o,u=c.maxTickSize[t],h=`${W.maxTickSize}_${t}_${!!n}`,f=a.cache.get(h);if(f&&f.generation===o.redrawGeneration)return u;const g=`axis_${t}`,p={width:0,height:0};let _;if(d||n||!s[`${g}_show`]||u.width>0&&a.filterTargetsToShow().length===0)return u;if((r||s.render_mode==="canvas")&&((i=a.scale[t])!=null&&i.copy)){const x=/^y2?$/.test(t),m=a.getTargetsToShow(),b=a.scale[t].copy().domain(a[`get${x?"Y":"X"}Domain`](m,t)),v=b.domain(),y=v[0]===v[1]&&v.every(I=>I>0),T=ot(u.domain)&&u.domain[0]===u.domain[1]&&u.domain.every(I=>I>0);if(y||T)return u;u.domain=v,x||os(u.ticks);const w=this.getAxis(t,b,!1,!1,!0),C=s[`${g}_tick_rotate`],A=s[`${g}_tick_count`];if(!s[`${g}_tick_values`]&&A&&w.tickValues(this.generateTickValues(v,A,x?this.isTimeSeriesY():this.isTimeSeries())),!x&&this.updateXAxisTickValues(m,w),_=this.getMaxTickSizeFingerprint(t,b,v,w,C,n),(f==null?void 0:f.fingerprint)===_)return a.cache.add(h,V_(G_({},f),{generation:o.redrawGeneration})),ex(u,f.value);const k=w.tickValues(),L=!x&&Array.isArray(k)&&k.length>Gi;L&&w.tickValues(j_(k,w.tickFormat()));const E=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),D=E.append("g").attr("class",`${It[`axis${Ot(t)}`]} ${U.dummy}`);w.create(D);const{sizeFor1Char:R}=D.node(),P=E.selectAll("text").attr("transform",$(C)?`rotate(${C})`:null),B=L?k.length:P.size();if(R)P.each(function(I,X){const G=this.textContent.length*R.w,Z=R.h;p.width=Math.max(p.width,G),p.height=Math.max(p.height,Z),x||(u.ticks[X]=G)});else{const I=[];if(P.each(function(){I.push(this)}),(I.length<=5?I:W_(I)).map(G=>ht(G,!0)).forEach(G=>{p.width=Math.max(p.width,G.width),p.height=Math.max(p.height,G.height)}),!x)for(let G=0;G<I.length;G++)u.ticks[G]=p.width}!x&&L&&K_(u.ticks,B,p.width),E.remove()}return Object.keys(p).forEach(x=>{p[x]>0&&(u[x]=p[x])}),a.cache.add(h,{fingerprint:_,generation:o.redrawGeneration,value:tx(u)}),u}getXAxisTickTextY2Overflow(t){const n=this.owner,{axis:i,config:a,state:{current:s,isLegendRight:o,legendItemWidth:r}}=n,l=n.getAxisTickRotate("x"),c=l>0&&l<90;if((i.isCategorized()||i.isTimeSeries())&&a.axis_x_tick_fit&&(!a.axis_x_tick_culling||se(a.axis_x_tick_culling))&&!a.axis_x_tick_multiline&&c){const d=a.axis_y2_show&&s.maxTickSize.y2.width||0,u=o&&r||0,h=s.width-n.getCurrentPaddingByDirection("left"),f=this.getXAxisTickMaxOverflow(l,h-t)-d-u,g=Math.max(0,f)+t;return Math.min(g,h/2)}return 0}getXAxisTickMaxOverflow(t,n){var i;const a=this.owner,{axis:s,config:o,state:r}=a,l=s.isTimeSeries(),c=r.current.maxTickSize.x.ticks,d=c.length,u=(i=ss(c))!=null?i:r.current.maxTickSize.x.width,{left:h,right:f}=r.axis.x.padding;let g=0;const p=d-(l&&o.axis_x_tick_fit?.5:0);for(let m=0;m<d;m++){const b=m+1,v=Math.cos(Math.PI*t/180)*J_(c,m,u),y=b-(l?1:.5)+h;if(y<=0)continue;const w=(n-v)/y,C=p-b,A=f*w,S=C*w+A,k=v-w/2-S;g=Math.max(g,k)}const _=a.getTargetsToShow();let x=0;if(!l&&o.axis_x_tick_count<=_.length&&_[0].values.length){const m=Xe(a.axis.getAxisType("x"),0,n-g).domain([h*-1,a.getXDomainMax(a.data.targets)+1+f]);x=(m(1)-m(0))/2}return g+x}updateLabels(t){const n=this.owner,{config:i,$el:{main:a},$T:s}=n,o=i.axis_rotated;["x","y","y2"].forEach(r=>{const l=this.getLabelText(r),c=`axis${Ot(r)}`,d=It[`${c}Label`];if(l){let u=a.select(`text.${d}`);u.empty()&&(u=a.select(`g.${It[c]}`).insert("text",":first-child").attr("class",d).attr("transform",["rotate(-90)",null][r==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(r))),s(u,t).attr("x",()=>this.xForAxisLabel(r)).attr("dx",()=>this.dxForAxisLabel(r)).attr("dy",()=>this.dyForAxisLabel(r)).text(l)}})}getPadding(t,n,i,a){const s=$(t)?t:t[n];return q(s)?this.owner.convertPixelToScale(/(bottom|top)/.test(n)?"y":"x",s,a):i}generateTickValues(t,n,i){let a=t;if(n){const s=z(n)?n():n;if(s===1)a=[t[0]];else if(s===2)a=[t[0],t[t.length-1]];else if(s>2){const o=this.isCategorized(),r=s-2,l=t[0],c=t[t.length-1],d=(c-l)/(r+1);let u;a=[l];for(let h=0;h<r;h++)u=+l+d*(h+1),a.push(i?new Date(u):o?Math.round(u):u);a.push(c)}}return i||(a=a.sort((s,o)=>s-o)),a}generateTransitions(t){const n=this.owner,{$el:{axis:i},$T:a}=n,[s,o,r,l,c,d]=["x","y","y2","subX","subY","subY2"].map(u=>a(i[u],t));return{axisX:s,axisY:o,axisY2:r,axisSubX:l,axisSubY:c,axisSubY2:d}}redraw(t,n,i){const a=this.owner,{config:s,state:o,$el:r}=a,l=n?"0":null;["x","y","y2","subX","subY","subY2"].forEach(c=>{const d=this[c],u=r.axis[c];d&&u&&(!i&&!s.transition_duration&&(d.config.withoutTransition=!0),u.style("opacity",l),d.create(t[`axis${Ot(c)}`]))}),this.updateAxes(),!o.rendered&&s.axis_tooltip&&this.setAxisTooltip()}syncAxisDomains(t,n,i){var a;const s=this.owner,{config:o,scale:r,$el:l}=s,c=!!r.zoom;let d;if(!c&&this.isCategorized()&&t.length===0&&l.axis.x&&r.x.domain([0,l.axis.x.selectAll(".tick").size()]),r.x&&t.length?(!c&&s.updateXDomain(t,n.UpdateXDomain,n.UpdateOrgXDomain,n.TrimXDomain),o.axis_x_tick_values||this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),(a=this.subX)==null||a.tickValues([])),o.zoom_rescale&&!i&&(d=r.x.orgDomain()),["y","y2"].forEach(u=>{const h=`axis_${u}_`,f=r[u];if(f){const g=o[`${h}tick_values`],p=o[`${h}tick_count`];if(f.domain(s.getYDomain(t,u,d)),!g&&p){const _=s.axis[u],x=f.domain();_.tickValues(this.generateTickValues(x,x.every(m=>m===0)?1:p,this.isTimeSeriesY()))}}}),n.Y){const u=()=>{var h,f;(h=r.subY)==null||h.domain(s.getYDomain(t,"y")),(f=r.subY2)==null||f.domain(s.getYDomain(t,"y2")),["y","y2"].forEach(g=>{const p=g==="y2"?"subY2":"subY",_=r[p],x=s.axis[p],m=this.getTickValues(g,!0),b=Ze(o,p,"count");if(!_||!x||m||!b)return;const v=_.domain();x.tickValues(this.generateTickValues(v,v.every(y=>y===0)?1:b,this.isTimeSeriesY()))})};o.subchart_show?s.withSubchartTypeContext(u):u()}}redrawAxis(t,n,i,a,s){const o=this.owner;this.syncAxisDomains(t,n,a),this.redraw(i,o.hasArcType(),s),this.updateLabels(n.Transition),(n.UpdateXDomain||n.UpdateXAxis||n.Y)&&t.length&&this.setCulling()}setCulling(){const t=this.owner,{config:n,state:{clip:i,current:a},$el:s}=t;["subX","x","y","y2","subY","subY2"].forEach(o=>{const r=s.axis[o],l=Ze(n,o,"culling");if(r&&l){const c=r.selectAll(".tick"),d=pn(c.data(),!Ze(n,o,"culling_reverse")),u=d.length,h=Ze(n,o,"culling_max"),g=!Ze(n,o,"culling_lines")||H_(this[o],d,Y_(c));let p;if(u){for(let x=1;x<u;x++)if(u/x<h){p=x;break}p=p!=null?p:u;const _=new Map;for(let x=0;x<d.length;x++)_.set(d[x],x);c.each(function(x){var m;const b=g?this:this.querySelector("text");b&&(b.style.display=((m=_.get(x))!=null?m:0)%p?"none":null)})}else c.style("display",null);if(o==="x"){const _=a.maxTickSize.x.clipPath?i.pathXAxisTickTexts:null;s.svg.selectAll(`.${It.axisX} .tick text`).attr("clip-path",_)}}})}setAxisTooltip(){var t;const n=this.owner,{config:{axis_rotated:i,axis_tooltip:a},$el:{axis:s,axisTooltip:o}}=n,r=(t=a.backgroundColor)!=null?t:"black";n.generateTextBGColorFilter(r,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(l=>{var c,d,u;if(Q(r)||r[l])if(o[l]=(c=s[l])==null?void 0:c.append("text").classed(It[`axis${l.toUpperCase()}Tooltip`],!0).attr("filter",n.updateTextBGColor({id:l},r)),i){const h=l==="x"?"x":"y",f=l==="y"?"1.15em":l==="x"?"-0.3em":"-0.4em";(d=o[l])==null||d.attr(h,f).attr(`d${l==="x"?"y":"x"}`,l==="x"?"0.4em":"-1.3em").style("text-anchor",l==="x"?"end":null)}else{const h=l==="x"?"y":"x",f=l==="x"?"1.15em":`${l==="y"?"-":""}0.4em`;(u=o[l])==null||u.attr(h,f).attr(`d${l==="x"?"x":"y"}`,l==="x"?"-1em":"0.3em").style("text-anchor",l==="y"?"end":null)}})}}var Jl=Math.pow,ax={initEventRect(){this.$el.main.select(`.${U.chart}`).append("g").attr("class",Ie.eventRects).style("fill-opacity","0")},redrawEventRect(){var e;const t=this,{config:n,state:i,$el:a}=t,s=t.isMultipleX(),o=n.axis_x_inverted;if(a.eventRect)t.updateEventRect(a.eventRect,!0);else if(t.data.targets.length){const l=t.$el.main.select(`.${Ie.eventRects}`).style("cursor",n.zoom_enabled&&n.zoom_type!=="drag"?n.axis_rotated?"ns-resize":"ew-resize":null).classed(Ie.eventRectsMultiple,s).classed(Ie.eventRectsSingle,!s).selectAll(`.${Ie.eventRect}`).data([0]).enter().append("rect");t.updateEventRect(l),t.updateEventType(l),l.call(t.getDraggableSelection()),a.eventRect=l,t.state.inputType==="touch"&&!a.svg.on("touchstart.eventRect")&&!t.hasArcType()&&t.bindTouchOnEventRect(),i.rendered&&t.updateEventRect(a.eventRect,!0)}if(!s){const r=t.getMaxDataCountTarget();(!n.data_xSort||o)&&r.sort((l,c)=>o?c.x-l.x:l.x-c.x),t.updateDataIndexByX(r),t.updateXs(r),(e=t.updatePointClass)==null||e.call(t,!0),i.eventReceiver.data=r}t.updateEventRectData()},bindTouchOnEventRect(){const e=this,{config:t,state:n,$el:{eventRect:i,svg:a}}=e,s=f=>{if(e.isMultipleX())e.selectRectForMultipleXs(f);else{const g=e.getDataIndexFromEvent(n.event);e.callOverOutForTouch(g),g===-1?e.unselectRect():e.selectRectForSingle(f,g)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=tn(r)&&r||!1,c=!isNaN(r)&&r||null;let d;const u=!l&&c===null,h=f=>{const g=f.type,_=f.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];g==="touchstart"?l?f.preventDefault():c!==null&&(d=_):g==="touchmove"&&(l||d===!0||c!==null&&Math.abs(d-_)>=c)&&(d=!0,f.preventDefault())};i.on("touchstart",f=>{n.event=f,e.updateEventRect()},{passive:u}).on("touchstart.eventRect touchmove.eventRect",f=>{if(n.event=f,!i.empty()&&i.classed(Ie.eventRect)){if(n.dragging||n.flowing||e.hasArcType()||f.touches.length>1)return;h(f),s(i.node())}else o()},{passive:u}).on("touchend.eventRect",f=>{n.event=f,!i.empty()&&i.classed(Ie.eventRect)&&(e.hasArcType()||!e.toggleShape||n.cancelClick)&&n.cancelClick&&(n.cancelClick=!1)},{passive:u}),a.on("touchstart",f=>{n.event=f;const{target:g}=f;g&&g!==i.node()&&o()},{passive:u})},updateEventRect(e,t=!1){const n=this,{state:i,$el:a}=n,{eventReceiver:s,width:o,height:r,rendered:l,resizing:c}=i,d=e||a.eventRect,u=()=>{if(s){const h=dr(a.chart.node());s.rect=ht(d.node(),!0).toJSON(),s.rect.top+=h.y,s.rect.left+=h.x}};(!l||c||t)&&(d.attr("x",0).attr("y",0).attr("width",o).attr("height",r),(!l||t)&&d.classed(Ie.eventRect,!0)),u()},updateEventType(e){const t=this,n=tn(e),i=n?t.$el.eventRect:e,a=n?e!==(i==null?void 0:i.datum().multipleX):!1;i&&(a&&(i==null||i.on("mouseover mousemove mouseout click",null)),t.isMultipleX()?t.generateEventRectsForMultipleXs(i):t.generateEventRectsForSingleX(i))},updateEventRectData(){const e=this,{config:t,scale:n,state:i}=e,a=n.zoom||n.x,s=t.axis_rotated,o=e.isMultipleX(),r=a==null?void 0:a.domain(),l=r?`${r[0]}_${r[1]}_${i.width}_${i.height}_${e.data.targets.length}_${i.dataGeneration}_${[...i.hiddenTargetIds].join(",")}`:null;if(l&&l===i._eventRectFingerprint)return;i._eventRectFingerprint=l;let c,d,u,h;if(e.updateEventType(o),o)c=0,d=0,u=i.width,h=i.height;else{let p,_;if(e.axis.isCategorized())p=e.getEventRectWidth(),_=x=>a(x.x)-p/2;else{const x=({index:m})=>({prev:e.getPrevX(m),next:e.getNextX(m)});p=m=>{const b=x(m),v=a.domain();let y;return b.prev===null&&b.next===null?y=s?i.height:i.width:b.prev===null?y=(a(b.next)+a(m.x))/2:b.next===null?y=a(v[1])-(a(b.prev)+a(m.x))/2:y=Math.max(0,(a(b.next)-a(b.prev))/2),y},_=m=>{const b=x(m);let v;return b.prev===null&&b.next===null?v=0:b.prev===null?v=a(a.domain()[0]):v=(a(m.x)+a(b.prev))/2,v}}c=s?0:_,d=s?_:0,u=s?i.width:p,h=s?p:i.height}const{eventReceiver:f}=i,g=(p,_)=>z(p)?p(_):p;f.coords.splice(f.data.length),f.data.forEach((p,_)=>{f.coords[_]={x:g(c,p),y:g(d,p),w:g(u,p),h:g(h,p)}})},selectRectForSingle(e,t){var n,i,a,s,o,r,l;const c=this,{config:d,state:u,$el:{main:h,circle:f}}=c,g=d.data_selection_enabled,p=d.data_selection_grouped,_=d.data_selection_isselectable,x=d.tooltip_grouped,m=c.getAllValuesOnIndex(t);if(x&&(c.showTooltip(m,e),(n=c.showGridFocus)==null||n.call(c,m),(i=c.showSubchartGridFocus)==null||i.call(c,m),!g||p))return;!f&&h.selectAll(`.${U.EXPANDED}:not(.${kt.shape}-${t})`).classed(U.EXPANDED,!1);const b=h.selectAll(`.${kt.shape}-${t}`).classed(U.EXPANDED,!0).style("cursor",_?"pointer":null).filter(function(v){return c.isWithinShape(this,v)});if(b.call(v=>{var y,T,w;const C=v.data();g&&(p||_!=null&&_.bind(c.api)(C))&&(e.style.cursor="pointer"),x||(c.showTooltip(C,e),(y=c.showGridFocus)==null||y.call(c,C),(T=c.showSubchartGridFocus)==null||T.call(c,C),(w=c.unexpandCircles)==null||w.call(c),v.each(A=>c.setExpand(t,A.id)))}),!x&&b.empty()){const v=Zt(u.event,e),y=m.filter(T=>c.isTargetToShow(T.id)?c.dist(T,v)<c.getPointSensitivity(T):!1);if(y.length>0){let T=y[0],w=c.dist(T,v);for(let C=1;C<y.length;C++){const A=y[C],S=c.dist(A,v);S<w&&(w=S,T=A)}c.showTooltip([T],e),(a=c.showGridFocus)==null||a.call(c,[T]),(s=c.showSubchartGridFocus)==null||s.call(c,[T]),(o=c.unexpandCircles)==null||o.call(c),c.setExpand(t,T.id,!0),g&&(p||_!=null&&_.bind(c.api)(T))&&(e.style.cursor="pointer")}else d.interaction_onout&&((r=c.hideGridFocus)==null||r.call(c),(l=c.hideSubchartGridFocus)==null||l.call(c),c.hideTooltip(),!p&&c.setExpand(t))}},selectRectForMultipleXs(e,t=!0){var n,i;const a=this,{config:s,state:o}=a,r=a.getTargetsToShow();if(o.dragging||a.hasArcType(r))return;const l=Zt(o.event,e),c=a.findClosestFromTargets(r,l);if(t&&o.mouseover&&(!c||c.id!==o.mouseover.id)&&(s.data_onout.call(a.api,o.mouseover),o.mouseover=void 0),!c){a.unselectRect();return}const u=(a.isBubbleType(c)||a.isScatterType(c)||!s.tooltip_grouped?[c]:a.filterByX(r,c.x)).map(f=>a.addName(f));a.showTooltip(u,e),a.setExpand(c.index,c.id,!0),(n=a.showGridFocus)==null||n.call(a,u),(i=a.showSubchartGridFocus)==null||i.call(a,u);const h=a.dist(c,l);(a.isBarType(c.id)||h<a.getPointSensitivity(c))&&(a.$el.eventRect.style("cursor","pointer"),t&&(!o.mouseover||o.mouseover.x!==c.x||o.mouseover.id!==c.id)&&(s.data_onover.call(a.api,c),o.mouseover=c))},unselectRect(){var e,t,n,i;const a=this,{state:s,$el:{circle:o,tooltip:r}}=a;if(s._lastTooltipMouse=null,s.isCanvasMode){(e=a.clearCanvasFocus)==null||e.call(a),r&&a.hideTooltip();return}(t=a.$el.eventRect)==null||t.style("cursor",null),(n=a.hideGridFocus)==null||n.call(a),(i=a.hideSubchartGridFocus)==null||i.call(a),r&&(a.hideTooltip(),a._handleLinkedCharts(!1)),o&&!a.isPointFocusOnly()&&a.unexpandCircles(),a.expandBarTypeShapes(!1)},generateEventRectsForSingleX(e){const t=this,{config:n,state:i}=t,{eventReceiver:a}=i,s=e.style("cursor",n.data_selection_enabled&&n.data_selection_grouped?"pointer":null).on("click",function(o){i.event=o;const{currentIdx:r,data:l}=a,c=l[r===-1?t.getDataIndexFromEvent(o):r];t.clickHandlerForSingleX.bind(this)(c,t)}).datum({multipleX:!1});if(i.inputType==="mouse"){const o=r=>{const l=r?t.getDataIndexFromEvent(r):a.currentIdx;return l>-1?a.data[l]:null};s.on("mouseover",r=>{i.event=r,t.updateEventRect(),Object.values(t.$el.axisTooltip).forEach(l=>l==null?void 0:l.style("display",null))}).on("mousemove",function(r){var l;const c=o(r);if(i.event=r,!c)return;let{index:d}=c;const u=n.line_step_type;if(n.line_step_tooltipMatch&&t.hasType("step")&&/^step\-(before|after)$/.test(u)){const f=t.scale.zoom||t.scale.x,g=t.axis.xs[d],p=f.invert(Zt(r,this)[0]);u==="step-after"&&p<g?d-=1:u==="step-before"&&p>g&&(d+=1)}(l=t.showAxisGridFocus)==null||l.call(t);const h=n.tooltip_grouped&&d===a.currentIdx;if(i.dragging||i.flowing||t.hasArcType()||h){if(n.tooltip_show&&h){const[f,g]=Zt(r,this),p=i._lastTooltipMouse;(!p||Jl(f-p[0],2)+Jl(g-p[1],2)>=9)&&(i._lastTooltipMouse=[f,g],t.setTooltipPosition())}return}d!==a.currentIdx&&(t.setOverOut(!1,a.currentIdx),a.currentIdx=d),d===-1?t.unselectRect():t.selectRectForSingle(this,d),t.setOverOut(d!==-1,d)}).on("mouseout",r=>{var l;i.event=r,!(!t.config||t.hasArcType()||a.currentIdx===-1||!n.interaction_onout)&&((l=t.hideAxisGridFocus)==null||l.call(t),t.unselectRect(),t.setOverOut(!1,a.currentIdx),a.currentIdx=-1)})}return s},clickHandlerForSingleX(e,t){const n=t,{config:i,state:a,$el:{main:s}}=n;if(!e||n.hasArcType()||a.cancelClick){a.cancelClick&&(a.cancelClick=!1);return}const{index:o}=e;s.selectAll(`.${kt.shape}-${o}`).each(function(r){var l;(i.data_selection_grouped||n.isWithinShape(this,r))&&((l=n.toggleShape)==null||l.call(n,this,r,o),i.data_onclick.bind(n.api)(r,this))})},generateEventRectsForMultipleXs(e){const t=this,{config:n,state:i}=t;e.on("click",function(a){i.event=a,t.clickHandlerForMultipleXS.bind(this)(t)}).datum({multipleX:!0}),i.inputType==="mouse"&&e.on("mouseover mousemove",function(a){i.event=a,t.selectRectForMultipleXs(this)}).on("mouseout",a=>{i.event=a,!(!t.config||t.hasArcType()||!n.interaction_onout)&&t.unselectRect()})},clickHandlerForMultipleXS(e){const t=e,{config:n,state:i}=t,a=t.getTargetsToShow();if(t.hasArcType(a))return;const s=Zt(i.event,this),o=t.findClosestFromTargets(a,s);if(!o)return;const r=t.getPointSensitivity(o);(t.isBarType(o.id)||t.dist(o,s)<r)&&t.$el.main.selectAll(`.${kt.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${kt.shape}-${o.index}`).each(function(){var l;(n.data_selection_grouped||t.isWithinShape(this,o))&&((l=t.toggleShape)==null||l.call(t,this,o,o.index),n.data_onclick.bind(t.api)(o,this))})}},sx={initClip(){const e=this,{clip:t,datetimeId:n}=e.state;t.id=`${n}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:n}=t;return!n.clipPath&&/-clip$/.test(e)||!n.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!n.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+s+10:i.bottom)+20,c=o?-(1+r):-(r-1),d=-15,u=o?i.left+20:a+10+r;e.attr("x",c).attr("y",d).attr("width",u).attr("height",l)},setYAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=n.axis_y_inner,c=l&&!o?n.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),d=-(o?20:i.top),u=(o?a+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+s)+10;e.attr("x",c).attr("y",d).attr("width",u).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:n,xAxisHeight:i},$el:{defs:a}}=e,s=e.getHorizontalAxisHeight("x");if(a&&!n.idXAxisTickTexts){const o=`${n.id}-xaxisticktexts`;e.appendClip(a,o),n.idXAxisTickTexts=o,n.pathXAxisTickTexts=e.getClipPath(n.idXAxisTickTexts)}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&s!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=s},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:n}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const a=Math.sin(Math.PI/180*Math.abs(i));n.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/a}else n.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:n},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",n.maxTickSize.x.clipPath).attr("height",30)}},ox={getAxisSize(e){const t=this,n=t.config.axis_rotated;return n&&e==="x"||!n&&/y2?/.test(e)?t.getAxisWidthByAxisId(e,!0):t.getHorizontalAxisHeight(e)},getAxisWidthByAxisId(e,t){var n,i;const a=this;if(a.axis){const s=(n=a.axis)==null?void 0:n.getAxisLabelPosition(e),{width:o}=a.axis.getMaxTickSize(e,t),r=o===0?.5:0;return o+(((i=a.config.padding)==null?void 0:i.mode)==="fit"?s.isInner?10+r:10:s.isInner?20+r:40)}else return 40},getHorizontalAxisHeight(e){var t,n;const i=this,{config:a,state:s}=i,{rotatedPadding:o,isLegendRight:r,isLegendInset:l}=s,c=a.axis_rotated,d=((t=a.padding)==null?void 0:t.mode)==="fit",u=a[`axis_${e}_inner`],h=a[`axis_${e}_label`].text,f=13;let g=((n=a.padding)==null?void 0:n.mode)==="fit"?u&&!h?e==="y"?1:0:20:30;if(e==="x"&&!a.axis_x_show)return 8;if(e==="x"&&$(a.axis_x_height))return a.axis_x_height;if(e==="y"&&!a.axis_y_show)return a.legend_show&&!r&&!l?10:1;if(e==="y2"&&!a.axis_y2_show)return d?0:o.top;const p=i.axis.getMaxTickSize(e),_=Math.abs(a.axis_x_tick_rotate)>0&&(!a.axis_x_tick_autorotate||i.needToRotateXAxisTickTexts());return(a.axis_x_tick_multiline||_)&&p.height>f&&(g+=p.height-f),g+(i.axis.getAxisLabelPosition(e).isInner?0:10)+(e==="y2"&&!c?-10:0)},getEventRectWidth(){const e=this,{config:t,axis:n}=e,i=t.axis_x_inverted,a=n.x.tickInterval();return Math.max(0,i?Math.abs(a):a)},getAxisTickRotate(e){const t=this,{axis:n,config:i,state:a,$el:s}=t;let o=i[`axis_${e}_tick_rotate`];if(e==="x"){const r=n.isCategorized()||n.isTimeSeries();if(i.axis_x_tick_fit&&r){const l=i.axis_x_tick_count,c=a.current.maxTickSize.x.ticks.length;let d=0;if(l?d=l>c?c:l:c&&(d=c),d!==a.axis.x.tickCount){const{targets:u}=t.data;a.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(u,"min"),t.getXDomainMinMax(u,"max")],d)}a.axis.x.tickCount=d}(s.svg||a.isCanvasMode)&&i.axis_x_tick_autorotate&&i.axis_x_tick_fit&&!i.axis_x_tick_multiline&&!i.axis_x_tick_culling&&r&&(o=t.needToRotateXAxisTickTexts()?i.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const e=this,{state:{axis:t,current:n,isLegendRight:i,legendItemWidth:a}}=e,s=i&&a,o=n.width-s-e.getCurrentPaddingByDirection("left")-e.getCurrentPaddingByDirection("right"),r=t.x.tickCount+t.x.padding.left+t.x.padding.right,{width:l}=e.axis.getMaxTickSize("x"),c=r?o/r:0;return l>c}},rx={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:[]},lx={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:[]},cx={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:[]},ux=Object.defineProperty,Ql=Object.getOwnPropertySymbols,dx=Object.prototype.hasOwnProperty,hx=Object.prototype.propertyIsEnumerable,tc=(e,t,n)=>t in e?ux(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cs=(e,t)=>{for(var n in t||(t={}))dx.call(t,n)&&tc(e,n,t[n]);if(Ql)for(var n of Ql(t))hx.call(t,n)&&tc(e,n,t[n]);return e},fx=cs(cs(cs({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},rx),lx),cx),gx={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const px=[L_,R_,E_],ec={axis:nx,clip:sx,eventrect:ax,sizeAxis:ox},nc={optDataAxis:gx,optAxis:fx};function ic(e){return Object.keys(e).map(t=>e[t])}function ac(e=[],t=[]){St(pe.prototype,ic(ec).concat(e)),St(Yt.prototype,px),cn.setOptions(ic(nc).concat(t))}function ei(e=[],t=[]){ac(e,t)}function Fe(e,t=[]){const n=Array.isArray(e)?e:e?[e]:[];ac([Rn,Bi,A_].concat(n),[dn,k_].concat(t))}let sc=()=>(Fe(kn,[Ln]),(sc=()=>O.AREA)()),oc=()=>(Fe(kn,[Ln]),(oc=()=>O.AREA_LINE_RANGE)()),rc=()=>(Fe(kn,[Ln]),(rc=()=>O.AREA_STEP_RANGE)()),lc=()=>(Fe(kn,[Ln,es]),(lc=()=>O.AREA_SPLINE)()),cc=()=>(Fe(kn,[Ln,es]),(cc=()=>O.AREA_SPLINE_RANGE)()),uc=()=>(Fe(kn,[Ln]),(uc=()=>O.AREA_STEP)());function us(e){const t=this.config.bar_connectLine,n=(t==null?void 0:t[e])||t;return/^(start|end)\-(start|end)$/.test(n)?n:null}var _x={initBar(){const{$el:e,config:t,state:{clip:n}}=this;e.bar=e.main.select(`.${U.chart}`),e.bar=t.bar_front?e.bar.append("g"):e.bar.insert("g",":first-child"),e.bar.attr("class",ie.chartBars).call(this.setCssRule(!1,`.${ie.chartBars}`,["pointer-events:none"])),t.clipPath===!1&&(t.bar_radius||t.bar_radius_ratio)&&e.bar.attr("clip-path",n.pathXAxis.replace(/#[^)]*/,`#${n.id}`))},updateTargetsForBar(e){const t=this,{config:n}=t,i=t.getClass("bars",!0),a=n.interaction_enabled&&n.data_selection_isselectable;Ya.call(t,e,{type:"Bar",elKey:"bar",containerClass:ie.chartBars,itemClass:ie.chartBar,initFn:t.initBar}).append("g").attr("class",i).style("cursor",o=>{var r;return(r=a==null?void 0:a.bind)!=null&&r.call(a,t.api)(o)?"pointer":null}).call(o=>{t.setCssRule(!0,` .${ie.bar}`,["fill"],t.color)(o),o.each(function(r){us.call(t,r.id)&&(0,F.select)(this).append("path").attr("class",ie.barConnectLine)})})},updateBar(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,$el:a,$T:s}=n,o=t?a.subchart:a,r=n.getClass("bar",!0),l=n.initialOpacity.bind(n);i.bar_linearGradient&&n.updateLinearGradient();const c=o.main.selectAll(`.${ie.bars}`).selectAll(`.${ie.bar}`).data(n.labelishData.bind(n));s(c.exit(),e).style("opacity","0").remove(),o.bar=c.enter().append("path").attr("class",r).style("fill",n.generateUpdateBarColor()).merge(c).style("opacity",l),n.setRatioForGroupedData(o.bar.data())},generateUpdateBarColor(){const e=this,t=e.getStylePropValue(e.color)||(()=>null);return n=>Vr.call(e,n,"bar_linearGradient",t)},updateBarColor(e){return this.generateUpdateBarColor()(e)},redrawBar(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{bar:a}=n?i.$el.subchart:i.$el,s=[],o=new Map,r=_i(i),l=i.generateUpdateBarColor(),c=function(u,h,f){var g;const _=$(u.value)||i.isBarRangeType(u)||((g=i.isSubchartCandlestickBarValue)==null?void 0:g.call(i,u,n))?e(u,h):[""];let x=o.get(u.id);if(x===void 0&&(x=us.call(i,u.id),o.set(u.id,x)),_.length>1&&s.push(_[1]),h===f.length-1&&s.length){const m=i.$T((0,F.select)(this.parentNode.querySelector(`.${ie.barConnectLine}`)),t,me());i.updateConnectLine(m,x,s),s.splice(0)}return _[0]},d=i.$T(a,t,me());return r&&typeof d.attrTween=="function"?d.attrTween("d",function(u,h,f){var g;const p=c.call(this,u,h,f);return Sd((g=this.getAttribute("d"))!=null?g:"",p)}):d.attr("d",c),[d.style("fill",u=>{var h;return((h=i.getSubchartCandlestickBarColor)==null?void 0:h.call(i,u,n))||l(u)}).style("clip-path",u=>u.clipPath).style("opacity",null)]},generateDrawBar(e,t){const n=this,{config:i}=n,a=n.generateGetBarPoints(e,t),s=_i(n),o=s?ma(n):new Set,r=new Map;return(l,c)=>{const d=a(l,c),{indexX:u,indexY:h,isNegative:f,pos:g,radius:p,clipPath:_}=va(n,l,d,s,o,n.isStackingRadiusData.bind(n)),x=["",""];if(l.clipPath=_,s){const y=`a${p} ${p} ${f?"1 0 0":"0 0 1"} `;x[h]=`${y}${p},${p}`,x[u]=`${y}${[-p,p][i.axis_rotated?"sort":"reverse"]()}`,f&&x.reverse()}const m=i.axis_rotated?`H${g} ${x[0]}V${d[2][h]-p} ${x[1]}H${d[3][u]}`:`V${g} ${x[0]}H${d[2][u]-p} ${x[1]}V${d[3][h]}`,b=[`M${d[0][u]},${d[0][h]}${m}z`];let v=r.get(l.id);return v===void 0&&(v=us.call(n,l.id),r.set(l.id,v)),v&&b.push(i.axis_rotated?{x:d[0][u],y:d[0][h],width:d[0][u]-g,height:d[2][h]-d[0][h]}:{x:d[0][u],y:g,width:d[2][u]-d[0][u],height:d[3][h]-g}),b}},isStackingRadiusData(e){const t=this,{$el:n,config:i,data:a,state:s}=t,{id:o,index:r,value:l}=e;if(s.hiddenTargetIds.has(o)){const h=n.bar.filter(f=>f.id===o&&f.value===l);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const c=i.data_groups.find(h=>h.indexOf(o)>-1),u=t.orderTargets(t.filterTargetsToShow(a.targets.filter(t.isBarType,t))).filter(h=>c.indexOf(h.id)>-1).map(h=>{const f=h.values[r];if(f&&($(l)&&l>0?f.value>0:f.value<0))return f}).filter(Boolean).map(h=>h.id);return l!==0&&u.indexOf(o)===u.length-1},updateConnectLine(e,t,n){const i=n.map((a,s,o)=>{const r=this.config.axis_rotated,l=/^start-(start|end)$/.test(t),c=/^end-(start|end)$/.test(t),d=[],u=r?c?a.x-a.width:a.x:a.x+a.width,h=r||l?a.y+a.height:a.y;return s===0?d.push(`${u},${h}`):(d.push(r?`L${a.x-(/\w+-end$/.test(t)?a.width:0)},${a.y}`:`L${a.x},${a.y+(/\w+-start$/.test(t)?a.height:0)}`),s<o.length-1&&d.push(`M${u},${h}`)),d.join(" ")});e.attr("d",`M${i.join("")}z`)}},xx={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 dc=()=>(ei([_x,Rn],[xx,dn]),(dc=()=>O.BAR)());var mx={initBubble(){const e=this,{config:t}=e;e.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength(){const e=this,{width:t,height:n}=e.state,i=W.bubbleBaseLength;let a=e.cache.get(i);return a||e.cache.add(i,a=de("min",[t,n])),a},getBubbleR(e){const t=this;let n=t.config.bubble_maxR;z(n)?n=n.bind(t.api)(e):$(n)||(n=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const i=W.bubbleMaxValue;let a=t.cache.get(i);a===null&&t.cache.add(i,a=de("max",t.getMinMaxData().max.map(r=>t.isBubbleZType(r)?t.getBubbleZData(r.value,"y"):tt(r.value)?r.value.mid:r.value)));const s=n*n*Math.PI,o=(t.isBubbleZType(e)?t.getBubbleZData(e.value,"z"):e.value)*(s/a);return Math.sqrt(o/Math.PI)},getBubbleZData(e,t){return tt(e)?e[t]:e[t==="y"?0:1]}},vx=mx,bx={bubble_maxR:35,bubble_zerobased:!1};let hc=()=>(ei([Rn,Bi,vx],[bx,dn]),(hc=()=>O.BUBBLE)());var yx=Object.defineProperty,fc=Object.getOwnPropertySymbols,Tx=Object.prototype.hasOwnProperty,wx=Object.prototype.propertyIsEnumerable,gc=(e,t,n)=>t in e?yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cx=(e,t)=>{for(var n in t||(t={}))Tx.call(t,n)&&gc(e,n,t[n]);if(fc)for(var n of fc(t))wx.call(t,n)&&gc(e,n,t[n]);return e},Sx={generateGetCandlestickPoints(e,t=!1){const n=this,i=t?n.axis.subX:n.axis.x,a=n.getIndicesMax(e)+1,s=n.getBarW("candlestick",i,a),o=n.getShapeX(s,e,!!t),r=n.getShapeY(!!t),l=n.getShapeOffset(n.isCandlestickType,e,!!t),c=n.getYScaleById.bind(n);return(d,u)=>{const h=c.call(n,d.id,t)(n.getShapeYMin(d.id,t)),f=l(d,u)||h,g=$(s)?s:s[d.id]||s._$width,p=n.getCandlestickData(d);let _;if(p&&$(p.open)&&$(p.close)){const x={start:o(d),end:0};x.end=x.start+g;const m={start:r(p.open),end:r(p.close)},b={x:x.start+g/2,high:r(p.high),low:r(p.low)},v=h-f;m.start-=v,m.end-=v,b.high-=v,b.low-=v,_=[[x.start,m.start],[x.end,m.end],[b.x,b.low,b.high]]}else _=[[0,0],[0,0],[0,0,0]];return _}},getCandlestickData({value:e}){let t;if(ot(e)){const[n,i,a,s,o=!1]=e;t={open:n,high:i,low:a,close:s},o!==!1&&(t.volume=o)}else tt(e)&&(t=Cx({},e));return t&&(t._isUp=t.close>=t.open),t||null}},Ax=Object.defineProperty,kx=Object.defineProperties,Lx=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,Rx=Object.prototype.hasOwnProperty,Ex=Object.prototype.propertyIsEnumerable,_c=(e,t,n)=>t in e?Ax(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Px=(e,t)=>{for(var n in t||(t={}))Rx.call(t,n)&&_c(e,n,t[n]);if(pc)for(var n of pc(t))Ex.call(t,n)&&_c(e,n,t[n]);return e},Dx=(e,t)=>kx(e,Lx(t)),Ix=Dx(Px({},Sx),{initCandlestick(){Wr.call(this,{elKey:"candlestick",className:De.chartCandlesticks})},updateTargetsForCandlestick(e){Ya.call(this,e,{type:"Candlestick",elKey:"candlestick",containerClass:De.chartCandlesticks,itemClass:De.chartCandlestick,initFn:this.initCandlestick,withFocus:!1,withStyles:!1}).style("pointer-events","none")},updateCandlestick(e,t=!1){const n=this,{$el:i,$T:a}=n,s=t?i.subchart:i,o=n.getClass("candlestick",!0),r=n.initialOpacity.bind(n),l=s.main.selectAll(`.${De.chartCandlestick}`).selectAll(`.${De.candlestick}`).data(n.labelishData.bind(n));a(l.exit(),e).style("opacity","0").remove();const c=l.enter().filter(d=>d.value).append("g").attr("class",o);c.append("line"),c.append("path"),s.candlestick=l.merge(c).style("opacity",r)},generateDrawCandlestick(e,t){const n=this,{config:i}=n,a=n.generateGetCandlestickPoints(e,t),s=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const d=a(r,l),u=n.getCandlestickData(r),h=u==null?void 0:u._isUp,f=+s,g=+!f;c.classed&&c.classed(De[h?"valueUp":"valueDown"],!0);const p=s?`H${d[1][1]} V${d[1][0]} H${d[0][1]}`:`V${d[1][1]} H${d[1][0]} V${d[0][1]}`;c.select("path").attr("d",`M${d[0][f]},${d[0][g]}${p}z`).style("fill",m=>(h?n.color(m):tt(o)?o[m.id]:o)||n.color(m));const _=c.select("line"),x=s?{x1:d[2][1],x2:d[2][2],y1:d[2][0],y2:d[2][0]}:{x1:d[2][0],x2:d[2][0],y1:d[2][1],y2:d[2][2]};for(const m in x)_.attr(m,x[m])}},redrawCandlestick(e,t,n=!1){const i=this,{$el:a,$T:s}=i,{candlestick:o}=n?a.subchart:a,r=me(!0);return[o.each(function(l,c){const d=s((0,F.select)(this),t,r);e(l,c,d)}).style("opacity",null)]}}),Mx={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"};let xc=()=>(ei([Ix,Rn],[Mx,dn]),(xc=()=>O.CANDLESTICK)());var Wi={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},Fx={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},mc=wt(10);const Ox=15,vc=20,bc=.35;function $x(e=!1){const t=this;return["donut","pie","polar","gauge"].find(n=>t.hasType(n)&&!(n==="gauge"&&e&&t.hasMultiArcGauge()))}function yc(){const e=this,{config:t}=e,n=$x.call(e,!0),i=n&&t[`${n}_label_line`],a=Ut(i),s=(l,c,d)=>d,o={show:i===!0||a&&(i==null?void 0:i.show)!==!1,distance:a&&(i==null?void 0:i.distance)||vc};if(i===!0)return{chartType:n,line:o,text:{formatter:s}};if(!a)return{chartType:n,line:{show:!1,distance:vc},text:{formatter:null}};let r=s;return z(i.text)?r=i.text:i.text===!1&&(r=null),{chartType:n,line:o,text:{formatter:r}}}function Bx(e,t){const n=this,{state:i}=n,a=n.updateAngle(e);if(!a)return null;let{outerRadius:s}=n.getRadius(e),o=s;n.hasType("polar")&&(o=n.getPolarOuterRadius(e,s),s=i.radius);let r=(a.startAngle+a.endAngle)/2;Math.abs(a.endAngle-a.startAngle-2*Math.PI)<.01&&(r=Math.PI/2);const c=Math.sin(r),d=-Math.cos(r),u={x:c*o,y:d*o},h=s+Ox,f={x:c*h,y:d*h},g=c>=0,p={x:f.x+t*(g?1:-1),y:f.y};return{startPoint:u,breakPoint:f,endPoint:p,isRight:g,midAngle:r}}function Tc(){return yc.call(this).line.show}function zx(e){const t=this,{$el:{arcs:n},$T:i}=t,{line:a,text:s}=yc.call(t),o=a.distance;let r=null;n.selectAll(`.${at.chartArc}`).each(function(l){var c,d,u;const h=(0,F.select)(this),f=Bx.call(t,l,o),{ratio:g,meetsThreshold:p,updated:_}=(c=l._cache)!=null?c:{};if(!_||!f)return;const x=t.isTargetToShow(l.data.id)&&p,{startPoint:m,breakPoint:b,endPoint:v,isRight:y}=f,T=`${m.x},${m.y} ${b.x},${b.y} ${v.x},${v.y}`;if(a.show){let C=h.select(`.${at.arcLabelLine}`);C.empty()&&(C=h.append("polyline").attr("class",at.arcLabelLine)),i(C,e).attr("points",T).style("stroke",t.color(l.data)).style("opacity",x?null:"0")}let w=h.select(`.${at.arcLabelLineText}`);if(w.empty()&&(w=h.append("text").attr("class",at.arcLabelLineText).style("pointer-events","none")),x){const{value:C}=_,{id:A}=l.data,S=((u=(d=s.formatter)!=null?d:t.getArcLabelConfig("format"))!=null?u:t.defaultArcValueFormat)(C,g,A).toString();Cn(w,S,[-1,1],!1);const k={x:v.x+5*(y?1:-1),y:v.y};w.style("text-anchor",y?"start":"end");const L=w.node(),E=L==null?void 0:L.querySelectorAll("tspan");if(r===null&&(r=parseFloat(N.getComputedStyle(L).fontSize)||12),E&&E.length>1){const R=(E.length-3)/2;k.y+=(-R+bc)*r}else k.y+=bc*r;i(w,e).attr("transform",`translate(${k.x},${k.y})`).style("opacity",null).style("fill",t.updateTextColor.bind(t)(l))}else i(w,e).style("opacity","0")})}var Nx=Object.defineProperty,Xx=Object.defineProperties,Gx=Object.getOwnPropertyDescriptors,wc=Object.getOwnPropertySymbols,Vx=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,Cc=(e,t,n)=>t in e?Nx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yx=(e,t)=>{for(var n in t||(t={}))Vx.call(t,n)&&Cc(e,n,t[n]);if(wc)for(var n of wc(t))Wx.call(t,n)&&Cc(e,n,t[n]);return e},Hx=(e,t)=>Xx(e,Gx(t));const ds=["donut","gauge","pie","polar"];function jx(e){return["donut","pie","polar","gauge"].find(t=>e.hasType(t))}function Ux(e,t,n,i){var a,s;const{config:o,state:{radiusExpanded:r}}=e,l=n.endAngle-Math.PI/2,c=Math.sin(l),d={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const u=o.arc_rangeText_position;if(u){const h=o.arc_rangeText_values,f=z(u)?u(h[t.index]):u;d.x+=(a=f==null?void 0:f.x)!=null?a:0,d.y+=(s=f==null?void 0:f.y)!=null?s:0}}return d}function Kx(e,t,n,i){const{config:a}=e,s=jx(e);let o=s?a[`${s}_label_ratio`]:void 0;if(o)o=z(o)?o.bind(e.api)(t,n,i):o;else{const u=36/n,h=u>.375;o=n&&i?(h?1.175-u:.8)*n/i:0}return o}function Zx(e,t,n){let{outerRadius:i}=e.getRadius(t);e.hasType("polar")&&(i=e.getPolarOuterRadius(t,i));const[a,s]=e.svgArc.centroid(n).map(l=>isNaN(l)?0:l),o=Math.sqrt(a*a+s*s),r=Kx(e,t,i,o);return{pos:{x:a,y:s},ratio:r}}function Sc(e=0){const t=this,{config:n,state:i}=t,a=t.hasMultiArcGauge(),s=i.gaugeArcWidth/t.getTargetsToShow().length,o=e?Math.min(i.radiusExpanded*e-i.radius,s*.8-(1-e)*100):0;return{inner(r){const{innerRadius:l}=t.getRadius(r);return a?i.radius-s*(r.index+1):$(l)?l:0},outer(r){const{outerRadius:l}=t.getRadius(r);let c;if(a)c=i.radius-s*r.index+o;else if(t.hasType("polar")&&!e)c=t.getPolarOuterRadius(r,l);else if(c=l,e){let{radiusExpanded:d}=i;i.radius!==l&&(d-=Math.abs(i.radius-l)),c=d*e}return c},corner(r,l){const{arc_cornerRadius_ratio:c=0,arc_cornerRadius:d=0}=n,{data:{id:u},value:h}=r;let f;return c?f=c*l:f=$(d)?d:d.call(t.api,u,h,l),f}}}function hs(e){return function(t){const n=({startAngle:a=0,endAngle:s=0,padAngle:o=0})=>({startAngle:a,endAngle:s,padAngle:o}),i=(0,mc.interpolate)(n(this._current),n(t));return this._current=t,function(a){const s=i(a),{data:o,index:r,value:l}=t;return e(Hx(Yx({},s),{data:o,index:r,value:l}))}}}var qx={initPie(){const e=this,{config:t}=e,n=t.data_type,i=t[`${n}_padding`],a=t[`${n}_startingAngle`]||0,s=(i?i*.01:t[`${n}_padAngle`])||0;e.pie=(0,pt.pie)().startAngle(a).endAngle(a+2*Math.PI).padAngle(s).value(o=>{var r,l;return(l=(r=o.values)==null?void 0:r.reduce((c,d)=>c+d.value,0))!=null?l:o}).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius(){const e=this,{config:t,state:n}=e,i=t.data_type,a=t[`${i}_padding`],s=t.gauge_width||t.donut_width,o=e.getTargetsToShow().length*t.gauge_arcs_minWidth,r=.85,l=Tc.call(e)?r:1;n.radiusExpanded=Math.min(n.arcWidth,n.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?r:l),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 c=t.pie_innerRadius||(a?a*(n.innerRadiusRatio+.1):0);n.outerRadius=t.pie_outerRadius,n.innerRadius=e.hasType("donut")||e.hasType("gauge")?n.radius*n.innerRadiusRatio:c},getRadius(e){const t=this,n=e==null?void 0:e.data;let{innerRadius:i,outerRadius:a}=t.state;return!$(i)&&n&&(i=i[n.id]||0),tt(a)&&n&&n.id in a?a=a[n.id]:$(a)||(a=t.state.radius),{innerRadius:i,outerRadius:a}},updateArc(){const e=this;e.updateRadius(),e.svgArc=e.getSvgArc(),e.svgArcExpanded=e.getSvgArcExpanded()},getArcLength(){const e=this,{config:t}=e,n=t.gauge_arcLength*3.6;let i=2*(n/360);return n<-360?i=-2:n>360&&(i=2),i*Math.PI},getStartingAngle(){const e=this,{config:t}=e,n=t.data_type,i=e.hasType("gauge")?t.gauge_fullCircle:!1,a=-1*Math.PI/2,s=Math.PI/2;let o=t[`${n}_startingAngle`]||0;return!i&&o<=a?o=a:!i&&o>=s?o=s:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(e,t=!1){var n;const i=this,{config:a,state:s}=i,o=t&&i.hasType("gauge");let{pie:r}=i,l=e,c=!1;if(!a)return null;const d=i.getStartingAngle(),u=a.gauge_fullCircle||t&&!o?i.getArcLength():d*-2,h=l.data&&i.isGaugeType(l.data)&&!i.hasMultiArcGauge();if(h){const{gauge_min:f,gauge_max:g}=a,p=i.getTotalDataSum(s.rendered),_=u*((p-f)/(g-f));r=r.startAngle(d).endAngle(_+d)}if(t===!1){let f;if(h)f=r(i.filterTargetsToShow());else{const g="$arcPieLayout";let p=i.cache.get(g);(!p||p.generation!==s.redrawGeneration)&&(p={generation:s.redrawGeneration,layout:r(i.filterTargetsToShow())},i.cache.add(g,p)),f=p.layout}f.forEach((g,p)=>{var _;!c&&g.data.id===((_=l.data)==null?void 0:_.id)&&(c=!0,l=g,l.index=p)})}if(isNaN(l.startAngle)&&(l.startAngle=0),isNaN(l.endAngle)&&(l.endAngle=l.startAngle),t||l.data&&(a.gauge_enforceMinMax||i.hasMultiArcGauge())){const{gauge_min:f,gauge_max:g}=a,p=t&&!o?i.getTotalDataSum(s.rendered):g,_=u/(p-f),x=(n=l.value)!=null?n:0,m=x<f?0:x<p?x-f:p-f;l.startAngle=d,l.endAngle=d+_*m}return c||t?l:null},getSvgArc(){const e=this,{inner:t,outer:n,corner:i}=Sc.call(e),a=(0,pt.arc)().innerRadius(t).outerRadius(n),s=function(o,r){var l;let c="M 0 0";if(o.value||o.data){const d=r?o:(l=e.updateAngle(o))!=null?l:null;d&&(c=a.cornerRadius(i(d,n(d)))(d))}return c};return s.centroid=a.centroid,s},getSvgArcExpanded(e=1){const t=this,{inner:n,outer:i,corner:a}=Sc.call(t,e),s=(0,pt.arc)().innerRadius(n).outerRadius(i);return o=>{const r=t.updateAngle(o),l=i(r);let c=0;return r&&(c=a(r,l)),r&&s.cornerRadius(c)(r)||"M 0 0"}},getArc(e,t,n){return n||this.isArcType(e.data)?this.svgArc(e,t):"M 0 0"},redrawArcRangeText(){const e=this,{config:t,$el:{arcs:n},state:i,$T:a}=e,s=t.arc_rangeText_format,o=e.hasType("gauge")&&t.arc_rangeText_fixed;let r=t.arc_rangeText_values;if(r!=null&&r.length){const l=t.arc_rangeText_unit==="%",c=e.getTotalDataSum(i.rendered);l&&(r=r.map(h=>c/100*h));const d=e.pie(r).map((h,f)=>(h.index=f,h));let u=n.selectAll(`.${at.arcRange}`).data(r);u.exit().remove(),u=a(u.enter().append("text").attr("class",at.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const f=l?h/c*100:h;return z(s)?s(f):`${f}${l?"%":""}`}).merge(u)),(!i.rendered||i.rendered&&!o)&&c>0&&u.attr("transform",function(h,f){return e.transformForArcLabel(this,d[f],!0)}),u.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t,n=!1){const i=this,a=i.updateAngle(t,n);if(!a)return"";let s,o=1;if(n||i.hasMultiArcGauge())s=Ux(i,t,a,n);else if(!i.hasType("gauge")||i.data.targets.length>1){const r=Zx(i,t,a);s=r.pos,o=r.ratio}else return"";return zr.call(i,e,s),`translate(${s.x*o},${s.y*o})`},convertToArcData(e){return this.addName({id:"data"in e?e.data.id:e.id,value:e.value,ratio:this.getRatio("arc",e),index:e.index})},textForArcLabel(e){var t;const n=this,i=n.hasType("gauge"),a=(t=ds.filter(n.hasType.bind(n)))==null?void 0:t[0];n.shouldShowArcLabel()&&e.style("fill",n.updateTextColor.bind(n)).attr("filter",s=>n.updateTextBGColor.bind(n)(s,n.config.data_labels_backgroundColors)).each(function(s){const o=(0,F.select)(this),r=n.updateAngle(s),l=n.getRatio("arc",r),c=Ga.call(n,l,a);if(s._cache={updated:r,ratio:l,meetsThreshold:c},c){const{value:d}=r||s,u=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(d,l,s.data.id).toString();Cn(o,u,[-1,1],i)}else o.text("")})},expandArc(e){const t=this,{state:{transiting:n},$el:i}=t;if(n){const s=setInterval(()=>{t.state.transiting||(clearInterval(s),i.legend.selectAll(`.${lt.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const a=t.mapToTargetIds(e);i.svg.selectAll(t.selectorTargets(a,`.${at.chartArc}`)).each(function(s){if(!t.shouldExpand(s.data.id))return;const o=t.getExpandConfig(s.data.id,"duration"),r=t.getSvgArcExpanded(t.getExpandConfig(s.data.id,"rate"));(0,F.select)(this).selectAll("path").transition().duration(o).attrTween("d",hs(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",hs(r.bind(t)))})},unexpandArc(e){const t=this,{state:{transiting:n},$el:{svg:i}}=t;if(n)return;const a=t.mapToTargetIds(e);i.selectAll(t.selectorTargets(a,`.${at.chartArc}`)).selectAll("path").transition().duration(s=>t.getExpandConfig(s.data.id,"duration")).attrTween("d",hs(t.svgArc.bind(t))),i.selectAll(`${at.arc}`).style("opacity",null)},getExpandConfig(e,t){const n=this,{config:i}=n,a={duration:50,rate:.98};let s;return n.isDonutType(e)?s="donut":n.isGaugeType(e)?s="gauge":n.isPieType(e)&&(s="pie"),s?i[`${s}_expand_${t}`]:a[t]},shouldExpand(e){const t=this,{config:n}=t,i=t.isDonutType(e)?"donut":t.isGaugeType(e)?"gauge":t.isPieType(e)?"pie":null;return i?!!n[`${i}_expand`]:!1},shouldShowArcLabel(){const e=this,{config:t}=e;return ds.some(n=>e.hasType(n)&&t[`${n}_label_show`])},getArcLabelConfig(e="format"){const t=this,{config:n}=t;let i=a=>a;return ds.filter(t.hasType.bind(t)).forEach(a=>{i=n[`${a}_label_${e}`]}),e==="format"&&z(i)?i.bind(t.api):i},updateTargetsForArc(e){const t=this,{$el:n}=t,i=t.hasType("gauge"),a=t.getChartClass("Arc"),s=t.getClass("arcs",!0),o=t.classFocus.bind(t),r=n.main.select(`.${at.chartArcs}`),l=r.selectAll(`.${at.chartArc}`).data(t.pie(e)).attr("class",d=>a(d)+o(d.data)),c=l.enter().append("g").attr("class",a).call(this.setCssRule(!1,`.${at.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));c.append("g").attr("class",s).merge(l),c.append("text").attr("dy",i&&!t.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",t.getStylePropValue("middle")).style("pointer-events",t.getStylePropValue("none")),n.text=r.selectAll(`.${U.target} text`)},initArc(){const e=this,{$el:t}=e;t.arcs=t.main.select(`.${U.chart}`).append("g").attr("class",at.chartArcs).attr("transform",e.getTranslate("arc")),e.setArcTitle()},setArcTitle(e){const t=this,n=e||t.getArcTitle(),i=t.hasType("gauge");if(n){const a=i?ae.chartArcsGaugeTitle:at.chartArcsTitle;let s=t.$el.arcs.select(`.${a}`);s.empty()&&(s=t.$el.arcs.append("text").attr("class",a).style("text-anchor","middle")),i&&s.attr("dy","-0.3em"),Cn(s,n,i?void 0:[-.6,1.35],!0)}},getArcTitle(){const e=this,t=e.hasType("donut")&&"donut"||e.hasType("gauge")&&"gauge";return t?e.config[`${t}_title`]:""},getArcTitleWithNeedleValue(){const e=this,{config:t,state:n}=e,i=e.getArcTitle();if(i&&e.config.arc_needle_show&&/{=[A-Z_]+}/.test(i)){let a=n.current.needle;return $(a)||(a=t.arc_needle_value),an(i,{NEEDLE_VALUE:~~a})}return!1},redrawArc(e,t,n){const i=this,{config:a,state:s,$el:{main:o}}=i,r=a.interaction_enabled,l=r&&a.data_selection_isselectable;let c=o.selectAll(`.${at.arcs}`).selectAll(`.${at.arc}`).data(i.arcData.bind(i));c.exit().transition().duration(t).style("opacity","0").remove(),c=c.enter().append("path").attr("class",i.getClass("arc",!0)).style("fill",d=>i.color(d.data)).style("cursor",d=>{var u;return(u=l==null?void 0:l.bind)!=null&&u.call(l,i.api)(d)?"pointer":null}).style("opacity","0").each(function(d){i.isGaugeType(d.data)&&(d.startAngle=a.gauge_startingAngle,d.endAngle=a.gauge_startingAngle),this._current=d}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",d=>!i.isGaugeType(d.data)&&n?"scale(0)":"").style("opacity",function(d){return d===this._current?"0":null}).each(()=>{s.transiting=!0}).transition().duration(e).attrTween("d",function(d){const u=i.updateAngle(d);if(!u)return()=>"M 0 0";isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const h=(0,mc.interpolate)(this._current,u);return this._current=h(0),function(f){const g=h(f);return g.data=d.data,i.getArc(g,!0)}}).attr("transform",n?"scale(1)":"").style("fill",d=>{let u;return i.levelColor?(u=i.levelColor(d.data.values[0].value),a.data_colors[d.data.id]=u):u=i.color(d.data),u}).style("opacity",null).call(ri,function(){if(i.levelColor){const d=(0,F.select)(this),u=d.datum(this._current);i.updateLegendItemColor(u.data.id,d.style("fill"))}s.transiting=!1,s.redrawing&&(s.redrawing=!1,s._targetsToShow=null,s._cachedDrawShape=null),H(a.onrendered,i.api)}),r&&i.bindArcEvent(c),i.hasType("polar")&&i.redrawPolar(),i.hasType("gauge")&&i.redrawBackgroundArcs(),a.arc_needle_show&&i.redrawNeedle(),i.redrawArcText(e),i.redrawArcRangeText()},redrawNeedle(){const e=this,{$el:t,config:n,state:{hiddenTargetIds:i,radius:a}}=e,s=(a-1)/100*n.arc_needle_length,o=i.size!==e.data.targets.length;let r=e.$el.arcs.select(`.${at.needle}`);const l=n.arc_needle_path,c=n.arc_needle_bottom_width/2,d=n.arc_needle_top_width/2,u=n.arc_needle_top_rx,h=n.arc_needle_top_ry,f=n.arc_needle_bottom_len,g=n.arc_needle_bottom_rx,p=n.arc_needle_bottom_ry,_=e.getNeedleAngle(),x=()=>{const m=e.getArcTitleWithNeedleValue();m&&e.setArcTitle(m)};if(x(),r.empty()&&(r=t.arcs.append("path").classed(at.needle,!0),t.needle=r,t.needle.updateHelper=(m,b=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(ri,()=>{b&&(n.arc_needle_value=m),x()})}),o){const m=z(l)?l.call(e,s):`M-${c} ${f} A${g} ${p} 0 0 0 ${c} ${f} L${d} -${s} A${u} ${h} 0 0 0 -${d} -${s} L-${c} ${f} Z`;e.$T(r).attr("d",m).style("fill",n.arc_needle_color).style("display",null).style("transform",`rotate(${_}deg)`)}else r.style("display","none")},getNeedleAngle(e){const t=this,{config:n,state:i}=t,a=t.getArcLength(),s=t.hasType("gauge"),o=t.getTotalDataSum(!0);let r=ct(e)?e:n.arc_needle_value,l=n[`${n.data_type}_startingAngle`]||0,c;if($(r)||(r=s&&t.data.targets.length===1?o:0),i.current.needle=r,s){l=t.getStartingAngle();const d=n.gauge_fullCircle?a:l*-2,{gauge_min:u,gauge_max:h}=n;c=d*((r-u)/(h-u))}else c=o?a*(r/o):0;return(l+c)*(180/Math.PI)},redrawBackgroundArcs(){const e=this,{config:t,state:n}=e,i=e.hasMultiArcGauge(),a=t.gauge_fullCircle,s=e.getTargetsToShow().length===0&&!!t.data_empty_label_text,o=e.getStartingAngle(),r=a?o+e.getArcLength():o*-1;let l=e.$el.arcs.select(`${i?"g":""}.${at.chartArcsBackground}`);if(i){let c=0;l=l.selectAll(`path.${at.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(d,u)=>`${at.chartArcsBackground} ${at.chartArcsBackground}-${u}`).merge(l).style("fill",t.gauge_background||null).attr("d",({id:d})=>{if(s||n.hiddenTargetIds.has(d))return"M 0 0";const u={data:[{value:t.gauge_max}],startAngle:o,endAngle:r,index:c++};return e.getArc(u,!0,!0)}),l.exit().remove()}else l.attr("d",s?"M 0 0":()=>{const c={data:[{value:t.gauge_max}],startAngle:o,endAngle:r};return e.getArc(c,!0,!0)})},bindArcEvent(e){const t=this,{config:n,state:i}=t,a=i.inputType==="touch",s=i.inputType==="mouse",o=c=>{const d=t.updateAngle(c);return d?t.convertToArcData(d):null};function r(c,d,u){t.expandArc(u),t.api.focus(u),t.toggleFocusLegend(u,!0),t.showTooltip([d],c)}function l(c){const d=(c==null?void 0:c.id)||void 0;t.unexpandArc(d),t.api.revert(),t.revertLegend(),t.hideTooltip()}if(e.on("click",function(c,d,u){var h;const f=o(d);f&&((h=t.toggleShape)==null||h.call(t,this,f,u),n.data_onclick.bind(t.api)(f,this))}),s&&e.on("mouseover",function(c,d){if(i.transiting)return;i.event=c;const u=o(d),h=(u==null?void 0:u.id)||void 0;r(this,u,h),t.setOverOut(!0,u)}).on("mouseout",(c,d)=>{if(i.transiting||!n.interaction_onout)return;i.event=c;const u=o(d);l(),t.setOverOut(!1,u)}).on("mousemove",function(c,d){const u=o(d);i.event=c,t.showTooltip([u],this)}),a&&t.hasArcType()&&!t.radars){const c=d=>{var u,h;const{clientX:f,clientY:g}=(h=(u=d.changedTouches)==null?void 0:u[0])!=null?h:{clientX:0,clientY:0};return(0,F.select)(nt.elementFromPoint(f,g))};t.$el.svg.on("touchstart touchmove",function(d){if(i.transiting)return;i.event=d;const h=c(d).datum(),f=h!=null&&h.data&&h.data.id?t.updateAngle(h):null,g=f?t.convertToArcData(f):null,p=(g==null?void 0:g.id)||void 0;t.callOverOutForTouch(g),Ct(p)?l():r(this,g,p)},{passive:!0})}},redrawArcText(e){const t=this,{config:n,state:i,$el:{main:a,arcs:s}}=t,o=t.hasType("gauge"),r=t.hasMultiArcGauge();let l;if(o&&t.data.targets.length===1&&n.gauge_title||(l=a.selectAll(`.${at.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?ae.gaugeValue:null).call(t.textForArcLabel.bind(t)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(i.radius/5)}px`:null),Br.call(t),l.attr("transform",function(c){return t.transformForArcLabel.bind(t)(this,c)}).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),a.select(`.${at.chartArcsTitle}`).style("opacity",t.hasType("donut")||o?null:"0"),o){const c=n.gauge_fullCircle;c&&(l==null||l.attr("dy",`${r?0:Math.round(i.radius/14)}`)),n.gauge_label_show&&(s.select(`.${ae.chartArcsGaugeUnit}`).attr("dy",`${c?1.5:.75}em`).text(n.gauge_units),s.select(`.${ae.chartArcsGaugeMin}`).attr("dx",`${-1*(i.innerRadius+(i.radius-i.innerRadius)/(c?1:2))}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_min,!1)),!c&&s.select(`.${ae.chartArcsGaugeMax}`).attr("dx",`${i.innerRadius+(i.radius-i.innerRadius)/2}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_max,!0)))}Tc.call(t)&&zx.call(t,e)},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:n}}=t,i=$(e)?a=>a.index===e:a=>a.data.id===e;return n==null?void 0:n.selectAll(`.${U.target} path`).filter(i)}};function Pn(e,t){St(pe.prototype,[qx,Rn].concat(e||[])),cn.setOptions([dn].concat(t||[]))}let Ac=()=>(Pn(void 0,[Wi,Fx]),(Ac=()=>O.DONUT)());var Jx=Object.defineProperty,kc=Object.getOwnPropertySymbols,Qx=Object.prototype.hasOwnProperty,tm=Object.prototype.propertyIsEnumerable,Lc=(e,t,n)=>t in e?Jx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,em=(e,t)=>{for(var n in t||(t={}))Qx.call(t,n)&&Lc(e,n,t[n]);if(kc)for(var n of kc(t))tm.call(t,n)&&Lc(e,n,t[n]);return e};function Dn(e=!1){const t=this,{config:n,state:{current:{width:i,height:a}}}=t,s=t.getCurrentPadding(),o=em({width:i-s.left-s.right,height:a-(n.legend_show?t.getLegendHeight()+10:0)-s.top-s.bottom},s);if(e){const r=fs.call(t,o),l=n.funnel_rotated;o.width=Math.max(o.width,l?r.height:r.width),o.height=Math.max(o.height,l?r.width:r.height)}return o}function fs(e){const t=this,{config:n}=t,i=n.funnel_rotated,[a,s]=[n.funnel_neck_width,n.funnel_neck_height].map((o,r)=>tt(o)?e[i!==!r?"width":"height"]*o.ratio:o);return{width:a,height:s}}function nm(e){const t=this,n=t.config.funnel_rotated,{width:i,height:a}=Dn.call(t,!0),s=[];return e.forEach((o,r)=>{const{ratio:l=0}=o,c=r>0?s[r-1][2][n?0:1]:0,d=l+c;s.push(o.coords=n?[[c,0],[d,0],[d,a],[c,a],[c,0]]:[[0,c],[i,c],[i,d],[0,d],[0,c]])}),s}function im(){const e=this,t=e.config.funnel_rotated,{width:n,height:i}=Dn.call(e,!0),a=fs.call(e,{width:n,height:i});let s;if(t){const o=(i-a.width)/2,r=n-a.height;s=[[r,o],[n,o],[n,i-o],[r,i-o],[0,i]]}else{const o=(n-a.width)/2,r=i-a.height;s=[[n,0],[n-o,r],[n-o,i],[o,i],[o,r]]}return`M${[[0,0],...s,[0,0]].join("L")}z`}function am(e){const t=this,{config:n}=t,i=e.map(a=>({id:a.id,value:a.values.reduce((s,o)=>s+o.value,0)}));return n.data_order&&i.sort(t.getSortCompareFn.bind(t)(!0)),Rc.call(t,i)}function Rc(e){const t=this,{width:n,height:i}=Dn.call(t),a=t.getTotalDataSum(!0),s=t.config.funnel_rotated?n:i;return e.forEach(o=>{o.ratio=o.value/a*s}),e}function sm(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ec(e,t,n,i,a){const s=[];for(let r=0;r<=20;r++){const l=r/20,c=e+(t-e)*l,d=n+(i-n)*sm(l);s.push(a?[c,d]:[d,c])}return s}function om(){var e;const t=this,n=t.config.funnel_rotated,{width:i,height:a}=Dn.call(t,!0),s=fs.call(t,{width:i,height:a}),o=(0,pt.line)().x(f=>f[0]).y(f=>f[1]).curve(pt.curveLinear),r=(n?a-s.width:i-s.width)/2,l=n?i-s.height:a-s.height,c=Ec(0,l,n?0:i,n?r:i-r,n),d=[];if(s.height>0&&(c.push(n?[i,r]:[i-r,a]),d.push(n?[i,a-r]:[r,a])),d.push(...Ec(l,0,n?a-r:r,n?a:0,n)),c.length>1){const[f,g]=n?[1,0]:[0,1];c.splice(1,0,[c[f][0],c[g][1]]);const p=d.length-1;p>0&&d.splice(p,0,[d[p-f][0],d[p-g][1]])}const u=o(c)||"",h=((e=o(d))==null?void 0:e.replace(/^M/,"L"))||"";return n?`${u}${h}z`:`M0,0${u.replace(/^M/,"L")}${h}z`}var rm={initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${U.chart}`).append("g").classed(Un.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(Un.funnelBackground,!0),e.bindFunnelEvent()},bindFunnelEvent(){const e=this,{$el:{funnel:t},config:n,state:i}=e;if(!n.interaction_enabled)return;const a=o=>{var r;const l=o.isTrusted?o.target:(r=i.eventReceiver.rect)==null?void 0:r.node();if(l&&/^path$/i.test(l.tagName))return i.event=o,(0,F.select)(l).datum()},s=i.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.target),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})},updateTargetsForFunnel(e){const t=this,{$el:{funnel:n}}=t;n||t.initFunnel();const i=t.getChartClass("Funnel"),a=t.getClass("funnel",!0),s=am.call(t,e.filter(t.isFunnelType.bind(t))),o=t.filterNullish(s),r=n.selectAll(`.${Un.chartFunnel}`).data(o);r.exit().remove();const l=r.enter().insert("g",`.${Un.funnelBackground}`);l.append("path"),n.path=l.merge(r).attr("class",i).select("path").attr("class",a).style("opacity","0").style("fill",t.color)},updateFunnel(e){const t=this,{$el:{funnel:n}}=t,i=e.map(({id:a})=>a);n.path=n.path.filter(a=>i.includes(a.id))},generateGetFunnelPoints(){const e=this,{config:t,$el:{funnel:n}}=e,i=t.funnel_rotated,a=e.filterTargetsToShow(n.path),{top:s,left:o,width:r,height:l}=Dn.call(e),c={};let d=0;return a.each(u=>{const h=d,{ratio:f}=u;d+=f;const g=i?o:s,p=g+h,_=g+d,x=(p+_)/2,m=i?s+l/2:o+r/2;c[u.id]=i?[[p,m],[_,m],[x,m]]:[[m,p],[m,_],[m,x]]}),u=>c[u.id]},redrawFunnel(){const e=this,{config:t,$T:n,$el:{funnel:i}}=e,a=e.filterTargetsToShow(i.path),s=nm.call(e,Rc.call(e,a.data())),{top:o,left:r}=Dn.call(e),l=(t.funnel_spline?om:im).call(e);i.attr("transform",`translate(${r}, ${o})`).attr("clip-path",`path('${l}')`),i.background.attr("d",l),n(a).attr("d",(c,d)=>`M${s[d].join("L")}z`).style("opacity","1"),i.selectAll("g").style("opacity",null)}},lm={funnel_neck_width:0,funnel_neck_height:0,funnel_rotated:!1,funnel_spline:!1};let Pc=()=>(Pn([rm],[lm]),(Pc=()=>O.FUNNEL)());var cm={initGauge(){const e=this,{config:t,$el:{arcs:n}}=e,i=(a=null,s="")=>{n.append("text").attr("class",a).style("text-anchor","middle").style("pointer-events","none").text(s)};if(e.hasType("gauge")){const a=e.hasMultiArcGauge();n.append(a?"g":"path").attr("class",at.chartArcsBackground).style("fill",!a&&t.gauge_background||null),t.gauge_units&&i(ae.chartArcsGaugeUnit),t.gauge_label_show&&(i(ae.chartArcsGaugeMin),!t.gauge_fullCircle&&i(ae.chartArcsGaugeMax))}},updateGaugeMax(){const e=this,{config:t,state:n}=e,a=e.hasMultiArcGauge()?e.getMinMaxData().max[0].value:e.getTotalDataSum(n.rendered);!t.gauge_enforceMinMax&&a+t.gauge_min*(t.gauge_min>0?-1:1)>t.gauge_max&&(t.gauge_max=a-t.gauge_min)},redrawArcGaugeLine(){const e=this,{config:t,state:n,$el:i}=e,{hiddenTargetIds:a}=e.state,s=i.main.selectAll(`.${at.arcs}`).selectAll(`.${at.arcLabelLine}`).data(e.arcData.bind(e));s.enter().append("rect").attr("class",r=>`${at.arcLabelLine} ${U.target} ${U.target}-${r.data.id}`).merge(s).style("fill",r=>e.levelColor?e.levelColor(r.data.values[0].value):e.color(r.data)).style("display",t.gauge_label_show?null:"none").each(function(r){let l=0;const c=2;let d=0,u=0,h="";if(!a.has(r.data.id)){const f=e.updateAngle(r),g=n.gaugeArcWidth/e.getTargetsToShow().length*(f.index+1),p=f.endAngle-Math.PI/2,_=n.radius-g,x=p-(_===0?0:1/_);l=n.radiusExpanded-n.radius+g,d=Math.cos(x)*_,u=Math.sin(x)*_,h=`rotate(${p*180/Math.PI}, ${d}, ${u})`}(0,F.select)(this).attr("x",d).attr("y",u).attr("width",l).attr("height",c).attr("transform",h).style("stroke-dasharray",`0, ${l+c}, 0`)})},textForGaugeMinMax(e,t){const n=this,{config:i}=n,a=i.gauge_label_extents;return z(a)?a.bind(n.api)(e,t):e},getGaugeLabelHeight(){const{config:e}=this;return this.config.gauge_label_show&&!e.gauge_fullCircle?20:0},getPaddingBottomForGauge(){return this.getGaugeLabelHeight()*2}},um={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 Dc=()=>(Pn([cm],[Wi,um]),(Dc=()=>O.GAUGE)()),Ic=()=>(Fe(),(Ic=()=>O.LINE)()),Mc=()=>(Fe(void 0,[es]),(Mc=()=>O.SPLINE)()),Fc=()=>(Fe(),(Fc=()=>O.STEP)());var dm={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 Oc=()=>(Pn(void 0,[Wi,dm]),(Oc=()=>O.PIE)());function $c(e){const t=e.config.polar_level_max;let n=e.getMinMaxData().max[0].value;return t&&t>n&&(n=t),n}var hm={initPolar(){const e=this,{$el:{arcs:t},config:n}=e,i=n.polar_level_text_show,a=n.polar_level_text_backgroundColor;t.levels=t.append("g").attr("class",Me.levels),i&&a&&e.generateTextBGColorFilter(a)},getPolarOuterRadius(e,t){var n;const i=$c(this);return((n=e==null?void 0:e.data.values[0].value)!=null?n:0)/i*t},updateTargetsForPolar(e){this.updateTargetsForArc(e)},redrawPolar(){const e=this,{config:t}=e;t.polar_level_show&&e.updatePolarLevel()},updatePolarLevel(){const e=this,{config:t,state:n,$el:{arcs:{levels:i}}}=e,a=t.polar_level_depth,s=$c(e),o=li(0,a),r=n.radius,l=o.map(h=>r*((h+1)/a)),c=(t.polar_level_text_format||function(){}).bind(e.api),d=i.selectAll(`.${Me.level}`).data(o);d.exit().remove();const u=d.enter().append("g").attr("class",(h,f)=>`${Me.level} ${Me.level}-${f}`);if(u.append("circle"),u.merge(d).selectAll("circle").style("visibility",t.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>l[h]),t.polar_level_text_show){const h=t.polar_level_text_backgroundColor,f=`#${n.datetimeId}-labels-bg${e.getTargetSelectorSuffix(h)}`;u.append("text").style("text-anchor","middle"),u.merge(d).selectAll("text").attr("dy",g=>-l[g]+5).attr("filter",h?`url(${f})`:null).text(g=>c(s/o.length*(g+1)))}}},fm={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:e=>e%1===0?e:e.toFixed(2),polar_level_text_show:!0,polar_padAngle:0,polar_padding:0,polar_startingAngle:0};let Bc=()=>(Pn([hm],[Wi,fm]),(Bc=()=>O.POLAR)());function gm(e,t,n,i,a,s){const o=e&&i>0?n-i:i,r=2*Math.PI;return a*(1-s*(t==="x"?Math.sin:Math.cos)(o*r/n))}const In=W.radarPoints,zc=W.radarTextWidth;var pm={initRadar(){const e=this,{config:t,state:{current:n},$el:i}=e;e.hasType("radar")&&(i.radar=i.main.select(`.${U.chart}`).append("g").attr("class",er.chartRadars),i.radar.levels=i.radar.append("g").attr("class",Me.levels),i.radar.axes=i.radar.append("g").attr("class",It.axis),i.radar.shapes=i.radar.append("g").attr("class",kt.shapes),n.dataMax=t.radar_axis_max||e.getMinMaxData().max[0].value,t.radar_axis_text_show&&(t.interaction_enabled&&e.bindRadarEvent(),e.updateRadarLevel(),e.updateRadarAxes()))},getRadarSize(){const e=this,{config:t,state:{arcWidth:n,arcHeight:i}}=e,a=t.axis_x_categories.length<4?-20:10,s=(Math.min(n,i)-a)/2;return[s,s]},updateTargetsForRadar(e){const t=this,{config:n}=t;se(n.axis_x_categories)&&(n.axis_x_categories=li(0,de("max",e.map(i=>i.values.length)))),t.generateRadarPoints()},getRadarPosition(e,t,n,i){const a=this,{config:s}=a,[o,r]=a.getRadarSize(),l=s.axis_x_categories.length,c=s.radar_direction_clockwise,d=nn(e).map(u=>gm(c,u,l,t,ct(n)?n:e==="x"?o:r,$(i)?i:s.radar_size_ratio));return d.length===1?d[0]:d},generateRadarPoints(){const e=this,t=e.data.targets,[n,i]=e.getRadarSize(),a=e.cache.get(In)||{},s=a._size;(!s||s.width!==n&&s.height!==i)&&(t.forEach(o=>{a[o.id]=o.values.map((r,l)=>e.getRadarPosition(["x","y"],l,void 0,e.getRatio("radar",r)))}),a._size={width:n,height:i},e.cache.add(In,a))},redrawRadar(){const e=this,{radar:t,main:n}=e.$el,i=e.getTranslate("radar");i&&(t.attr("transform",i),n.select(`.${Et.chartTexts}`).attr("transform",i),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(In);return(t,n)=>{const i=e[t.id][n];return[i,i,i,i]}},updateRadarLevel(){const e=this,{config:t,state:n,$el:{radar:i}}=e,[a,s]=e.getRadarSize(),o=t.radar_level_depth,r=t.axis_x_categories.length,l=t.radar_level_text_show,c=i.levels,d=li(0,o),u=t.radar_size_ratio*Math.min(a,s),h=d.map(x=>u*((x+1)/o)),f=(t.radar_level_text_format||function(){}).bind(e.api),g=d.map(x=>{const m=h[x];return li(0,r).map(v=>e.getRadarPosition(["x","y"],v,m,1).join(",")).join(" ")}),p=c.selectAll(`.${Me.level}`).data(d);p.exit().remove();const _=p.enter().append("g").attr("class",(x,m)=>`${Me.level} ${Me.level}-${m}`);_.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),l&&(c.select("text").empty()&&c.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>f(0)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(x=>f(n.current.dataMax/d.length*(x+1)))),_.merge(p).attr("transform",x=>`translate(${a-h[x]}, ${s-h[x]})`).selectAll("polygon").attr("points",x=>g[x]),l&&c.selectAll("text").attr("x",x=>Ct(x)?a:g[x].split(",")[0]).attr("y",x=>Ct(x)?s:0)},updateRadarAxes(){const e=this,{config:t,$el:{radar:n}}=e,[i,a]=e.getRadarSize(),s=t.axis_x_categories;let o=n.axes.selectAll("g").data(s);o.exit().remove();const r=o.enter().append("g").attr("class",(l,c)=>`${It.axis}-${c}`);if(t.radar_axis_line_show&&r.append("line"),t.radar_axis_text_show&&r.append("text"),o=r.merge(o),t.radar_axis_line_show&&o.select("line").attr("x1",i).attr("y1",a).attr("x2",(l,c)=>e.getRadarPosition("x",c)).attr("y2",(l,c)=>e.getRadarPosition("y",c)),t.radar_axis_text_show){const{x:l=0,y:c=0}=t.radar_axis_text_position,d=e.cache.get(zc)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(u=>{u.each(function(h){Cn((0,F.select)(this),String(h),[-.6,1.2])})}).datum((u,h)=>({index:h})).attr("transform",function(u){Ct(this.width)&&(this.width=ht(this,!0).width/2);let h=e.getRadarPosition("x",u.index,void 0,1),f=Math.round(e.getRadarPosition("y",u.index,void 0,1));return h>i?h+=this.width+l:Math.round(h)<i&&(h-=this.width+l),f>a?(f/2===a&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),f+=c):f<a&&(f-=c),`translate(${h} ${f})`}),!d){const u=[n.axes,n.levels].map(h=>ur(h.node()).width);u.every(h=>h>0)&&e.cache.add(zc,u[0]-u[1])}}},bindRadarEvent(){const e=this,{config:t,state:n,$el:{radar:i,svg:a}}=e,s=e.isPointFocusOnly(),{inputType:o,transiting:r}=n,l=o==="mouse",c=d=>{if(n.event=d,!t.interaction_onout)return;const u=e.getDataIndexFromEvent(d),h=Ct(u);(l||h)&&(e.hideTooltip(),s?e.hideCircleFocus():e.unexpandCircles(),l?e.setOverOut(!1,u):h&&e.callOverOutForTouch())};i.axes.on(l?"mouseover ":"touchstart",d=>{if(r)return;n.event=d;const u=e.getDataIndexFromEvent(d);e.selectRectForSingle(a.node(),u),l?e.setOverOut(!0,u):e.callOverOutForTouch(u)},l?void 0:{passive:!0}).on("mouseout",l?c:null),l||a.on("touchstart",c,{passive:!0})},updateRadarShape(){const e=this,t=e.data.targets.filter(s=>e.isRadarType(s)),n=e.cache.get(In),i=e.$el.radar.shapes.selectAll("polygon").data(e.filterNullish(t)),a=i.enter().append("g").attr("class",e.getChartClass("Radar"));e.$T(i.exit()).remove(),a.append("polygon").merge(i).style("fill",e.color).style("stroke",e.color).attr("points",s=>n[s.id].join(" ")),e.updateTargetForCircle(t,a)},radarCircleX(e){return this.cache.get(In)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(In)[e.id][e.index][1]}},_m={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:e=>e%1===0?e:e.toFixed(2),radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1};let Nc=()=>(Pn([ec.eventrect,Bi,pm],[dn,_m,{axis_x_categories:nc.optAxis.axis_x_categories}]),(Nc=()=>O.RADAR)());var xm={scatter_zerobased:!1};let Xc=()=>(ei([Rn,Bi],[dn,xm]),(Xc=()=>O.SCATTER)());var Oe=wt(11);function mm(e){const t=this;return e.map(n=>{const{id:i,values:a}=n,{value:s}=a[0];return{name:i,id:i,value:s,ratio:t.getRatio("treemap",a[0])}})}var vm={initTreemapLayout(){this.treemap=(0,Oe.treemap)().tile(this.getTreemapTile())},getTreemapTile(){var e,t;const n=this,{config:i,state:{current:{width:a,height:s}}}=n,o=(t={binary:Oe.treemapBinary,dice:Oe.treemapDice,slice:Oe.treemapSlice,sliceDice:Oe.treemapSliceDice,squarify:Oe.treemapSquarify,resquarify:Oe.treemapResquarify}[(e=i.treemap_tile)!=null?e:"binary"])!=null?t:Oe.treemapBinary;return(r,l,c,d,u)=>{o(r,0,0,a,s);for(const h of r.children)h.x0=l+h.x0/a*(d-l),h.x1=l+h.x1/a*(d-l),h.y0=c+h.y0/s*(u-c),h.y1=c+h.y1/s*(u-c)}},getTreemapData(e){const t=this;return{name:"root",children:mm.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},getTreemapRoot(e){const t=this,n=t.getTreemapData(e!=null?e:t.data.targets),i=(0,Oe.hierarchy)(n).sum(s=>s.value),a=t.getSortCompareFn(!0);return t.treemap||t.initTreemapLayout(),t.treemap(a?i.sort(a):i)}},bm=Object.defineProperty,ym=Object.defineProperties,Tm=Object.getOwnPropertyDescriptors,Gc=Object.getOwnPropertySymbols,wm=Object.prototype.hasOwnProperty,Cm=Object.prototype.propertyIsEnumerable,Vc=(e,t,n)=>t in e?bm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sm=(e,t)=>{for(var n in t||(t={}))wm.call(t,n)&&Vc(e,n,t[n]);if(Gc)for(var n of Gc(t))Cm.call(t,n)&&Vc(e,n,t[n]);return e},Am=(e,t)=>ym(e,Tm(t));function km(e,t){const n=this;e.selectAll("g").attr("transform",i=>{const a=vn(n,i,t);return`translate(${a.x},${a.y})`}).select("rect").attr("width",i=>vn(n,i,t).w).attr("height",i=>vn(n,i,t).h)}var Lm=Am(Sm({},vm),{initTreemap(){const e=this,{$el:t,state:{current:{width:n,height:i},clip:a,datetimeId:s}}=e;a.id=`${s}-clip`,e.initTreemapLayout(),t.defs.append("clipPath").attr("id",a.id).append("rect").attr("width",n).attr("height",i),t.treemap=t.main.select(`.${U.chart}`).attr("clip-path",`url(#${a.id})`).append("g").classed(ir.chartTreemaps,!0),e.bindTreemapEvent()},bindTreemapEvent(){const e=this,{$el:t,config:n,state:i}=e,a=s=>{var o;const r=s.isTrusted?s.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return r&&/^rect$/i.test(r.tagName)&&(i.event=s,l=(0,F.select)(r).datum()),l==null?void 0:l.data};if(n.interaction_enabled){const s=i.inputType==="touch";t.treemap.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:n}}=t,i=[t.getTreemapRoot(e!=null?e:t.data.targets)];n.data(t.filterNullish(i))},updateTreemap(e){const t=this,{$el:n,$T:i}=t,a=n.treemap.datum(),s=t.getChartClass("Treemap"),o=t.getClass("treemap",!0),r=n.treemap.selectAll("g").data(a.children);i(r.exit(),e).style("opacity","0").remove(),r.enter().append("g").append("rect"),n.treemap.selectAll("g").attr("class",s).select("rect").attr("class",o).attr("fill",l=>t.color(l.data.name))},generateGetTreemapPoints(){const e=this,{$el:t}=e,n={};return t.treemap.selectAll("g").each(i=>{const a=vn(e,i);n[i.data.name]=[[a.x,a.y],[a.x+a.w,a.y+a.h]]}),i=>n[i.id]},redrawTreemap(e){const t=this,{$el:n,state:{current:{width:i,height:a}}}=t;return n.defs.select("rect").attr("width",i).attr("height",a),[t.$T(n.treemap,e,me()).call(km.bind(t),n.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{$el:{treemap:n},config:i,scale:{x:a,y:s}}=t,{id:o,value:r}=e,l=i.treemap_label_format,c=t.getRatio("treemap",e),d=(c*100).toFixed(2),u=i.treemap_label_show&&Ga.call(t,c,"treemap")?null:"0",h=n.selectAll("g").filter(p=>p.data.id===o).datum();let f=0,g=0;if(h){const{x0:p,x1:_,y0:x,y1:m}=h;f=a(_)-a(p),g=s(m)-s(x)}return function(p){return p.style("opacity",u),z(l)?l.bind(t.api)(r,c,o,{width:f,height:g}):`${o}
40
- ${d}%`}}}),Rm={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};let Wc=()=>(ei([Lm],[Rm]),(Wc=()=>O.TREEMAP)()),gs=Object.create(null);const Yc={version:"4.1.4",generate(e){const t=Ae(Object.create(null),gs,e),n=new Yt(t);return n.internal.charts=this.instance,this.instance.push(n),n},defaults(e){return tt(e)&&(gs=e),gs},instance:[],plugin:{}};Object.keys(Qt).forEach(e=>Qt[e]()),Object.keys(J).forEach(e=>J[e]()),fl(),gl(),Al(),Vl(),hl(),ll()})(),ji})()});
39
+ `):[];if(l.length)return l;if(et(r))return r;let c=o.tickWidth;(!c||c<=0)&&(c=i?95:o.isCategory?(o.isInverted?n(a[0])-n(a[1]):n(a[1])-n(a[0]))-12:110);const u=String(r),d=[];let h=0;for(;;){let f,p=-1;for(let g=1;h+g<u.length;g++)if(u.charAt(h+g)===" "&&(f=g),c<s*(g+1)){p=g;break}if(p===-1)return d.push(u.slice(h)),d;d.push(u.substr(h,f||p)),h+=f?f+1:p}}scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?String(t):"bottom",this):this.config.orient}tickFormat(t){const{config:n}=this;return arguments.length?(n.tickFormat=t,this):n.tickFormat}tickCentered(t){const{config:n}=this;return arguments.length?(n.tickCentered=t,this):n.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(t){var n,a,i;const{outerTickSize:s,tickOffset:o,tickValues:r}=this.config;let l;if(this.params.isCategory){const c=(n=this.params.owner.scale.zoom)!=null?n:this.helper.scale;l=o*2||Math.abs(c(1)-c(0))}else{const c=(a=this.params.owner.scale.zoom)!=null?a:this.helper.scale;if(l=(this.g?this.g.select("path.domain").node().getTotalLength()-s*2:Math.abs(c.range()[1]-c.range()[0]))/(t||((i=this.g)==null?void 0:i.selectAll("line").size())||1),r)for(let d=0;d<r.length-1;d++){const h=c(r[d+1])-c(r[d]);h&&h<l&&(l=h)}}return l===1/0?0:l}ticks(...t){const{config:n}=this;return t.length?(n.tickArguments=dn(t),this):n.tickArguments}tickCulling(t){const{config:n}=this;return arguments.length?(n.tickCulling=t,this):n.tickCulling}tickValues(t){const{config:n}=this;if(G(t))n.tickValues=()=>t(this.helper.scale.domain());else{if(!arguments.length)return n.tickValues;n.tickValues=t}return this}setTransition(t){return this.config.transition=t,this}}var lv=Object.defineProperty,cv=Object.defineProperties,uv=Object.getOwnPropertyDescriptors,Xc=Object.getOwnPropertySymbols,dv=Object.prototype.hasOwnProperty,hv=Object.prototype.propertyIsEnumerable,As=(e,t,n)=>t in e?lv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fv=(e,t)=>{for(var n in t||(t={}))dv.call(t,n)&&As(e,n,t[n]);if(Xc)for(var n of Xc(t))hv.call(t,n)&&As(e,n,t[n]);return e},gv=(e,t)=>cv(e,uv(t)),Se=(e,t,n)=>As(e,typeof t!="symbol"?t+"":t,n);function Ls(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function oi(e){return/^sub/.test(e)}function sn(e,t,n){const a=Ls(t),i=e[`subchart_axis_${a}_tick_${n}`];return oi(t)&&i!==void 0?i:e[`axis_${a}_tick_${n}`]}function pv(e){var t,n;const a=[e[0],e[e.length-1]];let i=0,s=null;for(const r of e){const l=(n=(t=r.textContent)==null?void 0:t.length)!=null?n:0;l>i&&(i=l,s=r)}s&&!a.includes(s)&&a.push(s);const o=e[Math.floor(e.length/2)];return a.includes(o)||a.push(o),a}const ri=50,Ps=Symbol("tickWidthFallback");function _v(e){var t,n,a;const i=e.select("line").node(),s=(n=(t=i==null?void 0:i.ownerDocument)==null?void 0:t.defaultView)!=null&&n.getComputedStyle?parseFloat(i.ownerDocument.defaultView.getComputedStyle(i).strokeWidth):parseFloat((a=i==null?void 0:i.getAttribute)==null?void 0:a.call(i,"stroke-width"));return Number.isFinite(s)&&s>0?s:1}function xv(e,t,n){var a;const i=(a=e==null?void 0:e.scale)==null?void 0:a.call(e);if(!i||t.length<2)return!1;const s=Math.max(1,n)/2,o=t.map(l=>+i(l)).filter(Number.isFinite).sort((l,c)=>l-c);if(o.length<2)return!1;let r=o[0]+s;for(let l=1;l<o.length;l++){const c=o[l]-s,u=o[l]+s;if(c<=r+Lo)return!0;r=Math.max(r,u)}return!1}function mv(e,t){if(e.length<=ri)return e;const n=new Map,a=r=>{r>=0&&r<e.length&&n.set(r,e[r])};a(0),a(e.length-1),a(Math.floor(e.length/2));const i=Math.max(1,Math.floor(e.length/(ri-3)));let s=-1,o=0;for(let r=0;r<e.length;r+=i){a(r);const l=e[r],c=t?t(l):l,u=Array.isArray(c)?c.join("").length:String(c!=null?c:"").length;u>s&&(s=u,o=r)}return a(o),Array.from(n.keys()).sort((r,l)=>r-l).map(r=>n.get(r))}function vv(e){return G(e)?Wc(e):!Array.isArray(e)||e.length<=ri?e:{length:e.length,first:e[0],middle:e[Math.floor(e.length/2)],last:e[e.length-1]}}function Rs(e){return e[Ps]}function li(e,t){N(t)?Object.defineProperty(e,Ps,{configurable:!0,value:t,writable:!0}):delete e[Ps]}function Es(e){e.length=0,li(e)}function bv(e,t,n){Es(e),e.length=t,li(e,n)}function yv(e){const t=[];return t.length=e.length,Object.keys(e).forEach(n=>{const a=+n;t[a]=e[a]}),li(t,Rs(e)),t}function Tv(e,t){Es(e),e.length=t.length,Object.keys(t).forEach(n=>{const a=+n;e[a]=t[a]}),li(e,Rs(t))}function wv(e,t,n){const a=e[t];if(N(a))return a;const i=Number(a);return Number.isFinite(i)?i:n}const Gc=new WeakMap;let kv=0;function Wc(e){if(!e||!/^(function|object)$/.test(typeof e))return`${typeof e}:${String(e)}`;let t=Gc.get(e);return t||(t=++kv,Gc.set(e,t)),`${typeof e}:${t}`}function Ms(e){return e instanceof Date?`date:${+e}`:Array.isArray(e)?`[${e.map(t=>Ms(t)).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${t}:${Ms(e[t])}`).join(",")}}`:typeof e=="function"?Wc(e):`${typeof e}:${String(e)}`}function Ds(e){return e instanceof Date?new Date(+e):Array.isArray(e)?e.map(t=>Ds(t)):e}function Cv(e){return{width:e.width,height:e.height,ticks:e.ticks&&yv(e.ticks),clipPath:e.clipPath,domain:Ds(e.domain)}}function Sv(e,t){return e.width=t.width,e.height=t.height,e.clipPath=t.clipPath,e.domain=Ds(t.domain),e.ticks&&t.ticks&&Tv(e.ticks,t.ticks),e}var Av={getAxisInstance:function(){return this.axis||new Lv(this)}};class Lv{constructor(t){Se(this,"owner"),Se(this,"x"),Se(this,"subX"),Se(this,"subY"),Se(this,"subY2"),Se(this,"y"),Se(this,"y2"),Se(this,"axesList",{}),Se(this,"tick",{x:null,y:null,y2:null}),Se(this,"xs",[]),Se(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom",subY:"left",subY2:"right"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${Ft.axis} ${Ft[`axis${Mt(t)}`]}`}isHorizontal(t,n){const a=t.config.axis_rotated;return n?a:!a}isCategorized(){const{config:t,state:n}=this.owner;return t.axis_x_type.indexOf("category")>=0||n.hasRadar}isCustomX(){const{config:t}=this.owner;return!this.isTimeSeries()&&(t.data_x||St(t.data_xs))}isTimeSeries(t="x"){return this.owner.config[`axis_${t}_type`]==="timeseries"}isLog(t="x"){return this.owner.config[`axis_${t}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(t="x"){let n="linear";return this.isTimeSeries(t)?n=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(n="log"),n}getExtent(){const t=this.owner,{config:n,scale:a}=t;let i=n.axis_x_extent;if(i){if(G(i))i=i.bind(t.api)(t.getXDomain(t.data.targets),a.subX);else if(this.isTimeSeries()&&i.every(isNaN)){const s=Zt.bind(t);i=i.map(o=>a.subX(s(o)))}}return i}init(){const t=this.owner,{config:n,$el:{main:a,axis:i},state:{clip:s}}=t,o=["x","y"];n.axis_y2_show&&o.push("y2"),o.forEach(r=>{const l=this.getAxisClassName(r);i[r]=a.append("g").attr("class",l).attr("clip-path",()=>{let c=null;return r==="x"?c=s.pathXAxis:r==="y"&&(c=s.pathYAxis),c}).attr("transform",t.getTranslate(r)).style("visibility",n[`axis_${r}_show`]?null:"hidden"),this.generateAxes(r)})}setOrient(){const t=this.owner,{axis_rotated:n,axis_y_inner:a,axis_y2_inner:i}=t.config;this.orient={x:n?"left":"bottom",y:n?a?"top":"bottom":a?"right":"left",y2:n?i?"bottom":"top":i?"left":"right",subX:n?"left":"bottom",subY:n?a?"top":"bottom":a?"right":"left",subY2:n?i?"bottom":"top":i?"left":"right"}}generateAxes(t){const n=this.owner,{config:a}=n,i=[],s=a[`axis_${t}_axes`],o=a.axis_rotated;let r;t==="x"?r=o?"left":"bottom":t==="y"?r=o?"bottom":"left":t==="y2"&&(r=o?"top":"right"),s.length&&s.forEach(l=>{const c=l.tick||{},u=n.scale[t].copy();l.domain&&u.domain(l.domain);const d=new Nc({outerTick:c.outer!==!1,noTransition:!1,config:a,id:t,isSubAxes:!0,owner:n}).scale(u).orient(r).tickFormat(G(c.format)?c.format.bind(n.api):(h=>h));nt(c.count)&&d.ticks(c.count),c.values&&d.tickValues(c.values),i.push(d)}),this.axesList[t]=i}updateAxes(){const t=this.owner,{config:n,$el:{main:a},$T:i}=t;Object.keys(this.axesList).forEach(s=>{const o=n[`axis_${s}_axes`],r=t.scale[s].copy(),l=r.range();this.axesList[s].forEach((c,u)=>{const d=c.scale().range();l.every((p,g)=>p===d[g])||c.scale().range(l);const h=`${this.getAxisClassName(s)}-${u+1}`;let f=a.select(`.${h.replace(/\s/,".")}`);f.empty()?(f=a.append("g").attr("class",h).style("visibility",n[`axis_${s}_show`]?null:"hidden"),c.create(f)):(o[u].domain&&r.domain(o[u].domain),c.scale(r).create(i(f))),f.attr("transform",t.getTranslate(s,u+1))})})}setAxis(t,n,a,i){const s=this.owner,o=Ls(t);oi(t)||(this.tick[o]=this.getTickValues(o)),this[t]=this.getAxis(t,n,a,t==="x"&&(s.scale.zoom||s.config.subchart_show||s.state.resizing)?!0:i)}getAxis(t,n,a,i,s){const o=this.owner,{config:r}=o,l=/^(x|subX)$/.test(t),c=Ls(t),u=l&&this.isCategorized(),d=this.orient[t],h=s?0:o.getAxisTickRotate(c);let f;if(l)f=t==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const m=oi(t)?r[`subchart_axis_${c}_tick_format`]||r[`axis_${c}_tick_format`]:r[`axis_${c}_tick_format`];G(m)&&(f=m.bind(o.api))}let p=oi(t)?this.getTickValues(c,!0):this.tick[c];const g=Fe({outerTick:a,noTransition:i,config:r,id:t,tickTextRotate:h,owner:o},l&&{isCategory:u,isInverted:r.axis_x_inverted,tickMultiline:r.axis_x_tick_multiline,tickWidth:r.axis_x_tick_width,tickTitle:u&&r.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(g.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new Nc(g).scale(l&&o.scale.zoom||n).orient(d);if(l&&this.isTimeSeries()&&p&&!G(p)){const m=Zt.bind(o);p=p.map(v=>m(v))}else!l&&this.isTimeSeriesY()&&(_.ticks(r.axis_y_tick_time_value),p=null);p&&_.tickValues(p),_.tickFormat(f||!l&&o.isStackNormalized()&&o.hasAxisGroupedData(c)&&(m=>`${m}%`)),u&&(_.tickCentered(r.axis_x_tick_centered),le(r.axis_x_tick_culling)&&(r.axis_x_tick_culling=!1));const x=sn(r,t,"count");return x&&_.ticks(x),_}updateXAxisTickValues(t,n){var a;const i=this.owner,{config:s}=i,o=s.axis_x_tick_fit,r=(c=s.axis_x_tick_count)=>{let u=c,d;return o&&(d=i.mapTargetsToUniqueXs(t),this.isCategorized()&&u>d.length&&(u=d.length),d=this.generateTickValues(d,u,this.isTimeSeries())),d},l=r();if(n)n.tickValues(l);else if(this.x){const c=this.getTickValues("x",!0),u=sn(s,"subX","count"),d=c!=null?c:u!==s.axis_x_tick_count?r(u):l;this.x.tickValues(l),(a=this.subX)==null||a.tickValues(d)}return l}getId(t){const{config:n,scale:a}=this.owner;let i=n.data_axes[t];return(!i||!a[i])&&(i="y"),i}getXAxisTickFormat(t){const n=this.owner,{config:a,format:i}=n,s=t&&a.subchart_axis_x_tick_format||a.axis_x_tick_format,o=this.isTimeSeries(),r=this.isCategorized();let l;return s?G(s)?l=s.bind(n.api):o&&(l=c=>c?i.axisTime(s)(c):""):l=o?i.defaultAxisTime:r?n.categoryName:c=>c<0?c.toFixed(0):c,G(l)?c=>l.apply(n,r?[c,n.categoryName(c)]:[c]):l}getTickValues(t,n=!1){const a=this.owner,i=n?sn(a.config,`sub${Mt(t)}`,"values"):a.config[`axis_${t}_tick_values`],s=G(i)?i.call(a.api):i,o=a[`${t}Axis`];return n?s!=null?s:void 0:s||(o?o.tickValues():void 0)}getLabelOptionByAxisId(t){return this.owner.config[`axis_${t}_label`]}getLabelText(t){const n=this.getLabelOptionByAxisId(t);return st(n)?n:n?n.text:null}setLabelText(t,n){const a=this.owner,{config:i}=a,s=this.getLabelOptionByAxisId(t);st(s)?i[`axis_${t}_label`]=n:s&&(s.text=n)}getLabelPosition(t,n){const a=this.owner.config.axis_rotated,i=this.getLabelOptionByAxisId(t),s=ne(i)&&i.position?i.position:n[+!a],o=r=>!!~s.indexOf(r);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(t){return this.getLabelPosition(t,t==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}xForAxisLabel(t){const n=this.owner,{state:{width:a,height:i}}=n,s=this.getAxisLabelPosition(t);let o=s.isMiddle?-i/2:0;return this.isHorizontal(n,t!=="x")?o=s.isLeft?0:s.isCenter?a/2:a:s.isBottom&&(o=-i),o}textAnchorForAxisLabel(t){const n=this.owner,a=this.getAxisLabelPosition(t);let i=a.isMiddle?"middle":"end";return this.isHorizontal(n,t!=="x")?i=a.isLeft?"start":a.isCenter?"middle":"end":a.isBottom&&(i="start"),i}dxForAxisLabel(t){const n=this.owner,a=this.getAxisLabelPosition(t);let i=a.isBottom?"0.5em":"0";return this.isHorizontal(n,t!=="x")?i=a.isLeft?"0.5em":a.isRight?"-0.5em":"0":a.isTop&&(i="-0.5em"),i}dyForAxisLabel(t){const n=this.owner,{config:a}=n,i=a.axis_rotated,s=this.getAxisLabelPosition(t).isInner,o=a[`axis_${t}_tick_rotate`]?n.getHorizontalAxisHeight(t):0,{width:r}=this.getMaxTickSize(t);let l;if(t==="x"){const c=a.axis_x_height;i?l=s?"1.2em":-25-r:s?l="-0.5em":c?l=c-10:o?l=o-10:l="3em"}else l={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],i?s?l=l[0]:o?l=o*(t==="y2"?-1:1)-l[1]:l=l[2]:l=s?l[3]:(l[4]+(a[`axis_${t}_inner`]?0:r+l[4]))*(t==="y"?-1:1);return l}getTickFormatCacheValue(t){const n=this.owner,{config:a}=n;return t==="x"?{format:a.axis_x_tick_format,type:a.axis_x_type,localtime:a.axis_x_localtime,categories:a.axis_x_categories}:{format:a[`axis_${t}_tick_format`],normalized:n.isStackNormalized(),grouped:n.hasAxisGroupedData(t),type:a[`axis_${t}_type`]}}getMaxTickSizeFingerprint(t,n,a,i,s,o){var r;const l=this.owner,{config:c,state:u}=l,d=t==="x",h=d?"axis_x":`axis_${t}`,f=i.tickValues();return Ms({id:t,withoutRecompute:!!o,dataGeneration:u.dataGeneration,size:[u.current.width,u.current.height],range:(r=n.range)==null?void 0:r.call(n),domain:a,type:n.type,orient:this.orient[t],axisRotated:c.axis_rotated,evalTextSize:c.axis_evalTextSize,format:this.getTickFormatCacheValue(t),ticks:{values:vv(f),rawValues:c[`${h}_tick_values`],arguments:i.ticks(),count:c[`${h}_tick_count`],rotate:s,show:c[`${h}_tick_show`],textShow:c[`${h}_tick_text_show`],textPosition:c[`${h}_tick_text_position`],inner:c[`${h}_tick_inner`],culling:c[`${h}_tick_culling`],cullingMax:c[`${h}_tick_culling_max`],cullingLines:c[`${h}_tick_culling_lines`],cullingReverse:c[`${h}_tick_culling_reverse`],stepSize:!d&&c[`${h}_tick_stepSize`],timeValue:!d&&c[`${h}_tick_time_value`],fit:d&&c.axis_x_tick_fit,autorotate:d&&c.axis_x_tick_autorotate,centered:d&&c.axis_x_tick_centered,inverted:d&&c.axis_x_inverted,multiline:d&&c.axis_x_tick_multiline,width:d&&c.axis_x_tick_width}})}getMaxTickSize(t,n){var a;const i=this.owner,{config:s,state:o,$el:{svg:r,chart:l}}=i,{current:c,resizing:u}=o,d=c.maxTickSize[t],h=`${Z.maxTickSize}_${t}_${!!n}`,f=i.cache.get(h);if(f&&f.generation===o.redrawGeneration)return d;const p=`axis_${t}`,g={width:0,height:0};let _;if(u||n||!s[`${p}_show`]||d.width>0&&i.filterTargetsToShow().length===0)return d;if((r||s.render_mode==="canvas")&&((a=i.scale[t])!=null&&a.copy)){const x=/^y2?$/.test(t),m=i.getTargetsToShow(),v=i.scale[t].copy().domain(i[`get${x?"Y":"X"}Domain`](m,t)),b=v.domain(),T=b[0]===b[1]&&b.every(O=>O>0),k=et(d.domain)&&d.domain[0]===d.domain[1]&&d.domain.every(O=>O>0);if(T||k)return d;d.domain=b,x||Es(d.ticks);const w=this.getAxis(t,v,!1,!1,!0),y=s[`${p}_tick_rotate`],C=s[`${p}_tick_count`];if(!s[`${p}_tick_values`]&&C&&w.tickValues(this.generateTickValues(b,C,x?this.isTimeSeriesY():this.isTimeSeries())),!x&&this.updateXAxisTickValues(m,w),_=this.getMaxTickSizeFingerprint(t,v,b,w,y,n),(f==null?void 0:f.fingerprint)===_)return i.cache.add(h,gv(fv({},f),{generation:o.redrawGeneration})),Sv(d,f.value);const S=w.tickValues(),L=!x&&Array.isArray(S)&&S.length>ri;L&&w.tickValues(mv(S,w.tickFormat()));const P=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),D=P.append("g").attr("class",`${Ft[`axis${Mt(t)}`]} ${U.dummy}`);w.create(D);const{sizeFor1Char:R}=D.node(),E=P.selectAll("text").attr("transform",N(y)?`rotate(${y})`:null),M=L?S.length:E.size();if(R)E.each(function(O,$){const I=this.textContent.length*R.w,F=R.h;g.width=Math.max(g.width,I),g.height=Math.max(g.height,F),x||(d.ticks[$]=I)});else{const O=[];if(E.each(function(){O.push(this)}),(O.length<=5?O:pv(O)).map(I=>mt(I,!0)).forEach(I=>{g.width=Math.max(g.width,I.width),g.height=Math.max(g.height,I.height)}),!x)for(let I=0;I<O.length;I++)d.ticks[I]=g.width}!x&&L&&bv(d.ticks,M,g.width),P.remove()}return Object.keys(g).forEach(x=>{g[x]>0&&(d[x]=g[x])}),i.cache.add(h,{fingerprint:_,generation:o.redrawGeneration,value:Cv(d)}),d}getXAxisTickTextY2Overflow(t){const n=this.owner,{axis:a,config:i,state:{current:s,isLegendRight:o,legendItemWidth:r}}=n,l=n.getAxisTickRotate("x"),c=l>0&&l<90;if((a.isCategorized()||a.isTimeSeries())&&i.axis_x_tick_fit&&(!i.axis_x_tick_culling||le(i.axis_x_tick_culling))&&!i.axis_x_tick_multiline&&c){const u=i.axis_y2_show&&s.maxTickSize.y2.width||0,d=o&&r||0,h=s.width-n.getCurrentPaddingByDirection("left"),f=this.getXAxisTickMaxOverflow(l,h-t)-u-d,p=Math.max(0,f)+t;return Math.min(p,h/2)}return 0}getXAxisTickMaxOverflow(t,n){var a;const i=this.owner,{axis:s,config:o,state:r}=i,l=s.isTimeSeries(),c=r.current.maxTickSize.x.ticks,u=c.length,d=(a=Rs(c))!=null?a:r.current.maxTickSize.x.width,{left:h,right:f}=r.axis.x.padding;let p=0;const g=u-(l&&o.axis_x_tick_fit?.5:0);for(let m=0;m<u;m++){const v=m+1,b=Math.cos(Math.PI*t/180)*wv(c,m,d),T=v-(l?1:.5)+h;if(T<=0)continue;const w=(n-b)/T,y=g-v,C=f*w,A=y*w+C,S=b-w/2-A;p=Math.max(p,S)}const _=i.getTargetsToShow();let x=0;if(!l&&o.axis_x_tick_count<=_.length&&_[0].values.length){const m=Je(i.axis.getAxisType("x"),0,n-p).domain([h*-1,i.getXDomainMax(i.data.targets)+1+f]);x=(m(1)-m(0))/2}return p+x}updateLabels(t){const n=this.owner,{config:a,$el:{main:i},$T:s}=n,o=a.axis_rotated;["x","y","y2"].forEach(r=>{const l=this.getLabelText(r),c=`axis${Mt(r)}`,u=Ft[`${c}Label`];if(l){let d=i.select(`text.${u}`);d.empty()&&(d=i.select(`g.${Ft[c]}`).insert("text",":first-child").attr("class",u).attr("transform",["rotate(-90)",null][r==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(r))),s(d,t).attr("x",()=>this.xForAxisLabel(r)).attr("dx",()=>this.dxForAxisLabel(r)).attr("dy",()=>this.dyForAxisLabel(r)).text(l)}})}getPadding(t,n,a,i){const s=N(t)?t:t[n];return nt(s)?this.owner.convertPixelToScale(/(bottom|top)/.test(n)?"y":"x",s,i):a}generateTickValues(t,n,a){let i=t;if(n){const s=G(n)?n():n;if(s===1)i=[t[0]];else if(s===2)i=[t[0],t[t.length-1]];else if(s>2){const o=this.isCategorized(),r=s-2,l=t[0],c=t[t.length-1],u=(c-l)/(r+1);let d;i=[l];for(let h=0;h<r;h++)d=+l+u*(h+1),i.push(a?new Date(d):o?Math.round(d):d);i.push(c)}}return a||(i=i.sort((s,o)=>s-o)),i}generateTransitions(t){const n=this.owner,{$el:{axis:a},$T:i}=n,[s,o,r,l,c,u]=["x","y","y2","subX","subY","subY2"].map(d=>i(a[d],t));return{axisX:s,axisY:o,axisY2:r,axisSubX:l,axisSubY:c,axisSubY2:u}}redraw(t,n,a){const i=this.owner,{config:s,state:o,$el:r}=i,l=n?"0":null;["x","y","y2","subX","subY","subY2"].forEach(c=>{const u=this[c],d=r.axis[c];u&&d&&(!a&&!s.transition_duration&&(u.config.withoutTransition=!0),d.style("opacity",l),u.create(t[`axis${Mt(c)}`]))}),this.updateAxes(),!o.rendered&&s.axis_tooltip&&this.setAxisTooltip()}syncAxisDomains(t,n,a){var i;const s=this.owner,{config:o,scale:r,$el:l}=s,c=!!r.zoom;let u;if(!c&&this.isCategorized()&&t.length===0&&l.axis.x&&r.x.domain([0,l.axis.x.selectAll(".tick").size()]),r.x&&t.length?(!c&&s.updateXDomain(t,n.UpdateXDomain,n.UpdateOrgXDomain,n.TrimXDomain),o.axis_x_tick_values||this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),(i=this.subX)==null||i.tickValues([])),o.zoom_rescale&&!a&&(u=r.x.orgDomain()),["y","y2"].forEach(d=>{const h=`axis_${d}_`,f=r[d];if(f){const p=o[`${h}tick_values`],g=o[`${h}tick_count`];if(f.domain(s.getYDomain(t,d,u)),!p&&g){const _=s.axis[d],x=f.domain();_.tickValues(this.generateTickValues(x,x.every(m=>m===0)?1:g,this.isTimeSeriesY()))}}}),n.Y){const d=()=>{var h,f;(h=r.subY)==null||h.domain(s.getYDomain(t,"y")),(f=r.subY2)==null||f.domain(s.getYDomain(t,"y2")),["y","y2"].forEach(p=>{const g=p==="y2"?"subY2":"subY",_=r[g],x=s.axis[g],m=this.getTickValues(p,!0),v=sn(o,g,"count");if(!_||!x||m||!v)return;const b=_.domain();x.tickValues(this.generateTickValues(b,b.every(T=>T===0)?1:v,this.isTimeSeriesY()))})};o.subchart_show?s.withSubchartTypeContext(d):d()}}redrawAxis(t,n,a,i,s){const o=this.owner;this.syncAxisDomains(t,n,i),this.redraw(a,o.hasArcType(),s),this.updateLabels(n.Transition),(n.UpdateXDomain||n.UpdateXAxis||n.Y)&&t.length&&this.setCulling()}setCulling(){const t=this.owner,{config:n,state:{clip:a,current:i},$el:s}=t;["subX","x","y","y2","subY","subY2"].forEach(o=>{const r=s.axis[o],l=sn(n,o,"culling");if(r&&l){const c=r.selectAll(".tick"),u=An(c.data(),!sn(n,o,"culling_reverse")),d=u.length,h=sn(n,o,"culling_max"),p=!sn(n,o,"culling_lines")||xv(this[o],u,_v(c));let g;if(d){for(let x=1;x<d;x++)if(d/x<h){g=x;break}g=g!=null?g:d;const _=new Map;for(let x=0;x<u.length;x++)_.set(u[x],x);c.each(function(x){var m;const v=p?this:this.querySelector("text");v&&(v.style.display=((m=_.get(x))!=null?m:0)%g?"none":null)})}else c.style("display",null);if(o==="x"){const _=i.maxTickSize.x.clipPath?a.pathXAxisTickTexts:null;s.svg.selectAll(`.${Ft.axisX} .tick text`).attr("clip-path",_)}}})}setAxisTooltip(){var t;const n=this.owner,{config:{axis_rotated:a,axis_tooltip:i},$el:{axis:s,axisTooltip:o}}=n,r=(t=i.backgroundColor)!=null?t:"black";n.generateTextBGColorFilter(r,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(l=>{var c,u,d;if(st(r)||r[l])if(o[l]=(c=s[l])==null?void 0:c.append("text").classed(Ft[`axis${l.toUpperCase()}Tooltip`],!0).attr("filter",n.updateTextBGColor({id:l},r)),a){const h=l==="x"?"x":"y",f=l==="y"?"1.15em":l==="x"?"-0.3em":"-0.4em";(u=o[l])==null||u.attr(h,f).attr(`d${l==="x"?"y":"x"}`,l==="x"?"0.4em":"-1.3em").style("text-anchor",l==="x"?"end":null)}else{const h=l==="x"?"y":"x",f=l==="x"?"1.15em":`${l==="y"?"-":""}0.4em`;(d=o[l])==null||d.attr(h,f).attr(`d${l==="x"?"x":"y"}`,l==="x"?"-1em":"0.3em").style("text-anchor",l==="y"?"end":null)}})}}var Vc=Math.pow,Pv={initEventRect(){this.$el.main.select(`.${U.chart}`).append("g").attr("class",Ge.eventRects).style("fill-opacity","0")},redrawEventRect(){var e;const t=this,{config:n,state:a,$el:i}=t,s=t.isMultipleX(),o=n.axis_x_inverted;if(i.eventRect)t.updateEventRect(i.eventRect,!0);else if(t.data.targets.length){const l=t.$el.main.select(`.${Ge.eventRects}`).style("cursor",n.zoom_enabled&&n.zoom_type!=="drag"?n.axis_rotated?"ns-resize":"ew-resize":null).classed(Ge.eventRectsMultiple,s).classed(Ge.eventRectsSingle,!s).selectAll(`.${Ge.eventRect}`).data([0]).enter().append("rect");t.updateEventRect(l),t.updateEventType(l),l.call(t.getDraggableSelection()),i.eventRect=l,t.state.inputType==="touch"&&!i.svg.on("touchstart.eventRect")&&!t.hasArcType()&&t.bindTouchOnEventRect(),a.rendered&&t.updateEventRect(i.eventRect,!0)}if(!s){const r=t.getMaxDataCountTarget();(!n.data_xSort||o)&&r.sort((l,c)=>o?c.x-l.x:l.x-c.x),t.updateDataIndexByX(r),t.updateXs(r),(e=t.updatePointClass)==null||e.call(t,!0),a.eventReceiver.data=r}t.updateEventRectData()},bindTouchOnEventRect(){const e=this,{config:t,state:n,$el:{eventRect:a,svg:i}}=e,s=f=>{if(e.isMultipleX())e.selectRectForMultipleXs(f);else{const p=e.getDataIndexFromEvent(n.event);e.callOverOutForTouch(p),p===-1?e.unselectRect():e.selectRectForSingle(f,p)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=cn(r)&&r||!1,c=!isNaN(r)&&r||null;let u;const d=!l&&c===null,h=f=>{const p=f.type,_=f.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];p==="touchstart"?l?f.preventDefault():c!==null&&(u=_):p==="touchmove"&&(l||u===!0||c!==null&&Math.abs(u-_)>=c)&&(u=!0,f.preventDefault())};a.on("touchstart",f=>{n.event=f,e.updateEventRect()},{passive:d}).on("touchstart.eventRect touchmove.eventRect",f=>{if(n.event=f,!a.empty()&&a.classed(Ge.eventRect)){if(n.dragging||n.flowing||e.hasArcType()||f.touches.length>1)return;h(f),s(a.node())}else o()},{passive:d}).on("touchend.eventRect",f=>{n.event=f,!a.empty()&&a.classed(Ge.eventRect)&&(e.hasArcType()||!e.toggleShape||n.cancelClick)&&n.cancelClick&&(n.cancelClick=!1)},{passive:d}),i.on("touchstart",f=>{n.event=f;const{target:p}=f;p&&p!==a.node()&&o()},{passive:d})},updateEventRect(e,t=!1){const n=this,{state:a,$el:i}=n,{eventReceiver:s,width:o,height:r,rendered:l,resizing:c}=a,u=e||i.eventRect,d=()=>{if(s){const h=jr(i.chart.node());s.rect=mt(u.node(),!0).toJSON(),s.rect.top+=h.y,s.rect.left+=h.x}};(!l||c||t)&&(u.attr("x",0).attr("y",0).attr("width",o).attr("height",r),(!l||t)&&u.classed(Ge.eventRect,!0)),d()},updateEventType(e){const t=this,n=cn(e),a=n?t.$el.eventRect:e,i=n?e!==(a==null?void 0:a.datum().multipleX):!1;a&&(i&&(a==null||a.on("mouseover mousemove mouseout click",null)),t.isMultipleX()?t.generateEventRectsForMultipleXs(a):t.generateEventRectsForSingleX(a))},updateEventRectData(){const e=this,{config:t,scale:n,state:a}=e,i=n.zoom||n.x,s=t.axis_rotated,o=e.isMultipleX(),r=i==null?void 0:i.domain(),l=r?`${r[0]}_${r[1]}_${a.width}_${a.height}_${e.data.targets.length}_${a.dataGeneration}_${[...a.hiddenTargetIds].join(",")}`:null;if(l&&l===a._eventRectFingerprint)return;a._eventRectFingerprint=l;let c,u,d,h;if(e.updateEventType(o),o)c=0,u=0,d=a.width,h=a.height;else{let g,_;if(e.axis.isCategorized())g=e.getEventRectWidth(),_=x=>i(x.x)-g/2;else{const x=({index:m})=>({prev:e.getPrevX(m),next:e.getNextX(m)});g=m=>{const v=x(m),b=i.domain();let T;return v.prev===null&&v.next===null?T=s?a.height:a.width:v.prev===null?T=(i(v.next)+i(m.x))/2:v.next===null?T=i(b[1])-(i(v.prev)+i(m.x))/2:T=Math.max(0,(i(v.next)-i(v.prev))/2),T},_=m=>{const v=x(m);let b;return v.prev===null&&v.next===null?b=0:v.prev===null?b=i(i.domain()[0]):b=(i(m.x)+i(v.prev))/2,b}}c=s?0:_,u=s?_:0,d=s?a.width:g,h=s?g:a.height}const{eventReceiver:f}=a,p=(g,_)=>G(g)?g(_):g;f.coords.splice(f.data.length),f.data.forEach((g,_)=>{f.coords[_]={x:p(c,g),y:p(u,g),w:p(d,g),h:p(h,g)}})},selectRectForSingle(e,t){var n,a,i,s,o,r,l;const c=this,{config:u,state:d,$el:{main:h,circle:f}}=c,p=u.data_selection_enabled,g=u.data_selection_grouped,_=u.data_selection_isselectable,x=u.tooltip_grouped,m=c.getAllValuesOnIndex(t);if(x&&(c.showTooltip(m,e),(n=c.showGridFocus)==null||n.call(c,m),(a=c.showSubchartGridFocus)==null||a.call(c,m),!p||g))return;!f&&h.selectAll(`.${U.EXPANDED}:not(.${vt.shape}-${t})`).classed(U.EXPANDED,!1);const v=h.selectAll(`.${vt.shape}-${t}`).classed(U.EXPANDED,!0).style("cursor",_?"pointer":null).filter(function(b){return c.isWithinShape(this,b)});if(v.call(b=>{var T,k,w;const y=b.data();p&&(g||_!=null&&_.bind(c.api)(y))&&(e.style.cursor="pointer"),x||(c.showTooltip(y,e),(T=c.showGridFocus)==null||T.call(c,y),(k=c.showSubchartGridFocus)==null||k.call(c,y),(w=c.unexpandCircles)==null||w.call(c),b.each(C=>c.setExpand(t,C.id)))}),!x&&v.empty()){const b=se(d.event,e),T=m.filter(k=>c.isTargetToShow(k.id)?c.dist(k,b)<c.getPointSensitivity(k):!1);if(T.length>0){let k=T[0],w=c.dist(k,b);for(let y=1;y<T.length;y++){const C=T[y],A=c.dist(C,b);A<w&&(w=A,k=C)}c.showTooltip([k],e),(i=c.showGridFocus)==null||i.call(c,[k]),(s=c.showSubchartGridFocus)==null||s.call(c,[k]),(o=c.unexpandCircles)==null||o.call(c),c.setExpand(t,k.id,!0),p&&(g||_!=null&&_.bind(c.api)(k))&&(e.style.cursor="pointer")}else u.interaction_onout&&((r=c.hideGridFocus)==null||r.call(c),(l=c.hideSubchartGridFocus)==null||l.call(c),c.hideTooltip(),!g&&c.setExpand(t))}},selectRectForMultipleXs(e,t=!0){var n,a;const i=this,{config:s,state:o}=i,r=i.getTargetsToShow();if(o.dragging||i.hasArcType(r))return;const l=se(o.event,e),c=i.findClosestFromTargets(r,l);if(t&&o.mouseover&&(!c||c.id!==o.mouseover.id)&&(s.data_onout.call(i.api,o.mouseover),o.mouseover=void 0),!c){i.unselectRect();return}const d=(i.isBubbleType(c)||i.isScatterType(c)||!s.tooltip_grouped?[c]:i.filterByX(r,c.x)).map(f=>i.addName(f));i.showTooltip(d,e),i.setExpand(c.index,c.id,!0),(n=i.showGridFocus)==null||n.call(i,d),(a=i.showSubchartGridFocus)==null||a.call(i,d);const h=i.dist(c,l);(i.isBarType(c.id)||h<i.getPointSensitivity(c))&&(i.$el.eventRect.style("cursor","pointer"),t&&(!o.mouseover||o.mouseover.x!==c.x||o.mouseover.id!==c.id)&&(s.data_onover.call(i.api,c),o.mouseover=c))},unselectRect(){var e,t,n,a;const i=this,{state:s,$el:{circle:o,tooltip:r}}=i;if(s._lastTooltipMouse=null,s.isCanvasMode){(e=i.clearCanvasFocus)==null||e.call(i),r&&i.hideTooltip();return}(t=i.$el.eventRect)==null||t.style("cursor",null),(n=i.hideGridFocus)==null||n.call(i),(a=i.hideSubchartGridFocus)==null||a.call(i),r&&(i.hideTooltip(),i._handleLinkedCharts(!1)),o&&!i.isPointFocusOnly()&&i.unexpandCircles(),i.expandBarTypeShapes(!1)},generateEventRectsForSingleX(e){const t=this,{config:n,state:a}=t,{eventReceiver:i}=a,s=e.style("cursor",n.data_selection_enabled&&n.data_selection_grouped?"pointer":null).on("click",function(o){a.event=o;const{currentIdx:r,data:l}=i,c=l[r===-1?t.getDataIndexFromEvent(o):r];t.clickHandlerForSingleX.bind(this)(c,t)}).datum({multipleX:!1});if(a.inputType==="mouse"){const o=r=>{const l=r?t.getDataIndexFromEvent(r):i.currentIdx;return l>-1?i.data[l]:null};s.on("mouseover",r=>{a.event=r,t.updateEventRect(),Object.values(t.$el.axisTooltip).forEach(l=>l==null?void 0:l.style("display",null))}).on("mousemove",function(r){var l;const c=o(r);if(a.event=r,!c)return;let{index:u}=c;const d=n.line_step_type;if(n.line_step_tooltipMatch&&t.hasType("step")&&/^step\-(before|after)$/.test(d)){const f=t.scale.zoom||t.scale.x,p=t.axis.xs[u],g=f.invert(se(r,this)[0]);d==="step-after"&&g<p?u-=1:d==="step-before"&&g>p&&(u+=1)}(l=t.showAxisGridFocus)==null||l.call(t);const h=n.tooltip_grouped&&u===i.currentIdx;if(a.dragging||a.flowing||t.hasArcType()||h){if(n.tooltip_show&&h){const[f,p]=se(r,this),g=a._lastTooltipMouse;(!g||Vc(f-g[0],2)+Vc(p-g[1],2)>=9)&&(a._lastTooltipMouse=[f,p],t.setTooltipPosition())}return}u!==i.currentIdx&&(t.setOverOut(!1,i.currentIdx),i.currentIdx=u),u===-1?t.unselectRect():t.selectRectForSingle(this,u),t.setOverOut(u!==-1,u)}).on("mouseout",r=>{var l;a.event=r,!(!t.config||t.hasArcType()||i.currentIdx===-1||!n.interaction_onout)&&((l=t.hideAxisGridFocus)==null||l.call(t),t.unselectRect(),t.setOverOut(!1,i.currentIdx),i.currentIdx=-1)})}return s},clickHandlerForSingleX(e,t){const n=t,{config:a,state:i,$el:{main:s}}=n;if(!e||n.hasArcType()||i.cancelClick){i.cancelClick&&(i.cancelClick=!1);return}const{index:o}=e;s.selectAll(`.${vt.shape}-${o}`).each(function(r){var l;(a.data_selection_grouped||n.isWithinShape(this,r))&&((l=n.toggleShape)==null||l.call(n,this,r,o),a.data_onclick.bind(n.api)(r,this))})},generateEventRectsForMultipleXs(e){const t=this,{config:n,state:a}=t;e.on("click",function(i){a.event=i,t.clickHandlerForMultipleXS.bind(this)(t)}).datum({multipleX:!0}),a.inputType==="mouse"&&e.on("mouseover mousemove",function(i){a.event=i,t.selectRectForMultipleXs(this)}).on("mouseout",i=>{a.event=i,!(!t.config||t.hasArcType()||!n.interaction_onout)&&t.unselectRect()})},clickHandlerForMultipleXS(e){const t=e,{config:n,state:a}=t,i=t.getTargetsToShow();if(t.hasArcType(i))return;const s=se(a.event,this),o=t.findClosestFromTargets(i,s);if(!o)return;const r=t.getPointSensitivity(o);(t.isBarType(o.id)||t.dist(o,s)<r)&&t.$el.main.selectAll(`.${vt.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${vt.shape}-${o.index}`).each(function(){var l;(n.data_selection_grouped||t.isWithinShape(this,o))&&((l=t.toggleShape)==null||l.call(t,this,o,o.index),n.data_onclick.bind(t.api)(o,this))})}},Rv={initClip(){const e=this,{clip:t,datetimeId:n}=e.state;t.id=`${n}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:n}=t;return!n.clipPath&&/-clip$/.test(e)||!n.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!n.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:n,state:{margin:a,width:i,height:s}}=t,o=n.axis_rotated,r=Math.max(30,a.left)-(o?0:20),l=(o?a.top+s+10:a.bottom)+20,c=o?-(1+r):-(r-1),u=-15,d=o?a.left+20:i+10+r;e.attr("x",c).attr("y",u).attr("width",d).attr("height",l)},setYAxisClipPath(e){const t=this,{config:n,state:{margin:a,width:i,height:s}}=t,o=n.axis_rotated,r=Math.max(30,a.left)-(o?20:0),l=n.axis_y_inner,c=l&&!o?n.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),u=-(o?20:a.top),d=(o?i+15+r:a.left+20)+(l?20:0),h=(o?a.bottom+10:a.top+s)+10;e.attr("x",c).attr("y",u).attr("width",d).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:n,xAxisHeight:a},$el:{defs:i}}=e,s=e.getHorizontalAxisHeight("x");if(i&&!n.idXAxisTickTexts){const o=`${n.id}-xaxisticktexts`;e.appendClip(i,o),n.idXAxisTickTexts=o,n.pathXAxisTickTexts=e.getClipPath(n.idXAxisTickTexts)}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&s!==a&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=s},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:n}}}=e,a=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&a){const i=Math.sin(Math.PI/180*Math.abs(a));n.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/i}else n.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:n},$el:{svg:a}}=e;a&&a.select(`#${t.idXAxisTickTexts} rect`).attr("width",n.maxTickSize.x.clipPath).attr("height",30)}},Ev={getAxisSize(e){const t=this,n=t.config.axis_rotated;return n&&e==="x"||!n&&/y2?/.test(e)?t.getAxisWidthByAxisId(e,!0):t.getHorizontalAxisHeight(e)},getAxisWidthByAxisId(e,t){var n,a;const i=this;if(i.axis){const s=(n=i.axis)==null?void 0:n.getAxisLabelPosition(e),{width:o}=i.axis.getMaxTickSize(e,t),r=o===0?.5:0;return o+(((a=i.config.padding)==null?void 0:a.mode)==="fit"?s.isInner?10+r:10:s.isInner?20+r:40)}else return 40},getHorizontalAxisHeight(e){var t,n;const a=this,{config:i,state:s}=a,{rotatedPadding:o,isLegendRight:r,isLegendInset:l}=s,c=i.axis_rotated,u=((t=i.padding)==null?void 0:t.mode)==="fit",d=i[`axis_${e}_inner`],h=i[`axis_${e}_label`].text,f=13;let p=((n=i.padding)==null?void 0:n.mode)==="fit"?d&&!h?e==="y"?1:0:20:30;if(e==="x"&&!i.axis_x_show)return 8;if(e==="x"&&N(i.axis_x_height))return i.axis_x_height;if(e==="y"&&!i.axis_y_show)return i.legend_show&&!r&&!l?10:1;if(e==="y2"&&!i.axis_y2_show)return u?0:o.top;const g=a.axis.getMaxTickSize(e),_=Math.abs(i.axis_x_tick_rotate)>0&&(!i.axis_x_tick_autorotate||a.needToRotateXAxisTickTexts());return(i.axis_x_tick_multiline||_)&&g.height>f&&(p+=g.height-f),p+(a.axis.getAxisLabelPosition(e).isInner?0:10)+(e==="y2"&&!c?-10:0)},getEventRectWidth(){const e=this,{config:t,axis:n}=e,a=t.axis_x_inverted,i=n.x.tickInterval();return Math.max(0,a?Math.abs(i):i)},getAxisTickRotate(e){const t=this,{axis:n,config:a,state:i,$el:s}=t;let o=a[`axis_${e}_tick_rotate`];if(e==="x"){const r=n.isCategorized()||n.isTimeSeries();if(a.axis_x_tick_fit&&r){const l=a.axis_x_tick_count,c=i.current.maxTickSize.x.ticks.length;let u=0;if(l?u=l>c?c:l:c&&(u=c),u!==i.axis.x.tickCount){const{targets:d}=t.data;i.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(d,"min"),t.getXDomainMinMax(d,"max")],u)}i.axis.x.tickCount=u}(s.svg||i.isCanvasMode)&&a.axis_x_tick_autorotate&&a.axis_x_tick_fit&&!a.axis_x_tick_multiline&&!a.axis_x_tick_culling&&r&&(o=t.needToRotateXAxisTickTexts()?a.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const e=this,{state:{axis:t,current:n,isLegendRight:a,legendItemWidth:i}}=e,s=a&&i,o=n.width-s-e.getCurrentPaddingByDirection("left")-e.getCurrentPaddingByDirection("right"),r=t.x.tickCount+t.x.padding.left+t.x.padding.right,{width:l}=e.axis.getMaxTickSize("x"),c=r?o/r:0;return l>c}},Mv={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:[]},Dv={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:[]},Ov={axis_y2_clipPath:!0,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:[]},$v=Object.defineProperty,Hc=Object.getOwnPropertySymbols,Fv=Object.prototype.hasOwnProperty,Iv=Object.prototype.propertyIsEnumerable,Yc=(e,t,n)=>t in e?$v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Os=(e,t)=>{for(var n in t||(t={}))Fv.call(t,n)&&Yc(e,n,t[n]);if(Hc)for(var n of Hc(t))Iv.call(t,n)&&Yc(e,n,t[n]);return e},Bv=Os(Os(Os({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},Mv),Dv),Ov),zv={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const Nv=[Qm,tv,ev],jc={axis:Av,clip:Rv,eventrect:Pv,sizeAxis:Ev},Uc={optDataAxis:zv,optAxis:Bv};function Kc(e){return Object.keys(e).map(t=>e[t])}function Zc(e=[],t=[]){pt(Rt.prototype,Kc(jc).concat(e)),pt(Jt.prototype,Nv),Oe.setOptions(Kc(Uc).concat(t))}function Vn(e=[],t=[]){Zc(e,t)}function Ve(e,t=[]){const n=Array.isArray(e)?e:e?[e]:[];Zc([bn,ai,qm].concat(n),[an,Jm].concat(t))}let qc=()=>(Ve(Xn,[Gn]),(qc=()=>X.AREA)()),Jc=()=>(Ve(Xn,[Gn]),(Jc=()=>X.AREA_LINE_RANGE)()),Qc=()=>(Ve(Xn,[Gn]),(Qc=()=>X.AREA_STEP_RANGE)()),tu=()=>(Ve(Xn,[Gn,Ss]),(tu=()=>X.AREA_SPLINE)()),eu=()=>(Ve(Xn,[Gn,Ss]),(eu=()=>X.AREA_SPLINE_RANGE)()),nu=()=>(Ve(Xn,[Gn]),(nu=()=>X.AREA_STEP)());function $s(e){const t=this.config.bar_connectLine,n=(t==null?void 0:t[e])||t;return/^(start|end)\-(start|end)$/.test(n)?n:null}var Xv={initBar(){const{$el:e,config:t,state:{clip:n}}=this;e.bar=e.main.select(`.${U.chart}`),e.bar=t.bar_front?e.bar.append("g"):e.bar.insert("g",":first-child"),e.bar.attr("class",de.chartBars).call(this.setCssRule(!1,`.${de.chartBars}`,["pointer-events:none"])),t.clipPath===!1&&(t.bar_radius||t.bar_radius_ratio)&&e.bar.attr("clip-path",n.pathXAxis.replace(/#[^)]*/,`#${n.id}`))},updateTargetsForBar(e){const t=this,{config:n}=t,a=t.getClass("bars",!0),i=n.interaction_enabled&&n.data_selection_isselectable;fs.call(t,e,{type:"Bar",elKey:"bar",containerClass:de.chartBars,itemClass:de.chartBar,initFn:t.initBar}).append("g").attr("class",a).style("cursor",o=>{var r;return(r=i==null?void 0:i.bind)!=null&&r.call(i,t.api)(o)?"pointer":null}).call(o=>{t.setCssRule(!0,` .${de.bar}`,["fill"],t.color)(o),o.each(function(r){$s.call(t,r.id)&&(0,B.select)(this).append("path").attr("class",de.barConnectLine)})})},updateBar(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:a,$el:i,$T:s}=n,o=t?i.subchart:i,r=n.getClass("bar",!0),l=n.initialOpacity.bind(n);a.bar_linearGradient&&n.updateLinearGradient();const c=o.main.selectAll(`.${de.bars}`).selectAll(`.${de.bar}`).data(n.labelishData.bind(n));s(c.exit(),e).style("opacity","0").remove(),o.bar=c.enter().append("path").attr("class",r).style("fill",n.generateUpdateBarColor()).merge(c).style("opacity",l),n.setRatioForGroupedData(o.bar.data())},generateUpdateBarColor(){const e=this,t=e.getStylePropValue(e.color)||(()=>null);return n=>kl.call(e,n,"bar_linearGradient",t)},updateBarColor(e){return this.generateUpdateBarColor()(e)},redrawBar(e,t,n=!1){const a=this;if(a.state.isCanvasMode)return[];const{bar:i}=n?a.$el.subchart:a.$el,s=[],o=new Map,r=ka(a),l=a.generateUpdateBarColor(),c=function(d,h,f){var p;const _=N(d.value)||a.isBarRangeType(d)||((p=a.isSubchartCandlestickBarValue)==null?void 0:p.call(a,d,n))?e(d,h):[""];let x=o.get(d.id);if(x===void 0&&(x=$s.call(a,d.id),o.set(d.id,x)),_.length>1&&s.push(_[1]),h===f.length-1&&s.length){const m=a.$T((0,B.select)(this.parentNode.querySelector(`.${de.barConnectLine}`)),t,ye());a.updateConnectLine(m,x,s),s.splice(0)}return _[0]},u=a.$T(i,t,ye());return r&&typeof u.attrTween=="function"?u.attrTween("d",function(d,h,f){var p;const g=c.call(this,d,h,f);return Rd((p=this.getAttribute("d"))!=null?p:"",g)}):u.attr("d",c),[u.style("fill",d=>{var h;return((h=a.getSubchartCandlestickBarColor)==null?void 0:h.call(a,d,n))||l(d)}).style("clip-path",d=>d.clipPath).style("opacity",null)]},generateDrawBar(e,t){const n=this,{config:a}=n,i=n.generateGetBarPoints(e,t),s=ka(n),o=s?_i(n):new Set,r=new Map;return(l,c)=>{const u=i(l,c),{indexX:d,indexY:h,isNegative:f,pos:p,radius:g,clipPath:_}=xi(n,l,u,s,o,n.isStackingRadiusData.bind(n)),x=["",""];if(l.clipPath=_,s){const T=`a${g} ${g} ${f?"1 0 0":"0 0 1"} `;x[h]=`${T}${g},${g}`,x[d]=`${T}${[-g,g][a.axis_rotated?"sort":"reverse"]()}`,f&&x.reverse()}const m=a.axis_rotated?`H${p} ${x[0]}V${u[2][h]-g} ${x[1]}H${u[3][d]}`:`V${p} ${x[0]}H${u[2][d]-g} ${x[1]}V${u[3][h]}`,v=[`M${u[0][d]},${u[0][h]}${m}z`];let b=r.get(l.id);return b===void 0&&(b=$s.call(n,l.id),r.set(l.id,b)),b&&v.push(a.axis_rotated?{x:u[0][d],y:u[0][h],width:u[0][d]-p,height:u[2][h]-u[0][h]}:{x:u[0][d],y:p,width:u[2][d]-u[0][d],height:u[3][h]-p}),v}},isStackingRadiusData(e){const t=this,{$el:n,config:a,data:i,state:s}=t,{id:o,index:r,value:l}=e;if(s.hiddenTargetIds.has(o)){const h=n.bar.filter(f=>f.id===o&&f.value===l);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const c=a.data_groups.find(h=>h.indexOf(o)>-1),d=t.orderTargets(t.filterTargetsToShow(i.targets.filter(t.isBarType,t))).filter(h=>c.indexOf(h.id)>-1).map(h=>{const f=h.values[r];if(f&&(N(l)&&l>0?f.value>0:f.value<0))return f}).filter(Boolean).map(h=>h.id);return l!==0&&d.indexOf(o)===d.length-1},updateConnectLine(e,t,n){const a=n.map((i,s,o)=>{const r=this.config.axis_rotated,l=/^start-(start|end)$/.test(t),c=/^end-(start|end)$/.test(t),u=[],d=r?c?i.x-i.width:i.x:i.x+i.width,h=r||l?i.y+i.height:i.y;return s===0?u.push(`${d},${h}`):(u.push(r?`L${i.x-(/\w+-end$/.test(t)?i.width:0)},${i.y}`:`L${i.x},${i.y+(/\w+-start$/.test(t)?i.height:0)}`),s<o.length-1&&u.push(`M${d},${h}`)),u.join(" ")});e.attr("d",`M${a.join("")}z`)}},Gv={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 au=()=>(Vn([Xv,bn],[Gv,an]),(au=()=>X.BAR)());const Pt={boxplot:"bb-boxplot",boxplotBox:"bb-boxplot-box",boxplotMean:"bb-boxplot-mean",boxplotMedian:"bb-boxplot-median",boxplotOutlier:"bb-boxplot-outlier",boxplotWhisker:"bb-boxplot-whisker",chartBoxplot:"bb-chart-boxplot",chartBoxplots:"bb-chart-boxplots"};function Fs(e,t){const n=(e.length-1)*t,a=Math.floor(n),i=n-a;return e[a]+(i&&e[a+1]!==void 0?i*(e[a+1]-e[a]):0)}function Wv(e,t){const n=e.filter(N).sort((r,l)=>r-l);if(!n.length)return null;const a=Fs(n,.25),i=Fs(n,.75),s=(i-a)*t,o=n.filter(r=>r>=a-s&&r<=i+s);return{min:o[0],q1:a,median:Fs(n,.5),q3:i,max:o[o.length-1],outliers:n.filter(r=>r<a-s||r>i+s),mean:n.reduce((r,l)=>r+l,0)/n.length}}var Is={isBoxplotType(e){return this.isTypeOf(e,"boxplot")},getBoxplotData({value:e}){var t;if(!et(e))return null;const{config:n}=this,a=(t=this.boxplotParsed)!=null?t:this.boxplotParsed=new WeakMap;let i=a.get(e);if(i===void 0){const{boxplot_outlier_show:s,boxplot_mean_show:o}=n;if(n.boxplot_samples)i=Wv(e,n.boxplot_whisker_iqr);else if(e.length>=5&&e.slice(0,5).every(N)){const[r,l,c,u,d,h,f]=e;i={min:r,q1:l,median:c,q3:u,max:d,outliers:et(h)?h.filter(N):[],mean:N(f)?f:void 0}}else i=null;i&&(!s&&(i.outliers=[]),!o&&(i.mean=void 0)),a.set(e,i)}return i},getBoxplotDomainValues(e){const t=this.getBoxplotData(e);return t?[t.min,t.max,...t.outliers]:[]},generateGetBoxplotPoints(e,t=!1){const n=this,a=t?n.axis.subX:n.axis.x,i=n.getIndicesMax(e)+1,s=n.getBarW("boxplot",a,i);if(Q(s)){const l=n.getTargetsToShow().map(c=>c.id);l.forEach(c=>{var u;(u=s[c])!=null||(s[c]=s._$width)}),s._$total=l.map(c=>s[c])}const o=n.getShapeX(s,e,!!t),r=n.getShapeY(!!t);return l=>{const c=n.getBoxplotData(l);if(!c)return null;const u=N(s)?s:s[l.id]||s._$width,d=o(l);return[[d,r(c.q1)],[d+u,r(c.q3)],[d+u/2,r(c.min),r(c.max)],[r(c.median)],c.outliers.map(h=>r(h)),N(c.mean)?[r(c.mean)]:[]]}},getBoxplotTooltipRows(e,t,n){const a=this.getBoxplotData(e);if(!a)return[];const i=r=>t(r,...n),s=a.outliers.slice(0,5).map(i).join(", "),o=[["Max",i(a.max)],["Q3",i(a.q3)],["Median",i(a.median)],["Q1",i(a.q1)],["Min",i(a.min)]];return N(a.mean)&&o.splice(3,0,["Mean",i(a.mean)]),a.outliers.length&&o.push(["Outliers",s+(a.outliers.length>5?`, ... (${a.outliers.length})`:"")]),o}},Vv=Object.defineProperty,Hv=Object.defineProperties,Yv=Object.getOwnPropertyDescriptors,iu=Object.getOwnPropertySymbols,jv=Object.prototype.hasOwnProperty,Uv=Object.prototype.propertyIsEnumerable,su=(e,t,n)=>t in e?Vv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kv=(e,t)=>{for(var n in t||(t={}))jv.call(t,n)&&su(e,n,t[n]);if(iu)for(var n of iu(t))Uv.call(t,n)&&su(e,n,t[n]);return e},Zv=(e,t)=>Hv(e,Yv(t)),qv=Zv(Kv({},Is),{initBoxplot(){const e=this,{$el:t}=e;t.boxplot=t.main.select(`.${U.chart}`).append("g").attr("class",Pt.chartBoxplots)},updateTargetsForBoxplot(e){const t=this,{$el:n}=t;!t.$el.boxplot&&t.initBoxplot(),n.main.select(`.${Pt.chartBoxplots}`).selectAll(`.${Pt.chartBoxplot}`).data(t.filterNullish(e)).attr("class",i=>Pt.chartBoxplot+t.classTarget(i.id)).enter().append("g").attr("class",i=>Pt.chartBoxplot+t.classTarget(i.id)).style("pointer-events","none")},updateBoxplot(e){const t=this,{$el:n,$T:a}=t,i=n.main.selectAll(`.${Pt.chartBoxplot}`).selectAll(`.${Pt.boxplot}`).data(o=>t.getBoxplotRows(o));a(i.exit(),e).style("opacity","0").remove();const s=i.enter().append("g").attr("class",o=>t.generateClass(Pt.boxplot,o.index).trim());s.append("path").attr("class",Pt.boxplotWhisker),s.append("path").attr("class",Pt.boxplotBox),s.append("path").attr("class",Pt.boxplotMedian),n.boxplot=i.merge(s).attr("class",o=>t.generateClass(Pt.boxplot,o.index).trim()).style("opacity",t.initialOpacity.bind(t))},getBoxplotRows(e){return this.isBoxplotType(e)?e.values.filter(t=>this.getBoxplotData(t)):[]},generateDrawBoxplot(e,t){const n=this,a=n.generateGetBoxplotPoints(e,t),i=n.config.axis_rotated?(s,o)=>`${o},${s}`:(s,o)=>`${s},${o}`;return(s,o,r)=>{const l=a(s,o);if(!l)return;const{config:c}=n,[[u,d],[h,f],[p,g,_],[x],m,v]=l,b=(h-u)*c.boxplot_whisker_width/2,T=b>0?`M${i(p-b,_)}L${i(p+b,_)}M${i(p-b,g)}L${i(p+b,g)}`:"";r.select(`.${Pt.boxplotBox}`).attr("d",`M${i(u,d)}L${i(h,d)}L${i(h,f)}L${i(u,f)}z`).style("fill",n.color(s)),r.select(`.${Pt.boxplotMedian}`).attr("d",`M${i(u,x)}L${i(h,x)}`),r.select(`.${Pt.boxplotWhisker}`).attr("d",`M${i(p,_)}L${i(p,f)}M${i(p,d)}L${i(p,g)}${T}`);const k=(0,B.select)(r.node()),w=c.boxplot_outlier_r,y=c.boxplot_mean_r;k.selectAll(`.${Pt.boxplotOutlier}`).data(m).join("path").attr("class",Pt.boxplotOutlier).attr("d",C=>{const[A,S]=c.axis_rotated?[C,p]:[p,C];return`M${A-w},${S}a${w},${w} 0 1,0 ${2*w},0a${w},${w} 0 1,0 ${-2*w},0`}),k.selectAll(`.${Pt.boxplotMean}`).data(v).join("path").attr("class",Pt.boxplotMean).attr("d",C=>`M${i(p-y,C)}L${i(p,C-y)}L${i(p+y,C)}L${i(p,C+y)}z`)}},redrawBoxplot(e,t){const n=this,{$el:a,$T:i}=n,s=ye(!0);return[a.boxplot.each(function(o,r){e(o,r,i((0,B.select)(this),t,s))}).style("opacity",null)]}}),Jv={boxplot_samples:!1,boxplot_width:void 0,boxplot_width_ratio:.6,boxplot_width_max:void 0,boxplot_whisker_width:.5,boxplot_whisker_iqr:1.5,boxplot_outlier_show:!0,boxplot_outlier_r:3,boxplot_mean_show:!1,boxplot_mean_r:4};const Qv={padded:!0,domainValues:(e,t)=>Is.getBoxplotDomainValues.call(e,t),hit:(e,t)=>`.${Pt.chartBoxplot}.${U.target}${e.getTargetSelectorSuffix(t.id)} .${Pt.boxplot}-${t.index} .${Pt.boxplotBox}`,tooltipRows:(e,t,n,a)=>Is.getBoxplotTooltipRows.call(e,t,n,a)};let ou=()=>(Vn([qv,bn],[Jv,an]),ac("boxplot",Qv),(ou=()=>"boxplot")());var tb={initBubble(){const e=this,{config:t}=e;e.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength(){const e=this,{width:t,height:n}=e.state,a=Z.bubbleBaseLength;let i=e.cache.get(a);return i||e.cache.add(a,i=be("min",[t,n])),i},getBubbleR(e){const t=this;let n=t.config.bubble_maxR;G(n)?n=n.bind(t.api)(e):N(n)||(n=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const a=Z.bubbleMaxValue;let i=t.cache.get(a);i===null&&t.cache.add(a,i=be("max",t.getMinMaxData().max.map(r=>t.isBubbleZType(r)?t.getBubbleZData(r.value,"y"):Q(r.value)?r.value.mid:r.value)));const s=n*n*Math.PI,o=(t.isBubbleZType(e)?t.getBubbleZData(e.value,"z"):e.value)*(s/i);return Math.sqrt(o/Math.PI)},getBubbleZData(e,t){return Q(e)?e[t]:e[t==="y"?0:1]}},eb=tb,nb={bubble_maxR:35,bubble_zerobased:!1};let ru=()=>(Vn([bn,ai,eb],[nb,an]),(ru=()=>X.BUBBLE)());var lu=kt(10),ab=Object.defineProperty,ib=Object.defineProperties,sb=Object.getOwnPropertyDescriptors,cu=Object.getOwnPropertySymbols,ob=Object.prototype.hasOwnProperty,rb=Object.prototype.propertyIsEnumerable,uu=(e,t,n)=>t in e?ab(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bs=(e,t)=>{for(var n in t||(t={}))ob.call(t,n)&&uu(e,n,t[n]);if(cu)for(var n of cu(t))rb.call(t,n)&&uu(e,n,t[n]);return e},zs=(e,t)=>ib(e,sb(t));const zt={bullet:"bb-bullet",chartBullet:"bb-chart-bullet",chartBullets:"bb-chart-bullets",bulletRange:"bb-bullet-range",bulletMeasure:"bb-bullet-measure",bulletTarget:"bb-bullet-target",bulletAxis:"bb-bullet-axis",bulletTitle:"bb-bullet-title"},du=16,on=e=>Number.isFinite(e),Ns=(e,t)=>e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;function lb(e){let t=0,n=0;return e.forEach(a=>{t=Math.min(t,a),n=Math.max(n,a)}),[t,n]}function cb(e,t){var n;const{config:a,api:i}=this,s=a.bullet_title_text;let o;return G(s)?o=s.call(i,e,t):Q(s)&&(o=Ns(s,e)),String((n=o!=null?o:Ns(a.data_names,e))!=null?n:e)}function ub(e){const t=this,{config:n,cache:a,state:{isCanvasMode:i},$el:s}=t;if(n.bullet_rotated)return 18;const o=e.map(c=>c.title),r=`bullet-title-${i}-${o.join("\0")}`;let l=a.get(r)||0;if(!l&&i&&t.canvasRenderer){const{ctx:c}=t.canvasRenderer;c.save(),c.font=t.canvasTheme.style.bullet.titleFont,l=o.reduce((u,d)=>Math.max(u,c.measureText(d).width),0),c.restore()}else if(!l&&!i&&s.bullet){const c=s.bullet.append("text").attr("class",zt.bulletTitle).style("visibility","hidden");o.forEach(u=>{var d,h;l=Math.max(l,((h=(d=c.text(u).node()).getComputedTextLength)==null?void 0:h.call(d))||0)}),c.remove()}return l?a.add(r,l):l=o.reduce((c,u)=>Math.max(c,u.length),0)*6.5,Math.ceil(l)+8}function hu(e){var t,n;const a=this,{config:i,state:{current:{width:s,height:o},isCanvasMode:r,isLegendRight:l}}=a,c=a.getCurrentPadding(),u=i.legend_show&&i.legend_position==="bottom"?(r?0:a.getLegendHeight())+10:0,d=r?a.getCanvasSurfaceHeight():o,h=i.bullet_axis_show&&!i.bullet_rotated?du:0,f=i.legend_show&&l?a.getLegendWidth()+(((t=i.padding)==null?void 0:t.mode)==="fit"?0:20):0,p=!i.bullet_rotated&&i.bullet_label_show&&a.hasDataLabel(),g=p||i.bullet_title_show?e!=null?e:a.getBulletData():[],_=p&&g.some(T=>T.domainMax<=0||T.value>=T.domainMax)?14:0,x=i.bullet_title_show?ub.call(a,g):0,m=i.bullet_rotated?0:x,v=i.bullet_rotated?x:0,b=c.top+(r&&((n=a.getCanvasTitleDescent)==null?void 0:n.call(a))||0);return{width:Math.max(0,s-c.left-c.right-h*2-_-m-f),height:Math.max(0,d-u-b-c.bottom-v),left:c.left+h+m,top:b}}function db(){const{config:e}=this;return e.bullet_axis_show?e.bullet_rotated?34:20:0}function hb(e,t){const n=this.config.bullet_ranges;let a=[];return G(n)?a=n.call(this.api,e,t)||[]:et(n)?a=n:Q(n)&&et(n[e])&&(a=n[e]),a.filter(on).sort((i,s)=>i-s)}function fb(e,t){const n=this.config.bullet_target;let a;return G(n)?a=n.call(this.api,e,t):et(n)||on(n)?a=n:Q(n)&&(a=Ns(n,e)),(et(a)?a:[a]).filter(on)}function gb(e,t){const n=this.config.bullet_range_colors;return G(n)?n.call(this.api,e,t):et(n)&&n[e]?n[e]:null}function pb(e,t,n){const{config:a,api:i}=this,{axes:s,axisLen:o,isRotated:r}=e,l=`${t}|${n}`;let c=s.get(l);if(!c){const u=(0,ze.scaleLinear)().domain([t,n]).range(r?[o,0]:[0,o]),{bullet_axis_tick_count:d,bullet_axis_tick_values:h,bullet_axis_tick_format:f}=a,p=on(d)&&d>0?Math.min(d,Math.max(2,o)):Math.max(2,Math.floor(o/(r?40:60))),[g,_]=[t,n],x=et(h)?h.filter(v=>on(v)&&v>=g&&v<=_):u.ticks(p),m=G(f)?v=>String(f.call(i,v)):u.tickFormat(p);c={scale:u,count:p,ticks:x,format:m,key:`${u.domain()}|${u.range()}|${x}|${x.map(m)}`},s.set(l,c)}return c}function Xs(){const e=this,{config:t}=e,n=e.getBulletData(),a=hu.call(e,n),i=t.bullet_rotated,s=db.call(e),o=(i?a.width:a.height)/(n.length||1);return{rows:n,area:a,isRotated:i,axisSize:s,band:o,bandInner:Math.max(0,o-t.bullet_padding-s),axisLen:i?a.height:a.width,axes:new Map}}function Gs(e,t){const n=this,{config:a}=n,{area:i,isRotated:s,axisSize:o,band:r,bandInner:l,axisLen:c}=t,{height:u,left:d,top:h}=i,{domainMin:f,domainMax:p}=e,g=l*a.bullet_width_ratio,_=l*a.bullet_width_target_ratio,x=R=>(R-f)/(p-f)*c,m=R=>Math.min(Math.max(x(R),0),c),v=m(0),b=e.ranges.map((R,E)=>({value:R,index:E})).sort((R,E)=>E.value-R.value).map(({value:R,index:E})=>{const M=m(R);return zs(Bs({},s?{x:0,y:u-M,width:l,height:M}:{x:0,y:0,width:M,height:l}),{fill:gb.call(n,E,e.ranges.length),t:E/Math.max(e.ranges.length-1,1)})}),T=a.bullet_type==="dot",k=a.bullet_marker_size||g/2,w=m(e.value),y=e.value<0;let C;if(T)C={cx:s?l/2:w,cy:s?u-w:l/2,r:k};else{const R=Math.abs(w-v);C=s?{x:(l-g)/2,y:u-Math.max(v,w),width:g,height:R}:{x:Math.min(v,w),y:(l-g)/2,width:R,height:g}}const A=e.targets.filter(R=>R>=f&&R<=p).map(R=>{const E=x(R);return s?{x1:(l-_)/2,x2:(l+_)/2,y1:u-E,y2:u-E}:{x1:E,x2:E,y1:(l-_)/2,y2:(l+_)/2}}),S=T?k:0,L=y?v:w,P=zs(Bs({},s?{x:l/2,y:u-L-S-6}:{x:L+S+5,y:l/2}),{center:T?{x:C.cx,y:C.cy}:{x:C.x+C.width/2,y:C.y+C.height/2}}),D=a.bullet_title_show?s?{text:e.title,x:l/2,y:u+13,anchor:"middle"}:{text:e.title,x:-(o?du:0)-6,y:l/2,anchor:"end"}:null;return{area:{left:d,top:h},offset:s?{x:e.index*r+o,y:0}:{x:0,y:e.index*r},ranges:b,isDot:T,measure:C,color:n.color(e),targets:A,title:D,axis:o?zs(Bs({},pb.call(n,t,f,p)),{rotated:s,x:0,y:s?0:l}):null,label:P}}const _b={ownLegendLayout:!0,themeTextColor:!0,textAnchor(e){return e.config.bullet_rotated||e.config.data_labels.centered?"middle":"start"},labelData(e,t){const n=t.values[t.values.length-1];return e.config.bullet_label_show&&n&&(N(n.value)||n.value)?[n]:[]},labelFormat(e){const t=e.config.bullet_label_format;return G(t)?(n,a)=>t.call(e.api,n,a):void 0},tooltipTarget(e,t){var n;const a=e.getBulletData().filter(s=>e.isTargetToShow(s.id)),i=(n=t.data)!=null&&n.id?a.filter(s=>s.id===t.data.id):[a[t.index]].filter(Boolean);return{data:i,point:i[0]&&e.getBulletMeasureCenter(i[0])}},textX(e,t,n,a){return t?t[e.config.data_labels.centered?1:0][0]+Bn.call(e,n,"x"):da(a,"x")},textY(e,t,n,a,i){if(!t)return da(a,"y");const s=e.config.data_labels.centered,o=t[s?1:0][1];return(s||!e.config.bullet_rotated?o+i.height/2-3:o)+Bn.call(e,n,"y")}};var xb={isBulletType(e){return this.isTypeOf(e,"bullet")},getBulletSize(){return hu.call(this)},getCanvasTitleDescent(){const{config:e,canvasRenderer:t,canvasTheme:n}=this;if(!e.title_text||!t)return 0;const{ctx:a}=t;a.save(),a.font=n.style.title.font;const i=a.measureText(String(e.title_text)).fontBoundingBoxDescent||0;return a.restore(),i},getBulletData(){const e=this;return e.data.targets.filter(e.isBulletType.bind(e)).map((n,a)=>{var i;const s=Number((i=n.values[n.values.length-1])==null?void 0:i.value),o=on(s)?s:0,r=hb.call(e,n.id,o),l=fb.call(e,n.id,o),[c,u]=lb([o].concat(l,r)),{bullet_axis_min:d,bullet_axis_max:h}=e.config;let f=on(d)?d:c,p=on(h)?h:u;f>=p&&(f=c,p=u),p===f&&(p=f+1);const g=p-f,_=r.length?r:[.5,.75,1].map(x=>f+g*x);return{id:n.id,index:a,x:a,name:n.id,value:o,title:e.config.bullet_title_show?cb.call(e,n.id,o):"",ranges:_,targets:l,domainMin:f,domainMax:p}})},getBulletLayout(){return Xs.call(this)},getBulletMeasureCenter(e){const{area:t,offset:n,measure:a}=Gs.call(this,e,Xs.call(this)),[i,s]="cx"in a?[a.cx,a.cy]:[a.x+a.width/2,a.y+a.height/2];return[t.left+n.x+i,t.top+n.y+s]},generateGetBulletPoints(){const e=this;let t;return n=>{if(!t){const a=Xs.call(e);t={},a.rows.forEach(i=>{const{area:s,offset:o,label:r}=Gs.call(e,i,a),l=s.left+o.x,c=s.top+o.y;t[i.id]=[[l+r.x,c+r.y],[l+r.center.x,c+r.center.y]]})}return t[n.id]}},getBulletRowGeometry(e,t){return Gs.call(this,e,t)}},mb=Object.defineProperty,vb=Object.defineProperties,bb=Object.getOwnPropertyDescriptors,fu=Object.getOwnPropertySymbols,yb=Object.prototype.hasOwnProperty,Tb=Object.prototype.propertyIsEnumerable,gu=(e,t,n)=>t in e?mb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wb=(e,t)=>{for(var n in t||(t={}))yb.call(t,n)&&gu(e,n,t[n]);if(fu)for(var n of fu(t))Tb.call(t,n)&&gu(e,n,t[n]);return e},kb=(e,t)=>vb(e,bb(t));const Ws=(0,B.local)();function pu(e,t,n,a){const i=e.select(`${t}.${n}`),s=i.empty();return[s?e.insert(t,a).classed(n,!0):i,s]}function yn(e,t,n,a,i,s){const o=n?t:e.$T(t,a);Object.keys(i).forEach(r=>o.attr(r,i[r])),s!==void 0&&o.style("fill",s)}function Cb(e,t,n,a){var i,s;const o=this,{offset:r,ranges:l,isDot:c,measure:u,color:d,targets:h,axis:f,title:p}=o.getBulletRowGeometry(t,n),g={target:`.${zt.bulletTarget}`,axis:`.${zt.bulletAxis}`};yn(o,e,e.attr("transform")===null,a,{transform:`translate(${r.x}, ${r.y})`});const _=e.selectAll(`.${zt.bulletRange}`).data(l),x=({x:y,y:C,width:A,height:S})=>({x:y,y:C,width:A,height:S}),m=(y,{fill:C,t:A})=>y.style("--bb-t",C?null:A);_.exit().remove(),_.each(function(y){const C=(0,B.select)(this);yn(o,C,!1,a,x(y),y.fill),m(C,y)}),_.enter().insert("rect",`.${zt.bulletMeasure}`).attr("class",zt.bulletRange).each(function(y){const C=(0,B.select)(this);yn(o,C,!0,a,x(y),y.fill),m(C,y)});const v=c?"circle":"rect";e.selectAll(`.${zt.bulletMeasure}`).filter(function(){return this.tagName.toLowerCase()!==v}).remove();const[b,T]=pu(e,v,zt.bulletMeasure,`${g.target}, ${g.axis}`);b.attr("class",[zt.bulletMeasure,o.generateClass(vt.shape,t.index),o.generateClass(zt.bullet,t.id)].join("").replace(/\s+/g," ").trim()).datum(t),yn(o,b,T,a,u,d);const k=e.selectAll(`line${g.target}`).nodes();k.slice(h.length).forEach(y=>y.remove()),h.forEach((y,C)=>{const A=!k[C],S=A?e.insert("line",g.axis).classed(zt.bulletTarget,!0):(0,B.select)(k[C]);S.datum(t),yn(o,S,A,a,y)});let w=e.select(g.axis);if(f&&!w.empty()&&((i=Ws.get(w.node()))==null?void 0:i.rotated)!==f.rotated&&(w.remove(),w=e.select(g.axis)),f){const y=w.empty();y&&(w=e.append("g").attr("class",zt.bulletAxis)),f.rotated?w.attr("transform",null):yn(o,w,y,a,{transform:`translate(${f.x}, ${f.y})`});const{key:C}=f;((s=Ws.get(w.node()))==null?void 0:s.key)!==C&&((y?w:o.$T(w,a)).call((f.rotated?lu.axisLeft:lu.axisBottom)(f.scale).tickValues(f.ticks).tickFormat(f.format).tickSizeOuter(0)),w.attr("font-family",null).attr("font-size",null),Ws.set(w.node(),{rotated:f.rotated,key:C}))}else w.remove();if(p){const[y,C]=pu(e,"text",zt.bulletTitle,null);y.text(p.text).style("text-anchor",p.anchor).attr("dy",p.anchor==="end"?".35em":null),yn(o,y,C,a,{x:p.x,y:p.y})}else e.select(`.${zt.bulletTitle}`).remove()}var Sb=kb(wb({},xb),{initBullet(){const e=this,{$el:t}=e;t.bullet=t.main.select(`.${U.chart}`).append("g").classed(zt.chartBullets,!0),e.bindBulletEvent()},bindBulletEvent(){const e=this,{$el:{bullet:t},config:n,state:a}=e;if(!n.interaction_enabled)return;const i=o=>{var r,l;const c=o.target===t.node()?(l=(r=a.eventReceiver.rect)==null?void 0:r.node)==null?void 0:l.call(r):o.target;if(c&&/^(rect|circle|line)$/i.test(c.tagName)){const u=(0,B.select)(c).datum();if(u&&Q(u)&&"id"in u)return a.event=o,u}},s=a.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=i(o);r&&(e.showTooltip([e.addName(r)],e.$el.svg.node()),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=i(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))}).on("click",o=>{const r=i(o);r&&n.data_onclick.bind(e.api)(r,o.target)})},updateTargetsForBullet(){const e=this,{$el:t}=e;t.bullet||e.initBullet();const n=e.getBulletData(),a=s=>zt.chartBullet+e.classTarget(s.id),i=t.bullet.selectAll(`.${zt.chartBullet}`).data(n,s=>s.id);i.exit().remove(),i.enter().append("g").merge(i).attr("class",a)},redrawBullet(e){const t=this,{$el:{bullet:n}}=t,a=t.getBulletLayout(),{left:i,top:s}=a.area;n.attr("transform",`translate(${i}, ${s})`),n.selectAll(`.${zt.chartBullet}`).data(a.rows,o=>o.id).each(function(o){Cb.call(t,(0,B.select)(this),o,a,e)})}}),Ab={bullet_rotated:!1,bullet_type:"bar",bullet_marker_size:0,bullet_ranges:null,bullet_target:null,bullet_width_ratio:.35,bullet_width_target_ratio:.6,bullet_range_colors:null,bullet_padding:4,bullet_axis_show:!0,bullet_axis_min:void 0,bullet_axis_max:void 0,bullet_axis_tick_count:void 0,bullet_axis_tick_values:void 0,bullet_axis_tick_format:void 0,bullet_title_show:!1,bullet_title_text:void 0,bullet_label_show:!0,bullet_label_format:void 0};let _u=()=>(pt(Rt.prototype,[Sb]),Oe.setOptions([Ab]),vn("bullet",{hooks:_b}),(_u=()=>"bullet")());var Lb=Object.defineProperty,xu=Object.getOwnPropertySymbols,Pb=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable,mu=(e,t,n)=>t in e?Lb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eb=(e,t)=>{for(var n in t||(t={}))Pb.call(t,n)&&mu(e,n,t[n]);if(xu)for(var n of xu(t))Rb.call(t,n)&&mu(e,n,t[n]);return e},Mb={generateGetCandlestickPoints(e,t=!1){const n=this,a=t?n.axis.subX:n.axis.x,i=n.getIndicesMax(e)+1,s=n.getBarW("candlestick",a,i),o=n.getShapeX(s,e,!!t),r=n.getShapeY(!!t),l=n.getShapeOffset(n.isCandlestickType,e,!!t),c=n.getYScaleById.bind(n);return(u,d)=>{const h=c.call(n,u.id,t)(n.getShapeYMin(u.id,t)),f=l(u,d)||h,p=N(s)?s:s[u.id]||s._$width,g=n.getCandlestickData(u);let _;if(g&&N(g.open)&&N(g.close)){const x={start:o(u),end:0};x.end=x.start+p;const m={start:r(g.open),end:r(g.close)},v={x:x.start+p/2,high:r(g.high),low:r(g.low)},b=h-f;m.start-=b,m.end-=b,v.high-=b,v.low-=b,_=[[x.start,m.start],[x.end,m.end],[v.x,v.low,v.high]]}else _=[[0,0],[0,0],[0,0,0]];return _}},getCandlestickData({value:e}){let t;if(et(e)){const[n,a,i,s,o=!1]=e;t={open:n,high:a,low:i,close:s},o!==!1&&(t.volume=o)}else Q(e)&&(t=Eb({},e));return t&&(t._isUp=t.close>=t.open),t||null}},Db=Object.defineProperty,Ob=Object.defineProperties,$b=Object.getOwnPropertyDescriptors,vu=Object.getOwnPropertySymbols,Fb=Object.prototype.hasOwnProperty,Ib=Object.prototype.propertyIsEnumerable,bu=(e,t,n)=>t in e?Db(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bb=(e,t)=>{for(var n in t||(t={}))Fb.call(t,n)&&bu(e,n,t[n]);if(vu)for(var n of vu(t))Ib.call(t,n)&&bu(e,n,t[n]);return e},zb=(e,t)=>Ob(e,$b(t)),Nb=zb(Bb({},Mb),{initCandlestick(){Cl.call(this,{elKey:"candlestick",className:Xe.chartCandlesticks})},updateTargetsForCandlestick(e){fs.call(this,e,{type:"Candlestick",elKey:"candlestick",containerClass:Xe.chartCandlesticks,itemClass:Xe.chartCandlestick,initFn:this.initCandlestick,withFocus:!1,withStyles:!1}).style("pointer-events","none")},updateCandlestick(e,t=!1){const n=this,{$el:a,$T:i}=n,s=t?a.subchart:a,o=n.getClass("candlestick",!0),r=n.initialOpacity.bind(n),l=s.main.selectAll(`.${Xe.chartCandlestick}`).selectAll(`.${Xe.candlestick}`).data(n.labelishData.bind(n));i(l.exit(),e).style("opacity","0").remove();const c=l.enter().filter(u=>u.value).append("g").attr("class",o);c.append("line"),c.append("path"),s.candlestick=l.merge(c).style("opacity",r)},generateDrawCandlestick(e,t){const n=this,{config:a}=n,i=n.generateGetCandlestickPoints(e,t),s=a.axis_rotated,o=a.candlestick_color_down;return(r,l,c)=>{const u=i(r,l),d=n.getCandlestickData(r),h=d==null?void 0:d._isUp,f=+s,p=+!f;c.classed&&c.classed(Xe[h?"valueUp":"valueDown"],!0);const g=s?`H${u[1][1]} V${u[1][0]} H${u[0][1]}`:`V${u[1][1]} H${u[1][0]} V${u[0][1]}`;c.select("path").attr("d",`M${u[0][f]},${u[0][p]}${g}z`).style("fill",m=>(h?n.color(m):Q(o)?o[m.id]:o)||n.color(m));const _=c.select("line"),x=s?{x1:u[2][1],x2:u[2][2],y1:u[2][0],y2:u[2][0]}:{x1:u[2][0],x2:u[2][0],y1:u[2][1],y2:u[2][2]};for(const m in x)_.attr(m,x[m])}},redrawCandlestick(e,t,n=!1){const a=this,{$el:i,$T:s}=a,{candlestick:o}=n?i.subchart:i,r=ye(!0);return[o.each(function(l,c){const u=s((0,B.select)(this),t,r);e(l,c,u)}).style("opacity",null)]}}),Xb={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"};let yu=()=>(Vn([Nb,bn],[Xb,an]),(yu=()=>X.CANDLESTICK)());var ci={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},Gb={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},Vs=kt(11);const Wb=15,Tu=20,wu=.35;function Vb(e=!1){const t=this;return["donut","pie","polar","gauge"].find(n=>t.hasType(n)&&!(n==="gauge"&&e&&t.hasMultiArcGauge()))}function ku(){const e=this,{config:t}=e,n=Vb.call(e,!0),a=n&&t[`${n}_label_line`],i=ne(a),s=(l,c,u)=>u,o={show:a===!0||i&&(a==null?void 0:a.show)!==!1,distance:i&&(a==null?void 0:a.distance)||Tu};if(a===!0)return{chartType:n,line:o,text:{formatter:s}};if(!i)return{chartType:n,line:{show:!1,distance:Tu},text:{formatter:null}};let r=s;return G(a.text)?r=a.text:a.text===!1&&(r=null),{chartType:n,line:o,text:{formatter:r}}}function Hb(e,t){const n=this,{state:a}=n,i=n.updateAngle(e);if(!i)return null;let{outerRadius:s}=n.getRadius(e),o=s;n.hasType("polar")&&(o=n.getPolarOuterRadius(e,s),s=a.radius);let r=(i.startAngle+i.endAngle)/2;Math.abs(i.endAngle-i.startAngle-2*Math.PI)<.01&&(r=Math.PI/2);const c=Math.sin(r),u=-Math.cos(r),d={x:c*o,y:u*o},h=s+Wb,f={x:c*h,y:u*h},p=c>=0,g={x:f.x+t*(p?1:-1),y:f.y};return{startPoint:d,breakPoint:f,endPoint:g,isRight:p,midAngle:r}}function Cu(){return ku.call(this).line.show}function Yb(e){const t=this,{$el:{arcs:n},$T:a}=t,{line:i,text:s}=ku.call(t),o=i.distance;let r=null;n.selectAll(`.${ct.chartArc}`).each(function(l){var c,u,d;const h=(0,B.select)(this),f=Hb.call(t,l,o),{ratio:p,meetsThreshold:g,updated:_}=(c=l._cache)!=null?c:{};if(!_||!f)return;const x=t.isTargetToShow(l.data.id)&&g,{startPoint:m,breakPoint:v,endPoint:b,isRight:T}=f,k=`${m.x},${m.y} ${v.x},${v.y} ${b.x},${b.y}`;if(i.show){let y=h.select(`.${ct.arcLabelLine}`);y.empty()&&(y=h.append("polyline").attr("class",ct.arcLabelLine)),a(y,e).attr("points",k).style("stroke",t.color(l.data)).style("opacity",x?null:"0")}let w=h.select(`.${ct.arcLabelLineText}`);if(w.empty()&&(w=h.append("text").attr("class",ct.arcLabelLineText).style("pointer-events","none")),x){const{value:y}=_,{id:C}=l.data,A=((d=(u=s.formatter)!=null?u:t.getArcLabelConfig("format"))!=null?d:t.defaultArcValueFormat)(y,p,C).toString();In(w,A,[-1,1],!1);const S={x:b.x+5*(T?1:-1),y:b.y};w.style("text-anchor",T?"start":"end");const L=w.node(),P=L==null?void 0:L.querySelectorAll("tspan");if(r===null&&(r=parseFloat(W.getComputedStyle(L).fontSize)||12),P&&P.length>1){const R=(P.length-3)/2;S.y+=(-R+wu)*r}else S.y+=wu*r;a(w,e).attr("transform",`translate(${S.x},${S.y})`).style("opacity",null).style("fill",t.updateTextColor.bind(t)(l))}else a(w,e).style("opacity","0")})}var jb=Object.defineProperty,Ub=Object.defineProperties,Kb=Object.getOwnPropertyDescriptors,Su=Object.getOwnPropertySymbols,Zb=Object.prototype.hasOwnProperty,qb=Object.prototype.propertyIsEnumerable,Au=(e,t,n)=>t in e?jb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jb=(e,t)=>{for(var n in t||(t={}))Zb.call(t,n)&&Au(e,n,t[n]);if(Su)for(var n of Su(t))qb.call(t,n)&&Au(e,n,t[n]);return e},Qb=(e,t)=>Ub(e,Kb(t));const Hs=["donut","gauge","pie","polar"];function ty(e){return["donut","pie","polar","gauge"].find(t=>e.hasType(t))}function ey(e,t,n,a){var i,s;const{config:o,state:{radiusExpanded:r}}=e,l=n.endAngle-Math.PI/2,c=Math.sin(l),u={x:Math.cos(l)*(r+(a?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(a){const d=o.arc_rangeText_position;if(d){const h=o.arc_rangeText_values,f=G(d)?d(h[t.index]):d;u.x+=(i=f==null?void 0:f.x)!=null?i:0,u.y+=(s=f==null?void 0:f.y)!=null?s:0}}return u}function ny(e,t,n,a){const{config:i}=e,s=ty(e);let o=s?i[`${s}_label_ratio`]:void 0;if(o)o=G(o)?o.bind(e.api)(t,n,a):o;else{const d=36/n,h=d>.375;o=n&&a?(h?1.175-d:.8)*n/a:0}return o}function ay(e,t,n){let{outerRadius:a}=e.getRadius(t);e.hasType("polar")&&(a=e.getPolarOuterRadius(t,a));const[i,s]=e.svgArc.centroid(n).map(l=>isNaN(l)?0:l),o=Math.sqrt(i*i+s*s),r=ny(e,t,a,o);return{pos:{x:i,y:s},ratio:r}}function Lu(e=0){const t=this,{config:n,state:a}=t,i=t.hasMultiArcGauge(),s=a.gaugeArcWidth/t.getTargetsToShow().length,o=e?Math.min(a.radiusExpanded*e-a.radius,s*.8-(1-e)*100):0;return{inner(r){const{innerRadius:l}=t.getRadius(r);return i?a.radius-s*(r.index+1):N(l)?l:0},outer(r){const{outerRadius:l}=t.getRadius(r);let c;if(i)c=a.radius-s*r.index+o;else if(t.hasType("polar")&&!e)c=t.getPolarOuterRadius(r,l);else if(c=l,e){let{radiusExpanded:u}=a;a.radius!==l&&(u-=Math.abs(a.radius-l)),c=u*e}return c},corner(r,l){const{arc_cornerRadius_ratio:c=0,arc_cornerRadius:u=0}=n,{data:{id:d},value:h}=r;let f;return c?f=c*l:f=N(u)?u:u.call(t.api,d,h,l),f}}}function Ys(e){return function(t){const n=({startAngle:i=0,endAngle:s=0,padAngle:o=0})=>({startAngle:i,endAngle:s,padAngle:o}),a=(0,Vs.interpolate)(n(this._current),n(t));return this._current=t,function(i){const s=a(i),{data:o,index:r,value:l}=t;return e(Qb(Jb({},s),{data:o,index:r,value:l}))}}}var iy={initPie(){const e=this,{config:t}=e,n=t.data_type,a=t[`${n}_padding`],i=t[`${n}_startingAngle`]||0,s=(a?a*.01:t[`${n}_padAngle`])||0;e.pie=(0,bt.pie)().startAngle(i).endAngle(i+2*Math.PI).padAngle(s).value(o=>{var r,l;return(l=(r=o.values)==null?void 0:r.reduce((c,u)=>c+u.value,0))!=null?l:o}).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius(){const e=this,{config:t,state:n}=e,a=t.data_type,i=t[`${a}_padding`],s=t.gauge_width||t.donut_width,o=e.getTargetsToShow().length*t.gauge_arcs_minWidth,r=.85,l=Cu.call(e)?r:1;n.radiusExpanded=Math.min(n.arcWidth,n.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?r:l),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 c=t.pie_innerRadius||(i?i*(n.innerRadiusRatio+.1):0);n.outerRadius=t.pie_outerRadius,n.innerRadius=e.hasType("donut")||e.hasType("gauge")?n.radius*n.innerRadiusRatio:c},getRadius(e){const t=this,n=e==null?void 0:e.data;let{innerRadius:a,outerRadius:i}=t.state;return!N(a)&&n&&(a=a[n.id]||0),Q(i)&&n&&n.id in i?i=i[n.id]:N(i)||(i=t.state.radius),{innerRadius:a,outerRadius:i}},updateArc(){const e=this;e.updateRadius(),e.svgArc=e.getSvgArc(),e.svgArcExpanded=e.getSvgArcExpanded()},getArcLength(){const e=this,{config:t}=e,n=t.gauge_arcLength*3.6;let a=2*(n/360);return n<-360?a=-2:n>360&&(a=2),a*Math.PI},getStartingAngle(){const e=this,{config:t}=e,n=t.data_type,a=e.hasType("gauge")?t.gauge_fullCircle:!1,i=-1*Math.PI/2,s=Math.PI/2;let o=t[`${n}_startingAngle`]||0;return!a&&o<=i?o=i:!a&&o>=s?o=s:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(e,t=!1){var n;const a=this,{config:i,state:s}=a,o=t&&a.hasType("gauge");let{pie:r}=a,l=e,c=!1;if(!i)return null;const u=a.getStartingAngle(),d=i.gauge_fullCircle||t&&!o?a.getArcLength():u*-2,h=l.data&&a.isGaugeType(l.data)&&!a.hasMultiArcGauge();if(h){const{gauge_min:f,gauge_max:p}=i,g=a.getTotalDataSum(s.rendered),_=d*((g-f)/(p-f));r=r.startAngle(u).endAngle(_+u)}if(t===!1){let f;if(h)f=r(a.filterTargetsToShow());else{const p="$arcPieLayout";let g=a.cache.get(p);(!g||g.generation!==s.redrawGeneration)&&(g={generation:s.redrawGeneration,layout:r(a.filterTargetsToShow())},a.cache.add(p,g)),f=g.layout}f.forEach((p,g)=>{var _;!c&&p.data.id===((_=l.data)==null?void 0:_.id)&&(c=!0,l=p,l.index=g)})}if(isNaN(l.startAngle)&&(l.startAngle=0),isNaN(l.endAngle)&&(l.endAngle=l.startAngle),t||l.data&&(i.gauge_enforceMinMax||a.hasMultiArcGauge())){const{gauge_min:f,gauge_max:p}=i,g=t&&!o?a.getTotalDataSum(s.rendered):p,_=d/(g-f),x=(n=l.value)!=null?n:0,m=x<f?0:x<g?x-f:g-f;l.startAngle=u,l.endAngle=u+_*m}return c||t?l:null},getSvgArc(){const e=this,{inner:t,outer:n,corner:a}=Lu.call(e),i=(0,bt.arc)().innerRadius(t).outerRadius(n),s=function(o,r){var l;let c="M 0 0";if(o.value||o.data){const u=r?o:(l=e.updateAngle(o))!=null?l:null;u&&(c=i.cornerRadius(a(u,n(u)))(u))}return c};return s.centroid=i.centroid,s},getSvgArcExpanded(e=1){const t=this,{inner:n,outer:a,corner:i}=Lu.call(t,e),s=(0,bt.arc)().innerRadius(n).outerRadius(a);return o=>{const r=t.updateAngle(o),l=a(r);let c=0;return r&&(c=i(r,l)),r&&s.cornerRadius(c)(r)||"M 0 0"}},getArc(e,t,n){return n||this.isArcType(e.data)?this.svgArc(e,t):"M 0 0"},redrawArcRangeText(){const e=this,{config:t,$el:{arcs:n},state:a,$T:i}=e,s=t.arc_rangeText_format,o=e.hasType("gauge")&&t.arc_rangeText_fixed;let r=t.arc_rangeText_values;if(r!=null&&r.length){const l=t.arc_rangeText_unit==="%",c=e.getTotalDataSum(a.rendered);l&&(r=r.map(h=>c/100*h));const u=e.pie(r).map((h,f)=>(h.index=f,h));let d=n.selectAll(`.${ct.arcRange}`).data(r);d.exit().remove(),d=i(d.enter().append("text").attr("class",ct.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const f=l?h/c*100:h;return G(s)?s(f):`${f}${l?"%":""}`}).merge(d)),(!a.rendered||a.rendered&&!o)&&c>0&&d.attr("transform",function(h,f){return e.transformForArcLabel(this,u[f],!0)}),d.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t,n=!1){const a=this,i=a.updateAngle(t,n);if(!i)return"";let s,o=1;if(n||a.hasMultiArcGauge())s=ey(a,t,i,n);else if(!a.hasType("gauge")||a.data.targets.length>1){const r=ay(a,t,i);s=r.pos,o=r.ratio}else return"";return bl.call(a,e,s),`translate(${s.x*o},${s.y*o})`},convertToArcData(e){return this.addName({id:"data"in e?e.data.id:e.id,value:e.value,ratio:this.getRatio("arc",e),index:e.index})},textForArcLabel(e){var t;const n=this,a=n.hasType("gauge"),i=(t=Hs.filter(n.hasType.bind(n)))==null?void 0:t[0];n.shouldShowArcLabel()&&e.style("fill",n.updateTextColor.bind(n)).attr("filter",s=>n.updateTextBGColor.bind(n)(s,n.config.data_labels_backgroundColors)).each(function(s){const o=(0,B.select)(this),r=n.updateAngle(s),l=n.getRatio("arc",r),c=cs.call(n,l,i);if(s._cache={updated:r,ratio:l,meetsThreshold:c},c){const{value:u}=r||s,d=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(u,l,s.data.id).toString();In(o,d,[-1,1],a)}else o.text("")})},expandArc(e){const t=this,{state:{transiting:n},$el:a}=t;if(n){const s=setInterval(()=>{t.state.transiting||(clearInterval(s),a.legend.selectAll(`.${ut.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const i=t.mapToTargetIds(e);a.svg.selectAll(t.selectorTargets(i,`.${ct.chartArc}`)).each(function(s){if(!t.shouldExpand(s.data.id))return;const o=t.getExpandConfig(s.data.id,"duration"),r=t.getSvgArcExpanded(t.getExpandConfig(s.data.id,"rate"));(0,B.select)(this).selectAll("path").transition().duration(o).attrTween("d",Ys(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",Ys(r.bind(t)))})},unexpandArc(e){const t=this,{state:{transiting:n},$el:{svg:a}}=t;if(n)return;const i=t.mapToTargetIds(e);a.selectAll(t.selectorTargets(i,`.${ct.chartArc}`)).selectAll("path").transition().duration(s=>t.getExpandConfig(s.data.id,"duration")).attrTween("d",Ys(t.svgArc.bind(t))),a.selectAll(`${ct.arc}`).style("opacity",null)},getExpandConfig(e,t){const n=this,{config:a}=n,i={duration:50,rate:.98};let s;return n.isDonutType(e)?s="donut":n.isGaugeType(e)?s="gauge":n.isPieType(e)&&(s="pie"),s?a[`${s}_expand_${t}`]:i[t]},shouldExpand(e){const t=this,{config:n}=t,a=t.isDonutType(e)?"donut":t.isGaugeType(e)?"gauge":t.isPieType(e)?"pie":null;return a?!!n[`${a}_expand`]:!1},shouldShowArcLabel(){const e=this,{config:t}=e;return Hs.some(n=>e.hasType(n)&&t[`${n}_label_show`])},getArcLabelConfig(e="format"){const t=this,{config:n}=t;let a=i=>i;return Hs.filter(t.hasType.bind(t)).forEach(i=>{a=n[`${i}_label_${e}`]}),e==="format"&&G(a)?a.bind(t.api):a},updateTargetsForArc(e){const t=this,{$el:n}=t,a=t.hasType("gauge"),i=t.getChartClass("Arc"),s=t.getClass("arcs",!0),o=t.classFocus.bind(t),r=n.main.select(`.${ct.chartArcs}`),l=r.selectAll(`.${ct.chartArc}`).data(t.pie(e)).attr("class",u=>i(u)+o(u.data)),c=l.enter().append("g").attr("class",i).call(this.setCssRule(!1,`.${ct.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));c.append("g").attr("class",s).merge(l),c.append("text").attr("dy",a&&!t.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",t.getStylePropValue("middle")).style("pointer-events",t.getStylePropValue("none")),n.text=r.selectAll(`.${U.target} text`)},initArc(){const e=this,{$el:t}=e;t.arcs=t.main.select(`.${U.chart}`).append("g").attr("class",ct.chartArcs).attr("transform",e.getTranslate("arc")),e.setArcTitle()},setArcTitle(e){const t=this,n=e||t.getArcTitle(),a=t.hasType("gauge");if(n){const i=a?he.chartArcsGaugeTitle:ct.chartArcsTitle;let s=t.$el.arcs.select(`.${i}`);s.empty()&&(s=t.$el.arcs.append("text").attr("class",i).style("text-anchor","middle")),a&&s.attr("dy","-0.3em"),In(s,n,a?void 0:[-.6,1.35],!0)}},getArcTitle(){const e=this,t=e.hasType("donut")&&"donut"||e.hasType("gauge")&&"gauge";return t?e.config[`${t}_title`]:""},getArcTitleWithNeedleValue(){const e=this,{config:t,state:n}=e,a=e.getArcTitle();if(a&&e.config.arc_needle_show&&/{=[A-Z_]+}/.test(a)){let i=n.current.needle;return N(i)||(i=t.arc_needle_value),hn(a,{NEEDLE_VALUE:~~i})}return!1},redrawArc(e,t,n){const a=this,{config:i,state:s,$el:{main:o}}=a,r=i.interaction_enabled,l=r&&i.data_selection_isselectable;let c=o.selectAll(`.${ct.arcs}`).selectAll(`.${ct.arc}`).data(a.arcData.bind(a));c.exit().transition().duration(t).style("opacity","0").remove(),c=c.enter().append("path").attr("class",a.getClass("arc",!0)).style("fill",u=>a.color(u.data)).style("cursor",u=>{var d;return(d=l==null?void 0:l.bind)!=null&&d.call(l,a.api)(u)?"pointer":null}).style("opacity","0").each(function(u){a.isGaugeType(u.data)&&(u.startAngle=i.gauge_startingAngle,u.endAngle=i.gauge_startingAngle),this._current=u}).merge(c),a.hasType("gauge")&&(a.updateGaugeMax(),a.hasMultiArcGauge()&&a.redrawArcGaugeLine()),c.attr("transform",u=>!a.isGaugeType(u.data)&&n?"scale(0)":"").style("opacity",function(u){return u===this._current?"0":null}).each(()=>{s.transiting=!0}).transition().duration(e).attrTween("d",function(u){const d=a.updateAngle(u);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=(0,Vs.interpolate)(this._current,d);return this._current=h(0),function(f){const p=h(f);return p.data=u.data,a.getArc(p,!0)}}).attr("transform",n?"scale(1)":"").style("fill",u=>{let d;return a.levelColor?(d=a.levelColor(u.data.values[0].value),i.data_colors[u.data.id]=d):d=a.color(u.data),d}).style("opacity",null).call(Aa,function(){if(a.levelColor){const u=(0,B.select)(this),d=u.datum(this._current);a.updateLegendItemColor(d.data.id,u.style("fill"))}s.transiting=!1,s.redrawing&&(s.redrawing=!1,s._targetsToShow=null,s._cachedDrawShape=null),q(i.onrendered,a.api)}),r&&a.bindArcEvent(c),a.hasType("polar")&&a.redrawPolar(),a.hasType("gauge")&&a.redrawBackgroundArcs(),i.arc_needle_show&&a.redrawNeedle(),a.redrawArcText(e),a.redrawArcRangeText()},redrawNeedle(){const e=this,{$el:t,config:n,state:{hiddenTargetIds:a,radius:i}}=e,s=(i-1)/100*n.arc_needle_length,o=a.size!==e.data.targets.length;let r=e.$el.arcs.select(`.${ct.needle}`);const l=n.arc_needle_path,c=n.arc_needle_bottom_width/2,u=n.arc_needle_top_width/2,d=n.arc_needle_top_rx,h=n.arc_needle_top_ry,f=n.arc_needle_bottom_len,p=n.arc_needle_bottom_rx,g=n.arc_needle_bottom_ry,_=e.getNeedleAngle(),x=()=>{const m=e.getArcTitleWithNeedleValue();m&&e.setArcTitle(m)};if(x(),r.empty()&&(r=t.arcs.append("path").classed(ct.needle,!0),t.needle=r,t.needle.updateHelper=(m,v=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(Aa,()=>{v&&(n.arc_needle_value=m),x()})}),o){const m=G(l)?l.call(e,s):`M-${c} ${f} A${p} ${g} 0 0 0 ${c} ${f} L${u} -${s} A${d} ${h} 0 0 0 -${u} -${s} L-${c} ${f} Z`;e.$T(r).attr("d",m).style("fill",n.arc_needle_color).style("display",null).style("transform",`rotate(${_}deg)`)}else r.style("display","none")},getNeedleAngle(e){const t=this,{config:n,state:a}=t,i=t.getArcLength(),s=t.hasType("gauge"),o=t.getTotalDataSum(!0);let r=ht(e)?e:n.arc_needle_value,l=n[`${n.data_type}_startingAngle`]||0,c;if(N(r)||(r=s&&t.data.targets.length===1?o:0),a.current.needle=r,s){l=t.getStartingAngle();const u=n.gauge_fullCircle?i:l*-2,{gauge_min:d,gauge_max:h}=n;c=u*((r-d)/(h-d))}else c=o?i*(r/o):0;return(l+c)*(180/Math.PI)},redrawBackgroundArcs(){const e=this,{config:t,state:n}=e,a=e.hasMultiArcGauge(),i=t.gauge_fullCircle,s=e.getTargetsToShow().length===0&&!!t.data_empty_label_text,o=e.getStartingAngle(),r=i?o+e.getArcLength():o*-1;let l=e.$el.arcs.select(`${a?"g":""}.${ct.chartArcsBackground}`);if(a){let c=0;l=l.selectAll(`path.${ct.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(u,d)=>`${ct.chartArcsBackground} ${ct.chartArcsBackground}-${d}`).merge(l).style("fill",t.gauge_background||null).attr("d",({id:u})=>{if(s||n.hiddenTargetIds.has(u))return"M 0 0";const d={data:[{value:t.gauge_max}],startAngle:o,endAngle:r,index:c++};return e.getArc(d,!0,!0)}),l.exit().remove()}else l.attr("d",s?"M 0 0":()=>{const c={data:[{value:t.gauge_max}],startAngle:o,endAngle:r};return e.getArc(c,!0,!0)})},bindArcEvent(e){const t=this,{config:n,state:a}=t,i=a.inputType==="touch",s=a.inputType==="mouse",o=c=>{const u=t.updateAngle(c);return u?t.convertToArcData(u):null};function r(c,u,d){t.expandArc(d),t.api.focus(d),t.toggleFocusLegend(d,!0),t.showTooltip([u],c)}function l(c){const u=(c==null?void 0:c.id)||void 0;t.unexpandArc(u),t.api.revert(),t.revertLegend(),t.hideTooltip()}if(e.on("click",function(c,u,d){var h;const f=o(u);f&&((h=t.toggleShape)==null||h.call(t,this,f,d),n.data_onclick.bind(t.api)(f,this))}),s&&e.on("mouseover",function(c,u){if(a.transiting)return;a.event=c;const d=o(u),h=(d==null?void 0:d.id)||void 0;r(this,d,h),t.setOverOut(!0,d)}).on("mouseout",(c,u)=>{if(a.transiting||!n.interaction_onout)return;a.event=c;const d=o(u);l(),t.setOverOut(!1,d)}).on("mousemove",function(c,u){const d=o(u);a.event=c,t.showTooltip([d],this)}),i&&t.hasArcType()&&!t.radars){const c=u=>{var d,h;const{clientX:f,clientY:p}=(h=(d=u.changedTouches)==null?void 0:d[0])!=null?h:{clientX:0,clientY:0};return(0,B.select)(rt.elementFromPoint(f,p))};t.$el.svg.on("touchstart touchmove",function(u){if(a.transiting)return;a.event=u;const h=c(u).datum(),f=h!=null&&h.data&&h.data.id?t.updateAngle(h):null,p=f?t.convertToArcData(f):null,g=(p==null?void 0:p.id)||void 0;t.callOverOutForTouch(p),Ct(g)?l():r(this,p,g)},{passive:!0})}},redrawArcText(e){const t=this,{config:n,state:a,$el:{main:i,arcs:s}}=t,o=t.hasType("gauge"),r=t.hasMultiArcGauge();let l;if(o&&t.data.targets.length===1&&n.gauge_title||(l=i.selectAll(`.${ct.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?he.gaugeValue:null).call(t.textForArcLabel.bind(t)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(a.radius/5)}px`:null),vl.call(t),l.attr("transform",function(c){return t.transformForArcLabel.bind(t)(this,c)}).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),i.select(`.${ct.chartArcsTitle}`).style("opacity",t.hasType("donut")||o?null:"0"),o){const c=n.gauge_fullCircle;c&&(l==null||l.attr("dy",`${r?0:Math.round(a.radius/14)}`)),n.gauge_label_show&&(s.select(`.${he.chartArcsGaugeUnit}`).attr("dy",`${c?1.5:.75}em`).text(n.gauge_units),s.select(`.${he.chartArcsGaugeMin}`).attr("dx",`${-1*(a.innerRadius+(a.radius-a.innerRadius)/(c?1:2))}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_min,!1)),!c&&s.select(`.${he.chartArcsGaugeMax}`).attr("dx",`${a.innerRadius+(a.radius-a.innerRadius)/2}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_max,!0)))}Cu.call(t)&&Yb.call(t,e)},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:n}}=t,a=N(e)?i=>i.index===e:i=>i.data.id===e;return n==null?void 0:n.selectAll(`.${U.target} path`).filter(a)}};function Hn(e,t){pt(Rt.prototype,[iy,bn].concat(e||[])),Oe.setOptions([an].concat(t||[]))}let Pu=()=>(Hn(void 0,[ci,Gb]),(Pu=()=>X.DONUT)());var sy=Object.defineProperty,Ru=Object.getOwnPropertySymbols,oy=Object.prototype.hasOwnProperty,ry=Object.prototype.propertyIsEnumerable,Eu=(e,t,n)=>t in e?sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ly=(e,t)=>{for(var n in t||(t={}))oy.call(t,n)&&Eu(e,n,t[n]);if(Ru)for(var n of Ru(t))ry.call(t,n)&&Eu(e,n,t[n]);return e};function Yn(e=!1){const t=this,{config:n,state:{current:{width:a,height:i}}}=t,s=t.getCurrentPadding(),o=ly({width:a-s.left-s.right,height:i-(n.legend_show?t.getLegendHeight()+10:0)-s.top-s.bottom},s);if(e){const r=js.call(t,o),l=n.funnel_rotated;o.width=Math.max(o.width,l?r.height:r.width),o.height=Math.max(o.height,l?r.width:r.height)}return o}function js(e){const t=this,{config:n}=t,a=n.funnel_rotated,[i,s]=[n.funnel_neck_width,n.funnel_neck_height].map((o,r)=>Q(o)?e[a!==!r?"width":"height"]*o.ratio:o);return{width:i,height:s}}function cy(e){const t=this,n=t.config.funnel_rotated,{width:a,height:i}=Yn.call(t,!0),s=[];return e.forEach((o,r)=>{const{ratio:l=0}=o,c=r>0?s[r-1][2][n?0:1]:0,u=l+c;s.push(o.coords=n?[[c,0],[u,0],[u,i],[c,i],[c,0]]:[[0,c],[a,c],[a,u],[0,u],[0,c]])}),s}function uy(){const e=this,t=e.config.funnel_rotated,{width:n,height:a}=Yn.call(e,!0),i=js.call(e,{width:n,height:a});let s;if(t){const o=(a-i.width)/2,r=n-i.height;s=[[r,o],[n,o],[n,a-o],[r,a-o],[0,a]]}else{const o=(n-i.width)/2,r=a-i.height;s=[[n,0],[n-o,r],[n-o,a],[o,a],[o,r]]}return`M${[[0,0],...s,[0,0]].join("L")}z`}function dy(e){const t=this,{config:n}=t,a=e.map(i=>({id:i.id,value:i.values.reduce((s,o)=>s+o.value,0)}));return n.data_order&&a.sort(t.getSortCompareFn.bind(t)(!0)),Mu.call(t,a)}function Mu(e){const t=this,{width:n,height:a}=Yn.call(t),i=t.getTotalDataSum(!0),s=t.config.funnel_rotated?n:a;return e.forEach(o=>{o.ratio=o.value/i*s}),e}function hy(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Du(e,t,n,a,i){const s=[];for(let r=0;r<=20;r++){const l=r/20,c=e+(t-e)*l,u=n+(a-n)*hy(l);s.push(i?[c,u]:[u,c])}return s}function fy(){var e;const t=this,n=t.config.funnel_rotated,{width:a,height:i}=Yn.call(t,!0),s=js.call(t,{width:a,height:i}),o=(0,bt.line)().x(f=>f[0]).y(f=>f[1]).curve(bt.curveLinear),r=(n?i-s.width:a-s.width)/2,l=n?a-s.height:i-s.height,c=Du(0,l,n?0:a,n?r:a-r,n),u=[];if(s.height>0&&(c.push(n?[a,r]:[a-r,i]),u.push(n?[a,i-r]:[r,i])),u.push(...Du(l,0,n?i-r:r,n?i:0,n)),c.length>1){const[f,p]=n?[1,0]:[0,1];c.splice(1,0,[c[f][0],c[p][1]]);const g=u.length-1;g>0&&u.splice(g,0,[u[g-f][0],u[g-p][1]])}const d=o(c)||"",h=((e=o(u))==null?void 0:e.replace(/^M/,"L"))||"";return n?`${d}${h}z`:`M0,0${d.replace(/^M/,"L")}${h}z`}const gy={themeTextColor:!0,canvasUnsupported:"funnel chart",afterUnload(e){e.updateFunnel(e.data.targets)},labelData(e,t){return t.values.filter(n=>N(n.value)||!!n.value)},textX(e,t,n,a,i){var s,o;return t?((o=(s=t[2])==null?void 0:s[0])!=null?o:t[0][0])+e.getCenteredTextPos(n,t,a,"x",i)+Bn.call(e,n,"x"):da(a,"x")},textY(e,t,n,a,i,s){var o,r;if(!t)return da(a,"y");let l=((r=(o=t[2])==null?void 0:o[1])!=null?r:t[0][1])+i.height/2-3;return e.config.axis_rotated||(l+=e.getCenteredTextPos(n,t,a,"y",s)),l+Bn.call(e,n,"y")}};var py={isFunnelType(e){return this.isTypeOf(e,"funnel")},initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${U.chart}`).append("g").classed(la.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(la.funnelBackground,!0),e.bindFunnelEvent()},bindFunnelEvent(){const e=this,{$el:{funnel:t},config:n,state:a}=e;if(!n.interaction_enabled)return;const i=o=>{var r;const l=o.isTrusted?o.target:(r=a.eventReceiver.rect)==null?void 0:r.node();if(l&&/^path$/i.test(l.tagName))return a.event=o,(0,B.select)(l).datum()},s=a.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=i(o);r&&(e.showTooltip([r],o.target),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=i(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))}).on("click",o=>{const{target:r}=o,l=/^path$/i.test(r.tagName)?(0,B.select)(r).datum():null;l!=null&&l.id&&n.data_onclick.bind(e.api)(l,r)})},updateTargetsForFunnel(e){const t=this,{$el:{funnel:n}}=t;n||t.initFunnel();const a=t.getChartClass("Funnel"),i=t.getClass("funnel",!0,!0),s=dy.call(t,e.filter(t.isFunnelType.bind(t))),o=t.filterNullish(s),r=n.selectAll(`.${la.chartFunnel}`).data(o);r.exit().remove();const l=r.enter().insert("g",`.${la.funnelBackground}`);l.append("path"),n.path=l.merge(r).attr("class",a).select("path").attr("class",i).style("opacity","0").style("fill",t.color)},updateFunnel(e){const t=this,{$el:{funnel:n}}=t,a=e.map(({id:i})=>i);n.path=n.path.filter(i=>a.includes(i.id))},generateGetFunnelPoints(){const e=this,{config:t,$el:{funnel:n}}=e,a=t.funnel_rotated,i=e.filterTargetsToShow(n.path),{top:s,left:o,width:r,height:l}=Yn.call(e),c={};let u=0;return i.each(d=>{const h=u,{ratio:f}=d;u+=f;const p=a?o:s,g=p+h,_=p+u,x=(g+_)/2,m=a?s+l/2:o+r/2;c[d.id]=a?[[g,m],[_,m],[x,m]]:[[m,g],[m,_],[m,x]]}),d=>c[d.id]},redrawFunnel(){const e=this,{config:t,$T:n,$el:{funnel:a}}=e,i=e.filterTargetsToShow(a.path),s=cy.call(e,Mu.call(e,i.data())),{top:o,left:r}=Yn.call(e),l=(t.funnel_spline?fy:uy).call(e);a.attr("transform",`translate(${r}, ${o})`).attr("clip-path",`path('${l}')`),a.background.attr("d",l),n(i).attr("d",(c,u)=>`M${s[u].join("L")}z`).style("opacity","1"),a.selectAll("g").style("opacity",null)}},_y={funnel_neck_width:0,funnel_neck_height:0,funnel_rotated:!1,funnel_spline:!1};let Ou=()=>(Hn([py],[_y]),Object.assign(H,la),vn("funnel",{hooks:gy}),(Ou=()=>X.FUNNEL)());var xy={initGauge(){const e=this,{config:t,$el:{arcs:n}}=e,a=(i=null,s="")=>{n.append("text").attr("class",i).style("text-anchor","middle").style("pointer-events","none").text(s)};if(e.hasType("gauge")){const i=e.hasMultiArcGauge();n.append(i?"g":"path").attr("class",ct.chartArcsBackground).style("fill",!i&&t.gauge_background||null),t.gauge_units&&a(he.chartArcsGaugeUnit),t.gauge_label_show&&(a(he.chartArcsGaugeMin),!t.gauge_fullCircle&&a(he.chartArcsGaugeMax))}},updateGaugeMax(){const e=this,{config:t,state:n}=e,i=e.hasMultiArcGauge()?e.getMinMaxData().max[0].value:e.getTotalDataSum(n.rendered);!t.gauge_enforceMinMax&&i+t.gauge_min*(t.gauge_min>0?-1:1)>t.gauge_max&&(t.gauge_max=i-t.gauge_min)},redrawArcGaugeLine(){const e=this,{config:t,state:n,$el:a}=e,{hiddenTargetIds:i}=e.state,s=a.main.selectAll(`.${ct.arcs}`).selectAll(`.${ct.arcLabelLine}`).data(e.arcData.bind(e));s.enter().append("rect").attr("class",r=>`${ct.arcLabelLine} ${U.target} ${U.target}-${r.data.id}`).merge(s).style("fill",r=>e.levelColor?e.levelColor(r.data.values[0].value):e.color(r.data)).style("display",t.gauge_label_show?null:"none").each(function(r){let l=0;const c=2;let u=0,d=0,h="";if(!i.has(r.data.id)){const f=e.updateAngle(r),p=n.gaugeArcWidth/e.getTargetsToShow().length*(f.index+1),g=f.endAngle-Math.PI/2,_=n.radius-p,x=g-(_===0?0:1/_);l=n.radiusExpanded-n.radius+p,u=Math.cos(x)*_,d=Math.sin(x)*_,h=`rotate(${g*180/Math.PI}, ${u}, ${d})`}(0,B.select)(this).attr("x",u).attr("y",d).attr("width",l).attr("height",c).attr("transform",h).style("stroke-dasharray",`0, ${l+c}, 0`)})},textForGaugeMinMax(e,t){const n=this,{config:a}=n,i=a.gauge_label_extents;return G(i)?i.bind(n.api)(e,t):e},getGaugeLabelHeight(){const{config:e}=this;return this.config.gauge_label_show&&!e.gauge_fullCircle?20:0},getPaddingBottomForGauge(){return this.getGaugeLabelHeight()*2}},my={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 $u=()=>(Hn([xy],[ci,my]),($u=()=>X.GAUGE)());const Yt={chartHeatmap:"bb-chart-heatmap",heatmapRows:"bb-heatmap-rows",heatmapRow:"bb-heatmap-row",heatmapCell:"bb-heatmap-cell",heatmapLabel:"bb-heatmap-label",heatmapNames:"bb-heatmap-names",heatmapAxis:"bb-heatmap-axis",heatmapColorbar:"bb-heatmap-colorbar"},vy=18,ui=6,jn=12,di=10,Fu=16,by=11,yy=(e,t)=>e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,hi=e=>e!=null&&e!==""&&Number.isFinite(Number(e));function Ty(){var e,t;const n=this,{config:a,state:{current:{width:i,height:s},isCanvasMode:o,isLegendRight:r}}=n,l=n.getCurrentPadding(),c=a.legend_show&&a.legend_position==="bottom"?(o?0:n.getLegendHeight())+10:0,u=a.legend_show&&r?n.getLegendWidth()+(((e=a.padding)==null?void 0:e.mode)==="fit"?6:20):0,d=o?n.getCanvasSurfaceHeight():s,h=Math.max(0,d-l.top-l.bottom-c),f=o&&c&&((t=n.getCanvasBottomLegendHeight)==null?void 0:t.call(n))||0;return{left:l.left,top:l.top,width:Math.max(0,i-l.left-l.right-u),height:h,chrome:l.top+l.bottom+c+f}}function Us(e){const t=this,{cache:n,state:{isCanvasMode:a},$el:i}=t,s=`heatmap-text-${a}-${e.join("\0")}`;let o=n.get(s)||0;if(!o&&a&&t.canvasRenderer){const{ctx:r}=t.canvasRenderer;r.save(),r.font=t.canvasTheme.style.heatmap.axisFont,o=e.reduce((l,c)=>Math.max(l,r.measureText(c).width),0),r.restore()}else if(!o&&!a&&i.heatmap){const r=i.heatmap.append("text").attr("class",Yt.heatmapAxis).style("visibility","hidden");e.forEach(l=>{var c,u;o=Math.max(o,((u=(c=r.text(l).node()).getComputedTextLength)==null?void 0:u.call(c))||0)}),r.remove()}return o?n.add(s,o):o=e.reduce((r,l)=>Math.max(r,l.length),0)*6.5,Math.ceil(o)}function wy(e){const t=this.config.heatmap_color_ranges;if(t!=null&&t.length)return o=>{var r;return(r=t.find(l=>{var c,u;return o>=((c=l.from)!=null?c:-1/0)&&o<=((u=l.to)!=null?u:1/0)}))==null?void 0:r.color};const n=this.config.heatmap_color_range,[a,i]=e,s=n.length-1;return s<1?()=>n[0]:(0,ze.scaleLinear)().domain(n.map((o,r)=>a+(i-a)*r/s)).range(n).interpolate(Vs.interpolateRgb).clamp(!0)}function ky(e){const t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(e);let n=[0,0,0];return t?n=[+t[1],+t[2],+t[3]]:/^#[0-9a-f]{6}$/i.test(e)?n=[1,3,5].map(a=>parseInt(e.slice(a,a+2),16)):/^#[0-9a-f]{3}$/i.test(e)&&(n=[1,2,3].map(a=>parseInt(e[a]+e[a],16))),(n[0]*299+n[1]*587+n[2]*114)/1e3>140?"#000":"#fff"}function Iu(e,t,n,a=4){const i=Math.max(1,Math.ceil((n+a)/(t||1)));return e.map((s,o)=>[s,o]).filter(([,s])=>s%i===0)}const Bu={ownLegendLayout:!0,currentHeight(e){var t,n;if(!(e.config.heatmap_cell_ratio>0)||!((n=(t=e.data)==null?void 0:t.targets)!=null&&n.length))return;const{height:a}=e.getHeatmapLayout(!0);return Number.isFinite(a)?Math.ceil(a):void 0},namedData:!0,labelData(){return[]},legendColor(e,t){var n,a;const i=t.values.filter(s=>hi(s.value));return i.length&&(a=(n=e.getHeatmapScale().scale(i.reduce((s,o)=>s+Number(o.value),0)/i.length))!=null?n:e.config.heatmap_color_none)!=null?a:void 0},tooltipColor(e,t){var n,a;return hi(t.value)&&(a=(n=e.getHeatmapScale().scale(Number(t.value)))!=null?n:e.config.heatmap_color_none)!=null?a:void 0},tooltipTarget(e,t){var n,a,i,s,o;const{cells:r}=e.getHeatmapLayout(),l=(n=t.data)==null?void 0:n.id,c=(i=t.index)!=null?i:(a=t.data)==null?void 0:a.index,u=(o=t.x)!=null?o:(s=t.data)==null?void 0:s.x,d=r.find(h=>(l===void 0||h.id===l)&&(c!==void 0?h.index===c:u!==void 0?h.x===String(u):!0)&&h.value!==null);return{data:d?[e.getHeatmapCellData(d)]:[],point:d&&[(d.x0+d.x1)/2,(d.y0+d.y1)/2]}}},zu=new WeakSet,Nu=new WeakMap;var Cy={fitHeatmapHeight(){const e=this,{width:t,height:n}=e.state.current,a=Bu.currentHeight(e);let i=Nu.get(e);(!i||i.width!==t)&&Nu.set(e,i={width:t,count:0}),a&&Math.abs(a-n)>1&&i.count++<3&&e.resizeFunction()},isHeatmapType(e){return this.isTypeOf(e,"heatmap")},getHeatmapLayout(e=!1){const t=this,{config:n}=t,a=t.data.targets.filter(t.isHeatmapType.bind(t)),i=Ty.call(t);e&&(i.height=1/0);const o=a.reduce((F,V)=>V.values.length>F.length?V.values:F,[]).map(F=>String(F.x)),{domain:r,scale:l}=t.getHeatmapScale(),c=a.filter(F=>t.isTargetToShow(F.id)),u=c.map(F=>F.id),d=c.map(F=>{var V;return String((V=yy(n.data_names,F.id))!=null?V:F.id)}),h=n.heatmap_axis_x_show&&o.length>0,f=n.heatmap_axis_y_show&&u.length>0,p=f?Us.call(t,d)+ui:0,g=h?vy:0,_=n.heatmap_axis_x_position==="top",x=n.heatmap_colorbar_format,m=F=>F===void 0?"":String(G(x)?x.call(t.api,F):F),v=n.heatmap_color_ranges||[];let b=[];n.heatmap_colorbar_show&&(b=v.length?v.map((F,V)=>{var Y;return{text:(Y=F.name)!=null?Y:F.from===void 0?`\u2264 ${m(F.to)}`:F.to===void 0?`\u2265 ${m(F.from)}`:`${m(F.from)} - ${m(F.to)}`,pos:(V+.5)/v.length,edge:!1}}):r.map((F,V)=>({text:m(F),pos:V,edge:!0})));const T=n.heatmap_colorbar_position,k=T!=="top"&&T!=="bottom",w=b.length>0,y=w&&k?di+jn+4+Us.call(t,b.map(F=>F.text)):0,C=w&&!k?di+jn+Fu:0,A=T==="top",S={left:i.left+p,top:i.top+(_?g:0)+(A?C:0),width:Math.max(0,i.width-p-y),height:Math.max(0,i.height-g-C)};let L=o.length?S.width/o.length:0,P=u.length?S.height/u.length:0;const D=n.heatmap_cell_ratio;D>0&&L&&P&&(L=Math.min(L,P*D),P=L/D,S.width=L*o.length,S.height=P*u.length);const R=n.heatmap_cell_padding/2,E=n.heatmap_color_none,M=[];c.forEach((F,V)=>{F.values.forEach((Y,j)=>{var dt;const it=hi(Y.value),ft=it&&(dt=l(Number(Y.value)))!=null?dt:E;ft&&M.push({id:F.id,name:d[V],x:o[j],index:j,row:V,value:it?Number(Y.value):null,color:ft,x0:S.left+j*L+R,y0:S.top+V*P+R,x1:S.left+(j+1)*L-R,y1:S.top+(V+1)*P-R})})});const O=h?Iu(o,L,Us.call(t,o)).map(([F,V])=>({text:F,x:S.left+(V+.5)*L,y:_?S.top-ui:S.top+S.height+ui,align:"center",baseline:_?"bottom":"top"})):[],$=f?Iu(d,P,by,0).map(([F,V])=>({text:F,x:S.left-ui,y:S.top+(V+.5)*P,align:"right",baseline:"middle"})):[];let I=null;if(w){const F=v.length?v.map(j=>j.color):n.heatmap_color_range,V=F.length-1,Y=[];if(F.forEach((j,dt)=>{v.length?Y.push([dt/F.length,j],[(dt+1)/F.length,j]):Y.push([V?dt/V:0,j])}),k){const j=S.left+S.width+di;I={horizontal:!1,x:j,y:S.top,width:jn,height:S.height,stops:Y.map(([dt,it])=>[1-dt,it]).reverse(),labels:b.map(dt=>({text:dt.text,x:j+jn+4,y:S.top+S.height*(1-dt.pos),align:"left",baseline:dt.edge?dt.pos?"top":"bottom":"middle"}))}}else{const j=A?i.top+Fu:S.top+S.height+(_?0:g)+di,dt=A?j-4:j+jn+4,it=A?"bottom":"top";I={horizontal:!0,x:S.left,y:j,width:S.width,height:jn,stops:Y,labels:b.map(ft=>({text:ft.text,x:S.left+S.width*ft.pos,y:dt,align:ft.edge?ft.pos?"right":"left":"center",baseline:it}))}}}return{cells:M,rows:u,columns:o,plot:S,axisX:O,axisY:$,colorbar:I,domain:r,height:S.height+g+C+i.chrome}},getHeatmapScale(){const e=this,{config:t}=e;let n=1/0,a=-1/0;e.data.targets.filter(e.isHeatmapType.bind(e)).forEach(r=>{e.color(r.id),r.values.forEach(l=>{if(hi(l.value)){const c=Number(l.value);n=Math.min(n,c),a=Math.max(a,c)}})});let i=t.heatmap_color_min,s=t.heatmap_color_max;i>s&&(zu.has(e)||(zu.add(e),console.error(`[billboard.js] heatmap.color.min (${i}) is bigger than heatmap.color.max (${s}): both are ignored.`)),i=s=void 0);const o=[i!=null?i:n===1/0?0:n,s!=null?s:a===-1/0?1:a];return{domain:o,scale:wy.call(e,o)}},getHeatmapLabelColor(e){return this.config.heatmap_label_color||ky(e.color)},getHeatmapLabel(e){var t;const n=this,{config:a}=n;if(!a.heatmap_label_show||e.value===null)return"";const i=a.heatmap_label_format;return String((t=G(i)?i.call(n.api,e.value,e.x,e.id):e.value)!=null?t:"")},isHeatmapDefocused(e){var t;return!!((t=this.state.defocusedTargetIds)!=null&&t.has(e))},getHeatmapCellData(e){return{id:e.id,x:e.x,index:e.index,value:e.value,name:`${e.name} / ${e.x}`}},generateGetHeatmapPoints(){return()=>{}}},Sy=Object.defineProperty,Ay=Object.defineProperties,Ly=Object.getOwnPropertyDescriptors,Xu=Object.getOwnPropertySymbols,Py=Object.prototype.hasOwnProperty,Ry=Object.prototype.propertyIsEnumerable,Gu=(e,t,n)=>t in e?Sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ey=(e,t)=>{for(var n in t||(t={}))Py.call(t,n)&&Gu(e,n,t[n]);if(Xu)for(var n of Xu(t))Ry.call(t,n)&&Gu(e,n,t[n]);return e},My=(e,t)=>Ay(e,Ly(t));const Dy={left:"start",right:"end",center:"middle"},Oy={middle:".35em",top:".71em",bottom:"0"};var $y=My(Ey({},Cy),{initHeatmap(){const e=this,{$el:t}=e;t.heatmap=t.main.select(`.${U.chart}`).append("g").classed(Yt.chartHeatmap,!0),t.heatmap.append("defs"),t.heatmap.append("g").classed(Yt.heatmapRows,!0),t.heatmap.append("g").classed(Yt.heatmapNames,!0),t.heatmap.append("g").classed(Yt.heatmapColorbar,!0),e.bindHeatmapEvent()},bindHeatmapEvent(){const e=this,{$el:{heatmap:t},config:n,state:a}=e;if(!n.interaction_enabled)return;const i=o=>{var r,l;const c=o.target===t.node()?(l=(r=a.eventReceiver.rect)==null?void 0:r.node)==null?void 0:l.call(r):o.target;if(c&&/^rect$/i.test(c.tagName)){const u=(0,B.select)(c).datum();if((u==null?void 0:u.id)!==void 0&&u.value!==void 0&&u.value!==null)return a.event=o,e.getHeatmapCellData(u)}},s=a.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=i(o);r&&(e.showTooltip([r],e.$el.svg.node()),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r,o.target))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=i(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r,o.target))}).on("click",o=>{const r=i(o);r&&n.data_onclick.bind(e.api)(r,o.target)})},updateTargetsForHeatmap(){const e=this;!e.$el.heatmap&&e.initHeatmap()},setHeatmapText(e,t){const n=this;e.each(function(a){(0,B.select)(this).attr("class",Yt.heatmapAxis).text(a.text).attr("dy",Oy[a.baseline]).style("text-anchor",Dy[a.align])}),n.$T(e,t).attr("x",a=>a.x).attr("y",a=>a.y)},redrawHeatmap(e){const t=this,{$el:{heatmap:n},config:a,state:i}=t,{cells:s,rows:o,axisX:r,axisY:l,colorbar:c}=t.getHeatmapLayout(),u=a.heatmap_cell_radius,d=a.heatmap_cell_border_width,h=new Map(o.map(m=>[m,[]]));s.forEach(m=>{var v;return(v=h.get(m.id))==null?void 0:v.push(m)});const f=n.select(`.${Yt.heatmapRows}`).selectAll(`.${Yt.heatmapRow}`).data(o,m=>m);f.exit().remove(),f.enter().append("g").merge(f).attr("class",m=>Yt.heatmapRow+t.classTarget(m)).each(function(m){const v=(0,B.select)(this),b=h.get(m),T=v.selectAll(`.${Yt.heatmapCell}`).data(b,y=>y.index);T.exit().remove();const k=T.enter().append("rect").style("opacity","0").merge(T).attr("class",y=>`${vt.shape} ${vt.shape}-${y.index} ${Yt.heatmapCell}`).style("fill",y=>y.color).style("stroke",d?a.heatmap_cell_border_color:null).style("stroke-width",d?`${d}px`:null).attr("rx",u||null);t.$T(k,e).attr("x",y=>y.x0).attr("y",y=>y.y0).attr("width",y=>Math.max(0,y.x1-y.x0)).attr("height",y=>Math.max(0,y.y1-y.y0)).style("opacity",null);const w=v.selectAll(`.${Yt.heatmapLabel}`).data(a.heatmap_label_show?b.filter(y=>y.value!==null):[],y=>y.index);w.exit().remove(),w.enter().append("text").merge(w).attr("class",Yt.heatmapLabel).attr("x",y=>(y.x0+y.x1)/2).attr("y",y=>(y.y0+y.y1)/2).attr("dy",".35em").style("text-anchor","middle").style("fill",y=>t.getHeatmapLabelColor(y)).text(y=>t.getHeatmapLabel(y))});const g=n.select(`.${Yt.heatmapNames}`).selectAll("text").data(r.concat(l),m=>`${m.align}${m.text}`);g.exit().remove(),t.setHeatmapText(g.enter().append("text").merge(g),e);const _=n.select(`.${Yt.heatmapColorbar}`),x=`${i.datetimeId}-heatmap-colorbar`;_.selectAll("*").remove(),n.select("defs").selectAll("*").remove(),c&&(n.select("defs").append("linearGradient").attr("id",x).attr("x1",0).attr("x2",c.horizontal?1:0).attr("y1",0).attr("y2",c.horizontal?0:1).selectAll("stop").data(c.stops).enter().append("stop").attr("offset",m=>m[0]).attr("stop-color",m=>m[1]),_.append("rect").attr("x",c.x).attr("y",c.y).attr("width",c.width).attr("height",c.height).style("fill",`url(#${x})`),t.setHeatmapText(_.selectAll("text").data(c.labels).enter().append("text"))),t.fitHeatmapHeight(),n.selectAll(`.${Yt.heatmapRow}`).classed(ut.defocused,m=>t.isHeatmapDefocused(m))}}),Fy={heatmap_color_range:["#f6efa6","#d88273","#bf444c"],heatmap_color_ranges:void 0,heatmap_color_min:void 0,heatmap_color_max:void 0,heatmap_color_none:"#ebedf0",heatmap_cell_ratio:void 0,heatmap_cell_padding:0,heatmap_cell_radius:0,heatmap_cell_border_width:0,heatmap_cell_border_color:"#fff",heatmap_label_show:!1,heatmap_label_format:void 0,heatmap_label_color:void 0,heatmap_axis_x_show:!0,heatmap_axis_x_position:"bottom",heatmap_axis_y_show:!0,heatmap_colorbar_show:!0,heatmap_colorbar_position:"right",heatmap_colorbar_format:void 0};let Wu=()=>(pt(Rt.prototype,[$y]),Oe.setOptions([Fy]),vn("heatmap",{hooks:Bu}),(Wu=()=>"heatmap")()),Vu=()=>(Ve(),(Vu=()=>X.LINE)()),Hu=()=>(Ve(void 0,[Ss]),(Hu=()=>X.SPLINE)()),Yu=()=>(Ve(),(Yu=()=>X.STEP)());var Iy={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 ju=()=>(Hn(void 0,[ci,Iy]),(ju=()=>X.PIE)());function Uu(e){const t=e.config.polar_level_max;let n=e.getMinMaxData().max[0].value;return t&&t>n&&(n=t),n}var By={initPolar(){const e=this,{$el:{arcs:t},config:n}=e,a=n.polar_level_text_show,i=n.polar_level_text_backgroundColor;t.levels=t.append("g").attr("class",We.levels),a&&i&&e.generateTextBGColorFilter(i)},getPolarOuterRadius(e,t){var n;const a=Uu(this);return((n=e==null?void 0:e.data.values[0].value)!=null?n:0)/a*t},updateTargetsForPolar(e){this.updateTargetsForArc(e)},redrawPolar(){const e=this,{config:t}=e;t.polar_level_show&&e.updatePolarLevel()},updatePolarLevel(){const e=this,{config:t,state:n,$el:{arcs:{levels:a}}}=e,i=t.polar_level_depth,s=Uu(e),o=La(0,i),r=n.radius,l=o.map(h=>r*((h+1)/i)),c=(t.polar_level_text_format||function(){}).bind(e.api),u=a.selectAll(`.${We.level}`).data(o);u.exit().remove();const d=u.enter().append("g").attr("class",(h,f)=>`${We.level} ${We.level}-${f}`);if(d.append("circle"),d.merge(u).selectAll("circle").style("visibility",t.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>l[h]),t.polar_level_text_show){const h=t.polar_level_text_backgroundColor,f=`#${n.datetimeId}-labels-bg${e.getTargetSelectorSuffix(h)}`;d.append("text").style("text-anchor","middle"),d.merge(u).selectAll("text").attr("dy",p=>-l[p]+5).attr("filter",h?`url(${f})`:null).text(p=>c(s/o.length*(p+1)))}}},zy={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:e=>e%1===0?e:e.toFixed(2),polar_level_text_show:!0,polar_padAngle:0,polar_padding:0,polar_startingAngle:0};let Ku=()=>(Hn([By],[ci,zy]),(Ku=()=>X.POLAR)());function Ny(e,t,n,a,i,s){const o=e&&a>0?n-a:a,r=2*Math.PI;return i*(1-s*(t==="x"?Math.sin:Math.cos)(o*r/n))}const Un=Z.radarPoints,Zu=Z.radarTextWidth;var Xy={initRadar(){const e=this,{config:t,state:{current:n},$el:a}=e;e.hasType("radar")&&(a.radar=a.main.select(`.${U.chart}`).append("g").attr("class",zr.chartRadars),a.radar.levels=a.radar.append("g").attr("class",We.levels),a.radar.axes=a.radar.append("g").attr("class",Ft.axis),a.radar.shapes=a.radar.append("g").attr("class",vt.shapes),n.dataMax=t.radar_axis_max||e.getMinMaxData().max[0].value,t.interaction_enabled&&a.radar.shapes.on("click",i=>{const{target:s}=i,o=/^circle$/i.test(s.tagName)?(0,B.select)(s).datum():null;o!=null&&o.id&&t.data_onclick.bind(e.api)(o,s)}),t.radar_axis_text_show&&(t.interaction_enabled&&e.bindRadarEvent(),e.updateRadarLevel(),e.updateRadarAxes()))},getRadarSize(){const e=this,{config:t,state:{arcWidth:n,arcHeight:a}}=e,i=t.axis_x_categories.length<4?-20:10,s=(Math.min(n,a)-i)/2;return[s,s]},updateTargetsForRadar(e){const t=this,{config:n}=t;le(n.axis_x_categories)&&(n.axis_x_categories=La(0,be("max",e.map(a=>a.values.length)))),t.generateRadarPoints()},getRadarPosition(e,t,n,a){const i=this,{config:s}=i,[o,r]=i.getRadarSize(),l=s.axis_x_categories.length,c=s.radar_direction_clockwise,u=dn(e).map(d=>Ny(c,d,l,t,ht(n)?n:e==="x"?o:r,N(a)?a:s.radar_size_ratio));return u.length===1?u[0]:u},generateRadarPoints(){const e=this,t=e.data.targets,[n,a]=e.getRadarSize(),i=e.cache.get(Un)||{},s=i._size;(!s||s.width!==n&&s.height!==a)&&(t.forEach(o=>{i[o.id]=o.values.map((r,l)=>e.getRadarPosition(["x","y"],l,void 0,e.getRatio("radar",r)))}),i._size={width:n,height:a},e.cache.add(Un,i))},redrawRadar(){const e=this,{radar:t,main:n}=e.$el,a=e.getTranslate("radar");a&&(t.attr("transform",a),n.select(`.${Ot.chartTexts}`).attr("transform",a),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(Un);return(t,n)=>{const a=e[t.id][n];return[a,a,a,a]}},updateRadarLevel(){const e=this,{config:t,state:n,$el:{radar:a}}=e,[i,s]=e.getRadarSize(),o=t.radar_level_depth,r=t.axis_x_categories.length,l=t.radar_level_text_show,c=a.levels,u=La(0,o),d=t.radar_size_ratio*Math.min(i,s),h=u.map(x=>d*((x+1)/o)),f=(t.radar_level_text_format||function(){}).bind(e.api),p=u.map(x=>{const m=h[x];return La(0,r).map(b=>e.getRadarPosition(["x","y"],b,m,1).join(",")).join(" ")}),g=c.selectAll(`.${We.level}`).data(u);g.exit().remove();const _=g.enter().append("g").attr("class",(x,m)=>`${We.level} ${We.level}-${m}`);_.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),l&&(c.select("text").empty()&&c.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>f(0)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(x=>f(n.current.dataMax/u.length*(x+1)))),_.merge(g).attr("transform",x=>`translate(${i-h[x]}, ${s-h[x]})`).selectAll("polygon").attr("points",x=>p[x]),l&&c.selectAll("text").attr("x",x=>Ct(x)?i:p[x].split(",")[0]).attr("y",x=>Ct(x)?s:0)},updateRadarAxes(){const e=this,{config:t,$el:{radar:n}}=e,[a,i]=e.getRadarSize(),s=t.axis_x_categories;let o=n.axes.selectAll("g").data(s);o.exit().remove();const r=o.enter().append("g").attr("class",(l,c)=>`${Ft.axis}-${c}`);if(t.radar_axis_line_show&&r.append("line"),t.radar_axis_text_show&&r.append("text"),o=r.merge(o),t.radar_axis_line_show&&o.select("line").attr("x1",a).attr("y1",i).attr("x2",(l,c)=>e.getRadarPosition("x",c)).attr("y2",(l,c)=>e.getRadarPosition("y",c)),t.radar_axis_text_show){const{x:l=0,y:c=0}=t.radar_axis_text_position,u=e.cache.get(Zu)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){In((0,B.select)(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){Ct(this.width)&&(this.width=mt(this,!0).width/2);let h=e.getRadarPosition("x",d.index,void 0,1),f=Math.round(e.getRadarPosition("y",d.index,void 0,1));return h>a?h+=this.width+l:Math.round(h)<a&&(h-=this.width+l),f>i?(f/2===i&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),f+=c):f<i&&(f-=c),`translate(${h} ${f})`}),!u){const d=[n.axes,n.levels].map(h=>Yr(h.node()).width);d.every(h=>h>0)&&e.cache.add(Zu,d[0]-d[1])}}},bindRadarEvent(){const e=this,{config:t,state:n,$el:{radar:a,svg:i}}=e,s=e.isPointFocusOnly(),{inputType:o,transiting:r}=n,l=o==="mouse",c=u=>{if(n.event=u,!t.interaction_onout)return;const d=e.getDataIndexFromEvent(u),h=Ct(d);(l||h)&&(e.hideTooltip(),s?e.hideCircleFocus():e.unexpandCircles(),l?e.setOverOut(!1,d):h&&e.callOverOutForTouch())};a.axes.on(l?"mouseover ":"touchstart",u=>{if(r)return;n.event=u;const d=e.getDataIndexFromEvent(u);e.selectRectForSingle(i.node(),d),l?e.setOverOut(!0,d):e.callOverOutForTouch(d)},l?void 0:{passive:!0}).on("mouseout",l?c:null).on("click",u=>{const d=e.getDataIndexFromEvent(u);if(Ct(d))return;const h=/tspan/i.test(u.target.tagName)?u.target.parentNode:u.target;e.filterTargetsToShow(e.data.targets).forEach(f=>{const p=e.getValueOnIndex(f.values,d);p&&t.data_onclick.bind(e.api)(p,h)})}),l||i.on("touchstart",c,{passive:!0})},updateRadarShape(){const e=this,t=e.data.targets.filter(s=>e.isRadarType(s)),n=e.cache.get(Un),a=e.$el.radar.shapes.selectAll("polygon").data(e.filterNullish(t)),i=a.enter().append("g").attr("class",e.getChartClass("Radar"));e.$T(a.exit()).remove(),i.append("polygon").merge(a).style("fill",e.color).style("stroke",e.color).attr("points",s=>n[s.id].join(" ")),e.updateTargetForCircle(t,i)},radarCircleX(e){return this.cache.get(Un)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(Un)[e.id][e.index][1]}},Gy={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:e=>e%1===0?e:e.toFixed(2),radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1};let qu=()=>(Hn([jc.eventrect,ai,Xy],[an,Gy,{axis_x_categories:Uc.optAxis.axis_x_categories}]),(qu=()=>X.RADAR)());var Tn=Math.pow;const _e={chartSankey:"bb-chart-sankey",sankeyLinks:"bb-sankey-links",sankeyLink:"bb-sankey-link",sankeyNodes:"bb-sankey-nodes",sankeyNode:"bb-sankey-node",sankeyLabel:"bb-sankey-label"},Ju={left:e=>e.depth,right:(e,t)=>t-1-e.height,justify:(e,t)=>e.sourceLinks.length?e.depth:t-1,center:e=>e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min(...e.sourceLinks.map(t=>t.target.depth))-1:0},Qu=(e,t)=>e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,td=e=>e.reduce((t,n)=>t+n.value,0),Ks=(e,t)=>e.y0-t.y0,ed=(e,t)=>Ks(e.source,t.source)||e.index-t.index,nd=(e,t)=>Ks(e.target,t.target)||e.index-t.index,ad=e=>e>0&&Number.isFinite(e);function Wy(){const e=this,{config:t}=e,n=e.data.targets.filter(e.isSankeyType.bind(e)),a=new Map,i=[],s=[];n.forEach(r=>e.color(r.id)),n.forEach(r=>r.values.forEach(l=>ad(Number(l.value))&&e.color(String(l.x))));const o=r=>{var l;let c=a.get(r);return c||(c={id:r,name:String((l=Qu(t.data_names,r))!=null?l:r),index:i.length,value:0,color:e.color(r),sourceLinks:[],targetLinks:[],depth:0,height:0,layer:0,x0:0,x1:0,y0:0,y1:0},a.set(r,c),i.push(c)),c};return n.filter(r=>e.isTargetToShow(r.id)).forEach(r=>{r.values.forEach(l=>{const c=Number(l.value);if(!ad(c)||!e.isTargetToShow(String(l.x)))return;const u=o(r.id),d=o(String(l.x)),h={source:u,target:d,value:c,index:s.length,width:0,y0:0,y1:0};u.sourceLinks.push(h),d.targetLinks.push(h),s.push(h)})}),i.forEach(r=>{r.value=Math.max(td(r.sourceLinks),td(r.targetLinks))}),{nodes:i,links:s}}function id(e,t){const n=t==="depth"?"sourceLinks":"targetLinks",a=t==="depth"?"target":"source";let i=new Set(e),s=0;for(;i.size;){const o=new Set;if(i.forEach(r=>{r[t]=s,r[n].forEach(l=>o.add(l[a]))}),++s>e.length)return!1;i=o}return!0}function Vy(){var e;const t=this,n=t.config.sankey_node_sort,a=(i,s)=>i.index-s.index;return G(n)?(i,s)=>n.call(t.api,t.getSankeyNodeData(i),t.getSankeyNodeData(s))||a(i,s):(e=Qu({data:a,asc:(i,s)=>i.value-s.value||a(i,s),desc:(i,s)=>s.value-i.value||a(i,s)},n))!=null?e:null}function Hy(e,t,n){var a;const i=this,{config:s}=i,o=n.left,r=n.top,l=o+n.width,c=r+n.height,u=s.sankey_node_width,d=(a=Ju[s.sankey_node_align])!=null?a:Ju.justify,h=Vy.call(i),f=Math.max(...e.map(P=>P.depth))+1,p=f>1?(l-o-u)/(f-1):0,g=Array.from({length:f},()=>[]);e.forEach(P=>{const D=Math.max(0,Math.min(f-1,Math.floor(d(P,f))));P.layer=D,P.x0=o+D*p,P.x1=P.x0+u,g[D].push(P)}),h&&g.forEach(P=>P.sort(h));const _=Math.max(...g.map(P=>P.length)),x=Math.min(s.sankey_node_padding,_>1?(c-r)/(_-1):1/0),m=P=>{P.sourceLinks.sort(nd),P.targetLinks.sort(ed)},v=P=>{P.targetLinks.forEach(D=>D.source.sourceLinks.sort(nd)),P.sourceLinks.forEach(D=>D.target.targetLinks.sort(ed))},b=Math.min(...g.map(P=>(c-r-(P.length-1)*x)/P.reduce((D,R)=>D+R.value,0)));g.forEach(P=>{let D=r;P.forEach(E=>{E.y0=D,E.y1=D+E.value*b,D=E.y1+x,E.sourceLinks.forEach(M=>{M.width=M.value*b})});const R=(c-D+x)/(P.length+1);P.forEach((E,M)=>{E.y0+=R*(M+1),E.y1+=R*(M+1)}),P.forEach(m)});const T=(P,D)=>{P.y0+=D,P.y1+=D},k=(P,D,R,E)=>{for(;R<P.length;R++){const M=P[R],O=(D-M.y0)*E;O>1e-6&&T(M,O),D=M.y1+x}},w=(P,D,R,E)=>{for(;R>=0;R--){const M=P[R],O=(M.y1-D)*E;O>1e-6&&T(M,-O),D=M.y0-x}},y=(P,D)=>{const R=P.length>>1,E=P[R];w(P,E.y0-x,R-1,D),k(P,E.y1+x,R+1,D),w(P,c,P.length-1,D),k(P,r,0,D)},C=(P,D)=>{let R=P.y0-(P.sourceLinks.length-1)*x/2;for(const{target:E,width:M}of P.sourceLinks){if(E===D)break;R+=M+x}for(const{source:E,width:M}of D.targetLinks){if(E===P)break;R-=M}return R},A=(P,D)=>{let R=D.y0-(D.targetLinks.length-1)*x/2;for(const{source:E,width:M}of D.targetLinks){if(E===P)break;R+=M+x}for(const{target:E,width:M}of P.sourceLinks){if(E===D)break;R-=M}return R},S=(P,D,R,E)=>{P.forEach(M=>{let O=0,$=0;(D?M.targetLinks:M.sourceLinks).forEach(I=>{const F=I.value*(I.target.layer-I.source.layer);O+=(D?C(I.source,M):A(M,I.target))*F,$+=F}),$>0&&(T(M,(O/$-M.y0)*R),v(M))}),h||P.sort(Ks),y(P,E)},L=s.sankey_iterations;for(let P=0;P<L;P++){const D=Tn(.99,P),R=Math.max(1-D,(P+1)/L);for(let E=g.length-2;E>=0;E--)S(g[E],!1,D,R);for(let E=1;E<g.length;E++)S(g[E],!0,D,R)}e.forEach(P=>{let D=P.y0,R=P.y0;P.sourceLinks.forEach(E=>{E.y0=D+E.width/2,D+=E.width}),P.targetLinks.forEach(E=>{E.y1=R+E.width/2,R+=E.width})})}function sd(){var e;const t=this,{config:n,state:{current:{width:a,height:i},isCanvasMode:s,isLegendRight:o}}=t,r=t.getCurrentPadding(),l=n.legend_show&&n.legend_position==="bottom"?(s?0:t.getLegendHeight())+10:0,c=n.legend_show&&o?t.getLegendWidth()+(((e=n.padding)==null?void 0:e.mode)==="fit"?0:20):0,u=s?t.getCanvasSurfaceHeight():i;return{left:r.left,top:r.top,width:Math.max(0,a-r.left-r.right-c),height:Math.max(0,u-r.top-r.bottom-l)}}function Yy(e){return{left:e.top,top:e.left,width:e.height,height:e.width}}function jy(e){const{x0:t,x1:n,y0:a,y1:i}=e;Object.assign(e,{x0:a,x1:i,y0:t,y1:n})}function Uy(e,t,n){const[[a,i],[s],,[o,r]]=e,l=g=>Tn(1-g,3)*a+3*(1-g)*g*s+Tn(g,3)*o;let c=0,u=1;for(let g=0;g<20;g++){const _=(c+u)/2;l(_)<n==a<o?c=_:u=_}const d=(c+u)/2,h=3*Tn(1-d,2)*(s-a)+3*Tn(d,2)*(o-s),f=6*d*(1-d)*(r-i),p=h?f/h:0;return{c:i+(r-i)*(3*Tn(d,2)-2*Tn(d,3)),half:t/2*Math.sqrt(1+p*p)}}const Ky={namedData:!0,afterFocus(e){var t;(t=e.updateSankeyFocus)==null||t.call(e)},labelData(){return[]},tooltipTarget(e,t){var n;const{nodes:a}=e.getSankeyLayout(),i=(n=t.data)!=null&&n.id?a.find(r=>r.id===t.data.id):a[t.index],s=i?[e.getSankeyNodeData(i)]:[],o=i&&(e.config.sankey_rotated?[(i.x0+i.x1)/2,i.y1]:[i.x1,(i.y0+i.y1)/2]);return{data:s,point:o}}};var Zy={isSankeyType(e){return this.isTypeOf(e,"sankey")},getSankeyLayout(){const e=this,t=sd.call(e),{nodes:n,links:a}=Wy.call(e);if(n.length)if(id(n,"depth")&&id(n,"height")){const i=e.config.sankey_rotated;Hy.call(e,n,a,i?Yy(t):t),i&&n.forEach(jy)}else return console.error("[billboard.js] The links of the sankey chart make a cycle: it can't be drawn."),{nodes:[],links:[],area:t};return{nodes:n,links:a,area:t}},getSankeyLinkPoints(e,t=!1){const n=this.config.sankey_rotated,a=n?e.source.y1:e.source.x1,i=n?e.target.y0:e.target.x0,s=(a+i)/2,o=[[a,e.y0],[s,e.y0],[s,e.y1],[i,e.y1]];return n&&!t?o.map(([r,l])=>[l,r]):o},getSankeyLinkPath(e){const[t,n,a,i]=this.getSankeyLinkPoints(e);return`M${t}C${n},${a},${i}`},isSankeyLinkHit(e,t,n){const a=this.getSankeyLinkPoints(e,!0),[i,s]=this.config.sankey_rotated?[n,t]:[t,n];if(i<a[0][0]||i>a[3][0])return!1;const o=Uy(a,Math.max(1,e.width),i);return Math.abs(s-o.c)<=o.half},getSankeyLabel(e){var t;const n=this,{config:a}=n;if(!a.sankey_label_show)return null;const i=a.sankey_label_format,s=String((t=G(i)?i.call(n.api,e.name,e.value,e.id):e.name)!=null?t:""),o=sd.call(n);if(a.sankey_rotated){const l=e.y0>o.top+o.height/2;return{text:s,x:(e.x0+e.x1)/2,y:l?e.y0-6:e.y1+6,align:"center",baseline:l?"bottom":"top"}}const r=e.x0>o.left+o.width/2;return{text:s,x:r?e.x0-6:e.x1+6,y:(e.y0+e.y1)/2,align:r?"right":"left",baseline:"middle"}},getSankeyLinkColors(e){const{source:{color:t},target:{color:n}}=e;return{source:[t,t],target:[n,n],gradient:[t,n]}[this.config.sankey_link_color]||[t,t]},isSankeyDefocused(e){const t=this,n=t.state.defocusedTargetIds;return n!=null&&n.size?"source"in e?n.has(e.source.id):n.has(e.id)||e.targetLinks.length>0&&!t.data.targets.some(a=>a.id===e.id)&&e.targetLinks.every(a=>n.has(a.source.id)):!1},getSankeyNodeData(e){return{id:e.id,index:e.index,value:e.value,name:e.name}},getSankeyLinkData(e){const{source:t,target:n,value:a,index:i}=e;return{id:t.id,x:n.id,index:i,value:a,name:`${t.name} \u2192 ${n.name}`,source:t.id,target:n.id}},generateGetSankeyPoints(){return()=>{}}},qy=Object.defineProperty,Jy=Object.defineProperties,Qy=Object.getOwnPropertyDescriptors,od=Object.getOwnPropertySymbols,t0=Object.prototype.hasOwnProperty,e0=Object.prototype.propertyIsEnumerable,rd=(e,t,n)=>t in e?qy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,n0=(e,t)=>{for(var n in t||(t={}))t0.call(t,n)&&rd(e,n,t[n]);if(od)for(var n of od(t))e0.call(t,n)&&rd(e,n,t[n]);return e},a0=(e,t)=>Jy(e,Qy(t)),i0=a0(n0({},Zy),{initSankey(){const e=this,{$el:t}=e;t.sankey=t.main.select(`.${U.chart}`).append("g").classed(_e.chartSankey,!0),t.sankey.append("defs"),t.sankey.append("g").classed(_e.sankeyLinks,!0),t.sankey.append("g").classed(_e.sankeyNodes,!0),e.bindSankeyEvent()},bindSankeyEvent(){const e=this,{$el:{sankey:t},config:n,state:a}=e;if(!n.interaction_enabled)return;const i=o=>{var r,l;const c=o.target===t.node()?(l=(r=a.eventReceiver.rect)==null?void 0:r.node)==null?void 0:l.call(r):o.target;if(c&&/^(rect|path)$/i.test(c.tagName)){const u=(0,B.select)(c).datum();if(u!=null&&u.sourceLinks)return a.event=o,e.getSankeyNodeData(u);if(u!=null&&u.source)return a.event=o,e.getSankeyLinkData(u)}},s=a.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=i(o);r&&(e.showTooltip([r],e.$el.svg.node()),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r,o.target))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=i(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r,o.target))}).on("click",o=>{const r=i(o);r&&n.data_onclick.bind(e.api)(r,o.target)})},updateTargetsForSankey(){const e=this;!e.$el.sankey&&e.initSankey()},updateSankeyFocus(){var e;const t=this,n=a=>t.isSankeyDefocused(a);(e=t.$el.sankey)==null||e.selectAll(`.${_e.sankeyLink}, .${_e.sankeyNode}`).classed(ut.defocused,n)},redrawSankey(e){var t;const n=this,{$el:{sankey:a},config:i,state:s}=n,{nodes:o,links:r}=n.getSankeyLayout(),l=i.sankey_rotated,c=i.sankey_node_border_width,u=v=>`${v.source.id}\0${v.target.id}\0${v.index}`,d=v=>v.id,h=v=>`${s.datetimeId}-sankey-link-${v.index}`;a.style("--bb-sankey-link-opacity",(t=i.sankey_link_opacity)!=null?t:null);const f=a.select(`.${_e.sankeyLinks}`).selectAll(`.${_e.sankeyLink}`).data(r,u);f.exit().remove();const p=f.enter().append("path").style("opacity","0").merge(f).attr("class",v=>n.generateClass(_e.sankeyLink,v.source.id)).style("stroke",v=>{const[b,T]=n.getSankeyLinkColors(v);return b===T?b:`url(#${h(v)})`}),g=a.select("defs").selectAll("linearGradient").data(r.filter(v=>{const[b,T]=n.getSankeyLinkColors(v);return b!==T}));g.exit().remove(),g.enter().append("linearGradient").attr("gradientUnits","userSpaceOnUse").call(v=>{v.append("stop").attr("offset","0"),v.append("stop").attr("offset","1")}).merge(g).attr("id",v=>h(v)).each(function(v){const[[b],,,[T]]=n.getSankeyLinkPoints(v,!0),[k,w]=l?["y","x"]:["x","y"],y=n.getSankeyLinkColors(v);(0,B.select)(this).attr(`${k}1`,b).attr(`${k}2`,T).attr(`${w}1`,0).attr(`${w}2`,0).selectAll("stop").attr("stop-color",(C,A)=>y[A])}),n.$T(p,e).attr("d",v=>n.getSankeyLinkPath(v)).style("stroke-width",v=>`${Math.max(1,v.width)}px`).style("opacity",null);const _=a.select(`.${_e.sankeyNodes}`).selectAll(`.${_e.sankeyNode}`).data(o,d);_.exit().remove();const x=_.enter().append("g");x.append("rect").attr("class",vt.shape),x.append("text").attr("class",_e.sankeyLabel);const m=x.merge(_).attr("class",v=>_e.sankeyNode+n.classTarget(v.id));m.select("rect").datum(v=>v).style("fill",v=>v.color).style("stroke",c?i.sankey_node_border_color:null).style("stroke-width",c?`${c}px`:null).call(v=>{n.$T(v,e).attr("x",b=>b.x0).attr("y",b=>b.y0).attr("width",b=>Math.max(1,b.x1-b.x0)).attr("height",b=>Math.max(1,b.y1-b.y0))}),m.select("text").datum(v=>v).each(function(v){const b=n.getSankeyLabel(v),T=(0,B.select)(this);b?(T.text(b.text).attr("dy",{middle:".35em",top:".71em",bottom:"0"}[b.baseline]).style("text-anchor",{left:"start",right:"end",center:"middle"}[b.align]),n.$T(T,e).attr("x",b.x).attr("y",b.y)):T.text(null)}),n.updateSankeyFocus()}}),s0={sankey_rotated:!1,sankey_node_width:20,sankey_node_padding:10,sankey_node_align:"justify",sankey_node_sort:"auto",sankey_node_border_width:0,sankey_node_border_color:"#000",sankey_link_color:"source",sankey_link_opacity:void 0,sankey_iterations:6,sankey_label_show:!0,sankey_label_format:void 0};let ld=()=>(pt(Rt.prototype,[i0]),Oe.setOptions([s0]),vn("sankey",{hooks:Ky}),(ld=()=>"sankey")());var o0={scatter_zerobased:!1};let cd=()=>(Vn([bn,ai],[an,o0]),(cd=()=>X.SCATTER)());var He=kt(12);function r0(e){const t=this;return e.map(n=>{const{id:a,values:i}=n,{value:s}=i[0];return{name:a,id:a,value:s,ratio:t.getRatio("treemap",i[0])}})}var l0={initTreemapLayout(){this.treemap=(0,He.treemap)().tile(this.getTreemapTile())},getTreemapTile(){var e,t;const n=this,{config:a,state:{current:{width:i,height:s}}}=n,o=(t={binary:He.treemapBinary,dice:He.treemapDice,slice:He.treemapSlice,sliceDice:He.treemapSliceDice,squarify:He.treemapSquarify,resquarify:He.treemapResquarify}[(e=a.treemap_tile)!=null?e:"binary"])!=null?t:He.treemapBinary;return(r,l,c,u,d)=>{o(r,0,0,i,s);for(const h of r.children)h.x0=l+h.x0/i*(u-l),h.x1=l+h.x1/i*(u-l),h.y0=c+h.y0/s*(d-c),h.y1=c+h.y1/s*(d-c)}},getTreemapData(e){const t=this;return{name:"root",children:r0.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},getTreemapRoot(e){const t=this,n=t.getTreemapData(e!=null?e:t.data.targets),a=(0,He.hierarchy)(n).sum(s=>s.value),i=t.getSortCompareFn(!0);return t.treemap||t.initTreemapLayout(),t.treemap(i?a.sort(i):a)}},c0=Object.defineProperty,u0=Object.defineProperties,d0=Object.getOwnPropertyDescriptors,ud=Object.getOwnPropertySymbols,h0=Object.prototype.hasOwnProperty,f0=Object.prototype.propertyIsEnumerable,dd=(e,t,n)=>t in e?c0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g0=(e,t)=>{for(var n in t||(t={}))h0.call(t,n)&&dd(e,n,t[n]);if(ud)for(var n of ud(t))f0.call(t,n)&&dd(e,n,t[n]);return e},p0=(e,t)=>u0(e,d0(t));function _0(e,t){const n=this;e.selectAll("g").attr("transform",a=>{const i=Cn(n,a,t);return`translate(${i.x},${i.y})`}).select("rect").attr("width",a=>Cn(n,a,t).w).attr("height",a=>Cn(n,a,t).h)}var x0=p0(g0({},l0),{initTreemap(){const e=this,{$el:t,state:{current:{width:n,height:a},clip:i,datetimeId:s}}=e;i.id=`${s}-clip`,e.initTreemapLayout(),t.defs.append("clipPath").attr("id",i.id).append("rect").attr("width",n).attr("height",a),t.treemap=t.main.select(`.${U.chart}`).attr("clip-path",`url(#${i.id})`).append("g").classed(Xr.chartTreemaps,!0),e.bindTreemapEvent()},bindTreemapEvent(){const e=this,{$el:t,config:n,state:a}=e,i=s=>{var o;const r=s.isTrusted?s.target:(o=a.eventReceiver.rect)==null?void 0:o.node();let l;return r&&/^rect$/i.test(r.tagName)&&(a.event=s,l=(0,B.select)(r).datum()),l==null?void 0:l.data};if(n.interaction_enabled){const s=a.inputType==="touch";t.treemap.on(s?"touchstart":"mouseover mousemove",o=>{const r=i(o);r&&(e.showTooltip([r],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=i(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))}).on("click",o=>{var r;const{target:l}=o,c=/^rect$/i.test(l.tagName)?(r=(0,B.select)(l).datum())==null?void 0:r.data:null;c&&n.data_onclick.bind(e.api)(c,l)})}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:n}}=t,a=[t.getTreemapRoot(e!=null?e:t.data.targets)];n.data(t.filterNullish(a))},updateTreemap(e){const t=this,{$el:n,$T:a}=t,i=n.treemap.datum(),s=t.getChartClass("Treemap"),o=t.getClass("treemap",!0),r=n.treemap.selectAll("g").data(i.children);a(r.exit(),e).style("opacity","0").remove(),r.enter().append("g").append("rect"),n.treemap.selectAll("g").attr("class",s).select("rect").attr("class",o).attr("fill",l=>t.color(l.data.name))},generateGetTreemapPoints(){const e=this,{$el:t}=e,n={};return t.treemap.selectAll("g").each(a=>{const i=Cn(e,a);n[a.data.name]=[[i.x,i.y],[i.x+i.w,i.y+i.h]]}),a=>n[a.id]},redrawTreemap(e){const t=this,{$el:n,state:{current:{width:a,height:i}}}=t;return n.defs.select("rect").attr("width",a).attr("height",i),[t.$T(n.treemap,e,ye()).call(_0.bind(t),n.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{$el:{treemap:n},config:a,scale:{x:i,y:s}}=t,{id:o,value:r}=e,l=a.treemap_label_format,c=t.getRatio("treemap",e),u=(c*100).toFixed(2),d=a.treemap_label_show&&cs.call(t,c,"treemap")?null:"0",h=n.selectAll("g").filter(g=>g.data.id===o).datum();let f=0,p=0;if(h){const{x0:g,x1:_,y0:x,y1:m}=h;f=i(_)-i(g),p=s(m)-s(x)}return function(g){return g.style("opacity",d),G(l)?l.bind(t.api)(r,c,o,{width:f,height:p}):`${o}
40
+ ${u}%`}}}),m0={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};let hd=()=>(Vn([x0],[m0]),(hd=()=>X.TREEMAP)()),Zs=Object.create(null);const fd={version:"4.2.0-next.1",generate(e){const t=Fe(Object.create(null),Zs,e),n=new Jt(t);return n.internal.charts=this.instance,this.instance.push(n),n},defaults(e){return Q(e)&&(Zs=e),Zs},instance:[],plugin:{}};Object.keys(re).forEach(e=>re[e]()),Object.keys(at).forEach(e=>at[e]()),ic(),sc(),pt(Rt.prototype,Tf),xc(),Ts("grid",fg),pt(Rt.prototype,Ix),Ts("subchart",Bx),pt(Rt.prototype,mx),Ts("selection",vx),Oc(),tc(),Il(),ac("boxplot",{canvas:gf}),vn("bullet",{canvas:_f}),vn("heatmap",{canvas:wg}),vn("sankey",{canvas:kg}),Wx("treemap",zx)})(),fi})()});