billboard.js 4.1.0-next.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +3 -15
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +4 -4
  5. package/dist/billboard.pkgd.js +3 -15
  6. package/dist/billboard.pkgd.min.js +4 -4
  7. package/dist/billboard.react.js +1 -1
  8. package/dist/billboard.react.min.js +1 -1
  9. package/dist/billboard.worker.js +1 -1
  10. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  17. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  18. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  19. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2 -2
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2 -2
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  30. package/dist/theme/dark.css +1 -1
  31. package/dist/theme/dark.min.css +1 -1
  32. package/dist/theme/datalab.css +1 -1
  33. package/dist/theme/datalab.min.css +1 -1
  34. package/dist/theme/graph.css +1 -1
  35. package/dist/theme/graph.min.css +1 -1
  36. package/dist/theme/insight.css +1 -1
  37. package/dist/theme/insight.min.css +1 -1
  38. package/dist/theme/modern.css +1 -1
  39. package/dist/theme/modern.min.css +1 -1
  40. package/dist-esm/Chart/Chart.js +1 -1
  41. package/dist-esm/Chart/api/axis.js +1 -1
  42. package/dist-esm/Chart/api/category.js +1 -1
  43. package/dist-esm/Chart/api/chart.js +1 -1
  44. package/dist-esm/Chart/api/color.js +1 -1
  45. package/dist-esm/Chart/api/data.js +1 -1
  46. package/dist-esm/Chart/api/export.js +1 -1
  47. package/dist-esm/Chart/api/flow.js +1 -1
  48. package/dist-esm/Chart/api/focus.js +1 -1
  49. package/dist-esm/Chart/api/grid.js +1 -1
  50. package/dist-esm/Chart/api/group.js +1 -1
  51. package/dist-esm/Chart/api/legend.js +1 -1
  52. package/dist-esm/Chart/api/load.js +1 -1
  53. package/dist-esm/Chart/api/regions.js +1 -1
  54. package/dist-esm/Chart/api/selection.js +1 -1
  55. package/dist-esm/Chart/api/show.js +1 -1
  56. package/dist-esm/Chart/api/stubs.js +1 -1
  57. package/dist-esm/Chart/api/subchart.js +1 -1
  58. package/dist-esm/Chart/api/tooltip.js +1 -1
  59. package/dist-esm/Chart/api/x.js +1 -1
  60. package/dist-esm/Chart/api/zoom.js +1 -1
  61. package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
  62. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
  63. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
  64. package/dist-esm/ChartInternal/ChartInternal.js +1 -2
  65. package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
  66. package/dist-esm/ChartInternal/data/convert.js +1 -1
  67. package/dist-esm/ChartInternal/data/data.js +1 -1
  68. package/dist-esm/ChartInternal/data/load.js +1 -1
  69. package/dist-esm/ChartInternal/interactions/drag.js +1 -1
  70. package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
  71. package/dist-esm/ChartInternal/interactions/flow.js +1 -1
  72. package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
  73. package/dist-esm/ChartInternal/interactions/subchart.js +1 -1
  74. package/dist-esm/ChartInternal/interactions/zoom.js +1 -1
  75. package/dist-esm/ChartInternal/internals/category.js +1 -1
  76. package/dist-esm/ChartInternal/internals/class.js +1 -1
  77. package/dist-esm/ChartInternal/internals/clip.js +1 -1
  78. package/dist-esm/ChartInternal/internals/color.js +1 -1
  79. package/dist-esm/ChartInternal/internals/domain.js +1 -1
  80. package/dist-esm/ChartInternal/internals/format.js +1 -1
  81. package/dist-esm/ChartInternal/internals/grid.js +1 -1
  82. package/dist-esm/ChartInternal/internals/legend.js +1 -1
  83. package/dist-esm/ChartInternal/internals/redraw.js +1 -1
  84. package/dist-esm/ChartInternal/internals/region.js +1 -1
  85. package/dist-esm/ChartInternal/internals/scale.js +1 -1
  86. package/dist-esm/ChartInternal/internals/selection.js +1 -1
  87. package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
  88. package/dist-esm/ChartInternal/internals/size.js +1 -1
  89. package/dist-esm/ChartInternal/internals/style.js +1 -1
  90. package/dist-esm/ChartInternal/internals/subchart.util.js +1 -1
  91. package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
  92. package/dist-esm/ChartInternal/internals/text.js +1 -1
  93. package/dist-esm/ChartInternal/internals/text.util.js +1 -1
  94. package/dist-esm/ChartInternal/internals/title.js +1 -1
  95. package/dist-esm/ChartInternal/internals/tooltip.js +1 -1
  96. package/dist-esm/ChartInternal/internals/transform.js +1 -1
  97. package/dist-esm/ChartInternal/internals/type.js +1 -1
  98. package/dist-esm/ChartInternal/shape/arc.js +1 -1
  99. package/dist-esm/ChartInternal/shape/area.js +1 -1
  100. package/dist-esm/ChartInternal/shape/bar.js +1 -1
  101. package/dist-esm/ChartInternal/shape/bubble.js +1 -1
  102. package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
  103. package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
  104. package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
  105. package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
  106. package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
  107. package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
  108. package/dist-esm/ChartInternal/shape/core/path.js +1 -1
  109. package/dist-esm/ChartInternal/shape/core/point.js +1 -1
  110. package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
  111. package/dist-esm/ChartInternal/shape/funnel.js +1 -1
  112. package/dist-esm/ChartInternal/shape/gauge.js +1 -1
  113. package/dist-esm/ChartInternal/shape/line.js +1 -1
  114. package/dist-esm/ChartInternal/shape/point.js +1 -1
  115. package/dist-esm/ChartInternal/shape/polar.js +1 -1
  116. package/dist-esm/ChartInternal/shape/radar.js +1 -1
  117. package/dist-esm/ChartInternal/shape/shape.js +1 -1
  118. package/dist-esm/ChartInternal/shape/treemap.js +1 -1
  119. package/dist-esm/canvas/CanvasAxisRenderer.js +1 -1
  120. package/dist-esm/canvas/CanvasEngine.js +1 -1
  121. package/dist-esm/canvas/CanvasPainter.js +1 -1
  122. package/dist-esm/canvas/CanvasRenderer.js +1 -1
  123. package/dist-esm/canvas/CanvasTheme.js +1 -1
  124. package/dist-esm/canvas/HitDetector.js +1 -1
  125. package/dist-esm/canvas/axisTicks.js +1 -1
  126. package/dist-esm/canvas/classes.js +1 -1
  127. package/dist-esm/canvas/color.js +1 -1
  128. package/dist-esm/canvas/geometry.js +1 -1
  129. package/dist-esm/canvas/labels.js +1 -1
  130. package/dist-esm/canvas/pointPattern.js +1 -1
  131. package/dist-esm/canvas/util.js +1 -1
  132. package/dist-esm/config/Options/Options.js +1 -1
  133. package/dist-esm/config/Options/axis/axis.js +1 -1
  134. package/dist-esm/config/Options/axis/x.js +1 -1
  135. package/dist-esm/config/Options/axis/y.js +1 -1
  136. package/dist-esm/config/Options/axis/y2.js +1 -13
  137. package/dist-esm/config/Options/common/boost.js +1 -1
  138. package/dist-esm/config/Options/common/color.js +1 -1
  139. package/dist-esm/config/Options/common/grid.js +1 -1
  140. package/dist-esm/config/Options/common/legend.js +1 -1
  141. package/dist-esm/config/Options/common/main.js +1 -1
  142. package/dist-esm/config/Options/common/point.js +1 -1
  143. package/dist-esm/config/Options/common/title.js +1 -1
  144. package/dist-esm/config/Options/common/tooltip.js +1 -1
  145. package/dist-esm/config/Options/data/axis.js +1 -1
  146. package/dist-esm/config/Options/data/data.js +1 -1
  147. package/dist-esm/config/Options/data/selection.js +1 -1
  148. package/dist-esm/config/Options/interaction/interaction.js +1 -1
  149. package/dist-esm/config/Options/interaction/subchart.js +1 -1
  150. package/dist-esm/config/Options/interaction/zoom.js +1 -1
  151. package/dist-esm/config/Options/shape/arc.js +1 -1
  152. package/dist-esm/config/Options/shape/area.js +1 -1
  153. package/dist-esm/config/Options/shape/bar.js +1 -1
  154. package/dist-esm/config/Options/shape/bubble.js +1 -1
  155. package/dist-esm/config/Options/shape/candlestick.js +1 -1
  156. package/dist-esm/config/Options/shape/donut.js +1 -1
  157. package/dist-esm/config/Options/shape/funnel.js +1 -1
  158. package/dist-esm/config/Options/shape/gauge.js +1 -1
  159. package/dist-esm/config/Options/shape/line.js +1 -1
  160. package/dist-esm/config/Options/shape/pie.js +1 -1
  161. package/dist-esm/config/Options/shape/polar.js +1 -1
  162. package/dist-esm/config/Options/shape/radar.js +1 -1
  163. package/dist-esm/config/Options/shape/scatter.js +1 -1
  164. package/dist-esm/config/Options/shape/spline.js +1 -1
  165. package/dist-esm/config/Options/shape/treemap.js +1 -1
  166. package/dist-esm/config/Store/Element.js +1 -1
  167. package/dist-esm/config/Store/State.js +1 -1
  168. package/dist-esm/config/Store/Store.js +1 -1
  169. package/dist-esm/config/classes.js +1 -1
  170. package/dist-esm/config/config.js +1 -1
  171. package/dist-esm/config/const.js +1 -1
  172. package/dist-esm/config/resolver/axis.core.js +1 -1
  173. package/dist-esm/config/resolver/axis.js +1 -1
  174. package/dist-esm/config/resolver/canvas.js +1 -1
  175. package/dist-esm/config/resolver/canvasShape.js +1 -1
  176. package/dist-esm/config/resolver/category.js +1 -1
  177. package/dist-esm/config/resolver/export.js +1 -1
  178. package/dist-esm/config/resolver/flow.js +1 -1
  179. package/dist-esm/config/resolver/grid.js +1 -1
  180. package/dist-esm/config/resolver/interaction/selection.js +1 -1
  181. package/dist-esm/config/resolver/interaction/subchart.js +1 -1
  182. package/dist-esm/config/resolver/interaction/zoom.js +1 -1
  183. package/dist-esm/config/resolver/regions.js +1 -1
  184. package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
  185. package/dist-esm/config/resolver/shape/area.js +1 -1
  186. package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
  187. package/dist-esm/config/resolver/shape/bar.js +1 -1
  188. package/dist-esm/config/resolver/shape/bubble.js +1 -1
  189. package/dist-esm/config/resolver/shape/candlestick.js +1 -1
  190. package/dist-esm/config/resolver/shape/donut.js +1 -1
  191. package/dist-esm/config/resolver/shape/funnel.js +1 -1
  192. package/dist-esm/config/resolver/shape/gauge.js +1 -1
  193. package/dist-esm/config/resolver/shape/line.js +1 -1
  194. package/dist-esm/config/resolver/shape/pie.js +1 -1
  195. package/dist-esm/config/resolver/shape/polar.js +1 -1
  196. package/dist-esm/config/resolver/shape/radar.js +1 -1
  197. package/dist-esm/config/resolver/shape/scatter.js +1 -1
  198. package/dist-esm/config/resolver/shape/treemap.js +1 -1
  199. package/dist-esm/core.js +3 -3
  200. package/dist-esm/index.canvas.js +1 -1
  201. package/dist-esm/index.esm.js +1 -1
  202. package/dist-esm/module/Cache.js +1 -1
  203. package/dist-esm/module/browser.js +1 -1
  204. package/dist-esm/module/dsv.js +1 -1
  205. package/dist-esm/module/error.js +1 -1
  206. package/dist-esm/module/generator.js +1 -1
  207. package/dist-esm/module/sanitize.js +1 -1
  208. package/dist-esm/module/util/brush.js +1 -1
  209. package/dist-esm/module/util/dom.js +1 -1
  210. package/dist-esm/module/util/object.js +1 -1
  211. package/dist-esm/module/util/type-checks.js +1 -1
  212. package/dist-esm/module/worker.js +1 -1
  213. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  214. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  215. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  216. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  217. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  218. package/dist-esm/react/index.js +1 -1
  219. package/package.json +1 -1
  220. package/src/ChartInternal/ChartInternal.ts +1 -1
  221. package/src/config/Options/axis/y2.ts +0 -13
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.0-next.3
8
+ * @version 4.1.0
9
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 kc},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,_e=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
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(),u=(n=si.get(c))!=null?n:c,d=[];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 v=(i=oi.get(p))!=null?i:p;let b,y;if(_!==void 0)b=_,y='"';else if(x!==void 0)b=x,y="'";else if(m!==void 0)b=m,y='"';else{oi.has(p)&&d.push(v);continue}if(oi.has(p)){const w=mu(p,b,m!==void 0);w!==null&&d.push(`${v}=${y}${w}${y}`)}}const f=d.length>0?` ${d.join(" ")}`:"";return`<${u}${f}${l?"/>":">"}`}function Se(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|[^<>\s]+>/g,t=>t.startsWith("<!--")?"":t.startsWith("<")?bu(t)?yu(t):t.replace(/</g,"&lt;"):t.slice(0,-1)+"&gt;")}var Tu=Object.defineProperty,ks=Object.getOwnPropertySymbols,wu=Object.prototype.hasOwnProperty,Cu=Object.prototype.propertyIsEnumerable,As=(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)&&As(e,n,t[n]);if(ks)for(var n of ks(t))Cu.call(t,n)&&As(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 ku(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 Au(...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 ke(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]=ke(e[i],a)):e[i]=ot(a)?a.concat():a}}),ke(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 ue(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 xe(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 Se(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,u;const d=this,{axis:h,config:f,format:g,org:p,scale:_,state:{current:x,width:m,height:v,width2:b,height2:y,hasAxis:T,hasTreemap:w}}=d;if(T){const C=f.axis_rotated,k=d.getResettedPadding(1),S={x:C?k:0,y:C?0:v,subX:C?1:0,subY:C?0:y},A={x:C?v:m,y:C?m:k,subX:C?v:m,subY:C?b: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=d.getXScale(S.x,A.x,L,()=>h.x.tickOffset()),_.subX=d.getXScale(S.x,A.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=d.getYScale("y",S.y,A.y,_.y?_.y.domain():f.axis_y_default,_.y),_.subY=d.getYScale("y",S.subY,A.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",S.y,A.y,_.y2?_.y2.domain():f.axis_y2_default,_.y2),_.subY2=d.getYScale("y2",S.subY,A.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=d.getCurrentPadding();_.x=(0,Qe.scaleLinear)().rangeRound([C.left,x.width-C.right]),_.y=(0,Qe.scaleLinear)().rangeRound([C.top,x.height-C.bottom])}else(u=d.updateArc)==null||u.call(d)},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 de(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 Ae(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 u=ui(i[0]),d=ui(i[i.length-1]);if(u===null||d===null)return a;const h=u<=d,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 he(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,u=(n=(t=c.zoom)==null?void 0:t.domain)==null?void 0:n.call(t),d=((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!(u!=null&&u.length)||!(d!=null&&d.length)?!1:!On(u[0],d[0])||!On(u[1],d[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 u;return(u=Xs(e,c))!=null?u: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(u=>Mu(e,u));const[s,o]=a;let r=Gs(i,s),l=Ou(i,o);const c=u=>{const d=Gs(i,u);let h=-1,f=1/0;for(const g of[d-1,d]){const p=i[g],_=Math.abs(p-u);_<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(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,((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:u}=e,d=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 _=v=>(f.set(g,v),v);if(!(h!=null&&h.length))return _([]);const x=di(u.axis_x_tick_values,e.api);if(x){const v=ta(e,x);return _(t?aa(e,v):v)}if(u.axis_x_tick_fit&&(h!=null&&h.length)&&e.mapTargetsToUniqueXs){const v=$u(e,h),b=Bu(e,v),y=na(e,b,u.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 v=((o=(s=e.zoom)==null?void 0:s.getDomain)==null?void 0:o.call(s))||d.domain(),b=Iu(sn(d,u.axis_x_tick_count||_e),v);return _(t?gi(b,sa(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,y)=>y);return _(t?gi(v,sa(e)):v)}const m=sn(d,u.axis_x_tick_count||_e);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||_e,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,u=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),d=zt(r,"x","count","subchart_axis_x"),h=Gu(e),f=(_,x=!1)=>t?aa(e,_,x,"subchart_axis_x",h):_;if(!c||!(u!=null&&u.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(u),d,(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,d||_e);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)),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 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 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 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"),u=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,u);return fi(e,h,r)}if(l===!1||c===!1)return t;const d=Vs(e,!1);return Ys(e,d,n,r)?t:fi(e,d,r)}function $n(e,t="y",n,i=!0,a=e.scale[t],s=`axis_${t}`){var o,r,l;const{axis:c,config:u}=e,d=`axis_${t}`,h=di(zt(u,t,"values",s),e.api),f=_=>i?Uu(e,t,_,s):_;if(h)return f(zs(e,h,t));const g=Xu(a.domain(),u[`${d}_tick_stepSize`]);if(g.length)return f(g);const p=n!=null?n:zt(u,t,"count",s);if((o=c==null?void 0:c.isTimeSeries)!=null&&o.call(c,t)&&u[`${d}_tick_time_value`])return f(sn(a,u[`${d}_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,_e))}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:_e)}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)||_e,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 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 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)||_e,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))}),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,g)=>l?(u-1-g)%d===0:g%d===0);const h=new Set(c.filter((f,g)=>g%d===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||_e,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
11
  `),r=de((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,u)=>{const d=l+u*r;(a==null?void 0:a.maxWidth)===void 0?s.fillText(c,0,d):s.fillText(c,0,d,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,u={x:n-a,y:i-a,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,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(u=>String(u));const c=String(l);return c.indexOf(`
@@ -27,7 +27,7 @@ ${(r*100).toFixed(2)}%`;return c==null?null:String(c)}var pt=wt(4),Id=Object.def
27
27
  <td class="name">${this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>'}{=NAME}</td>
28
28
  <td class="value">{=VALUE}</td>
29
29
  </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:u}}=a,{bindto:d}=s.tooltip_contents,h=s.axis_rotated,f=c==null?void 0:c.datum();if(!d&&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 k;const S=o[w?(k=a.axis)==null?void 0:k.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:v=0}=f,b=(i=(n=s.tooltip_position)==null?void 0:n.bind(a.api)(g,m,v,l==null?void 0:l.node(),x))!=null?i:u&&Fa(u)?a.getTooltipPositionViewBox.bind(a)(m,v,x):a.getTooltipPosition.bind(a)(m,v,x);["top","left"].forEach(y=>{const T=b[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,u=l.axis_rotated,d=s.hasArcType()||c.hasFunnel||c.hasTreemap,h=(a=(i=d?r:o)==null?void 0:i.node())!=null?a:c.event.target;let{x:f,y:g}=n;c.hasAxis&&(f=u?f:n.xAxis,g=u?n.xAxis:g);const p=ki(h,f,g,!1),_=ht(h),x=ki(h,20,0,!1).x;let m=p.y,v=p.x+e/2+x;return d&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(v-=e/2+x,m+=t):(m+=_.height/2,v+=_.width/2-(e-x))),v+e>_.width&&(v=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:v}},getTooltipPosition(e,t,n){var i,a,s;const o=this,{config:r,scale:l,state:c}=o,{width:u,height:d,current:h,hasFunnel:f,hasRadar:g,hasTreemap:p,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,v=r.axis_rotated,b=o.hasArcType(),y=c.isCanvasMode?0:o.getSvgLeft(!0);let T=y+h.width-o.getCurrentPaddingByDirection("right");const w=20;let{x:C,y:k}=n;if(g)C+=C>=u/2?15:-(e+15),k+=15;else if(b){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+=(u-(_?o.getLegendWidth():0))/2,k+=(m?d:d/2+t)+L}}else if(f||p)k+=t;else{const A={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};v?(C+=y+A.left+w,k=A.top+n.xAxis+w,T-=y):(C=y+A.left+w+(l.zoom?C:n.xAxis),k+=A.top-5)}if(C+e+15>T&&(C-=e+(f||p||b?0:v?w*2:38)),k+t>h.height){const A=p?t+10:30;k-=m?t*1.5:t+A}const S={top:k,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 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&&q(n.getBaseValue(h))?(o++,s==null||s.push(h)):s||(s=e.slice(0,d))}if(o===0||!l)return;const c=a.datum();let u=s;if(!c||c.current!==r){const{index:d,x:h}=l;u||(u=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:d,x:h,current:r,data:e,width:a.property("offsetWidth"),height:a.property("offsetHeight")}),H(i.tooltip_onshown,n.api,e),n._handleLinkedCharts(!0,d)}n.setTooltipPosition(u||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:u,$el:d,state:h}=r.internal,f=u.tooltip_linked,g=u.tooltip_linked_name,p=nt.body.contains(d.chart.node());if(f&&o===g&&p){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 i=this,{config:a,$el:{eventRect:s,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:u,hasTreemap:d}}=i;if(!i.state.isCanvasMode&&(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(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;d&&(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[u,d]=i.getRadarSize();l=s.width/2-u,c=s.height/2-d}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={},u={},d=n.subchart_type;t.mapToIds(i.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,a.current.types=[],a.subchartSourceTypes=u;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 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 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:u=!0}=t;i[s]||l.call(n);const d=n.getChartClass(a),h=c?n.classFocus.bind(n):()=>"",g=i.main.select(`.${o}`).selectAll(`.${r}`).data(n.filterNullish(e)).attr("class",p=>d(p)+h(p)).enter().append("g").attr("class",d);return u&&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]:"",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,g;g=h[f];f++){if(g in u){u[r.id]=u[g];break}r.id!==g&&c&&(u[g]=(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 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,u)=>{l[c.id]=u,l.__max__=u}),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,u=Ut(e)&&(e._$total.length?e._$total.reduce(c)/2:0),d=[];if(u&&Ut(e)&&e._$total.length){let h=0;for(const f of e._$total)h+=f,d.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(u){const v=e[h.id]||e._$width;x=r?m-v/2:m-v+((f=d[p])!=null?f:e._$total.slice(0,p+1).reduce(c))-u}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),v=Wa(n,x,t);return _[m]=x,g[m]=l?n.getRatio("index",x,!0):v,_},{});return{id:h.id,rowValues:f,rowValueMapByXValue:p,values:g}}),u=i.reduce((h,{id:f},g)=>(h[f]=g,h),{}),d={generation:a,indexMapByTargetId:u,shapeOffsetTargets:c};return n.cache.add(o,d),d},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(u=>u.id!==l.id&&c[u.id]===c[l.id]))}}return(l,c)=>{var u;const{id:d,value:h,x:f}=l,g=Wa(i,l,n),p=i.getIndices(t,l),_=i.getYScaleById(d,n);if(i.isBarRangeType(l))return _(h[0]);const x=Number(f),m=_(o==="zero"?0:i.getShapeYMin(d,n));let v=m;const b=(u=r==null?void 0:r.get(d))!=null?u:a.filter(y=>y.id!==d&&p[y.id]===p[d]);for(const y of b){const{id:T,rowValueMapByXValue:w,rowValues:C,values:k}=y;if(s[T]<s[d]){const S=k[x];let A=C[c];(!A||Number(A.x)!==x)&&(A=w[x]);const L=A&&Wa(i,A,n);$(L)&&$(g)&&L*g>=0&&$(S)&&(g!==0||o==="positive"&&S>0||o==="negative"&&S<0)&&(v+=_(S)-m)}}return v}},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(u,d)=>{let h=c.get(u.id);h===void 0&&(h=l.call(i,u.id,t)(i.getShapeYMin(u.id,t)),c.set(u.id,h));const f=r(u,d)||h,g=s(u);let p=o(u);a.axis_rotated&&(u.value>0&&p<h||u.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,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=a(c),g=c.value;let p=s(c);return i.axis_rotated&&(g>0&&p<d||g<0&&d<p)&&(p=d),[[f,h],[f,p-(d-h)],[f,p-(d-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),u=n.getYScaleById.bind(n),d=new Map;return(h,f)=>{const{id:g}=h;let p=d.get(g);p||(p={y0:u.call(n,g,t)(n.getShapeYMin(g,t)),isInverted:i[`axis_${n.axis.getId(g)}_inverted`]},d.set(g,p));const{y0:_,isInverted:x}=p,m=c(h,f)||_,v=$(o)?o:o[h.id]||o._$width,b=h.value,y=r(h);let T=l(h);i.axis_rotated&&!x&&(b>0&&T<_||b<0&&_<T)&&(T=_),n.isBarRangeType(h)||(T-=_-m);const w=y+v;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:u,scale:d,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:u.xDomain[0],(r=c.axis_x_max)!=null?r:u.xDomain[1]].map(y=>l.axis.isTimeSeries()?Vt.call(l,y):Number(y));let m=t.tickInterval(f);if(d.zoom&&!l.axis.isCategorized()&&_>1){const y=x.every((T,w)=>T===u.xDomain[w]);m=u.xDomain.map((T,w)=>{const C=y?T:T-Math.abs(x[w]);return d.zoom(C)}).reduce((T,w)=>Math.abs(T)+w)/f}const v=y=>{const T=y?c[p][y]:c[p],w=y?T.ratio:c[`${p}_ratio`],C=y?T.max:c[`${p}_max`],k=$(T)?T:z(T)?T.call(l,h.width,n,f):n?m*w/n:0;return C&&k>C?C:k};let b=v();return!g&&Ut(c[p])&&(b={_$width:b,_$total:[]},l.getTargetsToShow().forEach(y=>{c[p][y.id]&&(b[y.id]=v(y.id),b._$total.push(b[y.id]||b._$width))})),b},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),u=Math.abs(i.y-a.y),d=o-l,h=o+c+l,f=r+u+l,g=r-l;return d<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 ge{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*xe()}`,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,u)=>{o()||(u.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 u=a.zoom_enabled&&a.zoom_type==="drag";s.defaultAxisTime=d=>{const{x:h,zoom:f}=i.scale,g=u?f:f&&h.orgDomain().toString()!==f.domain().toString(),p=d.getMilliseconds()&&".%L"||d.getSeconds()&&".:%S"||d.getMinutes()&&"%I:%M"||d.getHours()&&"%I %p"||d.getDate()!==1&&"%b %d"||g&&d.getDate()===1&&"%b'%y"||d.getMonth()&&"%-m/%-d"||"%Y";return s.axisTime(p)(d)}}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=kf(a.interaction_inputType_mouse,a.interaction_inputType_touch)}initWithData(t){var n,i,a,s,o,r;const l=this,{config:c,scale:u,state:d,$el:h,org:f}=l,{hasAxis:g,hasFunnel:p,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:T,y:w,y2:C,subX:k,subY:S,subY2:A}=u;T&&(T.domain(pn(l.getXDomain(l.data.targets),!c.axis_x_inverted)),k.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")),A&&A.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)}d.rendered=!0;return}if(h.svg=h.chart.append("svg").style("overflow","hidden").style("display","block"),x&&d.inputType){const T=d.inputType==="touch",{onclick:w,onover:C,onout:k}=c,S=(n=c.interaction_inputType_touch)==null?void 0:n.preventDefault,A=tn(S)&&S||!1,L=!isNaN(S)&&S||null,E=T?{passive:!A&&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",(k==null?void 0:k.bind(l.api))||null)}c.svg_classname&&h.svg.attr("class",c.svg_classname);const b=z(c.color_tiles)&&l.patterns;(g||b||m||_||v||(i=l.hasLegendDefsPoint)!=null&&i.call(l))&&(h.defs=h.svg.append("defs"),g&&["id","idXAxis","idYAxis","idY2Axis","idGrid"].forEach(T=>{l.appendClip(h.defs,d.clip[T])}),l.generateTextBGColorFilter(v),b&&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?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(),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(),d.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:u,grid:d,needle:h,arcs:f,circle:g,bar:p,candlestick:_,line:x,area:m,text:v}}=t;t.api.$={chart:n,svg:i,canvas:c,eventOverlay:u,defs:a,main:s,tooltip:o,legend:r,title:l,grid:d,arc:f,circles:g,bar:{bars:p},candlestick:_,line:{lines:x,areas:m},needle:h,text:{texts:v}}}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=d=>a[`updateTargetsFor${d}`](t.filter(a[`is${d}Type`].bind(a)));if(a.updateTargetsForText(t),s){const d=["bar","candlestick","line"];for(const h of d){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 d="Arc";r?d="Radar":a.hasType("polar")&&(d="Polar"),c(d)}else o?c("Funnel"):l&&c("Treemap");const u=a.hasType("bubble")||a.hasType("scatter");u&&((i=a.updateTargetForCircle)==null||i.call(a)),a.filterTargetsToShowAtInit(u)}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),u=[],d=()=>{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();d()&&(o.resizeRedrawTime=Yr()-g,o.resizeLiveScale=o.resizeRedrawTime>ms)},f=Rf(s.resize_timer,c&&l?h:void 0);u.push(()=>H(s.onresize,i.api)),c&&u.push(d),u.push(()=>{H(s.onresized,i.api),o.resizing=!1,o.resizeLiveScale=null}),u.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(ge.prototype,[Zf,Jf,Qf,eg,ig,rg,ug,tg,dg,bg,Tg,Eu,Gg,wg,Cg,Eg,Dg,Fg,Og,Bg]);const Ha=[he,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}>${Se(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(u=>!l.has(u)&&e.isTargetToShow(u));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,u=function(d,h){var f;if(!H(i.legend_item_onclick,n,h,!a.hiddenTargetIds.has(h))){const g=(0,F.select)(this);d.type==="dblclick"||d.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(d,h){r&&d.type==="click"&&rp(e,h)||u.call(this,d,h)}:null),r&&o==="click"&&l&&t.on("touchstart",function(d,h){ap(e,h,d)},c).on("touchmove",d=>{Jr(e,d)},c).on("touchend",function(d,h){sp(e,h,d)&&(op(e,h),u.call(this,d,h))},c),!r&&t.on("mouseover",s||z(i.legend_item_onover)?function(d,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(d,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,u]=t,d=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?u>=f&&u<=g&&c>=d-p&&c<=h:c>=d&&c<=h&&u>=f&&u<=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 u=c[`client${e.axis_rotated?"Y":"X"}`];o.type==="touchstart"?i?o.preventDefault():a!==null&&(s=u):o.type==="touchmove"&&(i||s===!0||a!==null&&Math.abs(s-u)>=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 kp(e){return e.data.targets.reduce((t,n)=>t+n.values.length,0)}function Ap(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,u,d;const h=this,{axis:f,data:g,org:p,scale:_,state:x}=h,{done:m=()=>{},duration:v,length:b,orgDataCount:y}=e,T=(t=N.requestAnimationFrame)==null?void 0:t.bind(N),w=!!((n=f.isLog)!=null&&n.call(f,"x"));if(!T||!v||!b||!y||kp(h)>Kg)return!1;const C=_.x.domain().slice(0,2),k=(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 A=g.targets.map(I=>I.values.splice(0,b));h.updateXDomain(h.filterTargetsToShow(g.targets),!0,!0);const L=_.x.domain().slice(0,2),E=(u=(c=p.xDomain)==null?void 0:c.slice)==null?void 0:u.call(c);if(g.targets.forEach((I,X)=>{I.values.unshift(...A[X])}),!rl(L,w))return k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),!1;Ap(h);let D=!1;const R=Cp(),P=()=>{var I,X;D||(D=!0,g.targets.forEach(G=>{G.values.splice(0,b)}),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)/v)),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 k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),x.flowing=!0,x.cancelClick=!0,(d=h.hideTooltip)==null||d.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(d=>i.data_names[d]!==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,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(oe.legendItemTitle,!0);const u=c.merge(l).attr("class",d=>n.generateClass(j.legendItem,d).trim());Kr(n,u),u.select(`.${j.legendItemTile}`).classed(oe.legendItemTileCircle,!i.legend_usePoint&&i.legend_item_tile_type==="circle").style("background-color",d=>i.legend_usePoint?null:n.color(d)).html(d=>i.legend_usePoint?Qg(n,d):""),u.select(`.${oe.legendItemTitle}`).text(d=>Ii(n,d)),i.legend_tooltip&&u.attr("title",d=>Ii(n,d)),Qr(n,u),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(u=>{const d=z(o)?Se(o.call(n,u,t.color(u),n.data(u)[0].values)):an(o,{COLOR:t.color(u),TITLE:u});d&&(r.push(u),l+=d)});const c=s.html(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 u=n.legend_contents_bindto&&n.legend_contents_template;if(u)a.legend.selectAll(`.${j.legendItem}`).each(function(d){const h=ht(this,!0),f=`${Ii(t,d)}`,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 d=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 k=`${Ii(t,w)}`,S=lp(t,k),A=Math.max(32,k.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)||A)+g.tileWidth+(E&&!d?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=d?t.getLegendHeight():t.getLegendWidth(),m=(w,C,k=!1)=>{let S;k||(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:k,height:S})=>{const A=n.legend_equally&&!C?g.max.width:k,L=n.legend_equally&&!C?g.max.height:S,E=d?L:A;if(p.widths[w]=A,p.heights[w]=L,s.push(A),r=Math.max(r,A),l=Math.max(l,L),C){p.steps[w]=0,p.offsets[w]=0;return}m(w,E)});const v=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],b=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 k=C?0:v(w),S=C?0:b(w);o[w]={item:{x:k,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(u){const d=Math.max(1,i.current.width),h=10;let f=1,g=0;s.forEach(p=>{g&&g+h+p>d?(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),u||a.legend.selectAll(`button.${j.legendItem}`).each(function(d){const h=o[d],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 u=vp(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[g]=s.filterTargetsToShow(s.data.targets);u=g?[g.id]:[]}qa(s,g=>{const p=Ke(g),_=c||!u||u.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),d=!0}else(!h||f)&&i&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),d=!0);else _&&x&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),d=!0)}),d&&((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,u=>{const d=Ke(u);(i.data_selection_grouped?u.id===r.id:d!==l)&&s.has(d)&&(s.delete(d),H(i.data_onunselected,n.api,u,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,u]=o,d=Math.min(r,c),h=Math.max(r,c),f=i.data_selection_grouped?a.margin.top:Math.min(l,u),g=i.data_selection_grouped?a.margin.top+a.height:Math.max(l,u),p={x:d,y:f,w:h-d,h:g-f},_=Math.abs(c-r)>4||Math.abs(u-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 u=c-o;if(Math.abs(u)>Ug&&(s.canvasSubchartBrushMoved=!0),!s.canvasSubchartBrushMoved)return(t=e.preventDefault)==null||t.call(e),!0;let d;if(l==="move"&&r){const[f,g]=Fi(i),p=r[1]-r[0];let _=r[0]+u,x=r[1]+u;_<f&&(x+=f-_,_=f),x>g&&(_-=x-g,x=g),d=[Math.max(f,Math.min(g-p,_)),Math.min(g,Math.max(f+p,x))]}else l==="resize-start"&&r?d=Ka(i,c,r[1]):l==="resize-end"&&r?d=Ka(i,r[0],c):d=Ka(i,o,c);const h=_p(i,d[0],d[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=u=>u.pointerId===a,o=u=>{s(u)&&n.updateCanvasSubchartBrush(u)},r=u=>{s(u)&&(n.endCanvasSubchartBrush(u),c())},l=u=>{s(u)&&(n.cancelCanvasSubchartBrush(u),c())};function c(){var u;N.removeEventListener("pointermove",o),N.removeEventListener("pointerup",r),N.removeEventListener("pointercancel",l);try{(u=i.releasePointerCapture)==null||u.call(i,a)}catch(d){}}try{(t=i.setPointerCapture)==null||t.call(i,a)}catch(u){}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,u=c.canvas.node();if(l.event=e,l.flowing||l.canvasSelectionDragging)return;if((t=o.updateCanvasSubchartCursor)!=null&&t.call(o,e)){o.dispatchCanvasDataOut(u),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),(n=o.hideTooltip)==null||n.call(o);return}const d=Jn(o,e),h=d&&(pp(o,d)||d),f=h?fp(o,h):null;if(!f){if(o.dispatchCanvasDataOut(u),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),d&&r.axis_tooltip&&hp(o,d)){o.renderCanvasAxisTooltip(d),(i=o.hideTooltip)==null||i.call(o);return}(a=o.hideTooltip)==null||a.call(o);return}o.dispatchCanvasDataOver(f,u);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,u)},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(),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=el(s,u),h=d.find(x=>x&&Rt(s,x))||d[0];if(!d.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=d.map(x=>`${x.id}:${x.index}`).join("|"),s.renderCanvasFocus(d,_),(a=s.showTooltip)==null||a.call(s,d,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(ge.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,u,d;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),(d=(u=h.resizeFunction)==null?void 0:u.resizeObserver)==null||d.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 d=!!((t=o.focusedTargetIds)!=null&&t.size)||!!((n=o.defocusedTargetIds)!=null&&n.size);c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set,d&&((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(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?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)),u=e?null:"0";e&&l.length&&(c.style("display",null),H(s.config.data_onshown,this,l)),s.$T(c).style("opacity",u,"important").call(ri,()=>{var d;!e&&l.length===0&&(c.style("display","none"),H((d=s.config)==null?void 0:d.data_onhidden,this,o)),c.style("opacity",u)}),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,u,d,h;const f=this.internal,{$el:g,config:p,state:{eventReceiver:_,hasFunnel:x,hasTreemap:m,inputType:v}}=f;let b,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,`.${At.shape}`);_.rect=g.main.select(C)}else f.isMultipleX()?y=[f.xx(T),w]:(p.tooltip_grouped||(y=[0,w]),b=(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)?b=f.getIndexByX(e.x):ct(e.index)&&(b=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[b!=null?b:e.data.index]).filter(Boolean):T.map(L=>L.values[b]).filter(Boolean),C=(r=(o=g.canvas)==null?void 0:o.node)==null?void 0:r.call(o),k=f.state.canvasShape||((l=f.getDrawShape)==null?void 0:l.call(f)),S=w[0],A=y||(S&&((c=k==null?void 0:k.pos)!=null&&c.cx)&&((u=k==null?void 0:k.pos)!=null&&u.cy)?[f.state.margin.left+k.pos.cx(S),f.state.margin.top+k.pos.cy(S)]:void 0);if(!w.length||!C)return;f.state.canvasFocusKey=w.map(L=>`${L.id}:${L.index}`).join("|"),(d=f.renderCanvasFocus)==null||d.call(f,w,A),(h=f.showTooltip)==null||h.call(f,w,C);return}(v==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(T=>{f.dispatchEvent(T,b,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: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),(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 ge(this);this.internal=n,(function i(a,s,o){Object.keys(a).forEach(r=>{const l=z(a[r]),c=s!==o,u=bt(a[r]),d=u&&Object.keys(a[r]).length>0;l&&(!c&&d||c)?s[r]=a[r].bind(o):u&&!l?s[r]={}:s[r]=a[r],d&&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(`
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:u}}=a,{bindto:d}=s.tooltip_contents,h=s.axis_rotated,f=c==null?void 0:c.datum();if(!d&&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 k;const S=o[w?(k=a.axis)==null?void 0:k.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:v=0}=f,b=(i=(n=s.tooltip_position)==null?void 0:n.bind(a.api)(g,m,v,l==null?void 0:l.node(),x))!=null?i:u&&Fa(u)?a.getTooltipPositionViewBox.bind(a)(m,v,x):a.getTooltipPosition.bind(a)(m,v,x);["top","left"].forEach(y=>{const T=b[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,u=l.axis_rotated,d=s.hasArcType()||c.hasFunnel||c.hasTreemap,h=(a=(i=d?r:o)==null?void 0:i.node())!=null?a:c.event.target;let{x:f,y:g}=n;c.hasAxis&&(f=u?f:n.xAxis,g=u?n.xAxis:g);const p=ki(h,f,g,!1),_=ht(h),x=ki(h,20,0,!1).x;let m=p.y,v=p.x+e/2+x;return d&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(v-=e/2+x,m+=t):(m+=_.height/2,v+=_.width/2-(e-x))),v+e>_.width&&(v=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:v}},getTooltipPosition(e,t,n){var i,a,s;const o=this,{config:r,scale:l,state:c}=o,{width:u,height:d,current:h,hasFunnel:f,hasRadar:g,hasTreemap:p,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,v=r.axis_rotated,b=o.hasArcType(),y=c.isCanvasMode?0:o.getSvgLeft(!0);let T=y+h.width-o.getCurrentPaddingByDirection("right");const w=20;let{x:C,y:k}=n;if(g)C+=C>=u/2?15:-(e+15),k+=15;else if(b){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+=(u-(_?o.getLegendWidth():0))/2,k+=(m?d:d/2+t)+L}}else if(f||p)k+=t;else{const A={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};v?(C+=y+A.left+w,k=A.top+n.xAxis+w,T-=y):(C=y+A.left+w+(l.zoom?C:n.xAxis),k+=A.top-5)}if(C+e+15>T&&(C-=e+(f||p||b?0:v?w*2:38)),k+t>h.height){const A=p?t+10:30;k-=m?t*1.5:t+A}const S={top:k,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 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&&q(n.getBaseValue(h))?(o++,s==null||s.push(h)):s||(s=e.slice(0,d))}if(o===0||!l)return;const c=a.datum();let u=s;if(!c||c.current!==r){const{index:d,x:h}=l;u||(u=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:d,x:h,current:r,data:e,width:a.property("offsetWidth"),height:a.property("offsetHeight")}),H(i.tooltip_onshown,n.api,e),n._handleLinkedCharts(!0,d)}n.setTooltipPosition(u||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:u,$el:d,state:h}=r.internal,f=u.tooltip_linked,g=u.tooltip_linked_name,p=nt.body.contains(d.chart.node());if(f&&o===g&&p){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 i=this,{config:a,$el:{eventRect:s,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:u,hasTreemap:d}}=i;if(!i.state.isCanvasMode&&(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(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;d&&(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[u,d]=i.getRadarSize();l=s.width/2-u,c=s.height/2-d}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={},u={},d=n.subchart_type;t.mapToIds(i.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,a.current.types=[],a.subchartSourceTypes=u;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 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 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:u=!0}=t;i[s]||l.call(n);const d=n.getChartClass(a),h=c?n.classFocus.bind(n):()=>"",g=i.main.select(`.${o}`).selectAll(`.${r}`).data(n.filterNullish(e)).attr("class",p=>d(p)+h(p)).enter().append("g").attr("class",d);return u&&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]:"",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,g;g=h[f];f++){if(g in u){u[r.id]=u[g];break}r.id!==g&&c&&(u[g]=(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 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,u)=>{l[c.id]=u,l.__max__=u}),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,u=Ut(e)&&(e._$total.length?e._$total.reduce(c)/2:0),d=[];if(u&&Ut(e)&&e._$total.length){let h=0;for(const f of e._$total)h+=f,d.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(u){const v=e[h.id]||e._$width;x=r?m-v/2:m-v+((f=d[p])!=null?f:e._$total.slice(0,p+1).reduce(c))-u}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),v=Wa(n,x,t);return _[m]=x,g[m]=l?n.getRatio("index",x,!0):v,_},{});return{id:h.id,rowValues:f,rowValueMapByXValue:p,values:g}}),u=i.reduce((h,{id:f},g)=>(h[f]=g,h),{}),d={generation:a,indexMapByTargetId:u,shapeOffsetTargets:c};return n.cache.add(o,d),d},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(u=>u.id!==l.id&&c[u.id]===c[l.id]))}}return(l,c)=>{var u;const{id:d,value:h,x:f}=l,g=Wa(i,l,n),p=i.getIndices(t,l),_=i.getYScaleById(d,n);if(i.isBarRangeType(l))return _(h[0]);const x=Number(f),m=_(o==="zero"?0:i.getShapeYMin(d,n));let v=m;const b=(u=r==null?void 0:r.get(d))!=null?u:a.filter(y=>y.id!==d&&p[y.id]===p[d]);for(const y of b){const{id:T,rowValueMapByXValue:w,rowValues:C,values:k}=y;if(s[T]<s[d]){const S=k[x];let A=C[c];(!A||Number(A.x)!==x)&&(A=w[x]);const L=A&&Wa(i,A,n);$(L)&&$(g)&&L*g>=0&&$(S)&&(g!==0||o==="positive"&&S>0||o==="negative"&&S<0)&&(v+=_(S)-m)}}return v}},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(u,d)=>{let h=c.get(u.id);h===void 0&&(h=l.call(i,u.id,t)(i.getShapeYMin(u.id,t)),c.set(u.id,h));const f=r(u,d)||h,g=s(u);let p=o(u);a.axis_rotated&&(u.value>0&&p<h||u.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,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=a(c),g=c.value;let p=s(c);return i.axis_rotated&&(g>0&&p<d||g<0&&d<p)&&(p=d),[[f,h],[f,p-(d-h)],[f,p-(d-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),u=n.getYScaleById.bind(n),d=new Map;return(h,f)=>{const{id:g}=h;let p=d.get(g);p||(p={y0:u.call(n,g,t)(n.getShapeYMin(g,t)),isInverted:i[`axis_${n.axis.getId(g)}_inverted`]},d.set(g,p));const{y0:_,isInverted:x}=p,m=c(h,f)||_,v=$(o)?o:o[h.id]||o._$width,b=h.value,y=r(h);let T=l(h);i.axis_rotated&&!x&&(b>0&&T<_||b<0&&_<T)&&(T=_),n.isBarRangeType(h)||(T-=_-m);const w=y+v;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:u,scale:d,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:u.xDomain[0],(r=c.axis_x_max)!=null?r:u.xDomain[1]].map(y=>l.axis.isTimeSeries()?Vt.call(l,y):Number(y));let m=t.tickInterval(f);if(d.zoom&&!l.axis.isCategorized()&&_>1){const y=x.every((T,w)=>T===u.xDomain[w]);m=u.xDomain.map((T,w)=>{const C=y?T:T-Math.abs(x[w]);return d.zoom(C)}).reduce((T,w)=>Math.abs(T)+w)/f}const v=y=>{const T=y?c[p][y]:c[p],w=y?T.ratio:c[`${p}_ratio`],C=y?T.max:c[`${p}_max`],k=$(T)?T:z(T)?T.call(l,h.width,n,f):n?m*w/n:0;return C&&k>C?C:k};let b=v();return!g&&Ut(c[p])&&(b={_$width:b,_$total:[]},l.getTargetsToShow().forEach(y=>{c[p][y.id]&&(b[y.id]=v(y.id),b._$total.push(b[y.id]||b._$width))})),b},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),u=Math.abs(i.y-a.y),d=o-l,h=o+c+l,f=r+u+l,g=r-l;return d<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 ge{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*xe()}`,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,u)=>{o()||(u.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 u=a.zoom_enabled&&a.zoom_type==="drag";s.defaultAxisTime=d=>{const{x:h,zoom:f}=i.scale,g=u?f:f&&h.orgDomain().toString()!==f.domain().toString(),p=d.getMilliseconds()&&".%L"||d.getSeconds()&&".:%S"||d.getMinutes()&&"%I:%M"||d.getHours()&&"%I %p"||d.getDate()!==1&&"%b %d"||g&&d.getDate()===1&&"%b'%y"||d.getMonth()&&"%-m/%-d"||"%Y";return s.axisTime(p)(d)}}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=kf(a.interaction_inputType_mouse,a.interaction_inputType_touch)}initWithData(t){var n,i,a,s,o,r;const l=this,{config:c,scale:u,state:d,$el:h,org:f}=l,{hasAxis:g,hasFunnel:p,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:T,y:w,y2:C,subX:k,subY:S,subY2:A}=u;T&&(T.domain(pn(l.getXDomain(l.data.targets),!c.axis_x_inverted)),k.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")),A&&A.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)}d.rendered=!0;return}if(h.svg=h.chart.append("svg").style("overflow","hidden").style("display","block"),x&&d.inputType){const T=d.inputType==="touch",{onclick:w,onover:C,onout:k}=c,S=(n=c.interaction_inputType_touch)==null?void 0:n.preventDefault,A=tn(S)&&S||!1,L=!isNaN(S)&&S||null,E=T?{passive:!A&&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",(k==null?void 0:k.bind(l.api))||null)}c.svg_classname&&h.svg.attr("class",c.svg_classname);const b=z(c.color_tiles)&&l.patterns;(g||b||m||_||v||(i=l.hasLegendDefsPoint)!=null&&i.call(l))&&(h.defs=h.svg.append("defs"),g&&["id","idXAxis","idYAxis","idGrid"].forEach(T=>{l.appendClip(h.defs,d.clip[T])}),l.generateTextBGColorFilter(v),b&&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?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(),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(),d.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:u,grid:d,needle:h,arcs:f,circle:g,bar:p,candlestick:_,line:x,area:m,text:v}}=t;t.api.$={chart:n,svg:i,canvas:c,eventOverlay:u,defs:a,main:s,tooltip:o,legend:r,title:l,grid:d,arc:f,circles:g,bar:{bars:p},candlestick:_,line:{lines:x,areas:m},needle:h,text:{texts:v}}}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=d=>a[`updateTargetsFor${d}`](t.filter(a[`is${d}Type`].bind(a)));if(a.updateTargetsForText(t),s){const d=["bar","candlestick","line"];for(const h of d){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 d="Arc";r?d="Radar":a.hasType("polar")&&(d="Polar"),c(d)}else o?c("Funnel"):l&&c("Treemap");const u=a.hasType("bubble")||a.hasType("scatter");u&&((i=a.updateTargetForCircle)==null||i.call(a)),a.filterTargetsToShowAtInit(u)}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),u=[],d=()=>{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();d()&&(o.resizeRedrawTime=Yr()-g,o.resizeLiveScale=o.resizeRedrawTime>ms)},f=Rf(s.resize_timer,c&&l?h:void 0);u.push(()=>H(s.onresize,i.api)),c&&u.push(d),u.push(()=>{H(s.onresized,i.api),o.resizing=!1,o.resizeLiveScale=null}),u.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(ge.prototype,[Zf,Jf,Qf,eg,ig,rg,ug,tg,dg,bg,Tg,Eu,Gg,wg,Cg,Eg,Dg,Fg,Og,Bg]);const Ha=[he,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}>${Se(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(u=>!l.has(u)&&e.isTargetToShow(u));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,u=function(d,h){var f;if(!H(i.legend_item_onclick,n,h,!a.hiddenTargetIds.has(h))){const g=(0,F.select)(this);d.type==="dblclick"||d.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(d,h){r&&d.type==="click"&&rp(e,h)||u.call(this,d,h)}:null),r&&o==="click"&&l&&t.on("touchstart",function(d,h){ap(e,h,d)},c).on("touchmove",d=>{Jr(e,d)},c).on("touchend",function(d,h){sp(e,h,d)&&(op(e,h),u.call(this,d,h))},c),!r&&t.on("mouseover",s||z(i.legend_item_onover)?function(d,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(d,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,u]=t,d=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?u>=f&&u<=g&&c>=d-p&&c<=h:c>=d&&c<=h&&u>=f&&u<=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 u=c[`client${e.axis_rotated?"Y":"X"}`];o.type==="touchstart"?i?o.preventDefault():a!==null&&(s=u):o.type==="touchmove"&&(i||s===!0||a!==null&&Math.abs(s-u)>=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 kp(e){return e.data.targets.reduce((t,n)=>t+n.values.length,0)}function Ap(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,u,d;const h=this,{axis:f,data:g,org:p,scale:_,state:x}=h,{done:m=()=>{},duration:v,length:b,orgDataCount:y}=e,T=(t=N.requestAnimationFrame)==null?void 0:t.bind(N),w=!!((n=f.isLog)!=null&&n.call(f,"x"));if(!T||!v||!b||!y||kp(h)>Kg)return!1;const C=_.x.domain().slice(0,2),k=(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 A=g.targets.map(I=>I.values.splice(0,b));h.updateXDomain(h.filterTargetsToShow(g.targets),!0,!0);const L=_.x.domain().slice(0,2),E=(u=(c=p.xDomain)==null?void 0:c.slice)==null?void 0:u.call(c);if(g.targets.forEach((I,X)=>{I.values.unshift(...A[X])}),!rl(L,w))return k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),!1;Ap(h);let D=!1;const R=Cp(),P=()=>{var I,X;D||(D=!0,g.targets.forEach(G=>{G.values.splice(0,b)}),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)/v)),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 k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),x.flowing=!0,x.cancelClick=!0,(d=h.hideTooltip)==null||d.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(d=>i.data_names[d]!==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,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(oe.legendItemTitle,!0);const u=c.merge(l).attr("class",d=>n.generateClass(j.legendItem,d).trim());Kr(n,u),u.select(`.${j.legendItemTile}`).classed(oe.legendItemTileCircle,!i.legend_usePoint&&i.legend_item_tile_type==="circle").style("background-color",d=>i.legend_usePoint?null:n.color(d)).html(d=>i.legend_usePoint?Qg(n,d):""),u.select(`.${oe.legendItemTitle}`).text(d=>Ii(n,d)),i.legend_tooltip&&u.attr("title",d=>Ii(n,d)),Qr(n,u),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(u=>{const d=z(o)?Se(o.call(n,u,t.color(u),n.data(u)[0].values)):an(o,{COLOR:t.color(u),TITLE:u});d&&(r.push(u),l+=d)});const c=s.html(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 u=n.legend_contents_bindto&&n.legend_contents_template;if(u)a.legend.selectAll(`.${j.legendItem}`).each(function(d){const h=ht(this,!0),f=`${Ii(t,d)}`,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 d=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 k=`${Ii(t,w)}`,S=lp(t,k),A=Math.max(32,k.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)||A)+g.tileWidth+(E&&!d?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=d?t.getLegendHeight():t.getLegendWidth(),m=(w,C,k=!1)=>{let S;k||(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:k,height:S})=>{const A=n.legend_equally&&!C?g.max.width:k,L=n.legend_equally&&!C?g.max.height:S,E=d?L:A;if(p.widths[w]=A,p.heights[w]=L,s.push(A),r=Math.max(r,A),l=Math.max(l,L),C){p.steps[w]=0,p.offsets[w]=0;return}m(w,E)});const v=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],b=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 k=C?0:v(w),S=C?0:b(w);o[w]={item:{x:k,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(u){const d=Math.max(1,i.current.width),h=10;let f=1,g=0;s.forEach(p=>{g&&g+h+p>d?(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),u||a.legend.selectAll(`button.${j.legendItem}`).each(function(d){const h=o[d],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 u=vp(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[g]=s.filterTargetsToShow(s.data.targets);u=g?[g.id]:[]}qa(s,g=>{const p=Ke(g),_=c||!u||u.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),d=!0}else(!h||f)&&i&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),d=!0);else _&&x&&m&&(l.delete(p),H(o.data_onunselected,s.api,g,s.canvasEngine.canvas),d=!0)}),d&&((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,u=>{const d=Ke(u);(i.data_selection_grouped?u.id===r.id:d!==l)&&s.has(d)&&(s.delete(d),H(i.data_onunselected,n.api,u,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,u]=o,d=Math.min(r,c),h=Math.max(r,c),f=i.data_selection_grouped?a.margin.top:Math.min(l,u),g=i.data_selection_grouped?a.margin.top+a.height:Math.max(l,u),p={x:d,y:f,w:h-d,h:g-f},_=Math.abs(c-r)>4||Math.abs(u-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 u=c-o;if(Math.abs(u)>Ug&&(s.canvasSubchartBrushMoved=!0),!s.canvasSubchartBrushMoved)return(t=e.preventDefault)==null||t.call(e),!0;let d;if(l==="move"&&r){const[f,g]=Fi(i),p=r[1]-r[0];let _=r[0]+u,x=r[1]+u;_<f&&(x+=f-_,_=f),x>g&&(_-=x-g,x=g),d=[Math.max(f,Math.min(g-p,_)),Math.min(g,Math.max(f+p,x))]}else l==="resize-start"&&r?d=Ka(i,c,r[1]):l==="resize-end"&&r?d=Ka(i,r[0],c):d=Ka(i,o,c);const h=_p(i,d[0],d[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=u=>u.pointerId===a,o=u=>{s(u)&&n.updateCanvasSubchartBrush(u)},r=u=>{s(u)&&(n.endCanvasSubchartBrush(u),c())},l=u=>{s(u)&&(n.cancelCanvasSubchartBrush(u),c())};function c(){var u;N.removeEventListener("pointermove",o),N.removeEventListener("pointerup",r),N.removeEventListener("pointercancel",l);try{(u=i.releasePointerCapture)==null||u.call(i,a)}catch(d){}}try{(t=i.setPointerCapture)==null||t.call(i,a)}catch(u){}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,u=c.canvas.node();if(l.event=e,l.flowing||l.canvasSelectionDragging)return;if((t=o.updateCanvasSubchartCursor)!=null&&t.call(o,e)){o.dispatchCanvasDataOut(u),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),(n=o.hideTooltip)==null||n.call(o);return}const d=Jn(o,e),h=d&&(pp(o,d)||d),f=h?fp(o,h):null;if(!f){if(o.dispatchCanvasDataOut(u),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),d&&r.axis_tooltip&&hp(o,d)){o.renderCanvasAxisTooltip(d),(i=o.hideTooltip)==null||i.call(o);return}(a=o.hideTooltip)==null||a.call(o);return}o.dispatchCanvasDataOver(f,u);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,u)},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(),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=el(s,u),h=d.find(x=>x&&Rt(s,x))||d[0];if(!d.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=d.map(x=>`${x.id}:${x.index}`).join("|"),s.renderCanvasFocus(d,_),(a=s.showTooltip)==null||a.call(s,d,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(ge.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,u,d;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),(d=(u=h.resizeFunction)==null?void 0:u.resizeObserver)==null||d.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 d=!!((t=o.focusedTargetIds)!=null&&t.size)||!!((n=o.defocusedTargetIds)!=null&&n.size);c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set,d&&((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(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?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)),u=e?null:"0";e&&l.length&&(c.style("display",null),H(s.config.data_onshown,this,l)),s.$T(c).style("opacity",u,"important").call(ri,()=>{var d;!e&&l.length===0&&(c.style("display","none"),H((d=s.config)==null?void 0:d.data_onhidden,this,o)),c.style("opacity",u)}),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,u,d,h;const f=this.internal,{$el:g,config:p,state:{eventReceiver:_,hasFunnel:x,hasTreemap:m,inputType:v}}=f;let b,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,`.${At.shape}`);_.rect=g.main.select(C)}else f.isMultipleX()?y=[f.xx(T),w]:(p.tooltip_grouped||(y=[0,w]),b=(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)?b=f.getIndexByX(e.x):ct(e.index)&&(b=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[b!=null?b:e.data.index]).filter(Boolean):T.map(L=>L.values[b]).filter(Boolean),C=(r=(o=g.canvas)==null?void 0:o.node)==null?void 0:r.call(o),k=f.state.canvasShape||((l=f.getDrawShape)==null?void 0:l.call(f)),S=w[0],A=y||(S&&((c=k==null?void 0:k.pos)!=null&&c.cx)&&((u=k==null?void 0:k.pos)!=null&&u.cy)?[f.state.margin.left+k.pos.cx(S),f.state.margin.top+k.pos.cy(S)]:void 0);if(!w.length||!C)return;f.state.canvasFocusKey=w.map(L=>`${L.id}:${L.index}`).join("|"),(d=f.renderCanvasFocus)==null||d.call(f,w,A),(h=f.showTooltip)==null||h.call(f,w,C);return}(v==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(T=>{f.dispatchEvent(T,b,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: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),(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 ge(this);this.internal=n,(function i(a,s,o){Object.keys(a).forEach(r=>{const l=z(a[r]),c=s!==o,u=bt(a[r]),d=u&&Object.keys(a[r]).length>0;l&&(!c&&d||c)?s[r]=a[r].bind(o):u&&!l?s[r]={}:s[r]=a[r],d&&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
31
  `)));const u=s.serializeToString(c),d=`<svg xmlns="${F.namespaces.svg}" width="${i}" height="${a}"
32
32
  viewBox="0 0 ${n.width} ${n.height}"
33
33
  preserveAspectRatio="${(t==null?void 0:t.preserveAspectRatio)===!1?"none":"xMinYMid meet"}">
@@ -36,5 +36,5 @@ ${(r*100).toFixed(2)}%`;return c==null?null:String(c)}var pt=wt(4),Id=Object.def
36
36
  ${l.replace(/(url\()[^#]+/g,"$1")}
37
37
  </foreignObject></svg>`;return`data:image/svg+xml;base64,${Np(d)}`}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:u,f:d}=e.getScreenCTM(),{width:h,height:f}=ht(e,!0);return{x:o*a+l*s+u-i,y:r*a+c*s+d-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:u,textAnchor:d,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:u,textAnchor:d,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:u,transform:d}=n[i];if(e.save(),e.font=`${u} ${c}`,e.fillStyle=l,d==="none")e.fillText(i,a,s);else{const h=d.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,u=a;if((t==null?void 0:t.preserveAspectRatio)!==!1){const d=Math.min(i/n.width,a/n.height);c=n.width*d,u=n.height*d,l=(a-u)/2}o.drawImage(e,0,0,e.width,e.height,0,l,c,u)}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:u}=l&&l.width&&l.height?{width:l.width,height:l.height}:a.current,d=ke(Object.create(null),{width:c,height:u,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e);if(a.isCanvasMode&&r){const g=Yp(r,d,{width:c,height:u});return t==null||t.bind(this)(g),g}const h=Xp(s.node(),d,{width:c,height:u}),f=d.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=d.width||c,p.height=d.height||u,_.drawImage(g,0,0),f.length&&(Wp(_,f),f.length=0),t.bind(this)(p.toDataURL(d.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,u,d;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 v=!1;for(let b=0;b<g.length;b++)if(m.id===g[b].id){v=!0,m.values[m.values.length-1]&&(c=m.values[m.values.length-1].index+1);const y=g[b].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(b,1);break}!v&&h.push(m.id)}),t.data.targets.forEach(m=>{for(let v=0;v<h.length;v++)if(m.id===h[v]){if(!m.values[m.values.length-1])continue;c=m.values[m.values.length-1].index+1;for(let b=0;b<l;b++)m.values.push({id:m.id,index:c+b,x:p?t.getOtherTargetX(c+b):c+b,value:null})}}),t.data.targets.length&&g.forEach(m=>{const v=t.data.targets[0].values[0].index,b=m.values,y=b.length,T=Math.max(c-v,0);if(T){b.length=y+T;for(let w=y-1;w>=0;w--)b[w+T]=b[w];for(let w=0;w<T;w++){const C=v+w;b[w]={id:m.id,index:C,x:p?t.getOtherTargetX(C):C,value:null}}}for(let w=T;w<b.length;w++){const C=b[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,d=p?Vt.call(t,e.to):e.to,_.values.forEach(m=>{m.x<d&&l++})):ct(e.length)&&(l=e.length),f?f===1&&p&&(u=(_.values[_.values.length-1].x-x.x)/2,r=[new Date(+x.x-u),new Date(+x.x+u)]):(p?u=_.values.length>1?_.values[_.values.length-1].x-x.x:x.x-t.getXDomain(t.data.targets)[0]:u=1,r=[x.x-u,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(b=>{b.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 u=a[c[0]];u&&c.length>1&&(u=u[c[1]]),u!=null&&u.size()&&(r[l]=u)}),(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),u=fr();let d;u.add(Object.keys(e).map(h=>(d=e[h].transition().ease(f=>+f).duration(s),h==="axis.x"?d=d.call(f=>{n.axis.x.setTransition(f).create(f)}):h==="region.list"?d=d.filter(n.isRegionOnX).attr("transform",c):d=d.attr("transform",c),d))),d.call(u,()=>{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:u,cy:d,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",u).attr("cy",d);else{const m=b=>u(b)-i.point_r,v=b=>d(b)-i.point_r;x.attr("x",m).attr("y",v)}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),u;const d=o.domain(),h=a.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?u=o(d[0])-o(h[0]):u=a.axis.isTimeSeries()?o(d[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?u=o(d[0])-o(h[0]):a.axis.isTimeSeries()?(l=a.getValueOnIndex(r,0),c=a.getValueOnIndex(r,r.length-1),u=o(l.x)-o(c.x)):u=en(h)/2;const f=en(d)/en(h);return`translate(${u},0) scale(${f},1)`}};let gl=()=>(St(ge.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",`${kt.grid} ${kt.gridLines}`),i.gridLines.main.append("g").attr("class",kt.xgridLines),i.gridLines.main.append("g").attr("class",kt.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,u=d=>(i.zoom||i.x)(d)+c*(r?-1:1);a.xgridAttr=r?{x1:0,x2:a.width,y1:u,y2:u}:{x1:u,x2:u,y1:0,y2:a.height},o.x=s.select(`.${kt.xgrids}`).selectAll(`.${kt.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",kt.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,F.select)(this);Object.keys(a.xgridAttr).forEach(h=>{d.attr(h,a.xgridAttr[h])}),d.style("opacity",()=>+d.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)||e.scale.y.ticks(n.grid_y_ticks);s.y=o.select(`.${kt.ygrids}`).selectAll(`.${kt.ygrid}`).data(c),s.y.exit().remove(),s.y=s.y.enter().append("line").attr("class",kt.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(`.${kt[`${e}gridLines`]}`).selectAll(`.${kt[`${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,F.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),s(l.attr("class",u=>`${kt[`${e}gridLine`]} ${u.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(u){var d;return(d=u.text)!=null?d: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"),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?i:r).attr("y1",n?r:0).attr("y2",n?r:a),u=o(u,e).attr("x",Cl(!n,i,a)).attr("y",r),d=o(d,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),u.style("opacity",null),d.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?kt.gridLines:U.chart}${s?" + *":""}`,r=a.main.insert("g",o).attr("clip-path",i.pathGrid).attr("class",kt.grid);if(a.grid.main=r,t.grid_x_show&&r.append("g").attr("class",kt.xgrids),t.grid_y_show&&r.append("g").attr("class",kt.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,u]=Zt(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 g=h==="x"&&!l||h!=="x"&&l?"x":"y",p=d[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",u).attr("y2",u)})},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(d=>d&&q(n.getBaseValue(d)));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,u=n.xx.bind(n);r.style("visibility",null).data(l.concat(l)).each(function(d){const h=(0,F.select)(this),f={x:u(d),y:n.getYScaleById(d.id)(d.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(d.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(_e),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=u=>!s(u),r=t?kt.xgridLines:kt.ygridLines,l=t?kt.xgridLine:kt.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 kl=()=>(St(ge.prototype,Jp),Yt.prototype.xgrids=yl.xgrids,Yt.prototype.ygrids=yl.ygrids,cn.setOptions([Qp]),(kl=()=>({}))());function Al(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,u=e&&!s.data_selection_multiple;let d=!u;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,v=!n||n.indexOf(m)>=0,b=_.selectAll(`.${ut.selectedCircle}-${m}`),y=!b.empty();e?p&&v&&l(x)&&(!y||u)?(d||(Al.call(a,!1),d=!0),a.selectPoint(null,x,m)):(!u||d)&&ct(i)&&i&&y&&h(b,x,m):p&&v&&y&&h(b,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),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=(ct(t)?[].concat(t):s.getTargetsToShow().map(f=>f.id)).slice(0,1))),(a=s.isPointFocusOnly)!=null&&a.call(s)){Al.call(s,e,t,n,i);return}r.selectAll(`.${At.shapes}`).selectAll(`.${At.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(we.line)||f.classed(Ci.area))return;const m=s.getToggle(this,h).bind(s),v=f.classed(ut.SELECTED);e?_&&x&&c(h)&&(!v||u)?(d||(Qa.call(s,!1),d=!0),!f.classed(ut.SELECTED)&&m(!0,f.classed(ut.SELECTED,!0),h,p)):(!u||d)&&ct(i)&&i&&v&&m(!1,f.classed(ut.SELECTED,!1),h,p):_&&x&&c(h)&&v&&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(`.${At.shapes+i.getTargetSelectorSuffix(e)}`).selectAll(`.${At.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,u]=e,d=Math.min(r,c),h=Math.max(r,c),f=s?i.margin.top:Math.min(l,u),g=s?i.height:Math.max(l,u),p=()=>{!t||!t.$el||!t.$el.main||(a.select(`.${ln.dragarea}`).attr("x",d).attr("y",f).attr("width",h-d).attr("height",g-f),a.selectAll(`.${At.shapes}`).selectAll(`.${At.shape}`).filter(_=>o==null?void 0:o.bind(t.api)(_)).each(function(_,x){const m=(0,F.select)(this),v=m.classed(ut.SELECTED),b=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=d<w&&w<h&&f<C&&C<g}else if(m.classed(ie.bar)){const{x:w,y:C,width:k,height:S}=ur(this);T=t.togglePath,y=!(h<w||w+k<d)&&!(g<C||C+S<f)}else return;y^b&&(m.classed(ln.INCLUDED,!b),m.classed(ut.SELECTED,!v),T.call(t,!v,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(`.${At.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),u=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",d=>i.pointSelectR(d)*1.4)).attr("r",u)},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 u;if(!s.data_selection_multiple){const d=(i=a.isPointFocusOnly)==null?void 0:i.call(a);let h=`.${d?ut.selectedCircles:At.shapes}`;s.data_selection_grouped&&(h+=a.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(d?`.${ut.selectedCircle}`:`.${At.shape}.${ut.SELECTED}`).classed(ut.SELECTED,!1).each(function(f){const g=(0,F.select)(this);u=g,c(!1,g,f,f.index)})}(!u||u.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(ge.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 u;return c.isCanvasMode?(o.subchart_show&&(u=e,Array.isArray(u)?(u=a.isTimeSeries()?u.map(d=>Vt.bind(i)(d)):u,u=i.setCanvasSubchartDomain(u)||c.domain):u=(t=c.domain)!=null?t:r.orgDomain()),u):(o.subchart_show&&(u=e,Array.isArray(u)?(a.isTimeSeries()&&(u=u.map(h=>Vt.bind(i)(h))),i.withinRange(u,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))&&(c.domain=u.slice(),s.move(s.getSelection(),u.map(l)))):u=(n=c.domain)!=null?n:r.orgDomain()),u)};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 kn(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",kn(o.attr("x1"),0)).attr("x2",l).attr("y1",kn(o.attr("y1"),-10)).attr("y2",kn(o.attr("y2"),-10)):r.attr("x1",kn(o.attr("x1"),-10)).attr("x2",kn(o.attr("x2"),-10)).attr("y1",kn(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],u=l.top+r[1],d={bubbles:!0,cancelable:!0,screenX:c,screenY:u,clientX:c,clientY:u};/^touch/.test(t)?Oa.touch(o,t,d):Oa.mouse(o,t,d)}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",u=>{const{selection:d,sourceEvent:h,target:f,type:g}=u;g==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?d:null),/(start|brush)/.test(g)&&(g==="brush"&&h&&a.domain&&(l==null||l.forEach((p,_)=>{p!==d[_]&&(a.domain[_]=n.x.orgDomain()[_])})),e.redrawForBrush(g!=="start")),g==="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",(p,_)=>{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,Ri.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=i.main)==null||u.select(`.${V.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]]:ot(h)&&(h=h.map((f,g)=>[f,g>0?d: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`,u=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:d}=o;d.style("visibility",l),d.append("g").attr("clip-path",u).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=d.select(`.${V.chart}`),_=V[`chart${g}s`];p.select(`.${_}`).empty()&&p.append("g").attr("class",_)}})});const h=d.append("g").attr("clip-path",u).attr("class",V.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",`${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),d.append("g").attr("clip-path",u).attr("class",V.xgridFocus).append("line").attr("class",V.xgridFocus).style("visibility","hidden"),r.subX=d.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=d.append("g").attr("class",V.axisY).attr("transform",e.getTranslate("subY")).style("visibility",t.subchart_axis_y_show?l:"hidden"),r.subY2=d.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),u=n.getClass(r?"circles":`${o}s`,!0),d=s.select(`.${V[`chart${`${l}s`}`]}`);if(r){const h=d.selectAll(`.${V.circles}`).data(e.filter(n[`is${Ot(o)}Type`].bind(n))).attr("class",u);h.exit().remove(),h.enter().append("g").attr("class",u)}else{const h=d.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",u);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,u=!!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 d=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}`](u,!0),o[`redraw${p}`](_,u,!0)}),o.hasType("bubble")||o.hasType("scatter")){const{cx:g}=f.pos,p=o.updateCircleY(!0);o.updateCircle(!0),o.redrawCircle(g,p,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: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(ge.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 u=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=u?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=ue("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=ue("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,u=Ol(e,s);(r=n.xScale)==null||r.range(i.x.range());const d=u[c?"rescaleY":"rescaleX"](n.xScale||i.x);if(d.domain().some(g=>/(Invalid Date|NaN)/.test(g.toString())))return;const h=e.trimXDomain(d.domain()),f=t.zoom_rescale;if(d.domain(h,n.xDomain),o){const g=d(i.x.domain()[0]),p=c?u.x:g,_=c?g:u.y,x=$l(e,re.zoomIdentity.translate(p,_).scale(s.k));(l=$i(e))==null||l.property("__zoom",x)}i.zoom=e.getCustomizedXScale(d),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:u}=e;!l&&c&&i.x.domain().every((g,p)=>g!==s.xDomain[p])&&i.x.domain(s.xDomain),t.zoom.updateTransformScale(u,n.zoom_type==="wheel"&&o);const d=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:d,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=u=>{const[d,h]=r!=null?r:[0,i?n.height:n.width];return Math.min(Math.max(u,d),h)};e.zoomBehaviour=(0,Ar.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",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,u,this)[l.index]),s=a,n.isCanvasMode?(d=e.renderCanvasZoomBrush)==null||d.call(e,a,s):o.attr(l.axis,a).attr(l.attr,0),e.onZoomStart(u)}).on("drag",function(u){var d;s=c(Bl(e,u,this)[l.index]),n.isCanvasMode?(d=e.renderCanvasZoomBrush)==null||d.call(e,a,s):o.attr(l.axis,Math.min(a,s)).attr(l.attr,Math.abs(s-a))}).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),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(ge.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(u=>{s.indexOf(u)>=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(u=>{s.indexOf(u)>=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 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:g=!1}=(u=c.label)!=null?u:{},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+d}, ${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 u;return(u=c==null?void 0:c.color)!=null?u: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 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=a[t.axis])):(l?!o:o)&&u in t&&(h=a.zoom||a.x),h){let f=0;d=t[u],n.axis.isTimeSeries(t.axis)?d=Vt.call(n,d):/(x|width)/.test(e)&&n.axis.isCategorized()&&isNaN(d)&&(d=i.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 Vl=()=>(St(ge.prototype,T_),Yt.prototype.regions=y_.regions,(Vl=()=>({}))());var An={initArea(e){const t=this,{config:n}=t;e.insert("g",`.${n.area_front?Nt.circles:we.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,xe()).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 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(Se(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(Se(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,u,d,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(u=e.custom)==null?void 0:u.create.bind(o)(g,_,...r);if(s==="update")return(d=e.custom)==null?void 0:d.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 k_={initLine(){Wr.call(this,{elKey:"line",className:we.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:we.chartLines,itemClass:we.chartLine,initFn:t.initLine});if(o.append("g").attr("class",a),t.hasTypeOf("Area")){const r=i.select(`.${we.chartLines}`).selectAll(`.${we.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(`.${we.lines}`).selectAll(`.${we.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,xe()).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),u=a.hasNullDataValue(e);let d,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,A,L,E)=>{const D=S.x.getTime(),R=A.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,A,L,E)=>{const D=t(A.x,!o),R=n(A.value,o),P=L+E,B=t(d(L),!o),I=n(h(L),o);let X=t(d(P),!o),G=n(h(P),o);X>D&&(X=D),S.value>A.value&&(o?G<R:G>R)&&(G=R);const Z=[[B,I],[X,G]];return o&&Z.forEach(et=>et.reverse()),x(Z)},v={x:a.axis.getAxisType("x"),y:a.axis.getAxisType("y")};let b="";if(!e.length)return b;const y=a.$el.line.filter(({id:S})=>S===e[0].id),T=y.clone().style("display","none"),w=(S,A)=>S.attr("d",A).node().getTotalLength(),C={dash:[],lastLength:0};let k=!1;for(let S=0,A;A=e[S];S++){const L=e[S-1],E=L&&q(L.value);let D=a.isWithinRegions(A.x,c);if(q(A.value)){if(Ct(c)||!D||!E)b+=`${S&&E?"L":"M"}${p(A)},${_(A)}`;else if(E)if(D=((D==null?void 0:D.dasharray)||l).split(" ").map(Number),d=Xe(v.x,L.x,A.x),h=Xe(v.y,L.value,A.value),u){const R=t(A.x)-t(L.x),P=n(A.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)b+=m(L,A,I,f),I+g>=1&&(b+=m(L,A,1,0))}else{let R;if(k=A.x===e[e.length-1].x,r){const X=+L.x,G=new Date(X),Z=new Date(X+(+A.x-X));R=[[t(G),n(h(0))],[t(Z),n(h(1))]]}else R=[[t(d(0)),n(h(0))],[t(d(1)),n(h(1))]];o&&R.forEach(X=>X.reverse());const P=w(T,b),B=w(T,b+=`L${R[1].join(",")}`),I=S_(P-C.lastLength,B-C.lastLength,D,k);C.lastLength+=I.length,C.dash.push(I.dash)}}}return C.dash.length&&(!k&&C.dash.push(w(T,b)),y.attr("stroke-dasharray",C.dash.join(" "))),T.remove(),b},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=()=>xe(),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,u=t;if(!c){c=n.filterNullish(a.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const d=s.main.select(`.${Nt.chartCircles}`).style("pointer-events","none").selectAll(`.${Nt.circles}`).data(c);d.exit().remove(),u=d.enter()}o&&u.append("g").attr("class",d=>n.generateClass(ut.selectedCircles,d.id)),u.append("g").attr("class",l).call(d=>{n.setCssRule(!0,`.${Nt.circles}`,["cursor:pointer"],r)(d),n.setCssRule(!0,` .${Nt.circle}`,["fill","stroke"],n.color)(d)}).style("opacity",function(){return(0,F.select)(this.parentNode).classed(Nt.chartCircles)?"0":null}),o&&c.forEach(d=>{s.main.selectAll(`.${ut.selectedCircles}${n.getTargetSelectorSuffix(d.id)}`).selectAll(`${ut.selectedCircle}`).each(h=>{h.value=d.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(d=>{const h=t.isLineType(d)&&t.shouldDrawPointsForLine(d)||t.isBubbleType(d)||t.isRadarType(d)||t.isScatterType(d)?s?[d.values[0]]:d.values:[];return t.filterNullish(h)});r.exit().remove();const l=t.pointR.bind(t),c=t.generateUpdateCircleColor(),u=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",u)}},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,u=c.main.selectAll(`.${ut.selectedCircle}`);if(!s.config.point_show)return[];const d=s.isCirclePoint()?"c":"",h=xe(),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(u,n).attr("cx",e).attr("cy",t)]}const p=s.point("update",s,e,t,g,n,i,u),_=[];return c.circle.each(function(x){let m=p.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: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),u=a||Ct(e),d=t.point("update",t,l,c,t.getStylePropValue(t.color),i?!1:u);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)&&(d.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:u}=Yl(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),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:d,y:h}=ht(e);r=d,l=h}const c=r-i[0],u=l-i[1];return Math.sqrt(c*c+u*u)<(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()),u=f=>q(f.value)?t(f)-l/2:0,d=f=>q(f.value)?n(f)-c/2:0;let h=e;return a&&(s&&h.attr("x",u),h=r.$T(h,a,En()),o&&r.$T(o,a,En())),h.attr("x",u).attr("y",d).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,u=h=>n(h)-l;let d=e;return a&&(s&&d.attr("x",c),d=r.$T(d,a,En()),o&&r.$T(o,a,En())),d.attr("x",c).attr("y",u).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"},A_={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`],u=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)&&!u&&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),u=/^(top|bottom)$/.test(r),d=a.getTickTransformSetter(u?"x":"y"),h=d===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,v=Ni(m),{isSubAxes:b}=s,y=!b&&v&&/^(x|y|y2)$/.test(v)?s.config[`axis_${v}_tick_text_position`]:{x:0,y:0},T=O_(m),w=s.config[`${T}_show`],C=b?{tick:!0,text:!0}:{tick:w?s.config[`${T}_tick_show`]:!1,text:w?s.config[`${T}_tick_text_show`]:!1},k=s.config.axis_evalTextSize;let S;t.each(function(){const A=(0,F.select)(this);let L=this.__chart__||o,E=a.copyScale();S=A,this.__chart__=E,i.tickOffset=s.isCategory?(E(1)-E(0))/2:0;const D=A.selectAll(".domain").data([0]);if(D.enter().append("path").attr("class","domain").merge(D).attr("d",()=>{const R=i.outerTickSize*f;return u?`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=A.selectAll(".tick");if(n.canReuseTickNodesOnResize(P,R,c||s.config.axis_rotated,C))d(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(k)&&(et=k.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,!!k));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",u?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:d(X,E);P=s.owner.state.flowing?a.transitionise(P):s.owner.$T(P),d(I,L),d(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,u=this.params.tickTextRotate,d=6,h=i.h/2-d,f=v=>{const b=["start","end"];return o==="top"&&b.reverse(),v?b[v>0?0:1]:"middle"},g=v=>v?`rotate(${v})`:null,p=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_${Ni(c)}_tick_inner`];switch(o){case"bottom":t.attr("x1",a.x).attr("x2",a.x).attr("y2",v=>this.getTickSize.bind(this)(v)*(m?-1:1)),n.attr("x",0).attr("y",p(u)).style("text-anchor",(v,b,{length:y})=>!_&&b===0&&(x===!0||x.first)?"start":!_&&b===y-1&&(x===!0||x.last)?"end":f(u)).attr("transform",g(u));break;case"top":t.attr("x2",0).attr("y2",m?s:-s),n.attr("x",0).attr("y",-(p(u)+h+d)).style("text-anchor",f(u)).attr("transform",g(u));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(`
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 u(d,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 u(d.concat(h.substr(0,g||_)),h.slice(g?g+1:_));return d.concat(h)}return u(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 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=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)),pe=(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,u=o[l]+s;if(c<=r+vs)return!0;r=Math.max(r,u)}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,u=Array.isArray(c)?c.join("").length:String(c!=null?c:"").length;u>s&&(s=u,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){pe(this,"owner"),pe(this,"x"),pe(this,"subX"),pe(this,"subY"),pe(this,"subY2"),pe(this,"y"),pe(this,"y2"),pe(this,"axesList",{}),pe(this,"tick",{x:null,y:null,y2:null}),pe(this,"xs",[]),pe(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||{},u=n.scale[t].copy();l.domain&&u.domain(l.domain);const d=new Ul({outerTick:c.outer!==!1,noTransition:!1,config:i,id:t,isSubAxes:!0,owner:n}).scale(u).orient(r).tickFormat(z(c.format)?c.format.bind(n.api):(h=>h));q(c.count)&&d.ticks(c.count),c.values&&d.tickValues(c.values),a.push(d)}),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,u)=>{const d=c.scale().range();l.every((g,p)=>g===d[p])||c.scale().range(l);const h=`${this.getAxisClassName(s)}-${u+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[u].domain&&r.domain(o[u].domain),c.scale(r).create(a(f))),f.attr("transform",t.getTranslate(s,u+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),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=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=ke({outerTick:i,noTransition:a,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||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new Ul(p).scale(l&&o.scale.zoom||n).orient(d);if(l&&this.isTimeSeries()&&g&&!z(g)){const m=Vt.bind(o);g=g.map(v=>m(v))}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}%`)),u&&(_.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 u=c,d;return o&&(d=a.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=Ze(s,"subX","count"),d=c!=null?c:u!==s.axis_x_tick_count?r(u):l;this.x.tickValues(l),(i=this.subX)==null||i.tickValues(d)}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:u}=l,d=t==="x",h=d?"axis_x":`axis_${t}`,f=a.tickValues();return rs({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: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:!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 i;const a=this.owner,{config:s,state:o,$el:{svg:r,chart:l}}=a,{current:c,resizing:u}=o,d=c.maxTickSize[t],h=`${W.maxTickSize}_${t}_${!!n}`,f=a.cache.get(h);if(f&&f.generation===o.redrawGeneration)return d;const g=`axis_${t}`,p={width:0,height:0};let _;if(u||n||!s[`${g}_show`]||d.width>0&&a.filterTargetsToShow().length===0)return d;if((r||s.render_mode==="canvas")&&((i=a.scale[t])!=null&&i.copy)){const x=/^y2?$/.test(t),m=a.getTargetsToShow(),v=a.scale[t].copy().domain(a[`get${x?"Y":"X"}Domain`](m,t)),b=v.domain(),y=b[0]===b[1]&&b.every(I=>I>0),T=ot(d.domain)&&d.domain[0]===d.domain[1]&&d.domain.every(I=>I>0);if(y||T)return d;d.domain=b,x||os(d.ticks);const w=this.getAxis(t,v,!1,!1,!0),C=s[`${g}_tick_rotate`],k=s[`${g}_tick_count`];if(!s[`${g}_tick_values`]&&k&&w.tickValues(this.generateTickValues(b,k,x?this.isTimeSeriesY():this.isTimeSeries())),!x&&this.updateXAxisTickValues(m,w),_=this.getMaxTickSizeFingerprint(t,v,b,w,C,n),(f==null?void 0:f.fingerprint)===_)return a.cache.add(h,V_(G_({},f),{generation:o.redrawGeneration})),ex(d,f.value);const A=w.tickValues(),L=!x&&Array.isArray(A)&&A.length>Gi;L&&w.tickValues(j_(A,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?A.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||(d.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++)d.ticks[G]=p.width}!x&&L&&K_(d.ticks,B,p.width),E.remove()}return Object.keys(p).forEach(x=>{p[x]>0&&(d[x]=p[x])}),a.cache.add(h,{fingerprint:_,generation:o.redrawGeneration,value:tx(d)}),d}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 u=a.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,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,u=c.length,d=(i=ss(c))!=null?i:r.current.maxTickSize.x.width,{left:h,right:f}=r.axis.x.padding;let g=0;const p=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)*J_(c,m,d),y=v-(l?1:.5)+h;if(y<=0)continue;const w=(n-b)/y,C=p-v,k=f*w,S=C*w+k,A=b-w/2-S;g=Math.max(g,A)}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)}`,u=It[`${c}Label`];if(l){let d=a.select(`text.${u}`);d.empty()&&(d=a.select(`g.${It[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,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],u=(c-l)/(r+1);let d;a=[l];for(let h=0;h<r;h++)d=+l+u*(h+1),a.push(i?new Date(d):o?Math.round(d):d);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,u]=["x","y","y2","subX","subY","subY2"].map(d=>a(i[d],t));return{axisX:s,axisY:o,axisY2:r,axisSubX:l,axisSubY:c,axisSubY2:u}}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 u=this[c],d=r.axis[c];u&&d&&(!i&&!s.transition_duration&&(u.config.withoutTransition=!0),d.style("opacity",l),u.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 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([]),(a=this.subX)==null||a.tickValues([])),o.zoom_rescale&&!i&&(u=r.x.orgDomain()),["y","y2"].forEach(d=>{const h=`axis_${d}_`,f=r[d];if(f){const g=o[`${h}tick_values`],p=o[`${h}tick_count`];if(f.domain(s.getYDomain(t,d,u)),!g&&p){const _=s.axis[d],x=f.domain();_.tickValues(this.generateTickValues(x,x.every(m=>m===0)?1:p,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(g=>{const p=g==="y2"?"subY2":"subY",_=r[p],x=s.axis[p],m=this.getTickValues(g,!0),v=Ze(o,p,"count");if(!_||!x||m||!v)return;const b=_.domain();x.tickValues(this.generateTickValues(b,b.every(y=>y===0)?1:v,this.isTimeSeriesY()))})};o.subchart_show?s.withSubchartTypeContext(d):d()}}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"),u=pn(c.data(),!Ze(n,o,"culling_reverse")),d=u.length,h=Ze(n,o,"culling_max"),g=!Ze(n,o,"culling_lines")||H_(this[o],u,Y_(c));let p;if(d){for(let x=1;x<d;x++)if(d/x<h){p=x;break}p=p!=null?p:d;const _=new Map;for(let x=0;x<u.length;x++)_.set(u[x],x);c.each(function(x){var m;const v=g?this:this.querySelector("text");v&&(v.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,u,d;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";(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 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 u;const d=!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&&(u=_):g==="touchmove"&&(l||u===!0||c!==null&&Math.abs(u-_)>=c)&&(u=!0,f.preventDefault())};i.on("touchstart",f=>{n.event=f,e.updateEventRect()},{passive:d}).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:d}).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:d}),a.on("touchstart",f=>{n.event=f;const{target:g}=f;g&&g!==i.node()&&o()},{passive:d})},updateEventRect(e,t=!1){const n=this,{state:i,$el:a}=n,{eventReceiver:s,width:o,height:r,rendered:l,resizing:c}=i,u=e||a.eventRect,d=()=>{if(s){const h=dr(a.chart.node());s.rect=ht(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(Ie.eventRect,!0)),d()},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,u,d,h;if(e.updateEventType(o),o)c=0,u=0,d=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 v=x(m),b=a.domain();let y;return v.prev===null&&v.next===null?y=s?i.height:i.width:v.prev===null?y=(a(v.next)+a(m.x))/2:v.next===null?y=a(b[1])-(a(v.prev)+a(m.x))/2:y=Math.max(0,(a(v.next)-a(v.prev))/2),y},_=m=>{const v=x(m);let b;return v.prev===null&&v.next===null?b=0:v.prev===null?b=a(a.domain()[0]):b=(a(m.x)+a(v.prev))/2,b}}c=s?0:_,u=s?_:0,d=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(u,p),w:g(d,p),h:g(h,p)}})},selectRectForSingle(e,t){var n,i,a,s,o,r,l;const c=this,{config:u,state:d,$el:{main:h,circle:f}}=c,g=u.data_selection_enabled,p=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),(i=c.showSubchartGridFocus)==null||i.call(c,m),!g||p))return;!f&&h.selectAll(`.${U.EXPANDED}:not(.${At.shape}-${t})`).classed(U.EXPANDED,!1);const v=h.selectAll(`.${At.shape}-${t}`).classed(U.EXPANDED,!0).style("cursor",_?"pointer":null).filter(function(b){return c.isWithinShape(this,b)});if(v.call(b=>{var y,T,w;const C=b.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),b.each(k=>c.setExpand(t,k.id)))}),!x&&v.empty()){const b=Zt(d.event,e),y=m.filter(T=>c.isTargetToShow(T.id)?c.dist(T,b)<c.getPointSensitivity(T):!1);if(y.length>0){let T=y[0],w=c.dist(T,b);for(let C=1;C<y.length;C++){const k=y[C],S=c.dist(k,b);S<w&&(w=S,T=k)}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 u.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 d=(a.isBubbleType(c)||a.isScatterType(c)||!s.tooltip_grouped?[c]:a.filterByX(r,c.x)).map(f=>a.addName(f));a.showTooltip(d,e),a.setExpand(c.index,c.id,!0),(n=a.showGridFocus)==null||n.call(a,d),(i=a.showSubchartGridFocus)==null||i.call(a,d);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: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,g=t.axis.xs[u],p=f.invert(Zt(r,this)[0]);d==="step-after"&&p<g?u-=1:d==="step-before"&&p>g&&(u+=1)}(l=t.showAxisGridFocus)==null||l.call(t);const h=n.tooltip_grouped&&u===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}u!==a.currentIdx&&(t.setOverOut(!1,a.currentIdx),a.currentIdx=u),u===-1?t.unselectRect():t.selectRectForSingle(this,u),t.setOverOut(u!==-1,u)}).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(`.${At.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(`.${At.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${At.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),u=-15,d=o?i.left+20:a+10+r;e.attr("x",c).attr("y",u).attr("width",d).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),u=-(o?20:i.top),d=(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",u).attr("width",d).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,u=((t=a.padding)==null?void 0:t.mode)==="fit",d=a[`axis_${e}_inner`],h=a[`axis_${e}_label`].text,f=13;let g=((n=a.padding)==null?void 0:n.mode)==="fit"?d&&!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 u?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 u=0;if(l?u=l>c?c:l:c&&(u=c),u!==a.axis.x.tickCount){const{targets:d}=t.data;a.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(d,"min"),t.getXDomainMinMax(d,"max")],u)}a.axis.x.tickCount=u}(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_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:[]},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(ge.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,k_].concat(n),[dn,A_].concat(t))}let sc=()=>(Fe(An,[Ln]),(sc=()=>O.AREA)()),oc=()=>(Fe(An,[Ln]),(oc=()=>O.AREA_LINE_RANGE)()),rc=()=>(Fe(An,[Ln]),(rc=()=>O.AREA_STEP_RANGE)()),lc=()=>(Fe(An,[Ln,es]),(lc=()=>O.AREA_SPLINE)()),cc=()=>(Fe(An,[Ln,es]),(cc=()=>O.AREA_SPLINE_RANGE)()),uc=()=>(Fe(An,[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(d,h,f){var g;const _=$(d.value)||i.isBarRangeType(d)||((g=i.isSubchartCandlestickBarValue)==null?void 0:g.call(i,d,n))?e(d,h):[""];let x=o.get(d.id);if(x===void 0&&(x=us.call(i,d.id),o.set(d.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,xe());i.updateConnectLine(m,x,s),s.splice(0)}return _[0]},u=i.$T(a,t,xe());return r&&typeof u.attrTween=="function"?u.attrTween("d",function(d,h,f){var g;const p=c.call(this,d,h,f);return Sd((g=this.getAttribute("d"))!=null?g:"",p)}):u.attr("d",c),[u.style("fill",d=>{var h;return((h=i.getSubchartCandlestickBarColor)==null?void 0:h.call(i,d,n))||l(d)}).style("clip-path",d=>d.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 u=a(l,c),{indexX:d,indexY:h,isNegative:f,pos:g,radius:p,clipPath:_}=va(n,l,u,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[d]=`${y}${[-p,p][i.axis_rotated?"sort":"reverse"]()}`,f&&x.reverse()}const m=i.axis_rotated?`H${g} ${x[0]}V${u[2][h]-p} ${x[1]}H${u[3][d]}`:`V${g} ${x[0]}H${u[2][d]-p} ${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=us.call(n,l.id),r.set(l.id,b)),b&&v.push(i.axis_rotated?{x:u[0][d],y:u[0][h],width:u[0][d]-g,height:u[2][h]-u[0][h]}:{x:u[0][d],y:g,width:u[2][d]-u[0][d],height:u[3][h]-g}),v}},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),d=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&&d.indexOf(o)===d.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),u=[],d=r?c?a.x-a.width:a.x:a.x+a.width,h=r||l?a.y+a.height:a.y;return s===0?u.push(`${d},${h}`):(u.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&&u.push(`M${d},${h}`)),u.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=ue("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=ue("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(u,d)=>{const h=c.call(n,u.id,t)(n.getShapeYMin(u.id,t)),f=l(u,d)||h,g=$(s)?s:s[u.id]||s._$width,p=n.getCandlestickData(u);let _;if(p&&$(p.open)&&$(p.close)){const x={start:o(u),end:0};x.end=x.start+g;const m={start:r(p.open),end:r(p.close)},v={x:x.start+g/2,high:r(p.high),low:r(p.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(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}},kx=Object.defineProperty,Ax=Object.defineProperties,Lx=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,Rx=Object.prototype.hasOwnProperty,Ex=Object.prototype.propertyIsEnumerable,_c=(e,t,n)=>t in e?kx(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)=>Ax(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(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:i}=n,a=n.generateGetCandlestickPoints(e,t),s=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const u=a(r,l),d=n.getCandlestickData(r),h=d==null?void 0:d._isUp,f=+s,g=+!f;c.classed&&c.classed(De[h?"valueUp":"valueDown"],!0);const p=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][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: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 i=this,{$el:a,$T:s}=i,{candlestick:o}=n?a.subchart:a,r=xe(!0);return[o.each(function(l,c){const u=s((0,F.select)(this),t,r);e(l,c,u)}).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,u)=>u,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),u=-Math.cos(r),d={x:c*o,y:u*o},h=s+Ox,f={x:c*h,y:u*h},g=c>=0,p={x:f.x+t*(g?1:-1),y:f.y};return{startPoint:d,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,u,d;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:v,endPoint:b,isRight:y}=f,T=`${m.x},${m.y} ${v.x},${v.y} ${b.x},${b.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:k}=l.data,S=((d=(u=s.formatter)!=null?u:t.getArcLabelConfig("format"))!=null?d:t.defaultArcValueFormat)(C,g,k).toString();Cn(w,S,[-1,1],!1);const A={x:b.x+5*(y?1:-1),y:b.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;A.y+=(-R+bc)*r}else A.y+=bc*r;i(w,e).attr("transform",`translate(${A.x},${A.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),u={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const d=o.arc_rangeText_position;if(d){const h=o.arc_rangeText_values,f=z(d)?d(h[t.index]):d;u.x+=(a=f==null?void 0:f.x)!=null?a:0,u.y+=(s=f==null?void 0:f.y)!=null?s:0}}return u}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 d=36/n,h=d>.375;o=n&&i?(h?1.175-d:.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:u}=i;i.radius!==l&&(u-=Math.abs(i.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=$(u)?u:u.call(t.api,d,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,u)=>c+u.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 u=i.getStartingAngle(),d=a.gauge_fullCircle||t&&!o?i.getArcLength():u*-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),_=d*((p-f)/(g-f));r=r.startAngle(u).endAngle(_+u)}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,_=d/(p-f),x=(n=l.value)!=null?n:0,m=x<f?0:x<p?x-f:p-f;l.startAngle=u,l.endAngle=u+_*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 u=r?o:(l=e.updateAngle(o))!=null?l:null;u&&(c=a.cornerRadius(i(u,n(u)))(u))}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 u=e.pie(r).map((h,f)=>(h.index=f,h));let d=n.selectAll(`.${at.arcRange}`).data(r);d.exit().remove(),d=a(d.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(d)),(!i.rendered||i.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 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:u}=r||s,d=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(u,l,s.data.id).toString();Cn(o,d,[-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",u=>a(u)+o(u.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",u=>i.color(u.data)).style("cursor",u=>{var d;return(d=l==null?void 0:l.bind)!=null&&d.call(l,i.api)(u)?"pointer":null}).style("opacity","0").each(function(u){i.isGaugeType(u.data)&&(u.startAngle=a.gauge_startingAngle,u.endAngle=a.gauge_startingAngle),this._current=u}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",u=>!i.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=i.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,mc.interpolate)(this._current,d);return this._current=h(0),function(f){const g=h(f);return g.data=u.data,i.getArc(g,!0)}}).attr("transform",n?"scale(1)":"").style("fill",u=>{let d;return i.levelColor?(d=i.levelColor(u.data.values[0].value),a.data_colors[u.data.id]=d):d=i.color(u.data),d}).style("opacity",null).call(ri,function(){if(i.levelColor){const u=(0,F.select)(this),d=u.datum(this._current);i.updateLegendItemColor(d.data.id,u.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,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,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,v=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(ri,()=>{v&&(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${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: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 u=n.gauge_fullCircle?a:l*-2,{gauge_min:d,gauge_max:h}=n;c=u*((r-d)/(h-d))}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",(u,d)=>`${at.chartArcsBackground} ${at.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:i}=t,a=i.inputType==="touch",s=i.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(i.transiting)return;i.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(i.transiting||!n.interaction_onout)return;i.event=c;const d=o(u);l(),t.setOverOut(!1,d)}).on("mousemove",function(c,u){const d=o(u);i.event=c,t.showTooltip([d],this)}),a&&t.hasArcType()&&!t.radars){const c=u=>{var d,h;const{clientX:f,clientY:g}=(h=(d=u.changedTouches)==null?void 0:d[0])!=null?h:{clientX:0,clientY:0};return(0,F.select)(nt.elementFromPoint(f,g))};t.$el.svg.on("touchstart touchmove",function(u){if(i.transiting)return;i.event=u;const h=c(u).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(ge.prototype,[qx,Rn].concat(e||[])),cn.setOptions([dn].concat(t||[]))}let kc=()=>(Pn(void 0,[Wi,Fx]),(kc=()=>O.DONUT)());var Jx=Object.defineProperty,Ac=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(Ac)for(var n of Ac(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,u=l+c;s.push(o.coords=n?[[c,0],[u,0],[u,a],[c,a],[c,0]]:[[0,c],[i,c],[i,u],[0,u],[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,u=n+(i-n)*sm(l);s.push(a?[c,u]:[u,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),u=[];if(s.height>0&&(c.push(n?[i,r]:[i-r,a]),u.push(n?[i,a-r]:[r,a])),u.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=u.length-1;p>0&&u.splice(p,0,[u[p-f][0],u[p-g][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`}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 u=0;return a.each(d=>{const h=u,{ratio:f}=d;u+=f;const g=i?o:s,p=g+h,_=g+u,x=(p+_)/2,m=i?s+l/2:o+r/2;c[d.id]=i?[[p,m],[_,m],[x,m]]:[[m,p],[m,_],[m,x]]}),d=>c[d.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,u)=>`M${s[u].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 u=0,d=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,u=Math.cos(x)*_,d=Math.sin(x)*_,h=`rotate(${p*180/Math.PI}, ${u}, ${d})`}(0,F.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: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),u=i.selectAll(`.${Me.level}`).data(o);u.exit().remove();const d=u.enter().append("g").attr("class",(h,f)=>`${Me.level} ${Me.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",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",At.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,ue("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,u=nn(e).map(d=>gm(c,d,l,t,ct(n)?n:e==="x"?o:r,$(i)?i:s.radar_size_ratio));return u.length===1?u[0]:u},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,u=li(0,o),d=t.radar_size_ratio*Math.min(a,s),h=u.map(x=>d*((x+1)/o)),f=(t.radar_level_text_format||function(){}).bind(e.api),g=u.map(x=>{const m=h[x];return li(0,r).map(b=>e.getRadarPosition(["x","y"],b,m,1).join(",")).join(" ")}),p=c.selectAll(`.${Me.level}`).data(u);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/u.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,u=e.cache.get(zc)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){Cn((0,F.select)(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){Ct(this.width)&&(this.width=ht(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>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})`}),!u){const d=[n.axes,n.levels].map(h=>ur(h.node()).width);d.every(h=>h>0)&&e.cache.add(zc,d[0]-d[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=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())};i.axes.on(l?"mouseover ":"touchstart",u=>{if(r)return;n.event=u;const d=e.getDataIndexFromEvent(u);e.selectRectForSingle(a.node(),d),l?e.setOverOut(!0,d):e.callOverOutForTouch(d)},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,u,d)=>{o(r,0,0,a,s);for(const h of r.children)h.x0=l+h.x0/a*(u-l),h.x1=l+h.x1/a*(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: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},km=(e,t)=>ym(e,Tm(t));function Am(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=km(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,xe()).call(Am.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),u=(c*100).toFixed(2),d=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",d),z(l)?l.bind(t.api)(r,c,o,{width:f,height:g}):`${o}
40
- ${u}%`}}}),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.0-next.3",generate(e){const t=ke(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(),kl(),Vl(),hl(),ll()})(),ji})()});
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 u(d,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 u(d.concat(h.substr(0,g||_)),h.slice(g?g+1:_));return d.concat(h)}return u(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 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=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)),pe=(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,u=o[l]+s;if(c<=r+vs)return!0;r=Math.max(r,u)}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,u=Array.isArray(c)?c.join("").length:String(c!=null?c:"").length;u>s&&(s=u,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){pe(this,"owner"),pe(this,"x"),pe(this,"subX"),pe(this,"subY"),pe(this,"subY2"),pe(this,"y"),pe(this,"y2"),pe(this,"axesList",{}),pe(this,"tick",{x:null,y:null,y2:null}),pe(this,"xs",[]),pe(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||{},u=n.scale[t].copy();l.domain&&u.domain(l.domain);const d=new Ul({outerTick:c.outer!==!1,noTransition:!1,config:i,id:t,isSubAxes:!0,owner:n}).scale(u).orient(r).tickFormat(z(c.format)?c.format.bind(n.api):(h=>h));q(c.count)&&d.ticks(c.count),c.values&&d.tickValues(c.values),a.push(d)}),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,u)=>{const d=c.scale().range();l.every((g,p)=>g===d[p])||c.scale().range(l);const h=`${this.getAxisClassName(s)}-${u+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[u].domain&&r.domain(o[u].domain),c.scale(r).create(a(f))),f.attr("transform",t.getTranslate(s,u+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),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=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=ke({outerTick:i,noTransition:a,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||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new Ul(p).scale(l&&o.scale.zoom||n).orient(d);if(l&&this.isTimeSeries()&&g&&!z(g)){const m=Vt.bind(o);g=g.map(v=>m(v))}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}%`)),u&&(_.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 u=c,d;return o&&(d=a.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=Ze(s,"subX","count"),d=c!=null?c:u!==s.axis_x_tick_count?r(u):l;this.x.tickValues(l),(i=this.subX)==null||i.tickValues(d)}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:u}=l,d=t==="x",h=d?"axis_x":`axis_${t}`,f=a.tickValues();return rs({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: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:!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 i;const a=this.owner,{config:s,state:o,$el:{svg:r,chart:l}}=a,{current:c,resizing:u}=o,d=c.maxTickSize[t],h=`${W.maxTickSize}_${t}_${!!n}`,f=a.cache.get(h);if(f&&f.generation===o.redrawGeneration)return d;const g=`axis_${t}`,p={width:0,height:0};let _;if(u||n||!s[`${g}_show`]||d.width>0&&a.filterTargetsToShow().length===0)return d;if((r||s.render_mode==="canvas")&&((i=a.scale[t])!=null&&i.copy)){const x=/^y2?$/.test(t),m=a.getTargetsToShow(),v=a.scale[t].copy().domain(a[`get${x?"Y":"X"}Domain`](m,t)),b=v.domain(),y=b[0]===b[1]&&b.every(I=>I>0),T=ot(d.domain)&&d.domain[0]===d.domain[1]&&d.domain.every(I=>I>0);if(y||T)return d;d.domain=b,x||os(d.ticks);const w=this.getAxis(t,v,!1,!1,!0),C=s[`${g}_tick_rotate`],k=s[`${g}_tick_count`];if(!s[`${g}_tick_values`]&&k&&w.tickValues(this.generateTickValues(b,k,x?this.isTimeSeriesY():this.isTimeSeries())),!x&&this.updateXAxisTickValues(m,w),_=this.getMaxTickSizeFingerprint(t,v,b,w,C,n),(f==null?void 0:f.fingerprint)===_)return a.cache.add(h,V_(G_({},f),{generation:o.redrawGeneration})),ex(d,f.value);const A=w.tickValues(),L=!x&&Array.isArray(A)&&A.length>Gi;L&&w.tickValues(j_(A,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?A.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||(d.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++)d.ticks[G]=p.width}!x&&L&&K_(d.ticks,B,p.width),E.remove()}return Object.keys(p).forEach(x=>{p[x]>0&&(d[x]=p[x])}),a.cache.add(h,{fingerprint:_,generation:o.redrawGeneration,value:tx(d)}),d}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 u=a.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,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,u=c.length,d=(i=ss(c))!=null?i:r.current.maxTickSize.x.width,{left:h,right:f}=r.axis.x.padding;let g=0;const p=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)*J_(c,m,d),y=v-(l?1:.5)+h;if(y<=0)continue;const w=(n-b)/y,C=p-v,k=f*w,S=C*w+k,A=b-w/2-S;g=Math.max(g,A)}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)}`,u=It[`${c}Label`];if(l){let d=a.select(`text.${u}`);d.empty()&&(d=a.select(`g.${It[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,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],u=(c-l)/(r+1);let d;a=[l];for(let h=0;h<r;h++)d=+l+u*(h+1),a.push(i?new Date(d):o?Math.round(d):d);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,u]=["x","y","y2","subX","subY","subY2"].map(d=>a(i[d],t));return{axisX:s,axisY:o,axisY2:r,axisSubX:l,axisSubY:c,axisSubY2:u}}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 u=this[c],d=r.axis[c];u&&d&&(!i&&!s.transition_duration&&(u.config.withoutTransition=!0),d.style("opacity",l),u.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 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([]),(a=this.subX)==null||a.tickValues([])),o.zoom_rescale&&!i&&(u=r.x.orgDomain()),["y","y2"].forEach(d=>{const h=`axis_${d}_`,f=r[d];if(f){const g=o[`${h}tick_values`],p=o[`${h}tick_count`];if(f.domain(s.getYDomain(t,d,u)),!g&&p){const _=s.axis[d],x=f.domain();_.tickValues(this.generateTickValues(x,x.every(m=>m===0)?1:p,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(g=>{const p=g==="y2"?"subY2":"subY",_=r[p],x=s.axis[p],m=this.getTickValues(g,!0),v=Ze(o,p,"count");if(!_||!x||m||!v)return;const b=_.domain();x.tickValues(this.generateTickValues(b,b.every(y=>y===0)?1:v,this.isTimeSeriesY()))})};o.subchart_show?s.withSubchartTypeContext(d):d()}}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"),u=pn(c.data(),!Ze(n,o,"culling_reverse")),d=u.length,h=Ze(n,o,"culling_max"),g=!Ze(n,o,"culling_lines")||H_(this[o],u,Y_(c));let p;if(d){for(let x=1;x<d;x++)if(d/x<h){p=x;break}p=p!=null?p:d;const _=new Map;for(let x=0;x<u.length;x++)_.set(u[x],x);c.each(function(x){var m;const v=g?this:this.querySelector("text");v&&(v.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,u,d;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";(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 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 u;const d=!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&&(u=_):g==="touchmove"&&(l||u===!0||c!==null&&Math.abs(u-_)>=c)&&(u=!0,f.preventDefault())};i.on("touchstart",f=>{n.event=f,e.updateEventRect()},{passive:d}).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:d}).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:d}),a.on("touchstart",f=>{n.event=f;const{target:g}=f;g&&g!==i.node()&&o()},{passive:d})},updateEventRect(e,t=!1){const n=this,{state:i,$el:a}=n,{eventReceiver:s,width:o,height:r,rendered:l,resizing:c}=i,u=e||a.eventRect,d=()=>{if(s){const h=dr(a.chart.node());s.rect=ht(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(Ie.eventRect,!0)),d()},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,u,d,h;if(e.updateEventType(o),o)c=0,u=0,d=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 v=x(m),b=a.domain();let y;return v.prev===null&&v.next===null?y=s?i.height:i.width:v.prev===null?y=(a(v.next)+a(m.x))/2:v.next===null?y=a(b[1])-(a(v.prev)+a(m.x))/2:y=Math.max(0,(a(v.next)-a(v.prev))/2),y},_=m=>{const v=x(m);let b;return v.prev===null&&v.next===null?b=0:v.prev===null?b=a(a.domain()[0]):b=(a(m.x)+a(v.prev))/2,b}}c=s?0:_,u=s?_:0,d=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(u,p),w:g(d,p),h:g(h,p)}})},selectRectForSingle(e,t){var n,i,a,s,o,r,l;const c=this,{config:u,state:d,$el:{main:h,circle:f}}=c,g=u.data_selection_enabled,p=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),(i=c.showSubchartGridFocus)==null||i.call(c,m),!g||p))return;!f&&h.selectAll(`.${U.EXPANDED}:not(.${At.shape}-${t})`).classed(U.EXPANDED,!1);const v=h.selectAll(`.${At.shape}-${t}`).classed(U.EXPANDED,!0).style("cursor",_?"pointer":null).filter(function(b){return c.isWithinShape(this,b)});if(v.call(b=>{var y,T,w;const C=b.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),b.each(k=>c.setExpand(t,k.id)))}),!x&&v.empty()){const b=Zt(d.event,e),y=m.filter(T=>c.isTargetToShow(T.id)?c.dist(T,b)<c.getPointSensitivity(T):!1);if(y.length>0){let T=y[0],w=c.dist(T,b);for(let C=1;C<y.length;C++){const k=y[C],S=c.dist(k,b);S<w&&(w=S,T=k)}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 u.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 d=(a.isBubbleType(c)||a.isScatterType(c)||!s.tooltip_grouped?[c]:a.filterByX(r,c.x)).map(f=>a.addName(f));a.showTooltip(d,e),a.setExpand(c.index,c.id,!0),(n=a.showGridFocus)==null||n.call(a,d),(i=a.showSubchartGridFocus)==null||i.call(a,d);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: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,g=t.axis.xs[u],p=f.invert(Zt(r,this)[0]);d==="step-after"&&p<g?u-=1:d==="step-before"&&p>g&&(u+=1)}(l=t.showAxisGridFocus)==null||l.call(t);const h=n.tooltip_grouped&&u===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}u!==a.currentIdx&&(t.setOverOut(!1,a.currentIdx),a.currentIdx=u),u===-1?t.unselectRect():t.selectRectForSingle(this,u),t.setOverOut(u!==-1,u)}).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(`.${At.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(`.${At.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${At.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),u=-15,d=o?i.left+20:a+10+r;e.attr("x",c).attr("y",u).attr("width",d).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),u=-(o?20:i.top),d=(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",u).attr("width",d).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,u=((t=a.padding)==null?void 0:t.mode)==="fit",d=a[`axis_${e}_inner`],h=a[`axis_${e}_label`].text,f=13;let g=((n=a.padding)==null?void 0:n.mode)==="fit"?d&&!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 u?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 u=0;if(l?u=l>c?c:l:c&&(u=c),u!==a.axis.x.tickCount){const{targets:d}=t.data;a.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(d,"min"),t.getXDomainMinMax(d,"max")],u)}a.axis.x.tickCount=u}(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(ge.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,k_].concat(n),[dn,A_].concat(t))}let sc=()=>(Fe(An,[Ln]),(sc=()=>O.AREA)()),oc=()=>(Fe(An,[Ln]),(oc=()=>O.AREA_LINE_RANGE)()),rc=()=>(Fe(An,[Ln]),(rc=()=>O.AREA_STEP_RANGE)()),lc=()=>(Fe(An,[Ln,es]),(lc=()=>O.AREA_SPLINE)()),cc=()=>(Fe(An,[Ln,es]),(cc=()=>O.AREA_SPLINE_RANGE)()),uc=()=>(Fe(An,[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(d,h,f){var g;const _=$(d.value)||i.isBarRangeType(d)||((g=i.isSubchartCandlestickBarValue)==null?void 0:g.call(i,d,n))?e(d,h):[""];let x=o.get(d.id);if(x===void 0&&(x=us.call(i,d.id),o.set(d.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,xe());i.updateConnectLine(m,x,s),s.splice(0)}return _[0]},u=i.$T(a,t,xe());return r&&typeof u.attrTween=="function"?u.attrTween("d",function(d,h,f){var g;const p=c.call(this,d,h,f);return Sd((g=this.getAttribute("d"))!=null?g:"",p)}):u.attr("d",c),[u.style("fill",d=>{var h;return((h=i.getSubchartCandlestickBarColor)==null?void 0:h.call(i,d,n))||l(d)}).style("clip-path",d=>d.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 u=a(l,c),{indexX:d,indexY:h,isNegative:f,pos:g,radius:p,clipPath:_}=va(n,l,u,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[d]=`${y}${[-p,p][i.axis_rotated?"sort":"reverse"]()}`,f&&x.reverse()}const m=i.axis_rotated?`H${g} ${x[0]}V${u[2][h]-p} ${x[1]}H${u[3][d]}`:`V${g} ${x[0]}H${u[2][d]-p} ${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=us.call(n,l.id),r.set(l.id,b)),b&&v.push(i.axis_rotated?{x:u[0][d],y:u[0][h],width:u[0][d]-g,height:u[2][h]-u[0][h]}:{x:u[0][d],y:g,width:u[2][d]-u[0][d],height:u[3][h]-g}),v}},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),d=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&&d.indexOf(o)===d.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),u=[],d=r?c?a.x-a.width:a.x:a.x+a.width,h=r||l?a.y+a.height:a.y;return s===0?u.push(`${d},${h}`):(u.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&&u.push(`M${d},${h}`)),u.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=ue("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=ue("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(u,d)=>{const h=c.call(n,u.id,t)(n.getShapeYMin(u.id,t)),f=l(u,d)||h,g=$(s)?s:s[u.id]||s._$width,p=n.getCandlestickData(u);let _;if(p&&$(p.open)&&$(p.close)){const x={start:o(u),end:0};x.end=x.start+g;const m={start:r(p.open),end:r(p.close)},v={x:x.start+g/2,high:r(p.high),low:r(p.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(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}},kx=Object.defineProperty,Ax=Object.defineProperties,Lx=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,Rx=Object.prototype.hasOwnProperty,Ex=Object.prototype.propertyIsEnumerable,_c=(e,t,n)=>t in e?kx(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)=>Ax(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(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:i}=n,a=n.generateGetCandlestickPoints(e,t),s=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const u=a(r,l),d=n.getCandlestickData(r),h=d==null?void 0:d._isUp,f=+s,g=+!f;c.classed&&c.classed(De[h?"valueUp":"valueDown"],!0);const p=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][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: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 i=this,{$el:a,$T:s}=i,{candlestick:o}=n?a.subchart:a,r=xe(!0);return[o.each(function(l,c){const u=s((0,F.select)(this),t,r);e(l,c,u)}).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,u)=>u,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),u=-Math.cos(r),d={x:c*o,y:u*o},h=s+Ox,f={x:c*h,y:u*h},g=c>=0,p={x:f.x+t*(g?1:-1),y:f.y};return{startPoint:d,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,u,d;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:v,endPoint:b,isRight:y}=f,T=`${m.x},${m.y} ${v.x},${v.y} ${b.x},${b.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:k}=l.data,S=((d=(u=s.formatter)!=null?u:t.getArcLabelConfig("format"))!=null?d:t.defaultArcValueFormat)(C,g,k).toString();Cn(w,S,[-1,1],!1);const A={x:b.x+5*(y?1:-1),y:b.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;A.y+=(-R+bc)*r}else A.y+=bc*r;i(w,e).attr("transform",`translate(${A.x},${A.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),u={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const d=o.arc_rangeText_position;if(d){const h=o.arc_rangeText_values,f=z(d)?d(h[t.index]):d;u.x+=(a=f==null?void 0:f.x)!=null?a:0,u.y+=(s=f==null?void 0:f.y)!=null?s:0}}return u}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 d=36/n,h=d>.375;o=n&&i?(h?1.175-d:.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:u}=i;i.radius!==l&&(u-=Math.abs(i.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=$(u)?u:u.call(t.api,d,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,u)=>c+u.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 u=i.getStartingAngle(),d=a.gauge_fullCircle||t&&!o?i.getArcLength():u*-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),_=d*((p-f)/(g-f));r=r.startAngle(u).endAngle(_+u)}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,_=d/(p-f),x=(n=l.value)!=null?n:0,m=x<f?0:x<p?x-f:p-f;l.startAngle=u,l.endAngle=u+_*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 u=r?o:(l=e.updateAngle(o))!=null?l:null;u&&(c=a.cornerRadius(i(u,n(u)))(u))}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 u=e.pie(r).map((h,f)=>(h.index=f,h));let d=n.selectAll(`.${at.arcRange}`).data(r);d.exit().remove(),d=a(d.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(d)),(!i.rendered||i.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 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:u}=r||s,d=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(u,l,s.data.id).toString();Cn(o,d,[-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",u=>a(u)+o(u.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",u=>i.color(u.data)).style("cursor",u=>{var d;return(d=l==null?void 0:l.bind)!=null&&d.call(l,i.api)(u)?"pointer":null}).style("opacity","0").each(function(u){i.isGaugeType(u.data)&&(u.startAngle=a.gauge_startingAngle,u.endAngle=a.gauge_startingAngle),this._current=u}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",u=>!i.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=i.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,mc.interpolate)(this._current,d);return this._current=h(0),function(f){const g=h(f);return g.data=u.data,i.getArc(g,!0)}}).attr("transform",n?"scale(1)":"").style("fill",u=>{let d;return i.levelColor?(d=i.levelColor(u.data.values[0].value),a.data_colors[u.data.id]=d):d=i.color(u.data),d}).style("opacity",null).call(ri,function(){if(i.levelColor){const u=(0,F.select)(this),d=u.datum(this._current);i.updateLegendItemColor(d.data.id,u.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,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,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,v=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(ri,()=>{v&&(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${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: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 u=n.gauge_fullCircle?a:l*-2,{gauge_min:d,gauge_max:h}=n;c=u*((r-d)/(h-d))}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",(u,d)=>`${at.chartArcsBackground} ${at.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:i}=t,a=i.inputType==="touch",s=i.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(i.transiting)return;i.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(i.transiting||!n.interaction_onout)return;i.event=c;const d=o(u);l(),t.setOverOut(!1,d)}).on("mousemove",function(c,u){const d=o(u);i.event=c,t.showTooltip([d],this)}),a&&t.hasArcType()&&!t.radars){const c=u=>{var d,h;const{clientX:f,clientY:g}=(h=(d=u.changedTouches)==null?void 0:d[0])!=null?h:{clientX:0,clientY:0};return(0,F.select)(nt.elementFromPoint(f,g))};t.$el.svg.on("touchstart touchmove",function(u){if(i.transiting)return;i.event=u;const h=c(u).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(ge.prototype,[qx,Rn].concat(e||[])),cn.setOptions([dn].concat(t||[]))}let kc=()=>(Pn(void 0,[Wi,Fx]),(kc=()=>O.DONUT)());var Jx=Object.defineProperty,Ac=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(Ac)for(var n of Ac(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,u=l+c;s.push(o.coords=n?[[c,0],[u,0],[u,a],[c,a],[c,0]]:[[0,c],[i,c],[i,u],[0,u],[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,u=n+(i-n)*sm(l);s.push(a?[c,u]:[u,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),u=[];if(s.height>0&&(c.push(n?[i,r]:[i-r,a]),u.push(n?[i,a-r]:[r,a])),u.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=u.length-1;p>0&&u.splice(p,0,[u[p-f][0],u[p-g][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`}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 u=0;return a.each(d=>{const h=u,{ratio:f}=d;u+=f;const g=i?o:s,p=g+h,_=g+u,x=(p+_)/2,m=i?s+l/2:o+r/2;c[d.id]=i?[[p,m],[_,m],[x,m]]:[[m,p],[m,_],[m,x]]}),d=>c[d.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,u)=>`M${s[u].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 u=0,d=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,u=Math.cos(x)*_,d=Math.sin(x)*_,h=`rotate(${p*180/Math.PI}, ${u}, ${d})`}(0,F.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: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),u=i.selectAll(`.${Me.level}`).data(o);u.exit().remove();const d=u.enter().append("g").attr("class",(h,f)=>`${Me.level} ${Me.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",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",At.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,ue("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,u=nn(e).map(d=>gm(c,d,l,t,ct(n)?n:e==="x"?o:r,$(i)?i:s.radar_size_ratio));return u.length===1?u[0]:u},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,u=li(0,o),d=t.radar_size_ratio*Math.min(a,s),h=u.map(x=>d*((x+1)/o)),f=(t.radar_level_text_format||function(){}).bind(e.api),g=u.map(x=>{const m=h[x];return li(0,r).map(b=>e.getRadarPosition(["x","y"],b,m,1).join(",")).join(" ")}),p=c.selectAll(`.${Me.level}`).data(u);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/u.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,u=e.cache.get(zc)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){Cn((0,F.select)(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){Ct(this.width)&&(this.width=ht(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>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})`}),!u){const d=[n.axes,n.levels].map(h=>ur(h.node()).width);d.every(h=>h>0)&&e.cache.add(zc,d[0]-d[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=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())};i.axes.on(l?"mouseover ":"touchstart",u=>{if(r)return;n.event=u;const d=e.getDataIndexFromEvent(u);e.selectRectForSingle(a.node(),d),l?e.setOverOut(!0,d):e.callOverOutForTouch(d)},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,u,d)=>{o(r,0,0,a,s);for(const h of r.children)h.x0=l+h.x0/a*(u-l),h.x1=l+h.x1/a*(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: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},km=(e,t)=>ym(e,Tm(t));function Am(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=km(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,xe()).call(Am.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),u=(c*100).toFixed(2),d=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",d),z(l)?l.bind(t.api)(r,c,o,{width:f,height:g}):`${o}
40
+ ${u}%`}}}),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.0",generate(e){const t=ke(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(),kl(),Vl(),hl(),ll()})(),ji})()});