semiotic 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CLAUDE.md +16 -3
  2. package/ai/schema.json +42 -1
  3. package/ai/system-prompt.md +4 -0
  4. package/dist/components/Annotation.d.ts +42 -2
  5. package/dist/components/CategoryColors.d.ts +1 -1
  6. package/dist/components/ChartGrid.d.ts +1 -1
  7. package/dist/components/ContextLayout.d.ts +1 -1
  8. package/dist/components/DataSummaryContext.d.ts +1 -1
  9. package/dist/components/DetailsPanel.d.ts +3 -2
  10. package/dist/components/Legend.d.ts +2 -3
  11. package/dist/components/LinkedCharts.d.ts +1 -1
  12. package/dist/components/ThemeProvider.d.ts +1 -1
  13. package/dist/components/Tooltip/FlippingTooltip.d.ts +1 -1
  14. package/dist/components/Tooltip/Tooltip.d.ts +4 -3
  15. package/dist/components/charts/geo/ChoroplethMap.d.ts +4 -4
  16. package/dist/components/charts/geo/DistanceCartogram.d.ts +5 -4
  17. package/dist/components/charts/geo/FlowMap.d.ts +4 -4
  18. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +4 -3
  19. package/dist/components/charts/index.d.ts +2 -0
  20. package/dist/components/charts/network/ChordDiagram.d.ts +4 -3
  21. package/dist/components/charts/network/CirclePack.d.ts +3 -3
  22. package/dist/components/charts/network/ForceDirectedGraph.d.ts +3 -2
  23. package/dist/components/charts/network/OrbitDiagram.d.ts +6 -5
  24. package/dist/components/charts/network/SankeyDiagram.d.ts +4 -3
  25. package/dist/components/charts/network/TreeDiagram.d.ts +3 -3
  26. package/dist/components/charts/network/Treemap.d.ts +3 -3
  27. package/dist/components/charts/ordinal/BarChart.d.ts +24 -4
  28. package/dist/components/charts/ordinal/BoxPlot.d.ts +4 -3
  29. package/dist/components/charts/ordinal/DonutChart.d.ts +4 -3
  30. package/dist/components/charts/ordinal/DotPlot.d.ts +4 -3
  31. package/dist/components/charts/ordinal/FunnelChart.d.ts +4 -3
  32. package/dist/components/charts/ordinal/GaugeChart.d.ts +2 -1
  33. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -3
  34. package/dist/components/charts/ordinal/Histogram.d.ts +4 -3
  35. package/dist/components/charts/ordinal/LikertChart.d.ts +4 -3
  36. package/dist/components/charts/ordinal/PieChart.d.ts +4 -3
  37. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +4 -3
  38. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
  39. package/dist/components/charts/ordinal/SwarmPlot.d.ts +4 -3
  40. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -3
  41. package/dist/components/charts/ordinal/ViolinPlot.d.ts +4 -3
  42. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +7 -6
  43. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
  44. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -6
  45. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -6
  46. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -6
  47. package/dist/components/charts/shared/ChartError.d.ts +1 -2
  48. package/dist/components/charts/shared/annotationResolvers.d.ts +4 -3
  49. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  50. package/dist/components/charts/shared/colorUtils.d.ts +4 -3
  51. package/dist/components/charts/shared/datumTypes.d.ts +20 -0
  52. package/dist/components/charts/shared/diagnoseConfig.d.ts +2 -7
  53. package/dist/components/charts/shared/formatUtils.d.ts +4 -2
  54. package/dist/components/charts/shared/hooks.d.ts +27 -23
  55. package/dist/components/charts/shared/legendUtils.d.ts +3 -2
  56. package/dist/components/charts/shared/mergeShapeStyle.d.ts +43 -0
  57. package/dist/components/charts/shared/networkUtils.d.ts +7 -6
  58. package/dist/components/charts/shared/selectionUtils.d.ts +5 -4
  59. package/dist/components/charts/shared/statisticalOverlays.d.ts +14 -26
  60. package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +2 -2
  61. package/dist/components/charts/shared/statsTooltip.d.ts +3 -2
  62. package/dist/components/charts/shared/tooltipUtils.d.ts +7 -6
  63. package/dist/components/charts/shared/types.d.ts +22 -13
  64. package/dist/components/charts/shared/useChartSetup.d.ts +7 -6
  65. package/dist/components/charts/shared/useLikertAggregation.d.ts +18 -7
  66. package/dist/components/charts/shared/useOrdinalStreaming.d.ts +3 -2
  67. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -1
  68. package/dist/components/charts/shared/validateChartData.d.ts +2 -1
  69. package/dist/components/charts/shared/validateProps.d.ts +2 -8
  70. package/dist/components/charts/shared/withChartWrapper.d.ts +1 -1
  71. package/dist/components/charts/xy/AreaChart.d.ts +4 -3
  72. package/dist/components/charts/xy/BubbleChart.d.ts +4 -3
  73. package/dist/components/charts/xy/CandlestickChart.d.ts +47 -0
  74. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -3
  75. package/dist/components/charts/xy/Heatmap.d.ts +12 -7
  76. package/dist/components/charts/xy/LineChart.d.ts +4 -3
  77. package/dist/components/charts/xy/MinimapChart.d.ts +4 -4
  78. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +5 -4
  79. package/dist/components/charts/xy/QuadrantChart.d.ts +4 -3
  80. package/dist/components/charts/xy/Scatterplot.d.ts +4 -3
  81. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +3 -3
  82. package/dist/components/charts/xy/StackedAreaChart.d.ts +4 -3
  83. package/dist/components/data/transforms.d.ts +8 -7
  84. package/dist/components/export/chartConfig.d.ts +4 -3
  85. package/dist/components/export/selectionSerializer.d.ts +1 -1
  86. package/dist/components/geo/mergeData.d.ts +2 -1
  87. package/dist/components/realtime/BinAccumulator.d.ts +3 -2
  88. package/dist/components/realtime/renderers/types.d.ts +2 -1
  89. package/dist/components/realtime/renderers/waterfallRenderer.d.ts +2 -1
  90. package/dist/components/realtime/types.d.ts +25 -21
  91. package/dist/components/semiotic-themes.d.ts +2 -1
  92. package/dist/components/semiotic-xy.d.ts +2 -0
  93. package/dist/components/semiotic.d.ts +3 -3
  94. package/dist/components/server/animatedGif.d.ts +4 -18
  95. package/dist/components/server/renderToStaticSVG.d.ts +5 -4
  96. package/dist/components/server/serverChartConfigs.d.ts +2 -10
  97. package/dist/components/server/staticAnnotations.d.ts +2 -1
  98. package/dist/components/server/staticLegend.d.ts +2 -1
  99. package/dist/components/store/ObservationStore.d.ts +4 -3
  100. package/dist/components/store/SelectionStore.d.ts +4 -9
  101. package/dist/components/store/ThemeStore.d.ts +32 -4
  102. package/dist/components/store/TooltipStore.d.ts +6 -2
  103. package/dist/components/store/useSelection.d.ts +13 -9
  104. package/dist/components/stream/AccessibleDataTable.d.ts +5 -5
  105. package/dist/components/stream/CanvasHitTester.d.ts +2 -1
  106. package/dist/components/stream/DataSourceAdapter.d.ts +2 -1
  107. package/dist/components/stream/FocusRing.d.ts +1 -2
  108. package/dist/components/stream/GeoParticlePool.d.ts +2 -1
  109. package/dist/components/stream/GeoPipelineStore.d.ts +7 -6
  110. package/dist/components/stream/MarginalGraphics.d.ts +1 -2
  111. package/dist/components/stream/NetworkPipelineStore.d.ts +3 -2
  112. package/dist/components/stream/NetworkSVGOverlay.d.ts +21 -15
  113. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -19
  114. package/dist/components/stream/OrdinalPipelineStore.d.ts +6 -5
  115. package/dist/components/stream/OrdinalSVGOverlay.d.ts +6 -5
  116. package/dist/components/stream/PipelineStore.d.ts +63 -28
  117. package/dist/components/stream/SVGOverlay.d.ts +10 -10
  118. package/dist/components/stream/SceneGraph.d.ts +6 -5
  119. package/dist/components/stream/StreamGeoFrame.d.ts +2 -1
  120. package/dist/components/stream/StreamNetworkFrame.d.ts +2 -1
  121. package/dist/components/stream/StreamOrdinalFrame.d.ts +2 -1
  122. package/dist/components/stream/StreamXYFrame.d.ts +2 -1
  123. package/dist/components/stream/XYBrushOverlay.d.ts +1 -21
  124. package/dist/components/stream/devDataAccessWarning.d.ts +2 -11
  125. package/dist/components/stream/geoTypes.d.ts +43 -24
  126. package/dist/components/stream/hoverUtils.d.ts +2 -1
  127. package/dist/components/stream/keyboardNav.d.ts +18 -6
  128. package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +4 -3
  129. package/dist/components/stream/layouts/hierarchyUtils.d.ts +4 -3
  130. package/dist/components/stream/networkTypes.d.ts +73 -47
  131. package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +1 -1
  132. package/dist/components/stream/ordinalSceneBuilders/barScene.d.ts +2 -2
  133. package/dist/components/stream/ordinalSceneBuilders/connectorScene.d.ts +1 -1
  134. package/dist/components/stream/ordinalSceneBuilders/pointScene.d.ts +2 -2
  135. package/dist/components/stream/ordinalSceneBuilders/statisticalScene.d.ts +4 -4
  136. package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +1 -1
  137. package/dist/components/stream/ordinalSceneBuilders/timelineScene.d.ts +1 -1
  138. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +9 -8
  139. package/dist/components/stream/ordinalTypes.d.ts +65 -33
  140. package/dist/components/stream/pipelineDecay.d.ts +2 -1
  141. package/dist/components/stream/pipelinePulse.d.ts +2 -1
  142. package/dist/components/stream/pipelineTransitions.d.ts +16 -4
  143. package/dist/components/stream/renderers/colorUtils.d.ts +20 -0
  144. package/dist/components/stream/types.d.ts +58 -17
  145. package/dist/components/stream/xySceneBuilders/areaScene.d.ts +3 -2
  146. package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -1
  147. package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +2 -1
  148. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -1
  149. package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +3 -2
  150. package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -1
  151. package/dist/components/stream/xySceneBuilders/lineScene.d.ts +2 -1
  152. package/dist/components/stream/xySceneBuilders/mixedScene.d.ts +2 -1
  153. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -1
  154. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -1
  155. package/dist/components/stream/xySceneBuilders/types.d.ts +35 -26
  156. package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -1
  157. package/dist/components/types/marginType.d.ts +15 -0
  158. package/dist/geo.min.js +1 -1
  159. package/dist/geo.module.min.js +1 -1
  160. package/dist/network.min.js +1 -1
  161. package/dist/network.module.min.js +1 -1
  162. package/dist/ordinal.min.js +1 -1
  163. package/dist/ordinal.module.min.js +1 -1
  164. package/dist/realtime.min.js +1 -1
  165. package/dist/realtime.module.min.js +1 -1
  166. package/dist/semiotic-ai.min.js +1 -1
  167. package/dist/semiotic-ai.module.min.js +1 -1
  168. package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +1 -0
  169. package/dist/semiotic-themes.d.ts +2 -1
  170. package/dist/semiotic-themes.min.js +1 -1
  171. package/dist/semiotic-themes.module.min.js +1 -1
  172. package/dist/semiotic-utils.min.js +1 -1
  173. package/dist/semiotic-utils.module.min.js +1 -1
  174. package/dist/semiotic-xy.d.ts +2 -0
  175. package/dist/semiotic.d.ts +3 -3
  176. package/dist/semiotic.min.js +1 -1
  177. package/dist/semiotic.module.min.js +1 -1
  178. package/dist/server.min.js +1 -1
  179. package/dist/server.module.min.js +1 -1
  180. package/dist/test-utils/canvasMock.d.ts +10 -2
  181. package/dist/xy.min.js +1 -1
  182. package/dist/xy.module.min.js +1 -1
  183. package/package.json +38 -32
  184. package/dist/components/types/annotationTypes.d.ts +0 -145
  185. package/dist/components/types/generalTypes.d.ts +0 -241
  186. package/dist/components/types/interactionTypes.d.ts +0 -72
  187. package/dist/components/types/networkTypes.d.ts +0 -174
  188. package/dist/components/types/ordinalTypes.d.ts +0 -112
  189. package/dist/semiotic-statisticalOverlays-DGX_WWc5.js +0 -1
@@ -1 +1 @@
1
- import*as e from"react";import{useRef as t,useMemo as n,useEffect as o,useSyncExternalStore as r,createContext as i,useContext as a,useCallback as s,useState as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{select as h}from"d3-selection";import{brushX as g,brushY as f,brush as p}from"d3-brush";import{scaleOrdinal as y,scaleLinear as m,scaleLog as v,scaleTime as b,scaleBand as x,scaleSequential as k}from"d3-scale";import{quadtree as w}from"d3-quadtree";import{interpolatePlasma as A,interpolateViridis as S,interpolatePurples as O,interpolateOranges as E,interpolateGreens as j,interpolateReds as C,interpolateBlues as P,schemeSet3 as M,schemeTableau10 as _,schemeCategory10 as L}from"d3-scale-chromatic";import{bin as T,quantile as B,min as D,groups as N,max as I,sum as $,mean as H,group as R}from"d3-array";import{packEnclose as F,hierarchy as W,partition as z,pack as G,treemap as Y,treemapBinary as q,cluster as X,tree as V}from"d3-hierarchy";import{area as U,curveCatmullRom as K,curveCardinal as Q,curveBasis as Z,curveStepBefore as J,curveStepAfter as ee,curveStep as te,curveMonotoneY as ne,curveMonotoneX as oe,curveLinear as re,arc as ie,line as ae,curveNatural as se,pie as le}from"d3-shape";import ce from"regression";import{interpolateNumber as ue}from"d3-interpolate";import{forceLink as de,forceSimulation as he,forceManyBody as ge,forceCenter as fe,forceX as pe,forceY as ye}from"d3-force";import{ribbon as me,chord as ve}from"d3-chord";function be(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function xe(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function ke({width:r,height:i,totalWidth:a,totalHeight:s,margin:l,dimension:c,scales:u,onBrush:d,binSize:y,snap:m,binBoundaries:v,snapDuring:b,streaming:x}){const k=t(null),w=t(null),A=t(d);A.current=d;const S=t(u);S.current=u;const O=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),E=t(O);E.current=O;const j=t(!1),C=t(null);return o(()=>{if(!k.current)return;const e=h(k.current).select(".brush-g"),t="x"===c?g():"y"===c?f():p();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(j.current)return;const o=S.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=n.selection;a=[o.x.invert(e),o.x.invert(t)],s=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;a=[o.x.invert(0),o.x.invert(r)],s=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;a=[o.x.invert(e),o.x.invert(r)],s=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=E.current;r&&r.length>0?a=function(e,t){return 0===t.length?e:[be(e[0],t),xe(e[1],t)]}(a,r):y&&y>0&&(a=[Math.floor(a[0]/y)*y,Math.ceil(a[1]/y)*y]);const i=o.x(a[0]),s=o.x(a[1]);if(j.current=!0,"x"===c)e.call(t.move,[i,s]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[s,o[1][1]]])}j.current=!1}const l={x:a,y:s};C.current=l,A.current(l)}),e.call(t),w.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),w.current=null}},[r,i,c,m,y,b]),o(()=>{if(!(x&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const e=C.current,t=u.x.domain()[0],n=h(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===m){const e=E.current;e&&e.length>0?o=xe(t,e):y&&y>0&&(o=Math.ceil(t/y)*y)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),a=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[i,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[a,o]])}if(j.current=!1,r){const t={x:[o,e.x[1]],y:e.y};C.current=t,A.current(t)}},[u,x,c,m,y]),e.createElement("svg",{ref:k,width:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class we{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class Ae{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[i]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class Se{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Oe(e,t,n,o,r){const i=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function Ee(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function je(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Ce(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const Me={category10:L,tableau10:_,set3:M,blues:P,reds:C,greens:j,oranges:E,purples:O,viridis:S,plasma:A},_e=L,Le=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Te=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Be=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function De(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Be.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):_e[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%_e.length]}function Ne(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const i=Me[n]||Me.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:_e;return y().domain(o).range(e).unknown("#999")}}function Ie(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}function $e(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}function He(e,t,n){var o;const r=null!==(o=e.duration)&&void 0!==o?o:500,i=n-t;return r>i?1-i/r:0}function Re(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Fe(e,t){return Math.min((e-t.startTime)/t.duration,1)}function We(e,t,n){return e+(t-e)*n}function ze(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ge(e,t,n){var o,r,i,a;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(a=null!==(r=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==r?r:null===(i=t.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ye(e,t,n,o,r,i){const a=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||a.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:r,datum:c,group:i}}function qe(e,t,n,o,r,i,a,s){const l=[];for(const i of e){const e=n(i),a=o(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const c=t.x(e),u=s?s(i):r;l.push({px:c,topY:t.y(a),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:a}}function Xe(e,t,n,o,r,i,a){const s=n(e),l=o(e);if(null==s||null==l||Number.isNaN(s)||Number.isNaN(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function Ve(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function Ue(e,t,n,o,r,i,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function Ke(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],r=[];for(const n of t){const t=e.getX(n),i=e.getY(n);if(null==t||null==i||Number.isNaN(t)||Number.isNaN(i))continue;const a=e.getBounds(n),s=e.scales.x(t);if(a&&0!==a)o.push([s,e.scales.y(i+a)]),r.push([s,e.scales.y(i-a)]);else{const t=e.scales.y(i);o.push([s,t]),r.push([s,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function Qe(e,t,n,o){var r;if(!e.config.pointStyle)return;const i=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=Xe(a,e.scales,e.getX,i,s,o,l);c&&n.push(c)}}}const Ze={blues:P,reds:C,greens:j,viridis:S},Je=new Map;class et{constructor(e){if(this.xExtent=new Se,this.yExtent=new Se,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this.config=e,this.buffer=new Ae(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=je(e.timeAccessor||e.xAccessor,"time"),this.getY=je(e.valueAccessor||e.yAccessor,"value")):(this.getX=je(e.xAccessor,"x"),this.getY=je(e.yAccessor,"y")),this.getGroup=Pe(e.groupAccessor),this.getCategory=Pe(e.categoryAccessor),this.getSize=e.sizeAccessor?je(e.sizeAccessor,"size"):void 0,this.getColor=Pe(e.colorAccessor),this.getBounds=e.boundsAccessor?je(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?je(e.y0Accessor,"y0"):void 0,this.getPointId=Pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?je(e.openAccessor,"open"):void 0,this.getHigh=je(e.highAccessor,"high"),this.getLow=je(e.lowAccessor,"low"),this.getClose=n?je(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?je(this.config.timeAccessor||this.config.xAccessor,"time"):je(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,a,s;const{config:l,buffer:c}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(n=l.xExtent[0])&&void 0!==n?n:d[0],null!==(o=l.xExtent[1])&&void 0!==o?o:d[1]]:d,f=l.yExtent?[null!==(r=l.yExtent[0])&&void 0!==r?r:h[0],null!==(i=l.yExtent[1])&&void 0!==i?i:h[1]]:h;const p=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!p&&c.size>0)if(l.normalize)f=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)f=this._stackExtentCache.yDomain;else{const t=this.groupData(u),n=new Map;let o=0;for(const e of t)for(const t of e.data){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=(n.get(e)||0)+r;n.set(e,i),i>o&&(o=i)}f=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:f}}}else if("bar"===l.chartType&&l.binSize&&!p&&c.size>0){const[,e]=function(e,t,n,o,r){const i=Oe(e,t,n,o,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(c,this.getX,this.getY,l.binSize,this.getCategory);f=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!p&&c.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;f=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!p&&f[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>f[1]&&(f[1]=t+n),f[0]>t-n&&(f[0]=t-n))}const e=f[1]-f[0],t=e>0?e*l.extentPadding:1,n=null===(a=l.yExtent)||void 0===a?void 0:a[0],o=null===(s=l.yExtent)||void 0===s?void 0:s[1];f=[null!=n?f[0]:f[0]-t,null!=o?f[1]:f[1]+t],"log"===l.yScaleType&&0>=f[0]&&h[0]>0&&(f[0]=null!=n?f[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];f[0]!==1/0&&f[1]!==-1/0||(f=[0,1]);const y="streaming"===l.runtimeMode,x=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(y)if("x"==("up"===(k=l.arrowOfTime)||"down"===k?"y":"x")){const t="right"===l.arrowOfTime?[x,e.width-x]:[e.width-x,x];this.scales={x:m().domain(g).range(t),y:m().domain(f).range([e.height-x,x])}}else{const t="down"===l.arrowOfTime?[x,e.height-x]:[e.height-x,x];this.scales={x:m().domain(f).range([x,e.width-x]),y:m().domain(g).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)};this.scales={x:t(l.xScaleType,g,[x,e.width-x]),y:t(l.yScaleType,f,[e.height-x,x])}}var k;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,et.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let r=0;for(const e of this.scene)"point"===e.type&&(o[r++]=e);this._quadtree=w().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),a=this.scales.y.range(),s=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:s(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:r}=this;if(!r||0===t.length)return[];const i={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),r=[],i=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=Ke(e,t.data,t.key);n&&r.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);i&&i.length>0&&(o.colorThresholds=i),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),r.push(o)}return Qe(e,o,r),r}(i,t);case"area":return function(e,t){const n=e.groupData(t),o=[],r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),a=qe(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(a.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return Qe(e,n,o),o}(i,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set,i=e.scales.y.domain()[0],a=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=qe(t.data,e.scales,e.getX,e.getY,i,n,t.key,a);e.config.gradientFill&&(r.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return Qe(e,n,o),o}(i,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:r,stackedTops:i}=function(e,t,n,o,r,i,a){var s;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(s=u.get(o.key))||void 0===s?void 0:s.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,f=new Map;for(const e of c)f.set(e,0);for(const n of e){const e=u.get(n.key),o=[],s=[],l=new Map;for(const n of c){let r=e.get(n)||0;const a=f.get(n);i&&(r/=d.get(n));const c=a+r,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),f.set(n,c),l.set(n,c)}g.set(n.key,l);const p={type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key};a&&(p.curve=a),h.push(p)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),a=r;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=i.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Qe(e,n,a,o)}return a}(i,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},s=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(s=i(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(r);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=Xe(r,e.scales,e.getX,e.getY,s,t,l);c&&n.push(c)}return n}(i,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,r,i;const a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=Math.max(1,Math.floor(null!==(r=e.config.heatmapYBins)&&void 0!==r?r:20)),l=null!==(i=e.config.heatmapAggregation)&&void 0!==i?i:"count",c=je(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/a,p=(g-h||1)/s,y=a*s;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],r=e.getX(o),i=e.getY(o);if(!isFinite(r)||!isFinite(i))continue;const l=Math.min(Math.floor((r-u)/f),a-1),d=Math.min(Math.floor((i-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+l;m[g]++;const y=c(o);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/a,A=n.height/s,S=e.config.showValues,O=e.config.heatmapValueFormat,E=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>n;n++){const o=t+n;if(0===m[o])continue;let r;switch(l){case"sum":r=v[o];break;case"mean":r=v[o]/m[o];break;default:r=m[o]}const i=(r-b)/k;E.push(Ue(n*w,(s-1-e)*A,w,A,`rgb(${220-(180*i+.5)|0},${220-(100*i+.5)|0},${255-(50*i+.5)|0})`,{xi:n,yi:e,value:r,count:m[o],sum:v[o]},S?{value:r,showValues:!0,valueFormat:O}:void 0))}}return E}(e,t,n);if(0===t.length)return[];const o=je(e.config.valueAccessor,"value"),r=Ce(e.config.xAccessor,"x"),i=Ce(e.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],r=a.get(l[e]),i=s.get(c[e]);if(void 0===r||void 0===i)continue;const d=o(n),h=i*u+r,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Ze?e:"blues";let n=Je.get(t);if(n)return n;n=Array(256);const o=Ze[t]||P;for(let e=0;256>e;e++)n[e]=o(e/255);return Je.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"),S=255/(w-k||1),O=n.width/u,E=n.height/d,j=e.config.showValues,C=e.config.heatmapValueFormat,M=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;M.push(Ue(o*O,(d-1-(n-o)/u)*E,O,E,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:C}:void 0))}return M}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Oe(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),a=Array.from(t).filter(e=>!i.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const i=[],a=e.scales,[s,l]=a.x.domain();for(const t of o.values()){const o=Math.max(t.start,s),c=Math.min(t.end,l);if(o>=c)continue;const u=a.x(o),d=a.x(c),h=Math.abs(d-u),g=h>2?1:0,f=Math.min(u,d)+g/2,p=Math.max(h-g,1);if(p>0)if(r&&t.categories.size>0){let o=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r);i.push(Ve(f,Math.min(l,c),p,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[s])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),o+=r}}else{const e=a.y(0),n=a.y(t.total);i.push(Ve(f,Math.min(e,n),p,Math.abs(e-n),{fill:"#007bff"},{binStart:t.start,binEnd:t.end,total:t.total}))}}const c=new Set;for(const e of o.values())c.add(e.start),c.add(e.end);return{nodes:i,binBoundaries:Array.from(c).sort((e,t)=>e-t)}}(i,t);return this._barCategoryCache=null!==(n=i.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,r,i;const a=[],s=e.config.swarmStyle||{},l=null!==(n=s.radius)&&void 0!==n?n:3,c=null!==(o=s.fill)&&void 0!==o?o:"#007bff",u=null!==(r=s.opacity)&&void 0!==r?r:.7,d=s.stroke,h=s.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const r=e.scales.x(t),s=e.scales.y(o);let g=c;if(e.getCategory){const t=e.getCategory(n);g=(null===(i=e.config.barColors)||void 0===i?void 0:i[t])||g}const f={type:"point",x:r,y:s,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(f.pointId=e.getPointId(n)+""),a.push(f)}return a}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const a=[],s=e.scales,l=e.config.waterfallStyle,c=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===c.length)return a;const u=null!==(o=null==l?void 0:l.positiveColor)&&void 0!==o?o:"#28a745",d=null!==(r=null==l?void 0:l.negativeColor)&&void 0!==r?r:"#dc3545",h=null!==(i=null==l?void 0:l.gap)&&void 0!==i?i:1,g=null==l?void 0:l.stroke,f=null==l?void 0:l.strokeWidth;let p=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),y=p+i;let m;m=c.length-1>t?e.getX(c[t+1])-r:t>0?r-e.getX(c[t-1]):0;const v=s.x(r),b=0!==m?s.x(r+m):v+n.width/10,x=Math.min(v,b)+h/2,k=Math.max(v,b)-h/2-x;if(0>=k){p=y;continue}const w=s.y(p),A=s.y(y);a.push(Ve(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:f},Object.assign(Object.assign({},o),{baseline:p,cumEnd:y,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),p=y}return a}(i,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const r=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(r||e.getOpen&&e.getClose))return[];const i=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=r?s:a.upColor||"#28a745",c=r?s:a.downColor||"#dc3545",u=r?s:a.wickColor||"#333",d=a.wickWidth||(r?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=r?0:null!==(o=a.bodyWidth)&&void 0!==o?o:0;if(!r&&null==a.bodyWidth&&h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else r||null!=a.bodyWidth||(g=6);for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=r?o:e.getOpen(n),h=r?a:e.getClose(n);if(!r&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};r&&(p.isRange=!0),i.push(p)}return i}(i,t);default:return[]}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?$e(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,r;const i=n.length;if(1>=i)return;const a=new Map;for(let e=0;n.length>e;e++)a.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let r=!1;for(let n=0;t.length>n;n++){const s=a.get(t[n]);null!=s?(o[n]=$e(e,s,i),1>o[n]&&(r=!0)):o[n]=1}r&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const r=Array(o);let s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(r[n]=$e(e,o,i),1>r[n]&&(s=!0)):r[n]=1}s&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=a.get(n);if(null!=t){const n=$e(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=$e(e,t,i);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;else{const e=null!==(r=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const a="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(r=e.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(i=e.glowRadius)&&void 0!==i?i:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0;for(const n of t){const t=c.get(n);if(null==t)continue;const i=o.get(t);if(null==i)continue;const s=He(e,i,a);s>r&&(r=s)}r>0&&(n._pulseIntensity=r,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=He(e,r,a);i>0&&(n._pulseIntensity=i,n._pulseColor=s,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=e.duration)&&void 0!==n?n:500,i=t.peek();return null!=i&&r>o-i}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var r,i,a;n.clear(),o.clear();for(let s=0;t.length>s;s++){const l=t[s],c=Ge(e,l,s);c&&("point"===l.type?n.set(c,{x:l.x,y:l.y,r:l.r,opacity:l.style.opacity}):"rect"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:l.style.opacity}):"heatcell"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:null===(r=l.style)||void 0===r?void 0:r.opacity}):"candlestick"===l.type?n.set(c,{x:l.x,y:l.openY}):"line"===l.type?o.set(c,{path:l.path.map(e=>[e[0],e[1]]),opacity:null===(i=l.style)||void 0===i?void 0:i.opacity}):"area"===l.type&&o.set(c,{topPath:l.topPath.map(e=>[e[0],e[1]]),bottomPath:l.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=l.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],r=Ge(this.transitionContext,t,e);r&&("point"===t.type?this.prevPositionMap.set(r,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(r,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(r,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(r,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(r,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r){var i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,P,M,_,L;if(0===o.size&&0===r.size)return n;const T=null!==(i=t.duration)&&void 0!==i?i:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let B=!1;const D=new Set,N=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=Ge(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(N.add(A),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];B=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];B=!0}i._targetOpacity=null!==(a=i.style.opacity)&&void 0!==a?a:1,i._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s:i.style.opacity)&&void 0!==l?l:1}else i._targetOpacity=null!==(c=i.style.opacity)&&void 0!==c?c:1,i._startOpacity=0,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;continue}const S=o.get(A);if("point"===i.type)if(S){D.add(A);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=null!==(u=i.style.opacity)&&void 0!==u?u:1,S.x===e.x&&S.y===e.y&&S.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=S.x,i.y=S.y,i.r=null!==(d=S.r)&&void 0!==d?d:i.r,B=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("rect"===i.type)if(S){D.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(g=i.style.opacity)&&void 0!==g?g:1,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(f=S.w)&&void 0!==f?f:i.w,i.h=null!==(p=S.h)&&void 0!==p?p:i.h,B=!0)}else i._targetOpacity=null!==(y=i.style.opacity)&&void 0!==y?y:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("heatcell"===i.type)if(S){D.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(v=null===(m=i.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(b=S.w)&&void 0!==b?b:i.w,i.h=null!==(x=S.h)&&void 0!==x?x:i.h,B=!0)}else i._targetOpacity=null!==(w=null===(k=i.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,i.style=Object.assign(Object.assign({},i.style||{}),{opacity:0}),B=!0}for(const[e,t]of r)if(!N.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(A=t.opacity)&&void 0!==A?A:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(S=t.opacity)&&void 0!==S?S:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}for(const[e,t]of o)if(!D.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(O=t.r)&&void 0!==O?O:3,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(j=t.w)&&void 0!==j?j:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(P=t.opacity)&&void 0!==P?P:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(M=t.w)&&void 0!==M?M:0,h:null!==(_=t.h)&&void 0!==_?_:0,fill:"#999",datum:null,style:{opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}B=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),B&&(n.activeTransition={startTime:ze(),duration:T}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var r,i,a,s,l;if(!n.activeTransition)return!1;const c=Fe(e,n.activeTransition),u=Re(c,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=We(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=We(n.x,e._targetX,u),e.y=We(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=We(n.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=We(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=We(n.x,e._targetX,u),e.y=We(n.y,e._targetY,u),void 0!==n.w&&(e.w=We(n.w,e._targetW,u)),void 0!==n.h&&(e.h=We(n.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:We(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=We(n.x,e._targetX,u),e.y=We(n.y,e._targetY,u),void 0!==n.w&&(e.w=We(n.w,e._targetW,u)),void 0!==n.h&&(e.h=We(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(s=e._startOpacity)&&void 0!==s?s:0;e.style=Object.assign(Object.assign({},e.style),{opacity:We(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=We(t[o][0],n[o][0],u),e.path[o][1]=We(t[o][1],n[o][1],u)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:We(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=We(t[n][0],o[n][0],u),e.topPath[n][1]=We(t[n][1],o[n][1],u);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=We(n[t][0],r[t][0],u),e.bottomPath[t][1]=We(n[t][1],r[t][1],u)}}if(c>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const r=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Le,i=new Map;for(let e=0;n.length>e;e++)i.set(n[e],r[e%r.length]);return this._colorMapCache={key:o,map:i,version:this._ingestVersion},i}resolveLineStyle(e,t){const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}return n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}if(o&&"object"==typeof o)return{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2};const r=this.resolveGroupColor(e)||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Le,o=n[this._groupColorMap.size%n.length];return this._groupColorMap.set(e,o),o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,r;const i=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let a=!1;Object.assign(this.config,e);const s="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(s||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const l=s||!Ee(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=s||!Ee(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(r=i.yAccessor)&&void 0!==r?r:i.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=je(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=je(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=je(this.config.xAccessor,"x"),this.getY=je(this.config.yAccessor,"y")),a=!0)}if("groupAccessor"in e&&!Ee(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Pe(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!Ee(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Pe(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!Ee(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?je(this.config.sizeAccessor,"size"):void 0,a=!0),"colorAccessor"in e&&!Ee(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!Ee(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?je(this.config.y0Accessor,"y0"):void 0,a=!0),"pointIdAccessor"in e&&!Ee(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Pe(this.config.pointIdAccessor):void 0,a=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!Ee(e.openAccessor,i.openAccessor)||"closeAccessor"in e&&!Ee(e.closeAccessor,i.closeAccessor)||"highAccessor"in e&&!Ee(e.highAccessor,i.highAccessor)||"lowAccessor"in e&&!Ee(e.lowAccessor,i.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?je(this.config.openAccessor,"open"):void 0,this.getHigh=je(this.config.highAccessor,"high"),this.getLow=je(this.config.lowAccessor,"low"),this.getClose=t?je(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){a=!0;break}}a&&(this.needsFullRebuild=!0)}}function tt(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function nt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ot(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function rt(e,t){const n=ot(e);if(!n)return!1;const o=ot(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function it(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function at(e,t,n,o,r){const i=Math.max(o,r+5,12),a=t-i,s=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,g)=>{if(r>s||a>h||i>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,a=e.y-n,s=Math.sqrt(i*i+a*a);nt(e.r,o)>=s&&d>s&&(u=e,d=s),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}function st(e,t,n,o=30,r,i=0){let a=null;if(r){const e=at(r,t,n,o,i);e&&(a={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=ct(i,t,n,o);break;case"line":e=ut(i,t,n,o);break;case"rect":e=ht(i,t,n);break;case"heatcell":e=gt(i,t,n);break;case"area":if(!1===i.interactive)break;e=pt(i,t,n);break;case"candlestick":e=ft(i,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function lt(e,t,n){if(0===e.length)return null;const o=yt(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[a,s]=e[r],[l,c]=e[i];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function ct(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function ut(e,t,n,o=30){var r,i,a,s;if(0===e.path.length)return null;const l=yt(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const r=Math.max(0,l-1),i=Math.min(e.path.length-2,l);for(let a=r;i>=a;a++){const[r,i]=e.path[a],[s,l]=e.path[a+1],c=dt(t,n,r,i,s,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(s=null!==(i=null===(r=e.style)||void 0===r?void 0:r.strokeWidth)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.lineWidth)&&void 0!==s?s:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function dt(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function ht(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function gt(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function ft(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+a*a)}}return null}function pt(e,t,n){if(0===e.topPath.length)return null;const o=yt(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],a=t-r,s=n-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function yt(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function mt(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&a.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:a}}function vt(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}function bt(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?xt(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?xt(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function xt(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function kt(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}function wt(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}et.QUADTREE_THRESHOLD=500;const At={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function St(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,At[n])(o(e,t)),r}function Ot(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Et(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function jt({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function Ct(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[f,p]=e.useState(0),y=e.useCallback((e,t)=>{g(e),p(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,f=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=St(t,u,d,h),b=Et(t,r,i),x=i&&i.size>0&&i.has(t.label);f.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===a&&u===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),f})(t,o,r,i,a,s,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let f=0;t.label&&(f+=16);const p=((t,n,o,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;f.forEach((t,u)=>{const x=St(t,u,h,g),k=Et(t,r,i),w=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&y>0&&y+A>d&&(m++,y=0),p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===a&&u===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.createElement(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),y+=A});let x=0,k=0;for(const e of f){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:p,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,a,s,l,c,n,u,d,o);f+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:f,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=f+12});let f=h>o?0:Math.max(0,(o-h)/2);const p=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(p.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},i.label)),f+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${f},0)`},o.items)),f+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:f,y1:-8,x2:f,y2:(o.totalHeight||n)+0+8})),f+=12}),e.createElement("g",null,p)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},l),m)}function Pt(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===a||"bottom"===a;let f,p;return"left"===a?(f=4,p=i.top):"top"===a?(f=0,p=s?32:8):"bottom"===a?(f=0,p=r-i.bottom+50):(f=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${f}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(n)?e.createElement(jt,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(Ct,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)}function Mt(e){return"string"==typeof e?{type:e}:e}function _t({orient:t,config:o,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=n(()=>{if(0===r.length)return null;const n=i.domain(),o=a-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),f=(o-g)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+y*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+y*f,x2:c,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-f-g:m+f,width:Math.abs(o-n),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-f-g:m+f,x2:r,y2:"top"===t?m-f:m+f+g,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+y*(f+g/2),y1:c,x2:m+y*(f+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:c,x2:m+y*(f+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-f-g:m+f,y:Math.min(n,o),width:g,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-f-g:m+f,y1:r,x2:"left"===t?m-f:m+f+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=T().domain(n).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,r)=>{if(null==n.x0||null==n.x1)return null;const a=n.length/d*o;if(c){const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${e}`),n.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function Lt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Tt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Bt(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Tt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,p=a?u?[a]:Lt(a,c):[],y=i?u?[i]:Lt(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t)))),v=p.length*f),y.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t))));let k=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*f+(y.length>0?f:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*f;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),k)}(l,v,b,h))}function Dt(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Nt(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function It(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function $t(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Nt(e,n),c=It(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Ht(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Rt={linear:re,monotoneX:oe,monotoneY:ne,step:te,stepAfter:ee,stepBefore:J,basis:Z,cardinal:Q,catmullRom:K};function Ft(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,P,M,_,L,T,B,D,N,I,$,H,R,W,z,G,Y,q,X,V,K,Q,Z,J;switch(t.type){case"label":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Ht(i,a,o)?e.createElement(Dt,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Ht(i,a,o)?e.createElement(Dt,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Nt(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"top";let s;return s="bottom"===a?(o.height||0)-4:"center"===a?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:s,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=It(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"right";let s,l;return"left"===a?(s=4,l="start"):"center"===a?(s=(o.width||0)/2,l="middle"):(s=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:s,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Nt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=F(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Nt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Nt(n,o),s=It(n,o);if(null==i||null==s)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||a;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:l},c))}))}case"bracket":{const r=Nt(t,o),i=It(t,o);return e.createElement(Dt,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",f=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const p=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,y=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!p||!y)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],f+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(f,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?ce.polynomial(f,{order:t.order||2}):ce.linear(f)).points;const b=v.map(([e,t])=>`${p(e)},${y(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:p(v[v.length-1][0])+4,y:y(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(f=null==r?void 0:r(t.y0))&&void 0!==f?f:0,a=null!==(p=null==r?void 0:r(t.y1))&&void 0!==p?p:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",a=null!==(m=null===(y=o.scales)||void 0===y?void 0:y.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,s=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!a||!s)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=Rt[o.curve||"linear"]||re,g=U().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const f=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:f,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(S=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==S?S:null===(O=o.scales)||void 0===O?void 0:O.time,s=null!==(j=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==j?j:null===(C=o.scales)||void 0===C?void 0:C.value;if(!a||!s)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(P=t.threshold)&&void 0!==P?P:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(M=t.fillOpacity)&&void 0!==M?M:.1,m=t.anomalyColor||"#ef4444",v=null!==(_=t.anomalyRadius)&&void 0!==_?_:6,b=s(c+h*d),x=s(g),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},f&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const r=Nt(t,o),i=It(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(T=null===(L=o.scales)||void 0===L?void 0:L.x)&&void 0!==T?T:null===(B=o.scales)||void 0===B?void 0:B.time,l=null!==(N=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==N?N:null===(I=o.scales)||void 0===I?void 0:I.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=ce.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),y=null!==($=t.confidence)&&void 0!==$?$:.95,m=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,v=null!==(H=t.steps)&&void 0!==H?H:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-f,2)/p:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),O=`${s(b)},${l(u(b))}`,E=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(R=t.fillOpacity)&&void 0!==R?R:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${S}`,fill:"none",stroke:E,strokeWidth:null!==(W=t.strokeWidth)&&void 0!==W?W:2,strokeDasharray:null!==(z=t.strokeDasharray)&&void 0!==z?z:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:s(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:E,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=$t(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ht(r,i,o))return null;const a=null!==(G=t.dx)&&void 0!==G?G:0,s=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(q=t.width)&&void 0!==q?q:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(V=t.content)&&void 0!==V?V:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=$t(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(K=o.scales)||void 0===K?void 0:K.o,a=null===(Q=o.scales)||void 0===Q?void 0:Q.x,s=null===(Z=o.scales)||void 0===Z?void 0:Z.y,l=(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:(null==s?void 0:s.bandwidth)?s:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(J=t.opacity)&&void 0!==J?J:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===a)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}}}let Wt={positions:new Map};const zt=new Set;function Gt(){for(const e of zt)e()}function Yt(e,t){const n=Wt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Wt.positions);o.delete(e),Wt={positions:o},Gt()}function qt(e,t){const n=Wt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Wt.positions);o.delete(e),Wt={positions:o},Gt()}function Xt(){return Wt}function Vt(e){return zt.add(e),()=>zt.delete(e)}const Ut={positions:new Map};function Kt(){return()=>{}}function Qt(){return Ut}function Zt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Jt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function en(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,f=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||h||tn,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=l.x.ticks(Math.min(r,Math.max(2,Math.floor(o/70)))),a=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,a)})),c=s.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return nn(s,Math.max(55,c+8))},[l,u,h,o]),p=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nn(l.y.ticks(Math.min(o,Math.max(2,Math.floor(r/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,r]),y=d&&l,m=c&&l;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,A=(null==b?void 0:b.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&(()=>{var t,n;const i=Zt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),a=Zt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},f.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i})),p.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a})))})(),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:S,strokeWidth:1}),w&&e.createElement("path",{d:Jt("bottom",o,r),fill:"none",stroke:S,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:S,strokeWidth:1}),A&&e.createElement("path",{d:Jt("left",o,r),fill:"none",stroke:S,strokeWidth:1})))}function tn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function nn(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function on(i){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j,legendPosition:C="right",foregroundGraphics:P,marginalGraphics:M,xValues:_,yValues:L,annotations:T,svgAnnotationRules:B,xAccessor:D,yAccessor:N,annotationData:I,pointNodes:$,curve:H,underlayRendered:R,linkedCrosshairName:F,linkedCrosshairSourceId:W,children:z}=i,G=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=g.x.ticks(Math.min(o,Math.max(2,Math.floor(l/70)))),i=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),s=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(s+8,55)):Math.max(55,s+8);let u=nn(a,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[f,g,p,b,l]),Y=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=nn(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=g.y.domain()[1],t=g.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[f,g,p,x,c]),q=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||tn,o=null!==(e=t.ticks)&&void 0!==e?e:5;return nn(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[f,g,p,x,c]),X=t(new Map),V=t(null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0),U=null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0;V.current!==U&&(V.current=U,X.current=new Map);const K=n(()=>{if(!T||0===T.length)return null;const e=Ft(),t={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:D,yAccessor:N,width:l,height:c,data:I,frameType:"xy",pointNodes:$,curve:H,stickyPositionCache:X.current};return T.map((n,o)=>{if(B){const r=B(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[T,B,l,c,D,N,I,g,$,H]),Q=function(e){var t;const n=r(e?Vt:Kt,e?Xt:Qt,e?Xt:Qt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(F);return o(()=>{if(!(null==Q?void 0:Q.locked)||!F)return;const e=e=>{"Escape"===e.key&&qt(F)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Q?void 0:Q.locked,F]),f||w||A||P||M||K&&K.length>0||k||z||Q?e.createElement("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof w?w:"XY Chart"),e.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${h.left},${h.top})`},k&&g&&!R&&(()=>{var t,n;const o=Zt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=Zt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},G.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:c,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})),Y.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:l,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r})))})(),f&&g&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,s=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",f="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=l/Math.max(G.length-1,1),t=G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!R&&r&&!a&&e.createElement("line",{x1:0,y1:c,x2:l,y2:c,stroke:d,strokeWidth:1}),!R&&a&&e.createElement("path",{d:Jt("bottom",l,c),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!s&&("function"==typeof s?s(t.value,n):rt(t.value,n>0?G[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${c})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))}),y&&e.createElement("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},y),!R&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!R&&i&&e.createElement("path",{d:Jt("left",l,c),fill:"none",stroke:d,strokeWidth:1}),Y.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):rt(t.value,n>0?Y[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.createElement("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:l,y1:0,x2:l,y2:c,stroke:d,strokeWidth:1}),q.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):rt(t.value,o>0?q[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${l},${t.pixel})`},e.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},t.label)))}),o&&e.createElement("text",{x:l+h.right-15,y:c/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(90, ${l+h.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),K,M&&g&&_&&L&&e.createElement(e.Fragment,null,M.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(_t,{orient:"top",config:Mt(M.top),values:_,scale:g.x,size:h.top,length:l})),M.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(_t,{orient:"bottom",config:Mt(M.bottom),values:_,scale:g.x,size:h.bottom,length:l})),M.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(_t,{orient:"left",config:Mt(M.left),values:L,scale:g.y,size:h.left,length:c})),M.right&&e.createElement("g",{transform:`translate(${l}, 0)`},e.createElement(_t,{orient:"right",config:Mt(M.right),values:L,scale:g.y,size:h.right,length:c}))),P,Q&&Q.sourceId!==W&&(null==g?void 0:g.x)&&(()=>{const t=g.x(Q.xValue);if(null==t||0>t||t>l)return null;const n=Q.locked;return e.createElement("line",{x1:t,y1:0,x2:t,y2:c,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),z),w&&e.createElement("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),Pt({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:w,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j})):null}function rn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const an="undefined"==typeof window||"undefined"==typeof document,sn=e.createContext(null);function ln({children:t}){const[n,o]=e.useState(!1),r=e.useMemo(()=>({visible:n,setVisible:o}),[n]);return e.createElement(sn.Provider,{value:r},t)}function cn(){return e.useContext(sn)}const un={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function dn(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function hn(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const gn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},fn={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},pn={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},yn={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},mn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},vn={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},bn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},xn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function kn({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[a,s]=e.useState(!1),l=cn(),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=a||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{a||c||s(!0)},[a,c]),f=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:un}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:un,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",t.length," elements)"));const p=function(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O;const E=[];if(!Array.isArray(e))return E;for(const j of e)if(j&&"object"==typeof j)try{switch(j.type){case"point":E.push({label:"Point",values:{x:j.x,y:j.y}});break;case"line":{const e=j.path,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=j.topPath,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=j.datum&&"object"==typeof j.datum?j.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;E.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":E.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":E.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=j.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=j.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=j.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":E.push({label:"Node",values:{id:null!==(h=null===(d=j.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=j.cx)&&void 0!==g?g:j.x,y:null!==(f=j.cy)&&void 0!==f?f:j.y}});break;case"arc":E.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":E.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":E.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=j.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=j.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=j.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return E}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${gn(e.min)} to ${gn(e.max)}, mean ${gn(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(p.length,y),v=p.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:f,style:fn,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:mn},e.createElement("caption",{style:xn},"First ",v.length," of ",p.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"type"),x.map(t=>e.createElement("th",{key:t,style:vn},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.label),x.map(n=>{return e.createElement("td",{key:n,style:bn},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":gn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function wn({nodes:t,edges:n,chartType:o,tableId:r,chartTitle:i}){var a,s,l,c,u,d,h,g,f,p,y,m,v,b;const[x,k]=e.useState(!1),w=cn(),A=null!==(a=null==w?void 0:w.visible)&&void 0!==a&&a,S=x||A,O=i?"Data summary for "+i:r?`Data summary for ${o} ${r}`:"Data summary for "+o,E=e.useRef(null),j=e.useCallback(()=>{x||A||k(!0)},[x,A]),C=e.useCallback(e=>{var t;A||(null===(t=E.current)||void 0===t?void 0:t.contains(e.relatedTarget))||k(!1)},[A]);if(!t||0===t.length)return r?e.createElement("span",{id:r,tabIndex:-1,style:un}):null;if(!S)return e.createElement("div",{id:r,tabIndex:-1,onFocus:j,style:un,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>k(!0)},"View data summary (",t.length," nodes, ",n.length," edges)"));const P=Array.isArray(t)?t:[],M=Array.isArray(n)?n:[],_=new Map,L=new Map,T=new Map,B=new Map;for(const e of M){if(!e||"object"!=typeof e)continue;const t=null!==(s=e.datum)&&void 0!==s?s:e,n="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,o="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";L.set(e,(null!==(u=L.get(e))&&void 0!==u?u:0)+1),B.set(e,(null!==(d=B.get(e))&&void 0!==d?d:0)+r)}if(null!=o&&""!==o){const e=o+"";_.set(e,(null!==(h=_.get(e))&&void 0!==h?h:0)+1),T.set(e,(null!==(g=T.get(e))&&void 0!==g?g:0)+r)}}const D=[];for(let e=0;P.length>e;e++){const t=P[e];if(!t||"object"!=typeof t)continue;const n=null!==(p=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==p?p:t.id,o=null!=n?n+"":"node-"+e,r=null!==(y=_.get(o))&&void 0!==y?y:0,i=null!==(m=L.get(o))&&void 0!==m?m:0,a=null!==(v=T.get(o))&&void 0!==v?v:0,s=null!==(b=B.get(o))&&void 0!==b?b:0;D.push({id:o,degree:r+i,inDeg:r,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}D.sort((e,t)=>t.degree-e.degree);let N=0,I=0;if(D.length>0){let e=0;for(const t of D)e+=t.degree,t.degree>I&&(I=t.degree);N=e/D.length}const $=M.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),H=[`${D.length} nodes, ${M.length} edges.`];D.length>0&&H.push(`Mean degree: ${gn(N)}, max degree: ${I}.`);const R=D.slice(0,5);return e.createElement("div",{ref:E,id:r,tabIndex:-1,onBlur:C,style:fn,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>{A&&w&&w.setVisible(!1),k(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},H.join(" ")),e.createElement("table",{role:"table","aria-label":"Node degree summary for "+o,style:mn},e.createElement("caption",{style:xn},"Top ",R.length," of ",D.length," nodes by degree"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"id"),e.createElement("th",{style:vn},"degree"),e.createElement("th",{style:vn},"in"),e.createElement("th",{style:vn},"out"),$&&e.createElement("th",{style:vn},"w. degree"),$&&e.createElement("th",{style:vn},"w. in"),$&&e.createElement("th",{style:vn},"w. out"))),e.createElement("tbody",null,R.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.id),e.createElement("td",{style:bn},t.degree),e.createElement("td",{style:bn},t.inDeg),e.createElement("td",{style:bn},t.outDeg),$&&e.createElement("td",{style:bn},gn(t.wDegree)),$&&e.createElement("td",{style:bn},gn(t.wInDeg)),$&&e.createElement("td",{style:bn},gn(t.wOutDeg)))))))}function An({summary:t}){return t?e.createElement("div",{role:"note",style:un},t):null}function Sn({tableId:t}){return e.createElement("a",{href:"#"+t,style:un,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,un)}},"Skip to data table")}function On({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:un},n)}const En="var(--semiotic-focus, #005fcc)";function jn({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:En,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:En,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:En,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function Cn({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:a,className:s="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,s,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:s,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},a)}function Pn(o){const l=i(null),c=Mn(o);return[function({children:t}){const r=n(()=>Mn(o),[]);return e.createElement(l.Provider,{value:r,children:t})},e=>{var n;const o=null!==(n=a(l))&&void 0!==n?n:c,i=t(e);i.current=e;const u=s(()=>i.current(o.getState()),[o]),d=s(()=>i.current(o.getState()),[o]);return r(o.subscribe,u,d)}]}function Mn(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function _n(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:Ln})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const Ln=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Tn={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Bn={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Dn={mode:"light",colors:{primary:"#0000cc",categorical:Ln,sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[Nn,In]=Pn(e=>({theme:Tn,setTheme(t){e(e=>{if("light"===t)return{theme:Tn};if("dark"===t)return{theme:Bn};if("high-contrast"===t)return{theme:Dn};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Bn:Tn;return{theme:_n(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:_n(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));function $n(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function Hn(e,n,r){const i=t(null),[a,s]=l(null);return o(()=>{if(!n&&!r)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,r]),[i,[n&&a?a.w:e[0],r&&a?a.h:e[1]]]}const Rn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Fn=new WeakMap;let Wn=0,zn=!1,Gn=null,Yn=null,qn=null;function Xn(e,t){var n,o;if(!t)return t;const r=Rn.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(zn)return;if("undefined"==typeof window||"undefined"==typeof document)return;zn=!0;const e=()=>{Wn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Gn=new MutationObserver(e),Gn.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Yn=window.matchMedia("(prefers-color-scheme: dark)"),qn=e,"function"==typeof Yn.addEventListener?Yn.addEventListener("change",qn):"function"==typeof Yn.addListener&&Yn.addListener(qn)}catch(e){}}();let a=Fn.get(i);a&&a.version===Wn||(a={version:Wn,map:new Map},Fn.set(i,a));const s=a.map.get(t);if(void 0!==s)return s;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.map.set(t,l),l}function Vn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Un(r){const i=function(){const[e,t]=l(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),$n(e,e=>t(e.matches))},[]),e}(),a=t(i);a.current=i;const[c,u]=Hn(r.sizeProp,r.responsiveWidth,r.responsiveHeight),d=n(()=>Object.assign(Object.assign({},r.marginDefault),r.userMargin),[r.marginDefault,r.userMargin]),h=u[0]-d.left-d.right,g=u[1]-d.top-d.bottom,f=Vn(r.foregroundGraphics,u,d),p=Vn(r.backgroundGraphics,u,d),y=In(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(r.animate,r.transitionProp),b="semiotic-table-"+e.useId(),x=t(0),k=t(()=>{}),w=s(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);o(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=t(()=>{}),S=t(()=>{}),O=t(null),E=t(0),j=s(()=>{E.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),C=s(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===E.current&&(E.current=requestAnimationFrame(j))},[j]),P=s(()=>{O.current=null,0!==E.current&&(cancelAnimationFrame(E.current),E.current=0),S.current()},[]);o(()=>()=>{O.current=null,0!==E.current&&(cancelAnimationFrame(E.current),E.current=0)},[]);const M=r.themeDirtyRef;return o(()=>{M&&(Wn++,M.current=!0,w())},[y,w,M]),{reducedMotion:i,reducedMotionRef:a,responsiveRef:c,size:u,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:C,onPointerLeave:P}}function Kn(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Qn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Zn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function Jn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function eo(e,t,n,o,r,i){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const to=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=s.style.stroke||"#007bff",u=s.style.strokeWidth||2,d=s.colorThresholds,h=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=u,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const y=null!==(r=s.style.opacity)&&void 0!==r?r:1;eo(e,s.path,c,u,y,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=Zn(s.curve),f=d&&d.length>0&&h&&h.length===s.path.length,p=s._decayOpacities;if(p&&p.length===s.path.length&&!f){e.strokeStyle=c;const m=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let v=0;s.path.length-1>v;v++)e.globalAlpha=.5*(p[v]+p[v+1])*m,e.beginPath(),e.moveTo(s.path[v][0],s.path[v][1]),e.lineTo(s.path[v+1][0],s.path[v+1][1]),e.stroke()}else if(f){let b=null,x=null,k=null,w=null,A=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),A=!0}function O(){A&&(e.stroke(),A=!1)}for(let E=0;s.path.length>E;E++){const[j,C]=s.path[E],P=h[E],M=Jn(P,d,c);if(null!==b&&null!==w&&null!==k){if(M===w)e.lineTo(j,C);else{const _=[];for(const L of d){const T=L.value;(k>T||T>P)&&(T>k||P>T)||k===T||P===T||_.push({t:(T-k)/(P-k)})}_.sort((e,t)=>e.t-t.t);for(const B of _){const D=b+(j-b)*B.t,N=x+(C-x)*B.t,I=Jn(k+(P-k)*Math.min(B.t+1e-4,1),d,c);e.lineTo(D,N),O(),S(I,D,N)}e.lineTo(j,C)}b=j,x=C,k=P,w=M}else S(M,j,C),b=j,x=C,k=P,w=M}O()}else{if(e.beginPath(),!s.strokeGradient||2>s.strokeGradient.colorStops.length||2>s.path.length)e.strokeStyle=c;else{const $=e.createLinearGradient(s.path[0][0],0,s.path[s.path.length-1][0],0);for(const H of s.strokeGradient.colorStops)$.addColorStop(Math.max(0,Math.min(1,H.offset)),H.color);e.strokeStyle=$}if(g)ae().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(s.path);else{const[R,F]=s.path[0];e.moveTo(R,F);for(let W=1;s.path.length>W;W++)e.lineTo(s.path[W][0],s.path[W][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=("string"==typeof s.style.fill?Xn(e,s.style.fill):s.style.fill)||s.style.fill,g&&!f)ae().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(s.path);else{const[G,Y]=s.path[0];e.moveTo(G,Y);for(let q=1;s.path.length>q;q++)e.lineTo(s.path[q][0],s.path[q][1])}const z=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(z,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function no(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function oo(e,t,n=.3){no(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ro(e,t,n=.6){var o,r,i,a,s;if(!no(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function io(e,t,n,o=.35){no(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function ao(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function so(e){if(e.startsWith("#")){const t=4===e.length?e[1]+e[1]+e[2]+e[2]+e[3]+e[3]:e.slice(1,7);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[78,121,167]}function lo(e,t){const n=ao(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=U().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const co=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"area"===e.type);for(const t of s){if(2>t.topPath.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const s=t.style.fill||"#4e79a7",l=t._decayOpacities;if(l&&l.length===t.topPath.length){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;e.fillStyle=s;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(l[o]+l[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(l[n]+l[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const c=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(lo(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=e.createLinearGradient(0,n,0,o);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||r.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const e=so("string"==typeof s?s:"#4e79a7");r.addColorStop(0,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.topOpacity})`),r.addColorStop(1,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.bottomOpacity})`)}e.fillStyle=r,e.globalAlpha=c}else{const n=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=n*c,e.fillStyle=s}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(lo(e,t),io(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=c,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=ao(t.curve);if(e.beginPath(),n)ae().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1}},uo=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?Xn(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Xn(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),ro(e,t),e.globalAlpha=1}}finally{e.restore()}}},ho=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)go(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?Xn(e,t.style.fill):t.style.fill)||"#007bff";const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:o,y:r,w:i,h:a}=t;switch(t.roundedEdge){case"right":e.moveTo(o,r),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+a-n),e.arcTo(o+i,r+a,o+i-n,r+a,n),e.lineTo(o,r+a);break;case"left":e.moveTo(o+i,r),e.lineTo(o+n,r),e.arcTo(o,r,o,r+n,n),e.lineTo(o,r+a-n),e.arcTo(o,r+a,o+n,r+a,n),e.lineTo(o+i,r+a);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+a-n),e.arcTo(o+i,r+a,o+i-n,r+a,n),e.lineTo(o+n,r+a),e.arcTo(o,r+a,o,r+a-n,n);break;default:e.moveTo(o,r+a),e.lineTo(o,r+n),e.arcTo(o,r,o+n,r,n),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+a)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?Xn(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));oo(e,t),e.globalAlpha=1}};function go(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}function fo(e,t,n,o){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:n,time:t,value:n}),o)}function po(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function yo(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const mo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function vo(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${mo[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${mo[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const bo={line:[co,to,uo],area:[co,uo],stackedarea:[co,uo],scatter:[uo],bubble:[uo],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),oo(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):yo(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=po(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[ho],swarm:[uo],waterfall:[(e,t,n,o)=>{var r,i,a;ho(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const l=s[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],r=s[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(a=r.datum)||void 0===a?void 0:a.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const o=t._decayOpacity;if(null!=o&&1!==o&&(e.globalAlpha=o),e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke(),t.isRange){const n=Math.max(2*t.wickWidth,4);e.fillStyle=t.wickColor,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}e.restore()}}],mixed:[co,to,uo]},xo={top:20,right:20,bottom:30,left:40},ko={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white"};function wo(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const Ao={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function So({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:Ao},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const Oo=c(function(r,i){var a,c,d,h,g,f,p,y,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:S,xAccessor:O,yAccessor:E,colorAccessor:j,sizeAccessor:C,groupAccessor:P,lineDataAccessor:M,curve:_,normalize:L,binSize:T,valueAccessor:B,arrowOfTime:D="right",windowMode:N="sliding",windowSize:I=200,timeAccessor:$,xExtent:H,yExtent:R,extentPadding:F=.1,scalePadding:W,sizeRange:z,size:G=[500,300],responsiveWidth:Y,responsiveHeight:q,margin:X,className:V,background:U,lineStyle:K,pointStyle:Q,areaStyle:Z,waterfallStyle:J,swarmStyle:ee,barColors:te,colorScheme:ne,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:ae,lineGradient:se,areaGroups:le,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,showAxes:fe=!0,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:be,yFormat:xe,tickFormatTime:Ae,tickFormatValue:Se,hoverAnnotation:Oe,tooltipContent:Ee,customHoverBehavior:je,customClickBehavior:Ce,enableHover:Pe,hoverRadius:Me=30,tooltipMode:_e,annotations:Le,svgAnnotationRules:Te,showGrid:Be,legend:De,legendHoverBehavior:Ne,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:He,legendPosition:Re,backgroundGraphics:Fe,foregroundGraphics:We,canvasPreRenderers:ze,svgPreRenderers:Ge,title:Ye,categoryAccessor:qe,brush:Xe,onBrush:Ve,decay:Ue,pulse:Ke,transition:Qe,animate:Ze,staleness:Je,heatmapAggregation:tt,heatmapXBins:nt,heatmapYBins:ot,showValues:rt,heatmapValueFormat:it,marginalGraphics:at,pointIdAccessor:ct,xScaleType:ut,yScaleType:dt,accessibleTable:ht=!0,description:gt,summary:ft,linkedCrosshairName:pt,linkedCrosshairSourceId:xt}=r,At=t(!1),St=Un({sizeProp:G,responsiveWidth:Y,responsiveHeight:q,userMargin:X,marginDefault:xo,animate:Ze,transitionProp:Qe,themeDirtyRef:At}),{reducedMotionRef:Ot,responsiveRef:Et,size:jt,currentTheme:Ct,transition:Pt,introEnabled:Mt,tableId:_t,rafRef:Lt,renderFnRef:Tt,scheduleRender:Bt}=St;let Dt=St.margin;if(at){const e=60,t=Object.assign({},St.margin);at.top&&e>t.top&&(t.top=e),at.bottom&&e>t.bottom&&(t.bottom=e),at.left&&e>t.left&&(t.left=e),at.right&&e>t.right&&(t.right=e),Dt=t}const Nt="function"==typeof We?We({size:jt,margin:Dt}):We,It="function"==typeof Fe?Fe({size:jt,margin:Dt}):Fe,$t=jt[0]-Dt.left-Dt.right,Ht=jt[1]-Dt.top-Dt.bottom,Rt=null!=Oe?Oe:Pe,Ft=t(null),Wt=t(null),[zt,Gt]=l(0),[Yt,qt]=l(null),Xt=t(null),Vt=t(null),[Ut,Kt]=l(null),[Qt,Zt]=l(!1),[Jt,tn]=l([]),[nn,sn]=l([]),ln="streaming"===k||["bar","swarm","waterfall"].includes(x),cn=n(()=>{var e;return{chartType:x,runtimeMode:ln?"streaming":"bounded",windowSize:I,windowMode:N,arrowOfTime:ln?D:"right",extentPadding:F,scalePadding:W,xAccessor:ln?void 0:O,yAccessor:ln?void 0:E,timeAccessor:ln?$:void 0,valueAccessor:B,colorAccessor:j,sizeAccessor:C,groupAccessor:P||(M?"_lineGroup":void 0),categoryAccessor:qe,lineDataAccessor:M,xScaleType:ut,yScaleType:dt,xExtent:H,yExtent:R,sizeRange:z,binSize:T,normalize:L,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:!0===ae?{topOpacity:.8,bottomOpacity:.05}:!1===ae?void 0:ae,areaGroups:le?new Set(le):void 0,lineGradient:se,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,lineStyle:K,pointStyle:Q,areaStyle:Z,swarmStyle:ee,waterfallStyle:J,colorScheme:ne,barColors:te,annotations:Le,decay:Ue,pulse:Ke,transition:Pt,introAnimation:Mt,staleness:Je,heatmapAggregation:tt,heatmapXBins:nt,heatmapYBins:ot,showValues:rt,heatmapValueFormat:it,pointIdAccessor:ct,curve:_,themeCategorical:null===(e=null==Ct?void 0:Ct.colors)||void 0===e?void 0:e.categorical}},[x,I,N,D,F,W,O,E,$,B,ut,dt,j,C,P,qe,M,H,R,z,T,L,oe,re,ie,ae,se,le,ce,ue,de,he,ge,K,Q,Z,ee,J,ne,te,Le,Ue,Ke,null==Pt?void 0:Pt.duration,null==Pt?void 0:Pt.easing,Mt,Je,tt,nt,ot,rt,it,ln,ct,_,Ct]),un=t(null);un.current||(un.current=new et(cn)),o(()=>{var e;null===(e=un.current)||void 0===e||e.updateConfig(cn),At.current=!0,Bt()},[cn,Bt]);const hn=t(null);hn.current||(hn.current=new we(e=>{const t=un.current;t&&t.ingest(e)&&(At.current=!0,Bt())},{chunkThreshold:A,chunkSize:S})),o(()=>{var e;null===(e=hn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:S})},[A,S]);const gn=s(e=>{var t;null===(t=hn.current)||void 0===t||t.push(e)},[]),fn=s(e=>{var t;null===(t=hn.current)||void 0===t||t.pushMany(e)},[]),pn=s(()=>{var e,t;null===(e=hn.current)||void 0===e||e.clear(),null===(t=un.current)||void 0===t||t.clear(),At.current=!0,Bt()},[Bt]);u(i,()=>({push:gn,pushMany:fn,remove:e=>{var t,n,o;null===(t=hn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=un.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return r.length>0&&(Xt.current&&r.some(e=>{var t;return e===(null===(t=Xt.current)||void 0===t?void 0:t.data)})&&(Xt.current=null,Kt(null)),At.current=!0,Bt()),r},update:(e,t)=>{var n,o,r;null===(n=hn.current)||void 0===n||n.flush();const i=null!==(r=null===(o=un.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(At.current=!0,Bt()),i},clear:pn,getData:()=>{var e,t,n;return null===(e=hn.current)||void 0===e||e.flush(),null!==(n=null===(t=un.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=un.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=un.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[gn,fn,pn,Bt]),o(()=>{var e,t;if(w){if(M&&w.length>0&&"object"==typeof w[0]&&null!==w[0]){const t="string"==typeof M?M:"coordinates";if(Array.isArray(w[0][t])){const n=[];for(const e of w){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=hn.current)||void 0===e||e.setBoundedData(n))}}null===(t=hn.current)||void 0===t||t.setBoundedData(w)}},[w,M]);const{hoverHandlerRef:yn,hoverLeaveRef:mn,onPointerMove:vn,onPointerLeave:bn}=St;yn.current=e=>{if(!Rt)return;const t=Ft.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Dt.left,r=e.clientY-n.top-Dt.top;if(0>o||o>$t||0>r||r>Ht)return void(Xt.current&&(Xt.current=null,Vt.current=null,Kt(null),je&&(je(null),At.current=!0),Bt()));const i=un.current;if(!i||0===i.scene.length)return;const a=st(i.scene,o,r,Me,i.quadtree,i.maxPointRadius);if(!a)return void(Xt.current&&(Xt.current=null,Vt.current=null,Kt(null),je&&je(null),Bt()));const s=fo(a.datum||{},a.x,a.y);if("multi"===_e&&i.scene.length>0&&i.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=lt(e.path,t,n);if(null===i)continue;const a=yt(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=lt(e.topPath,t,n);if(null===i)continue;const a=yt(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.topPath[a][0],y:i,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(i.scene,a.x,Me),t=i.scales.y.invert,n=i.scales.x.invert;if(e.length>0){const o=n?n(a.x):a.x;s.xValue=o,s.xPx=a.x,s.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||"#007bff",datum:e.datum}))}}Xt.current=s,Vt.current=a.node,Kt(s),je&&(je(s),At.current=!0),Bt()},mn.current=()=>{Xt.current&&(Xt.current=null,Vt.current=null,Kt(null),je&&(je(null),At.current=!0),Bt())};const xn=t(()=>{});xn.current=e=>{if(!Ce)return;const t=Ft.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Dt.left,r=e.clientY-n.top-Dt.top;if(0>o||o>$t||0>r||r>Ht)return void Ce(null);const i=un.current;if(!i||0===i.scene.length)return void Ce(null);const a=st(i.scene,o,r,Me,i.quadtree,i.maxPointRadius);Ce(a?fo(a.datum||{},a.x,a.y):null)};const wn=s(e=>xn.current(e),[]),En=t(-1),Pn=t(null),Mn=t(null),_n=s(e=>{const t=un.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Mn.current&&Mn.current.version===n)o=Mn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)switch(a.type){case"point":i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(t=a.group)&&void 0!==t?t:"_default"});break;case"line":{const e=a,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.path.length>n&&t.length>n;n++)i.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=a,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(r=a.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=mt(e),Mn.current={version:n,graph:o}}const r=En.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),En.current=0;const t=o.flat[0];Pn.current={shape:t.shape,w:t.w,h:t.h};const n=kt(t);return Xt.current=n,Kt(n),je&&je(n),void Bt()}const i=vt(o,r),a=bt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return En.current=-1,Pn.current=null,Xt.current=null,Vt.current=null,Kt(null),je&&je(null),void Bt();En.current=a;const s=o.flat[a];Pn.current={shape:s.shape,w:s.w,h:s.h};const l=kt(s);Xt.current=l,Kt(l),je&&je(l),Bt()},[je,Bt]),Ln=s(e=>{En.current=-1,Pn.current=null,vn(e)},[vn]);Tt.current=()=>{var e,t;Lt.current=0;const n=Ft.current,o=Wt.current;if(!n||!o)return;const r=un.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(Ot.current?i+1e6:i),s=!Ot.current&&a,l=At.current||a;l&&!s&&r.computeScene({width:$t,height:Ht});const c=Qn(),u=function(e){if(!e)return ko;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),s=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||a||n?{axisStroke:s||ko.axisStroke,tickText:i||ko.tickText,crosshair:i?wo(i,"66"):ko.crosshair,hoverFill:l?wo(l,"4D"):ko.hoverFill,hoverStroke:i?wo(i,"99"):ko.hoverStroke,pointRing:l||ko.pointRing}:ko}(n),d=null!==(e=null==Je?void 0:Je.threshold)&&void 0!==e?e:5e3,h=Je&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=Kn(n,jt,Dt,c);if(e){if(e.clearRect(-Dt.left,-Dt.top,jt[0],jt[1]),h&&(e.globalAlpha=null!==(t=null==Je?void 0:Je.dimOpacity)&&void 0!==t?t:.5),"transparent"!==U&&!Fe){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=U||(t&&"transparent"!==t?t:null);o&&(e.fillStyle=o,e.fillRect(-Dt.left,-Dt.top,jt[0],jt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,$t,Ht),e.clip()),ze&&r.scales)for(const t of ze)e.save(),t(e,r.scene,r.scales,{width:$t,height:Ht}),e.restore();const o=bo[x];if(o&&r.scales)for(const t of o)t(e,r.scene,r.scales,{width:$t,height:Ht});e.restore(),h&&(e.globalAlpha=1)}}{const e=Kn(o,jt,Dt,c);if(e&&(e.clearRect(-Dt.left,-Dt.top,jt[0],jt[1]),Rt&&Xt.current&&r.scales&&function(e,t,n,o,r,i,a){var s,l;if(!1===r.crosshair)return;const c=t.allSeries,u=c&&c.length>0,d=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const h="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=h.stroke||a.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(u?d:t.x,0),e.lineTo(u?d:t.x,o),e.stroke(),u||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),u){e.lineWidth=2,e.strokeStyle=a.pointRing;for(const t of c)null!=t.valuePx&&(e.beginPath(),e.arc(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||"#007bff",e.fill(),e.stroke())}else{let n="";try{(null===(l=e.canvas)||void 0===l?void 0:l.parentElement)&&(n=getComputedStyle(e.canvas).getPropertyValue("--semiotic-primary").trim())}catch(e){}const o=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||n||"#007bff";e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,Xt.current,$t,Ht,"object"==typeof Rt?Rt:{},Vt.current,u),Vt.current&&Array.isArray(Oe))){const t=Oe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,r.scene,Vt.current,t)}}l&&n&&n.setAttribute("aria-label",dn(r.scene,x+" chart"));const g=At.current;if(At.current=!1,g&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Yt||e(Yt.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Yt.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Yt.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Yt.y.domain()[1])!==e(r.scales.y.domain()[1])||Yt.x.range()[0]!==r.scales.x.range()[0]||Yt.x.range()[1]!==r.scales.x.range()[1]||Yt.y.range()[0]!==r.scales.y.range()[0]||Yt.y.range()[1]!==r.scales.y.range()[1])&&qt(r.scales),at){const e=r.getData(),t="function"==typeof O?O:e=>e[O||"x"],n="function"==typeof E?E:e=>e[E||"y"];tn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),sn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Le&&Le.length>0&&Gt(e=>e+1),(null==Je?void 0:Je.showBadge)&&Zt(!!h),(s||null!=r.activeTransition||r.hasActivePulses)&&(Lt.current=requestAnimationFrame(()=>Tt.current()))},o(()=>(Bt(),()=>{var e;null===(e=hn.current)||void 0===e||e.clear()}),[Bt]),o(()=>{At.current=!0,Bt()},[x,$t,Ht,fe,U,K,ze,Bt]),wt(Je,un,At,Bt,Qt,Zt);const Tn=n(()=>{if(be||Ae)return;const e=un.current;return(null==e?void 0:e.xIsDate)&&Yt?vo(Yt.x.domain()):void 0},[be,Ae,Yt]),Bn=be||Ae||Tn,Dn=Rt&&Ut?Ee?Ee(Ut):e.createElement(So,{hover:Ut}):null,Nn=Dn?e.createElement(Cn,{x:Ut.x,y:Ut.y,containerWidth:$t,containerHeight:Ht,margin:Dt,className:"stream-frame-tooltip"},Dn):null,In=Pn.current,$n=e.createElement(jn,{active:En.current>=0,hoverPoint:Ut,margin:Dt,size:jt,shape:null==In?void 0:In.shape,width:null==In?void 0:In.w,height:null==In?void 0:In.h}),Hn=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},Rn=Hn(O,$,"__semiotic_resolvedX","__semiotic_resolvedTime"),Fn=Hn(E,B,"__semiotic_resolvedY","__semiotic_resolvedValue"),Wn=Rn.key,zn=Fn.key,Gn=Le&&Le.length>0,Yn=e=>{if(!e||!Gn||!Rn.fn&&!Fn.fn)return e;let t=!1;const n=e.map(e=>{const n=Rn.fn&&Rn.key&&!(Rn.key in e),o=Fn.fn&&Fn.key&&!(Fn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[Rn.key]=Rn.fn(e)),o&&(r[Fn.key]=Fn.fn(e)),r});return t?n:e};if(an){const t=un.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:$t,height:Ht}));const n=null!==(a=null==t?void 0:t.scene)&&void 0!==a?a:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r=Bn||(()=>{if((null==t?void 0:t.xIsDate)&&o)return vo(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":gt||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:jt[0],height:jt[1]}},e.createElement(An,{summary:ft}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:jt[0],height:jt[1],style:{position:"absolute",left:0,top:0}},e.createElement("g",{transform:`translate(${Dt.left},${Dt.top})`},It),e.createElement("g",{transform:`translate(${Dt.left},${Dt.top})`},U&&e.createElement("rect",{x:0,y:0,width:$t,height:Ht,fill:U}),Ge&&o&&Ge.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:$t,height:Ht}))),n.map((t,n)=>function(t,n){var o,r,i;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})}case"area":{const i=t;if(0===i.topPath.length)return null;const a=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),s=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${a}L${s}Z`,fill:rn(i.style.fill),fillOpacity:null!==(r=null!==(o=i.style.fillOpacity)&&void 0!==o?o:i.style.opacity)&&void 0!==r?r:.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:rn(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"rect":{const o=t;return e.createElement("rect",{key:"rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,a]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),s=.299*r+.587*i+.114*a>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.createElement("g",{key:"heatcell-"+n},e.createElement("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.createElement("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:l+"px"},t))}return e.createElement("rect",{key:"heatcell-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill})}case"candlestick":{const o=t,r=Math.min(o.openY,o.closeY),i=Math.max(Math.abs(o.openY-o.closeY),1),a=o.isUp?o.upColor:o.downColor;return e.createElement("g",{key:"candle-"+n},e.createElement("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.createElement("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:i,fill:a,stroke:a,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(on,{width:$t,height:Ht,totalWidth:jt[0],totalHeight:jt[1],margin:Dt,scales:o,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:r,yFormat:xe||Se,showGrid:Be,title:Ye,legend:De,legendHoverBehavior:Ne,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:He,legendPosition:Re,foregroundGraphics:Nt,marginalGraphics:at,xValues:[],yValues:[],annotations:Le,svgAnnotationRules:Te,annotationFrame:0,xAccessor:Wn,yAccessor:zn,annotationData:Yn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof _?_:void 0,linkedCrosshairName:pt,linkedCrosshairSourceId:xt}))}return e.createElement("div",{ref:Et,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":gt||("string"==typeof Ye?Ye:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":jt[0],height:q?"100%":jt[1],overflow:"visible"},onKeyDown:_n},ht&&e.createElement(Sn,{tableId:_t}),ht&&e.createElement(kn,{scene:null!==(h=null===(d=un.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:_t,chartTitle:"string"==typeof Ye?Ye:void 0}),e.createElement(An,{summary:ft}),e.createElement("div",{role:"img","aria-label":gt||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Rt?Ln:void 0,onMouseLeave:Rt?bn:void 0,onClick:Ce?wn:void 0},It&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:jt[0],height:jt[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Dt.left},${Dt.top})`},It)),e.createElement(en,{width:$t,height:Ht,totalWidth:jt[0],totalHeight:jt[1],margin:Dt,scales:Yt,showAxes:fe,axes:pe,showGrid:Be,xFormat:Bn,yFormat:xe||Se}),e.createElement("canvas",{ref:Ft,"aria-label":dn(null!==(f=null===(g=un.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Wt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(On,{hoverPoint:Ut}),e.createElement(on,{width:$t,height:Ht,totalWidth:jt[0],totalHeight:jt[1],margin:Dt,scales:Yt,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:Bn,yFormat:xe||Se,showGrid:Be,title:Ye,legend:De,legendHoverBehavior:Ne,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:He,legendPosition:Re,foregroundGraphics:Nt,marginalGraphics:at,xValues:Jt,yValues:nn,annotations:Le,svgAnnotationRules:Te,annotationFrame:zt,xAccessor:Wn,yAccessor:zn,annotationData:Yn(null===(p=un.current)||void 0===p?void 0:p.getData()),pointNodes:null===(y=un.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type),curve:"string"==typeof _?_:void 0,underlayRendered:!0,linkedCrosshairName:pt,linkedCrosshairSourceId:xt}),(Xe||Ve)&&e.createElement(ke,{width:$t,height:Ht,totalWidth:jt[0],totalHeight:jt[1],margin:Dt,dimension:null!==(m=null==Xe?void 0:Xe.dimension)&&void 0!==m?m:"xy",scales:Yt,onBrush:null!=Ve?Ve:()=>{},binSize:T,snap:null==Xe?void 0:Xe.snap,binBoundaries:null!==(v=null==Xe?void 0:Xe.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=un.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Xe?void 0:Xe.snapDuring,streaming:"streaming"===k}),(null==Je?void 0:Je.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Je.badgePosition?{top:4,left:4}:"bottom-left"===Je.badgePosition?{bottom:4,left:4}:"bottom-right"===Je.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Qt?"#dc3545":"#28a745",color:"white"})},Qt?"STALE":"LIVE"),$n,Nn))});function Eo(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=r(e.pieceData[0],e.name);i.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return i}function jo(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=B(e,.25))&&void 0!==t?t:i,median:null!==(n=B(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=B(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}Oo.displayName="StreamXYFrame";const Co={bar:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,getStack:s,resolvePieceStyle:l}=e,{r:c,projection:u}=o,d=[],h="vertical"===u,g="horizontal"===u,f=i.normalize,p=[];if(s){const e=new Set;for(const t of Object.values(r))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(r)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=a(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of p){const a=t.get(i);if(!a)continue;let u=a.total;f&&n>0&&(u/=n);const p=l(a.pieces[0],s?i:e.name),y=Object.assign(Object.assign({},a.pieces[0]),{__aggregateValue:a.total,__pieceCount:a.pieces.length,category:e.name});if(h){const t=c(0>u?r:o+u),n=0>u?c(r+u)-c(r):c(o)-c(o+u);d.push(Ve(e.x,t,e.width,Math.abs(n),p,y,i)),0>u?r+=u:o+=u}else if(g){const t=c(0>u?r+u:o),n=0>u?c(r)-c(r+u):c(o+u)-c(o);d.push(Ve(t,e.x,Math.abs(n),e.width,p,y,i)),0>u?r+=u:o+=u}}}if(i.roundedTop&&i.roundedTop>0){const e=Math.max(0,i.roundedTop),t=new Map;for(const e of d){if("rect"!==e.type)continue;const o=(null===(n=e.datum)||void 0===n?void 0:n.category)||"";t.has(o)||t.set(o,[]),t.get(o).push(e)}const o="vertical"===u;for(const n of t.values()){if(0===n.length)continue;const t=n.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),r=n.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});if(t.length>0){const n=t.reduce(o?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t);n.roundedTop=e,n.roundedEdge=o?"top":"right"}if(r.length>0){const t=r.reduce(o?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t);t.roundedTop=e,t.roundedEdge=o?"bottom":"left"}}}return d},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let a=0;h.length>a;a++){const c=r.get(h[a])||[];for(const r of c){const c=i(r),g=s(r,h[a]);if(d){const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ve(i,Math.min(s,d),o,Math.abs(s-d),g,r,h[a]))}else{const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ve(Math.min(s,d),i,Math.abs(d-s),o,g,r,h[a]))}}}}if(r.roundedTop&&r.roundedTop>0){const e=Math.max(0,r.roundedTop);for(const t of u){if("rect"!==t.type)continue;const n=i(t.datum);t.roundedTop=e,t.roundedEdge=d?0>n?"bottom":"top":0>n?"left":"right"}}return u},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,f=s.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),f=c?a(s):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:o})}}return l},pie:Eo,donut:Eo,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,f=[],p="vertical"===g,y=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=B(t,.25))&&void 0!==n?n:s,g=null!==(o=B(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=B(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,k=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,w=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,A=d(e.pieceData[0],e.name),S=[];if(y)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=p?e.middle:h(n),r=p?h(n):e.middle;S.push({px:o,py:r,value:n,datum:t})}}if(f.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(k),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(w),stats:{n:t.length,min:k,q1:c,median:g,q3:m,max:w,mean:t.reduce((e,t)=>e+t,0)/t.length},style:A,datum:e.pieceData,category:e.name,outliers:S}),y)for(const e of S)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],s=(a-i)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),f-1)]++;const y=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;f>t;t++){const n=u(i+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(i+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=B(t,.25))&&void 0!==n?n:i,l=null!==(o=B(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=B(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:jo(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,p=Math.max(...i,1),y=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/p)*e.width*.9,a=l(n+t*r),s=l(n+(t+1)*r);c.push(Ve(Math.min(a,s),e.x+e.width-o,Math.abs(s-a),o,y,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const f=Math.max(...c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/f*y}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:jo(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(Ve(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(Ve(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,a,s,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,g=[],f=t.width/2,p=!1!==e.config.showLabels,y=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===y.length)return g;const v=[],b=new Set;for(const e of y)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],k=[];let w=0;for(const e of y){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}k.push({col:e,groups:t,stepTotal:n}),x||n>w&&(w=n)}if(x)for(const e of k){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>w&&(w=o)}if(0===w)return g;const A=new Map;for(const e of v){const t=k[0].groups.get(e);A.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,O=x?.95*f:.9*t.width,E=m().domain([0,w]).range([0,O]),j=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let C=new Map;for(let e=0;k.length>e;e++){const t=k[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,y=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=E(o.total))}let r=f,i=f;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=E(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const k=h(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,S=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:S,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});p&&(0===s&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=f,O.__funnelStepLabelY=d,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+m/2,O.__funnelValueLabelY=d,O.__funnelBarW=m),g.push(Ve(x,d,m,u,k,O,l)),y.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,a=E(e),s=f-a/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});p&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=f,w.__funnelStepLabelY=d,w.__funnelRowWidth=a,w.__funnelValueLabelX=f,w.__funnelValueLabelY=d,w.__funnelBarW=a),g.push(Ve(s,d,a,u,x,w,b)),y.set(l,{x:s,y:d,w:a,h:u})}if(e>0&&C.size>0){const e=x?v:[v[0]];for(const o of e){const e=C.get(o),r=y.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),a={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:j},datum:null!==(l=null===(s=t.groups.get(o))||void 0===s?void 0:s.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};g.push(a)}}C=y}return g},"bar-funnel":function(e,t){var n,o,r,i;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=s(o);r.total+=i,r.pieces.push(o),n+=i}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,k=null==a?void 0:a.groups.get(h),w=null!==(i=null==k?void 0:k.total)&&void 0!==i?i:y,A=o?0:Math.max(0,w-y),S=n.x+e*s+l/2,O=v(y),E=v(0)-O,j=c(f.pieces[0],p?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(Ve(S,O,u,E,j,C,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},j),r=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(Ve(S,e,u,t,o,r,p?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=a(n,l);if(u){const r=s(t),i=s(t+o);c.push(Ve(r,e.x,i-r,e.width,d,n,l))}else{const r=s(t+o),i=s(t);c.push(Ve(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class Po{constructor(e){this.rExtent=new Se,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new Ae(e.windowSize),this.getO=Pe(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Se)):(this.getR=je(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Pe(e.stackBy),this.getGroup=Pe(e.groupBy),this.getColor=Pe(e.colorAccessor),this.getConnector=Pe(e.connectorAccessor),this.getDataId=Pe(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l="radial"===r,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let u,d;if(l){u=x().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=m().domain(a).range([o,n])}else s?(u=x().domain(i).range([0,e.height]).padding(c),d=m().domain(a).range([0,e.width])):(u=x().domain(i).range([0,e.width]).padding(c),d=m().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var i;const a=this.rExtents[r];a.dirty&&a.recalculate(n,o);let[l,c]=a.extent;l===1/0&&(l=0,c=1);const u=null!==(i=t.extentPadding)&&void 0!==i?i:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),s?m().domain([l,c]).range([0,e.width]):m().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,i,u,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===o)return i;if("function"==typeof o)return i.sort(o);const a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===o?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,a;const s=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let c=0,u=0;if("bar"===s&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==s){const e=u-c,t=e>0?e*l:1;null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(a=this.config.rExtent)||void 0===a?void 0:a[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===s||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=Co[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Le,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?$e(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const a=e[i],s=n?t(a):a[o];let l=r.get(s);l||(l=[],r.set(s,l)),l.push(i)}return this._categoryIndexCache={version:this._dataVersion,map:r},r}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,Po.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=w().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let r=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=i-t;if(a>n){const e=1-n/a;e>r&&(r=e)}}r>0&&(n._pulseIntensity=r,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,r;this.prevPositionMap.clear();const i=new Map,a=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,s="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,i);n&&("rect"===t.type?this.prevPositionMap.set(n,s?{x:t.x,y:a,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:a,y:t.y,w:0,h:t.h,opacity:null!==(r=t.style.opacity)&&void 0!==r?r:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,r;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(r=e.category)&&void 0!==r?r:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],r=this.getNodeKey(o,t);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(r,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,S);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)d?(A.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(r=d.w)&&void 0!==r?r:c.w,c.h=null!==(i=d.h)&&void 0!==i?i:c.h,w=!0)):(c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2;this.exitNodes.push({type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e})}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:ze(),duration:k})}advanceTransition(e){var t,n,o,r;if(!this.activeTransition)return!1;const i=Fe(e,this.activeTransition),a=Re(i,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=We(r,e._targetOpacity,a)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=We(o.x,e._targetX,a),e.y=We(o.y,e._targetY,a)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=We(o.r,e._targetR,a))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=We(r,e._targetOpacity,a)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=We(n.x,e._targetX,a),e.y=We(n.y,e._targetY,a),void 0!==n.w&&(e.w=We(n.w,e._targetW,a),e.h=We(n.h,e._targetH,a))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:We(o,e._targetOpacity,a)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=We(n.startAngle,e._targetStartAngle,a),e.endAngle=We(n.endAngle,e._targetEndAngle,a))}}}if(i>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!Ee(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!Ee(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!Ee(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(Ee(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=Pe(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,r=Array.isArray(n)?n:[n],i=Array.isArray(o)?o:[o];if(r.length!==i.length||r.some((e,t)=>!Ee(e,i[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Se)):(this.getR=je(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Ee(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Pe(this.config.stackBy):void 0),"groupBy"in e&&!Ee(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Pe(this.config.groupBy):void 0),"colorAccessor"in e&&!Ee(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Ee(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Pe(this.config.connectorAccessor):void 0)}}function Mo(e,t,n){const o=tt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function _o(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function Lo(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function To(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Bo(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function Do(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,{rTickValues:h}=t,g="radial"===(null==l?void 0:l.projection),f="horizontal"===(null==l?void 0:l.projection),p=n(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||No)(e)})),[l,d,g,h]),y=u&&l&&!g,m=c&&l&&!g;return y||m?e.createElement("svg",{width:i,height:a,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&e.createElement("g",{className:"ordinal-grid"},p.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:f?t.pixel:0,y1:f?0:t.pixel,x2:f?t.pixel:o,y2:f?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,f?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function No(e){return Math.round(100*e)/100+""}function Io(o){var r,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:f,rLabel:p,oFormat:y,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:O="right",foregroundGraphics:E,annotations:j,svgAnnotationRules:C,xAccessor:P,yAccessor:M,annotationData:_,underlayRendered:L,children:T}=o,B="radial"===(null==d?void 0:d.projection),D="horizontal"===(null==d?void 0:d.projection),N=!1!==g,I=n(()=>h&&N&&d&&!B?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:y?y(e,t):e}}):[],[h,N,d,y,B]),$=o.rTickValues,H=o.tickLabelEdgeAlign,R=n(()=>h&&d&&!B?($||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(m||No)(e)})):[],[h,d,m,B,$]),F=t(new Map),W=t(null!==(r=null==j?void 0:j.length)&&void 0!==r?r:0),z=null!==(i=null==j?void 0:j.length)&&void 0!==i?i:0;W.current!==z&&(W.current=z,F.current=new Map);const G=n(()=>{if(!j||0===j.length)return null;const e=Ft(),t="horizontal"===(null==d?void 0:d.projection),n=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,o={scales:d?{x:t?d.r:n||d.r,y:t&&n||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:P,yAccessor:M,width:a,height:s,data:_,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:F.current};return j.map((t,n)=>{if(C){const r=C(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[j,C,a,s,d,P,M,_]);return h||b||x||E||G&&G.length>0||v||T?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!B&&!L&&e.createElement("g",{className:"ordinal-grid"},R.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:D?t.pixel:0,y1:D?0:t.pixel,x2:D?t.pixel:a,y2:D?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!B&&e.createElement("g",{className:"ordinal-axes"},D?e.createElement(e.Fragment,null,!L&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))),f&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},f),!L&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!L&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&a-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),R.map((t,n)=>{const o=H?0===n?"start":n===R.length-1?"end":"middle":"middle";return e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))}),p&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p)):e.createElement(e.Fragment,null,!L&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):s,n=0>t||t>s?s:t;return e.createElement("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))),f&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!L&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),R.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},p))),G,E,T),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),Pt({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:O,title:b,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S})):null}function $o({width:n,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,onBrush:c}){const u=t(null),d=t(null),p=t(c);p.current=c;const y=t(l);y.current=l;const m=t(!1),v=t(null),b="horizontal"===(null==l?void 0:l.projection),x=t(b);return x.current=b,o(()=>{if(!u.current)return;const e=h(u.current).select(".brush-g"),t=b?g():f();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(m.current)return;const t=y.current;if(!t)return;if(!e.selection)return v.current=null,void p.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};v.current=i,p.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,b]),o(()=>{if(!l||!d.current||!v.current)return;if(!u.current)return;const e=v.current,t=h(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(m.current=!0,t.call(d.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(d.current.move,[o,n]),m.current=!1)},[l,b]),e.createElement("svg",{ref:u,width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}}))}function Ho(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Ro(e,t){const n=ie().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}Po.QUADTREE_THRESHOLD=500;const Fo=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:1,o=null!==(i=t.style.opacity)&&void 0!==i?i:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?Xn(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Ro(e,t)):(Ho(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Ho(e,t),io(e,t)),e.globalAlpha=1}},Wo=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=("string"==typeof t.style.fill?Xn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},zo=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=Xn(e,n.style.stroke)||("string"==typeof n.style.fill?Xn(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}};function Go(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Yo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let qo=null;function Xo(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(qo||(qo=document.createElement("canvas")),qo.width=e,qo.height=e,qo)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Vo=new Map;function Uo(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Vo.get(n);if(void 0!==o)return o;const r=Xo({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Vo.set(n,r),r}function Ko(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Qo(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Zo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Jo=e=>[zo,...e],er={bar:Jo([ho]),clusterbar:Jo([ho]),point:Jo([uo]),swarm:Jo([uo]),pie:[Fo],donut:[Fo],boxplot:Jo([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},uo]),violin:Jo([Wo]),histogram:Jo([ho]),ridgeline:Jo([Wo]),timeline:Jo([ho]),funnel:[ho,(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Go(r):null!=i?`${Go(r)} (${Yo(i)})`:Go(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=Go(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[ho,(e,t,n,o)=>{var r,i;const a=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of a){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=Uo(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,a=i?Zo(r):"",s=Qo(o);e.font="bold 13px sans-serif";const l=i?e.measureText(a).width:0;e.font="11px sans-serif";const c=e.measureText(s).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,f=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Ko(e,g,f,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Ko(e,g,f,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(a,h,f+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(s,h,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(s,h,f+3))}e.lineWidth=1}}],swimlane:Jo([ho])},tr={top:50,right:40,bottom:60,left:70},nr={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function or({hover:t}){var n,o,r,i,a,s;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:nr},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:nr},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:nr},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:nr},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(s=null!==(a=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==a?a:l.pct)&&void 0!==s?s:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:nr},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:nr},f&&e.createElement("div",{style:{fontWeight:"bold"}},f+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const rr=c(function(r,i){var a,c,d,h,g,f,p,y,m,v;const{chartType:b,runtimeMode:x,data:k,oAccessor:w="category",rAccessor:A="value",colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:C,valueAccessor:P,categoryAccessor:M,projection:_="vertical",size:L=[600,400],responsiveWidth:T,responsiveHeight:B,margin:D,barPadding:N,roundedTop:I,baselinePadding:$,innerRadius:H,cornerRadius:R,normalize:F,startAngle:W,sweepAngle:z,dynamicColumnWidth:G,bins:Y,showOutliers:q,showIQR:X,amplitude:V,connectorOpacity:U,showLabels:K,connectorAccessor:Q,connectorStyle:Z,dataIdAccessor:J,rExtent:ee,oExtent:te,extentPadding:ne=.05,oSort:oe,windowMode:re="sliding",windowSize:ae=200,pieceStyle:se,summaryStyle:le,colorScheme:ce,barColors:ue,showAxes:de=!0,showCategoryTicks:he,categoryLabel:ge,valueLabel:fe,categoryFormat:pe,valueFormat:ye,oLabel:me,rLabel:ve,oFormat:be,rFormat:xe,rTickValues:ke,tickLabelEdgeAlign:Ae,enableHover:Se=!0,hoverAnnotation:Oe,tooltipContent:Ee,customHoverBehavior:je,annotations:Ce,svgAnnotationRules:Pe,showGrid:Me=!1,legend:_e,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Be,legendIsolatedCategories:De,legendPosition:Ne,backgroundGraphics:Ie,foregroundGraphics:$e,title:He,className:Re,background:Fe,centerContent:We,decay:ze,pulse:Ge,transition:Ye,animate:qe,staleness:Xe,brush:Ve,onBrush:Ue,accessibleTable:Ke=!0,description:Qe,summary:Ze}=r,Je=t(!0),et=Un({sizeProp:L,responsiveWidth:T,responsiveHeight:B,userMargin:D,marginDefault:tr,foregroundGraphics:$e,backgroundGraphics:Ie,animate:qe,transitionProp:Ye,themeDirtyRef:Je}),{reducedMotionRef:tt,responsiveRef:nt,size:ot,margin:rt,adjustedWidth:it,adjustedHeight:st,resolvedForeground:lt,resolvedBackground:ct,currentTheme:ut,transition:dt,introEnabled:ht,tableId:gt,rafRef:ft,renderFnRef:pt,scheduleRender:yt}=et,xt=null!=ge?ge:me,At=null!=fe?fe:ve,St=null!=pe?pe:be,Ot=null!=ye?ye:xe,Et=t(null),jt=t(null),[Ct,Pt]=l(null),[Mt,_t]=l(null),[Lt,Tt]=l(0),[Bt,Dt]=l(!1),Nt=Se||Oe,It="streaming"===x,$t=n(()=>{var e;return{chartType:b,runtimeMode:It?"streaming":"bounded",windowSize:ae,windowMode:re,extentPadding:ne,projection:_,oAccessor:It?void 0:w,rAccessor:It?void 0:A,colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:It?C:void 0,valueAccessor:It?P||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:It?M||w:void 0,rExtent:ee,oExtent:te,barPadding:N,roundedTop:I,baselinePadding:$,innerRadius:H,cornerRadius:R,normalize:F,startAngle:W,sweepAngle:z,dynamicColumnWidth:G,bins:Y,showOutliers:q,showIQR:X,amplitude:V,connectorOpacity:U,showLabels:K,connectorAccessor:Q,connectorStyle:Z,dataIdAccessor:J,oSort:oe,pieceStyle:se,summaryStyle:le,colorScheme:ce,themeCategorical:null===(e=null==ut?void 0:ut.colors)||void 0===e?void 0:e.categorical,barColors:ue,decay:ze,pulse:Ge,transition:dt,introAnimation:ht,staleness:Xe}},[b,ae,re,ne,_,w,A,S,O,E,j,C,P,M,ee,te,N,I,$,H,R,F,W,z,G,Y,q,X,V,U,K,Q,Z,J,oe,se,le,ce,ue,ze,Ge,null==dt?void 0:dt.duration,null==dt?void 0:dt.easing,ht,Xe,It,ut]),Ht=t(null);Ht.current||(Ht.current=new Po($t)),o(()=>{var e;null===(e=Ht.current)||void 0===e||e.updateConfig($t),Je.current=!0,yt()},[$t,yt]);const Rt=t(null);Rt.current||(Rt.current=new we(e=>{const t=Ht.current;t&&t.ingest(e)&&(Je.current=!0,yt())}));const Ft=s(e=>{var t;null===(t=Rt.current)||void 0===t||t.push(e)},[]),Wt=s(e=>{var t;null===(t=Rt.current)||void 0===t||t.pushMany(e)},[]),zt=s(()=>{var e,t;null===(e=Rt.current)||void 0===e||e.clear(),null===(t=Ht.current)||void 0===t||t.clear(),Je.current=!0,yt()},[yt]),Gt=s(e=>{var t,n;null===(t=Rt.current)||void 0===t||t.clearLastData(),null===(n=Rt.current)||void 0===n||n.setReplacementData(e)},[]);u(i,()=>({push:Ft,pushMany:Wt,replace:Gt,remove:e=>{var t,n,o,r;null===(t=Rt.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Ht.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(i.length>0){const e=null===(r=jt.current)||void 0===r?void 0:r.data;!!jt.current&&i.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(jt.current=null,Pt(null)),Je.current=!0,yt()}return i},update:(e,t)=>{var n,o,r;null===(n=Rt.current)||void 0===n||n.flush();const i=null!==(r=null===(o=Ht.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(Je.current=!0,yt()),i},clear:zt,getData:()=>{var e,t,n;return null===(e=Rt.current)||void 0===e||e.flush(),null!==(n=null===(t=Ht.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Ht.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Ft,Wt,Gt,zt,yt]),o(()=>{var e;k&&(null===(e=Rt.current)||void 0===e||e.setBoundedData(k))},[k]);const{hoverHandlerRef:Yt,hoverLeaveRef:qt,onPointerMove:Xt,onPointerLeave:Vt}=et;Yt.current=e=>{if(!Nt)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-rt.left,r=e.clientY-n.top-rt.top;if(0>o||o>it||0>r||r>st)return void(jt.current&&(jt.current=null,Pt(null),je&&je(null),yt()));const i=Ht.current;if(!i||0===i.scene.length)return;const a="radial"===_,s=function(e,t,n,o=30,r,i=0){let a=null;if(r){const e=at(r,t,n,o,i);e&&(a={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":e=Mo(i,t,n);break;case"point":if(r)break;e=_o(i,t,n,o);break;case"wedge":e=Lo(i,t,n);break;case"boxplot":e=To(i,t,n);break;case"violin":e=Bo(i,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}(i.scene,a?o-it/2:o,a?r-st/2:r,30,i.pointQuadtree,i.maxPointRadius);if(!s)return void(jt.current&&(jt.current=null,Pt(null),je&&je(null),yt()));const l=fo(s.datum||{},s.x,s.y,Object.assign(Object.assign(Object.assign({},s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b}));jt.current=l,Pt(l),je&&(je(l),Je.current=!0),yt()},qt.current=()=>{jt.current&&(jt.current=null,Pt(null),je&&(je(null),Je.current=!0),yt())};const Ut=t(-1),Kt=t(null),Qt=t(null),Zt=s(e=>{const t=Ht.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Qt.current&&Qt.current.version===n)o=Qt.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)if("rect"===a.type&&null!=a.x){const e=null!==(n=null===(t=a.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(o=a.group)&&void 0!==o?o:e})}else if("point"===a.type)i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(r=a.group)&&void 0!==r?r:"_default"});else if("wedge"===a.type&&null!=a.cx){const e=((a.startAngle||0)+(a.endAngle||0))/2,t=((a.innerRadius||0)+(a.outerRadius||50))/2;i.push({x:a.cx+Math.cos(e)*t,y:a.cy+Math.sin(e)*t,datum:a.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=mt(e),Qt.current={version:n,graph:o}}const r=Ut.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Ut.current=0;const t=o.flat[0];Kt.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},kt(t)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});return jt.current=n,Pt(n),je&&je(n),void yt()}const i=vt(o,r),a=bt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return Ut.current=-1,Kt.current=null,jt.current=null,Pt(null),je&&je(null),void yt();Ut.current=a;const s=o.flat[a];Kt.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},kt(s)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});jt.current=l,Pt(l),je&&je(l),yt()},[je,yt]),Jt=s(e=>{Ut.current=-1,Kt.current=null,Xt(e)},[Xt]);pt.current=()=>{var e,t;ft.current=0;const n=Et.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Ht.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(tt.current?i+1e6:i),s=!tt.current&&a,l=Je.current;l&&!a&&(r.computeScene({width:it,height:st}),Je.current=!1),(l||s)&&n.setAttribute("aria-label",dn(r.scene,b+" chart"));const c=Qn(),u=ot[0]*c,d=ot[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=ot[0]+"px",n.style.height=ot[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,ot[0],ot[1]);const h=null!==(e=null==Xe?void 0:Xe.threshold)&&void 0!==e?e:5e3,g=Xe&&r.lastIngestTime>0&&i-r.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==Xe?void 0:Xe.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Fe&&!Ie){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=Fe||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,ot[0],ot[1]))}const f="radial"===_;o.save(),o.beginPath(),o.rect(rt.left,rt.top,it,st),o.clip(),f?(o.save(),o.translate(rt.left+it/2,rt.top+st/2)):o.translate(rt.left,rt.top);const p=er[b]||[],y={width:it,height:st};for(const e of p)e(o,r.scene,r.scales,y);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(_t(r.scales),Tt(e=>e+1)),(null==Xe?void 0:Xe.showBadge)&&Dt(!!g),(s||null!=r.activeTransition||r.hasActivePulses)&&(ft.current=requestAnimationFrame(()=>pt.current()))},o(()=>(yt(),()=>{var e;null===(e=Rt.current)||void 0===e||e.clear()}),[yt]),o(()=>{Je.current=!0,yt()},[b,it,st,de,Fe,yt]),wt(Xe,Ht,Je,yt,Bt,Dt);const en=Nt&&Ct?Ee?Ee(Ct):e.createElement(or,{hover:Ct}):null,tn="radial"===_,nn=en?e.createElement(Cn,{x:Ct?tn?Ct.x+it/2:Ct.x:0,y:Ct?tn?Ct.y+st/2:Ct.y:0,containerWidth:it,containerHeight:st,margin:rt,className:"stream-ordinal-tooltip"},en):null;if(an){const t=Ht.current;t&&k&&(t.ingest({inserts:k,bounded:!0}),t.computeScene({width:it,height:st}));const n=null!==(a=null==t?void 0:t.scene)&&void 0!==a?a:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===_,i=r?rt.left+it/2:rt.left,s=r?rt.top+st/2:rt.top;return e.createElement("div",{className:"stream-ordinal-frame"+(Re?" "+Re:""),role:"img","aria-label":Qe||("string"==typeof He?He:"Ordinal chart"),style:{position:"relative",width:ot[0],height:ot[1]}},e.createElement(An,{summary:Ze}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:ot[0],height:ot[1],style:{position:"absolute",left:0,top:0}},ct&&e.createElement("g",{transform:`translate(${rt.left},${rt.top})`},ct),e.createElement("g",{transform:`translate(${i},${s})`},Fe&&e.createElement("rect",{x:0,y:0,width:it,height:st,fill:Fe}),n.map((t,n)=>function(t,n){var o,r,i,a,s;const l=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:r,w:i,h:a}=n;let s;switch(n.roundedEdge){case"right":s=`M${o},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+a-t} A${t},${t} 0 0 1 ${o+i-t},${r+a} L${o},${r+a} Z`;break;case"left":s=`M${o+i},${r} L${o+t},${r} A${t},${t} 0 0 0 ${o},${r+t} L${o},${r+a-t} A${t},${t} 0 0 0 ${o+t},${r+a} L${o+i},${r+a} Z`;break;case"bottom":s=`M${o},${r} L${o+i},${r} L${o+i},${r+a-t} A${t},${t} 0 0 1 ${o+i-t},${r+a} L${o+t},${r+a} A${t},${t} 0 0 1 ${o},${r+a-t} Z`;break;default:s=`M${o},${r+a} L${o},${r+t} A${t},${t} 0 0 1 ${o+t},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+a} Z`}return e.createElement("path",{key:u,d:s,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:rn(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=ie().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.createElement("path",{key:u,d:r,transform:`translate(${n.cx},${n.cy})`,fill:rn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:rn(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:rn(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:rn(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:rn(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Io,{width:it,height:st,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:o,showAxes:de,showCategoryTicks:he,oLabel:xt,rLabel:At,oFormat:St,rFormat:Ot,rTickValues:ke,tickLabelEdgeAlign:Ae,showGrid:Me,title:He,legend:_e,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Be,legendIsolatedCategories:De,legendPosition:Ne,foregroundGraphics:lt,annotations:Ce,svgAnnotationRules:Pe,annotationFrame:0,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null==t?void 0:t.getData()}),We&&"radial"===_&&e.createElement("div",{style:{position:"absolute",left:rt.left+it/2,top:rt.top+st/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},We))}return e.createElement("div",{ref:nt,className:"stream-ordinal-frame"+(Re?" "+Re:""),role:"group","aria-label":Qe||("string"==typeof He?He:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":ot[0],height:B?"100%":ot[1],overflow:"visible"},onKeyDown:Zt},Ke&&e.createElement(Sn,{tableId:gt}),Ke&&e.createElement(kn,{scene:null!==(h=null===(d=Ht.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:gt,chartTitle:"string"==typeof He?He:void 0}),e.createElement(An,{summary:Ze}),e.createElement("div",{role:"img","aria-label":Qe||("string"==typeof He?He:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Nt?Jt:void 0,onMouseLeave:Nt?Vt:void 0},ct&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${rt.left},${rt.top})`},ct)),e.createElement(Do,{width:it,height:st,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Mt,showAxes:de,showGrid:Me,rFormat:Ot,rTickValues:ke}),e.createElement("canvas",{ref:Et,"aria-label":dn(null!==(f=null===(g=Ht.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1]}}),e.createElement(On,{hoverPoint:Ct}),e.createElement(Io,{width:it,height:st,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Mt,showAxes:de,showCategoryTicks:he,oLabel:xt,rLabel:At,oFormat:St,rFormat:Ot,showGrid:Me,title:He,legend:_e,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Be,legendIsolatedCategories:De,legendPosition:Ne,foregroundGraphics:lt,annotations:Ce,svgAnnotationRules:Pe,annotationFrame:Lt,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null===(p=Ht.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),(Ve||Ue)&&"radial"!==_&&e.createElement($o,{width:it,height:st,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Mt,onBrush:Ue||(()=>{})}),We&&"radial"===_&&e.createElement("div",{style:{position:"absolute",left:rt.left+it/2,top:rt.top+st/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},We),(null==Xe?void 0:Xe.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Xe.badgePosition?{top:4,left:4}:"bottom-left"===Xe.badgePosition?{bottom:4,left:4}:"bottom-right"===Xe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Bt?"#dc3545":"#28a745",color:"white"})},Bt?"STALE":"LIVE"),e.createElement(jn,{active:Ut.current>=0,hoverPoint:Ct,margin:rt,size:ot,shape:null===(y=Kt.current)||void 0===y?void 0:y.shape,width:null===(m=Kt.current)||void 0===m?void 0:m.w,height:null===(v=Kt.current)||void 0===v?void 0:v.h}),nn))});rr.displayName="StreamOrdinalFrame";const ir={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},ar={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class sr{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const n=this.particles[t];return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,n,o){var r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1,this._freeIndices.push(i);continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;a.t+=e*t*l*(s.bezier.circular?.3:1),1>a.t?lr(s.bezier,a.t,a.offset,a):(a.active=!1,this._freeIndices.push(i))}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)t.length>n?this.particles[n]=t[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=e}}function lr(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,r){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),l=a-s,[c,u,d,h]=e[s];cr(c,u,d,h,l,r);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;r.x+=-f/p*n*o*2,r.y+=e*n*o*2}}(e.segments,t,n,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);const[r,i,a,s]=e.points;cr(r,i,a,s,t,o);const l=s.x-r.x,c=s.y-r.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;o.x+=-c/u*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function cr(e,t,n,o,r,i){const a=1-r,s=a*a,l=s*a,c=r*r,u=c*r;i.x=l*e.x+3*s*r*t.x+3*a*c*n.x+u*o.x,i.y=l*e.y+3*s*r*t.y+3*a*c*n.y+u*o.y}function ur(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function dr(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,r),d=!0):i[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,r[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>i[t]){for(var f=i[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=u,r[p]=!0,u+=1,l.push(p),c.push(p);break}r[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}i[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(r[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:i,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];i[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function hr(e){return e.y0-e.y1>0?"up":"down"}function gr(e,t){return t(e.source)==t(e.target)}function fr(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function pr(e){return e.target.x0-e.source.x1}function yr(e,t){var n=vr(e),o=pr(t)/Math.tan(n);return"up"==hr(e)?e.y1-o:e.y1+o}function mr(e,t){var n=vr(e),o=pr(t)/Math.tan(n);return"up"==hr(e)?e.y1+o:e.y1-o}function vr(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function br(e,t){return t(e)}function xr(e){return wr(e.source)}function kr(e){return wr(e.target)}function wr(e){return(e.y0+e.y1)/2}function Ar(e){return e.virtual?0:e.value}function Sr(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!gr(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!gr(e,t)?o+1:o}),n+o}function Or(e){return e.target.depth}function Er(e,t){return e.sourceLinks.length?e.depth:t-1}function jr(e,t){return e.y0-t.y0}function Cr(e,t){return t.y0-e.y0}function Pr(e,t){return e.y1-t.y1}function Mr(e,t){return t.y1-e.y1}function _r(e,t){return Tr(e.source,t.source)||e.index-t.index}function Lr(e,t){return Tr(e.target,t.target)||e.index-t.index}function Tr(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Br(e,t){return Dr(e)==Dr(t)?"bottom"==e.circularLinkType?Cr(e,t):jr(e,t):Dr(t)-Dr(e)}function Dr(e){return e.target.column-e.source.column}function Nr(e,t){return Ir(e)==Ir(t)}function Ir(e){return e.y0-e.y1>0?"up":"down"}function $r(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=D(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Hr(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Hr(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,gr(e,t)&&fr(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Cr:jr);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Mr:Pr),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function Hr(e,t,n){e.sort(Br);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(gr(e,t)&&fr(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Rr(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Rr(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Fr(e){return function(){return e}}function Wr(e){return e.index}function zr(e){return e.nodes}function Gr(e){return e.links}function Yr(e,t,n){var o=N(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(r,i){var a=r.length;if(t)r.sort(t);else if(i>0){var s=new Map;r.forEach(function(e,t){var n,o,r,i=(o=0,r=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=wr(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=wr(e.target)*t,o+=t}}),o>0?r/o:NaN);s.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var n=s.get(e),o=s.get(t),r=n.bc,i=o.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(r)||isNaN(i)?isNaN(r)?isNaN(i)?n.idx-o.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Sr(t,n)-Sr(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Sr(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+r,t.y1=t.y0+t.value*e.ky)})})}function qr(e,t,n,o,r,i){var a=N(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&Sr(r,n)>0){var l=H(r.sourceLinks,kr),c=H(r.targetLinks,xr),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-wr(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=H(r.sourceLinks,kr),g=H(r.targetLinks,xr),f=((h&&g?(h+g)/2:h||g)-wr(r))*t;r.y0+=f,r.y1+=f}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||Tr),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function Xr(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Lr),e.targetLinks.sort(_r)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function Vr(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=Wr,l=Er,c=void 0,u=32,d=2,h=zr,g=Gr;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return R(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,r=e.target;"object"!=typeof o&&(o=e.source=ur(n,o)),"object"!=typeof r&&(r=e.target=ur(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=dr(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){br(e,t)!=br(r.source,t)&&br(e,t)!=br(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),gr(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max($(e.sourceLinks,Ar),$(e.targetLinks,Ar)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var g=i;if(null!==a){var f=N(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=I(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=N(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=D(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/$(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=I(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,r),Yr(h,c,s),qr(h,c,s,g,g,u),Xr(h),$r(h,s,d,10,8),Yr(h,c,s),qr(h,c,s,g,g,u),Xr(h),$r(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return br(n.source,t)==br(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Nr(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=yr(t,e);return e.y1-n}if(t.target.column>e.target.column)return yr(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return br(n.target,t)==br(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Nr(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=mr(t,e);return e.y0-n}if(t.source.column>e.source.column)return mr(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=D(t,function(e){return e.y0}),a=I(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),$r(h,s,d,10,8)}(f),f}return f.update=function(e){return Xr(e),$r(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(r=+e,f):r},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Fr(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:Fr(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Fr(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Fr(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],f):[[e,t],[n,o]]},f.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],f):[n-e,o-t]},f}const Ur=e=>{let t,n,o,r,i,a,s,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=ue(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,s=ue(t,n),o=s(.5),r=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${a} ${n},${a}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function Kr(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,u=r.leftFullExtent,d=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${i},${a+h*n}Z`}const Qr=new Set,Zr=new WeakMap;function Jr(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=Zr.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,Zr.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;Qr.has(e)||(Qr.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const ei={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Or))-1:0},justify:Er},ti={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(r=n.nodeWidth)&&void 0!==r?r:15,f=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=Vr().extent(v).links(m).nodes(y).nodeAlign(ei[h]||Er).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,u=o[0],d=o[1];if(i>0&&a>0&&(0>e||0>n||t>u||r>d)){const t=Math.min(u/i,d/a),o=-e*t+(u-i*t)/2,r=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of m)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=e.source,n=e.target,o="object"==typeof t&&null!==t?t.id:t+"",r="object"==typeof n&&null!==n?n.id:n+"",i=k.get(e._edgeKey?e._edgeKey:`${o}\0${r}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(o),n=x.get(r);t&&(i.source=t),n&&(i.target=n)}}},buildScene(e,t,n,o){var r,i,a,s;const l="vertical"===n.orientation?"down":"right",c=n.nodeStyle,u=n.edgeStyle,d=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,h=n.edgeColorBy||"source",g=Array.isArray(n.colorScheme)?n.colorScheme:L,f=new Map;e.forEach((e,t)=>{f.set(e.id,g[t%g.length])});const p=[],y=[],m=[],v=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=c?c(Jr(t,"nodeStyle")):{},r={fill:o.fill||f.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};v.set(t.id,("string"==typeof r.fill?r.fill:null)||f.get(t.id)||"#4d430c"),p.push("down"===l?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:r,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const b=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of b){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o="#999";o="function"==typeof h?h(e)||o:"target"===h?v.get(n.id)||f.get(n.id)||o:v.get(t.id)||f.get(t.id)||o;const r=u?u(Jr(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),l=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=r.fill||o;y.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+s},${t.sourceY-n}L${t.sourceX+s},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:null!==(i=r.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),y.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-l},${t.targetY-n}L${t.targetX-l},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:null!==(a=r.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-l,x1:t.targetX}});continue}let l;if(l=e.circular&&e.circularPathData?Kr(e):Ur(e),!l)continue;const c={fill:r.fill||o,fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:d,stroke:r.stroke||"none",strokeWidth:r.strokeWidth,opacity:r.opacity};y.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,c;"down"===l?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),s=n.y0+r/2),m.push({x:a,y:s,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var x;return{sceneNodes:p,sceneEdges:y,labels:m}}},ni={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.forceStrength)&&void 0!==r?r:.1,s=o[0]/2,l=o[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=oi(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const r=ri(e.id),i=r%360*(Math.PI/180),a=10+r%20;e.x=t/o.length+a*Math.cos(i),e.y=n/o.length+a*Math.sin(i)}else{const t=ri(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),r=n*t;o.x=s+e*Math.cos(r),o.y=l+e*Math.sin(r)}}}const g=null!==(i=n.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=ii(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=de().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),o=he().force("charge",ge().strength(e=>-25*y(e))).force("center",fe(s,l).strength(.8)).force("x",pe(s).strength(.15)).force("y",ye(l).strength(.15));if(o.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));o.force("link",n),o.force("link").links(e)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var r,i,a;const s=n.nodeStyle,l=n.edgeStyle,c=ii(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:L,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],f=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(Jr(t,"nodeSize")),n=s?s(Jr(t,"nodeStyle")):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=l?l(Jr(e,"edgeStyle")):{},r={stroke:o.stroke||"#999",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(y=n.nodeLabel)?"function"==typeof y?y:e=>e[y]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(Jr(n,"nodeSize"));f.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:h,sceneEdges:g,labels:f}}};function oi(e,t,n){const o=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function ri(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function ii(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(o=D(a))&&void 0!==o?o:0,l=null!==(r=I(a))&&void 0!==r?r:1;if(s===l)return()=>(i[0]+i[1])/2;const c=m().domain([s,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const ai=L,si={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);p[n][o]=r}const y=ve().padAngle(r);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=ie().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,r=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);r&&(r.chordData=t)}},buildScene(e,t,n,o){var r,i;const{groupWidth:a=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-a,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:ai,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=me().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(Jr(n,"nodeStyle")).fill||y.get(n.id)||p[t%p.length]:y.get(n.id)||p[t%p.length];const a=h?h(Jr(n,"nodeStyle")):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m(t);if(!n)continue;const o=li(n,u,d);let r="#999";if(g)r=g(Jr(e,"edgeStyle")).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===f&&n?r=y.get(n.id)||r:t&&(r=y.get(t.id)||r)}const a=g?g(Jr(e,"edgeStyle")):{},l={fill:r,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(k=n.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*o,y:d+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:v,sceneEdges:b,labels:x}}};function li(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const ci=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function ui(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>150?"#222":"#fff"}function di(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function hi(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function gi(e){return Array.isArray(e.colorScheme)?e.colorScheme:ci}function fi(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:"#4d430c"}function pi(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}const yi={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>{var t;return null!==(t=e[l])&&void 0!==t?t:0}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0},u=W(i,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=V();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=X();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=Y().size([n,o]).tile(q).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;G().size([n,o]).padding(i)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var r;z().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const o=g[t],i={id:di(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?mi(i,o,n):"treemap"===a||"partition"===a?vi(i,o):"circlepack"===a&&bi(i,o),i.__hierarchyNode=o,e.push(i),f.set(o,i)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=f.get(e.parent),o=f.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,u;const d=[],h=[],g=[],f=n.treeOrientation||"vertical",p="radial"===f,y=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,o=t.y;p&&(e+=y,o+=m);const i=r(Jr(t,"nodeStyle"));let s=i.fill||fi(n);if(n.colorByDepth&&void 0!==t.depth){const e=gi(n);s=e[t.depth%e.length]}const l={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(s=n.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,a=n.x,s=n.y;p&&(o+=y,r+=m,a+=y,s+=m);const u=pi(o,r,a,s,f),d=i(Jr(e,"edgeStyle")),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=hi(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(p&&(a+=y,s+=m),p){const e=a-y,t=s-m,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===f?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=a-v-6,i="end"):(o=a+v+6,i="start"),r=s):(o=a,r=s+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const a=[],s=[];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const s=o(Jr(n,"nodeStyle"));let l=s.fill||fi(t);if(t.colorByDepth&&void 0!==n.depth){const e=gi(t);l=e[n.depth%e.length]}const c={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};a.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:c,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=hi(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const l of e){const e=l.x1-l.x0,c=l.y1-l.y0;if(0>=e||0>=c)continue;const u=!((null===(i=l.data)||void 0===i?void 0:i.children)&&l.data.children.length>0);if(!a){if("leaf"===r&&!u)continue;if("parent"===r&&u)continue}const d=n?n(l):l.id;if(!d)continue;if((u?30:40)>e||(u?16:14)>c)continue;let h=o(Jr(l,"nodeStyle")).fill||fi(t);if(t.colorByDepth&&void 0!==l.depth){const e=gi(t);h=e[l.depth%e.length]}const g=ui(h);s.push(u?{x:l.x0+e/2,y:l.y0+c/2,text:d+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:g}:{x:l.x0+4,y:l.y0+12,text:d+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:g})}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l;const c=[],u=[];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(Jr(n,"nodeStyle"));let l=s.fill||fi(t);if(t.colorByDepth&&void 0!==n.depth){const e=gi(t);l=e[n.depth%e.length]}const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=hi(t.nodeLabel);for(const r of e){const e=null!==(s=r.__radius)&&void 0!==s?s:5,i=n?n(r):r.id;if(!i)continue;if(15>e)continue;const a=!((null===(l=r.data)||void 0===l?void 0:l.children)&&r.data.children.length>0);let c=o(Jr(r,"nodeStyle")).fill||fi(t);if(t.colorByDepth&&void 0!==r.depth){const e=gi(t);c=e[r.depth%e.length]}if(a){const t=ui(c);u.push({x:r.x,y:r.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:t})}else u.push({x:r.x,y:r.y-e+14,text:i+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:"#000",stroke:"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function mi(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function vi(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function bi(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function xi(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const ki={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const r=n.__hierarchyRoot;r&&function(e,t,n,o,r){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(i=n.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=xi(n);f.metaMap.clear(),o.length=0,r.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,i,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},O=p?u/h(S)*A:u*A,E=le().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=E(k),C=g(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=i+O*Math.sin(s),g=a+O*Math.cos(s)*C;o.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:s,depth:d,parentId:n,eccentricity:C}),r.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(r,o,n,e,t)},buildScene(e,t,n,o){var r,i,a,s,l;const c=n.nodeStyle,u=n.nodeSize,d="number"==typeof u?()=>u:"function"==typeof u?u:()=>6,h=[],g=[],f=[];if(!1!==n.orbitShowRings){const t=xi(n),o=new Map;for(const t of e)o.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;r.has(n)||r.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of r)for(let r=0;i>r;r++){const s=r/i*Math.PI*2,l=(r+1)/i*Math.PI*2;g.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=d(Jr(t,"nodeSize")),n=c?c(Jr(t,"nodeStyle")):{},o={fill:n.fill||"#6366f1",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:1,opacity:null!==(i=n.opacity)&&void 0!==i?i:0===(null!==(a=t.depth)&&void 0!==a?a:0)?1:.85};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id,depth:t.depth})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=d(Jr(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(l=null===(s=n.data)||void 0===s?void 0:s[t])&&void 0!==l?l:n.id;f.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:g,labels:f}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=xi(t),i=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,l=i*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},wi={sankey:ti,force:ni,chord:si,tree:yi,cluster:yi,treemap:yi,circlepack:yi,partition:yi,orbit:ki};function Ai(e){return wi[e]}class Si{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},ir),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new sr(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},ir),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new sr(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Oi(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",r=c(n)+"",i=Number(u(n))||1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Oi(o)),{data:n})),this.nodes.has(r)||this.nodes.set(r,Object.assign(Object.assign({},Oi(r)),{data:n}));const a=`${o}\0${r}\0${e}`;this.edges.set(a,{source:o,target:r,value:i,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:a})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Oi(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Oi(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a,s,l;const c=Ai(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values()),d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const s of u)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(r=s._prevY0)&&void 0!==r?r:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[e],n=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=n,this.edges.set(n,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const n=e.get(t.id);n&&(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(s=this.config.transition)||void 0===s?void 0:s.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,n=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=n,e._prevY1=n;for(const e of this.edges.values())e._prevY0=n,e._prevY1=n,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0;const p=new Set(this.nodes.keys()),y=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of p)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)p.has(e)||this.removedNodes.add(e);for(const e of y)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)y.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=p,this.previousEdgeKeys=y,this.layoutVersion++}buildScene(e){const t=Ai(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=Ai(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Ai(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=Array.from(this.nodes.values()),r=Array.from(this.edges.values());return n.tick(o,r,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=Fe(e,this.transition),n=Re(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=We(e._prevX0,e._targetX0,n),e.x1=We(e._prevX1,e._targetX1,n),e.y0=We(e._prevY0,e._targetY0,n),e.y1=We(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=We(e._prevY0,e._targetY0,n),e.y1=We(e._prevY1,e._targetY1,n),e.sankeyWidth=We(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=null==e?void 0:e.get(t.id);n&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const n=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(n){e._prevY0=n.y0,e._prevY1=n.y1,e._prevSankeyWidth=n.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const r=this._decaySortedNodes,i=new Map;for(let e=0;r.length>e;e++)i.set(r[e][0],e);for(const r of this.sceneNodes){const a=r.id;if(!a)continue;const s=i.get(a);if(void 0===s)continue;const l=$e(n,s,o),c=null!==(t=null===(e=r.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;r.style=Object.assign(Object.assign({},r.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const r=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,r}updateEdge(e,t,n){var o;const r=this.config.valueAccessor,i="function"==typeof r?r:r?e=>e[r]:e=>e.value,a=[];for(const[,r]of this.edges)if(("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t){a.push(r.data?Object.assign({},r.data):{}),r.data=n(null!==(o=r.data)&&void 0!==o?o:{});const e=i(r.data);null!=e&&(r.value=Number(e))}return a.length>0&&this.layoutVersion++,a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const n=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const o="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,r]of this.edges)o(r.data)===e&&n.push(t)}else for(const[o,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&this.layoutVersion++,n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Oi(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Ei(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=ji(t,n,o,r);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(i=e,s=n)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=Li(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function ji(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const r=t-e.cx,i=n-e.cy,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=tt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}let Ci=null,Pi=null;function Mi(){return Pi||(Ci=document.createElement("canvas"),Ci.width=1,Ci.height=1,Pi=Ci.getContext("2d")),Pi}function _i(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function Li(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;const i=_i(e),a=Mi();if(!i||!a)return null;try{if(a.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,a="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}const s=a.lineWidth;a.lineWidth=10;const l=a.isPointInStroke(i,t,n);if(a.lineWidth=s,l)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=_i(e),r=Mi();if(!o||!r)return null;try{if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(o,t,n);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Ti(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,labels:s,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",foregroundGraphics:p,sceneNodes:y,annotations:m,svgAnnotationRules:v}=t;return e.createElement(e.Fragment,null,e.createElement("svg",{role:"img",width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof l?l:"Network Chart"),e.createElement("desc",null,"string"==typeof l?l+" — network data visualization":"Network data visualization"),e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,n)=>e.createElement("text",{key:"label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),m&&m.filter(e=>"widget"!==e.type).map((t,r)=>{if(v){const i=v(t,r,{width:n,height:o,sceneNodes:y});if(i)return e.createElement(e.Fragment,{key:"annotation-"+r},i)}return null}),p),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:a.top},l):null,Pt({legend:c,totalWidth:r,totalHeight:i,margin:a,legendPosition:f,title:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&y).map((t,n)=>{var o,r,i,s,l,c,u,d,h;const g=y.find(e=>{var n,o,r,i,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(r=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===r?void 0:r.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!g)return null;const f=a.left+(null!==(o=g.cx)&&void 0!==o?o:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(r=g.x)&&void 0!==r?r:0),p=a.top+(null!==(i=g.cy)&&void 0!==i?i:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),m=null!==(l=t.dx)&&void 0!==l?l:0,v=null!==(c=t.dy)&&void 0!==c?c:-16,b=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e.createElement("span",{style:{fontSize:18,cursor:"default"}},"ℹ️");return e.createElement("div",{key:"widget-"+n,style:{position:"absolute",left:f+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function Bi(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Di(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=Bi(t);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999";r.addColorStop(0,1===a.from?s:"transparent"),r.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Ni(e,t){var n,o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Ii(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=Bi(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function $i(e,t){var n,o;if(!t.pathD)return;e.save();const r=Bi(t);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Ti.displayName="NetworkSVGOverlay";const Hi={top:20,right:80,bottom:20,left:80},Ri={top:40,right:40,bottom:40,left:40},Fi=new Set(["chord","force","circlepack","orbit"]),Wi=[800,600],zi={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Gi({data:t}){var n,o,r,i,a,s;if("edge"===t.nodeOrEdge){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:zi},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let a=c;for(;a;){const e=null!==(i=null!==(o=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:zi},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(a=l.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:zi},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const Yi=c(function(r,i){var a,c,d,h,g,f,p,y,m,v,b,x,k,w;const{chartType:A,nodes:S,edges:O,data:E,initialEdges:j,nodeIDAccessor:C="id",sourceAccessor:P="source",targetAccessor:M="target",valueAccessor:_="value",edgeIdAccessor:L,childrenAccessor:T,hierarchySum:B,orientation:D="horizontal",nodeAlign:N="justify",nodePaddingRatio:I=.05,nodeWidth:$=15,iterations:H=300,forceStrength:R=.1,padAngle:F=.01,groupWidth:W=20,sortGroups:z,edgeSort:G,treeOrientation:Y="vertical",edgeType:q="curve",padding:X,paddingTop:V,tensionConfig:U,showParticles:K=!1,particleStyle:Q,nodeStyle:Z,edgeStyle:J,colorBy:ee,colorScheme:te="category10",edgeColorBy:ne="source",edgeOpacity:oe=.5,colorByDepth:re=!1,nodeSize:ae=8,nodeSizeRange:se=[5,20],nodeLabel:le,showLabels:ce=!0,labelMode:ue,size:de=Wi,responsiveWidth:he,responsiveHeight:ge,margin:fe,className:pe,background:ye,enableHover:me=!0,tooltipContent:ve,customHoverBehavior:be,customClickBehavior:xe,onObservation:ke,chartId:we,onTopologyChange:Ae,annotations:Se,svgAnnotationRules:Oe,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:Le,title:Te,foregroundGraphics:Be,backgroundGraphics:De,decay:Ne,pulse:Ie,transition:$e,animate:He,staleness:Re,thresholds:Fe,accessibleTable:We=!0,description:ze,summary:Ge,orbitMode:Ye,orbitSize:qe,orbitSpeed:Xe,orbitRevolution:Ve,orbitRevolutionStyle:Ue,orbitEccentricity:Ke,orbitShowRings:Qe,orbitAnimated:Ze}=r,Je=Fi.has(A)?Ri:Hi,et=t(!0),tt=Un({sizeProp:de,responsiveWidth:he,responsiveHeight:ge,userMargin:fe,marginDefault:Je,foregroundGraphics:Be,backgroundGraphics:De,animate:He,transitionProp:$e,themeDirtyRef:et}),{reducedMotionRef:nt,responsiveRef:ot,size:rt,margin:it,adjustedWidth:at,adjustedHeight:st,resolvedForeground:lt,resolvedBackground:ct,transition:ut,introEnabled:dt,tableId:ht,rafRef:gt,renderFnRef:ft,scheduleRender:pt}=tt,yt=n(()=>Object.assign(Object.assign({},ir),U),[U]),xt=n(()=>Object.assign(Object.assign({},ar),Q),[Q]),kt=n(()=>({chartType:A,nodeIDAccessor:C,sourceAccessor:P,targetAccessor:M,valueAccessor:_,edgeIdAccessor:L,childrenAccessor:T,hierarchySum:B,orientation:D,nodeAlign:N,nodePaddingRatio:I,nodeWidth:$,iterations:H,forceStrength:R,padAngle:F,groupWidth:W,sortGroups:z,edgeSort:G,treeOrientation:Y,edgeType:q,padding:X,paddingTop:V,tensionConfig:yt,showParticles:K,particleStyle:xt,nodeStyle:Z,edgeStyle:J,nodeLabel:le,showLabels:ce,labelMode:ue,colorBy:ee,colorScheme:te,edgeColorBy:ne,edgeOpacity:oe,colorByDepth:re,nodeSize:ae,nodeSizeRange:se,decay:Ne,pulse:Ie,transition:ut,introAnimation:dt,staleness:Re,thresholds:Fe,orbitMode:Ye,orbitSize:qe,orbitSpeed:Xe,orbitRevolution:Ve,orbitRevolutionStyle:Ue,orbitEccentricity:Ke,orbitShowRings:Qe,orbitAnimated:Ze}),[A,C,P,M,_,T,B,D,N,I,$,H,R,F,W,z,G,Y,q,X,V,yt,K,xt,Z,J,le,ce,ue,ee,te,ne,oe,re,ae,se,Ne,Ie,null==ut?void 0:ut.duration,null==ut?void 0:ut.easing,dt,Re,Fe,Ye,qe,Xe,Ve,Ue,Ke,Qe,Ze]),At=t(null),St=t(0),Ot=t(null);Ot.current||(Ot.current=new Si(kt));const[Et,jt]=l(null),[Ct,Pt]=l(0),[Mt,_t]=l(0),[Lt,Tt]=l(!1),Bt=t(null),Dt=t(new Map),Nt=t(0),It=s(e=>{if("function"==typeof ee)return ee(e)+"";if("string"==typeof ee&&e.data){const t=e.data[ee];if(void 0!==t){if(!Dt.current.has(t+"")){const e=Array.isArray(te)?te:_e;Dt.current.set(t+"",e[Nt.current++%e.length])}return Dt.current.get(t+"")}}if(Dt.current.has(e.id))return Dt.current.get(e.id);const t=Array.isArray(te)?te:_e,n=ee?t[Nt.current++%t.length]:t[0];return Dt.current.set(e.id,n),n},[ee,te]),$t=s(e=>{if("function"==typeof ne)return ne(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===ne&&n?It(n):t?It(t):"#999"},[ne,It]),Ht=s(e=>{if(!(null==Q?void 0:Q.colorBy))return $t(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===xt.colorBy&&n?It(n):t?It(t):"#999"},[null==Q?void 0:Q.colorBy,xt.colorBy,It,$t]),Rt="sankey"===A&&K||!!Ie||null!==(c=null===(a=Ot.current)||void 0===a?void 0:a.isAnimating)&&void 0!==c&&c;o(()=>{var e;null===(e=Ot.current)||void 0===e||e.updateConfig(kt),et.current=!0,pt()},[kt,pt]);const Ft=s(()=>{var e;const t=Ot.current;if(!t)return;t.runLayout([at,st]),t.buildScene([at,st]),et.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&Dt.current.set(n.id,n.style.fill);const n=Array.isArray(te)?te:_e,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];Dt.current.has(t.id)||Dt.current.set(t.id,n[e%n.length])}if(Nt.current=o.length,Pt(t.layoutVersion),Ae){const{nodes:e,edges:n}=t.getLayoutData();Ae(e,n)}},[at,st,Ae,te]),Wt=s(e=>{const t=Ot.current;t&&(t.ingestEdge(e)&&Ft(),pt())},[Ft,pt]),zt=s(e=>{const t=Ot.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Ft(),pt()},[Ft,pt]),Gt=s(()=>{var e;null===(e=Ot.current)||void 0===e||e.clear(),Dt.current.clear(),Nt.current=0,Pt(0),jt(null),Bt.current=null,et.current=!0,pt()},[pt]),Yt=s(()=>{const e=Ot.current;e&&(e.tension+=999,Ft(),pt())},[Ft,pt]);u(i,()=>({push:Wt,pushMany:zt,removeNode:e=>{var t,n,o;const r=null!==(n=null===(t=Ot.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(r){const t=(null===(o=Bt.current)||void 0===o?void 0:o.data)?"function"==typeof C?C(Bt.current.data):Bt.current.data[C]:void 0;Bt.current&&"node"===Bt.current.nodeOrEdge&&t===e&&(Bt.current=null,jt(null)),Dt.current.delete(e),Ft(),et.current=!0,pt()}return r},removeEdge:(e,t)=>{var n,o;const r=null!==(o=null===(n=Ot.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(r){if(Bt.current&&"edge"===Bt.current.nodeOrEdge){const n=Bt.current.data;let o;o=void 0!==t?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===e&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===t:!L||!n||("function"==typeof L?L:e=>null==e?void 0:e[L])(n)===e,o&&(Bt.current=null,jt(null))}Ft(),et.current=!0,pt()}return r},updateNode:(e,t)=>{var n,o;const r=null!==(o=null===(n=Ot.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return r&&(et.current=!0,pt()),r},updateEdge:(e,t,n)=>{var o,r;const i=null!==(r=null===(o=Ot.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==r?r:[];return i.length>0&&(Ft(),et.current=!0,pt()),i},clear:Gt,getTopology:()=>{var e,t;return null!==(t=null===(e=Ot.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Ot.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Yt,getTension:()=>{var e,t;return null!==(t=null===(e=Ot.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Wt,zt,Gt,Yt,Ft,pt]);const qt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),Xt=qt?E||(Array.isArray(O)?void 0:O):void 0;o(()=>{var e;const t=Ot.current;if(t)if(qt&&Xt)t.ingestHierarchy(Xt,[at,st]),t.buildScene([at,st]),et.current=!0,pt();else{const n=S||[],o=Array.isArray(O)?O:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[at,st]),t.buildScene([at,st]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&Dt.current.set(n.id,n.style.fill+"");const r=Array.isArray(te)?te:_e,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];Dt.current.has(t.id)||Dt.current.set(t.id,r[e%r.length])}Nt.current=i.length,et.current=!0,pt()}},[S,O,E,Xt,qt,at,st,kt,pt,te]),o(()=>{j&&j.length>0&&zt(j)},[]);const Vt=s(e=>{if(be&&be(e),ke){const t=Date.now();ke(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[be,ke,we]),Ut=s(e=>{if(xe&&xe(e),ke){const t=Date.now();ke(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[xe,ke,we]),{hoverHandlerRef:Kt,hoverLeaveRef:Qt,onPointerMove:Zt,onPointerLeave:Jt}=tt;Kt.current=e=>{if(!me)return;const t=At.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-it.left,r=e.clientY-n.top-it.top;if(0>o||o>at||0>r||r>st)return void(Bt.current&&(Bt.current=null,jt(null),Vt&&(Vt(null),et.current=!0),pt()));const i=Ot.current;if(!i)return;const a=Ei(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(Bt.current&&(Bt.current=null,jt(null),Vt&&(Vt(null),et.current=!0),pt()));const s=fo(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});Bt.current=s,jt(s),Vt&&(Vt(s),et.current=!0),pt()},Qt.current=()=>{Bt.current&&(Bt.current=null,jt(null),Vt&&(Vt(null),et.current=!0),pt())};const en=t(()=>{});en.current=e=>{if(!xe&&!ke)return;const t=At.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-it.left,r=e.clientY-n.top-it.top;if(0>o||o>at||0>r||r>st)return;const i=Ot.current;if(!i)return;const a=Ei(i.sceneNodes,i.sceneEdges,o,r);Ut(a?fo(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)};const tn=s(e=>en.current(e),[]),nn=t(-1),on=t(null),sn=t(-1),ln=s(e=>{var t;const n=Ot.current;if(!n)return;const o=function(e){var t,n,o,r,i,a;const s=[];for(const l of e)"circle"===l.type&&null!=l.cx?s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"}):"rect"===l.type&&null!=l.x?s.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(r=null===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==r?r:"_default"}):"arc"===l.type&&null!=l.cx&&s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(a=null===(i=l.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(n.sceneNodes);if(0===o.length)return;const r=mt(o),i=nn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),nn.current=0,sn.current=-1;const t=r.flat[0];on.current={shape:t.shape,w:t.w,h:t.h};const n=fo(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Bt.current=n,jt(n),Vt&&(Vt(n),et.current=!0),void pt()}const a=vt(r,i),s=function(e,t,n,o,r){var i,a,s;const l=n.flat[t.flatIndex];if(!l)return bt(e,t,n);const c=null===(i=l.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,r=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;r>u&&(r=u,o=i)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(r.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n,o,r;const i=e+"",a=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,s="object"==typeof t.source?null===(o=t.source)||void 0===o?void 0:o.id:t.source,l="object"==typeof t.target?null===(r=t.target)||void 0===r?void 0:r.id:t.target,c=null!=s,u=null!=l;c&&s+""===i&&u?a.push(l+""):u&&l+""===i&&c&&a.push(s+"")}return a}(c,o);if(0===e.length)return t.flatIndex;const i=null!==(s=n.idToIdx.get(e[(r.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const o=bt(e,t,n);return null!==o&&o!==t.flatIndex&&(r.current=-1),o}}}(e.key,a,r,null!==(t=n.sceneEdges)&&void 0!==t?t:[],sn);if(null===s)return;if(e.preventDefault(),0>s)return nn.current=-1,on.current=null,sn.current=-1,Bt.current=null,jt(null),Vt&&(Vt(null),et.current=!0),void pt();nn.current=s;const l=r.flat[s];on.current={shape:l.shape,w:l.w,h:l.h};const c=l.datum||{},u=Object.assign(Object.assign({},"object"!=typeof c||null===c||Array.isArray(c)?{}:c),{data:c,x:l.x,y:l.y,time:l.x,value:l.y,nodeOrEdge:"node"});Bt.current=u,jt(u),Vt&&(Vt(u),et.current=!0),pt()},[Vt,pt]),cn=s(e=>{nn.current=-1,on.current=null,Zt(e)},[Zt]);ft.current=()=>{var e,t,n,o,r,i,a;gt.current=0;const s=At.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=Ot.current;if(!c)return;const u=performance.now(),d=St.current?Math.min((u-St.current)/1e3,.1):.016;St.current=u;const h=c.advanceTransition(nt.current?u+1e6:u),g=!nt.current&&h,f=!nt.current&&c.tickAnimation([at,st],d);(h||et.current||f)&&c.buildScene([at,st]);const p=Qn();if(!Kn(s,rt,it,p))return;l.clearRect(-it.left,-it.top,rt[0],rt[1]),ye&&(l.fillStyle=ye,l.fillRect(0,0,at,st)),Ne&&c.applyDecay(),Ie&&c.applyPulse(u),Fe&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==Re?void 0:Re.threshold)&&void 0!==e?e:5e3,m=Re&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Re?void 0:Re.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Di(e,n);break;case"line":Ni(e,n);break;case"ribbon":Ii(e,n);break;case"curved":$i(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),oo(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),ro(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(l,c.sceneNodes),K&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:ar.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:ar.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,xt);const t=.5*(null!==(n=xt.speedMultiplier)&&void 0!==n?n:1);let o;if(xt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:ar.radius,l=null!==(a=o.opacity)&&void 0!==a?a:ar.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,xt,Ht)}}m&&(l.globalAlpha=1);const v=et.current;if(et.current=!1,v||g||f){const e=At.current;e&&e.setAttribute("aria-label",hn(null!==(r=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==r?r:0,null!==(a=null===(i=c.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(v||g||f)&&_t(e=>e+1),(Rt||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(gt.current=requestAnimationFrame(()=>ft.current()))},o(()=>(pt(),()=>{}),[pt]),o(()=>{et.current=!0,pt()},[A,at,st,ye,pt]),wt(Re,Ot,et,pt,Lt,Tt);const un=me&&Et?e.createElement(Cn,{x:Et.x,y:Et.y,containerWidth:at,containerHeight:st,margin:it,className:"stream-network-tooltip",zIndex:2},ve?ve(Et):e.createElement(Gi,{data:Et})):null;if(an){const t=Ot.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),n=e?E||(Array.isArray(O)?void 0:O):void 0;if(e&&n)t.ingestHierarchy(n,[at,st]),t.buildScene([at,st]);else{const e=S||[],n=Array.isArray(O)?O:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[at,st]),t.buildScene([at,st]))}}const n=null!==(d=null==t?void 0:t.sceneNodes)&&void 0!==d?d:[],o=null!==(h=null==t?void 0:t.sceneEdges)&&void 0!==h?h:[],r=null!==(g=null==t?void 0:t.labels)&&void 0!==g?g:[];return e.createElement("div",{className:"stream-network-frame"+(pe?" "+pe:""),role:"img","aria-label":ze||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:rt[0],height:rt[1]}},e.createElement(An,{summary:Ge}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:rt[0],height:rt[1],style:{position:"absolute",left:0,top:0}},ct&&e.createElement("g",{transform:`translate(${it.left},${it.top})`},ct),e.createElement("g",{transform:`translate(${it.left},${it.top})`},ye&&e.createElement("rect",{x:0,y:0,width:at,height:st,fill:ye}),o.map((t,n)=>function(t,n){switch(t.type){case"line":return e.createElement("line",{key:"net-edge-"+n,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity});case"bezier":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"ribbon":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"curved":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),n.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e.createElement("circle",{key:"net-circle-"+n,cx:o.cx,cy:o.cy,r:o.r,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"rect":{const o=t;return e.createElement("rect",{key:"net-rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"arc":{const o=t,r=ie().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)({})||"";return e.createElement("path",{key:"net-arc-"+n,d:r,transform:`translate(${o.cx},${o.cy})`,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e.createElement("text",{key:"net-label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder},t.text)}(t,n)).filter(Boolean))),e.createElement(Ti,{width:at,height:st,totalWidth:rt[0],totalHeight:rt[1],margin:it,labels:r,sceneNodes:n,title:Te,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:Le,foregroundGraphics:lt,annotations:Se,svgAnnotationRules:Oe,annotationFrame:0}))}const dn=Ot.current;return e.createElement("div",{ref:ot,className:"stream-network-frame"+(pe?" "+pe:""),role:"group","aria-label":ze||("string"==typeof Te?Te:"Network chart"),tabIndex:0,style:{position:"relative",width:he?"100%":rt[0],height:ge?"100%":rt[1],overflow:"visible"},onKeyDown:ln},We&&e.createElement(Sn,{tableId:ht}),We&&e.createElement(wn,{nodes:null!==(f=null==dn?void 0:dn.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==dn?void 0:dn.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:ht,chartTitle:"string"==typeof Te?Te:void 0}),e.createElement(An,{summary:Ge}),e.createElement("div",{role:"img","aria-label":ze||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:me?cn:void 0,onMouseLeave:me?Jt:void 0,onClick:xe||ke?tn:void 0},ct&&e.createElement("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:rt[0],height:rt[1],pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${it.left},${it.top})`},ct)),e.createElement("canvas",{ref:At,"aria-label":hn(null!==(m=null===(y=null==dn?void 0:dn.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==dn?void 0:dn.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(On,{hoverPoint:Et}),e.createElement(Ti,{width:at,height:st,totalWidth:rt[0],totalHeight:rt[1],margin:it,labels:(null==dn?void 0:dn.labels)||[],sceneNodes:null==dn?void 0:dn.sceneNodes,title:Te,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:Le,foregroundGraphics:lt,annotations:Se,svgAnnotationRules:Oe,annotationFrame:Mt}),e.createElement(jn,{active:nn.current>=0,hoverPoint:Et,margin:it,size:rt,shape:null===(x=on.current)||void 0===x?void 0:x.shape,width:null===(k=on.current)||void 0===k?void 0:k.w,height:null===(w=on.current)||void 0===w?void 0:w.h}),un,(null==Re?void 0:Re.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Re.badgePosition?{top:4,left:4}:"bottom-left"===Re.badgePosition?{bottom:4,left:4}:"bottom-right"===Re.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Lt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},Lt?"STALE":"LIVE")))});Yi.displayName="StreamNetworkFrame";const qi={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Xi(e,t){return"function"==typeof t?t(e):e[t]}function Vi(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Ui(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=Xi(t,o);s=Vi(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Xi(t,o);l.push({label:n,value:Vi(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=Vi(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=Vi(t[e[0]],r))}}const c=Object.assign(Object.assign({},qi),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function Ki(t={}){const{fields:n=[],title:o,format:r,style:i={},className:a="",showLabels:s=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=Xi(t,o);c.push({value:Vi(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Vi(Xi(t,o),i);c.push({label:s?n:void 0,value:a})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:s?e:void 0,value:Vi(t[e],r)})});const u=Object.assign(Object.assign({},qi),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function Qi(t){if(!0===t)return Ui();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:qi},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Ui(t):Ui())}function Zi(e){return"string"==typeof e?e:"value"}function Ji(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function ea(e,t){if(!t)return Ji(e);try{const n=t(e);return null==n?Ji(e):n}catch(t){return Ji(e)}}function ta(e,t){return"function"==typeof t?t(e):e[t]}function na(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const r=t.data;if(!r)return null;const i=n?ea(ta(r,n.accessor),n.format):null;return e.createElement("div",{className:"semiotic-tooltip",style:qi},null!=i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=ea(ta(r,t.accessor),t.format);return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.7}},t.label,": "),e.createElement("span",null,o))}))}}function oa({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1,valueFormat:a}){return s=>{var l;const c=i?(null===(l=s.data)||void 0===l?void 0:l[0])||s.data||s:s.data||s,u=ta(c,t),d=ta(c,n),h=o?ta(c,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:qi},e.createElement("div",{style:{fontWeight:"bold"}},Ji(u)),e.createElement("div",{style:{marginTop:4}},ea(d,a)),null!=h&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||Zi(o),": ",Ji(h)))}}const ra=i(null);function ia({colors:t,categories:o,colorScheme:r="category10",children:i}){const a=n(()=>{if(t)return t;if(o){const e=Array.isArray(r)?r:Me[r]||_e,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,r]);return e.createElement(ra.Provider,{value:a},i)}function aa(){return a(ra)}function sa(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function la(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(sa(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function ca(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}ia.displayName="CategoryColorProvider";const[ua,da]=Pn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=ca(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=ca(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[ha,ga]=Pn(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function fa(e){const t=d(),o=e.clientId||t,{name:r}=e,i=da(e=>e.selections.get(r)),a=da(e=>e.setClause),l=da(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?la(i,o):()=>!0,[i,o]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:s(()=>{l(r,o)},[l,r,o]),clientId:o}}function pa(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=fa({name:t});return{onHover:s(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}function ya(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:l,clear:c}=fa({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=s(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function ma(e,t,o){const r=da(e=>e.selections.get(t));return n(()=>{if(!r||0===r.clauses.size)return e;const t=la(r,o);return e.filter(t)},[e,r,o])}function va(e={}){const{limit:t=50,types:o,chartId:r}=e,i=ga(e=>e.version),a=ga(e=>e.observations),s=ga(e=>e.clearObservations),l=n(()=>{let e=a;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[a,o,r,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const ba=i(!1);function xa({selections:e}){const t=da(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function ka({categoryColors:r,interaction:i,selectionName:a,field:c}){const u=Object.entries(r);if(0===u.length)return null;const d=u.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:u.map(([e,t])=>({label:e,color:t})),label:""}],g=pa({name:a,fields:[c]}),f=fa({name:a,clientId:"__linked-legend-isolate__"}),[p,y]=l(new Set),[m,v]=l(null),b=t(f.selectPoints);b.current=f.selectPoints;const x=t(f.clear);x.current=f.clear,o(()=>{"isolate"===i&&(p.size>0?b.current({[c]:Array.from(p)}):x.current())},[i,p,c]);const k=s(e=>{"highlight"===i&&(e?(v(e.label),g.onHover({[c]:e.label})):(v(null),g.onHover(null)))},[i,c,g]),w=s(e=>{"isolate"===i&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===d.length?new Set:n})},[i,d.length]),[A,[S]]=Hn([0,0],!0,!1),O=n(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(u.map(([e])=>e),S),[u,S]);return e.createElement("div",{ref:A,style:{width:"100%",display:"block"}},e.createElement("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"}},e.createElement(Ct,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===i?k:void 0,customClickBehavior:"isolate"===i?w:void 0,highlightedCategory:m,isolatedCategories:p})))}function wa({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:a="legend",legendField:s="category"}){const l=aa(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(ua,null,e.createElement(ha,null,n&&e.createElement(xa,{selections:n}),e.createElement(ba.Provider,{value:c},c&&"top"===r&&l&&e.createElement(ka,{categoryColors:l,interaction:i,selectionName:a,field:s}),t,c&&"bottom"===r&&l&&e.createElement(ka,{categoryColors:l,interaction:i,selectionName:a,field:s}))))}function Aa({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):Le[i%Le.length];return{label:r+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:s,label:""}]}}function Sa(e){return e?"string"==typeof e?{name:e}:e:null}function Oa(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const Ea=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],ja={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},Ca={light:Tn,dark:Bn,"high-contrast":Dn,pastels:{mode:"light",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Pa(e){return Ca[e]}function Ma(e,t=":root"){var n,o,r,i,a;const s=[];return s.push(` --semiotic-bg: ${e.colors.background};`),s.push(` --semiotic-text: ${e.colors.text};`),s.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),s.push(` --semiotic-grid: ${e.colors.grid};`),s.push(` --semiotic-border: ${e.colors.border};`),s.push(` --semiotic-primary: ${e.colors.primary};`),s.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&s.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&s.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&s.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&s.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(n=e.tooltip)||void 0===n?void 0:n.background)&&s.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(o=e.tooltip)||void 0===o?void 0:o.text)&&s.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(r=e.tooltip)||void 0===r?void 0:r.borderRadius)&&s.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)&&s.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(a=e.tooltip)||void 0===a?void 0:a.shadow)&&s.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&s.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&s.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&s.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&s.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&s.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),`${t} {\n${s.join("\n")}\n}`}function _a(e){var t,n,o,r,i,a;return{semiotic:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.text)||e.colors.text,$type:"color"},radius:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(a=e.colors.selectionOpacity)&&void 0!==a?a:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{})}}const La=e.createContext(void 0);function Ta({theme:t}){const n=In(e=>e.setTheme),o=In(e=>e.theme),r=e.useRef(o);r.current=o;const i=e.useRef(null);return e.useEffect(()=>{if(void 0!==t)return;if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(forced-colors: active)");return e.matches&&(i.current=r.current,n(Dn)),$n(e,e=>{var t;e.matches?(i.current=r.current,n(Dn)):(n(null!==(t=i.current)&&void 0!==t?t:Tn),i.current=null)})},[t,n]),e.useEffect(()=>{if(void 0!==t)if("string"==typeof t){const e=Pa(t);n(e||t)}else n(t)},[t,n]),null}function Ba({children:t}){var n,o,r,i,a;const s=In(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":s.colors.background,"--semiotic-text":s.colors.text,"--semiotic-text-secondary":s.colors.textSecondary,"--semiotic-grid":s.colors.grid,"--semiotic-border":s.colors.border,"--semiotic-primary":s.colors.primary,"--semiotic-font-family":s.typography.fontFamily},s.colors.focus?{"--semiotic-focus":s.colors.focus}:{}),(null===(n=s.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":s.tooltip.background}:{}),(null===(o=s.tooltip)||void 0===o?void 0:o.text)?{"--semiotic-tooltip-text":s.tooltip.text}:{}),(null===(r=s.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":s.tooltip.borderRadius}:{}),(null===(i=s.tooltip)||void 0===i?void 0:i.fontSize)?{"--semiotic-tooltip-font-size":s.tooltip.fontSize}:{}),(null===(a=s.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":s.tooltip.shadow}:{}),s.borderRadius?{"--semiotic-border-radius":s.borderRadius}:{}),s.colors.selection?{"--semiotic-selection-color":s.colors.selection}:{}),null!=s.colors.selectionOpacity?{"--semiotic-selection-opacity":s.colors.selectionOpacity+""}:{}),s.colors.diverging?{"--semiotic-diverging":s.colors.diverging}:{}),s.colors.annotation?{"--semiotic-annotation-color":s.colors.annotation}:{}),null!=s.typography.legendSize?{"--semiotic-legend-font-size":s.typography.legendSize+"px"}:{}),null!=s.typography.titleFontSize?{"--semiotic-title-font-size":s.typography.titleFontSize+"px"}:{}),null!=s.typography.tickFontFamily?{"--semiotic-tick-font-family":s.typography.tickFontFamily}:{}),c=e.useContext(La),u={};return c&&(u["data-semiotic-theme"]=c),e.createElement("div",Object.assign({style:l},u),t)}function Da({theme:t,children:n}){const o="string"==typeof t&&Pa(t)?t:void 0;return e.createElement(Nn,null,e.createElement(La.Provider,{value:o},e.createElement(Ta,{theme:t}),e.createElement(Ba,null,n)))}function Na(){return In(e=>e.theme)}const Ia="#007bff";function $a(){var e;const t=Na(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Ha(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Me[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:Ia}function Ra(e){return"function"==typeof e?e:t=>t[e]}function Fa(e,t,o){const r=aa(),i=$a();return n(()=>{var n;if(!t)return;const a=null!==(n=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=Ne(n.map(e=>({_cat:e})),"_cat",a);return t=>r[t]||e(t)}return Ne(n.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const n=Ne(e,t,a);return e=>r[e]||n(e)}return Ne(e,t,a)}if(r&&Object.keys(r).length>0){const e=Ne([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[e,t,o,r,i])}function Wa(e,t,o){return n(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r=Ra(o);return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function za({selection:e,linkedHover:t,fallbackFields:r=[],unwrapData:i=!1,onObservation:a,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:f}){const p=d(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,r),m=fa({name:(null==e?void 0:e.name)||"__unused__"}),v=pa({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||r||[]}),b=ga(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=l(null),A=f||r[0],S=n(()=>{if(!g||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,k,A]),O=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Wt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Wt={positions:new Map(Wt.positions).set(e,{xValue:t,sourceId:n})},Gt())}(y.name||"hover",Number(e),p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Yt(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(g&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(a||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});a&&a(e),b&&b(e)}}},[t,v,y,p,a,c,u,b,g,A]),E=s(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Wt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Wt.positions);return t.delete(e),Wt={positions:t},Gt(),!1}Wt={positions:new Map(Wt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Gt()}(y.name||"hover",Number(n),p)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(a||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});a&&a(e),b&&b(e)}}},[h,a,b,c,u,y,p]);return o(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{qt(e,p),Yt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:E,crosshairSourceId:p}}function Ga(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Ya({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=a(ba),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return Aa({data:e,colorBy:t,colorScale:o,getColor:De,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),s);return h&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,s,h,i]);return{legend:h,margin:g,legendPosition:i}}function qa(e,t,o){const[r,i]=l(null),[a,c]=l(new Set),u=s(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,r,a]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const Xa={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Va(e,t,n){var o,r,i,a,s,l,c;const u=Xa[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Ua(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function Ua(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Ka({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class Qa extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(Ka,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Za(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ja(e,t,n=3){let o,r=n+1;for(const n of t){const t=Za(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function es(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function ts(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Ja(e,t,3))&&void 0!==n?n:null)}function ns({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=es(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=ts(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function os({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function rs({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=es(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=ts(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const is={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},as={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},ss={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},ls=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],cs=["vertical","horizontal"],us={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ls},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ls},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ls},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},is),as),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:cs},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:cs},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:cs},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:cs},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:cs},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:cs},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:cs},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:cs},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},is),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},is),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},is),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},is),ss),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},is),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},is),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:cs},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},is),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},is),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},is),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},is),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},is),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},is),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},is),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},is),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},is),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},is),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},is),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function ds(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const hs=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),gs=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),fs=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ps=new Set(["LineChart","AreaChart","StackedAreaChart"]),ys=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function ms(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function vs(e,t){const n=ms(e),o=ms(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const bs=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];var xs;const ks="undefined"!=typeof process&&"production"!==(null===(xs=process.env)||void 0===xs?void 0:xs.NODE_ENV);function ws({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(Qa,{fallback:i=>{let a="";if(ks&&r)try{const e=function(e,t){const n=[],o=function(e,t){const n=[],o=us[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(us).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!ds(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Ja(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=ns({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=os({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=rs({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return us[e]?(function(e,t,n){const o=us[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=us[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){hs.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){gs.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=us[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!fs.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!ps.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=us[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!ys.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=vs(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=vs(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of bs)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(Ka,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const As={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Ss={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Os(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},As),{width:n,height:o})},r||"No data available"):null}function Es(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ss),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function js(e,t,n,o){if(!ks)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Cs(e){const t=In(e=>e.theme.colors.selectionOpacity);return n(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Ps(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,S="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:O,hoverSelectionHook:E,customHoverBehavior:j,customClickBehavior:C,crosshairSourceId:P}=za({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:S}),M=Ga(c,P),_=Fa(t,r,i),L=n(()=>{if(!r)return[];const e=new Set;for(const n of t){const t="function"==typeof r?r(n):n[r];null!=t&&e.add(t+"")}return Array.from(e)},[t,r]),T=qa(a,r,L),B=n(()=>E||(T.legendSelectionHook?T.legendSelectionHook:O),[E,T.legendSelectionHook,O]),D=Cs(l),{legend:N,margin:I,legendPosition:$}=Ya({data:t,colorBy:r,colorScale:_,showLegend:p,legendPosition:s,userMargin:y,defaults:m}),H=n(()=>{const e={};return N&&(e.legend=N,e.legendPosition=$),a&&"none"!==a&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),e},[N,$,a,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories]),R=Es(x,w,A),F=R?null:Os(o,w,A,k);return{colorScale:_,allCategories:L,legendState:T,effectiveSelectionHook:B,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:C,legend:N,margin:I,legendPosition:$,earlyReturn:R||F||null,legendBehaviorProps:H,crosshairProps:M,resolvedSelection:D}}const Ms=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,frameProps:E={},selection:j,linkedHover:C,linkedBrush:P,onObservation:M,onClick:_,hoverHighlight:L,chartId:T,loading:B,emptyContent:D,legendInteraction:N,legendPosition:I,color:$}=o,H=a.width,R=a.height,F=a.enableHover,W=a.showGrid,z=a.title,G=a.description,Y=a.summary,q=a.accessibleTable,X=a.xLabel,V=a.yLabel,U=l||[],K=Ps({data:U,rawData:l,colorBy:y,colorScheme:m,legendInteraction:N,legendPosition:I,selection:j,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:M,onClick:_,hoverHighlight:L,chartType:"Scatterplot",chartId:T,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:B,emptyContent:D,width:H,height:R}),Q=Sa(P),Z=ya({name:(null==Q?void 0:Q.name)||"__unused_brush__",xField:(null==Q?void 0:Q.xField)||("string"==typeof f?f:void 0),yField:(null==Q?void 0:Q.yField)||("string"==typeof p?p:void 0)}),J=Q?"xyBrush"===Z.brushInteraction.brush?"xy":"xBrush"===Z.brushInteraction.brush?"x":"y":void 0,ee=e.useRef(Z.brushInteraction);ee.current=Z.brushInteraction;const te=s(e=>{const t=ee.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(K.earlyReturn)return K.earlyReturn;js("Scatterplot",U,"xAccessor",f),js("Scatterplot",U,"yAccessor",p);const ne=n(()=>{if(!v||0===U.length)return;const e=U.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[U,v]),oe=n(()=>e=>{const t={fillOpacity:k};return y?K.colorScale&&(t.fill=De(e,y,K.colorScale)):t.fill=$||Ia,t.r=v?Ie(e,v,b,ne):x,t},[y,K.colorScale,v,b,ne,x,k,$]),re=n(()=>Oa(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),ie=n(()=>na([{label:X||Zi(f),accessor:f,role:"x",format:h},{label:V||Zi(p),accessor:p,role:"y",format:g},...y?[{label:Zi(y),accessor:y,role:"color"}]:[],...v?[{label:Zi(v),accessor:v,role:"size"}]:[]]),[f,p,X,V,y,v,h,g]),ae=ns({componentName:"Scatterplot",data:l,accessors:{xAccessor:f,yAccessor:p}});if(ae)return e.createElement(Ka,{componentName:"Scatterplot",message:ae,width:H,height:R});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:U}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:re,colorScheme:m,size:[H,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,showAxes:a.showAxes,xLabel:X,yLabel:V,xFormat:h,yFormat:g,enableHover:F,showGrid:W}),K.legendBehaviorProps),z&&{title:z}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===w?()=>null:Qi(w)||ie}),(C||M||_||L)&&{customHoverBehavior:K.customHoverBehavior}),(M||_||C)&&{customClickBehavior:K.customClickBehavior}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),O&&O.length>0&&{annotations:O}),Q&&{brush:{dimension:J},onBrush:te}),K.crosshairProps),E);return e.createElement(ws,{componentName:"Scatterplot",width:H,height:R},e.createElement(Oo,Object.assign({ref:i},se)))});function _s(e,t){return S(1===t?.5:e/(t-1))}Ms.displayName="Scatterplot";const Ls=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M}=o,_=s.width,L=s.height,T=s.enableHover,B=s.showGrid,D=s.title,N=s.description,I=s.summary,$=s.accessibleTable,H=s.xLabel,R=s.yLabel,F=l||[],{safeData:W,orderMap:z}=n(()=>{const e="function"==typeof g?g:e=>e[g],t="function"==typeof f?f:e=>e[f];let n=F;if(p&&F.length>0){const e="function"==typeof p?p:e=>e[p];n=[...F].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[F,p,g,f]);js("ConnectedScatterplot",W,"xAccessor",g),js("ConnectedScatterplot",W,"yAccessor",f);const{activeSelectionHook:G,hoverSelectionHook:Y,customHoverBehavior:q,customClickBehavior:X,crosshairSourceId:V}=za({selection:w,linkedHover:A,fallbackFields:[],onObservation:S,onClick:O,chartType:"ConnectedScatterplot",chartId:j,hoverHighlight:E,colorByField:void 0}),U=Cs(w),K=Ga(A,V),Q=qa(M,void 0,[]),Z=n(()=>Y||(Q.legendSelectionHook?Q.legendSelectionHook:G),[Y,Q.legendSelectionHook,G]),J=null!==(i=null==U?void 0:U.unselectedOpacity)&&void 0!==i?i:.5,ee=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==Z?void 0:Z.isActive,a=null==Z?void 0:Z.predicate,s=100>r.length,l=r.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=r[t],u=r[t+1],d=_s(t,l),h=!i||!a||a(null!==(n=c.datum)&&void 0!==n?n:c)||a(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:J:1;s&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=m,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[m,Z,J]),te=n(()=>[ee],[ee]),ne=n(()=>(t,n,o)=>{var r,i;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const s=a.length,l=100>s,c=[];for(let t=0;s-1>t;t++){const n=a[t],o=a[t+1],u=_s(t,s),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.createElement("line",{key:"halo-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*g})),c.push(e.createElement("line",{key:"seg-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[m]),oe=n(()=>[ne],[ne]),re=n(()=>e=>{var t,n;const o=z.get(e),r=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,i=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:i>0?_s(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,z]),ie=n(()=>Oa(re,Z,U),[re,Z,U]),ae=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),se=y||("string"==typeof p?p:"Order"),le=n(()=>na([{label:H||Zi(g),accessor:g,role:"x",format:d},{label:R||Zi(f),accessor:f,role:"y",format:h},...p?[{label:se,accessor:p,role:"group"}]:[]]),[g,f,H,R,p,se,d,h]),ce=ns({componentName:"ConnectedScatterplot",data:l,accessors:{xAccessor:g,yAccessor:f}}),ue=Es(C,_,L),de=ue?null:Os(l,_,L,P),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:W}),{xAccessor:g,yAccessor:f,pointStyle:ie,size:[_,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,showAxes:s.showAxes,xLabel:H,yLabel:R,xFormat:d,yFormat:h,enableHover:T,showGrid:B}),D&&{title:D}),N&&{description:N}),I&&{summary:I}),void 0!==$&&{accessibleTable:$}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:Qi(v)||le}),(A||S||O||E)&&{customHoverBehavior:q}),(S||O||A)&&{customClickBehavior:X}),b&&{pointIdAccessor:b}),{canvasPreRenderers:te,svgPreRenderers:oe}),x&&x.length>0&&{annotations:x}),K),k);return ue||de||(ce?e.createElement(Ka,{componentName:"ConnectedScatterplot",message:ce,width:_,height:L}):e.createElement(ws,{componentName:"ConnectedScatterplot",width:_,height:L},e.createElement(Oo,Object.assign({ref:a},he))))});function Ts(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}Ls.displayName="ConnectedScatterplot","function"==typeof SuppressedError&&SuppressedError;const Bs="__forecastSegment";let Ds=null;function Ns(){return Ts(this,void 0,void 0,function*(){return Ds||(Ds=yield import("./semiotic-statisticalOverlays-DGX_WWc5.js")),Ds})}const Is=c(function(r,i){var a,c;const d=t(null);u(i,()=>({push:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=d.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=d.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=d.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const h=Va(r.mode,{width:r.width,height:r.height,showGrid:r.showGrid,enableHover:r.enableHover,showLegend:r.showLegend,title:r.title,description:r.description,summary:r.summary,accessibleTable:r.accessibleTable,xLabel:r.xLabel,yLabel:r.yLabel}),{data:g,margin:f,className:p,xFormat:y,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:E=3,fillArea:j=!1,areaOpacity:C=.3,lineWidth:P=2,lineGradient:M,tooltip:_,pointIdAccessor:L,annotations:T,directLabel:B,gapStrategy:D="break",anomaly:N,forecast:I,frameProps:$={},selection:H,linkedHover:R,onObservation:F,onClick:W,hoverHighlight:z,hoverRadius:G,chartId:Y,loading:q,emptyContent:X,legendInteraction:V,legendPosition:U,xScaleType:K,yScaleType:Q,color:Z}=r,J=h.width,ee=h.height,te=h.enableHover,ne=h.showGrid,oe=h.showLegend,re=h.title,ie=h.description,ae=h.summary,se=h.accessibleTable,le=h.xLabel,ce=h.yLabel,ue=Es(q,J,ee),de=ue?null:Os(g,J,ee,X),he=g||[];js("LineChart",he,"xAccessor",v),js("LineChart",he,"yAccessor",b);const ge="string"==typeof v?v:"__semiotic_resolvedX",fe="string"==typeof b?b:"__semiotic_resolvedY",[pe,ye]=l(null),[me,ve]=l([]),be=n(()=>{if(!I&&!N)return he;const e="function"==typeof v,t="function"==typeof b;return e||t?he.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):he},[he,I,N,v,b]),xe=t(I),ke=t(N);o(()=>{if(!I&&!N)return void((xe.current||ke.current)&&(ye(null),ve([]),xe.current=I,ke.current=N));let e=!1;const t=I!==xe.current||N!==ke.current;if(xe.current=I,ke.current=N,t&&(ye(null),ve([])),I){const t=x&&"string"==typeof x&&"object"==typeof I?Object.assign(Object.assign({},I),{_groupBy:x}):I;(function(...e){return Ts(this,void 0,void 0,function*(){return(yield Ns()).buildForecast(...e)})})(be,ge,fe,t,N).then(t=>{e||(ye(t),ve(t.annotations))}).catch(()=>{e||(ye(null),ve([]))})}else N&&function(...e){return Ts(this,void 0,void 0,function*(){return(yield Ns()).buildAnomalyAnnotations(...e)})}(N).then(t=>{e||(ye(null),ve(t))}).catch(()=>{e||ve([])});return()=>{e=!0}},[be,I,N,ge,fe]);const we=pe?pe.processedData:he,Ae="__compoundGroup",Se=!(!I||!x),Oe=Se?Ae:I?Bs:x,Ee=n(()=>{if(!Se)return we;const e="function"==typeof x?x:e=>e[x];return we.map(t=>{const n=Object.assign({},t);return n[Ae]=`${e(t)}__${t[Bs]||"observed"}`,n})},[we,Se,x]),je=Se?Ee:we,Ce=n(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const a=pe?pe.processedData:he;for(const e of a){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[I,pe,he,b]),{activeSelectionHook:Pe,hoverSelectionHook:Me,customHoverBehavior:_e,customClickBehavior:Le,crosshairSourceId:Te}=za({selection:H,linkedHover:R,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:F,onClick:W,chartType:"LineChart",chartId:Y,hoverHighlight:z,colorByField:"string"==typeof w?w:void 0}),Be=Cs(H),Ne=Ga(R,Te),Ie=s(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),$e=void 0!==(null===(a=je[0])||void 0===a?void 0:a[k]),He=n(()=>{if($e)return je;if(Oe){const e=je.reduce((e,t)=>{const n="function"==typeof Oe?Oe(t):t[Oe];if(!e[n]){const o={[k]:[]};"string"==typeof Oe&&(o[Oe]=n),Se&&(o[Bs]=t[Bs],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:je}]},[je,Oe,k,$e]),{gapProcessedLineData:Re,hasGaps:Fe}=n(()=>{if("interpolate"===D){let e=!1;const t=[];for(const n of He){const o=(n[k]||[]).filter(t=>!Ie(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===D){let e=!1;const t=[];for(const n of He){const o=n[k]||[];let r=[],i=0;const a=Oe&&"string"==typeof Oe?n[Oe]:void 0;for(const s of o)if(Ie(s))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=a?`${a}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===D){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of He){const r=o[k]||[],i=[];for(const n of r)Ie(n)?(e=!0,i.push(Object.assign(Object.assign({},n),{[t]:0}))):i.push(n);n.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:He,hasGaps:!1}},[He,D,k,Ie,Oe,b]),We=Fa(we,w,A),ze=n(()=>{if(!w)return[];const e=new Set;for(const t of we){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[we,w]),Ge=qa(V,w,ze),Ye=n(()=>Me||(Ge.legendSelectionHook?Ge.legendSelectionHook:Pe),[Me,Ge.legendSelectionHook,Pe]),qe=n(()=>(e,t)=>{const n={strokeWidth:P},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return w?We&&(n.stroke=De(e,w,We),o&&(n.fill=n.stroke,n.fillOpacity=C)):(n.stroke=Z||Ia,o&&(n.fill=Z||Ia,n.fillOpacity=C)),n},[w,We,P,j,C,Z]),[Xe,Ve]=l(null);o(()=>{if(!I)return void Ve(null);let e=!1;return function(...e){return Ts(this,void 0,void 0,function*(){return(yield Ns()).createSegmentLineStyle(...e)})}(qe,I).then(t=>{e||Ve(()=>t)}).catch(()=>{e||Ve(null)}),()=>{e=!0}},[qe,I]);const Ue=Xe||qe,Ke=n(()=>Oa(Ue,Ye,Be),[Ue,Ye,Be]),Qe=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return w?We&&(t.fill=De(e.parentLine||e,w,We)):t.fill=Z||Ia,t}},[O,E,w,We,Z]),Ze=Array.isArray(j)?"mixed":j?"area":"line",Je="object"==typeof B?B:{},et=Je.position||"end",tt=Je.fontSize||11,nt=n(()=>{var e,t;if(!B||!w)return[];const n="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],r="function"==typeof w?w:e=>e[w],i=new Map;for(const n of Re){const o=n[k]||[];if(0===o.length)continue;const a="end"===et?o[o.length-1]:o[0],s=null!==(t=null!==(e=r(a))&&void 0!==e?e:r(n))&&void 0!==t?t:"";s&&!i.has(s+"")&&i.set(s+"",a)}const a=Array.from(i.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof v?v:"x"]:n(t),["string"==typeof b?b:"y"]:o(t),dx:"end"===et?6:-6,dy:0,color:We?We(e):Ia,fontSize:tt}));a.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;a.length>e;e++){const t="string"==typeof b?b:"y",n=a[e-1],o=a[e];tt+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=tt+2)}return a},[B,w,We,Re,k,v,b,et,tt]),ot=(!B||void 0!==oe)&&oe,rt=n(()=>{if(!B)return h.marginDefaults;const e=nt.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*tt);return Math.max(e,o)},0),t=e+10,n="end"===et?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[B,nt,tt,et,h.marginDefaults]),{legend:it,margin:at,legendPosition:st}=Ya({data:Re,colorBy:w,colorScale:We,showLegend:ot,legendPosition:U,userMargin:f,defaults:rt}),lt=x||w,ct=n(()=>na([{label:le||Zi(v),accessor:v,role:"x",format:y},{label:ce||Zi(b),accessor:b,role:"y",format:m},...lt?[{label:Zi(lt),accessor:lt,role:"group"}]:[]]),[v,b,le,ce,lt,y,m]),ut=ns({componentName:"LineChart",data:$e?(null===(c=we[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),dt=n(()=>$e||Oe||Fe?Re.flatMap(e=>{const t=e[k]||[];return Oe&&"string"==typeof Oe?t.map(t=>Object.assign(Object.assign({},t),{[Oe]:e[Oe]})):t}):je,[Re,k,$e,Oe,je,Fe]),ht=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ze},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=G&&{hoverRadius:G}),null!=g&&{data:dt}),{xAccessor:v,yAccessor:b,xScaleType:K,yScaleType:Q}),Ce&&{yExtent:Ce}),{groupAccessor:"break"===D&&Fe?"_gapSegment":Oe||void 0,curve:S,lineStyle:Ke}),O&&{pointStyle:Qe}),{size:[J,ee],responsiveWidth:r.responsiveWidth,responsiveHeight:r.responsiveHeight,margin:at,showAxes:h.showAxes,xLabel:le,yLabel:ce,xFormat:y,yFormat:m,enableHover:te,showGrid:ne}),it&&{legend:it,legendPosition:st}),V&&"none"!==V&&{legendHoverBehavior:Ge.onLegendHover,legendClickBehavior:Ge.onLegendClick,legendHighlightedCategory:Ge.highlightedCategory,legendIsolatedCategories:Ge.isolatedCategories}),re&&{title:re}),ie&&{description:ie}),ae&&{summary:ae}),void 0!==se&&{accessibleTable:se}),p&&{className:p}),null!=r.animate&&{animate:r.animate}),{tooltipContent:!1===_?()=>null:"multi"===_?t=>{var n,o,r,i,a,s,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const s=null!==(a=null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(r=t.data)||void 0===r?void 0:r.y)&&void 0!==i?i:t.value)&&void 0!==a?a:t.y;return e.createElement("div",{className:"semiotic-tooltip",style:qi},e.createElement("div",null,Vi(s)))}const g=null!==(d=null!==(c=null!==(s=t.xValue)&&void 0!==s?s:null===(l=t.data)||void 0===l?void 0:l.time)&&void 0!==c?c:null===(u=t.data)||void 0===u?void 0:u.x)&&void 0!==d?d:t.time;return e.createElement("div",{className:"semiotic-tooltip",style:qi},null!=g&&e.createElement("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4}},Vi(g)),h.map((t,n)=>e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"}},e.createElement("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.createElement("span",{style:{flex:1,fontSize:"0.85em"}},t.group),e.createElement("span",{style:{fontWeight:500,fontSize:"0.85em"}},Vi(t.value)))))}:Qi(_)||ct}),"multi"===_&&{tooltipMode:"multi"}),(R||F||W||z)&&{customHoverBehavior:_e}),(F||W||R)&&{customClickBehavior:Le}),L&&{pointIdAccessor:L}),((null==T?void 0:T.length)||me.length||nt.length)&&{annotations:[...T||[],...me,...nt]}),Ne),$);return ue||de||(ut?e.createElement(Ka,{componentName:"LineChart",message:ut,width:J,height:ee}):e.createElement(ws,{componentName:"LineChart",width:J,height:ee},e.createElement(Oo,Object.assign({ref:d},ht))))});Is.displayName="LineChart";const $s=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:S,showLine:O=!0,lineWidth:E=2,showPoints:j=!1,pointRadius:C=3,tooltip:P,annotations:M,frameProps:_={},selection:L,linkedHover:T,onObservation:B,onClick:D,hoverHighlight:N,chartId:I,loading:$,emptyContent:H,legendInteraction:R,legendPosition:F,color:W}=o,z=s.width,G=s.height,Y=s.enableHover,q=s.showGrid,X=s.showLegend,V=s.title,U=s.description,K=s.summary,Q=s.accessibleTable,Z=s.xLabel,J=s.yLabel,ee=Es($,z,G),te=ee?null:Os(l,z,G,H),ne=l||[];js("AreaChart",ne,"xAccessor",f),js("AreaChart",ne,"yAccessor",p);const{activeSelectionHook:oe,hoverSelectionHook:re,customHoverBehavior:ie,customClickBehavior:ae,crosshairSourceId:se}=za({selection:L,linkedHover:T,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:B,onClick:D,chartType:"AreaChart",chartId:I,hoverHighlight:N,colorByField:"string"==typeof x?x:void 0}),le=Cs(L),ce=Ga(T,se),ue=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[b]),de=n(()=>{if(ue)return ne;if(y){const e=ne.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[b]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:ne}]},[ne,y,b,ue]),he=Fa(ne,x,k),ge=n(()=>{if(!x)return[];const e=new Set;for(const t of ne){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[ne,x]),fe=qa(R,x,ge),pe=n(()=>re||(fe.legendSelectionHook?fe.legendSelectionHook:oe),[re,fe.legendSelectionHook,oe]),ye=n(()=>e=>{const t={};if(x){if(he){const n=De(e,x,he);t.fill=n,O?(t.stroke=n,t.strokeWidth=E):t.stroke="none"}}else{const e=W||Ia;t.fill=e,O?(t.stroke=e,t.strokeWidth=E):t.stroke="none"}return t.fillOpacity=A,t},[x,he,W,A,O,E]),me=n(()=>Oa(ye,pe,le),[ye,pe,le]),ve=n(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return x?he&&(t.fill=De(e.parentLine||e,x,he)):t.fill=Ia,t}},[j,C,x,he]),{legend:be,margin:xe,legendPosition:ke}=Ya({data:de,colorBy:x,colorScale:he,showLegend:X,legendPosition:F,userMargin:c,defaults:s.marginDefaults}),we=y||x,Ae=n(()=>na([{label:Z||Zi(f),accessor:f,role:"x",format:h},{label:J||Zi(p),accessor:p,role:"y",format:g},...we?[{label:Zi(we),accessor:we,role:"group"}]:[]]),[f,p,Z,J,we,h,g]),Se=ns({componentName:"AreaChart",data:l,accessors:{xAccessor:f,yAccessor:p}}),Oe=n(()=>ue||y?de.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):ne,[de,b,ue,y,ne]),Ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:Oe}),{xAccessor:f,yAccessor:p,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),S&&{lineGradient:S}),{curve:w,lineStyle:me}),j&&ve&&{pointStyle:ve}),{size:[z,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:xe,showAxes:s.showAxes,xLabel:Z,yLabel:J,xFormat:h,yFormat:g,enableHover:Y}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:q}),be&&{legend:be,legendPosition:ke}),R&&"none"!==R&&{legendHoverBehavior:fe.onLegendHover,legendClickBehavior:fe.onLegendClick,legendHighlightedCategory:fe.highlightedCategory,legendIsolatedCategories:fe.isolatedCategories}),V&&{title:V}),U&&{description:U}),K&&{summary:K}),void 0!==Q&&{accessibleTable:Q}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===P?()=>null:Qi(P)||Ae}),(T||B||D||N)&&{customHoverBehavior:ie}),(B||D||T)&&{customClickBehavior:ae}),M&&M.length>0&&{annotations:M}),ce),_);return ee||te||(Se?e.createElement(Ka,{componentName:"AreaChart",message:Se,width:z,height:G}):e.createElement(ws,{componentName:"AreaChart",width:z,height:G},e.createElement(Oo,Object.assign({ref:a},Ee))))});function Hs({isPushMode:e,colorBy:o,colorScheme:r,showLegend:i,legendPosition:a="right"}){const c=t(new Set),u=t([]),[d,h]=l(0),g=s(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),f=s(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),p=s(e=>t=>{f([t]),e(t)},[f]),y=s(e=>t=>{f(t),e(t)},[f]),m=s(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===i)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(r)?r:Le,a=new Map;for(let e=0;t.length>e;e++)a.set(t[e],n[e%n.length]);const s="string"==typeof o?o:"__streamCat";return Aa({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>a.get(e)||"#999",getColor:De})},[e,o,i,r,d]),b=n(()=>{if(v)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[v,a]);return{wrapPush:p,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}$s.displayName="AreaChart";const Rs=c(function(o,r){var i;const a=t(null),l=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:E=3,normalize:j=!1,tooltip:C,annotations:P,frameProps:M={},selection:_,linkedHover:L,onObservation:T,onClick:B,hoverHighlight:D,chartId:N,loading:I,emptyContent:$,legendInteraction:H,legendPosition:R,color:F}=o,W=l.width,z=l.height,G=l.enableHover,Y=l.showGrid,q=l.showLegend,X=l.title,V=l.description,U=l.summary,K=l.accessibleTable,Q=l.xLabel,Z=l.yLabel,J=Es(I,W,z),ee=J?null:Os(c,W,z,$),te=c||[],ne=Hs({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:q,legendPosition:R}),oe=s(ne.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[ne.wrapPush]),re=s(ne.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[ne.wrapPushMany]);u(r,()=>({push:oe,pushMany:re,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ne.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[oe,re,ne.resetCategories]);const{activeSelectionHook:ie,hoverSelectionHook:ae,customHoverBehavior:se,customClickBehavior:le,crosshairSourceId:ce}=za({selection:_,linkedHover:L,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:T,onClick:B,chartType:"StackedAreaChart",chartId:N,hoverHighlight:D,colorByField:"string"==typeof b?b:void 0}),ue=Cs(_),de=Ga(L,ce),he=void 0!==(null===(i=te[0])||void 0===i?void 0:i[v]),ge=n(()=>{if(he)return te;if(m){const e=te.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:te}]},[te,m,v,he]),fe=Fa(te,b,x),pe=n(()=>{if(!b)return[];const e=new Set;for(const t of te){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[te,b]),ye=qa(H,b,pe),me=n(()=>ae||(ye.legendSelectionHook?ye.legendSelectionHook:ie),[ae,ye.legendSelectionHook,ie]),ve=n(()=>e=>{const t={};if(b&&fe){const n=De(e,b,fe);t.fill=n,A?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}else if(!b){const e=F||Ia;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=S)}return t.fillOpacity=w,t},[b,fe,w,A,S,F]),be=n(()=>Oa(ve,me,ue),[ve,me,ue]),xe=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return b?fe&&(t.fill=De(e.parentLine||e,b,fe)):t.fill=F||Ia,t}},[O,E,b,fe,F]),{legend:ke,margin:we,legendPosition:Ae}=Ya({data:ge,colorBy:b,colorScale:fe,showLegend:q,legendPosition:R,userMargin:d,defaults:l.marginDefaults}),Se=ne.streamingLegend||ke,Oe=R||Ae,Ee=n(()=>{if(ne.streamingMarginAdjust){const e=Object.assign({},we);for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return we},[we,ne.streamingMarginAdjust]),je=m||b,Ce=n(()=>na([{label:Q||Zi(p),accessor:p,role:"x",format:g},{label:Z||Zi(y),accessor:y,role:"y",format:f},...je?[{label:Zi(je),accessor:je,role:"group"}]:[]]),[p,y,Q,Z,je,g,f]),Pe=ns({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:p,yAccessor:y}}),Me=n(()=>he||m?ge.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):te,[ge,v,he,m,te]),_e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=c&&{data:Me}),{xAccessor:p,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:j,lineStyle:be}),O&&xe&&{pointStyle:xe}),{size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ee,showAxes:l.showAxes,xLabel:Q,yLabel:Z,xFormat:g,yFormat:f,enableHover:G}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:Y}),Se&&{legend:Se,legendPosition:Oe}),H&&"none"!==H&&{legendHoverBehavior:ye.onLegendHover,legendClickBehavior:ye.onLegendClick,legendHighlightedCategory:ye.highlightedCategory,legendIsolatedCategories:ye.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===C?()=>null:Qi(C)||Ce}),(L||T||B||D)&&{customHoverBehavior:se}),(T||B||L)&&{customClickBehavior:le}),P&&P.length>0&&{annotations:P}),de),M);return J||ee||(Pe?e.createElement(Ka,{componentName:"StackedAreaChart",message:Pe,width:W,height:z}):e.createElement(ws,{componentName:"StackedAreaChart",width:W,height:z},e.createElement(Oo,Object.assign({ref:a},_e))))});Rs.displayName="StackedAreaChart";const Fs=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=Va(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y="blues",customColorScale:m,showValues:v=!1,valueFormat:b,cellBorderColor:x="#fff",cellBorderWidth:w=1,tooltip:A,annotations:O,frameProps:E={},selection:M,linkedHover:_,onObservation:L,onClick:T,hoverHighlight:B,chartId:D,loading:N,emptyContent:I,showLegend:$,legendPosition:H,legendInteraction:R}=o,F=a.width,W=a.height,z=a.enableHover,G=a.title,Y=a.description,q=a.summary,X=a.accessibleTable,V=a.xLabel,U=a.yLabel,K=Es(N,F,W),Q=K?null:Os(s,F,W,I),Z=s||[],J=null!=$&&$,ee=null!=H?H:"right",{margin:te}=Ya({data:Z,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:ee,userMargin:l,defaults:a.marginDefaults}),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=za({selection:M,linkedHover:_,fallbackFields:[],onObservation:L,onClick:T,chartType:"Heatmap",chartId:D,hoverHighlight:B,colorByField:void 0}),se=Cs(M),le=Ga(_,ae),ce=qa(R,void 0,[]),ue=n(()=>oe||(ce.legendSelectionHook?ce.legendSelectionHook:ne),[oe,ce.legendSelectionHook,ne]),de=n(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),he=n(()=>{const e=Z.map(de);return[Math.min(...e),Math.max(...e)]},[Z,de]),ge=n(()=>"custom"===y&&m?m:k({blues:P,reds:C,greens:j,viridis:S}[y]||P).domain(he),[y,m,he]);n(()=>{const e=Ra(d),t=Ra(h);return{xBinCount:new Set(Z.map(e)).size,yBinCount:new Set(Z.map(t)).size}},[Z,d,h]),n(()=>({coordinates:Z}),[Z]);const fe=n(()=>e=>{const t=de(e);return{fill:ge(t),stroke:x,strokeWidth:w}},[de,ge,x,w]);n(()=>Oa(fe,ue,se),[fe,ue,se]);const pe=n(()=>na([{label:V||Zi(d),accessor:d,role:"x",format:f},{label:U||Zi(h),accessor:h,role:"y",format:p},{label:Zi(g),accessor:g,role:"value",format:b}]),[d,h,V,U,g,f,p,b]),ye=ns({componentName:"Heatmap",data:s,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),me=n(()=>{if(J)return{gradient:{colorFn:e=>ge(e),domain:he,label:"string"==typeof g?g:"value",format:b}}},[J,ge,he,g,b]),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=s&&{data:Z}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==y?y:void 0,showValues:v,heatmapValueFormat:b,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:f,yFormat:p,enableHover:z}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),me&&{legend:me,legendPosition:ee}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===A?()=>null:Qi(A)||pe}),(_||L||T||B)&&{customHoverBehavior:re}),(L||T||_)&&{customClickBehavior:ie}),O&&O.length>0&&{annotations:O}),le),E);return K||Q||(ye?e.createElement(Ka,{componentName:"Heatmap",message:ye,width:F,height:W}):e.createElement(ws,{componentName:"Heatmap",width:F,height:W},e.createElement(Oo,Object.assign({ref:i},ve))))});Fs.displayName="Heatmap";const Ws=c(function(o,r){const i=t(null),a=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:S,marginalGraphics:O,pointIdAccessor:E,annotations:j,frameProps:C={},selection:P,linkedHover:M,linkedBrush:_,onObservation:L,onClick:T,hoverHighlight:B,chartId:D,loading:N,emptyContent:I,legendInteraction:$,legendPosition:H,color:R}=o,F=a.width,W=a.height,z=a.enableHover,G=a.showGrid,Y=a.showLegend,q=a.title,X=a.description,V=a.summary,U=a.accessibleTable,K=a.xLabel,Q=a.yLabel,Z=Es(N,F,W),J=Z?null:Os(c,F,W,I),ee=c||[],te=void 0===c,ne=t(null),[oe,re]=l(0),ie=s(e=>{if(!te)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];null!=e&&isFinite(e)&&(ne.current?(ne.current[0]>e&&(ne.current[0]=e,t=!0),e>ne.current[1]&&(ne.current[1]=e,t=!0)):(ne.current=[e,e],t=!0))}t&&re(e=>e+1)},[te,m]),ae=Hs({isPushMode:te,colorBy:b,colorScheme:x,showLegend:Y,legendPosition:H}),se=s(ae.wrapPush(e=>{var t;ie([e]),null===(t=i.current)||void 0===t||t.push(e)}),[ae.wrapPush,ie]),le=s(ae.wrapPushMany(e=>{var t;ie(e),null===(t=i.current)||void 0===t||t.pushMany(e)}),[ae.wrapPushMany,ie]);u(r,()=>({push:se,pushMany:le,remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ae.resetCategories(),ne.current=null,re(e=>e+1),null===(e=i.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[se,le,ae.resetCategories]);const{activeSelectionHook:ce,hoverSelectionHook:ue,customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=za({selection:P,linkedHover:M,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:L,onClick:T,chartType:"BubbleChart",chartId:D,hoverHighlight:B,colorByField:"string"==typeof b?b:void 0}),fe=Cs(P),pe=Ga(M,ge),ye=Sa(_);ya({name:(null==ye?void 0:ye.name)||"__unused_brush__",xField:(null==ye?void 0:ye.xField)||("string"==typeof p?p:void 0),yField:(null==ye?void 0:ye.yField)||("string"==typeof y?y:void 0)});const me=Fa(ee,b,x),ve=n(()=>{if(!b)return[];const e=new Set;for(const t of ee){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ee,b]),be=qa($,b,ve),xe=n(()=>ue||(be.legendSelectionHook?be.legendSelectionHook:ce),[ue,be.legendSelectionHook,ce]),ke=n(()=>{if(te)return ne.current||[0,1];const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m,te,oe]),we=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?me&&(t.fill=De(e,b,me)):t.fill=R||Ia,t.r=Ie(e,m,v,ke),t},[b,me,m,v,ke,k,w,A,R]),Ae=n(()=>Oa(we,xe,fe),[we,xe,fe]),{legend:Se,margin:Oe,legendPosition:Ee}=Ya({data:ee,colorBy:b,colorScale:me,showLegend:Y,legendPosition:H,userMargin:d,defaults:a.marginDefaults}),je=ae.streamingLegend||Se,Ce=H||Ee,Pe=n(()=>{if(ae.streamingMarginAdjust){const e=Object.assign({},Oe);for(const[t,n]of Object.entries(ae.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Oe},[Oe,ae.streamingMarginAdjust]),Me=n(()=>na([{label:K||Zi(p),accessor:p,role:"x",format:g},{label:Q||Zi(y),accessor:y,role:"y",format:f},{label:Zi(m),accessor:m,role:"size"},...b?[{label:Zi(b),accessor:b,role:"color"}]:[]]),[p,y,K,Q,m,b,g,f]),_e=ns({componentName:"BubbleChart",data:c,accessors:{xAccessor:p,yAccessor:y},requiredProps:{sizeBy:m}});if(_e)return e.createElement(Ka,{componentName:"BubbleChart",message:_e,width:F,height:W});const Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:ee}),{xAccessor:p,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:Ae,colorScheme:x,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Pe,showAxes:a.showAxes,xLabel:K,yLabel:Q,xFormat:g,yFormat:f,enableHover:z,showGrid:G}),je&&{legend:je,legendPosition:Ce}),$&&"none"!==$&&{legendHoverBehavior:be.onLegendHover,legendClickBehavior:be.onLegendClick,legendHighlightedCategory:be.highlightedCategory,legendIsolatedCategories:be.isolatedCategories}),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===S?()=>null:Qi(S)||Me}),(M||L||T||B)&&{customHoverBehavior:de}),(L||T||M)&&{customClickBehavior:he}),O&&{marginalGraphics:O}),E&&{pointIdAccessor:E}),j&&j.length>0&&{annotations:j}),pe),C);return Z||J||e.createElement(ws,{componentName:"BubbleChart",width:F,height:W},e.createElement(Oo,Object.assign({ref:i},Le)))});Ws.displayName="BubbleChart";const zs="__splomIdx",Gs={top:4,bottom:4,left:4,right:4};function Ys({frameRef:n,cellSize:r,onBrush:i}){const a=t(null),s=r-Gs.left-Gs.right,l=r-Gs.top-Gs.bottom;return o(()=>{if(!a.current)return;const e=h(a.current).select(".brush-g"),t=p().extent([[0,0],[s,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,a],[s,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(a)],[o.x.invert(s),o.y.invert(l)]];i(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[s,l,n,i]),e.createElement("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${Gs.left},${Gs.top})`}))}function qs({data:n,xField:o,yField:r,cellSize:i,pointRadius:a,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:f,onPointHover:p}){const y=t(null),m=fa({name:d,clientId:`splom-${o}-${r}`}),v=ya({name:d,xField:o,yField:r}),b=fa({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=s(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=s(e=>{if(!e)return void(null==p||p(null));const t=e.data,n=null==t?void 0:t[zs];void 0!==n&&(x({[zs]:[n]}),null==p||p(t,e.x+Gs.left,e.y+Gs.top))},[x,p]),A=s(e=>{const t={opacity:l,r:a};return t.fill=c?De(e,c,u):Ia,"hover"===f?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,a,f,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(Oo,{ref:y,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:Gs,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?w:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.createElement(Ys,{frameRef:y,cellSize:i,xField:o,yField:r,onBrush:k}))}function Xs({data:t,field:o,label:r,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=fa({name:c,clientId:"splom-diag-"+o}),g=fa({name:u,clientId:`splom-diag-${o}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.predicate,m=n(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const n=Math.min(...e),r=(Math.max(...e)-n)/a||1,l="string"==typeof s?s:null,c=l?[...new Set(t.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),f=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of t){const t=e[o];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-n)/r),a-1);if(d[i]++,p&&!y(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,p&&!y(e)||f[i][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})});return{bars:d.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,a,i,p,y,s]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`bg-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ia,opacity:p?.3:.6}))):m.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Ia,opacity:p?.3:.6})),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`sel-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ia,opacity:.7}))):m.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Ia,opacity:.7}))))}function Vs({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function Us(t){const{data:o,fields:r,fieldLabels:i={},colorBy:a,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:f="histogram",histogramBins:p=20,brushMode:y="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:S,chartId:O}=t,E="splom",j="splom-hover",C=m?"hover":y?"brush":"hover",P=da(e=>e.clearSelection),[M,_]=l(null),L=s(()=>{P(j),_(null)},[P,j]),T=n(()=>(o||[]).map((e,t)=>void 0!==e[zs]?e:Object.assign(Object.assign({},e),{[zs]:t})),[o]),B=Fa(T,a,c),D=void 0!==k?k:!!a,N=n(()=>{if(!D||!a)return null;const e="string"==typeof a?a:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:B?B(e+""):Ia})):null},[D,a,T,B]),I=n(()=>({display:"grid",gridTemplateColumns:"40px "+r.map(()=>u+"px").join(" "),gridTemplateRows:r.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[r,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},N&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},N.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:I,onMouseLeave:"hover"===C?L:void 0},r.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},i[t]||t),r.map((o,r)=>n===r?"label"===f?e.createElement(Vs,{key:"diag-"+t,label:i[t]||t,cellSize:u}):e.createElement(Xs,{key:"diag-"+t,data:T,field:t,label:i[t]||t,cellSize:u,bins:p,colorBy:a,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,mode:C}):e.createElement(qs,{key:`cell-${t}-${o}`,data:T,xField:o,yField:t,fieldLabels:i,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:a,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,a)=>{e?(_({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=a?a:0}),S&&S({type:"hover",datum:e,x:null!=i?i:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O})):(_(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O}))}:void 0})))),e.createElement("div",null)," ",r.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},i[t]||t))),M&&"hover"===C&&(()=>{const t=M.datum,n=i[M.xField]||M.xField,o=i[M.yField]||M.yField,r=a?"function"==typeof a?a(t):t[a]:null,s=w?"function"==typeof w?w(t):t[w]:"Row "+t[zs];return e.createElement("div",{style:{position:"absolute",left:40+M.colIndex*(u+d)+M.px,top:M.rowIndex*(u+d)+M.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},s+""),e.createElement("div",null,n,": ",null!=t[M.xField]?Number(t[M.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[M.yField]?Number(t[M.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof a?a:"group",": ",r+""))})())}function Ks(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(wa,{selections:r},e.createElement(Us,Object.assign({},t)))}function Qs({width:n,height:r,margin:i,scales:a,brushDirection:s,extent:l,onBrush:c}){const u=t(null),d=t(null),p=t(!1),y=n+i.left+i.right,m=r+i.top+i.bottom;return o(()=>{if(!u.current||!a)return;const e=h(u.current).select(".brush-group"),t="x"===s?g().extent([[0,0],[n,r]]):f().extent([[0,0],[n,r]]);return t.on("brush end",e=>{if(p.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===s?a.x:a.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,n,r,s,c]),o(()=>{if(!d.current||!a||!u.current)return;const e=h(u.current).select(".brush-group"),t="x"===s?a.x:a.y;if(p.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);p.current=!1},[l,a,s]),e.createElement("svg",{ref:u,width:y,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function Zs(r){var i,a;const{data:c,width:u=600,height:d=400,margin:h,className:g,title:f,description:p,summary:y,xLabel:m,yLabel:v,xFormat:b,yFormat:x,xAccessor:k="x",yAccessor:w="y",lineBy:A,lineDataAccessor:S="coordinates",colorBy:O,colorScheme:E,curve:j="linear",lineWidth:C=2,fillArea:P=!1,areaOpacity:M=.3,showPoints:_=!1,pointRadius:L=3,enableHover:T=!0,showGrid:B=!1,showLegend:D,legendPosition:N,tooltip:I,minimap:$={},renderBefore:H=!1,onBrush:R,brushExtent:F,frameProps:W={},loading:z,emptyContent:G}=r,Y=Es(z,u,d),q=Y?null:Os(c,u,d,G),X=c||[],[V,U]=l(null),K=null!=F?F:V,Q=s(e=>{F||U(e),null==R||R(e)},[F,R]),Z=t(null),[J,ee]=l(null);o(()=>{let e=0,t=!1;const n=()=>{var o,r;if(t)return;const i=null===(r=null===(o=Z.current)||void 0===o?void 0:o.getScales)||void 0===r?void 0:r.call(o);i?ee(i):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const te=void 0!==(null===(i=X[0])||void 0===i?void 0:i[S]),ne=n(()=>{if(te)return X;if(A){const e=X.reduce((e,t)=>{const n="function"==typeof A?A(t):t[A];if(!e[n]){const t={[S]:[]};"string"==typeof A&&(t[A]=n),e[n]=t}return e[n][S].push(t),e},{});return Object.values(e)}return[{[S]:X}]},[X,A,S,te]),oe=n(()=>te||A?ne.flatMap(e=>{const t=e[S]||[];return A&&"string"==typeof A?t.map(t=>Object.assign(Object.assign({},t),{[A]:e[A]})):t}):X,[ne,S,te,A,X]),re=Fa(X,O,E),ie=n(()=>e=>{const t={strokeWidth:C};return t.stroke=O?De(e,O,re):Ia,P&&(t.fill=t.stroke,t.fillOpacity=M),t},[O,re,C,P,M]),ae=n(()=>$.lineStyle?$.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=O?De(e,O,re):Ia,t},[O,re,$.lineStyle]),se=n(()=>{if(_)return e=>{const t={r:L,fillOpacity:1};return t.fill=O?De(e.parentLine||e,O,re):Ia,t}},[_,L,O,re]),{legend:le,margin:ce,legendPosition:ue}=Ya({data:ne,colorBy:O,colorScale:re,showLegend:D,legendPosition:N,userMargin:h}),de=$.height||60,he=n(()=>{var e,t,n,o,r,i,a,s;return{top:null!==(t=null===(e=$.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=$.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=$.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ce.left,right:null!==(s=null===(a=$.margin)||void 0===a?void 0:a.right)&&void 0!==s?s:ce.right}},[$.margin,ce]),ge=$.brushDirection||"x",fe=ns({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:w}});if(fe)return e.createElement(Ka,{componentName:"MinimapChart",message:fe,width:u,height:d});const pe=P?"area":"line",ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:pe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:j,lineStyle:ie},_&&{pointStyle:se}),{size:[u,d],responsiveWidth:r.responsiveWidth,responsiveHeight:r.responsiveHeight,margin:ce,showAxes:!0,xLabel:m,yLabel:v,xFormat:b,yFormat:x,enableHover:T,showGrid:B}),le&&{legend:le,legendPosition:ue}),f&&{title:f}),p&&{description:p}),y&&{summary:y}),I&&{tooltipContent:Qi(I)||void 0}),K&&{xExtent:K}),W),me={chartType:pe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:j,lineStyle:ae,size:[u,de+he.top+he.bottom],margin:he,showAxes:null!==(a=$.showAxes)&&void 0!==a&&a,background:$.background,enableHover:!1},ve=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(Oo,Object.assign({ref:Z},me)),e.createElement(Qs,{width:u-he.left-he.right,height:de,margin:he,scales:J,brushDirection:ge,extent:K,onBrush:Q})),be=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(Oo,Object.assign({},ye)));return Y||q||e.createElement(ws,{componentName:"MinimapChart",width:u,height:d},e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},H?ve:be,H?be:ve))}Ks.displayName="ScatterplotMatrix",Zs.displayName="MinimapChart";const Js=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",xCenter:p,yCenter:y,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:S=[3,15],pointRadius:O=5,pointOpacity:E=.8,tooltip:j,pointIdAccessor:C,annotations:P,frameProps:M={},selection:_,linkedHover:L,onObservation:T,onClick:B,hoverHighlight:D,chartId:N,loading:I,emptyContent:$,legendInteraction:H,legendPosition:R,color:F}=o,W=a.width,z=a.height,G=a.enableHover,Y=a.showGrid,q=a.showLegend,X=a.title,V=a.description,U=a.summary,K=a.accessibleTable,Q=a.xLabel,Z=a.yLabel,J=Es(I,W,z),ee=J?null:Os(s,W,z,$),te=s||[];js("QuadrantChart",te,"xAccessor",g),js("QuadrantChart",te,"yAccessor",f);const{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=za({selection:_,linkedHover:L,fallbackFields:"string"==typeof k?[k]:[],onObservation:T,onClick:B,chartType:"QuadrantChart",chartId:N,hoverHighlight:D,colorByField:"string"==typeof k?k:void 0}),se=Cs(_),le=Ga(L,ae),ce=Fa(te,k,w),ue=n(()=>{if(!k)return[];const e=new Set;for(const t of te){const n="function"==typeof k?k(t):t[k];null!=n&&e.add(n+"")}return Array.from(e)},[te,k]),de=qa(H,k,ue),he=n(()=>oe||(de.legendSelectionHook?de.legendSelectionHook:ne),[oe,de.legendSelectionHook,ne]),ge=n(()=>{if(!te.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof f?f:e=>+e[f];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const a of te){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=p&&isFinite(p)&&(n>p&&(n=p),p>o&&(o=p)),null!=y&&isFinite(y)&&(r>y&&(r=y),y>i&&(i=y)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(i-r)||1;return{xExtent:[n-a,o+a],yExtent:[r-s,i+s]}},[te,g,f,p,y]),fe=n(()=>{if(!A||0===te.length)return;const e=te.map(e=>"function"==typeof A?A(e):e[A]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,A]),pe=n(()=>"function"==typeof g?g:e=>+e[g],[g]),ye=n(()=>"function"==typeof f?f:e=>+e[f],[f]),me=n(()=>e=>{const t={fillOpacity:E};if(k)ce&&(t.fill=De(e,k,ce));else{const n=pe(e),o=ye(e),r=null!=p?n>=p:void 0,i=null!=y?o>=y:void 0;t.fill=void 0===i||void 0===r?F||Ia:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?Ie(e,A,S,fe):O,t},[k,ce,A,S,fe,O,E,pe,ye,p,y,m,F]),ve=n(()=>Oa(me,he,se),[me,he,se]),{legend:be,margin:xe,legendPosition:ke}=Ya({data:te,colorBy:k,colorScale:ce,showLegend:q,legendPosition:R,userMargin:l,defaults:a.marginDefaults}),we=n(()=>{if(!te.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof f&&e.add(f),"string"==typeof k&&e.add(k),"string"==typeof A&&e.add(A);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,g,f,k,A]),Ae=n(()=>na([...we?[{label:we,accessor:we,role:"title"}]:[],{label:Q||Zi(g),accessor:g,role:"x",format:d},{label:Z||Zi(f),accessor:f,role:"y",format:h},...k?[{label:Zi(k),accessor:k,role:"color"}]:[],...A?[{label:Zi(A),accessor:A,role:"size"}]:[]]),[we,g,f,Q,Z,k,A,d,h]),Se=ns({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:f}}),Oe=n(()=>{var e;const t={stroke:v.stroke||"#999",strokeWidth:null!==(e=v.strokeWidth)&&void 0!==e?e:1,dashArray:v.strokeDasharray||[]};return[(e,n,o,r)=>{var i;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const a=r.width,s=r.height,l=null!=p?o.x(p):a/2,c=null!=y?o.y(y):s/2;if(null!=p&&!isFinite(l))return;if(null!=y&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:a-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:s-d},{config:m.bottomRight,x:u,y:d,w:a-u,h:s-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(i=t.config.opacity)&&void 0!==i?i:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[p,y,m,v]),Ee=n(()=>b?[...Oe,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const r=o.width,i=o.height,a=null!=p?n.x(p):r/2,s=null!=y?n.y(y):i/2;(null==p||isFinite(a))&&(null==y||isFinite(s))&&(e.font=`600 ${x}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,r-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,i-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:Oe,[Oe,b,x,m,p,y]),je=n(()=>{const e=M.canvasPreRenderers||[];return[...Ee,...e]},[Ee,M.canvasPreRenderers]),Ce=n(()=>{var t;const n={stroke:v.stroke||"#999",strokeWidth:null!==(t=v.strokeWidth)&&void 0!==t?t:1,dashArray:v.strokeDasharray?Array.isArray(v.strokeDasharray)?v.strokeDasharray.join(","):v.strokeDasharray:void 0};return[(t,o,r)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const i=r.width,a=r.height,s=null!=p?o.x(p):i/2,l=null!=y?o.y(y):a/2;if(null!=p&&!isFinite(s))return null;if(null!=y&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,s)),u=Math.max(0,Math.min(a,l));return e.createElement(e.Fragment,null,[{config:m.topLeft,x:0,y:0,w:c,h:u},{config:m.topRight,x:c,y:0,w:i-c,h:u},{config:m.bottomLeft,x:0,y:u,w:c,h:a-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:a-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.createElement("rect",{key:"qf-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08}):null}),e.createElement("line",{x1:c,y1:0,x2:c,y2:a,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.createElement("line",{x1:0,y1:u,x2:i,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),b&&e.createElement(e.Fragment,null,e.createElement("text",{x:8,y:8+x,fill:m.topLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.topLeft.label),e.createElement("text",{x:i-8,y:8+x,fill:m.topRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.topRight.label),e.createElement("text",{x:8,y:a-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:a-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[p,y,m,v,b,x]),Pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:te}),{xAccessor:g,yAccessor:f,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:S,pointStyle:ve,colorScheme:w,size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:xe,showAxes:a.showAxes,xLabel:Q,yLabel:Z,xFormat:d,yFormat:h,enableHover:G,showGrid:Y}),ge&&{xExtent:ge.xExtent,yExtent:ge.yExtent}),be&&{legend:be,legendPosition:ke}),H&&"none"!==H&&{legendHoverBehavior:de.onLegendHover,legendClickBehavior:de.onLegendClick,legendHighlightedCategory:de.highlightedCategory,legendIsolatedCategories:de.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?Ae:Qi(j)||Ae}),(L||T||B||D)&&{customHoverBehavior:re}),(T||B||L)&&{customClickBehavior:ie}),C&&{pointIdAccessor:C}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:je}),le),M),je.length>0&&{canvasPreRenderers:je}),{svgPreRenderers:Ce});return J||ee||(Se?e.createElement(Ka,{componentName:"QuadrantChart",message:Se,width:W,height:z}):e.createElement(ws,{componentName:"QuadrantChart",width:W,height:z},e.createElement(Oo,Object.assign({ref:i},Pe))))});Js.displayName="QuadrantChart";const el="__ma_unitized",tl="__ma_series";function nl(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function ol(e,t){return t[0]+e*(t[1]-t[0])}const rl=c(function(o,r){var i,a;const s=t(null),l=t([]);u(r,()=>({push:e=>{if(!s.current)return;const t=e;for(let e=0;o.series.length>e&&2>e;e++){const n=o.series[e],r=n.extent||l.current[e];if(!r)continue;const i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(t);null!=i&&isFinite(i)&&s.current.push(Object.assign(Object.assign({},t),{[el]:nl(i,r),[tl]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!s.current)return;const t=[];for(const n of e)for(let e=0;o.series.length>e&&2>e;e++){const r=o.series[e],i=r.extent||l.current[e];if(!i)continue;const a=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=a&&isFinite(a)&&t.push(Object.assign(Object.assign({},n),{[el]:nl(a,i),[tl]:r.label||"Series "+(e+1)}))}s.current.pushMany(t)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const c=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:g,xFormat:f,xAccessor:p="x",series:y,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:_,legendPosition:L}=o,T=c.width,B=c.height,D=c.enableHover,N=c.showGrid,I=null===(i=c.showLegend)||void 0===i||i,$=c.title,H=c.description,R=c.summary,F=c.accessibleTable,W=c.xLabel,z=2===y.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||z||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${y.length}. Rendering as a standard multi-line chart.`);const G=Es(P,T,B),Y=G?null:Os(d,T,B,M),q=d||[],X=$a(),V=n(()=>{let e;if(Array.isArray(m))e=m;else if(X&&X.length>0)e=X;else{const t=Me[m];e=Array.isArray(t)?t:_e}return y.map((t,n)=>t.color||e[n%e.length])},[y,m,X]),U=n(()=>y.map((e,t)=>e.label||"Series "+(t+1)),[y]),{unitizedData:K,extents:Q}=n(()=>{if(0===q.length){const e=y.map(e=>e.extent||null).filter(Boolean);return e.length===y.length&&(l.current=e),{unitizedData:[],extents:e.length===y.length?e:[]}}const e=y.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(q,e.yAccessor));if(l.current=e,!z){const t=[];for(const e of q)for(let n=0;y.length>n;n++){const o=y[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push(Object.assign(Object.assign({},e),{[el]:r,[tl]:U[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of q)for(let o=0;2>o;o++){const r=y[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push(Object.assign(Object.assign({},n),{[el]:nl(i,e[o]),[tl]:U[o]}))}return{unitizedData:t,extents:e}},[q,y,z,U]),Z=n(()=>{if(z&&Q.length>=2)return[{orient:"left",label:U[0],tickFormat:y[0].format||(e=>{const t=ol(e,Q[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:U[1],tickFormat:y[1].format||(e=>{const t=ol(e,Q[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[z,Q,y,U]),J=Ps({data:n(()=>K.length>0?K:U.map(e=>({[tl]:e})),[K,U]),rawData:d,colorBy:tl,colorScheme:V,legendInteraction:_,legendPosition:L,selection:A,linkedHover:S,fallbackFields:[tl],unwrapData:!1,onObservation:O,onClick:E,hoverHighlight:j,chartType:"MultiAxisLineChart",chartId:C,showLegend:I,userMargin:h,marginDefaults:z?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:P,emptyContent:M,width:T,height:B});if(J.earlyReturn)return J.earlyReturn;const ee=n(()=>{const e=new Map;return U.forEach((t,n)=>e.set(t,V[n])),t=>({stroke:e.get(t[tl])||V[0],strokeWidth:b,fill:"none"})},[U,V,b]),te=n(()=>Oa(ee,J.effectiveSelectionHook,J.resolvedSelection),[ee,J.effectiveSelectionHook,J.resolvedSelection]),ne=n(()=>{if(!1===x)return()=>null;return Qi(x)||(t=>{var n;const o=t.data||t,r=o[tl],i=U.indexOf(r),a=o[el],s=z&&i>=0&&Q[i]?ol(a,Q[i]):a,l=i>=0&&(null===(n=y[i])||void 0===n?void 0:n.format)?y[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof p?p(o):o[p];return e.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},e.createElement("div",{style:{fontWeight:600,marginBottom:4,color:V[i]||"inherit"}},r),e.createElement("div",null,`${"string"==typeof p?p:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(s)}`))})},[x,U,V,Q,z,y,p]),oe=ns({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:p}}),re=z?[0,1]:void 0,ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:K}),{xAccessor:p,yAccessor:el,groupAccessor:tl,lineStyle:te,colorScheme:V,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:c.showAxes}),Z&&{axes:Z}),{xLabel:W}),z?{}:{yLabel:U[0]}),{xFormat:f}),z&&re&&{yExtent:re}),{enableHover:D}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:N,curve:v}),J.legendBehaviorProps),$&&{title:$}),H&&{description:H}),R&&{summary:R}),void 0!==F&&{accessibleTable:F}),g&&{className:g}),null!=o.animate&&{animate:o.animate}),{tooltipContent:ne}),k&&{annotations:k}),(S||O||E||j)&&{customHoverBehavior:J.customHoverBehavior}),(O||E||S)&&{customClickBehavior:J.customClickBehavior}),J.crosshairProps),w);return G||Y||(oe?e.createElement(Ka,{componentName:"MultiAxisLineChart",message:oe,width:T,height:B}):e.createElement(ws,{componentName:"MultiAxisLineChart",width:T,height:B},e.createElement(Oo,Object.assign({ref:s},ie))))});rl.displayName="MultiAxisLineChart";const il=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:_,legendInteraction:L,legendPosition:T,color:B,showCategoryTicks:D,categoryFormat:N,dataIdAccessor:I}=o,$=i.width,H=i.height,R=i.enableHover,F=i.showGrid,W=i.title,z=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=Ps({data:V,rawData:s,colorBy:p,colorScheme:y,legendInteraction:L,legendPosition:T,selection:S,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"BarChart",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:$,height:H});if(U.earlyReturn)return U.earlyReturn;js("BarChart",V,"categoryAccessor",d),js("BarChart",V,"valueAccessor",h);const K=Wa(V,m,h),Q=$a(),Z=n(()=>new Map,[V]),J=n(()=>(e,t)=>{const n={};return n.fill=p?De(e,p,U.colorScale):Ha(B,Q,y,void 0,Z),n},[p,U.colorScale,B,Q,y,Z]),ee=n(()=>{const e=null==A?void 0:A.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},J(t,n)),e(t,n)||{}):J},[J,A]),te=n(()=>Oa(ee,U.effectiveSelectionHook,U.resolvedSelection),[ee,U.effectiveSelectionHook,U.resolvedSelection]),ne=n(()=>oa({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group",valueFormat:f}),[d,h,p,f]),oe=ns({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(Ka,{componentName:"BarChart",message:oe,width:$,height:H});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:te,size:[$,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v}),null!=b&&{roundedTop:b}),I&&{dataIdAccessor:I}),{baselinePadding:x,enableHover:R,showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:f}),N&&{oFormat:N}),{showGrid:F,showCategoryTicks:D,oSort:m}),U.legendBehaviorProps),W&&{title:W}),z&&{description:z}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===k?()=>null:Qi(k)||ne}),(O||E||j||C)&&{customHoverBehavior:U.customHoverBehavior}),(E||j||O)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"BarChart",width:$,height:H},e.createElement(rr,Object.assign({ref:a},re)))});function al({ref:e,frameRef:t,isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:l,setup:c}){const d=Hs({isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:l}),h=s(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=s(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,r;return null!==(r=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==r?r:[]},clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:n(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:l||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,l]),effectiveMargin:n(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}il.displayName="BarChart";const sl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:P,chartId:M,loading:_,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,categoryFormat:N}=o,I=i.width,$=i.height,H=i.enableHover,R=i.showGrid,F=i.showLegend,W=i.title,z=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=p||d,K=void 0===s,Q=Ps({data:V,rawData:s,colorBy:U,colorScheme:y,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:P,chartType:"StackedBarChart",chartId:M,showLegend:F,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:L,width:I,height:$});if(Q.earlyReturn)return Q.earlyReturn;const Z=$a(),J=n(()=>new Map,[V]),ee=n(()=>(e,t)=>U?Q.colorScale?{fill:De(e,U,Q.colorScale)}:{}:{fill:Ha(D,Z,y,t,J)},[U,Q.colorScale,D,Z,y,J]),te=n(()=>{const e=null==S?void 0:S.pieceStyle;return e&&"function"==typeof e?(t,n)=>{const o=ee(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:ee},[ee,S]),ne=n(()=>Oa(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=n(()=>oa({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),re=ns({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:ie,effectiveMargin:ae}=al({ref:r,frameRef:a,isPushMode:K,colorBy:U,colorScheme:y,showLegend:F,legendPosition:B,setup:Q}),se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:V}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[I,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:f}),N&&{oFormat:N}),{showGrid:R}),ie),W&&{title:W}),z&&{description:z}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===w?()=>null:Qi(w)||oe}),(E||j||C||P)&&{customHoverBehavior:Q.customHoverBehavior}),(j||C||E)&&{customClickBehavior:Q.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e.createElement(Ka,{componentName:"StackedBarChart",message:re,width:I,height:$}):e.createElement(ws,{componentName:"StackedBarChart",width:I,height:$},e.createElement(rr,Object.assign({ref:a},se)))});sl.displayName="StackedBarChart";const ll="__likert_neutral_neg",cl="__likert_neutral_pos";function ul(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function dl(e,t,n,o,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],a=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:r})}}return l}function hl(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:ll,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:cl,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function gl(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const n of e)n.__likertLevel===ll?i=n:n.__likertLevel===cl?s=n:t.set(n.__likertLevelIndex,n);o&&i&&a.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const fl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:l,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:f,countAccessor:p="count",levels:y,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,valueFormat:P,loading:M,emptyContent:_,legendInteraction:L,legendPosition:T,categoryFormat:B}=o,D=i.width,N=i.height,I=i.enableHover,$=i.showGrid,H=i.showLegend,R=i.title,F=i.description,W=i.summary,z=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q="horizontal"===m,X=void 0===l,V=!f,U=n(()=>v&&Array.isArray(v)&&v.length>=y.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&a.push(o);for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return a}(y.length),[v,y.length]),K=n(()=>{const e=new Map;for(let t=0;y.length>t;t++)e.set(y[t],U[t]||"#888");return e},[y,U]),{processedData:Q,reAggregate:Z,accumulatorRef:J}=function({data:e,levels:o,categoryAccessor:r,valueAccessor:i,levelAccessor:a,countAccessor:l,isDiverging:c,frameRef:u}){const d=!a,h=n(()=>ul(r,"question"),[r]),g=n(()=>d?ul(i,"score"):null,[d,i]),f=n(()=>d?null:ul(a,"level"),[d,a]),p=n(()=>d?null:ul(l,"count"),[d,l]),y=e||[],m=t([]),v=n(()=>{if(0===y.length)return[];let e=dl(y,o,h,g,f,p);return c&&(e=hl(e,o),e=gl(e,o)),e},[y,o,h,g,f,p,c]),b=s(e=>{var t;let n=dl(e,o,h,g,f,p);c&&(n=hl(n,o),n=gl(n,o)),null===(t=u.current)||void 0===t||t.replace(n)},[o,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:y,categoryAccessor:h,valueAccessor:g,levelAccessor:f,countAccessor:p,isDiverging:q,frameRef:a}),ee="__likertLevelLabel",te=Hs({isPushMode:X,colorBy:ee,colorScheme:U,showLegend:H,legendPosition:T}),ne=s(te.wrapPush(e=>{J.current.push(e),Z(J.current)}),[te.wrapPush,Z,J]),oe=s(te.wrapPushMany(e=>{J.current.push(...e),Z(J.current)}),[te.wrapPushMany,Z,J]);u(r,()=>({push:ne,pushMany:oe,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;J.current=[],te.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ne,oe,te.resetCategories,J]);const re=Ps({data:Q,rawData:l,colorBy:ee,colorScheme:U,legendInteraction:L,legendPosition:T,selection:A,linkedHover:S,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"LikertChart",chartId:C,showLegend:H,userMargin:c,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:D,height:N});if(re.earlyReturn)return re.earlyReturn;const ie=n(()=>{const e=y.length;return e%2!=0&&K.get(y[Math.floor(e/2)])||"#888"},[y,K]),ae=w.pieceStyle,se=n(()=>(e,t)=>{var n,o;const r=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),i=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let a;if(i===ll||i===cl)a={fill:ie};else{const e=r||i;a=e&&K.has(e)?{fill:K.get(e)}:{fill:"#888"}}if(ae){const n=ae(e,t);n.stroke&&(a.stroke=n.stroke),null!=n.strokeWidth&&(a.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(a.strokeOpacity=n.strokeOpacity)}return a},[K,ie,ae]),le=n(()=>Oa(se,re.effectiveSelectionHook,re.resolvedSelection),[se,re.effectiveSelectionHook,re.resolvedSelection]),ce=n(()=>{const e=y.length;return e%2!=0?y[Math.floor(e/2)]:""},[y]),ue=n(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===ll||o===cl?ce:o,i=n.__likertCategory||"",a=Math.abs(n.__likertPct||0),s=o===ll||o===cl?2*a:a,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:qi},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${s.toFixed(1)}% (n=${l})`))},[ce]),de=n(()=>{if(!y||2>y.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&f)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(f&&!p)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return V?g&&(e.valueAccessor=g):(f&&(e.levelAccessor=f),p&&(e.countAccessor=p)),ns({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:y}})},[l,h,g,f,p,y,V]),he=n(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:y.map(e=>({label:e})),label:""}],[y,K]),ge=n(()=>!1!==H?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:he},legendPosition:T||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,T,H,he]),fe=n(()=>{const e=Object.assign({},re.margin);if(X&&!1!==H){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return q&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,q,X,H,T]),pe=n(()=>P||(q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[q,P]),ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:Q}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:q?"horizontal":"vertical",pieceStyle:le,size:[D,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:fe,barPadding:b,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y||(q?void 0:"Percentage"),rFormat:pe}),B&&{oFormat:B}),{showGrid:$}),ge),R&&{title:R}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===x?()=>null:!0===x?ue:Qi(x)||ue}),(S||O||E||j)&&{customHoverBehavior:re.customHoverBehavior}),(O||E||S)&&{customClickBehavior:re.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return de?e.createElement(Ka,{componentName:"LikertChart",message:de,width:D,height:N}):e.createElement(ws,{componentName:"LikertChart",width:D,height:N},e.createElement(rr,Object.assign({ref:a},ye)))});function pl({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=Sa("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),a=ya({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),l=t(a.brushInteraction);l.current=a.brushInteraction;const c=s(e=>{if(i){l.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}fl.displayName="LikertChart";const yl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,brush:S,onBrush:O,linkedBrush:E,frameProps:j={},selection:C,linkedHover:P,onObservation:M,onClick:_,hoverHighlight:L,chartId:T,loading:B,emptyContent:D,legendInteraction:N,legendPosition:I,color:$,showCategoryTicks:H,categoryFormat:R}=o,F=i.width,W=i.height,z=i.enableHover,G=i.showGrid,Y=i.title,q=i.description,X=i.summary,V=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Q=s||[],Z=Ps({data:Q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:N,legendPosition:I,selection:C,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:L,chartType:"SwarmPlot",chartId:T,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:D,width:F,height:W}),J=pl({brushProp:S,onBrushProp:O,linkedBrush:E,valueAccessor:h});if(Z.earlyReturn)return Z.earlyReturn;const ee=n(()=>{if(!m)return;const e=Q.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[Q,m]),te=$a(),ne=n(()=>new Map,[Q]),oe=j.pieceStyle,re=n(()=>(e,t)=>{const n={fillOpacity:x};if(n.fill=p?De(e,p,Z.colorScale):Ha($,te,y,void 0,ne),n.r=m?Ie(e,m,v,ee):b,oe){const o=oe(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[p,Z.colorScale,m,v,ee,b,x,$,te,y,ne,oe]),ie=n(()=>Oa(re,Z.effectiveSelectionHook,Z.resolvedSelection),[re,Z.effectiveSelectionHook,Z.resolvedSelection]),ae=n(()=>oa({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0,valueFormat:f}),[d,h,p,f]),se=ns({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(se)return e.createElement(Ka,{componentName:"SwarmPlot",message:se,width:F,height:W});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:k,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),R&&{oFormat:R}),{showGrid:G,showCategoryTicks:H}),Z.legendBehaviorProps),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===w?()=>null:Qi(w)||ae}),(P||M||_||L)&&{customHoverBehavior:Z.customHoverBehavior}),(M||_||P)&&{customClickBehavior:Z.customClickBehavior}),A&&A.length>0&&{annotations:A}),J.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"SwarmPlot",width:F,height:W},e.createElement(rr,Object.assign({ref:a},le)))});function ml(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:qi},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=i.length,s=a>0?a%2!=0?i[Math.floor(a/2)]:(i[a/2-1]+i[a/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:qi},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:qi},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}yl.displayName="SwarmPlot";const vl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:_,color:L,showCategoryTicks:T,categoryFormat:B}=o,D=i.width,N=i.height,I=i.enableHover,$=i.showGrid,H=i.title,R=i.description,F=i.summary,W=i.accessibleTable,z=i.categoryLabel,G=i.valueLabel,Y=s||[],q=Ps({data:Y,rawData:s,colorBy:p,colorScheme:y,legendInteraction:M,legendPosition:_,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"BoxPlot",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:D,height:N});if(q.earlyReturn)return q.earlyReturn;const X=$a(),V=n(()=>new Map,[Y]),U=n(()=>e=>{const t=p?De(e,p,q.colorScale):Ha(L,X,y,void 0,V);return{fill:t,stroke:t,fillOpacity:.8}},[p,q.colorScale,L,X,y,V]),K=n(()=>Oa(U,q.effectiveSelectionHook,q.resolvedSelection),[U,q.effectiveSelectionHook,q.resolvedSelection]),Q=n(()=>ml(),[]),Z=ns({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(Ka,{componentName:"BoxPlot",message:Z,width:D,height:N});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[D,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:q.margin,barPadding:v,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:z,rLabel:G,rFormat:f}),B&&{oFormat:B}),{showGrid:$,showCategoryTicks:T}),q.legendBehaviorProps),H&&{title:H}),R&&{description:R}),F&&{summary:F}),void 0!==W&&{accessibleTable:W}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:Qi(b)||Q}),(A||S||O||E)&&{customHoverBehavior:q.customHoverBehavior}),(S||O||A)&&{customClickBehavior:q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"BoxPlot",width:D,height:N},e.createElement(rr,Object.assign({ref:a},J)))});vl.displayName="BoxPlot";const bl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:k,onBrush:w,linkedBrush:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:P,chartId:M,loading:_,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,showCategoryTicks:N,categoryFormat:I}=o,$=i.width,H=i.height,R=i.enableHover,F=i.showGrid,W=i.title,z=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=Ps({data:V,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:P,chartType:"Histogram",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:L,width:$,height:H}),K=pl({brushProp:k,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(U.earlyReturn)return U.earlyReturn;const Q=n(()=>{if(0===V.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of V){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[V,h]),Z=$a(),J=n(()=>new Map,[V]),ee=n(()=>e=>{const t=y?De(e,y,U.colorScale):Ha(D,Z,m,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[y,U.colorScale,D,Z,m,J]),te=n(()=>Oa(ee,U.effectiveSelectionHook,U.resolvedSelection),[ee,U.effectiveSelectionHook,U.resolvedSelection]),ne=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:qi},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),oe=ns({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(Ka,{componentName:"Histogram",message:oe,width:$,height:H});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:te,bins:g,normalize:f}),Q&&{rExtent:Q}),{size:[$,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v,enableHover:R}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:p}),I&&{oFormat:I}),{showGrid:F,showCategoryTicks:N}),U.legendBehaviorProps),W&&{title:W}),z&&{description:z}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:Qi(b)||ne}),(E||j||C||P)&&{customHoverBehavior:U.customHoverBehavior}),(j||C||E)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"Histogram",width:$,height:H},e.createElement(rr,Object.assign({ref:a},re)))});bl.displayName="Histogram";const xl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:f=25,showIQR:p=!0,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:E,linkedHover:j,onObservation:C,onClick:P,hoverHighlight:M,chartId:_,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:N,showCategoryTicks:I,categoryFormat:$}=o,H=i.width,R=i.height,F=i.enableHover,W=i.showGrid,z=i.title,G=i.description,Y=i.summary,q=i.accessibleTable,X=i.categoryLabel,V=i.valueLabel,U=s||[],K=Ps({data:U,rawData:s,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:D,selection:E,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:M,chartType:"ViolinPlot",chartId:_,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:H,height:R}),Q=pl({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Z=$a(),J=n(()=>new Map,[U]),ee=n(()=>e=>{const t=m?De(e,m,K.colorScale):Ha(N,Z,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,N,Z,v,J]),te=n(()=>Oa(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),ne=n(()=>ml({valueAccessor:h}),[h]),oe=ns({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(Ka,{componentName:"ViolinPlot",message:oe,width:H,height:R});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:te,bins:f,showIQR:p,size:[H,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,barPadding:b,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V,rFormat:y}),$&&{oFormat:$}),{showGrid:W,showCategoryTicks:I}),K.legendBehaviorProps),z&&{title:z}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===x?()=>null:Qi(x)||ne}),(j||C||P||M)&&{customHoverBehavior:K.customHoverBehavior}),(C||P||j)&&{customClickBehavior:K.customClickBehavior}),k&&k.length>0&&{annotations:k}),Q.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"ViolinPlot",width:H,height:R},e.createElement(rr,Object.assign({ref:a},re)))});xl.displayName="ViolinPlot";const kl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:f=20,amplitude:p=1.5,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:_,legendPosition:L,color:T,showCategoryTicks:B,categoryFormat:D}=o,N=i.width,I=i.height,$=i.enableHover,H=i.showGrid,R=i.title,F=i.description,W=i.summary,z=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=Ps({data:q,rawData:s,colorBy:m,colorScheme:v,legendInteraction:_,legendPosition:L,selection:A,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"RidgelinePlot",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:N,height:I});if(X.earlyReturn)return X.earlyReturn;const V=$a(),U=n(()=>new Map,[q]),K=n(()=>e=>{const t=m?De(e,m,X.colorScale):Ha(T,V,v,void 0,U);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,T,V,v,U]),Q=n(()=>Oa(K,X.effectiveSelectionHook,X.resolvedSelection),[K,X.effectiveSelectionHook,X.resolvedSelection]),Z=n(()=>ml(),[]),J=ns({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(J)return e.createElement(Ka,{componentName:"RidgelinePlot",message:J,width:N,height:I});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:Q,bins:f,size:[N,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:b,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:y}),D&&{oFormat:D}),{showGrid:H,showCategoryTicks:B,oSort:!1,amplitude:p}),X.legendBehaviorProps),R&&{title:R}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===x?()=>null:Qi(x)||Z}),(S||O||E||j)&&{customHoverBehavior:X.customHoverBehavior}),(O||E||S)&&{customClickBehavior:X.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"RidgelinePlot",width:N,height:I},e.createElement(rr,Object.assign({ref:a},ee)))});kl.displayName="RidgelinePlot";const wl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:s,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:_,color:L,categoryFormat:T}=o,B="vertical"===y,D=i.width,N=i.height,I=i.enableHover,$=i.title,H=i.description,R=i.summary,F=i.accessibleTable,W=s||[],z=f||g,G=!z,Y=Ps({data:W,rawData:s,colorBy:z,colorScheme:p,legendInteraction:M,legendPosition:_,selection:w,linkedHover:A,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"FunnelChart",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:$?60:40,right:20,bottom:60,left:60}:{top:$?40:10,right:10,bottom:10,left:10},loading:C,emptyContent:P,width:D,height:N});if(Y.earlyReturn)return Y.earlyReturn;js("FunnelChart",W,"stepAccessor",d),js("FunnelChart",W,"valueAccessor",h);const q=$a(),X=n(()=>new Map,[W]),V=n(()=>{if(G)return L||((null==q?void 0:q[0])?q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[G,L,q,p]),U=k.pieceStyle,K=n(()=>(e,t)=>{const n={};if(n.fill=V||(z?De(e,z,Y.colorScale):Ha(L,q,p,t,X)),U){const o=U(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[V,z,Y.colorScale,L,q,p,X,U]),Q=n(()=>Oa(K,Y.effectiveSelectionHook,Y.resolvedSelection),[K,Y.effectiveSelectionHook,Y.resolvedSelection]),Z=n(()=>t=>{var n,o,r,i,a,s;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(a=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==a?a:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(s=null==l?void 0:l.__barFunnelCategory)&&void 0!==s?s:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:qi},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),f&&f!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},f+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",p))},[]),J=ns({componentName:"FunnelChart",data:s,accessors:{stepAccessor:d,valueAccessor:h}});if(J)return e.createElement(Ka,{componentName:"FunnelChart",message:J,width:D,height:N});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=s&&{data:W}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:Q,size:[D,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:B,showCategoryTicks:B}),T&&{oFormat:T}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),Y.legendBehaviorProps),$&&{title:$}),H&&{description:H}),R&&{summary:R}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?Z:Qi(b)||Z}),(A||S||O||E)&&{customHoverBehavior:Y.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Y.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"FunnelChart",width:D,height:N},e.createElement(rr,Object.assign({ref:a},ee)))});wl.displayName="FunnelChart";const Al=c(function(o,r){var i;const a=Va(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),s=t(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:f="horizontal",valueFormat:p,colorBy:y,colorScheme:m,sort:v="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:_,legendInteraction:L,legendPosition:T,color:B,categoryFormat:D}=o,N=a.width,I=a.height,$=a.enableHover,H=a.showGrid,R=a.title,F=a.description,W=a.summary,z=a.accessibleTable,G=a.categoryLabel,Y=a.valueLabel,q=l||[],X=Ps({data:q,rawData:l,colorBy:y,colorScheme:m,legendInteraction:L,legendPosition:T,selection:S,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"DotPlot",chartId:P,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:M,emptyContent:_,width:N,height:I});if(X.earlyReturn)return X.earlyReturn;const V=Wa(q,v,g),U=$a(),K=n(()=>new Map,[q]),Q=A.pieceStyle,Z=n(()=>(e,t)=>{const n={r:b,fillOpacity:.8};if(n.fill=y?De(e,y,X.colorScale):Ha(B,U,m,void 0,K),Q){const o=Q(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[y,X.colorScale,b,B,U,m,K,Q]),J=n(()=>Oa(Z,X.effectiveSelectionHook,X.resolvedSelection),[Z,X.effectiveSelectionHook,X.resolvedSelection]),ee=n(()=>oa({categoryAccessor:h,valueAccessor:g,valueFormat:p}),[h,g,p]),te=ns({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(te)return e.createElement(Ka,{componentName:"DotPlot",message:te,width:N,height:I});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:V}),{oAccessor:h,rAccessor:g,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:J,size:[N,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:x,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:a.showAxes,oLabel:G,rLabel:Y,rFormat:p}),D&&{oFormat:D}),{showGrid:H,oSort:v}),X.legendBehaviorProps),R&&{title:R}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===k?()=>null:Qi(k)||ee}),(O||E||j||C)&&{customHoverBehavior:X.customHoverBehavior}),(E||j||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(ws,{componentName:"DotPlot",width:N,height:I},e.createElement(rr,Object.assign({ref:s},ne)))});Al.displayName="DotPlot";const Sl=c(function(o,r){var i,a;const s=Va(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:E,loading:j,emptyContent:C,legendInteraction:P,legendPosition:M,color:_}=o,L=s.width,T=s.height,B=s.enableHover,D=s.showLegend,N=s.title,I=s.description,$=s.summary,H=s.accessibleTable,R=c||[],F=f||h,W=void 0===c,z=Ps({data:R,rawData:c,colorBy:F,colorScheme:p,legendInteraction:P,legendPosition:M,selection:k,linkedHover:w,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:E,showLegend:D,userMargin:u,marginDefaults:s.marginDefaults,loading:j,emptyContent:C,width:L,height:T});if(z.earlyReturn)return z.earlyReturn;const G=$a(),Y=n(()=>new Map,[R]),q=n(()=>(e,t)=>F?z.colorScale?{fill:De(e,F,z.colorScale)}:{}:{fill:Ha(_,G,p,t,Y)},[F,z.colorScale,_,G,p,Y]),X=n(()=>{const e=null==x?void 0:x.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},q(t,n)),e(t,n)||{}):q},[q,x]),V=n(()=>Oa(X,z.effectiveSelectionHook,z.resolvedSelection),[X,z.effectiveSelectionHook,z.resolvedSelection]),U=n(()=>oa({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),K=ns({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:Z}=al({ref:r,frameRef:l,isPushMode:W,colorBy:F,colorScheme:p,showLegend:D,legendPosition:M,setup:z}),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:R}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:V,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z,enableHover:B}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Q),N&&{title:N}),I&&{description:I}),$&&{summary:$}),void 0!==H&&{accessibleTable:H}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:Qi(v)||U}),(w||A||S||O)&&{customHoverBehavior:z.customHoverBehavior}),(A||S||w)&&{customClickBehavior:z.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.createElement(Ka,{componentName:"PieChart",message:K,width:L,height:T}):e.createElement(ws,{componentName:"PieChart",width:L,height:T},e.createElement(rr,Object.assign({ref:l},J)))});Sl.displayName="PieChart";const Ol=c(function(o,r){var i,a;const s=Va(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:f=60,centerContent:p,colorBy:y,colorScheme:m,startAngle:v=0,cornerRadius:b,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:_,legendPosition:L,color:T}=o,B=s.width,D=s.height,N=s.enableHover,I=s.showLegend,$=s.title,H=s.description,R=s.summary,F=s.accessibleTable,W=c||[],z=y||h,G=void 0===c,Y=Ps({data:W,rawData:c,colorBy:z,colorScheme:m,legendInteraction:_,legendPosition:L,selection:A,linkedHover:S,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"DonutChart",chartId:C,showLegend:I,userMargin:u,marginDefaults:s.marginDefaults,loading:P,emptyContent:M,width:B,height:D});if(Y.earlyReturn)return Y.earlyReturn;const q=$a(),X=n(()=>new Map,[W]),V=w.pieceStyle,U=n(()=>(e,t)=>{let n;if(n=z?Y.colorScale?{fill:De(e,z,Y.colorScale)}:{}:{fill:Ha(T,q,m,t,X)},V){const o=V(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[z,Y.colorScale,T,q,m,X,V]),K=n(()=>Oa(U,Y.effectiveSelectionHook,Y.resolvedSelection),[U,Y.effectiveSelectionHook,Y.resolvedSelection]),Q=n(()=>oa({categoryAccessor:h,valueAccessor:g,groupAccessor:y&&y!==h?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[h,g,y]),Z=ns({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:ee}=al({ref:r,frameRef:l,isPushMode:G,colorBy:z,colorScheme:m,showLegend:I,legendPosition:L,setup:Y}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=c&&{data:W}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,innerRadius:f,startAngle:v}),null!=b&&{cornerRadius:b}),{centerContent:p,size:[B,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee,enableHover:N}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),J),$&&{title:$}),H&&{description:H}),R&&{summary:R}),void 0!==F&&{accessibleTable:F}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===x?()=>null:Qi(x)||Q}),(S||O||E||j)&&{customHoverBehavior:Y.customHoverBehavior}),(O||E||S)&&{customClickBehavior:Y.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return Z?e.createElement(Ka,{componentName:"DonutChart",message:Z,width:B,height:D}):e.createElement(ws,{componentName:"DonutChart",width:B,height:D},e.createElement(rr,Object.assign({ref:l},te)))});Ol.displayName="DonutChart";const El=c(function(o,r){var i,a,s;const l=Va(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:300,height:null!==(a=o.height)&&void 0!==a?a:250,enableHover:null===(s=o.enableHover)||void 0===s||s,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary}),c=t(null),{value:u,min:d=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!0,sweep:w=240,fillZones:A=!0,tooltip:S,annotations:O,frameProps:E={},className:j}=o,C=l.width,P=l.height,M=l.title,_=l.description,L=l.summary,T=l.accessibleTable,B=Math.max(d,Math.min(h,u)),D=h-d||1,N=(B-d)/D,{gaugeData:I,pieceStyle:$,gaugeAnnotations:H}=n(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let r=d;for(let n=0;o.length>n;n++){const i=o[n],a=(i.value-r)/D;if(A){const o=(r-d)/D,s=Math.max(0,Math.min(N,(i.value-d)/D)-o),l=a-s;if(s>0){const o="fill-"+n;e.push({category:o,value:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:i.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:p,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:a,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(k&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:p},gaugeAnnotations:n}},[u,d,h,g,f,p,N,D,k,A]),R=w*Math.PI/180,F=180+(360-w)/2,W=-Math.PI/2+F*Math.PI/180,z=[[Math.cos(W),Math.sin(W)],[Math.cos(W+R),Math.sin(W+R)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-W)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>R+.001||z.push([Math.cos(e),Math.sin(e)]);const G=Math.min(...z.map(e=>e[0])),Y=Math.max(...z.map(e=>e[0])),q=Math.min(...z.map(e=>e[1])),X=Math.max(...z.map(e=>e[1])),V=(q+X)/2,U=(G+Y)/2,K=Math.max(10,Math.min((C-20)/(Y-G),(P-20)/(X-q))-4),Q=Math.max(10,K*(1-y)),Z=C/2-U*K,J=P/2-V*K,ee=2*(K+4),te=n(()=>{if(null!=b)return"function"==typeof b?b(B,d,h):b;const t=x?x(B):Math.round(B)+"";return e.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},e.createElement("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"}},t),k&&e.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},d," – ",h))},[b,B,d,h,x,k,K]),ne=n(()=>{if(!m)return null;const e=-Math.PI/2+F*Math.PI/180+N*R,t=Q-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,N,F,R,Q,v]),oe=n(()=>(t,n,o)=>{if("gauge-needle"===t.type)return e.createElement("g",{key:"gauge-needle-"+n,transform:`translate(${(o.width||C)/2},${(o.height||P)/2})`},e.createElement("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:2.5,strokeLinecap:"round"}),e.createElement("circle",{cx:0,cy:0,r:5,fill:t.color}));if("gauge-label"===t.type){const r=-Math.PI/2+F*Math.PI/180+(t.value-d)/D*R,i=Q-14,a=(o.height||P)/2;return e.createElement("text",{key:"gauge-label-"+n,x:(o.width||C)/2+Math.cos(r)*i,y:a+Math.sin(r)*i,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label)}return null},[C,P,d,D,F,R,Q]),re=n(()=>{const e=[...H,...O||[]];return ne&&e.push(ne),e},[H,O,ne]),ie=n(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.createElement("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"}},e.createElement("div",{style:{fontWeight:600}},(null==o?void 0:o._zone)||""),e.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},r?"Current: "+Math.round(B):"Remaining"))},[B]);if(0===I.length)return e.createElement(Ka,{componentName:"GaugeChart",message:"No data to display",width:C,height:P});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:I,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:$,innerRadius:Q,startAngle:F,sweepAngle:w,centerContent:te,size:[C,P],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:J-ee/2,bottom:P-J-ee/2,left:Z-ee/2,right:C-Z-ee/2},enableHover:l.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:Qi(S)||ie,svgAnnotationRules:oe},re.length>0&&{annotations:re}),M&&{title:M}),_&&{description:_}),L&&{summary:L}),void 0!==T&&{accessibleTable:T}),j&&{className:j}),null!=o.animate&&{animate:o.animate}),E);return e.createElement(ws,{componentName:"GaugeChart",width:C,height:P},e.createElement(rr,Object.assign({ref:c},ae)))});El.displayName="GaugeChart";const jl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:_,legendInteraction:L,legendPosition:T,color:B,categoryFormat:D}=o,N=i.width,I=i.height,$=i.enableHover,H=i.showGrid,R=i.showLegend,F=i.title,W=i.description,z=i.summary,G=i.accessibleTable,Y=i.categoryLabel,q=i.valueLabel,X=s||[],V=p||d,U=void 0===s,K=Ps({data:X,rawData:s,colorBy:V,colorScheme:y,legendInteraction:L,legendPosition:T,selection:S,linkedHover:O,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"GroupedBarChart",chartId:P,showLegend:R,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:N,height:I});if(K.earlyReturn)return K.earlyReturn;const Q=$a(),Z=n(()=>new Map,[X]),J=A.pieceStyle,ee=n(()=>(e,t)=>{const n=V?K.colorScale?{fill:De(e,V,K.colorScale)}:{}:{fill:Ha(B,Q,y,t,Z)};if(J){const o=J(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[V,K.colorScale,B,Q,y,Z,J]),te=n(()=>Oa(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),ne=n(()=>oa({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),oe=ns({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:re,effectiveMargin:ie}=al({ref:r,frameRef:a,isPushMode:U,colorBy:V,colorScheme:y,showLegend:R,legendPosition:T,setup:K}),ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:X}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:te,size:[N,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:q,rFormat:f}),D&&{oFormat:D}),{showGrid:H}),re),F&&{title:F}),W&&{description:W}),z&&{summary:z}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===k?()=>null:Qi(k)||ne}),(O||E||j||C)&&{customHoverBehavior:K.customHoverBehavior}),(E||j||O)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return oe?e.createElement(Ka,{componentName:"GroupedBarChart",message:oe,width:N,height:I}):e.createElement(ws,{componentName:"GroupedBarChart",width:N,height:I},e.createElement(rr,Object.assign({ref:a},ae)))});jl.displayName="GroupedBarChart";const Cl=c(function(o,r){const i=Va(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m=40,tooltip:v,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:_,legendInteraction:L,legendPosition:T,color:B,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:I,showCategoryTicks:$}=o,H=i.width,R=i.height,F=i.enableHover,W=i.showGrid,z=i.showLegend,G=i.title,Y=i.description,q=i.summary,X=i.accessibleTable,V=i.categoryLabel,U=i.valueLabel,K=s||[],Q=p||d,Z=void 0===s,J=Ps({data:K,rawData:s,colorBy:Q,colorScheme:y,legendInteraction:L,legendPosition:T,selection:S,linkedHover:O,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"SwimlaneChart",chartId:P,showLegend:z,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:H,height:R}),ee=pl({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=$a(),ne=n(()=>new Map,[K]),oe=A.pieceStyle,re=n(()=>(e,t)=>{const n=Q?J.colorScale?{fill:De(e,Q,J.colorScale)}:{}:{fill:Ha(B,te,y,t,ne)};if(oe){const o=oe(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Q,J.colorScale,B,te,y,ne,oe]),ie=n(()=>Oa(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=n(()=>oa({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),se=ns({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=al({ref:r,frameRef:a,isPushMode:Z,colorBy:Q,colorScheme:y,showLegend:z,legendPosition:T,setup:J}),ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[H,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ce,barPadding:m,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===$?void 0:V,rLabel:U,rFormat:f}),N&&{rTickValues:N}),null!=I&&{tickLabelEdgeAlign:I}),D&&{oFormat:D}),void 0!==$&&{showCategoryTicks:$}),{showGrid:W}),le),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:Qi(v)||ae}),(O||E||j||C)&&{customHoverBehavior:J.customHoverBehavior}),(E||j||O)&&{customClickBehavior:J.customClickBehavior}),b&&b.length>0&&{annotations:b}),ee.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return se?e.createElement(Ka,{componentName:"SwimlaneChart",message:se,width:H,height:R}):e.createElement(ws,{componentName:"SwimlaneChart",width:H,height:R},e.createElement(rr,Object.assign({ref:a},ue)))});Cl.displayName="SwimlaneChart";const Pl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Va(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:E,frameProps:j={},onObservation:C,onClick:P,chartId:M,selection:_,linkedHover:L,loading:T,emptyContent:B,legendInteraction:D,legendPosition:N}=o,I=s.width,$=s.height,H=s.enableHover,R=s.showLegend,F=null!==(i=s.showLabels)&&void 0!==i&&i,W=s.title,z=s.description,G=s.summary,Y=s.accessibleTable,q=Es(T,I,$),X=q?null:Os(l,I,$,B),V=l||[],U=c||[],K=Fa(V,m,v),Q=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Z=qa(D,m,Q),J=$a(),ee=n(()=>new Map,[]),te=n(()=>{if(Array.isArray(v))return v;if(J&&J.length>0)return J;const e=Me[v];return Array.isArray(e)?e:_e},[v,J]),ne=n(()=>e=>{const t={};return t.fill=m?De(e.data||e,m,K):Ha(void 0,J,v,void 0,ee),"number"==typeof b&&(t.r=b),t},[m,K,b,J,v,ee]),oe=n(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),re=n(()=>{if(F&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[F,y]),{legend:ie,margin:ae,legendPosition:se}=Ya({data:V,colorBy:m,colorScale:K,showLegend:R,legendPosition:N,userMargin:d,defaults:s.marginDefaults}),{customHoverBehavior:le,customClickBehavior:ce}=za({selection:_,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:C,onClick:P,chartType:"ForceDirectedGraph",chartId:M}),ue=rs({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ue?e.createElement(Ka,{componentName:"ForceDirectedGraph",message:ue,width:I,height:$}):q||X||e.createElement(ws,{componentName:"ForceDirectedGraph",width:I,height:$},e.createElement(Yi,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:V},null!=c&&{edges:U},{size:[I,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,nodeIDAccessor:g,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ne,edgeStyle:oe,colorBy:m,colorScheme:te,nodeSize:b,nodeSizeRange:x,nodeLabel:re,showLabels:F,enableHover:H,tooltipContent:!1===E?()=>null:Qi(E)||void 0,customHoverBehavior:L||C||P?le:void 0,customClickBehavior:C||P?ce:void 0,legend:ie,legendPosition:se},D&&"none"!==D&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories},{className:h,title:W,description:z,summary:G,accessibleTable:Y},null!=o.animate&&{animate:o.animate},j)))});function Ml(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function _l(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function Ll(e){return"function"==typeof e?e:t=>t[e]||1}function Tl({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=De(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=De(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}Pl.displayName="ForceDirectedGraph";const Bl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Va(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:O,frameProps:E={},onObservation:j,onClick:C,chartId:P,selection:M,linkedHover:_,loading:L,emptyContent:T,legendInteraction:B}=o,D=s.width,N=s.height,I=s.enableHover,$=null===(i=s.showLabels)||void 0===i||i,H=s.title,R=s.description,F=s.summary,W=s.accessibleTable,z=Es(L,D,N),G=z?null:Os(c,D,N,T),Y=c||[],q=n(()=>_l(l,Y,g,f),[l,Y,g,f]),X=Fa(q,m,v),V=n(()=>{if(!m)return[];const e=new Set;for(const t of q){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[q,m]),U=qa(B,m,V),K=$a(),Q=n(()=>new Map,[]),Z=n(()=>{if(Array.isArray(v))return v;if(K&&K.length>0)return K;const e=Me[v];return Array.isArray(e)?e:_e},[v,K]),J=q.length>0,ee=n(()=>{if(J)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(m)r.fill=De(e.data||e,m,X);else{const i=Array.isArray(v)?v:Me[v]||_e,a=Array.isArray(i)?i:_e,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r}},[J,m,X,v]),te=n(()=>{if(J)return Tl({edgeColorBy:b,colorBy:m,colorScale:X,nodeStyleFn:ee||(e=>({fill:Ha(void 0,K,v,void 0,Q)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[J,b,m,X,ee,S,K,v,Q]),ne=n(()=>{if(!$)return;const e=A||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[$,A,y]),oe=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:re,customClickBehavior:ie}=za({selection:M,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"ChordDiagram",chartId:P}),ae=rs({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return ae?e.createElement(Ka,{componentName:"ChordDiagram",message:ae,width:D,height:N}):z||G||e.createElement(ws,{componentName:"ChordDiagram",width:D,height:N},e.createElement(Yi,Object.assign({ref:a,chartType:"chord"},q.length>0&&{nodes:q},null!=c&&{edges:Y},{size:[D,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:ee,edgeStyle:te,colorBy:m,colorScheme:Z,edgeColorBy:b,edgeOpacity:S,nodeLabel:ne,showLabels:$,enableHover:I,tooltipContent:!1===O?()=>null:Qi(O)||void 0,customHoverBehavior:_||j||C?re:void 0,customClickBehavior:j||C?ie:void 0},B&&"none"!==B&&{legendHoverBehavior:U.onLegendHover,legendClickBehavior:U.onLegendClick,legendHighlightedCategory:U.highlightedCategory,legendIsolatedCategories:U.isolatedCategories},{className:h,title:H,description:R,summary:F,accessibleTable:W},null!=o.animate&&{animate:o.animate},E)))});Bl.displayName="ChordDiagram";const Dl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=Va(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:O=.5,edgeSort:E,tooltip:j,frameProps:C={},onObservation:P,onClick:M,chartId:_,selection:L,linkedHover:T,loading:B,emptyContent:D,legendInteraction:N}=o,I=s.width,$=s.height,H=s.enableHover,R=null===(i=s.showLabels)||void 0===i||i,F=s.title,W=s.description,z=s.summary,G=s.accessibleTable,Y=Es(B,I,$),q=Y?null:Os(c,I,$,D),X=c||[],V=n(()=>_l(l,X,g,f),[l,X,g,f]),U=Fa(V,m,v),K=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Q=qa(N,m,K),Z=$a(),J=n(()=>new Map,[]),ee=n(()=>{if(Array.isArray(v))return v;if(Z&&Z.length>0)return Z;const e=Me[v];return Array.isArray(e)?e:_e},[v,Z]),te=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?De(e.data||e,m,U):Ha(void 0,Z,v,void 0,J),t},[m,U,Z,v,J]),ne=n(()=>Tl({edgeColorBy:b,colorBy:m,colorScale:U,nodeStyleFn:te,edgeOpacity:O,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,U,te,O]),oe=n(()=>{if(!R)return;const e=S||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[R,S,y]),re=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:ie,customClickBehavior:ae}=za({selection:L,linkedHover:T,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:P,onClick:M,chartType:"SankeyDiagram",chartId:_}),se=rs({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return se?e.createElement(Ka,{componentName:"SankeyDiagram",message:se,width:I,height:$}):Y||q||e.createElement(ws,{componentName:"SankeyDiagram",width:I,height:$},e.createElement(Yi,Object.assign({ref:a,chartType:"sankey"},V.length>0&&{nodes:V},null!=c&&{edges:X},{size:[I,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:te,edgeStyle:ne,colorBy:m,colorScheme:ee,edgeColorBy:b,edgeOpacity:O,edgeSort:E,nodeLabel:oe,showLabels:R,enableHover:H,tooltipContent:!1===j?()=>null:Qi(j)||void 0,customHoverBehavior:T||P||M?ie:void 0,customClickBehavior:P||M?ae:void 0},N&&"none"!==N&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:h,title:F,description:W,summary:z,accessibleTable:G},null!=o.animate&&{animate:o.animate},C)))});function Nl(t){var o;const r=Va(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:a,className:s,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:f,colorByDepth:p=!1,edgeStyle:y="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,onClick:w,chartId:A,selection:S,linkedHover:O,loading:E,legendInteraction:j}=t,C=r.width,P=r.height,M=r.enableHover,_=null===(o=r.showLabels)||void 0===o||o,L=r.title,T=r.description,B=r.summary,D=r.accessibleTable,N=Es(E,C,P),I=n(()=>Ml(null!=i?i:null,u),[i,u]),$=Fa(I,p?void 0:g,f),H=n(()=>{if(!g||p)return[];const e=new Set;for(const t of I){const n="function"==typeof g?g(t):t[g];null!=n&&e.add(n+"")}return Array.from(e)},[I,g,p]),R=qa(j,p?void 0:g,H),F=$a(),W=n(()=>new Map,[]),z=n(()=>{if(Array.isArray(f))return f;if(F&&F.length>0)return F;const e=Me[f];return Array.isArray(e)?e:_e},[f,F]),G=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?Te[(e.depth||0)%Te.length]:g?De(e.data||e,g,$):Ha(void 0,F,f,void 0,W),t},[g,p,$,F,f,W]),Y=n(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),q=n(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return Ll(d)},[l,d]),X=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:V,customClickBehavior:U}=za({selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,onClick:w,chartType:"TreeDiagram",chartId:A}),K=os({componentName:"TreeDiagram",data:i});return K?e.createElement(Ka,{componentName:"TreeDiagram",message:K,width:C,height:P}):N||e.createElement(ws,{componentName:"TreeDiagram",width:C,height:P},e.createElement(Yi,Object.assign({chartType:l},null!=i&&{data:i},{size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:q,treeOrientation:c,edgeType:y,nodeStyle:G,edgeStyle:Y,colorBy:g,colorScheme:z,colorByDepth:p,nodeSize:v,nodeLabel:_?m||h:void 0,showLabels:_,enableHover:M,tooltipContent:!1===b?()=>null:Qi(b)||void 0,customHoverBehavior:O||k||w?V:void 0,customClickBehavior:k||w?U:void 0},j&&"none"!==j&&{legendHoverBehavior:R.onLegendHover,legendClickBehavior:R.onLegendClick,legendHighlightedCategory:R.highlightedCategory,legendIsolatedCategories:R.isolatedCategories},{className:s,title:L,description:T,summary:B,accessibleTable:D},null!=t.animate&&{animate:t.animate},x)))}function Il(t){var o;const r=Va(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:i,margin:a,className:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,labelMode:p="leaf",nodeLabel:y,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:E,legendInteraction:j}=t,C=r.width,P=r.height,M=r.enableHover,_=null===(o=r.showLabels)||void 0===o||o,L=r.title,T=r.description,B=r.summary,D=r.accessibleTable,N=Es(E,C,P),{activeSelectionHook:I,customHoverBehavior:$,customClickBehavior:H}=za({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,onClick:S,chartType:"Treemap",chartId:O}),R=Cs(k),F=s(e=>{if(!e)return $(null);const t=e.data||e;$({data:(null==t?void 0:t.data)||t})},[$]),W=n(()=>Ml(null!=i?i:null,c),[i,c]),z=Fa(W,f?void 0:h,g),G=n(()=>{if(!h||f)return[];const e=new Set;for(const t of W){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[W,h,f]),Y=qa(j,f?void 0:h,G),q=$a(),X=n(()=>new Map,[]),V=n(()=>{if(Array.isArray(g))return g;if(q&&q.length>0)return q;const e=Me[g];return Array.isArray(e)?e:_e},[g,q]),U=n(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=f?Te[(e.depth||0)%Te.length]:h?De(e.data||e,h,z):Ha(void 0,q,g,void 0,X),t},[h,f,z,q,g,X]),K=n(()=>I?e=>{var t;const n=Object.assign({},U(e));if(I.isActive)if(I.predicate(e.data||e))(null==R?void 0:R.selectedStyle)&&Object.assign(n,R.selectedStyle);else{const e=null!==(t=null==R?void 0:R.unselectedOpacity)&&void 0!==t?t:.5;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==R?void 0:R.unselectedStyle)&&Object.assign(n,R.unselectedStyle)}return n}:U,[U,I,R]),Q=n(()=>Ll(u),[u]),Z=void 0!==v?v:!_||"parent"!==p&&"all"!==p?void 0:18,J=Object.assign(Object.assign({},r.marginDefaults),a),ee=os({componentName:"Treemap",data:i});return ee?e.createElement(Ka,{componentName:"Treemap",message:ee,width:C,height:P}):N||e.createElement(ws,{componentName:"Treemap",width:C,height:P},e.createElement(Yi,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:Q,padding:m,paddingTop:Z,nodeStyle:K,colorBy:h,colorScheme:V,colorByDepth:f,nodeLabel:_?y||d:void 0,showLabels:_,labelMode:p,enableHover:M,tooltipContent:!1===b?()=>null:Qi(b)||void 0},(w||A||S)&&{customHoverBehavior:F},(A||S)&&{customClickBehavior:H},j&&"none"!==j&&{legendHoverBehavior:Y.onLegendHover,legendClickBehavior:Y.onLegendClick,legendHighlightedCategory:Y.highlightedCategory,legendIsolatedCategories:Y.isolatedCategories},{className:l,title:L,description:T,summary:B,accessibleTable:D},null!=t.animate&&{animate:t.animate},x)))}function $l(t){var o;const r=Va(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:a,className:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,nodeLabel:f,circleOpacity:p=.7,padding:y=4,tooltip:m,frameProps:v={},onObservation:b,onClick:x,chartId:k,selection:w,linkedHover:A,loading:S,legendInteraction:O}=t,E=r.width,j=r.height,C=r.enableHover,P=null===(o=r.showLabels)||void 0===o||o,M=r.title,_=r.description,L=r.summary,T=r.accessibleTable,B=Es(S,E,j),D=n(()=>Ml(null!=i?i:null,l),[i,l]),N=Fa(D,g?void 0:d,h),I=n(()=>{if(!d||g)return[];const e=new Set;for(const t of D){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[D,d,g]),$=qa(O,g?void 0:d,I),H=$a(),R=n(()=>new Map,[]),F=n(()=>{if(Array.isArray(h))return h;if(H&&H.length>0)return H;const e=Me[h];return Array.isArray(e)?e:_e},[h,H]),W=n(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?Te[(e.depth||0)%Te.length]:d?De(e.data||e,d,N):Ha(void 0,H,h,void 0,R),t},[d,g,N,p,H,h,R]),z=n(()=>Ll(c),[c]),G=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:Y,customClickBehavior:q}=za({selection:w,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),X=os({componentName:"CirclePack",data:i});return X?e.createElement(Ka,{componentName:"CirclePack",message:X,width:E,height:j}):B||e.createElement(ws,{componentName:"CirclePack",width:E,height:j},e.createElement(Yi,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[E,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:z,padding:y,nodeStyle:W,colorBy:d,colorScheme:F,colorByDepth:g,nodeLabel:P?f||u:void 0,showLabels:P,enableHover:C,tooltipContent:!1===m?()=>null:Qi(m)||void 0,customHoverBehavior:A||b||x?Y:void 0,customClickBehavior:b||x?q:void 0},O&&"none"!==O&&{legendHoverBehavior:$.onLegendHover,legendClickBehavior:$.onLegendClick,legendHighlightedCategory:$.highlightedCategory,legendIsolatedCategories:$.isolatedCategories},{className:s,title:M,description:_,summary:L,accessibleTable:T},null!=t.animate&&{animate:t.animate},v)))}Dl.displayName="SankeyDiagram",Nl.displayName="TreeDiagram",Il.displayName="Treemap",$l.displayName="CirclePack";const Hl=Te;function Rl(t){const o=Va(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:r,margin:i,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:E,onClick:j,chartId:C,selection:P,linkedHover:M,loading:_}=t,L=o.width,T=o.height,B=o.enableHover,D=o.title,N=o.description,I=o.summary,$=o.accessibleTable,H=Es(_,L,T),R=Fa(n(()=>Ml(r,s),[r,s]),d?void 0:c,u),F=$a(),W=n(()=>new Map,[]),z=n(()=>{if(Array.isArray(u))return u;if(F&&F.length>0)return F;const e=Me[u];return Array.isArray(e)?e:_e},[u,F]),G=n(()=>{if(Array.isArray(u))return u;const e=Me[u];return Array.isArray(e)?e:_e},[u]),Y=n(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?G[0]:Hl[(e.depth||0)%Hl.length]:c?De(e.data||e,c,R):Ha(void 0,F,u,void 0,W),n.opacity=o?1:.85,n},[c,d,R,G,F,u,W]),q=n(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),X=Object.assign({top:10,right:10,bottom:10,left:10},i),{customHoverBehavior:V,customClickBehavior:U}=za({selection:P,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:E,onClick:j,chartType:"OrbitDiagram",chartId:C}),K=n(()=>{if(V)return e=>{V(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[V]),Q=n(()=>{if(U)return e=>{U(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[U]),Z=os({componentName:"OrbitDiagram",data:r});return Z?e.createElement(Ka,{componentName:"OrbitDiagram",message:Z,width:L,height:T}):H||e.createElement(ws,{componentName:"OrbitDiagram",width:L,height:T},e.createElement(Yi,Object.assign({chartType:"orbit"},null!=r&&{data:r},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Y,edgeStyle:q,colorBy:c,colorScheme:z,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&B,tooltipContent:k?void 0:!1===w?()=>null:Qi(w)||void 0,customHoverBehavior:M||E||j?K:void 0,customClickBehavior:E||j?Q:void 0,foregroundGraphics:A,annotations:S,className:a,title:D,description:N,summary:I,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:$},null!=t.animate&&{animate:t.animate},O)))}Rl.displayName="OrbitDiagram";const Fl=c(function(n,o){var r,i,a,l;const c=Va(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:O,background:E,tooltipContent:j,tooltip:C,onHover:P,annotations:M,svgAnnotationRules:_,tickFormatTime:L,tickFormatValue:T,decay:B,pulse:D,staleness:N,transition:I,linkedHover:$,selection:H,onObservation:R,chartId:F,loading:W,emptyContent:z,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=j?j:C,Q=t(null),{customHoverBehavior:Z}=za({selection:H,linkedHover:$,unwrapData:!0,onObservation:R,chartType:"RealtimeLineChart",chartId:F}),J=s(e=>{P&&P(e),Z(e)},[P,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const ee=Es(W,U[0],U[1]),te=ee?null:Os(m,U[0],U[1],z),ne={stroke:A,strokeWidth:S,strokeDasharray:O};return ee||te||e.createElement(Oo,{ref:Q,chartType:"line",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:q,background:E,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:M,svgAnnotationRules:_,tickFormatTime:L,tickFormatValue:T,decay:B,pulse:D,staleness:N,transition:I,pointIdAccessor:n.pointIdAccessor,legendPosition:Y})});Fl.displayName="RealtimeLineChart";const Wl=c(function(n,o){var r,i,a,l;const c=Va(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{binSize:d,size:h,margin:g,className:f,arrowOfTime:p="right",windowMode:y="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,fill:E,stroke:j,strokeWidth:C,gap:P,background:M,tooltipContent:_,tooltip:L,onHover:T,annotations:B,svgAnnotationRules:D,tickFormatTime:N,tickFormatValue:I,linkedHover:$,selection:H,decay:R,pulse:F,staleness:W,transition:z,onObservation:G,chartId:Y,loading:q,emptyContent:X,emphasis:V,legendPosition:U,brush:K,onBrush:Q,linkedBrush:Z}=n,J=c.showAxes,ee=c.enableHover,te=null!=g?g:c.marginDefaults,ne=null!=h?h:[c.width,c.height],oe=null!=_?_:L,re=t(null),{customHoverBehavior:ie}=za({selection:H,linkedHover:$,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:Y}),ae=s(e=>{T&&T(e),ie(e)},[T,ie]),se=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,le=Sa(Z),ce=ya(Object.assign({name:(null==le?void 0:le.name)||"__unused_hist_brush__",xField:(null==le?void 0:le.xField)||("string"==typeof b?b:"time")},(null==le?void 0:le.yField)?{yField:le.yField}:{})),ue=t(ce.brushInteraction);ue.current=ce.brushInteraction;const de=s(e=>{if(Q&&Q(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}),le){const t=ue.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[Q,G,Y,le]);u(o,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=re.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=re.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const he=Es(q,ne[0],ne[1]),ge=he?null:Os(v,ne[0],ne[1],X),fe={};return null!=E&&(fe.fill=E),null!=j&&(fe.stroke=j),null!=C&&(fe.strokeWidth=C),null!=P&&(fe.gap=P),he||ge||e.createElement(Oo,{ref:re,chartType:"bar",runtimeMode:"streaming",size:ne,margin:te,className:V?`${f||""} semiotic-emphasis-${V}`.trim():f,arrowOfTime:p,windowMode:y,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:d,categoryAccessor:S,barColors:O,barStyle:fe,showAxes:J,background:M,hoverAnnotation:ee,tooltipContent:oe,customHoverBehavior:ae,annotations:B,svgAnnotationRules:D,tickFormatTime:N,tickFormatValue:I,decay:R,pulse:F,staleness:W,transition:z,pointIdAccessor:n.pointIdAccessor,legendPosition:U,brush:se||(Z?{dimension:"x"}:void 0),onBrush:se||Z?de:void 0})});Wl.displayName="RealtimeTemporalHistogram";const zl=Wl,Gl=c(function(n,o){var r,i,a,l;const c=Va(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:O,fill:E,opacity:j,stroke:C,strokeWidth:P,background:M,tooltipContent:_,tooltip:L,onHover:T,annotations:B,svgAnnotationRules:D,tickFormatTime:N,tickFormatValue:I,linkedHover:$,selection:H,onObservation:R,chartId:F,loading:W,emptyContent:z,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=_?_:L,Q=t(null),{customHoverBehavior:Z}=za({selection:H,linkedHover:$,unwrapData:!0,onObservation:R,chartType:"RealtimeSwarmChart",chartId:F}),J=s(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const ee=Es(W,U[0],U[1]),te=ee?null:Os(m,U[0],U[1],z),ne={};return null!=O&&(ne.radius=O),null!=E&&(ne.fill=E),null!=j&&(ne.opacity=j),null!=C&&(ne.stroke=C),null!=P&&(ne.strokeWidth=P),ee||te||e.createElement(Oo,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:ne,showAxes:q,background:M,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:D,tickFormatTime:N,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});Gl.displayName="RealtimeSwarmChart";const Yl=c(function(n,o){var r,i,a,l;const c=Va(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:O,connectorWidth:E,gap:j,stroke:C,strokeWidth:P,background:M,tooltipContent:_,tooltip:L,onHover:T,annotations:B,svgAnnotationRules:D,tickFormatTime:N,tickFormatValue:I,linkedHover:$,selection:H,onObservation:R,chartId:F,loading:W,emptyContent:z,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=_?_:L,Q=t(null),{customHoverBehavior:Z}=za({selection:H,linkedHover:$,unwrapData:!0,onObservation:R,chartType:"RealtimeWaterfallChart",chartId:F}),J=s(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const ee=Es(W,U[0],U[1]),te=ee?null:Os(m,U[0],U[1],z),ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=O&&(ne.connectorStroke=O),null!=E&&(ne.connectorWidth=E),null!=j&&(ne.gap=j),null!=C&&(ne.stroke=C),null!=P&&(ne.strokeWidth=P),ee||te||e.createElement(Oo,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:q,background:M,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:D,tickFormatTime:N,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});Yl.displayName="RealtimeWaterfallChart";const ql=c(function(n,o){var r,i,a,l;const c=Va(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(l=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==l?l:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:O=20,aggregation:E="count",background:j,tooltipContent:C,tooltip:P,onHover:M,annotations:_,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:B,decay:D,pulse:N,staleness:I,linkedHover:$,selection:H,onObservation:R,chartId:F,loading:W,emptyContent:z,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=C?C:P,Q=t(null),{customHoverBehavior:Z}=za({selection:H,linkedHover:$,unwrapData:!0,onObservation:R,chartType:"RealtimeHeatmap",chartId:F}),J=s(e=>{M&&M(e),Z(e)},[M,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const ee=Es(W,U[0],U[1]),te=ee?null:Os(m,U[0],U[1],z);return ee||te||e.createElement(Oo,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:O,heatmapAggregation:E,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:_,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:B,decay:D,pulse:N,staleness:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});function Xl(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),n=Math.abs(t);return 1e9>n?1e6>n?1e4>n?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}ql.displayName="RealtimeHeatmap";const Vl=864e5;function Ul(e){return 10>e?"0"+e:e+""}const Kl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ql(e){let t,n=e;return(o,r,i)=>{const a=o instanceof Date?o:new Date(o);e||!i||2>i.length||i===t||(t=i,n=function(e){if(2>e.length)return"days";const t=[];for(let n=1;e.length>n;n++)t.push(e[n]-e[n-1]);t.sort((e,t)=>e-t);const n=t[Math.floor(t.length/2)];return 12e4>n?"seconds":72e5>n?"minutes":2*Vl>n?"hours":60*Vl>n?"days":400*Vl>n?"months":"years"}(i));const s=n||"days";return null!=r&&0!==r&&i&&0!==i.length?function(e,t,n){const o=e.getUTCFullYear()!==t.getUTCFullYear(),r=o||e.getUTCMonth()!==t.getUTCMonth(),i=r||e.getUTCDate()!==t.getUTCDate(),a=i||e.getUTCHours()!==t.getUTCHours(),s=a||e.getUTCMinutes()!==t.getUTCMinutes(),l=Kl[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=Ul(e.getUTCHours()),h=Ul(e.getUTCMinutes()),g=Ul(e.getUTCSeconds());switch(n){case"seconds":return o?`${l} ${c}, ${u} ${d}:${h}:${g}`:i?`${l} ${c} ${d}:${h}:${g}`:a?`${d}:${h}:${g}`:s?`${h}:${g}`:":"+g;case"minutes":return o?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:a?`${d}:${h}`:":"+h;case"hours":return o?`${l} ${c}, ${u} ${d}:00`:r?`${l} ${c} ${d}:${h}`:i?`${l} ${c} ${d}:00`:d+":00";case"days":return o?`${l} ${c}, ${u}`:r?`${l} ${c}`:""+c;case"months":return o?`${l} ${u}`:""+l;case"years":return""+u}}(a,new Date(i[r-1]),s):function(e,t){const n=Kl[e.getUTCMonth()],o=e.getUTCDate(),r=e.getUTCFullYear(),i=Ul(e.getUTCHours()),a=Ul(e.getUTCMinutes()),s=Ul(e.getUTCSeconds());switch(t){case"seconds":return`${n} ${o}, ${r} ${i}:${a}:${s}`;case"minutes":case"hours":return`${n} ${o}, ${r} ${i}:${a}`;case"days":return`${n} ${o}, ${r}`;case"months":return`${n} ${r}`;case"years":return""+r}}(a,s)}}function Zl(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function Jl(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function ec(e,t){return Ts(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),tc(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);nc(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*r,n=l.height*r,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,n),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),a.toBlob(n=>{n?(nc(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function tc(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)tc(o[e],r[e])}function nc(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const oc=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),rc=new Set(["data","nodes","edges"]),ic="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function ac(e,t,n){if(!us[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(us).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(oc.has(e)||!o&&rc.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=ic(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function sc(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!us[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:ic(e.props)}}function lc(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function cc(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function uc(e){return Ts(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?dc(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function dc(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function hc(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function gc(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function fc(e){return"nominal"===e||"ordinal"===e}function pc(e){return"quantitative"===e||"temporal"===e}const yc={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},mc={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},vc={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function bc(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f;const p=[],{type:y,markProps:m}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"])}}(e.mark),v=e.encoding||{},b=v.x,x=v.y,k=v.color,w=v.size,A=v.theta,S=v.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&p.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&p.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&p.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&p.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||e.encoding&&e.encoding.facet||e.encoding&&(e.encoding.row||e.encoding.column))&&p.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&p.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&p.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const E={};e.width&&(E.width=e.width),e.height&&(E.height=e.height);const j=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(j&&(E.title=j),(null==k?void 0:k.field)&&(E.colorBy=k.field,null===(o=k.scale)||void 0===o?void 0:o.scheme)){const e=yc[k.scale.scheme];e&&(E.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(E.pointOpacity=S.value);const C=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(O&&(C||P)){const e=P?x:b,t=P?b:x,n=vc[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:n,value:o,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[n]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of i){let o;switch(r){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(O,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const n of O){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}O=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(E.data=O),(null==b?void 0:b.bin)?(E.valueAccessor=b.field,(null==x?void 0:x.field)&&(E.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(E.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(E.valueAccessor=x.field,(null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(E.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(a=null==b?void 0:b.bin)||void 0===a?void 0:a.maxbins)||(null===(s=null==x?void 0:x.bin)||void 0===s?void 0:s.maxbins):void 0;return t&&(E.bins=t),kc(e,E,p)}let M;switch(y){case"bar":M=function(e,t,n,o,r,i,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",fc(null==e?void 0:e.type)&&pc(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):pc(null==e?void 0:e.type)&&fc(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=i?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),r&&(o.data=r),g}(b,x,k,E,O,C,P);break;case"line":if(M="LineChart",xc(b,x,E,C,P),(null==k?void 0:k.field)&&(E.lineBy=k.field),m.interpolate){const e=mc[m.interpolate];e&&(E.curve=e)}!0===m.point&&(E.showPoints=!0),O&&(E.data=O);break;case"area":if((null==k?void 0:k.field)?(M="StackedAreaChart",E.areaBy=k.field):M="AreaChart",xc(b,x,E,C,P),m.interpolate){const e=mc[m.interpolate];e&&(E.curve=e)}void 0!==m.opacity&&(E.areaOpacity=m.opacity),O&&(E.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(M="BubbleChart",E.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(E.sizeRange=w.scale.range)):M="Scatterplot",xc(b,x,E,C,P),O&&(E.data=O);break;case"rect":M="Heatmap",(null==b?void 0:b.field)&&(E.xAccessor=b.field),(null==x?void 0:x.field)&&(E.yAccessor=x.field),(null==k?void 0:k.field)&&(E.valueAccessor=k.field,delete E.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(E.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(E.yLabel=x.axis.title),O&&(E.data=O);break;case"arc":m.innerRadius&&m.innerRadius>0?(M="DonutChart",E.innerRadius=m.innerRadius):M="PieChart",(null==A?void 0:A.field)?E.valueAccessor=A.field:(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field),(null==k?void 0:k.field)&&(E.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(E.categoryAccessor=b.field),O&&(E.data=O);break;case"tick":M="DotPlot",fc(null==b?void 0:b.type)?(E.categoryAccessor=b.field,(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(E.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(E.valueLabel=x.axis.title)):fc(null==x?void 0:x.type)?(E.categoryAccessor=x.field,(null==b?void 0:b.field)&&(E.valueAccessor=C?"value":b.field),E.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(E.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(E.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field)),O&&(E.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),M="Scatterplot",xc(b,x,E,C,P),O&&(E.data=O)}return kc(M,E,p)}function xc(e,t,n,o,r){var i,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=r?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function kc(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}function wc(){const t=function(){const t=e.useContext(sn);return t?()=>t.setVisible(e=>!e):null}();return t?e.createElement("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:jc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"}))):null}const Ac={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function Sc({height:t}){return e.createElement("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function Oc({error:t}){return e.createElement("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5}},t))}const Ec=e.forwardRef(function({title:t,subtitle:n,children:o,width:r="100%",height:i=400,actions:a,chartConfig:s,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:f,style:p},y){const m=e.useRef(null),v=e.useRef(null),[b,x]=e.useState(!1),k=!1!==(null==a?void 0:a.export)&&void 0!==(null==a?void 0:a.export),w=!1!==(null==a?void 0:a.fullscreen)&&void 0!==(null==a?void 0:a.fullscreen),A=!1!==(null==a?void 0:a.copyConfig)&&void 0!==(null==a?void 0:a.copyConfig)&&s,S=!0===(null==a?void 0:a.dataSummary),O="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",j=e.useCallback(e=>Ts(this,void 0,void 0,function*(){v.current&&(yield ec(v.current,Object.assign(Object.assign({},O),e)))}),[O]),C=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),P=e.useCallback(e=>Ts(this,void 0,void 0,function*(){s&&(yield uc(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(y,()=>({export:j,toggleFullscreen:C,copyConfig:P,element:m.current}),[j,C,P]);const M=t||n||l||k||w||A||S||h,_=c?e.createElement(Sc,{height:i}):u?e.createElement(Oc,{error:u}):d?e.createElement(Qa,null,o):o;return L=e.createElement(e.Fragment,null,e.createElement("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.createElement("div",{ref:m,className:"semiotic-chart-container"+(f?" "+f:""),style:Object.assign(Object.assign({width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),p)},M&&e.createElement("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}},e.createElement("div",{className:"semiotic-chart-title-area"},t&&e.createElement("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"}},t),n&&e.createElement("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0}},n)),e.createElement("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4}},l,k&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Export chart","aria-label":"Export chart",style:jc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.createElement("path",{d:"M2 12h10"}))),S&&e.createElement(wc,null),w&&e.createElement("button",{className:"semiotic-chart-action",onClick:C,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen",style:jc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b?e.createElement(e.Fragment,null,e.createElement("path",{d:"M9 1v4h4"}),e.createElement("path",{d:"M5 13V9H1"}),e.createElement("path",{d:"M13 5H9V1"}),e.createElement("path",{d:"M1 9h4v4"})):e.createElement(e.Fragment,null,e.createElement("path",{d:"M1 5V1h4"}),e.createElement("path",{d:"M13 9v4H9"}),e.createElement("path",{d:"M9 1h4v4"}),e.createElement("path",{d:"M5 13H1V9"})))),A&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Copy config","aria-label":"Copy chart configuration",style:jc},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.createElement("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"}))),h&&e.createElement("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Ac[h].bg,color:Ac[h].color,lineHeight:"18px"}},h))),e.createElement("div",{className:"semiotic-chart-body",ref:v,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},b?{flex:1}:{height:i})},_,g))),S?e.createElement(ln,null,L):L;var L}),jc={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function Cc({children:t,columns:n="auto",minCellWidth:o=300,gap:r=16,className:i,style:a}){const s="number"==typeof n?n:void 0;return e.createElement("div",{className:"semiotic-chart-grid"+(i?" "+i:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},a)},e.Children.map(t,t=>e.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==s&&2>s?t:e.createElement("div",{style:{gridColumn:"span 2"}},t):t))}function Pc({children:t,context:n,position:o="right",contextSize:r=250,gap:i=12,className:a,style:s}){const l="left"===o||"right"===o,c="left"===o||"top"===o,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:i,width:"100%"},s),d=l?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return e.createElement("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u},e.createElement("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0}},t),e.createElement("div",{style:d},n))}Cc.displayName="ChartGrid",Pc.displayName="ContextLayout";function Mc({children:n,position:r="right",size:i=300,trigger:a="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:f,style:p}){const[y,m]=l(null),[v,b]=l(null),[x,k]=l(!1),[w,A]=l(!1),S=t(null),O=t(),E="click"===a?["click","click-end"]:["hover","hover-end"],{latest:j}=va({types:E,chartId:c,limit:1}),C=void 0!==u?u:j;o(()=>{if(C)if("click"===C.type||"hover"===C.type){const e=C;m(e.datum),b(e),x||(k(!0),A(!0),clearTimeout(O.current),O.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==C.type&&"hover-end"!==C.type||P()},[C]),o(()=>{null==g||g(x)},[x,g]);const P=s(()=>{A(!0),k(!1),clearTimeout(O.current),O.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(o(()=>()=>clearTimeout(O.current),[]),!y&&!w)return null;const M=y&&v?n(y,v):null;if(null===M&&!w)return null;const _=function(e,t,n,o){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},r),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(r,i,x,w);return e.createElement("div",{ref:S,className:`semiotic-details-panel semiotic-details-${r}${f?" "+f:""}`,style:Object.assign(Object.assign({},_),p)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:_c},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},e.createElement("path",{d:"M2 2l8 8M10 2l-8 8"}))),e.createElement("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1}},M))}const _c={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};Mc.displayName="DetailsPanel";export{$s as AreaChart,il as BarChart,vl as BoxPlot,Ws as BubbleChart,ja as CARBON_ALERT,Ea as CARBON_CATEGORICAL_14,Ln as COLOR_BLIND_SAFE_CATEGORICAL,ia as CategoryColorProvider,Ec as ChartContainer,Qa as ChartErrorBoundary,Cc as ChartGrid,Bl as ChordDiagram,$l as CirclePack,Ls as ConnectedScatterplot,Pc as ContextLayout,Bn as DARK_THEME,Mc as DetailsPanel,Ol as DonutChart,Al as DotPlot,Pl as ForceDirectedGraph,wl as FunnelChart,El as GaugeChart,jl as GroupedBarChart,Dn as HIGH_CONTRAST_THEME,Fs as Heatmap,bl as Histogram,Se as IncrementalExtent,Tn as LIGHT_THEME,fl as LikertChart,Is as LineChart,wa as LinkedCharts,Zs as MinimapChart,rl as MultiAxisLineChart,Ki as MultiLineTooltip,Rl as OrbitDiagram,Sl as PieChart,Js as QuadrantChart,ql as RealtimeHeatmap,zl as RealtimeHistogram,Fl as RealtimeLineChart,Gl as RealtimeSwarmChart,Wl as RealtimeTemporalHistogram,Yl as RealtimeWaterfallChart,kl as RidgelinePlot,Ae as RingBuffer,Dl as SankeyDiagram,Ms as Scatterplot,Ks as ScatterplotMatrix,Rs as StackedAreaChart,sl as StackedBarChart,Yi as StreamNetworkFrame,rr as StreamOrdinalFrame,Oo as StreamXYFrame,yl as SwarmPlot,Cl as SwimlaneChart,Ca as THEME_PRESETS,Da as ThemeProvider,Ui as Tooltip,Nl as TreeDiagram,Il as Treemap,xl as ViolinPlot,Ql as adaptiveTimeTicks,dc as configToJSX,uc as copyConfig,Xo as createHatchPattern,Zl as darkenColor,gc as deserializeSelections,ec as exportChart,sc as fromConfig,cc as fromURL,bc as fromVegaLite,Jl as lightenColor,Qi as normalizeTooltip,Pa as resolveThemePreset,hc as serializeSelections,Xl as smartTickFormat,Ma as themeToCSS,_a as themeToTokens,ac as toConfig,lc as toURL,ya as useBrushSelection,aa as useCategoryColors,va as useChartObserver,ma as useFilteredData,pa as useLinkedHover,fa as useSelection,Na as useTheme};
1
+ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useRef as i,useMemo as r,useEffect as s,createContext as a,useContext as l,useCallback as c,useSyncExternalStore as u,useState as d,forwardRef as h,useImperativeHandle as g,useId as f}from"react";import{select as p}from"d3-selection";import{brushX as y,brushY as v,brush as m}from"d3-brush";import{scaleOrdinal as b,scaleLinear as x,scaleLog as k,scaleTime as w,scaleBand as A,scaleSequential as S}from"d3-scale";import{quadtree as O}from"d3-quadtree";import{interpolatePlasma as j,interpolateViridis as C,interpolatePurples as M,interpolateOranges as P,interpolateGreens as _,interpolateReds as L,interpolateBlues as T,schemeSet3 as B,schemeTableau10 as D,schemeCategory10 as $,interpolateTurbo as N,interpolateCividis as I,interpolateMagma as H,interpolateInferno as W,interpolateGreys as R,interpolateSpectral as F,interpolateRdYlGn as z,interpolateRdYlBu as E,interpolateBrBG as Y,interpolatePRGn as G,interpolatePiYG as q,interpolateRdBu as X}from"d3-scale-chromatic";import{bin as V,quantile as U,min as K,groups as Q,max as Z,sum as J,mean as ee,group as te}from"d3-array";import{packEnclose as oe,hierarchy as ne,partition as ie,pack as re,treemap as se,treemapBinary as ae,cluster as le,tree as ce}from"d3-hierarchy";import{area as ue,curveCatmullRom as de,curveCardinal as he,curveBasis as ge,curveStepBefore as fe,curveStepAfter as pe,curveStep as ye,curveMonotoneY as ve,curveMonotoneX as me,curveLinear as be,arc as xe,line as ke,curveNatural as we,pie as Ae}from"d3-shape";import Se from"regression";import{interpolateNumber as Oe}from"d3-interpolate";import{forceLink as je,forceSimulation as Ce,forceManyBody as Me,forceCenter as Pe,forceX as _e,forceY as Le}from"d3-force";import{ribbon as Te,chord as Be}from"d3-chord";function De(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n+1>>1;t[i]>e?n=i-1:o=i}return t[o]}function $e(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n>>1;e>t[i]?o=i+1:n=i}return t[o]}function Ne({width:t,height:o,totalWidth:n,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:b,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const S=i(u);S.current=u;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),j=i(O);j.current=O;const C=i(!1),M=i(null);return s(()=>{if(!k.current)return;const e=p(k.current).select(".brush-g"),n="x"===c?y():"y"===c?v():m();return n.extent([[0,0],[t,o]]),n.on("brush end",i=>{if(C.current)return;const r=S.current;if(!r)return;if(!i.selection)return M.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(0)]}else if("y"===c){const[e,o]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(e)]}else{const[[e,t],[o,n]]=i.selection;s=[r.x.invert(e),r.x.invert(o)],a=[r.y.invert(n),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&b)){const t=j.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[De(e[0],t),$e(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const o=r.x(s[0]),a=r.x(s[1]);if(C.current=!0,"x"===c)e.call(n.move,[o,a]);else if("xy"===c){const t=i.selection;e.call(n.move,[[o,t[0][1]],[a,t[1][1]]])}C.current=!1}const l={x:s,y:a};M.current=l,A.current(l)}),e.call(n),w.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),w.current=null}},[t,o,c,g,h,b]),s(()=>{if(!(x&&u&&w.current&&M.current))return;if(!k.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],o=p(k.current).select(".brush-g");if(t>=e.x[1])return C.current=!0,o.call(w.current.move,null),C.current=!1,M.current=null,void A.current(null);let n=e.x[0],i=!1;if(t>e.x[0]){if(n=t,"bin"===g){const e=j.current;e&&e.length>0?n=$e(t,e):h&&h>0&&(n=Math.ceil(t/h)*h)}if(n>=e.x[1])return C.current=!0,o.call(w.current.move,null),C.current=!1,M.current=null,void A.current(null);i=!0}const r=u.x(n),s=u.x(e.x[1]);if(C.current=!0,"x"===c)o.call(w.current.move,[r,s]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(w.current.move,[[r,t],[s,n]])}if(C.current=!1,i){const t={x:[n,e.x[1]],y:e.y};M.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:k,width:n,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class Ie{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function He(t){const o=a(null),n=We(t);return[function({children:n}){const i=r(()=>We(t),[]);return e(o.Provider,{value:i,children:n})},e=>{var t;const r=null!==(t=l(o))&&void 0!==t?t:n,s=i(e);s.current=e;const a=c(()=>s.current(r.getState()),[r]),d=c(()=>s.current(r.getState()),[r]);return u(r.subscribe,a,d)}]}function We(e){const t=new EventTarget;let o=e(function(e){o=Object.assign(Object.assign({},o),e(o)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>o,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Re(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function Fe(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:ze})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const ze=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Ee={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ye={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ge={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ze,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[qe,Xe]=He(e=>({theme:Ee,setTheme(t){e(e=>{if("light"===t)return{theme:Ee};if("dark"===t)return{theme:Ye};if("high-contrast"===t)return{theme:Ge};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ye:Ee;return{theme:Fe(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:Fe(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));class Ve{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class Ue{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Ke(e,t,o,n,i){const r=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=r.get(l);if(c||(c={start:l,end:l+n,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function Qe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Ze(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function Je(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function et(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const tt={category10:$,tableau10:D,set3:B,blues:T,reds:L,greens:_,oranges:P,purples:M,viridis:C,plasma:j},ot=$,nt=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],it=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],rt=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function st(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||rt.has(t)}(n)?o(n):n}const n=null==e?void 0:e[t];return o?o(n):ot[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n+""))%ot.length]}function at(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=n.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return b().domain(n).range(o).unknown("#999");const r=tt[o]||tt.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ot;return b().domain(n).range(e).unknown("#999")}}function lt(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}function ct(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}function ut(e,t,o){var n;const i=null!==(n=e.duration)&&void 0!==n?n:500,r=o-t;return i>r?1-r/i:0}function dt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function ht(e,t){return Math.min((e-t.startTime)/t.duration,1)}function gt(e,t,o){return e+(t-e)*o}function ft(){return"undefined"!=typeof performance?performance.now():Date.now()}function pt(e,t,o){var n,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(n=t.datum)||void 0===n?void 0:n.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function yt(e,t,o,n,i,r){const s=[];for(const i of e){const e=o(i),r=n(i);null==e||null==r||Number.isNaN(e)||Number.isNaN(r)||s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function vt(e,t,o,n,i,r,s,a){const l=[];for(const r of e){const e=o(r),s=n(r);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function mt(e,t,o,n,i,r,s){const a=o(e),l=n(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function bt(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function xt(e,t,o,n,i,r,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function kt(e,t,o){if(!e.getBounds||!e.scales)return null;const n=[],i=[];for(const o of t){const t=e.getX(o),r=e.getY(o);if(null==t||null==r||Number.isNaN(t)||Number.isNaN(r))continue;const s=e.getBounds(o),a=e.scales.x(t);if(s&&0!==s)n.push([a,e.scales.y(r+s)]),i.push([a,e.scales.y(r-s)]);else{const t=e.scales.y(r);n.push([a,t]),i.push([a,t])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:i,style:e.resolveBoundsStyle(o,t[0]),datum:t,group:o,interactive:!1}}function wt(e,t,o,n){var i;if(!e.config.pointStyle)return;const r=null!=n?n:e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const s of n.data){let n=e.config.pointStyle(s);!n.fill&&t&&(n=Object.assign(Object.assign({},n),{fill:t}));const a=null!==(i=n.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=mt(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const At={blues:T,reds:L,greens:_,viridis:C,oranges:P,purples:M,greys:R,plasma:j,inferno:W,magma:H,cividis:I,turbo:N},St=new Map;class Ot{constructor(e){if(this.xExtent=new Ue,this.yExtent=new Ue,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this.config=e,this.buffer=new Ve(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Ze(e.timeAccessor||e.xAccessor,"time"),this.getY=Ze(e.valueAccessor||e.yAccessor,"value")):(this.getX=Ze(e.xAccessor,"x"),this.getY=Ze(e.yAccessor,"y")),this.getGroup=et(e.groupAccessor),this.getCategory=et(e.categoryAccessor),this.getSize=e.sizeAccessor?Ze(e.sizeAccessor,"size"):void 0,this.getColor=et(e.colorAccessor),this.getBounds=e.boundsAccessor?Ze(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?Ze(e.y0Accessor,"y0"):void 0,this.getPointId=et(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Ze(e.openAccessor,"open"):void 0,this.getHigh=Ze(e.highAccessor,"high"),this.getLow=Ze(e.lowAccessor,"low"),this.getClose=o?Ze(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new Ve(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Ze(this.config.timeAccessor||this.config.xAccessor,"time"):Ze(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],i=n instanceof Date,r="string"==typeof n&&n.length>=10&&!isNaN(new Date(n).getTime())&&isNaN(Number(n));if(this.xIsDate=i||r,r){const e="string"==typeof o?o:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(o(e)instanceof Date?o(e):new Date(o(e)))}}const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o)))}else for(const o of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,o,n,i,r,s,a;const{config:l,buffer:c}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(o=l.xExtent[0])&&void 0!==o?o:d[0],null!==(n=l.xExtent[1])&&void 0!==n?n:d[1]]:d,f=l.yExtent?[null!==(i=l.yExtent[0])&&void 0!==i?i:h[0],null!==(r=l.yExtent[1])&&void 0!==r?r:h[1]]:h;const p=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!p&&c.size>0)if(l.normalize)f=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)f=this._stackExtentCache.yDomain;else{const t=this.groupData(u),o=new Map;let n=0;for(const e of t)for(const t of e.data){const e=this.getX(t),i=this.getY(t);if(null==e||null==i||Number.isNaN(e)||Number.isNaN(i))continue;const r=(o.get(e)||0)+i;o.set(e,r),r>n&&(n=r)}f=[0,n+(n>0?n*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:f}}}else if("bar"===l.chartType&&l.binSize&&!p&&c.size>0){const[,e]=function(e,t,o,n,i){const r=Ke(e,t,o,n,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(c,this.getX,this.getY,l.binSize,this.getCategory);f=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!p&&c.size>0){const[e,t]=function(e,t){let o=0,n=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,o>i&&(o=i),i>n&&(n=i))}return[o,n]}(c,this.getY),o=t-e,n=o>0?o*l.extentPadding:1;f=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!p&&f[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),o=this.getBounds(e);null!=t&&!Number.isNaN(t)&&o&&(t+o>f[1]&&(f[1]=t+o),f[0]>t-o&&(f[0]=t-o))}const e=f[1]-f[0],t=e>0?e*l.extentPadding:1,o=null===(s=l.yExtent)||void 0===s?void 0:s[0],n=null===(a=l.yExtent)||void 0===a?void 0:a[1];f=[null!=o?f[0]:f[0]-t,null!=n?f[1]:f[1]+t],"log"===l.yScaleType&&0>=f[0]&&h[0]>0&&(f[0]=null!=o?f[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];f[0]!==1/0&&f[1]!==-1/0||(f=[0,1]);const y="streaming"===l.runtimeMode,v=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(y)if("x"==("up"===(m=l.arrowOfTime)||"down"===m?"y":"x")){const t="right"===l.arrowOfTime?[v,e.width-v]:[e.width-v,v];this.scales={x:x().domain(g).range(t),y:x().domain(f).range([e.height-v,v])}}else{const t="down"===l.arrowOfTime?[v,e.height-v]:[e.height-v,v];this.scales={x:x().domain(f).range([v,e.width-v]),y:x().domain(g).range(t)}}else{const t=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(o).clamp(!0)}return"time"===e?w().domain([new Date(t[0]),new Date(t[1])]).range(o):x().domain(t).range(o)};this.scales={x:t(l.xScaleType,g,[v,e.width-v]),y:t(l.yScaleType,f,[e.height-v,v])}}var m;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,o=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxPointRadius=o,Ot.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._quadtree=O().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;break;case"point":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return k().domain(e).range(o).clamp(!0)}return"time"===e?w().domain([new Date(t[0]),new Date(t[1])]).range(o):x().domain(t).range(o)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,n,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var o;const{config:n,scales:i}=this;if(!i||0===t.length)return[];const r={scales:i,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){var o;const n=e.groupData(t),i=[],r=null===(o=e.config.annotations)||void 0===o?void 0:o.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of n){const o=kt(e,t.data,t.key);o&&i.push(o)}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=yt(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(n.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),i.push(n)}return wt(e,n,i),i}(r,t);case"area":return function(e,t){const o=e.groupData(t),n=[],i=e.scales.y.domain()[0],r=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=vt(t.data,e.scales,e.getX,e.getY,i,o,t.key,r);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),n.push(s)}return wt(e,o,n),n}(r,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set,r=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o)if(i.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),i=vt(t.data,e.scales,e.getX,e.getY,r,o,t.key,s);e.config.gradientFill&&(i.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=yt(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return wt(e,o,n),n}(r,t);case"stackedarea":return function(e,t){const o=e.groupData(t);o.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const n=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:i,stackedTops:r}=function(e,t,o,n,i,r,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=o(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=o(i),r=n(i);null==t||null==r||Number.isNaN(t)||Number.isNaN(r)||e.set(t,(e.get(t)||0)+r)}u.set(t.key,e)}let d;if(r){d=new Map;for(const t of c){let o=0;for(const n of e)o+=(null===(a=u.get(n.key))||void 0===a?void 0:a.get(t))||0;d.set(t,o||1)}}const h=[],g=new Map,f=new Map;for(const e of c)f.set(e,0);for(const o of e){const e=u.get(o.key),n=[],a=[],l=new Map;for(const o of c){let i=e.get(o)||0;const s=f.get(o);r&&(i/=d.get(o));const c=s+i,u=t.x(o);a.push([u,t.y(s)]),n.push([u,t.y(c)]),f.set(o,c),l.set(o,c)}g.set(o.key,l);const p={type:"area",topPath:n,bottomPath:a,style:i(o.key,o.data[0]),datum:o.data,group:o.key};s&&(p.curve=s),h.push(p)}return{nodes:h,stackedTops:g}}(o,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,n),s=i;if(e.config.pointStyle){const t=new WeakMap;for(const n of o){const o=r.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=o=>{var n;return null!==(n=t.get(o))&&void 0!==n?n:e.getY(o)};wt(e,o,s,n)}return s}(r,t);case"scatter":case"bubble":return function(e,t){var o;const n=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);s=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7";for(const o of t){let t=e.config.pointStyle?e.config.pointStyle(o):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(o);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(o);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const c=e.getPointId?e.getPointId(o)+"":void 0,u=mt(o,e.scales,e.getX,e.getY,r,t,c);u&&n.push(u)}return n}(r,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){var n,i,r;const s=Math.max(1,Math.floor(null!==(n=e.config.heatmapXBins)&&void 0!==n?n:20)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=Ze(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const v=new Int32Array(y),m=new Float64Array(y);for(let o=0;t.length>o;o++){const n=t[o],i=e.getX(n),r=e.getY(n);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-u)/f),s-1),d=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>d)continue;const g=d*s+l;v[g]++;const y=c(n);m[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===v[e])continue;let t;switch(l){case"sum":t=m[e];break;case"mean":t=m[e]/v[e];break;default:t=v[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=o.width/s,A=o.height/a,S=e.config.showValues,O=e.config.heatmapValueFormat,j=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===v[n])continue;let i;switch(l){case"sum":i=m[n];break;case"mean":i=m[n]/v[n];break;default:i=v[n]}const r=(i-b)/k;j.push(xt(o*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:v[n],sum:m[n]},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return j}(e,t,o);if(0===t.length)return[];const n=Ze(e.config.valueAccessor,"value"),i=Je(e.config.xAccessor,"x"),r=Je(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],n=i(o),u=r(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}const y=new Float64Array(t.length),v=new Float64Array(t.length),m=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=n(o),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,v[f]=d,m[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=v[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in At?e:"blues";let o=St.get(t);if(o)return o;o=Array(256);const n=At[t]||T;for(let e=0;256>e;e++)o[e]=n(e/255);return St.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=o.width/u,j=o.height/d,C=e.config.showValues,M=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=v[e];if(!isFinite(t))continue;const o=y[e],n=o%u;P.push(xt(n*O,(d-1-(o-n)/u)*j,O,j,A[Math.min((t-k)*S+.5|0,255)],m[e],C?{value:t,showValues:!0,valueFormat:M}:void 0))}return P}(r,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Ke(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const o of e.categories.keys())t.add(o);const o=e.config.barColors?Object.keys(e.config.barColors):[],n=new Set(o),s=Array.from(t).filter(e=>!n.has(e)).sort(),a=o.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.x.domain(),u=e.config.barStyle,d=null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.opacity=u.opacity);for(const t of i.values()){const o=Math.max(t.start,l),i=Math.min(t.end,c);if(o>=i)continue;const h=a.x(o),p=a.x(i),y=Math.abs(p-h),v=y>g+1?g:0,m=Math.min(h,p)+v/2,b=Math.max(y-v,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r),h=(null===(n=e.config.barColors)||void 0===n?void 0:n[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(bt(m,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(bt(m,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},f),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=null!==(o=r.barCategoryCache)&&void 0!==o?o:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var o,n,i,r,s,a;const l=[],c=e.config.swarmStyle||{},u=null!==(o=c.radius)&&void 0!==o?o:3,d=null!==(r=null!==(n=c.fill)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,g=c.stroke,f=c.strokeWidth;for(const o of t){const t=e.getX(o),n=e.getY(o);if(null==n||Number.isNaN(n))continue;const i=e.scales.x(t),r=e.scales.y(n);let s=d;if(e.getCategory){const t=e.getCategory(o);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(r,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===g.length)return u;const f=null!==(r=null!==(n=null==h?void 0:h.positiveColor)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(l=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,v=null==h?void 0:h.stroke,m=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const n=g[t],i=e.getX(n),r=e.getY(n),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=d.x(i),c=0!==a?d.x(i+a):l+o.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=d.y(x),S=d.y(s),O=Math.min(A,S),j=Math.abs(A-S),C={fill:0>r?p:f,stroke:v,strokeWidth:m};null!=b&&(C.opacity=b),u.push(bt(k,O,w,j,C,Object.assign(Object.assign({},n),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(r,t,e);case"candlestick":return function(e,t){var o,n;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(o=e.config.candlestickRangeMode)&&void 0!==o&&o;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",u=i?a:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(n=s.bodyWidth)&&void 0!==n?n:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let o=1;h.length>o;o++){const n=Math.abs(e.scales.x(h[o])-e.scales.x(h[o-1]));n>0&&t>n&&(t=n)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const n=e.getHigh(o),s=e.getLow(o);if(null==n||Number.isNaN(n)||null==s||Number.isNaN(s))continue;const a=i?n:e.getOpen(o),h=i?s:e.getClose(o);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(n),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(r,t);default:return[]}}resolveBoundsStyle(e,t){var o;const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||(null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?ct(o,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,o){var n,i;const r=o.length;if(1>=r)return;const s=new Map;for(let e=0;o.length>e;e++)s.set(o[e],e);for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const n=Array(t.length);let i=!1;for(let o=0;t.length>o;o++){const a=s.get(t[o]);null!=a?(n[o]=ct(e,a,r),1>n[o]&&(i=!0)):n[o]=1}i&&(o._decayOpacities=n);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],n=o.topPath?o.topPath.length:t.length;if(2>n)continue;if(t.length===n){const i=Array(n);let a=!1;for(let o=0;t.length>o;o++){const n=s.get(t[o]);null!=n?(i[o]=ct(e,n,r),1>i[o]&&(a=!0)):i[o]=1}a&&(o._decayOpacities=i)}else{let i=1;for(const o of t){const t=s.get(o);if(null!=t){const o=ct(e,t,r);i>o&&(i=o)}}if(1>i){const e=Array(n);e.fill(i),o._decayOpacities=e}}continue}const t=s.get(o.datum);if(null==t)continue;const a=ct(e,t,r);if("heatcell"===o.type)o.style={opacity:a};else if("candlestick"===o.type)o._decayOpacity=a;else{const e=null!==(i=null===(n=o.style)||void 0===n?void 0:n.opacity)&&void 0!==i?i:1;o.style=Object.assign(Object.assign({},o.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,o,n){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;o.length>e;e++)c.set(o[e],e);for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let i=0;for(const o of t){const t=c.get(o);if(null==t)continue;const r=n.get(t);if(null==r)continue;const a=ut(e,r,s);a>i&&(i=a)}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const t=c.get(o.datum);if(null==t)continue;const i=n.get(t);if(null==i)continue;const r=ut(e,i,s);r>0&&(o._pulseIntensity=r,o._pulseColor=a,o._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var o;if(!t||0===t.size)return!1;const n="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(o=e.duration)&&void 0!==o?o:500,r=t.peek();return null!=r&&i>n-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,o,n){var i,r,s,a;o.clear(),n.clear();for(let l=0;t.length>l;l++){const c=t[l],u=pt(e,c,l);u&&("point"===c.type?o.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?o.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?n.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&n.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=c.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,o;this.prevPositionMap.clear(),this.prevPathMap.clear();const n=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=pt(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:n,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,o,n,i){var r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O,j,C,M,P,_,L,T,B,D,$,N,I,H,W,R,F,z,E,Y,G;if(0===n.size&&0===i.size)return o;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;o.scene.length>t;t++){const r=o.scene[t],_=pt(e,r,t);if(!_)continue;if(r._transitionKey=_,"line"===r.type||"area"===r.type){const e=i.get(_);if(e){if(U.add(_),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];X=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];X=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;continue}const L=n.get(_);if("point"===r.type)if(L){V.add(_);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(d=L.r)&&void 0!==d?d:r.r,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("rect"===r.type)if(L){V.add(_);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(g=r.style.opacity)&&void 0!==g?g:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("heatcell"===r.type)if(L){V.add(_);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(m=null===(v=r.style)||void 0===v?void 0:v.opacity)&&void 0!==m?m:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,X=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){V.add(_);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(j=L.highY)&&void 0!==j?j:r.highY,r.lowY=null!==(C=L.lowY)&&void 0!==C?C:r.lowY,X=!0)}else r._targetOpacity=null!==(P=null===(M=r.style)||void 0===M?void 0:M.opacity)&&void 0!==P?P:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(_=t.opacity)&&void 0!==_?_:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}for(const[e,t]of n)if(!V.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(D=t.w)&&void 0!==D?D:0,h:null!==($=t.h)&&void 0!==$?$:0,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(I=t.w)&&void 0!==I?I:0,h:null!==(H=t.h)&&void 0!==H?H:0,fill:"#999",datum:null,style:{opacity:null!==(W=t.opacity)&&void 0!==W?W:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(R=t.openY)&&void 0!==R?R:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(F=t.closeY)&&void 0!==F?F:n,highY:null!==(z=t.highY)&&void 0!==z?z:n,lowY:null!==(E=t.lowY)&&void 0!==E?E:n,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(i)}X=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),X&&(o.activeTransition={startTime:ft(),duration:q}),o}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},o=function(e,t,o,n){var i,r,s,a,l,c;if(!o.activeTransition)return!1;const u=ht(e,o.activeTransition),d=dt(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,r=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style.opacity=gt(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=gt(o.x,e._targetX,d),e.y=gt(o.y,e._targetY,d),void 0!==e._targetR&&void 0!==o.r&&(e.r=gt(o.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(r=o.opacity)&&void 0!==r?r:1:0;e.style.opacity=gt(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=gt(o.x,e._targetX,d),e.y=gt(o.y,e._targetY,d),void 0!==o.w&&(e.w=gt(o.w,e._targetW,d)),void 0!==o.h&&(e.h=gt(o.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(s=o.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:gt(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=gt(o.x,e._targetX,d),e.y=gt(o.y,e._targetY,d),void 0!==o.w&&(e.w=gt(o.w,e._targetW,d)),void 0!==o.h&&(e.h=gt(o.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(a=o.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:gt(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=gt(o.x,e._targetX,d),void 0!==o.openY&&(e.openY=gt(o.openY,e._targetOpenY,d)),void 0!==o.closeY&&(e.closeY=gt(o.closeY,e._targetCloseY,d)),void 0!==o.highY&&(e.highY=gt(o.highY,e._targetHighY,d)),void 0!==o.lowY&&(e.lowY=gt(o.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:gt(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=gt(t[n][0],o[n][0],d),e.path[n][1]=gt(t[n][1],o[n][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:gt(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,i=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=gt(t[o][0],n[o][0],d),e.topPath[o][1]=gt(t[o][1],n[o][1],d);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=gt(o[t][0],i[t][0],d),e.bottomPath[t][1]=gt(o[t][1],i[t][1],d)}}if(u>=1){for(const e of o.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,o}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const o of e){const e=this.getGroup(o);t.has(e)||t.set(e,[]),t.get(e).push(o)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const o of e){const e=this.getColor(o);e&&t.add(e)}const o=Array.from(t).sort(),n=o.join("\0");if(this._colorMapCache&&this._colorMapCache.key===n)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||nt,r=new Map;for(let e=0;o.length>e;e++)r.set(o[e],i[e%i.length]);return this._colorMapCache={key:n,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var o;const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}const i=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var o,n;if(this.config.areaStyle){const o=this.config.areaStyle(t||{});if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const i=this.config.lineStyle;if("function"==typeof i){const o=i(t||{},e);if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const r=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(n=i.fillOpacity)&&void 0!==n?n:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const o=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||nt;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Ot.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,o,n,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const l=a||!Qe(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),c=a||!Qe(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Ze(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Ze(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Ze(this.config.xAccessor,"x"),this.getY=Ze(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!Qe(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?et(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!Qe(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?et(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!Qe(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Ze(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!Qe(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?et(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!Qe(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Ze(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!Qe(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?et(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!Qe(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!Qe(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!Qe(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!Qe(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Ze(this.config.openAccessor,"open"):void 0,this.getHigh=Ze(this.config.highAccessor,"high"),this.getLow=Ze(this.config.lowAccessor,"low"),this.getClose=t?Ze(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const o of t)if(e[o]!==r[o]){s=!0;break}}s&&(this.needsFullRebuild=!0)}}function jt(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function Ct(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Mt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Pt(e,t){const o=Mt(e);if(!o)return!1;const n=Mt(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function _t(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Lt(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);Ct(e.r,n)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}function Tt(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Lt(i,t,o,n,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=Dt(r,t,o,n);break;case"line":e=$t(r,t,o,n);break;case"rect":e=It(r,t,o);break;case"heatcell":e=Ht(r,t,o);break;case"area":if(!1===r.interactive)break;e=Rt(r,t,o);break;case"candlestick":e=Wt(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Bt(e,t,o){if(0===e.length)return null;const n=Ft(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let i=n,r=n;n>0&&e[n][0]>=t?(i=n-1,r=n):e.length-1>n&&(i=n,r=n+1);const[s,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Dt(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Ct(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function $t(e,t,o,n=30){var i,r,s,a;if(0===e.path.length)return null;const l=Ft(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let n=1/0;const i=Math.max(0,l-1),r=Math.min(e.path.length-2,l);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=Nt(t,o,i,r,a,l);n>c&&(n=c)}d=n}else{const e=t-c,n=o-u;d=Math.sqrt(e*e+n*n)}const h=null!==(a=null!==(r=null===(i=e.style)||void 0===i?void 0:i.strokeWidth)&&void 0!==r?r:null===(s=e.style)||void 0===s?void 0:s.lineWidth)&&void 0!==a?a:1;return d>Math.max(5,h/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function Nt(e,t,o,n,i,r){const s=i-o,a=r-n,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-o,2)+Math.pow(t-n,2));let c=((e-o)*s+(t-n)*a)/l;c=Math.max(0,Math.min(1,c));const u=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-u,2))}function It(e,t,o){const n=jt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function Ht(e,t,o){const n=jt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function Wt(e,t,o){const n=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(r*r+s*s)}}return null}function Rt(e,t,o){if(0===e.topPath.length)return null;const n=Ft(e.topPath,t);if(0>n)return null;const[i,r]=e.topPath[n],s=t-i,a=o-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:r,distance:l}}function Ft(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const i=o+n>>1;t>e[i][0]?o=i+1:n=i}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function zt(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}function Et(e,t){var o,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}function Yt(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?Gt(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Gt(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function Gt(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function qt(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Xt(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}function Vt(e,t,o,n,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,u=l-a.lastIngestTime>c;u!==i&&(r(u),o.current=!0,n())},1e3);return()=>clearInterval(s)},[e,i,n])}Ot.GROUP_COLOR_MAP_CAP=1e3,Ot.QUADTREE_THRESHOLD=500;const Ut={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Kt(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,Ut[o])(n(e,t)),i}function Qt(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Zt(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Jt=(o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=o,p=[];let y=0;const v=!(!n&&!i),m="isolate"===d||void 0===d&&null!=s;return f.forEach((o,d)=>{const b=Kt(o,d,h,g),x=Zt(o,r,s),k=s&&s.size>0&&s.has(o.label);p.push(t("g",{transform:`translate(0,${y})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const o=(d+("ArrowDown"===e.key?1:-1)+f.length)%f.length;u(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(Qt,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+d)),y+=22}),p};function eo({config:o,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=o,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+n.useId();if("horizontal"===i){const o=12,n=Math.min(r,200),i=Math.max(0,(r-n)/2),c=[];for(let t=0;64>=t;t++){const o=t/64;c.push(e("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:n,height:o,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:i+n,y:o+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const o=t/64;h.push(e("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function to(o){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical"}=o,[f,p]=n.useState(0),[y,v]=n.useState(0),m=n.useCallback((e,t)=>{p(e),v(t)},[]),b="vertical"===g?(({legendGroups:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:o,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:Jt(t,n,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:o,height:n,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const f=[];o.forEach((o,n)=>{let p=0;o.label&&(p+=16);const y=((o,n,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=o,y=[];let v=0,m=0;const b=!(!n&&!i),x="isolate"===d||void 0===d&&null!=s;p.forEach((o,d)=>{const k=Kt(o,d,g,f),w=Zt(o,r,s),A=s&&s.size>0&&s.has(o.label),S=26+7*o.label.length;h&&h>0&&v>0&&v+S>h&&(m++,v=0),y.push(t("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&d===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?A||!1:void 0,"aria-current":b&&!x&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const o=(d+("ArrowRight"===e.key?1:-1)+p.length)%p.length;u(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&e(Qt,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+d)),v+=S});let k=0,w=0;for(const e of p){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const A=m+1;return{items:y,offset:k,totalRows:A,totalHeight:22*A}})(o,r,s,a,l,c,u,n,d,h,i);p+=y.offset+5,f.push(Object.assign(Object.assign({label:o.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=p+12});let p=g>i?0:Math.max(0,(i-g)/2);const y=[];return f.forEach((t,i)=>{const r=o[i];r.label&&(y.push(e("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),y.push(e("g",{className:"legend-item",transform:`translate(${p},0)`,children:t.items},"legend-group-"+i)),p+=t.offset+5,o[i+1]&&y.push(e("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(t.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}),x=!(!r&&!s);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function oo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function no(e){return"object"==typeof e&&null!==e&&"gradient"in e}function io(t){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),e("g",{transform:`translate(${f}, ${p})`,children:no(o)?e(eo,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):oo(o)?e(to,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):o})}function ro(e){return"string"==typeof e?{type:e}:e}function so({orient:o,config:n,values:i,scale:s,size:a,length:l}){const c=function(e){var t,o,n,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(o=e.fill)&&void 0!==o?o:"#4e79a7",fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(n),u="top"===o||"bottom"===o,d=r(()=>{if(0===i.length)return null;const n=s.domain(),r=a-8;if("boxplot"===c.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],i=t[Math.floor(.5*o)],r=t[Math.floor(.75*o)],s=r-n;return{q1:n,median:i,q3:r,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],r+1.5*s)}}(i);if(!n)return null;const{q1:a,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=n,f=Math.min(.5*r,20),p=(r-f)/2+4;if(u){const n=s(a),i=s(d),r=s(l),u=s(h),y=s(g),v="top"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:u,y1:m+v*(p+f/2),x2:y,y2:m+v*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:m+v*p,x2:u,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:m+v*p,x2:y,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(n,i),y:"top"===o?m-p-f:m+p,width:Math.abs(i-n),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===o?m-p-f:m+p,x2:r,y2:"top"===o?m-p:m+p+f,stroke:c.fill,strokeWidth:2})]})}{const n=s(a),i=s(d),r=s(l),u=s(h),y=s(g),v="left"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:m+v*(p+f/2),y1:u,x2:m+v*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:u,x2:m+v*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:y,x2:m+v*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===o?m-p-f:m+p,y:Math.min(n,i),width:f,height:Math.abs(i-n),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===o?m-p-f:m+p,y1:r,x2:"left"===o?m-p:m+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=V().domain(n).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+o,children:d.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===o?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===o?-4-i:4,y:Math.min(r,r+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}})});if("violin"===c.type){const t=r/2+4,n=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),a=s((e.x0+e.x1)/2);n.push(u?`${a},${"top"===o?-(t-i):t-i}`:`${"left"===o?-(t-i):t-i},${a}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(r/2),l=s((i.x0+i.x1)/2);n.push(u?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+o,children:e("polygon",{points:n.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,n=null!=d[0].x0?s(d[0].x0):0;t.push(`M${n},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===o?-n-4:n+4}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,n=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${n}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===o?-n-4:n+4},${i}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+o,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,a,l,o,u,4]);return d?e("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:d}):null}function ao(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function lo(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function co(o,n,i,r){if(!o)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=o;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>n?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>n?"end":"start";const p=16,y=a?d?[a]:ao(a,u):[],v=s?d?[s]:ao(s,u):[],m="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:f,fontWeight:"bold",children:y.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-title")),b=y.length*p),v.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:v.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-label"));let w=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const t=Math.min(u,120);let o=0,n=t;"end"===f?(o=-t,n=0):"middle"===f&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+v.length)*p+(v.length>0?p:0);let o=0,n=t;"bottom"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+v.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function uo(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(e("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(e("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(e("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e("path",{d:lo((null==o?void 0:o.type)||"curly",t,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function ho(t,o,n,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),u=e/2,d=n/2,h=t*d>o*u?u/t:d/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);l=Math.cos(n)*e,c=Math.sin(n)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(o-c,2))>.5&&(a.push(e("line",{x1:l,y1:c,x2:t,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,t-l);a.push(e("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:a})}function go(e){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=e,v=new Set(Array.isArray(f)?f:[]);let m=i||0,b=r||0;null!=s&&(m=s-o),null!=a&&(b=a-n);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===m&&0===b)if(void 0!==u.width){m=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;m=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!v.has("connector")&&ho(m,b,c,h,x,u),!v.has("subject")&&uo(x,u,h,o,n),!v.has("note")&&co(l,m,b,h)]}))}function fo(t){var o,n;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:t,ny:a});return e(go,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(go,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function po(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function yo(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function vo(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=po(e,o),c=yo(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function mo(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const bo={linear:be,monotoneX:me,monotoneY:ve,step:ye,stepAfter:pe,stepBefore:fe,basis:ge,cardinal:he,catmullRom:de};function xo(o){return function(o,n,i){var r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O,j,C,M,P,_,L,T,B,D,$,N,I,H,W,R,F,z,E,Y,G,q,X,V,U,K,Q,Z;switch(o.type){case"label":{const t=vo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return mo(r,s,i)?e(fo,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"label",connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"callout":{const t=vo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return mo(r,s,i)?e(fo,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"callout-circle",subject:{radius:o.radius||12},connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"x-threshold":{const r=po(o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=yo(o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"enclose":{const r=(o.coordinates||[]).map(e=>({x:po(Object.assign(Object.assign({},e),{type:"point"}),i),y:yo(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=oe(r),a=o.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"rect-enclose":{const r=(o.coordinates||[]).map(e=>({x:po(Object.assign(Object.assign({},e),{type:"point"}),i),y:yo(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=o.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"highlight":{const t=i.data||[],r="function"==typeof o.filter?t.filter(o.filter):o.field&&null!=o.value?t.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,n)=>{const r=po(t,i),a=yo(t,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(t):o.r||6,c="function"==typeof o.style?o.style(t):o.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const t=po(o,i),r=yo(o,i);return e(fo,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:o.dx||0,dy:o.dy||0,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"bracket",subject:{type:o.bracketType||"curly",width:o.width,height:o.height,depth:o.depth||30},color:o.color}},"ann-"+n)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,v=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!y||!v)return null;const m=o.method||"linear";let b;b="loess"===m?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(d=o.bandwidth)&&void 0!==d?d:.3):("polynomial"===m?Se.polynomial(p,{order:o.order||2}):Se.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),k=o.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:k,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:k,fontSize:11,children:o.label})]},"ann-"+n)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(o.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(o.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:o.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:o.fillOpacity||.1}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:o.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:o.label})]},"ann-"+n)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!a||!l)return null;const c=o.upperAccessor||"upperBounds",u=o.lowerAccessor||"lowerBounds",d=o.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=bo[i.curve||"linear"]||be,f=ue().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=o.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(A=o.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),o.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:o.label})]},"ann-"+n)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(O=null===(S=i.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(j=i.scales)||void 0===j?void 0:j.time,l=null!==(M=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==M?M:null===(P=i.scales)||void 0===P?void 0:P.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(_=o.threshold)&&void 0!==_?_:2,f=u-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",v=null!==(L=o.fillOpacity)&&void 0!==L?L:.1,m=o.anomalyColor||"#ef4444",b=null!==(T=o.anomalyRadius)&&void 0!==T?T:6,x=l(u+g*h),k=l(f),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:v}),w.map((t,o)=>{const n=po(t,i),r=yo(t,i);return null==n||null==r?null:e("circle",{cx:n,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:o.label})]},"ann-"+n)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(D=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==D?D:null===($=i.scales)||void 0===$?void 0:$.time,c=null!==(I=null===(N=i.scales)||void 0===N?void 0:N.y)&&void 0!==I?I:null===(H=i.scales)||void 0===H?void 0:H.value;if(!l||!c)return null;const u=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(o.method||"linear")){const e=Se.polynomial(u,{order:o.order||2}).equation;d=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=u.length;let t=0,o=0,n=0,i=0;for(const[e,r]of u)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;d=e=>a+s*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),v=null!==(W=o.confidence)&&void 0!==W?W:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(R=o.steps)&&void 0!==R?R:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=d(e),o=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const S=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(d(x))}`,C=o.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:o.fill||"#6366f1",fillOpacity:null!==(F=o.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),e("polyline",{points:`${j} ${O}`,fill:"none",stroke:C,strokeWidth:null!==(z=o.strokeWidth)&&void 0!==z?z:2,strokeDasharray:null!==(E=o.strokeDasharray)&&void 0!==E?E:"6,3"}),o.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:C,fontSize:11,children:o.label})]},"ann-"+n)}case"widget":{let t=null,r=null;if(null!=o.px&&null!=o.py)t=o.px,r=o.py;else{const e=vo(o,n,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!mo(t,r,i))return null;const s=null!==(Y=o.dx)&&void 0!==Y?Y:0,a=null!==(G=o.dy)&&void 0!==G?G:0,l=null!==(q=o.width)&&void 0!==q?q:32,c=null!==(X=o.height)&&void 0!==X?X:32,u=null!==(V=o.content)&&void 0!==V?V:e("span",{style:{fontSize:18,cursor:"default"},title:o.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=vo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(o.dx||0),y:s+(o.dy||0),fill:o.color||"var(--semiotic-text, #333)",fontSize:o.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:o.label},"ann-text-"+n)}case"category-highlight":{const r=o.category;if(null==r)return null;const s=null===(U=i.scales)||void 0===U?void 0:U.o,a=null===(K=i.scales)||void 0===K?void 0:K.x,l=null===(Q=i.scales)||void 0===Q?void 0:Q.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=o.color||"var(--semiotic-primary, #4589ff)",g=null!==(Z=o.opacity)&&void 0!==Z?Z:.15,f=o.label;return t("g",(i.projection?"vertical"===i.projection:c===a)?{children:[e("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:g}),f&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),f&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}}}let ko={positions:new Map};const wo=new Set;function Ao(){for(const e of wo)e()}function So(e,t){const o=ko.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(ko.positions);n.delete(e),ko={positions:n},Ao()}function Oo(e,t){const o=ko.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(ko.positions);n.delete(e),ko={positions:n},Ao()}function jo(){return ko}function Co(e){return wo.add(e),()=>wo.delete(e)}const Mo={positions:new Map};function Po(){return()=>{}}function _o(){return Mo}function Lo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function To(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+n;for(let e=0;r>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*i}`,s+=`L${Math.min(o,t)},${n}`}return s}{const n="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${n+4*i},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}}function Bo(o){const{width:n,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:f}=o,p=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||g||Do,i=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=c.x.ticks(Math.min(i,Math.max(2,Math.floor(n/70)))),s=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:c.x(e),label:o(e,t,s)})),l=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return $o(a,Math.max(55,l+8))},[c,d,g,n]),y=r(()=>{var e;if(!c)return[];const t=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==t?void 0:t.tickFormat)||f||Do,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return $o(c.y.ticks(Math.min(n,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,f,i]),v=h&&c,m=u&&c;if(!v&&!m)return null;const b=null==d?void 0:d.find(e=>"bottom"===e.orient),x=null==d?void 0:d.find(e=>"left"===e.orient),k=m&&(!b||!1!==b.baseline),w=m&&(!x||!1!==x.baseline),A=(null==b?void 0:b.jaggedBase)||!1,S=(null==x?void 0:x.jaggedBase)||!1,O="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[v&&(()=>{var o,r;const s=Lo(null===(o=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),a=Lo(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[p.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+o)),y.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+o))]})})(),k&&!A&&e("line",{x1:0,y1:i,x2:n,y2:i,stroke:O,strokeWidth:1}),A&&e("path",{d:To("bottom",n,i),fill:"none",stroke:O,strokeWidth:1}),w&&!S&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:O,strokeWidth:1}),S&&e("path",{d:To("left",n,i),fill:"none",stroke:O,strokeWidth:1})]})})}function Do(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function $o(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function No(n){var a,l;const{width:c,height:d,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:v,xLabel:m,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,showGrid:A,title:S,legend:O,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:P,legendPosition:_="right",foregroundGraphics:L,marginalGraphics:T,xValues:B,yValues:D,annotations:$,svgAnnotationRules:N,xAccessor:I,yAccessor:H,annotationData:W,pointNodes:R,curve:F,underlayRendered:z,linkedCrosshairName:E,linkedCrosshairSourceId:Y,children:G}=n,q=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||k||Do,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=p.x.ticks(Math.min(n,Math.max(2,Math.floor(c/70)))),r=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:p.x(e),label:o(e,t,r)})),a=s.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),l=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=$o(s,l);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=p.x.domain()[1],t=p.x(e),n=u[u.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,u.length,r);l>t-n&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[y,p,v,k,c]),X=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"left"===e.orient),o=(null==t?void 0:t.tickFormat)||w||Do,n=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=$o(p.y.ticks(Math.min(n,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),(null==t?void 0:t.includeMax)&&i.length>0){const e=p.y.domain()[1],t=p.y(e),n=i[i.length-1].pixel;if(Math.abs(t-n)>1){const r=o(e);22>Math.abs(t-n)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[y,p,v,w,d]),V=r(()=>{var e;if(!y||!p)return[];const t=null==v?void 0:v.find(e=>"right"===e.orient);if(!t)return[];const o=t.tickFormat||w||Do,n=null!==(e=t.ticks)&&void 0!==e?e:5;return $o(p.y.ticks(Math.min(n,Math.max(2,Math.floor(d/30)))).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,v,w,d]),U=i(new Map),K=i(null!==(a=null==$?void 0:$.length)&&void 0!==a?a:0),Q=null!==(l=null==$?void 0:$.length)&&void 0!==l?l:0;K.current!==Q&&(K.current=Q,U.current=new Map);const Z=r(()=>{if(!$||0===$.length)return null;const e=xo(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:I,yAccessor:H,width:c,height:d,data:W,frameType:"xy",pointNodes:R,curve:F,stickyPositionCache:U.current};return $.map((o,n)=>{if(N){const i=N(o,n,t);return null!=i?i:e(o,n,t)}return e(o,n,t)}).filter(Boolean)},[$,N,c,d,I,H,W,p,R,F]),J=function(e){var t;const o=u(e?Co:Po,e?jo:_o,e?jo:_o);return e&&null!==(t=o.positions.get(e))&&void 0!==t?t:null}(E);return s(()=>{if(!(null==J?void 0:J.locked)||!E)return;const e=e=>{"Escape"===e.key&&Oo(E)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==J?void 0:J.locked,E]),y||S||O||L||T||Z&&Z.length>0||A||G||J?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof S?S:"XY Chart"}),e("desc",{children:"string"==typeof S?S+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[A&&p&&!z&&(()=>{var o,n;const i=Lo(null===(o=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),r=Lo(null===(n=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return t("g",{className:"stream-grid",children:[q.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+o)),X.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:c,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),y&&p&&(()=>{const n=null==v?void 0:v.find(e=>"left"===e.orient),i=null==v?void 0:v.find(e=>"bottom"===e.orient),r=!n||!1!==n.baseline,s=!i||!1!==i.baseline,a=(null==n?void 0:n.jaggedBase)||!1,l=(null==i?void 0:i.jaggedBase)||!1,u=null==i?void 0:i.landmarkTicks,h=null==n?void 0:n.landmarkTicks,g="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&q.length>1&&(()=>{const e=c/Math.max(q.length-1,1),t=q.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[!z&&s&&!l&&e("line",{x1:0,y1:d,x2:c,y2:d,stroke:g,strokeWidth:1}),!z&&l&&e("path",{d:To("bottom",c,d),fill:"none",stroke:g,strokeWidth:1}),q.map((o,n)=>{const i=!!u&&("function"==typeof u?u(o.value,n):Pt(o.value,n>0?q[n-1].value:void 0));return t("g",{transform:`translate(${o.pixel},${d})`,children:[e("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:o.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:o.label})})]},"xtick-"+n)}),m&&e("text",{x:c/2,y:d+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:m}),!z&&r&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:g,strokeWidth:1}),!z&&a&&e("path",{d:To("left",c,d),fill:"none",stroke:g,strokeWidth:1}),X.map((o,n)=>{const i=!!h&&("function"==typeof h?h(o.value,n):Pt(o.value,n>0?X[n-1].value:void 0));return t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:o.label})})]},"ytick-"+n)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-f.left}, ${d/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n||0===V.length)return null;const i=n.landmarkTicks,r=n.label||x;return t(o,{children:[!1!==n.baseline&&e("line",{x1:c,y1:0,x2:c,y2:d,stroke:g,strokeWidth:1}),V.map((o,n)=>{const r=!!i&&("function"==typeof i?i(o.value,n):Pt(o.value,n>0?V[n-1].value:void 0));return t("g",{transform:`translate(${c},${o.pixel})`,children:[e("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:p,style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:o.label})})]},"ytick-r-"+n)}),r&&e("text",{x:c+f.right-15,y:d/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${c+f.right-15}, ${d/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),Z,T&&p&&B&&D&&t(o,{children:[T.top&&e("g",{transform:"translate(0, 0)",children:e(so,{orient:"top",config:ro(T.top),values:B,scale:p.x,size:f.top,length:c})}),T.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(so,{orient:"bottom",config:ro(T.bottom),values:B,scale:p.x,size:f.bottom,length:c})}),T.left&&e("g",{transform:"translate(0, 0)",children:e(so,{orient:"left",config:ro(T.left),values:D,scale:p.y,size:f.left,length:d})}),T.right&&e("g",{transform:`translate(${c}, 0)`,children:e(so,{orient:"right",config:ro(T.right),values:D,scale:p.y,size:f.right,length:d})})]}),L,J&&J.sourceId!==Y&&(null==p?void 0:p.x)&&(()=>{const t=p.x(J.xValue);if(null==t||0>t||t>c)return null;const o=J.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),S&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof S?S:null}),io({legend:O,totalWidth:h,totalHeight:g,margin:f,legendPosition:_,title:S,legendHoverBehavior:j,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:P})]}):null}function Io(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ho="undefined"==typeof window||"undefined"==typeof document,Wo=n.createContext(null);function Ro({children:t}){const[o,i]=n.useState(!1),r=n.useMemo(()=>({visible:o,setVisible:i}),[o]);return e(Wo.Provider,{value:r,children:t})}function Fo(){return n.useContext(Wo)}const zo={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Eo(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}function Yo(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}const Go=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},qo={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Xo={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Vo={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Uo={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ko={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Qo={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Zo={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Jo({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),u=Fo(),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=n.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=n.useCallback(()=>{l||d||c(!0)},[l,d]),y=n.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!o||0===o.length)return r?e("span",{id:r,tabIndex:-1,style:zo}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:p,style:zo,role:"region","aria-label":f,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",o.length," elements)"]})});const v=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x,k,w,A,S,O;const j=[];if(!Array.isArray(e))return j;for(const C of e)if(C&&"object"==typeof C)try{switch(C.type){case"point":j.push({label:"Point",values:{x:C.x,y:C.y}});break;case"line":{const e=C.path,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=C.topPath,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=C.datum&&"object"==typeof C.datum?C.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:C.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;j.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:C.x,y:C.y,value:C.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=C.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=C.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=C.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(d=C.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=C.cx)&&void 0!==g?g:C.x,y:null!==(f=C.cy)&&void 0!==f?f:C.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(p=C.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(v=C.cx)&&void 0!==v?v:C.x,y:null!==(m=C.cy)&&void 0!==m?m:C.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:C.x,open:C.open,high:C.high,low:C.low,close:C.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=C.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=C.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=C.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return j}(o),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(v),b=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Go(e.min)} to ${Go(e.max)}, mean ${Go(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(v.length,m),x=v.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:g,id:r,tabIndex:-1,onBlur:y,style:qo,role:"region","aria-label":f,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Vo,children:"×"}),e("div",{role:"note",style:Xo,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Uo,children:[t("caption",{style:Zo,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Ko,children:"type"}),w.map(t=>e("th",{style:Ko,children:t},t))]})}),e("tbody",{children:x.map((o,n)=>t("tr",{children:[e("td",{style:Qo,children:o.label}),w.map(t=>{return e("td",{style:Qo,children:(n=o.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Go(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},n))})]})]})}function en({nodes:o,edges:i,chartType:r,tableId:s,chartTitle:a}){var l,c,u,d,h,g,f,p,y,v,m,b,x,k;const[w,A]=n.useState(!1),S=Fo(),O=null!==(l=null==S?void 0:S.visible)&&void 0!==l&&l,j=w||O,C=a?"Data summary for "+a:s?`Data summary for ${r} ${s}`:"Data summary for "+r,M=n.useRef(null),P=n.useCallback(()=>{w||O||A(!0)},[w,O]),_=n.useCallback(e=>{var t;O||(null===(t=M.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[O]);if(!o||0===o.length)return s?e("span",{id:s,tabIndex:-1,style:zo}):null;if(!j)return e("div",{id:s,tabIndex:-1,onFocus:P,style:zo,role:"region","aria-label":C,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",o.length," nodes, ",i.length," edges)"]})});const L=Array.isArray(o)?o:[],T=Array.isArray(i)?i:[],B=new Map,D=new Map,$=new Map,N=new Map;for(const e of T){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,o="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,n="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";D.set(e,(null!==(h=D.get(e))&&void 0!==h?h:0)+1),N.set(e,(null!==(g=N.get(e))&&void 0!==g?g:0)+i)}if(null!=n&&""!==n){const e=n+"";B.set(e,(null!==(f=B.get(e))&&void 0!==f?f:0)+1),$.set(e,(null!==(p=$.get(e))&&void 0!==p?p:0)+i)}}const I=[];for(let e=0;L.length>e;e++){const t=L[e];if(!t||"object"!=typeof t)continue;const o=null!==(v=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==v?v:t.id,n=null!=o?o+"":"node-"+e,i=null!==(m=B.get(n))&&void 0!==m?m:0,r=null!==(b=D.get(n))&&void 0!==b?b:0,s=null!==(x=$.get(n))&&void 0!==x?x:0,a=null!==(k=N.get(n))&&void 0!==k?k:0;I.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}I.sort((e,t)=>t.degree-e.degree);let H=0,W=0;if(I.length>0){let e=0;for(const t of I)e+=t.degree,t.degree>W&&(W=t.degree);H=e/I.length}const R=T.some(e=>{var t;const o=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==o?void 0:o.value)&&Number.isFinite(o.value)}),F=[`${I.length} nodes, ${T.length} edges.`];I.length>0&&F.push(`Mean degree: ${Go(H)}, max degree: ${W}.`);const z=I.slice(0,5);return t("div",{ref:M,id:s,tabIndex:-1,onBlur:_,style:qo,role:"region","aria-label":C,children:[e("button",{type:"button",onClick:()=>{O&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Vo,children:"×"}),e("div",{role:"note",style:Xo,children:F.join(" ")}),t("table",{role:"table","aria-label":"Node degree summary for "+r,style:Uo,children:[t("caption",{style:Zo,children:["Top ",z.length," of ",I.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:Ko,children:"id"}),e("th",{style:Ko,children:"degree"}),e("th",{style:Ko,children:"in"}),e("th",{style:Ko,children:"out"}),R&&e("th",{style:Ko,children:"w. degree"}),R&&e("th",{style:Ko,children:"w. in"}),R&&e("th",{style:Ko,children:"w. out"})]})}),e("tbody",{children:z.map((o,n)=>t("tr",{children:[e("td",{style:Qo,children:o.id}),e("td",{style:Qo,children:o.degree}),e("td",{style:Qo,children:o.inDeg}),e("td",{style:Qo,children:o.outDeg}),R&&e("td",{style:Qo,children:Go(o.wDegree)}),R&&e("td",{style:Qo,children:Go(o.wInDeg)}),R&&e("td",{style:Qo,children:Go(o.wOutDeg)})]},n))})]})]})}function tn({summary:t}){return t?e("div",{role:"note",style:zo,children:t}):null}function on({tableId:t}){return e("a",{href:"#"+t,style:zo,onClick:e=>{e.preventDefault();const o=document.getElementById(t);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,zo)},children:"Skip to data table"})}function nn({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:zo,children:o})}const rn="var(--semiotic-focus, #005fcc)";function sn({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:rn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:rn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:rn,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function an({x:t,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=n.useRef(null),[d,h]=n.useState(null);n.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=d?`translate(${d.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:l,style:{position:"absolute",left:s.left+t,top:s.top+o,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function ln(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function cn(e,t,o){const n=i(null),[r,a]=d(null);return s(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;a(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return i.observe(e),()=>i.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}const un=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,dn=new WeakMap;let hn=0,gn=!1,fn=null,pn=null,yn=null;function vn(e,t){var o,n;if(!t)return t;const i=un.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(gn)return;if("undefined"==typeof window||"undefined"==typeof document)return;gn=!0;const e=()=>{hn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(fn=new MutationObserver(e),fn.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{pn=window.matchMedia("(prefers-color-scheme: dark)"),yn=e,"function"==typeof pn.addEventListener?pn.addEventListener("change",yn):"function"==typeof pn.addListener&&pn.addListener(yn)}catch(e){}}();let s=dn.get(r);s&&s.version===hn||(s={version:hn,map:new Map},dn.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}function mn(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function bn(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),ln(e,e=>t(e.matches))},[]),e}(),o=i(t);o.current=t;const[a,l]=cn(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-u.left-u.right,g=l[1]-u.top-u.bottom,f=mn(e.foregroundGraphics,l,u),p=mn(e.backgroundGraphics,l,u),y=Xe(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=i(0),k=i(()=>{}),w=c(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),j=i(0),C=c(()=>{j.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),M=c(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(C))},[C]),P=c(()=>{O.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),S.current()},[]);s(()=>()=>{O.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const _=e.themeDirtyRef;return s(()=>{_&&(hn++,_.current=!0,w())},[y,w,_]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:a,size:l,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:M,onPointerLeave:P}}function xn(e,t,o,n){const i=e.getContext("2d");if(!i)return null;const r=t[0]*n,s=t[1]*n,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(n,0,0,n,0,0),i.translate(o.left,o.top),i}function kn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function wn(e){switch(e){case"monotoneX":return me;case"monotoneY":return ve;case"cardinal":return he;case"catmullRom":return de;case"step":return ye;case"stepBefore":return fe;case"stepAfter":return pe;case"basis":return ge;case"natural":return we;default:return null}}function An(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function Sn(e,t,o,n,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=r;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let r=i;l>n&&(r*=n/l),l>a-n&&(r*=(a-n)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}const On=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,n.width*l,n.height),e.clip());const c=a.style.stroke||"#007bff",u=vn(e,c)||c,d=a.style.strokeWidth||2,h=a.colorThresholds,g=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=d,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;Sn(e,a.path,u,d,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=wn(a.curve),p=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!p){e.strokeStyle=u;const m=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let b=0;a.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*m,e.beginPath(),e.moveTo(a.path[b][0],a.path[b][1]),e.lineTo(a.path[b+1][0],a.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function j(){S&&(e.stroke(),S=!1)}for(let C=0;a.path.length>C;C++){const[M,P]=a.path[C],_=g[C],L=An(_,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(M,P);else{const T=[];for(const B of h){const D=B.value;(w>D||D>_)&&(D>w||_>D)||w===D||_===D||T.push({t:(D-w)/(_-w)})}T.sort((e,t)=>e.t-t.t);for(const $ of T){const N=x+(M-x)*$.t,I=k+(P-k)*$.t,H=An(w+(_-w)*Math.min($.t+1e-4,1),h,u);e.lineTo(N,I),j(),O(H,N,I)}e.lineTo(M,P)}x=M,k=P,w=_,A=L}else O(L,M,P),x=M,k=P,w=_,A=L}j()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=u;else{const W=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const R of a.strokeGradient.colorStops)W.addColorStop(Math.max(0,Math.min(1,R.offset)),R.color);e.strokeStyle=W}if(f)ke().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[F,z]=a.path[0];e.moveTo(F,z);for(let E=1;a.path.length>E;E++)e.lineTo(a.path[E][0],a.path[E][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=("string"==typeof a.style.fill?vn(e,a.style.fill):a.style.fill)||a.style.fill,f&&!p)ke().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[G,q]=a.path[0];e.moveTo(G,q);for(let X=1;a.path.length>X;X++)e.lineTo(a.path[X][0],a.path[X][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function jn(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function Cn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Mn(e,t,o=.3){Cn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Pn(e,t,o=.6){var n,i,r,s,a;if(!Cn(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function _n(e,t,o,n=.35){Cn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ln(e){switch(e){case"monotoneX":return me;case"monotoneY":return ve;case"cardinal":return he;case"catmullRom":return de;case"step":return ye;case"stepBefore":return fe;case"stepAfter":return pe;case"basis":return ge;case"natural":return we;default:return null}}function Tn(e,t){const o=Ln(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=ue().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}const Bn=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const o=t._introClipFraction;void 0!==o&&1>o&&(e.save(),e.beginPath(),e.rect(0,0,n.width*o,n.height),e.clip());const a=t.style.fill||"#4e79a7",l=t._decayOpacities;if(l&&l.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=a;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(l[n]+l[n+1])*o,e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(l[o]+l[o+1]),e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.stroke()}e.globalAlpha=1;continue}const c=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Tn(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const i=e.createLinearGradient(0,o,0,n);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||i.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const[o,n,r]=jn(e,"string"==typeof a?a:"#4e79a7");i.addColorStop(0,`rgba(${o},${n},${r},${t.fillGradient.topOpacity})`),i.addColorStop(1,`rgba(${o},${n},${r},${t.fillGradient.bottomOpacity})`)}e.fillStyle=i,e.globalAlpha=c}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*c,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Tn(e,t),_n(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=c,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke;else{const o=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)o.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=o}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Ln(t.curve);if(e.beginPath(),o)ke().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==o&&1>o&&e.restore(),e.globalAlpha=1}},Dn=(e,t,o,n)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=("string"==typeof t.style.fill?vn(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?vn(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Pn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function $n(e,t,o){const n=t.fillGradient;if(!n)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in n){const t=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const o=e.createLinearGradient(r,s,a,l);for(const e of t)o.addColorStop(e.offset,e.color);return o}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=jn(e,o);return c.addColorStop(0,`rgba(${u},${d},${h},${n.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${n.bottomOpacity})`),c}const Nn=(e,t,o,n)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)In(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=("string"==typeof t.style.fill?vn(e,t.style.fill):t.style.fill)||vn(e,"var(--semiotic-primary, #007bff)"),n="string"==typeof o?$n(e,t,o):null;e.fillStyle=n||o;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=("string"==typeof t.style.fill?vn(e,t.style.fill):t.style.fill)||vn(e,"var(--semiotic-primary, #007bff)"),n="string"==typeof o?$n(e,t,o):null;e.fillStyle=n||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Mn(e,t),e.globalAlpha=1}};function In(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}function Hn(e,t,o,n){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:o,time:t,value:o}),n)}function Wn(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>128?"#000":"#fff"}function Rn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Fn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zn(e){const t=e[1]-e[0],o=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:o>t?e=>{const t=new Date(e);return`${Fn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${Fn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const En={line:[Bn,On,Dn],area:[Bn,Dn],stackedarea:[Bn,Dn],scatter:[Dn],bubble:[Dn],heatmap:[(e,t,o,n)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const o=t.style;if(null!=(null==o?void 0:o.opacity)&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=vn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Mn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):Rn(t.value),n=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=Wn(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}}],bar:[Nn],swarm:[Dn],waterfall:[(e,t,o,n)=>{var i,r,s;Nn(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=vn(e,c)||c,e.lineWidth=null!==(i=null==l?void 0:l._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const n=a[t],i=a[t+1];if(!(null===(r=n.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=i.datum)||void 0===s?void 0:s.baseline))continue;const l=o.y(n.datum.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,o,n)=>{var i,r,s;for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const a=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==a&&(e.globalAlpha=a);const l=vn(e,t.wickColor)||t.wickColor,c=60>n.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=vn(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}c&&d(),e.restore()}}],mixed:[Bn,On,Dn]},Yn={top:20,right:20,bottom:30,left:40},Gn={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function qn(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],i=o[3];return`#${e}${e}${n}${n}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}const Xn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Vn({hover:o}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return t("div",{className:"semiotic-tooltip",style:Xn,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:n(o.value)}),e("div",{style:{opacity:.7,fontSize:11},children:n(o.time)})]})}const Un=h(function(o,a){var l,u,h,f,p,y,v,m,b,x,k;const{chartType:w,runtimeMode:A,data:S,chunkThreshold:O,chunkSize:j,xAccessor:C,yAccessor:M,colorAccessor:P,sizeAccessor:_,groupAccessor:L,lineDataAccessor:T,curve:B,normalize:D,binSize:$,valueAccessor:N,arrowOfTime:I="right",windowMode:H="sliding",windowSize:W=200,timeAccessor:R,xExtent:F,yExtent:z,extentPadding:E=.1,scalePadding:Y,sizeRange:G,size:q=[500,300],responsiveWidth:X,responsiveHeight:V,margin:U,className:K,background:Q,lineStyle:Z,pointStyle:J,areaStyle:ee,barStyle:te,waterfallStyle:oe,swarmStyle:ne,barColors:ie,colorScheme:re,boundsAccessor:se,boundsStyle:ae,y0Accessor:le,gradientFill:ce,lineGradient:ue,areaGroups:de,openAccessor:he,highAccessor:ge,lowAccessor:fe,closeAccessor:pe,candlestickStyle:ye,showAxes:ve=!0,axes:me,xLabel:be,yLabel:xe,yLabelRight:ke,xFormat:we,yFormat:Ae,tickFormatTime:Se,tickFormatValue:Oe,hoverAnnotation:je,tooltipContent:Ce,customHoverBehavior:Me,customClickBehavior:Pe,enableHover:_e,hoverRadius:Le=30,tooltipMode:Te,annotations:Be,svgAnnotationRules:De,showGrid:$e,legend:He,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:Ee,legendPosition:Ye,backgroundGraphics:Ge,foregroundGraphics:qe,canvasPreRenderers:Xe,svgPreRenderers:Ve,title:Ue,categoryAccessor:Ke,brush:Qe,onBrush:Ze,decay:Je,pulse:et,transition:tt,animate:ot,staleness:nt,heatmapAggregation:it,heatmapXBins:rt,heatmapYBins:st,showValues:at,heatmapValueFormat:lt,marginalGraphics:ct,pointIdAccessor:ut,xScaleType:dt,yScaleType:ht,accessibleTable:gt=!0,description:ft,summary:pt,linkedCrosshairName:yt,linkedCrosshairSourceId:vt}=o,mt=i(!1),bt=bn({sizeProp:q,responsiveWidth:X,responsiveHeight:V,userMargin:U,marginDefault:Yn,animate:ot,transitionProp:tt,themeDirtyRef:mt}),{reducedMotionRef:xt,responsiveRef:kt,size:wt,currentTheme:At,transition:St,introEnabled:jt,tableId:Ct,rafRef:Mt,renderFnRef:Pt,scheduleRender:_t}=bt;let Lt=bt.margin;if(ct){const e=60,t=Object.assign({},bt.margin);ct.top&&e>t.top&&(t.top=e),ct.bottom&&e>t.bottom&&(t.bottom=e),ct.left&&e>t.left&&(t.left=e),ct.right&&e>t.right&&(t.right=e),Lt=t}const Dt="function"==typeof qe?qe({size:wt,margin:Lt}):qe,$t="function"==typeof Ge?Ge({size:wt,margin:Lt}):Ge,Nt=wt[0]-Lt.left-Lt.right,It=wt[1]-Lt.top-Lt.bottom,Ht=null!=je?je:_e,Wt=i(null),Rt=i(null),[Gt,qt]=d(0),[Ut,Kt]=d(null),Qt=i(null),Zt=i(null),[Jt,eo]=d(null),to=i(Gn.primary),[oo,no]=d(!1),[io,ro]=d([]),[so,ao]=d([]),lo="streaming"===A||["bar","swarm","waterfall"].includes(w),co=r(()=>{var e,t,o;return{chartType:w,runtimeMode:lo?"streaming":"bounded",windowSize:W,windowMode:H,arrowOfTime:lo?I:"right",extentPadding:E,scalePadding:Y,xAccessor:lo?void 0:C,yAccessor:lo?void 0:M,timeAccessor:lo?R:void 0,valueAccessor:N,colorAccessor:P,sizeAccessor:_,groupAccessor:L||(T?"_lineGroup":void 0),categoryAccessor:Ke,lineDataAccessor:T,xScaleType:dt,yScaleType:ht,xExtent:F,yExtent:z,sizeRange:G,binSize:$,normalize:D,boundsAccessor:se,boundsStyle:ae,y0Accessor:le,gradientFill:!0===ce?{topOpacity:.8,bottomOpacity:.05}:!1===ce?void 0:ce,areaGroups:de?new Set(de):void 0,lineGradient:ue,openAccessor:he,highAccessor:ge,lowAccessor:fe,closeAccessor:pe,candlestickStyle:ye,lineStyle:Z,pointStyle:J,areaStyle:ee,swarmStyle:ne,waterfallStyle:oe,colorScheme:re,barColors:ie,barStyle:te,annotations:Be,decay:Je,pulse:et,transition:St,introAnimation:jt,staleness:nt,heatmapAggregation:it,heatmapXBins:rt,heatmapYBins:st,showValues:at,heatmapValueFormat:lt,pointIdAccessor:ut,curve:B,themeCategorical:null===(e=null==At?void 0:At.colors)||void 0===e?void 0:e.categorical,themeSemantic:Re(At),themeSequential:null===(t=null==At?void 0:At.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==At?void 0:At.colors)||void 0===o?void 0:o.diverging}},[w,W,H,I,E,Y,C,M,R,N,dt,ht,P,_,L,Ke,T,F,z,G,$,D,se,ae,le,ce,ue,de,he,ge,fe,pe,ye,Z,J,ee,ne,oe,te,re,ie,Be,Je,et,null==St?void 0:St.duration,null==St?void 0:St.easing,jt,nt,it,rt,st,at,lt,lo,ut,B,At]),uo=i(null);uo.current||(uo.current=new Ot(co)),s(()=>{var e;null===(e=uo.current)||void 0===e||e.updateConfig(co),mt.current=!0,_t()},[co,_t]);const ho=i(null);ho.current||(ho.current=new Ie(e=>{const t=uo.current;t&&t.ingest(e)&&(mt.current=!0,_t())},{chunkThreshold:O,chunkSize:j})),s(()=>{var e;null===(e=ho.current)||void 0===e||e.updateChunkOptions({chunkThreshold:O,chunkSize:j})},[O,j]);const go=c(e=>{var t;null===(t=ho.current)||void 0===t||t.push(e)},[]),fo=c(e=>{var t;null===(t=ho.current)||void 0===t||t.pushMany(e)},[]),po=c(()=>{var e,t;null===(e=ho.current)||void 0===e||e.clear(),null===(t=uo.current)||void 0===t||t.clear(),mt.current=!0,_t()},[_t]);g(a,()=>({push:go,pushMany:fo,remove:e=>{var t,o,n;null===(t=ho.current)||void 0===t||t.flush();const i=null!==(n=null===(o=uo.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];return i.length>0&&(Qt.current&&i.some(e=>{var t;return e===(null===(t=Qt.current)||void 0===t?void 0:t.data)})&&(Qt.current=null,eo(null)),mt.current=!0,_t()),i},update:(e,t)=>{var o,n,i;null===(o=ho.current)||void 0===o||o.flush();const r=null!==(i=null===(n=uo.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(mt.current=!0,_t()),r},clear:po,getData:()=>{var e,t,o;return null===(e=ho.current)||void 0===e||e.flush(),null!==(o=null===(t=uo.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=uo.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=uo.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[go,fo,po,_t]),s(()=>{var e,t;if(S){if(T&&S.length>0&&"object"==typeof S[0]&&null!==S[0]){const t="string"==typeof T?T:"coordinates";if(Array.isArray(S[0][t])){const o=[];for(const e of S){const n=e[t];if(Array.isArray(n)){const t=e.label||e.id||e.key;if(null!=t)for(const e of n)o.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of n)o.push(e)}}return void(null===(e=ho.current)||void 0===e||e.setBoundedData(o))}}null===(t=ho.current)||void 0===t||t.setBoundedData(S)}},[S,T]);const{hoverHandlerRef:yo,hoverLeaveRef:vo,onPointerMove:mo,onPointerLeave:bo}=bt;yo.current=e=>{if(!Ht)return;const t=Wt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Lt.left,i=e.clientY-o.top-Lt.top;if(0>n||n>Nt||0>i||i>It)return void(Qt.current&&(Qt.current=null,Zt.current=null,eo(null),Me&&(Me(null),mt.current=!0),_t()));const r=uo.current;if(!r||0===r.scene.length)return;const s=Tt(r.scene,n,i,Le,r.quadtree,r.maxPointRadius);if(!s)return void(Qt.current&&(Qt.current=null,Zt.current=null,eo(null),Me&&Me(null),_t()));const a=Hn(s.datum||{},s.x,s.y);if("multi"===Te&&r.scene.length>0&&r.scales){const e=function(e,t,o=30){const n=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=Bt(e.path,t,o);if(null===r)continue;const s=Ft(e.path,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=Bt(e.topPath,t,o);if(null===r)continue;const s=Ft(e.topPath,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.topPath[s][0],y:r,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return n}(r.scene,s.x,Le),t=r.scales.y.invert,o=r.scales.x.invert;if(e.length>0){const n=o?o(s.x):s.x;a.xValue=n,a.xPx=s.x;const i=to.current;a.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||i,datum:e.datum}))}}Qt.current=a,Zt.current=s.node,eo(a),Me&&(Me(a),mt.current=!0),_t()},vo.current=()=>{Qt.current&&(Qt.current=null,Zt.current=null,eo(null),Me&&(Me(null),mt.current=!0),_t())};const xo=i(()=>{});xo.current=e=>{if(!Pe)return;const t=Wt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Lt.left,i=e.clientY-o.top-Lt.top;if(0>n||n>Nt||0>i||i>It)return void Pe(null);const r=uo.current;if(!r||0===r.scene.length)return void Pe(null);const s=Tt(r.scene,n,i,Le,r.quadtree,r.maxPointRadius);Pe(s?Hn(s.datum||{},s.x,s.y):null)};const ko=c(e=>xo.current(e),[]),wo=i(-1),Ao=i(null),So=i(null),Oo=c(e=>{const t=uo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(So.current&&So.current.version===o)n=So.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,o=Array.isArray(e.datum)?e.datum:[],n=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&o.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:o[t],shape:"circle",group:n});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:"_default"});break;case"heatcell":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=zt(e),So.current={version:o,graph:n}}const i=wo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),wo.current=0;const t=n.flat[0];Ao.current={shape:t.shape,w:t.w,h:t.h};const o=Xt(t);return Qt.current=o,eo(o),Me&&Me(o),void _t()}const r=Et(n,i),s=Yt(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return wo.current=-1,Ao.current=null,Qt.current=null,Zt.current=null,eo(null),Me&&Me(null),void _t();wo.current=s;const a=n.flat[s];Ao.current={shape:a.shape,w:a.w,h:a.h};const l=Xt(a);Qt.current=l,eo(l),Me&&Me(l),_t()},[Me,_t]),jo=c(e=>{wo.current=-1,Ao.current=null,mo(e)},[mo]);Pt.current=()=>{var e,t;Mt.current=0;const o=Wt.current,n=Rt.current;if(!o||!n)return;const i=uo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(xt.current?r+1e6:r),a=!xt.current&&s,l=mt.current||s;l&&!a&&i.computeScene({width:Nt,height:It});const c=kn(),u=function(e){if(!e)return Gn;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||o||r?{axisStroke:l||Gn.axisStroke,tickText:s||Gn.tickText,crosshair:s?qn(s,"66"):Gn.crosshair,hoverFill:c?qn(c,"4D"):Gn.hoverFill,hoverStroke:s?qn(s,"99"):Gn.hoverStroke,pointRing:c||Gn.pointRing,primary:r||Gn.primary}:Gn}(o);to.current=u.primary;const d=null!==(e=null==nt?void 0:nt.threshold)&&void 0!==e?e:5e3,h=nt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=xn(o,wt,Lt,c);if(e){if(e.clearRect(-Lt.left,-Lt.top,wt[0],wt[1]),h&&(e.globalAlpha=null!==(t=null==nt?void 0:nt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Q&&!Ge){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=Q||(t&&"transparent"!==t?t:null);n&&(e.fillStyle=n,e.fillRect(-Lt.left,-Lt.top,wt[0],wt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Nt,It),e.clip()),Xe&&i.scales)for(const t of Xe)e.save(),t(e,i.scene,i.scales,{width:Nt,height:It}),e.restore();const n=En[w];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:Nt,height:It});e.restore(),h&&(e.globalAlpha=1)}}{const e=xn(n,wt,Lt,c);if(e&&(e.clearRect(-Lt.left,-Lt.top,wt[0],wt[1]),Ht&&Qt.current&&i.scales&&function(e,t,o,n,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,n),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of l)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const o=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,Qt.current,Nt,It,"object"==typeof Ht?Ht:{},Zt.current,u),Zt.current&&Array.isArray(je))){const t=je.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s=o.group;if(void 0!==s)for(const o of t){if("line"!==o.type)continue;if(o.group!==s)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,Zt.current,t,u)}}l&&o&&o.setAttribute("aria-label",Eo(i.scene,w+" chart"));const g=mt.current;if(mt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Ut||e(Ut.x.domain()[0])!==e(i.scales.x.domain()[0])||e(Ut.x.domain()[1])!==e(i.scales.x.domain()[1])||e(Ut.y.domain()[0])!==e(i.scales.y.domain()[0])||e(Ut.y.domain()[1])!==e(i.scales.y.domain()[1])||Ut.x.range()[0]!==i.scales.x.range()[0]||Ut.x.range()[1]!==i.scales.x.range()[1]||Ut.y.range()[0]!==i.scales.y.range()[0]||Ut.y.range()[1]!==i.scales.y.range()[1])&&Kt(i.scales),ct){const e=i.getData(),t="function"==typeof C?C:e=>e[C||"x"],o="function"==typeof M?M:e=>e[M||"y"];ro(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),ao(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Be&&Be.length>0&&qt(e=>e+1),(null==nt?void 0:nt.showBadge)&&no(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Mt.current=requestAnimationFrame(()=>Pt.current()))},s(()=>(_t(),()=>{var e;null===(e=ho.current)||void 0===e||e.clear()}),[_t]),s(()=>{mt.current=!0,_t()},[w,Nt,It,ve,Q,Z,Xe,_t]),Vt(nt,uo,mt,_t,oo,no);const Co=r(()=>{if(we||Se)return;const e=uo.current;return(null==e?void 0:e.xIsDate)&&Ut?zn(Ut.x.domain()):void 0},[we,Se,Ut]),Mo=we||Se||Co,Po=Ht&&Jt?Ce?Ce(Jt):e(Vn,{hover:Jt}):null,_o=Po?e(an,{x:Jt.x,y:Jt.y,containerWidth:Nt,containerHeight:It,margin:Lt,className:"stream-frame-tooltip",children:Po}):null,Lo=Ao.current,To=e(sn,{active:wo.current>=0,hoverPoint:Jt,margin:Lt,size:wt,shape:null==Lo?void 0:Lo.shape,width:null==Lo?void 0:Lo.w,height:null==Lo?void 0:Lo.h}),Do=(e,t,o,n)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null},$o=Do(C,R,"__semiotic_resolvedX","__semiotic_resolvedTime"),Wo=Do(M,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),Ro=$o.key,Fo=Wo.key,zo=Be&&Be.length>0,Yo=e=>{if(!e||!zo||!$o.fn&&!Wo.fn)return e;let t=!1;const o=e.map(e=>{const o=$o.fn&&$o.key&&!($o.key in e),n=Wo.fn&&Wo.key&&!(Wo.key in e);if(!o&&!n)return e;t=!0;const i=Object.assign({},e);return o&&(i[$o.key]=$o.fn(e)),n&&(i[Wo.key]=Wo.fn(e)),i});return t?o:e};if(Ho){const o=uo.current;o&&S&&(o.ingest({inserts:S,bounded:!0}),o.computeScene({width:Nt,height:It}));const i=null!==(l=null==o?void 0:o.scene)&&void 0!==l?l:[],r=null!==(u=null==o?void 0:o.scales)&&void 0!==u?u:null,s=Mo||(()=>{if((null==o?void 0:o.xIsDate)&&r)return zn(r.x.domain())})();return t("div",{className:"stream-xy-frame"+(K?" "+K:""),role:"img","aria-label":ft||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:wt[0],height:wt[1]},children:[e(tn,{summary:pt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:wt[0],height:wt[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Lt.left},${Lt.top})`,children:$t}),t("g",{transform:`translate(${Lt.left},${Lt.top})`,children:[Q&&e("rect",{x:0,y:0,width:Nt,height:It,fill:Q}),Ve&&r&&Ve.map((t,o)=>e(n.Fragment,{children:t(i,r,{width:Nt,height:It})},"svgpre-"+o)),i.map((o,n)=>function(o,n){var i,r,s;switch(o.type){case"line":{const t=o;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+n)}case"area":{const t=o;if(0===t.topPath.length)return null;const s=t.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...t.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:`M${s}L${a}Z`,fill:Io(t.style.fill),fillOpacity:null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.7,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"area-"+n)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Io(t.style.fill),opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+n)}case"rect":{const t=o;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Io(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+n)}case"heatcell":{const i=o;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const o=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,a]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),l=.299*r+.587*s+.114*a>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:o})]},"heatcell-"+n)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+n)}case"candlestick":{const i=o,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),a=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:a,stroke:a,strokeWidth:1})]},"candle-"+n)}default:return null}}(o,n)).filter(Boolean)]})]}),e(No,{width:Nt,height:It,totalWidth:wt[0],totalHeight:wt[1],margin:Lt,scales:r,showAxes:ve,axes:me,xLabel:be,yLabel:xe,yLabelRight:ke,xFormat:s,yFormat:Ae||Oe,showGrid:$e,title:Ue,legend:He,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:Ee,legendPosition:Ye,foregroundGraphics:Dt,marginalGraphics:ct,xValues:[],yValues:[],annotations:Be,svgAnnotationRules:De,annotationFrame:0,xAccessor:Ro,yAccessor:Fo,annotationData:Yo(null==o?void 0:o.getData()),pointNodes:null==o?void 0:o.scene.filter(e=>"point"===e.type),curve:"string"==typeof B?B:void 0,linkedCrosshairName:yt,linkedCrosshairSourceId:vt})]})}return t("div",{ref:kt,className:"stream-xy-frame"+(K?" "+K:""),role:"group","aria-label":ft||("string"==typeof Ue?Ue:"XY chart"),tabIndex:0,style:{position:"relative",width:X?"100%":wt[0],height:V?"100%":wt[1],overflow:"visible"},onKeyDown:Oo,children:[gt&&e(on,{tableId:Ct}),gt&&e(Jo,{scene:null!==(f=null===(h=uo.current)||void 0===h?void 0:h.scene)&&void 0!==f?f:[],chartType:w+" chart",tableId:Ct,chartTitle:"string"==typeof Ue?Ue:void 0}),e(tn,{summary:pt}),t("div",{role:"img","aria-label":ft||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ht?jo:void 0,onMouseLeave:Ht?bo:void 0,onClick:Pe?ko:void 0,children:[$t&&e("svg",{style:{position:"absolute",left:0,top:0,width:wt[0],height:wt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Lt.left},${Lt.top})`,children:$t})}),e(Bo,{width:Nt,height:It,totalWidth:wt[0],totalHeight:wt[1],margin:Lt,scales:Ut,showAxes:ve,axes:me,showGrid:$e,xFormat:Mo,yFormat:Ae||Oe}),e("canvas",{ref:Wt,"aria-label":Eo(null!==(y=null===(p=uo.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],w+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:Rt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(nn,{hoverPoint:Jt}),e(No,{width:Nt,height:It,totalWidth:wt[0],totalHeight:wt[1],margin:Lt,scales:Ut,showAxes:ve,axes:me,xLabel:be,yLabel:xe,yLabelRight:ke,xFormat:Mo,yFormat:Ae||Oe,showGrid:$e,title:Ue,legend:He,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:Ee,legendPosition:Ye,foregroundGraphics:Dt,marginalGraphics:ct,xValues:io,yValues:so,annotations:Be,svgAnnotationRules:De,annotationFrame:Gt,xAccessor:Ro,yAccessor:Fo,annotationData:Yo(null===(v=uo.current)||void 0===v?void 0:v.getData()),pointNodes:null===(m=uo.current)||void 0===m?void 0:m.scene.filter(e=>"point"===e.type),curve:"string"==typeof B?B:void 0,underlayRendered:!0,linkedCrosshairName:yt,linkedCrosshairSourceId:vt}),(Qe||Ze)&&e(Ne,{width:Nt,height:It,totalWidth:wt[0],totalHeight:wt[1],margin:Lt,dimension:null!==(b=null==Qe?void 0:Qe.dimension)&&void 0!==b?b:"xy",scales:Ut,onBrush:null!=Ze?Ze:()=>{},binSize:$,snap:null==Qe?void 0:Qe.snap,binBoundaries:null!==(x=null==Qe?void 0:Qe.binBoundaries)&&void 0!==x?x:"bar"===w?null===(k=uo.current)||void 0===k?void 0:k.getBinBoundaries():void 0,snapDuring:null==Qe?void 0:Qe.snapDuring,streaming:"streaming"===A}),(null==nt?void 0:nt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===nt.badgePosition?{top:4,left:4}:"bottom-left"===nt.badgePosition?{bottom:4,left:4}:"bottom-right"===nt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:oo?"#dc3545":"#28a745",color:"white"}),children:oo?"STALE":"LIVE"}),To,_o]})]})});function Kn(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function Qn(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=U(e,.25))&&void 0!==t?t:r,median:null!==(o=U(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=U(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}Un.displayName="StreamXYFrame";const Zn={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,v=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),v.push(t))}}else v.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of v){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(bt(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(bt(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const m="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(bt(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(bt(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),u=f&&a[i]||c,v=l(t,e.name),m=v.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:m,style:v,datum:t})}return d},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),u=r(n,e.name),d=u.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:n})}}return l},pie:Kn,donut:Kn,boxplot:function(e,t){var o,n,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,v=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],f=null!==(o=U(l,.25))&&void 0!==o?o:c,m=null!==(n=U(l,.5))&&void 0!==n?n:(c+u)/2,b=null!==(i=U(l,.75))&&void 0!==i?i:u,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>w>=e))&&void 0!==s?s:u,O=h(t.pieceData[0],t.name),j=[];if(v)for(const e of t.pieceData){const o=d(e);if(k>o||o>w){const n=y?t.middle:g(o),i=y?g(o):t.middle;j.push({px:n,py:i,value:o,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(f),medianPos:g(m),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:m,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,datum:t.pieceData,category:t.name,outliers:j}),v)for(const t of j)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...d,1),v=e.width/2*.9;let m="";if(g){m=`M ${e.middle} ${u(r)}`;for(let t=0;f>t;t++){const o=u(r+(t+.5)*a);m+=` L ${e.middle+d[t]/y*v} ${o}`}m+=` L ${e.middle} ${u(s)}`;for(let t=f-1;t>=0;t--){const o=u(r+(t+.5)*a);m+=` L ${e.middle-d[t]/y*v} ${o}`}m+=" Z"}else{m=`M ${u(r)} ${e.middle}`;for(let t=0;f>t;t++)m+=` L ${u(r+(t+.5)*a)} ${e.middle-d[t]/y*v}`;m+=` L ${u(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)m+=` L ${u(r+(t+.5)*a)} ${e.middle+d[t]/y*v}`;m+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const a=null!==(o=U(t,.25))&&void 0!==o?o:r,l=null!==(n=U(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=U(t,.75))&&void 0!==i?i:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(s),u(r)),width:e.width,height:Math.abs(u(s)-u(r))}:{x:Math.min(u(r),u(s)),y:e.x,width:Math.abs(u(s)-u(r)),height:e.width};h.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Qn(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(bt(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let v="";if(h){const t=e.x+e.width;v=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)v+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;v+=` L ${l(i)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);v+=` L ${t+c[e]/f*y} ${o}`}v+=` L ${t} ${l(i)} Z`}const m=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};u.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:m,stats:Qn(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(bt(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(bt(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var o,n,i,r,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===v.length)return f;const m=[],b=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),m.push(e))}const k=m.length>1&&"_default"!==m[0],w=[];let A=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=h?h(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(n);i.total+=r,i.pieces.push(n),o+=r}w.push({col:e,groups:t,stepTotal:o}),k||o>A&&(A=o)}if(k)for(const e of w){let t=0,o=0;for(let n=0;m.length>n;n++){const i=e.groups.get(m[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return f;const S=new Map;for(const e of m){const t=w[0].groups.get(e);S.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,j=k?.95*p:.9*t.width,C=x().domain([0,A]).range([0,j]),M=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let P=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,u=0===t,d=n.width,h=.55*d,v=n.x+(d-h)/2,b=new Map;if(k){let e=0;for(const t of m){const n=o.groups.get(t);n&&(e+=C(n.total))}let t=p,i=p;for(let r=0;m.length>r;r++){const a=m[r],l=o.groups.get(a);if(!l)continue;const c=C(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const k=g(l.pieces[0],a),w=null!==(s=S.get(a))&&void 0!==s?s:l.total,A=w>0?l.total/w*100:0,O=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=v,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=v,O.__funnelBarW=c),f.push(bt(x,v,c,h,k,O,a)),b.set(a,{x:x,y:v,w:c,h:h})}}else{const e=o.stepTotal,t=C(e),s=p-t/2,a=m[0],l="_default"!==a,c=null!==(r=null===(i=o.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:n.pieceData[0],d=l?a:n.name,x=g(c,d),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:u,category:l?a:n.name});y&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=v,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=v,w.__funnelBarW=t),f.push(bt(s,v,t,h,x,w,d)),b.set(a,{x:s,y:v,w:t,h:h})}if(t>0&&P.size>0){const t=k?m:[m[0]];for(const i of t){const t=P.get(i),r=b.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return g(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:M},datum:null!==(c=null===(l=o.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===i?n.name:i};f.push(u)}}P=b}return f},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const v=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);v.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const m=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=v.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=n?0:Math.max(0,w-y),S=o.x+e*a+l/2,O=m(y),j=m(0)-O,C=c(f.pieces[0],p?h:o.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:m(y+A)});if(d.push(bt(S,O,u,j,C,M,p?h:o.name)),A>0){const e=m(y+A),t=O-e,n=Object.assign({},C),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(bt(S,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){const{scales:o,columns:n,getR:i,getStack:r,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="horizontal"===l;for(const e of Object.values(n)){let t=0;for(const o of e.pieceData){const n=Math.abs(i(o));if(0===n)continue;const l=r?r(o):e.name,d=s(o,l);if(u){const i=a(t),r=a(t+n);c.push(bt(i,e.x,r-i,e.width,d,o,l))}else{const i=a(t+n),r=a(t);c.push(bt(e.x,i,e.width,r-i,d,o,l))}t+=n}}return c}};class Jn{constructor(e){this.rExtent=new Ue,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new Ve(e.windowSize),this.getO=et(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Ze(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Ue)):(this.getR=Ze(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=et(e.stackBy),this.getGroup=et(e.groupBy),this.getColor=et(e.colorAccessor),this.getConnector=et(e.connectorAccessor),this.getDataId=et(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Ve(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const n=o.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(n),s=this.computeValueDomain(n,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=A().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;d=x().domain(s).range([n,o])}else a?(u=A().domain(r).range([0,e.height]).padding(c),d=x().domain(s).range([0,e.width])):(u=A().domain(r).range([0,e.width]).padding(c),d=x().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(o,n);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?x().domain([l,c]).range([0,e.width]):x().domain([l,c]).range([e.height,0])}):[];let h=n;this.rAccessors.length>1&&(h=n.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,o,n,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==n){u=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of u)u.set(t,o/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;u?(c=h,g=u.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const o=this.getSceneContext(),n=Zn[this.config.chartType];let i=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(o,i);i=[...e,...i]}return i}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||nt,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?ct(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,Jn.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=O().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const n=u.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,v,m,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,S);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)d?(A.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,w=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(v=t.outerRadius)&&void 0!==v?v:100,startAngle:null!==(m=t.startAngle)&&void 0!==m?m:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:ft(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=ht(e,this.activeTransition),s=dt(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=gt(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=gt(n.x,e._targetX,s),e.y=gt(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=gt(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=gt(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=gt(o.x,e._targetX,s),e.y=gt(o.y,e._targetY,s),void 0!==o.w&&(e.w=gt(o.w,e._targetW,s),e.h=gt(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:gt(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=gt(o.startAngle,e._targetStartAngle,s),e.endAngle=gt(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!Qe(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!Qe(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!Qe(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(Qe(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=et(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!Qe(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Ze(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Ue)):(this.getR=Ze(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Qe(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?et(this.config.stackBy):void 0),"groupBy"in e&&!Qe(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?et(this.config.groupBy):void 0),"colorAccessor"in e&&!Qe(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?et(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Qe(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?et(this.config.connectorAccessor):void 0)}}function ei(e,t,o){const n=jt(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function ti(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Ct(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function oi(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=_t(Math.atan2(i,n)),a=_t(e.startAngle),l=_t(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function ni(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ii(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function ri(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=n,{rTickValues:f}=n,p="radial"===(null==u?void 0:u.projection),y="horizontal"===(null==u?void 0:u.projection),v=r(()=>!u||p?[]:(f||u.r.ticks(5)).map(e=>({value:e,pixel:u.r(e),label:(g||si)(e)})),[u,g,p,f]),m=h&&u&&!p,b=d&&u&&!p;return m||b?e("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[m&&e("g",{className:"ordinal-grid",children:v.map((t,o)=>e("line",{x1:y?t.pixel:0,y1:y?0:t.pixel,x2:y?t.pixel:i,y2:y?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),b&&e(o,{children:t(o,y?{children:[e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function si(e){return Math.round(100*e)/100+""}function ai(n){var s,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:v,oFormat:m,rFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:j,legendPosition:C="right",foregroundGraphics:M,annotations:P,svgAnnotationRules:_,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:D,children:$}=n,N="radial"===(null==g?void 0:g.projection),I="horizontal"===(null==g?void 0:g.projection),H=!1!==p,W=r(()=>f&&H&&g&&!N?g.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=g.o(e))&&void 0!==o?o:0)+g.o.bandwidth()/2,label:m?m(e,t):e}}):[],[f,H,g,m,N]),R=n.rTickValues,F=n.tickLabelEdgeAlign,z=r(()=>f&&g&&!N?(R||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||si)(e)})):[],[f,g,b,N,R]),E=i(new Map),Y=i(null!==(s=null==P?void 0:P.length)&&void 0!==s?s:0),G=null!==(a=null==P?void 0:P.length)&&void 0!==a?a:0;Y.current!==G&&(Y.current=G,E.current=new Map);const q=r(()=>{if(!P||0===P.length)return null;const e=xo(),t="horizontal"===(null==g?void 0:g.projection),o=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,n={scales:g?{x:t?g.r:o||g.r,y:t&&o||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:l,height:c,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:E.current};return P.map((t,o)=>{if(_){const i=_(t,o,n);return null!=i?i:e(t,o,n)}return e(t,o,n)}).filter(Boolean)},[P,_,l,c,g,L,T,B]);return f||k||w||M||q&&q.length>0||x||$?t("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!N&&!D&&e("g",{className:"ordinal-grid",children:z.map((t,o)=>e("line",{x1:I?t.pixel:0,y1:I?0:t.pixel,x2:I?t.pixel:l,y2:I?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!N&&e("g",{className:"ordinal-axes",children:t(o,I?{children:[!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:y}),!D&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!D&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),z.map((o,n)=>{const i=F?0===n?"start":n===z.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)}),v&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:v})]}:{children:[!D&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,o=0>t||t>c?c:t;return e("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),W.map((o,n)=>t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)),v&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:v})]})}),q,M,$]}),k&&e("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof k?k:null}),io({legend:w,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:k,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:j})]}):null}function li({width:t,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const u=i(null),d=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),m=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,s(()=>{if(!u.current)return;const e=p(u.current).select(".brush-g"),n=b?y():v();return n.extent([[0,0],[t,o]]),n.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return m.current=null,void h.current(null);const[o,n]=e.selection;let i;i=x.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};m.current=r,h.current(r)}),e.call(n),d.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),d.current=null}},[t,o,b]),s(()=>{if(!l||!d.current||!m.current)return;if(!u.current)return;const e=m.current,t=p(u.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);b?(f.current=!0,t.call(d.current.move,[o,n]),f.current=!1):(f.current=!0,t.call(d.current.move,[n,o]),f.current=!1)},[l,b]),e("svg",{ref:u,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function ci(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function ui(e,t){const o=xe().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}Jn.QUADTREE_THRESHOLD=500;const di=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?vn(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),ui(e,t)):(ci(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(ci(e,t),_n(e,t)),e.globalAlpha=1}},hi=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?vn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},gi=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=vn(e,o.style.stroke)||("string"==typeof o.style.fill?vn(e,o.style.fill):o.style.fill)||vn(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function fi(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function pi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let yi=null;function vi(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(yi||(yi=document.createElement("canvas")),yi.width=e,yi.height=e,yi)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const mi=new Map;function bi(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=mi.get(o);if(void 0!==n)return n;const i=vi({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return mi.set(o,i),i}function xi(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function ki(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function wi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Ai=e=>[gi,...e],Si={bar:Ai([Nn]),clusterbar:Ai([Nn]),point:Ai([Dn]),swarm:Ai([Dn]),pie:[di],donut:[di],boxplot:Ai([(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=vn(e,"var(--semiotic-primary, #007bff)"),a=vn(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?vn(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?vn(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Dn]),violin:Ai([hi]),histogram:Ai([Nn]),ridgeline:Ai([hi]),timeline:Ai([Nn]),funnel:[Nn,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?fi(i):null!=r?`${fi(i)} (${pi(r)})`:fi(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=fi(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(null!==(a=o.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Nn,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||vn(e,"var(--semiotic-border, #999)"),n=bi(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=vn(e,"var(--semiotic-text, #333)"),s=vn(e,"var(--semiotic-text-secondary, #666)");for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,a=!(!0===o.__barFunnelIsFirstStep)&&null!=i,l=a?wi(i):"",c=ki(n);e.font="bold 13px sans-serif";const u=a?e.measureText(l).width:0;e.font="11px sans-serif";const d=e.measureText(c).width,h=Math.max(u,d)+12,g=a?32:17,f=o.__barFunnelLabelX,p=f-h/2,y=o.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),xi(e,p,y,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),xi(e,p,y,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=r,e.fillText(l,f,y+3),e.font="11px sans-serif",e.fillStyle=s,e.fillText(c,f,y+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=r,e.fillText(c,f,y+3))}e.lineWidth=1}],swimlane:Ai([Nn])},Oi={top:50,right:40,bottom:60,left:70},ji={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Ci({hover:o}){var n,i,r,s,a,l;const c=o.data||{},u=o.stats,d=o.category;if(Array.isArray(c)){const o=d||(null===(n=c[0])||void 0===n?void 0:n.category)||"";if(u)return t("div",{className:"semiotic-tooltip",style:ji,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:["n = ",u.n]}),t("div",{children:["Min: ",u.min.toLocaleString()]}),t("div",{children:["Q1: ",u.q1.toLocaleString()]}),t("div",{children:["Median: ",u.median.toLocaleString()]}),t("div",{children:["Q3: ",u.q3.toLocaleString()]}),t("div",{children:["Max: ",u.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:ji,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return t("div",{className:"semiotic-tooltip",style:ji,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===o.length&&t("div",{style:{opacity:.8},children:[Number(o[0]).toFixed(1)," – ",Number(o[1]).toFixed(1)]})]})}const h=o.__oAccessor,g=o.__rAccessor,f=o.__chartType;if("swarm"===f||"point"===f){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ji,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ji,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}return t("div",{className:"semiotic-tooltip",style:ji,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}const Mi=h(function(o,a){var l,u,h,f,p,y,v,m,b,x;const{chartType:k,runtimeMode:w,data:A,oAccessor:S="category",rAccessor:O="value",colorAccessor:j,stackBy:C,groupBy:M,multiAxis:P,timeAccessor:_,valueAccessor:L,categoryAccessor:T,projection:B="vertical",size:D=[600,400],responsiveWidth:$,responsiveHeight:N,margin:I,barPadding:H,roundedTop:W,gradientFill:R,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:Y,startAngle:G,sweepAngle:q,dynamicColumnWidth:X,bins:V,showOutliers:U,showIQR:K,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:ee,connectorStyle:te,dataIdAccessor:oe,rExtent:ne,oExtent:ie,extentPadding:re=.05,oSort:se,windowMode:ae="sliding",windowSize:le=200,pieceStyle:ce,summaryStyle:ue,colorScheme:de,barColors:he,showAxes:ge=!0,showCategoryTicks:fe,categoryLabel:pe,valueLabel:ye,categoryFormat:ve,valueFormat:me,oLabel:be,rLabel:ke,oFormat:we,rFormat:Ae,rTickValues:Se,tickLabelEdgeAlign:Oe,enableHover:je=!0,hoverAnnotation:Ce,tooltipContent:Me,customHoverBehavior:Pe,annotations:_e,svgAnnotationRules:Le,showGrid:Te=!1,legend:Be,legendHoverBehavior:De,legendClickBehavior:$e,legendHighlightedCategory:Ne,legendIsolatedCategories:He,legendPosition:We,backgroundGraphics:Fe,foregroundGraphics:ze,title:Ee,className:Ye,background:Ge,centerContent:qe,decay:Xe,pulse:Ve,transition:Ue,animate:Ke,staleness:Qe,brush:Ze,onBrush:Je,accessibleTable:et=!0,description:tt,summary:ot}=o,nt=i(!0),it=bn({sizeProp:D,responsiveWidth:$,responsiveHeight:N,userMargin:I,marginDefault:Oi,foregroundGraphics:ze,backgroundGraphics:Fe,animate:Ke,transitionProp:Ue,themeDirtyRef:nt}),{reducedMotionRef:rt,responsiveRef:st,size:at,margin:lt,adjustedWidth:ct,adjustedHeight:ut,resolvedForeground:dt,resolvedBackground:ht,currentTheme:gt,transition:ft,introEnabled:pt,tableId:yt,rafRef:vt,renderFnRef:mt,scheduleRender:bt}=it,xt=null!=pe?pe:be,kt=null!=ye?ye:ke,wt=null!=ve?ve:we,At=null!=me?me:Ae,St=i(null),Ot=i(null),[jt,Ct]=d(null),[Mt,Pt]=d(null),[_t,Tt]=d(0),[Bt,Dt]=d(!1),$t=je||Ce,Nt="streaming"===w,It=r(()=>{var e,t,o;return{chartType:k,runtimeMode:Nt?"streaming":"bounded",windowSize:le,windowMode:ae,extentPadding:re,projection:B,oAccessor:Nt?void 0:S,rAccessor:Nt?void 0:O,colorAccessor:j,stackBy:C,groupBy:M,multiAxis:P,timeAccessor:Nt?_:void 0,valueAccessor:Nt?L||("string"==typeof O||"function"==typeof O?O:void 0):void 0,categoryAccessor:Nt?T||S:void 0,rExtent:ne,oExtent:ie,barPadding:H,roundedTop:W,gradientFill:R,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:Y,startAngle:G,sweepAngle:q,dynamicColumnWidth:X,bins:V,showOutliers:U,showIQR:K,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:ee,connectorStyle:te,dataIdAccessor:oe,oSort:se,pieceStyle:ce,summaryStyle:ue,colorScheme:de,themeCategorical:null===(e=null==gt?void 0:gt.colors)||void 0===e?void 0:e.categorical,themeSemantic:Re(gt),themeSequential:null===(t=null==gt?void 0:gt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==gt?void 0:gt.colors)||void 0===o?void 0:o.diverging,barColors:he,decay:Xe,pulse:Ve,transition:ft,introAnimation:pt,staleness:Qe}},[k,le,ae,re,B,S,O,j,C,M,P,_,L,T,ne,ie,H,W,R,F,z,E,Y,G,q,X,V,U,K,Q,Z,J,ee,te,oe,se,ce,ue,de,he,Xe,Ve,null==ft?void 0:ft.duration,null==ft?void 0:ft.easing,pt,Qe,Nt,gt]),Ht=i(null);Ht.current||(Ht.current=new Jn(It)),s(()=>{var e;null===(e=Ht.current)||void 0===e||e.updateConfig(It),nt.current=!0,bt()},[It,bt]);const Wt=i(null);Wt.current||(Wt.current=new Ie(e=>{const t=Ht.current;t&&t.ingest(e)&&(nt.current=!0,bt())}));const Rt=c(e=>{var t;null===(t=Wt.current)||void 0===t||t.push(e)},[]),Ft=c(e=>{var t;null===(t=Wt.current)||void 0===t||t.pushMany(e)},[]),Gt=c(()=>{var e,t;null===(e=Wt.current)||void 0===e||e.clear(),null===(t=Ht.current)||void 0===t||t.clear(),nt.current=!0,bt()},[bt]),qt=c(e=>{var t,o;null===(t=Wt.current)||void 0===t||t.clearLastData(),null===(o=Wt.current)||void 0===o||o.setReplacementData(e)},[]);g(a,()=>({push:Rt,pushMany:Ft,replace:qt,remove:e=>{var t,o,n,i;null===(t=Wt.current)||void 0===t||t.flush();const r=null!==(n=null===(o=Ht.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=Ot.current)||void 0===i?void 0:i.data;!!Ot.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Ot.current=null,Ct(null)),nt.current=!0,bt()}return r},update:(e,t)=>{var o,n,i;null===(o=Wt.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Ht.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(nt.current=!0,bt()),r},clear:Gt,getData:()=>{var e,t,o;return null===(e=Wt.current)||void 0===e||e.flush(),null!==(o=null===(t=Ht.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Ht.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Rt,Ft,qt,Gt,bt]),s(()=>{var e;A&&(null===(e=Wt.current)||void 0===e||e.setBoundedData(A))},[A]);const{hoverHandlerRef:Ut,hoverLeaveRef:Kt,onPointerMove:Qt,onPointerLeave:Zt}=it;Ut.current=e=>{if(!$t)return;const t=St.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-lt.left,i=e.clientY-o.top-lt.top;if(0>n||n>ct||0>i||i>ut)return void(Ot.current&&(Ot.current=null,Ct(null),Pe&&Pe(null),bt()));const r=Ht.current;if(!r||0===r.scene.length)return;const s="radial"===B,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Lt(i,t,o,n,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":e=ei(r,t,o);break;case"point":if(i)break;e=ti(r,t,o,n);break;case"wedge":e=oi(r,t,o);break;case"boxplot":e=ni(r,t,o);break;case"violin":e=ii(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-ct/2:n,s?i-ut/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Ot.current&&(Ot.current=null,Ct(null),Pe&&Pe(null),bt()));const l=Hn(a.datum||{},a.x,a.y,Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof S?S:void 0,__rAccessor:"string"==typeof O?O:void 0,__chartType:k}));Ot.current=l,Ct(l),Pe&&(Pe(l),nt.current=!0),bt()},Kt.current=()=>{Ot.current&&(Ot.current=null,Ct(null),Pe&&(Pe(null),nt.current=!0),bt())};const Jt=i(-1),eo=i(null),to=i(null),oo=c(e=>{const t=Ht.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(to.current&&to.current.version===o)n=to.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=zt(e),to.current={version:o,graph:n}}const i=Jt.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Jt.current=0;const t=n.flat[0];eo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Xt(t)),{__oAccessor:"string"==typeof S?S:void 0,__rAccessor:"string"==typeof O?O:void 0,__chartType:k});return Ot.current=o,Ct(o),Pe&&Pe(o),void bt()}const r=Et(n,i),s=Yt(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Jt.current=-1,eo.current=null,Ot.current=null,Ct(null),Pe&&Pe(null),void bt();Jt.current=s;const a=n.flat[s];eo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Xt(a)),{__oAccessor:"string"==typeof S?S:void 0,__rAccessor:"string"==typeof O?O:void 0,__chartType:k});Ot.current=l,Ct(l),Pe&&Pe(l),bt()},[Pe,bt]),no=c(e=>{Jt.current=-1,eo.current=null,Qt(e)},[Qt]);mt.current=()=>{var e,t;vt.current=0;const o=St.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=Ht.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(rt.current?r+1e6:r),a=!rt.current&&s,l=nt.current;l&&!s&&(i.computeScene({width:ct,height:ut}),nt.current=!1),(l||a)&&o.setAttribute("aria-label",Eo(i.scene,k+" chart"));const c=kn(),u=at[0]*c,d=at[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=at[0]+"px",o.style.height=at[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,at[0],at[1]);const h=null!==(e=null==Qe?void 0:Qe.threshold)&&void 0!==e?e:5e3,g=Qe&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==Qe?void 0:Qe.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ge&&!Fe){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Ge||(e&&"transparent"!==e?e:null);t&&(n.fillStyle=t,n.fillRect(0,0,at[0],at[1]))}const f="radial"===B;n.save(),n.beginPath(),n.rect(lt.left,lt.top,ct,ut),n.clip(),f?(n.save(),n.translate(lt.left+ct/2,lt.top+ut/2)):n.translate(lt.left,lt.top);const p=Si[k]||[],y={width:ct,height:ut};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(Pt(i.scales),Tt(e=>e+1)),(null==Qe?void 0:Qe.showBadge)&&Dt(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(vt.current=requestAnimationFrame(()=>mt.current()))},s(()=>(bt(),()=>{var e;null===(e=Wt.current)||void 0===e||e.clear()}),[bt]),s(()=>{nt.current=!0,bt()},[k,ct,ut,ge,Ge,bt]),Vt(Qe,Ht,nt,bt,Bt,Dt);const io=$t&&jt?Me?Me(jt):e(Ci,{hover:jt}):null,ro="radial"===B,so=io?e(an,{x:jt?ro?jt.x+ct/2:jt.x:0,y:jt?ro?jt.y+ut/2:jt.y:0,containerWidth:ct,containerHeight:ut,margin:lt,className:"stream-ordinal-tooltip",children:io}):null;if(Ho){const o=Ht.current;o&&A&&(o.ingest({inserts:A,bounded:!0}),o.computeScene({width:ct,height:ut}));const i=null!==(l=null==o?void 0:o.scene)&&void 0!==l?l:[],r=null!==(u=null==o?void 0:o.scales)&&void 0!==u?u:null,s="radial"===B,a=s?lt.left+ct/2:lt.left,c=s?lt.top+ut/2:lt.top;return t("div",{className:"stream-ordinal-frame"+(Ye?" "+Ye:""),role:"img","aria-label":tt||("string"==typeof Ee?Ee:"Ordinal chart"),style:{position:"relative",width:at[0],height:at[1]},children:[e(tn,{summary:ot}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:at[0],height:at[1],style:{position:"absolute",left:0,top:0},children:[ht&&e("g",{transform:`translate(${lt.left},${lt.top})`,children:ht}),t("g",{transform:`translate(${a},${c})`,children:[Ge&&e("rect",{x:0,y:0,width:ct,height:ut,fill:Ge}),i.map((o,i)=>function(o,i){var r,s,a,l,c;const u=("category"in o?o.category:void 0)||("group"in o?o.group:void 0)||"",d=e=>`ord-${o.type}-${u}-${i}-${e}`,h=`ord-${o.type}-${u}-${i}`;switch(o.type){case"rect":{const i=o,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let o=0;t.length>o;o++)l.push(e("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=Io(t.style.fill);l.push(e("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:Io(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const o=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+u-o} A${o},${o} 0 0 1 ${r+c-o},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+o},${l} A${o},${o} 0 0 0 ${r},${l+o} L${r},${l+u-o} A${o},${o} 0 0 0 ${r+o},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-o} A${o},${o} 0 0 1 ${r+c-o},${l+u} L${r+o},${l+u} A${o},${o} 0 0 1 ${r},${l+u-o} Z`;break;default:d=`M${r},${l+u} L${r},${l+o} A${o},${o} 0 0 1 ${r+o},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+u} Z`}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:d,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Io(t.style.fill),opacity:null!==(r=t.style.opacity)&&void 0!==r?r:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}case"wedge":{const t=o,n=xe().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2);t.cornerRadius&&n.cornerRadius(t.cornerRadius);const i=n({})||"";return e("path",{d:i,transform:`translate(${t.cx},${t.cy})`,fill:Io(t.style.fill),stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity},h)}case"boxplot":{const n=o,i=n.columnWidth/2;return t("g","vertical"===n.projection?{children:[e("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:Io(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-.5*i,y1:n.maxPos,x2:n.x+.5*i,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:Io(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.maxPos,y1:n.y-.5*i,x2:n.maxPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const t=o,n=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Io(t.style.fill),fillOpacity:null!==(l=t.style.fillOpacity)&&void 0!==l?l:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},d("path"))];if(t.iqrLine&&t.bounds){const o=t.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},d("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},d("med"))):n.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},d("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},d("med")))}return e("g",{children:n},h)}case"connector":return e("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:null!==(c=o.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const t=o,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:n,fill:Io(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}default:return null}}(o,i)).filter(Boolean)]})]}),e(ai,{width:ct,height:ut,totalWidth:at[0],totalHeight:at[1],margin:lt,scales:r,showAxes:ge,showCategoryTicks:fe,oLabel:xt,rLabel:kt,oFormat:wt,rFormat:At,rTickValues:Se,tickLabelEdgeAlign:Oe,showGrid:Te,title:Ee,legend:Be,legendHoverBehavior:De,legendClickBehavior:$e,legendHighlightedCategory:Ne,legendIsolatedCategories:He,legendPosition:We,foregroundGraphics:dt,annotations:_e,svgAnnotationRules:Le,annotationFrame:0,xAccessor:"string"==typeof S?S:void 0,yAccessor:"string"==typeof O?O:void 0,annotationData:null==o?void 0:o.getData()}),qe&&"radial"===B&&e("div",{style:{position:"absolute",left:lt.left+ct/2,top:lt.top+ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:qe})]})}return t("div",{ref:st,className:"stream-ordinal-frame"+(Ye?" "+Ye:""),role:"group","aria-label":tt||("string"==typeof Ee?Ee:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:$?"100%":at[0],height:N?"100%":at[1],overflow:"visible"},onKeyDown:oo,children:[et&&e(on,{tableId:yt}),et&&e(Jo,{scene:null!==(f=null===(h=Ht.current)||void 0===h?void 0:h.scene)&&void 0!==f?f:[],chartType:k+" chart",tableId:yt,chartTitle:"string"==typeof Ee?Ee:void 0}),e(tn,{summary:ot}),t("div",{role:"img","aria-label":tt||("string"==typeof Ee?Ee:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:$t?no:void 0,onMouseLeave:$t?Zt:void 0,children:[ht&&e("svg",{style:{position:"absolute",top:0,left:0,width:at[0],height:at[1],pointerEvents:"none"},children:e("g",{transform:`translate(${lt.left},${lt.top})`,children:ht})}),e(ri,{width:ct,height:ut,totalWidth:at[0],totalHeight:at[1],margin:lt,scales:Mt,showAxes:ge,showGrid:Te,rFormat:At,rTickValues:Se}),e("canvas",{ref:St,"aria-label":Eo(null!==(y=null===(p=Ht.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],k+" chart"),style:{position:"absolute",top:0,left:0,width:at[0],height:at[1]}}),e(nn,{hoverPoint:jt}),e(ai,{width:ct,height:ut,totalWidth:at[0],totalHeight:at[1],margin:lt,scales:Mt,showAxes:ge,showCategoryTicks:fe,oLabel:xt,rLabel:kt,oFormat:wt,rFormat:At,showGrid:Te,title:Ee,legend:Be,legendHoverBehavior:De,legendClickBehavior:$e,legendHighlightedCategory:Ne,legendIsolatedCategories:He,legendPosition:We,foregroundGraphics:dt,annotations:_e,svgAnnotationRules:Le,annotationFrame:_t,xAccessor:"string"==typeof S?S:void 0,yAccessor:"string"==typeof O?O:void 0,annotationData:null===(v=Ht.current)||void 0===v?void 0:v.getData(),underlayRendered:!0}),(Ze||Je)&&"radial"!==B&&e(li,{width:ct,height:ut,totalWidth:at[0],totalHeight:at[1],margin:lt,scales:Mt,onBrush:Je||(()=>{})}),qe&&"radial"===B&&e("div",{style:{position:"absolute",left:lt.left+ct/2,top:lt.top+ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:qe}),(null==Qe?void 0:Qe.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Qe.badgePosition?{top:4,left:4}:"bottom-left"===Qe.badgePosition?{bottom:4,left:4}:"bottom-right"===Qe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Bt?"#dc3545":"#28a745",color:"white"}),children:Bt?"STALE":"LIVE"}),e(sn,{active:Jt.current>=0,hoverPoint:jt,margin:lt,size:at,shape:null===(m=eo.current)||void 0===m?void 0:m.shape,width:null===(b=eo.current)||void 0===b?void 0:b.w,height:null===(x=eo.current)||void 0===x?void 0:x.h}),so]})]})});Mi.displayName="StreamOrdinalFrame";const Pi={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},_i={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Li{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,n){var i;for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const a=o[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=n&&null!==(i=n[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?Ti(a.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}}function Ti(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,u,d,h]=e[a];Bi(c,u,d,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*o*n*2,i.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[i,r,s,a]=e.points;Bi(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function Bi(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+u*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+u*n.y}function Di(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function $i(e,t){var o,n=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,n,d=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,i),d=!0):r[n]||(d=c(n));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return i.pop(),d}function u(e,t){var o=[].concat(t).concat(e);n.push(o)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),i=Array(t),r=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=u,i[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>o[p]){o[p]=n[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(n[t]=0|Math.min(n[t],n[p])),0>s[p]||a[t].push(s[p])}r[t]=f}else{if(n[t]===o[t]){var y=[],v=[],m=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),v.push(a[b]),m+=a[b].length,s[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(m);for(f=0;v.length>f;f++)for(var k=0;v[f].length>k;k++)x[--m]=v[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),i=n.components.filter(function(e){return e.length>1}),r=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],o=s);var l=i[o];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}o=0;for(var h=e.length;h>o;){var g=d(o);if(o=g.leastVertex,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(o),o+=1}else o=h}return n}function Ni(e){return e.y0-e.y1>0?"up":"down"}function Ii(e,t){return t(e.source)==t(e.target)}function Hi(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function Wi(e){return e.target.x0-e.source.x1}function Ri(e,t){var o=zi(e),n=Wi(t)/Math.tan(o);return"up"==Ni(e)?e.y1-n:e.y1+n}function Fi(e,t){var o=zi(e),n=Wi(t)/Math.tan(o);return"up"==Ni(e)?e.y1+n:e.y1-n}function zi(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Ei(e,t){return t(e)}function Yi(e){return qi(e.source)}function Gi(e){return qi(e.target)}function qi(e){return(e.y0+e.y1)/2}function Xi(e){return e.virtual?0:e.value}function Vi(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Ii(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Ii(e,t)?n+1:n}),o+n}function Ui(e){return e.target.depth}function Ki(e,t){return e.sourceLinks.length?e.depth:t-1}function Qi(e,t){return e.y0-t.y0}function Zi(e,t){return t.y0-e.y0}function Ji(e,t){return e.y1-t.y1}function er(e,t){return t.y1-e.y1}function tr(e,t){return nr(e.source,t.source)||e.index-t.index}function or(e,t){return nr(e.target,t.target)||e.index-t.index}function nr(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function ir(e,t){return rr(e)==rr(t)?"bottom"==e.circularLinkType?Zi(e,t):Qi(e,t):rr(t)-rr(e)}function rr(e){return e.target.column-e.source.column}function sr(e,t){return ar(e)==ar(t)}function ar(e){return e.y0-e.y1>0?"up":"down"}function lr(e,t,o,n,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=K(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),cr(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),cr(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Ii(e,t)&&Hi(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Zi:Qi);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?er:Ji),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,i=e.y1,r=(t+n)/2;return"M"+t+","+o+"C"+r+","+o+" "+r+","+i+" "+n+","+i}(e)}),r}function cr(e,t,o){e.sort(ir);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Ii(e,t)&&Hi(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&ur(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function ur(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function dr(e){return function(){return e}}function hr(e){return e.index}function gr(e){return e.nodes}function fr(e){return e.links}function pr(e,t,o){var n=Q(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(i,r){var s=i.length;if(t)i.sort(t);else if(r>0){var a=new Map;i.forEach(function(e,t){var o,n,i,r=(n=0,i=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=qi(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=qi(e.target)*t,n+=t}}),n>0?i/n:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var o=a.get(e),n=a.get(t),i=o.bc,r=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?o.idx-n.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Vi(t,o)-Vi(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Vi(t,o)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function yr(e,t,o,n,i,r){var s=Q(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=r;l>0;--l)c(a*=.99,o),u();function c(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var a;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&Vi(i,o)>0){var l=ee(i.sourceLinks,Gi),c=ee(i.targetLinks,Yi),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-qi(i))*t*.3;i.y0+=d,i.y1+=d}}else if(0==s&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)a=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+a;else{var h=ee(i.sourceLinks,Gi),g=ee(i.targetLinks,Yi),f=((h&&g?(h+g)/2:h||g)-qi(i))*t;i.y0+=f,i.y1+=f}})})}function u(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||nr),a=0;c>a;++a)(s=l-(r=o[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+n;if((s=l-n-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=o[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function vr(e){e.nodes.forEach(function(e){e.sourceLinks.sort(or),e.targetLinks.sort(tr)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,i=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function mr(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,a=hr,l=Ki,c=void 0,u=32,d=2,h=gr,g=fr;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return te(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,i=e.target;"object"!=typeof n&&(n=e.source=Di(o,n)),"object"!=typeof i&&(i=e.target=Di(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var n=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=$i(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:n>o?"top":"bottom","top"==i.circularLinkType?o++:n++,e.nodes.forEach(function(e){Ei(e,t)!=Ei(i.source,t)&&Ei(e,t)!=Ei(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Ii(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(J(e.sourceLinks,Xi),J(e.targetLinks,Xi)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var n,i,r;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,r):e.column})}(h,c,l);var g=r;if(null!==s){var f=Q(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=Z(f,function(e){return e.length});p>1&&(g=Math.max(1,(n-t)*s/(p-1)))}(function(e,t,o){var n=Q(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=K(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/J(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=Z(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/r),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,g,i),pr(h,c,a),yr(h,c,a,g,g,u),vr(h),lr(h,a,d,10,8),pr(h,c,a),yr(h,c,a,g,g,u),vr(h),lr(h,a,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return Ei(o.source,t)==Ei(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!sr(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=Ri(t,e);return e.y1-o}if(t.target.column>e.target.column)return Ri(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return Ei(o.target,t)==Ei(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!sr(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=Fi(t,e);return e.y0-o}if(t.source.column>e.source.column)return Fi(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,n=!1,i=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==n||0==i){var r=K(t,function(e){return e.y0}),s=Z(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-r);function l(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>a?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),o.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),lr(h,a,d,10,8)}(f),f}return f.update=function(e){return vr(e),lr(e,a,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:dr(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:dr(e),f):g},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:dr(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:dr(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],f):[[e,t],[o,n]]},f.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],f):[o-e,n-t]},f}const br=e=>{let t,o,n,i,r,s,a,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,s=e.target.x0,a=Oe(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${i},${l} ${i},${r}Z`):(t=e.source.x1,o=e.target.x0,a=Oe(t,o),n=a(.5),i=a(.5),r=e.y0-e.sankeyWidth/2,s=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${r}C${n},${r} ${i},${s} ${o},${s}L${o},${l}C${i},${l} ${n},${c} ${t},${c}Z`)};function xr(e){var t;const o=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,n=i.sourceY,r=i.targetX,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${n-o}L${t+a},${n-o}L${t+a},${n+o}L${t},${n+o}ZM${r},${s-o}L${r-l},${s-o}L${r-l},${s+o}L${r},${s+o}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,u=i.leftFullExtent,d=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(n,15));return`M${r},${s-h*o}L${c},${s-h*o}L${c+n},${s-h*o+h*g}L${c+n},${d+h*n-h*g}L${c+n-g},${d+h*n}L${u-n+g},${d+h*n}L${u-n},${d+h*n-h*g}L${u-n},${l-h*o+h*g}L${u-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${u+n},${l+h*o}L${u+n},${d-h*n}L${c-n},${d-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const kr=new Set,wr=new WeakMap;function Ar(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=wr.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,wr.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;kr.has(e)||(kr.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}const Sr={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Ui))-1:0},justify:Ki};function Or(e){return"string"==typeof e?e:e.id}const jr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,u;if(0===e.length)return;const d="vertical"===o.orientation?"down":"right",h=o.nodeAlign||"justify",g=null!==(i=o.nodeWidth)&&void 0!==i?i:15,f=null!==(r=o.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(s=o.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),v=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let m;m="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=mr().extent(m).links(v).nodes(y).nodeAlign(Sr[h]||Ki).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,o=1/0,i=-1/0;for(const n of y)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>i&&(i=n.y1);for(const n of v){if(!n.circular||!n.circularPathData)continue;const r=n.circularPathData,s=(null!==(l=null!==(a=n._circularWidth)&&void 0!==a?a:n.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),o>r.verticalFullExtent-s&&(o=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-o,u=n[0],d=n[1];if(r>0&&s>0&&(0>e||0>o||t>u||i>d)){const t=Math.min(u/r,d/s),n=-e*t+(u-r*t)/2,i=-o*t+(d-s*t)/2;for(const e of y)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of v)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+i,o.targetY=o.targetY*t+i,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+i,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+i,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+i,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of v){const t=Or(e.source),o=Or(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=d;const i=x.get(t),r=x.get(o);i&&(n.source=i),r&&(n.target=r)}}},buildScene(e,t,o,n){var i,r,s,a,l,c;const u="vertical"===o.orientation?"down":"right",d=o.nodeStyle,h=o.edgeStyle,g=null!==(i=o.edgeOpacity)&&void 0!==i?i:.5,f=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:$,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const v=[],m=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=d?d(Ar(t,"nodeStyle")):{},i={fill:n.fill||y.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),v.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(n.id)||y.get(n.id)||i:x.get(t.id)||y.get(t.id)||i;const u=h?h(Ar(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=u.fill||i;m.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:s,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),m.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-r},${t.targetY-o}L${t.targetX-r},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:s,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?xr(e):br(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};m.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:p,datum:e})}if(!1!==o.showLabels){const t=(w=o.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const r=t?t(o):o.id;if(!r)continue;let s,a,l;"down"===u?(s=o.y0+(o.y1-o.y0)/2,a=o.x1+14,l="start"):(n[0]/2>o.x0+e/2?(s=o.x0-6,l="end"):(s=o.x1+6,l="start"),a=o.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:b}}},Cr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r;if(0===e.length)return;const s=null!==(i=o.forceStrength)&&void 0!==i?i:.1,a=n[0]/2,l=n[1]/2,c=o.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=null==c?void 0:c.get(t.id);e?u++:o?(t.x=o.x,t.y=o.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of d){const n=Mr(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const i=Pr(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/n.length+s*Math.cos(r),e.y=o/n.length+s*Math.sin(r)}else{const t=Pr(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=a+n*Math.cos(o),e.y=l+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),i=o*t;n.x=a+e*Math.cos(i),n.y=l+e*Math.sin(i)}}}const g=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===o.iterations?0:h?40:g,p=_r(o.nodeSize,o.nodeSizeRange,e),y=e=>p(e);if(f>0){const o=je().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=Ce().force("charge",Me().strength(e=>-25*y(e))).force("center",Pe(a,l).strength(.8)).force("x",_e(a).strength(.15)).force("y",Le(l).strength(.15));if(n.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.force("link",o),n.force("link").links(e)}h?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;f>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.edgeStyle,g=_r(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:$,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],v=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Ar(t,"nodeSize")),n=d?d(Ar(t,"nodeStyle")):{},a={fill:n.fill||p.get(t.id)||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:2,opacity:n.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),n="object"==typeof e.target?e.target:b.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const i=h?h(Ar(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=o.themeSemantic)||void 0===a?void 0:a.border)||(null===(l=o.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=i.opacity)&&void 0!==u?u:.6};v.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==o.showLabels){const t=(x=o.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=g(Ar(o,"nodeSize"));m.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:v,labels:m}}};function Mr(e,t,o){const n=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let s=null;if(t===e?s=r:r===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function Pr(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function _r(e,t,o){var n,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],s=o.map(t=>{var o;return null===(o=t.data)||void 0===o?void 0:o[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>r[0];const a=null!==(n=K(s))&&void 0!==n?n:0,l=null!==(i=Z(s))&&void 0!==i?i:1;if(a===l)return()=>(r[0]+r[1])/2;const c=x().domain([a,l]).range(r).clamp(!0);return t=>{var o;const n=null===(o=t.data)||void 0===o?void 0:o[e];return null==n||"number"!=typeof n?r[0]:c(n)}}const Lr=$,Tr={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,l=a-r,c=n[0]/2,u=n[1]/2,d=(h=o.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=g.get("string"==typeof e.source?e.source:e.source.id),n=g.get(t);if(void 0===o||void 0===n)continue;const i=d(e);p[o][n]=i}const y=Be().padAngle(i);s&&y.sortGroups(s);const v=y(p),m=v.groups,b=xe().innerRadius(l).outerRadius(a);for(const t of m){const o=e[t.index],n=b.centroid(t);o.x=n[0]+c,o.y=n[1]+u,o.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);o&&(e.source=o),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of v){const o=e[t.source.index].id,n=e[t.target.index].id,i=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);i&&(i.chordData=t)}},buildScene(e,t,o,n){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=o,u=Math.min(n[0],n[1])/2,d=u-l,h=n[0]/2,g=n[1]/2,f=o.nodeStyle,p=o.edgeStyle,y=o.edgeColorBy||"source",v=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Lr,m=new Map;e.forEach((e,t)=>{m.set(e.id,v[t%v.length])});const b=Te().radius(d),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.arcData;if(!n)continue;let r;r=f?f(Ar(o,"nodeStyle")).fill||m.get(o.id)||v[t%v.length]:m.get(o.id)||v[t%v.length];const s=f?f(Ar(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};x.push({type:"arc",cx:h,cy:g,innerR:d,outerR:u,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:a,datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=b(t);if(!n)continue;const i=Br(n,h,g);let l=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(p)l=p(Ar(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===y&&o?l=m.get(o.id)||l:t&&(l=m.get(t.id)||l)}const u=p?p(Ar(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==o.showLabels){const t=(A=o.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=u+12;for(const o of e){const e=o.arcData;if(!e)continue;const i=t?t(o):o.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,s=r-Math.PI/2;w.push({x:h+Math.cos(s)*n,y:g+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function Br(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const i=[];let r=0;for(;n.length>r;){const e=n[r];if("M"===e||"L"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("C"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;3>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("Q"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;2>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("A"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&(i.push(Number(n[r])+t+""),r++),n.length>r&&(i.push(Number(n[r])+o+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(n[r]),r++)}return i.join(" ")}const Dr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function $r(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>150?"#222":"#fff"}function Nr(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Ir(e){return e?"function"==typeof e?e:t=>{var o;return(null===(o=t.data)||void 0===o?void 0:o[e])||t[e]||t.id}:null}function Hr(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Dr}function Wr(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Rr(e,t,o,n,i){if("horizontal"===i){const i=(e+o)/2;return`M ${e},${t} C ${i},${t} ${i},${n} ${o},${n}`}if("radial"===i){const i=(e+o)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+n)/2} T ${o},${n}`}{const i=(t+n)/2;return`M ${e},${t} C ${e},${i} ${o},${i} ${o},${n}`}}const Fr={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){var i;const r=o.__hierarchyRoot;if(!r)return;const s=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),l=o.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>{var t;return null!==(t=e[l])&&void 0!==t?t:0}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0},u=ne(r,a);u.sum(c),u.sort((e,t)=>{var o,n;return(null!==(o=t.value)&&void 0!==o?o:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[d,h]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=ce();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(u,o,d,h);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=le();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(u,o,d,h);break;case"treemap":!function(e,t,o,n){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=se().size([o,n]).tile(ae).padding(s);a>0&&l.paddingTop(a),l(e)}(u,o,d,h);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;re().size([o,n]).padding(r)(e)}(u,o,d,h);break;case"partition":!function(e,t,o,n){var i;ie().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(u,o,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const n=g[t],r={id:Nr(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=n.value)&&void 0!==i?i:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===s||"cluster"===s?zr(r,n,o):"treemap"===s||"partition"===s?Er(r,n):"circlepack"===s&&Yr(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===s||"cluster"===s)for(const e of g)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const i=o.nodeStyle||(()=>({})),r=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,i,r){var s,a,l,c,u,d,h,g;const f=[],p=[],y=[],v=o.treeOrientation||"vertical",m="radial"===v,b=n[0]/2,x=n[1]/2,k="number"==typeof(w=o.nodeSize)?w:5;var w;for(const t of e){let e=t.x,n=t.y;m&&(e+=b,n+=x);const r=i(Ar(t,"nodeStyle"));let l=r.fill||Wr(o);if(o.colorByDepth&&void 0!==t.depth){const e=Hr(o);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=o.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:n,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=o.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=t.x,s=t.y,a=n.x,l=n.y;m&&(i+=b,s+=x,a+=b,l+=x);const g=Rr(i,s,a,l,v),f=r(Ar(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=o.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=Ir(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,i,r,s=o.x,a=o.y;if(m&&(s+=b,a+=x),m){const e=s-b,t=a-x,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,i=a+t/o*10,r=0>e?"end":"start"):(n=s,i=a-12,r="middle")}else"horizontal"===v?((null===(g=o.data)||void 0===g?void 0:g.children)&&0!==o.data.children.length?(n=s-k-6,r="end"):(n=s+k+6,r="start"),i=a):(n=s,i=a+k+14,r="middle");y.push({x:n,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,o,n,i,r);case"treemap":case"partition":return function(e,t,o,n){var i,r,s,a,l;const c=[],u=[];for(const o of e){const e=o.x1-o.x0,s=o.y1-o.y0;if(0>=e||0>=s)continue;const a=n(Ar(o,"nodeStyle"));let l=a.fill||Wr(t);if(t.colorByDepth&&void 0!==o.depth){const e=Hr(t);l=e[o.depth%e.length]}const u={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:o.x0,y:o.y0,w:e,h:s,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Ir(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=o?o(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=n(Ar(c,"nodeStyle")).fill||Wr(t);if(t.colorByDepth&&void 0!==c.depth){const e=Hr(t);f=e[c.depth%e.length]}const p="string"==typeof f?$r(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,u,d,h,g;const f=[],p=[];for(const o of e){const e=null!==(i=o.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=n(Ar(o,"nodeStyle"));let c=l.fill||Wr(t);if(t.colorByDepth&&void 0!==o.depth){const e=Hr(t);c=e[o.depth%e.length]}const u={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.7};f.push({type:"circle",cx:o.x,cy:o.y,r:e,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Ir(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=o?o(i):i.id;if(!r)continue;if(15>e)continue;const s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=n(Ar(i,"nodeStyle")).fill||Wr(t);if(t.colorByDepth&&void 0!==i.depth){const e=Hr(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?$r(a):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,o,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function zr(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Er(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Yr(e,t){var o;const n=null!==(o=t.r)&&void 0!==o?o:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function Gr(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const qr={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,s;const a=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var o;return(null!==(o=e[t])&&void 0!==o?o:"")+""}}(o.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),u=null!==(r=o.orbitSize)&&void 0!==r?r:2.95,d=null!==(s=o.orbitEccentricity)&&void 0!==s?s:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=Gr(o);f.metaMap.clear(),n.length=0,i.length=0;const p=new Map;function y(e){var t;const o=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,o+1),0===o?e:`${e}__${o}`}const v=t[0]/2,m=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));n.push({id:x,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,s,u,d,p){const v=a(t);if(!(null==v?void 0:v.length))return;const m=v.length;let b=0,x=0,k=0;for(;m>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let m=0;b>m;m++){const x=c[Math.min(m,c.length-1)],k=v.slice(w,w+x);if(!k.length)break;const A=(m+1)/b,S={id:o,depth:d,data:t,parentId:o},O=p?u/h(S)*A:u*A,j=Ae().value(e=>{var t;return(null===(t=a(e))||void 0===t?void 0:t.length)?4:1}).sort(null),C=j(k),M=g(S);for(let t=0;k.length>t;t++){const a=(C[t].startAngle+C[t].endAngle)/2,c=k[t],u=y(l(c)),h=r+O*Math.sin(a),g=s+O*Math.cos(a)*M;n.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:a,depth:d,parentId:o,eccentricity:M}),i.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,v,m,b,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=Gr(o),n=new Map;for(const t of e)n.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;i.has(o)||i.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of i)for(let i=0;r>i;i++){const a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(l),y2:t+o*Math.cos(l)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Ar(t,"nodeSize")),n=d?d(Ar(t,"nodeStyle")):{},c={fill:n.fill||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:v.get(e.source),o="object"==typeof e.target?e.target:v.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=g(Ar(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(u=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==u?u:o.id;y.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,o,n,i)=>!1!==o.orbitAnimated&&(function(e,t){var o,n;const i=Gr(t),r=null!==(o=t.orbitSpeed)&&void 0!==o?o:.25,s=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const o=null!==(t=e.depth)&&void 0!==t?t:0;return(o%2==0?1:-1)/(o+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const o=c.get(e.parentId);if(!o)continue;const n=e.angle+a*l*s({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=o.x+e.ring*Math.sin(n),t.y=o.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)},Xr={sankey:jr,force:Cr,chord:Tr,tree:Fr,cluster:Fr,treemap:Fr,circlepack:Fr,partition:Fr,orbit:qr};function Vr(e){return Xr[e]}class Ur{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},Pi),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Li(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},Pi),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new Li(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:s="value"}=this.config,a="function"==typeof n?n:e=>e[n],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],u="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Kr(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=Number(u(o))||1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Kr(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Kr(i)),{data:o}));const s=`${n}\0${i}\0${e}`;this.edges.set(s,{source:n,target:i,value:r,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:s})}this.runLayout(o)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,i=0===this.nodes.size;let r=!1;const s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Kr(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,Kr(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,o,n,i,r,s,a,l;const c=Vr(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of u)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(o=a._prevX0)&&void 0!==o?o:0),c=(null!==(n=a._prevY1)&&void 0!==n?n:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0;const p=new Set(this.nodes.keys()),y=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of p)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)p.has(e)||this.removedNodes.add(e);for(const e of y)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)y.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=p,this.previousEdgeKeys=y,this.layoutVersion++}buildScene(e){const t=Vr(this.config.chartType);if(!t)return;const o=Array.from(this.nodes.values()),n=Array.from(this.edges.values()),{sceneNodes:i,sceneEdges:r,labels:s}=t.buildScene(o,n,this.config,e);this.sceneNodes=i,this.sceneEdges=r,this.labels=s}get isAnimating(){const e=Vr(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=Vr(this.config.chartType);if(!(null==o?void 0:o.tick))return!1;const n=Array.from(this.nodes.values()),i=Array.from(this.edges.values());return o.tick(n,i,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=ht(e,this.transition),o=dt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=gt(e._prevX0,e._targetX0,o),e.x1=gt(e._prevX1,e._targetX1,o),e.y0=gt(e._prevY0,e._targetY0,o),e.y1=gt(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=gt(e._prevY0,e._targetY0,o),e.y1=gt(e._prevY1,e._targetY1,o),e.sankeyWidth=gt(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=null==e?void 0:e.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,o="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&o&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,o))}buildStandardBezier(e,t,o){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=o.x0,s=Oe(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:n}}const i=t.x1,r=o.x0,s=Oe(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const i=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,s=o.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},o])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,o,n,i,r;const s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(o=s.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",c=null!==(n=s.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const n=this.nodeTimestamps.get(o);if(!n)continue;const i=e-n;a>i&&(t._pulseIntensity=1-i/a,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const o=t.datum;if(!o)continue;const n="object"==typeof o.source?null===(i=o.source)||void 0===i?void 0:i.id:o.source,s="object"==typeof o.target?null===(r=o.target)||void 0===r?void 0:r.id:o.target;if(!n||!s)continue;const c=this.edgeTimestamps.get(`${n}\0${s}`);if(!c)continue;const u=e-c;a>u&&(t._pulseIntensity=1-u/a,t._pulseColor=l)}}applyDecay(){var e,t;const o=this.config.decay;if(!o)return;const n=this.nodeTimestamps.size;if(1>=n)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const i=this._decaySortedNodes,r=new Map;for(let e=0;i.length>e;e++)r.set(i[e][0],e);for(const i of this.sceneNodes){const s=i.id;if(!s)continue;const a=r.get(s);if(void 0===a)continue;const l=ct(o,a,n),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const o=e-this.lastTopologyChangeTime;if(o>=2e3)return;const n=1-o/2e3;for(const e of this.sceneNodes){const o=e.id;o&&this.addedNodes.has(o)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,o;const n=this.config.thresholds;if(!n)return;const i=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(o=n.criticalColor)&&void 0!==o?o:"#ef4444",s=!1!==n.pulse;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const a=this.nodes.get(o);if(!a)continue;const l=n.metric(a);let c=null;void 0===n.critical||n.critical>l?void 0===n.warning||n.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const o=e.metric(t);if(void 0!==e.warning&&o>=e.warning||void 0!==e.critical&&o>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const o="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>o-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var o;const n=this.nodes.get(e);if(!n)return null;const i=n.data?Object.assign({},n.data):{};return n.data=t(null!==(o=n.data)&&void 0!==o?o:{}),this.layoutVersion++,i}updateEdge(e,t,o){var n;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=o(null!==(n=i.data)&&void 0!==n?n:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&this.layoutVersion++,s}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&n(i.data)===e&&o.push(t)}else for(const[n,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&this.layoutVersion++,o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Kr(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Qr(e,t,o,n,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=Zr(t,o,n,i);if(e)if("rect"===t.type){const o=t.w*t.h;a>o&&(r=e,a=o)}else s>e.distance&&(r=e,s=e.distance)}if(r)return r;for(const e of t){const t=ns(e,o,n);t&&s>t.distance&&(r=t,s=t.distance)}return r}function Zr(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const i=t-e.cx,r=o-e.cy,s=Math.sqrt(i*i+r*r);return s>Ct(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=jt(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const s=_t(Math.atan2(i,n)),a=_t(e.startAngle),l=_t(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);default:return null}}let Jr=null,es=null;function ts(){return es||(Jr=document.createElement("canvas"),Jr.width=1,Jr.height=1,es=Jr.getContext("2d")),es}function os(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function ns(e,t,o){switch(e.type){case"bezier":return function(e,t,o){var n,i;if(!e.pathD)return null;const r=os(e),s=ts();if(!r||!s)return null;try{if(s.isPointInPath(r,t,o)){const r="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,s="object"==typeof(null===(i=e.datum)||void 0===i?void 0:i.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:r&&s?(r.x1+s.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:o,distance:0}}const a=s.lineWidth;s.lineWidth=10;const l=s.isPointInStroke(r,t,o);if(s.lineWidth=a,l)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,i=e.y2-e.y1,r=n*n+i*i;if(0===r)return null;let s=((t-e.x1)*n+(o-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*i,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(o-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=os(e),i=ts();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);default:return null}}function is(i){const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:v="right",foregroundGraphics:m,sceneNodes:b,annotations:x,svgAnnotationRules:k}=i;return t(o,{children:[t("svg",{role:"img",width:a,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof d?d:"Network Chart"}),e("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((t,o)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+o)),x&&x.filter(e=>"widget"!==e.type).map((t,o)=>{if(k){const i=k(t,o,{width:r,height:s,sceneNodes:b});if(i)return e(n.Fragment,{children:i},"annotation-"+o)}return null}),m]}),d&&"string"==typeof d?e("text",{x:a/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor",children:d}):d?e("foreignObject",{x:0,y:0,width:a,height:c.top,children:d}):null,io({legend:h,totalWidth:a,totalHeight:l,margin:c,legendPosition:v,title:d,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==x?void 0:x.filter(e=>"widget"===e.type&&e.nodeId&&b).map((t,o)=>{var n,i,r,s,a,l,u,d,h;const g=b.find(e=>{var o,n,i,r,s;return e.id===t.nodeId||(null===(o=e.datum)||void 0===o?void 0:o.id)===t.nodeId||(null===(i=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!g)return null;const f=c.left+(null!==(n=g.cx)&&void 0!==n?n:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(i=g.x)&&void 0!==i?i:0),p=c.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),y=null!==(a=t.dx)&&void 0!==a?a:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,m=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{style:{position:"absolute",left:f+y-m/2,top:p+v-x/2,width:m,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+o)})]})}function rs(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function ss(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=rs(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=vn(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&vn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function as(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=vn(e,i)||i,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function ls(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=rs(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&vn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function cs(e,t){var o,n;if(!t.pathD)return;e.save();const i=rs(t),r=t.style.stroke||"#999";e.strokeStyle=vn(e,r)||r,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&vn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}is.displayName="NetworkSVGOverlay";const us={top:20,right:80,bottom:20,left:80},ds={top:40,right:40,bottom:40,left:40},hs=new Set(["chord","force","circlepack","orbit"]),gs=[800,600],fs={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function ps({data:o}){var n,i,r,s,a,l;if("edge"===o.nodeOrEdge){const e=o.data;return e?t("div",{className:"semiotic-tooltip",style:fs,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=o.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const o=[];let a=u;for(;a;){const e=null!==(s=null!==(i=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==i?i:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==s?s:c.id;null!=e&&o.unshift(e+""),a=a.parent}o.length>1&&o.shift();const l=o.length-1;return t("div",{className:"semiotic-tooltip",style:fs,children:[e("div",{children:o.map((o,n)=>t("span",{children:[n>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===l?e("strong",{children:o}):e("span",{style:{opacity:.7},children:o})]},n))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const d=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:fs,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}const ys=h(function(o,n){var a,l,u,h,f,p,y,v,m,b,x,k,w,A,S,O,j;const{chartType:C,nodes:M,edges:P,data:_,initialEdges:L,nodeIDAccessor:T="id",sourceAccessor:B="source",targetAccessor:D="target",valueAccessor:$="value",edgeIdAccessor:N,childrenAccessor:I,hierarchySum:H,orientation:W="horizontal",nodeAlign:R="justify",nodePaddingRatio:F=.05,nodeWidth:z=15,iterations:E=300,forceStrength:Y=.1,padAngle:G=.01,groupWidth:q=20,sortGroups:X,edgeSort:V,treeOrientation:U="vertical",edgeType:K="curve",padding:Q,paddingTop:Z,tensionConfig:J,showParticles:ee=!1,particleStyle:te,nodeStyle:oe,edgeStyle:ne,colorBy:ie,colorScheme:re="category10",edgeColorBy:se="source",edgeOpacity:ae=.5,colorByDepth:le=!1,nodeSize:ce=8,nodeSizeRange:ue=[5,20],nodeLabel:de,showLabels:he=!0,labelMode:ge,size:fe=gs,responsiveWidth:pe,responsiveHeight:ye,margin:ve,className:me,background:be,enableHover:ke=!0,tooltipContent:we,customHoverBehavior:Ae,customClickBehavior:Se,onObservation:Oe,chartId:je,onTopologyChange:Ce,annotations:Me,svgAnnotationRules:Pe,legend:_e,legendPosition:Le,legendHoverBehavior:Te,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:$e,title:Ne,foregroundGraphics:Ie,backgroundGraphics:He,decay:We,pulse:Fe,transition:ze,animate:Ee,staleness:Ye,thresholds:Ge,accessibleTable:qe=!0,description:Xe,summary:Ve,orbitMode:Ue,orbitSize:Ke,orbitSpeed:Qe,orbitRevolution:Ze,orbitRevolutionStyle:Je,orbitEccentricity:et,orbitShowRings:tt,orbitAnimated:nt}=o,it=hs.has(C)?ds:us,rt=i(!0),st=bn({sizeProp:fe,responsiveWidth:pe,responsiveHeight:ye,userMargin:ve,marginDefault:it,foregroundGraphics:Ie,backgroundGraphics:He,animate:Ee,transitionProp:ze,themeDirtyRef:rt}),{reducedMotionRef:at,responsiveRef:lt,size:ct,margin:ut,adjustedWidth:dt,adjustedHeight:ht,resolvedForeground:gt,resolvedBackground:ft,transition:pt,introEnabled:yt,tableId:vt,rafRef:mt,renderFnRef:bt,scheduleRender:xt,currentTheme:kt}=st,wt=r(()=>Object.assign(Object.assign({},Pi),J),[J]),At=r(()=>Object.assign(Object.assign({},_i),te),[te]),St=r(()=>{var e;return{chartType:C,nodeIDAccessor:T,sourceAccessor:B,targetAccessor:D,valueAccessor:$,edgeIdAccessor:N,childrenAccessor:I,hierarchySum:H,orientation:W,nodeAlign:R,nodePaddingRatio:F,nodeWidth:z,iterations:E,forceStrength:Y,padAngle:G,groupWidth:q,sortGroups:X,edgeSort:V,treeOrientation:U,edgeType:K,padding:Q,paddingTop:Z,tensionConfig:wt,showParticles:ee,particleStyle:At,nodeStyle:oe,edgeStyle:ne,nodeLabel:de,showLabels:he,labelMode:ge,colorBy:ie,colorScheme:re,themeCategorical:null===(e=null==kt?void 0:kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:Re(kt),edgeColorBy:se,edgeOpacity:ae,colorByDepth:le,nodeSize:ce,nodeSizeRange:ue,decay:We,pulse:Fe,transition:pt,introAnimation:yt,staleness:Ye,thresholds:Ge,orbitMode:Ue,orbitSize:Ke,orbitSpeed:Qe,orbitRevolution:Ze,orbitRevolutionStyle:Je,orbitEccentricity:et,orbitShowRings:tt,orbitAnimated:nt}},[C,T,B,D,$,I,H,W,R,F,z,E,Y,G,q,X,V,U,K,Q,Z,wt,ee,At,oe,ne,de,he,ge,ie,re,se,ae,le,ce,ue,We,Fe,null==pt?void 0:pt.duration,null==pt?void 0:pt.easing,yt,Ye,Ge,Ue,Ke,Qe,Ze,Je,et,tt,nt,kt]),Ot=i(null),jt=i(0),Ct=i(null);Ct.current||(Ct.current=new Ur(St));const[Mt,Pt]=d(null),[_t,Lt]=d(0),[Tt,Bt]=d(0),[Dt,$t]=d(!1),Nt=i(null),It=i(new Map),Ht=i(0),Wt=c(e=>{if("function"==typeof ie)return ie(e)+"";if("string"==typeof ie&&e.data){const t=e.data[ie];if(void 0!==t){if(!It.current.has(t+"")){const e=Array.isArray(re)?re:ot;It.current.set(t+"",e[Ht.current++%e.length])}return It.current.get(t+"")}}if(It.current.has(e.id))return It.current.get(e.id);const t=Array.isArray(re)?re:ot,o=ie?t[Ht.current++%t.length]:t[0];return It.current.set(e.id,o),o},[ie,re]),Rt=(null===(a=null==kt?void 0:kt.colors)||void 0===a?void 0:a.border)||(null===(l=null==kt?void 0:kt.colors)||void 0===l?void 0:l.secondary)||(null===(u=null==kt?void 0:kt.colors)||void 0===u?void 0:u.primary)||"#999",Ft=c(e=>{if("function"==typeof se)return se(e);const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===se&&o?Wt(o):t?Wt(t):Rt},[se,Wt,Rt]),Gt=c(e=>{if(!(null==te?void 0:te.colorBy))return Ft(e);const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===At.colorBy&&o?Wt(o):t?Wt(t):Rt},[null==te?void 0:te.colorBy,At.colorBy,Wt,Ft,Rt]),Xt="sankey"===C&&ee||!!Fe||null!==(f=null===(h=Ct.current)||void 0===h?void 0:h.isAnimating)&&void 0!==f&&f;s(()=>{var e;null===(e=Ct.current)||void 0===e||e.updateConfig(St),rt.current=!0,xt()},[St,xt]),s(()=>{var e;const t=Ct.current;if(t){t.buildScene([dt,ht]);for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&It.current.set(o.id,o.style.fill);rt.current=!0,xt()}},[kt,dt,ht,xt]);const Ut=c(()=>{var e;const t=Ct.current;if(!t)return;t.runLayout([dt,ht]),t.buildScene([dt,ht]),rt.current=!0;for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&It.current.set(o.id,o.style.fill);const o=Array.isArray(re)?re:ot,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];It.current.has(t.id)||It.current.set(t.id,o[e%o.length])}if(Ht.current=n.length,Lt(t.layoutVersion),Ce){const{nodes:e,edges:o}=t.getLayoutData();Ce(e,o)}},[dt,ht,Ce,re]),Kt=c(e=>{const t=Ct.current;t&&(t.ingestEdge(e)&&Ut(),xt())},[Ut,xt]),Qt=c(e=>{const t=Ct.current;if(!t)return;let o=!1;for(const n of e)t.ingestEdge(n)&&(o=!0);o&&Ut(),xt()},[Ut,xt]),Zt=c(()=>{var e;null===(e=Ct.current)||void 0===e||e.clear(),It.current.clear(),Ht.current=0,Lt(0),Pt(null),Nt.current=null,rt.current=!0,xt()},[xt]),Jt=c(()=>{const e=Ct.current;e&&(e.tension+=999,Ut(),xt())},[Ut,xt]);g(n,()=>({push:Kt,pushMany:Qt,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=Ct.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==o&&o;if(i){const t=(null===(n=Nt.current)||void 0===n?void 0:n.data)?"function"==typeof T?T(Nt.current.data):Nt.current.data[T]:void 0;Nt.current&&"node"===Nt.current.nodeOrEdge&&t===e&&(Nt.current=null,Pt(null)),It.current.delete(e),Ut(),rt.current=!0,xt()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=Ct.current)||void 0===o?void 0:o.removeEdge(e,t))&&void 0!==n&&n;if(i){if(Nt.current&&"edge"===Nt.current.nodeOrEdge){const o=Nt.current.data;let n;n=void 0!==t?("object"==typeof(null==o?void 0:o.source)?o.source.id:null==o?void 0:o.source)===e&&("object"==typeof(null==o?void 0:o.target)?o.target.id:null==o?void 0:o.target)===t:!N||!o||("function"==typeof N?N:e=>null==e?void 0:e[N])(o)===e,n&&(Nt.current=null,Pt(null))}Ut(),rt.current=!0,xt()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=Ct.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(rt.current=!0,xt()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=Ct.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(Ut(),rt.current=!0,xt()),r},clear:Zt,getTopology:()=>{var e,t;return null!==(t=null===(e=Ct.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Ct.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Jt,getTension:()=>{var e,t;return null!==(t=null===(e=Ct.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Kt,Qt,Zt,Jt,Ut,xt]);const eo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(C),to=eo?_||(Array.isArray(P)?void 0:P):void 0;s(()=>{var e;const t=Ct.current;if(t)if(eo&&to)t.ingestHierarchy(to,[dt,ht]),t.buildScene([dt,ht]),rt.current=!0,xt();else{const o=M||[],n=Array.isArray(P)?P:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[dt,ht]),t.buildScene([dt,ht]);for(const o of t.sceneNodes)o.id&&(null===(e=o.style)||void 0===e?void 0:e.fill)&&It.current.set(o.id,o.style.fill+"");const i=Array.isArray(re)?re:ot,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];It.current.has(t.id)||It.current.set(t.id,i[e%i.length])}Ht.current=r.length,rt.current=!0,xt()}},[M,P,_,to,eo,dt,ht,St,xt,re]),s(()=>{L&&L.length>0&&Qt(L)},[]);const oo=c(e=>{if(Ae&&Ae(e),Oe){const t=Date.now();Oe(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:je}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:je})}},[Ae,Oe,je]),no=c(e=>{if(Se&&Se(e),Oe){const t=Date.now();Oe(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:je}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:je})}},[Se,Oe,je]),{hoverHandlerRef:io,hoverLeaveRef:ro,onPointerMove:so,onPointerLeave:ao}=st;io.current=e=>{if(!ke)return;const t=Ot.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ut.left,i=e.clientY-o.top-ut.top;if(0>n||n>dt||0>i||i>ht)return void(Nt.current&&(Nt.current=null,Pt(null),oo&&(oo(null),rt.current=!0),xt()));const r=Ct.current;if(!r)return;const s=Qr(r.sceneNodes,r.sceneEdges,n,i);if(!s)return void(Nt.current&&(Nt.current=null,Pt(null),oo&&(oo(null),rt.current=!0),xt()));const a=Hn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Nt.current=a,Pt(a),oo&&(oo(a),rt.current=!0),xt()},ro.current=()=>{Nt.current&&(Nt.current=null,Pt(null),oo&&(oo(null),rt.current=!0),xt())};const lo=i(()=>{});lo.current=e=>{if(!Se&&!Oe)return;const t=Ot.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ut.left,i=e.clientY-o.top-ut.top;if(0>n||n>dt||0>i||i>ht)return;const r=Ct.current;if(!r)return;const s=Qr(r.sceneNodes,r.sceneEdges,n,i);no(s?Hn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const co=c(e=>lo.current(e),[]),uo=i(-1),ho=i(null),go=i(-1),fo=c(e=>{var t;const o=Ct.current;if(!o)return;const n=function(e){var t,o,n,i,r,s;const a=[];for(const l of e)"circle"===l.type&&null!=l.cx?a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(o=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==o?o:"_default"}):"rect"===l.type&&null!=l.x?a.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(n=l.datum)||void 0===n?void 0:n.id)&&void 0!==i?i:"_default"}):"arc"===l.type&&null!=l.cx&&a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(s=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});return a.sort((e,t)=>e.x-t.x||e.y-t.y),a}(o.sceneNodes);if(0===n.length)return;const i=zt(n),r=uo.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),uo.current=0,go.current=-1;const t=i.flat[0];ho.current={shape:t.shape,w:t.w,h:t.h};const o=Hn(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Nt.current=o,Pt(o),oo&&(oo(o),rt.current=!0),void xt()}const s=Et(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return Yt(e,t,o);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(s=function(e,t,o){let n=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;i>u&&(i=u,n=r)}return n}(o,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s:t.flatIndex;return n!==t.flatIndex&&(i.current=-1),n}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var o;const n=e+"",i=[];for(const e of t){const t=null!==(o=e.datum)&&void 0!==o?o:e,r=qt(t.source),s=qt(t.target),a=null!=r,l=null!=s;a&&r+""===n&&l?i.push(s+""):l&&s+""===n&&a&&i.push(r+"")}return i}(c,n);if(0===e.length)return t.flatIndex;const r=null!==(a=o.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const n=Yt(e,t,o);return null!==n&&n!==t.flatIndex&&(i.current=-1),n}}}(e.key,s,i,null!==(t=o.sceneEdges)&&void 0!==t?t:[],go);if(null===a)return;if(e.preventDefault(),0>a)return uo.current=-1,ho.current=null,go.current=-1,Nt.current=null,Pt(null),oo&&(oo(null),rt.current=!0),void xt();uo.current=a;const l=i.flat[a];ho.current={shape:l.shape,w:l.w,h:l.h};const c=l.datum||{},u=Object.assign(Object.assign({},"object"!=typeof c||null===c||Array.isArray(c)?{}:c),{data:c,x:l.x,y:l.y,time:l.x,value:l.y,nodeOrEdge:"node"});Nt.current=u,Pt(u),oo&&(oo(u),rt.current=!0),xt()},[oo,xt]),po=c(e=>{uo.current=-1,ho.current=null,so(e)},[so]);bt.current=()=>{var e,t,o,n,i,r,s;mt.current=0;const a=Ot.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=Ct.current;if(!c)return;const u=performance.now(),d=jt.current?Math.min((u-jt.current)/1e3,.1):.016;jt.current=u;const h=c.advanceTransition(at.current?u+1e6:u),g=!at.current&&h,f=!at.current&&c.tickAnimation([dt,ht],d);(h||rt.current||f)&&c.buildScene([dt,ht]);const p=kn();if(!xn(a,ct,ut,p))return;l.clearRect(-ut.left,-ut.top,ct[0],ct[1]),be&&(l.fillStyle=be,l.fillRect(0,0,dt,ht)),We&&c.applyDecay(),Fe&&c.applyPulse(u),Ge&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==Ye?void 0:Ye.threshold)&&void 0!==e?e:5e3,v=Ye&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(v&&(l.globalAlpha=null!==(t=null==Ye?void 0:Ye.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":ss(e,o);break;case"line":as(e,o);break;case"ribbon":ls(e,o);break;case"curved":cs(e,o)}}(l,c.sceneEdges),function(e,t){var o,n,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&vn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),Mn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&vn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),Pn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&vn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),ee&&c.particlePool&&!v){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,o,n){var i,r;const s=null!==(i=n.spawnRate)&&void 0!==i?i:_i.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:_i.maxPerEdge;for(let n=0;t.length>n;n++){const i=t[n];if(!i.bezier)continue;if(e.countForEdge(n)>=a)continue;const r=i.value*s*o*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,d,At);const t=.5*(null!==(o=At.speedMultiplier)&&void 0!==o?o:1);let n;if(At.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:_i.radius,l=null!==(s=n.opacity)&&void 0!==s?s:_i.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=o[s.edgeIndex];if(l){if("function"==typeof n.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?n.color(l,t):vn(e,"var(--semiotic-secondary, #666)")}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:i(l);e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,At,Gt)}}v&&(l.globalAlpha=1);const m=rt.current;if(rt.current=!1,m||g||f){const e=Ot.current;e&&e.setAttribute("aria-label",Yo(null!==(i=null===(n=c.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}(m||g||f)&&Bt(e=>e+1),(Xt||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(mt.current=requestAnimationFrame(()=>bt.current()))},s(()=>(xt(),()=>{}),[xt]),s(()=>{rt.current=!0,xt()},[C,dt,ht,be,xt]),Vt(Ye,Ct,rt,xt,Dt,$t);const yo=ke&&Mt?e(an,{x:Mt.x,y:Mt.y,containerWidth:dt,containerHeight:ht,margin:ut,className:"stream-network-tooltip",zIndex:2,children:we?we(Mt):e(ps,{data:Mt})}):null;if(Ho){const o=Ct.current;if(o){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(C),t=e?_||(Array.isArray(P)?void 0:P):void 0;if(e&&t)o.ingestHierarchy(t,[dt,ht]),o.buildScene([dt,ht]);else{const e=M||[],t=Array.isArray(P)?P:[];(e.length>0||t.length>0)&&(o.ingestBounded(e,t,[dt,ht]),o.buildScene([dt,ht]))}}const n=null!==(p=null==o?void 0:o.sceneNodes)&&void 0!==p?p:[],i=null!==(y=null==o?void 0:o.sceneEdges)&&void 0!==y?y:[],r=null!==(v=null==o?void 0:o.labels)&&void 0!==v?v:[];return t("div",{className:"stream-network-frame"+(me?" "+me:""),role:"img","aria-label":Xe||("string"==typeof Ne?Ne:"Network chart"),style:{position:"relative",width:ct[0],height:ct[1]},children:[e(tn,{summary:Ve}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ct[0],height:ct[1],style:{position:"absolute",left:0,top:0},children:[ft&&e("g",{transform:`translate(${ut.left},${ut.top})`,children:ft}),t("g",{transform:`translate(${ut.left},${ut.top})`,children:[be&&e("rect",{x:0,y:0,width:dt,height:ht,fill:be}),i.map((t,o)=>function(t,o){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e("path",{d:n.pathD,fill:Io(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"ribbon":{const n=t;return e("path",{d:n.pathD,fill:Io(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"curved":{const n=t;return e("path",{d:n.pathD,fill:Io(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+o)}default:return null}}(t,o)).filter(Boolean),n.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:Io(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+o)}case"rect":{const n=t;return e("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:Io(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=xe().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)({})||"";return e("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:Io(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+o)}default:return null}}(t,o)).filter(Boolean),r.map((t,o)=>function(t,o){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+o)}(t,o)).filter(Boolean)]})]}),e(is,{width:dt,height:ht,totalWidth:ct[0],totalHeight:ct[1],margin:ut,labels:r,sceneNodes:n,title:Ne,legend:_e,legendPosition:Le,legendHoverBehavior:Te,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:$e,foregroundGraphics:gt,annotations:Me,svgAnnotationRules:Pe,annotationFrame:0})]})}const vo=Ct.current;return t("div",{ref:lt,className:"stream-network-frame"+(me?" "+me:""),role:"group","aria-label":Xe||("string"==typeof Ne?Ne:"Network chart"),tabIndex:0,style:{position:"relative",width:pe?"100%":ct[0],height:ye?"100%":ct[1],overflow:"visible"},onKeyDown:fo,children:[qe&&e(on,{tableId:vt}),qe&&e(en,{nodes:null!==(m=null==vo?void 0:vo.sceneNodes)&&void 0!==m?m:[],edges:null!==(b=null==vo?void 0:vo.sceneEdges)&&void 0!==b?b:[],chartType:"Network chart",tableId:vt,chartTitle:"string"==typeof Ne?Ne:void 0}),e(tn,{summary:Ve}),t("div",{role:"img","aria-label":Xe||("string"==typeof Ne?Ne:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ke?po:void 0,onMouseLeave:ke?ao:void 0,onClick:Se||Oe?co:void 0,children:[ft&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ct[0],height:ct[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${ut.left},${ut.top})`,children:ft})}),e("canvas",{ref:Ot,"aria-label":Yo(null!==(k=null===(x=null==vo?void 0:vo.sceneNodes)||void 0===x?void 0:x.length)&&void 0!==k?k:0,null!==(A=null===(w=null==vo?void 0:vo.sceneEdges)||void 0===w?void 0:w.length)&&void 0!==A?A:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(nn,{hoverPoint:Mt}),e(is,{width:dt,height:ht,totalWidth:ct[0],totalHeight:ct[1],margin:ut,labels:(null==vo?void 0:vo.labels)||[],sceneNodes:null==vo?void 0:vo.sceneNodes,title:Ne,legend:_e,legendPosition:Le,legendHoverBehavior:Te,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:$e,foregroundGraphics:gt,annotations:Me,svgAnnotationRules:Pe,annotationFrame:Tt}),e(sn,{active:uo.current>=0,hoverPoint:Mt,margin:ut,size:ct,shape:null===(S=ho.current)||void 0===S?void 0:S.shape,width:null===(O=ho.current)||void 0===O?void 0:O.w,height:null===(j=ho.current)||void 0===j?void 0:j.h}),yo,(null==Ye?void 0:Ye.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ye.badgePosition?{top:4,left:4}:"bottom-left"===Ye.badgePosition?{bottom:4,left:4}:"bottom-right"===Ye.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Dt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Dt?"STALE":"LIVE"})]})]})});ys.displayName="StreamNetworkFrame";const vs={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function ms(e,t){return"function"==typeof t?t(e):e[t]}function bs(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function xs(o={}){const{fields:n,title:i,format:r,style:s={},className:a=""}=o;return o=>{if(!o||"object"!=typeof o)return null;let l;const c=[];if(i){const e=ms(o,i);l=bs(e,r)}if(n&&n.length>0)n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=ms(o,n);c.push({label:t,value:bs(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=bs(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=bs(o[e[0]],r))}}const u=Object.assign(Object.assign({},vs),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,o)=>t("div",{style:{marginTop:0===o&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},o))]})}}function ks(o={}){const{fields:n=[],title:i,format:r,style:s={},className:a="",showLabels:l=!0,separator:c=": "}=o;return o=>{if(!o||"object"!=typeof o)return null;const u=[];if(i){const e=ms(o,i);u.push({value:bs(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=bs(ms(o,n),i);u.push({label:l?t:void 0,value:s})}):Object.keys(o).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{u.push({label:l?e:void 0,value:bs(o[e],r)})});const d=Object.assign(Object.assign({},vs),s);return Array.isArray(u)&&0!==u.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:d,children:u.map((e,o)=>t("div",{style:{marginBottom:u.length-1>o?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},o))}):null}}function ws(t){if(!0===t)return xs();if("function"==typeof t){const o=t;return t=>{const n=o(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==n?null:e("div",{className:"semiotic-tooltip",style:vs,children:n})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?xs(t):xs())}function As(e){return"string"==typeof e?e:"value"}function Ss(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Os(e,t){if(!t)return Ss(e);try{const o=t(e);return null==o?Ss(e):o}catch(t){return Ss(e)}}function js(e,t){return"function"==typeof t?t(e):e[t]}function Cs(o){const n=o.find(e=>"title"===e.role),i=o.filter(e=>"title"!==e.role);return o=>{const r=o.data;if(!r)return null;const s=n?Os(js(r,n.accessor),n.format):null;return t("div",{className:"semiotic-tooltip",style:vs,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((o,n)=>{const i=Os(js(r,o.accessor),o.format);return t("div",{style:n>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[o.label,": "]}),e("span",{children:i})]},n)})]})}}function Ms({categoryAccessor:o,valueAccessor:n,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const u=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=js(u,o),h=js(u,n),g=i?js(u,i):void 0;return t("div",{className:"semiotic-tooltip",style:vs,children:[e("div",{style:{fontWeight:"bold"},children:Ss(d)}),e("div",{style:{marginTop:4},children:Os(h,a)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||As(i),": ",Ss(g)]})]})}}const Ps=a(null);function _s({colors:t,categories:o,colorScheme:n="category10",children:i}){const s=r(()=>{if(t)return t;if(o){const e=Array.isArray(n)?n:tt[n]||ot,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,n]);return e(Ps.Provider,{value:s,children:i})}function Ls(){return l(Ps)}function Ts(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function Bs(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Ts(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Ds(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}_s.displayName="CategoryColorProvider";const[$s,Ns]=He(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Ds(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Ds(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Is,Hs]=He(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Ws(e){const t=f(),o=e.clientId||t,{name:n}=e,i=Ns(e=>e.selections.get(n)),s=Ns(e=>e.setClause),a=Ns(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?Bs(i,o):()=>!0,[i,o]),isActive:l,selectPoints:c(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(n,{clientId:o,type:"point",fields:t})},[o,n,s]),selectInterval:c(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(n,{clientId:o,type:"interval",fields:t})},[o,n,s]),clear:c(()=>{a(n,o)},[a,n,o]),clientId:o}}function Rs(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Ws({name:t});return{onHover:c(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,s,t]),predicate:n,isActive:i}}function Fs(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function zs(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=Ws({name:t}),u=o&&n?"xyBrush":o?"xBrush":"yBrush",d=c(e=>{if(!e)return void l();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Fs(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Fs(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,o,n,a,l]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:l}}function Es(e,t,o){const n=Ns(e=>e.selections.get(t));return r(()=>{if(!n||0===n.clauses.size)return e;const t=Bs(n,o);return e.filter(t)},[e,n,o])}function Ys(e={}){const{limit:t=50,types:o,chartId:n}=e,i=Hs(e=>e.version),s=Hs(e=>e.observations),a=Hs(e=>e.clearObservations),l=r(()=>{let e=s;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[s,o,n,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const Gs=a(!1);function qs({selections:e}){const t=Ns(e=>e.setResolution);return s(()=>{for(const[o,n]of Object.entries(e))n.resolution&&t(o,n.resolution)},[e,t]),null}function Xs({categoryColors:t,interaction:o,selectionName:n,field:a}){const l=Object.entries(t);if(0===l.length)return null;const u=l.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:l.map(([e,t])=>({label:e,color:t})),label:""}],g=Rs({name:n,fields:[a]}),f=Ws({name:n,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[v,m]=d(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,s(()=>{"isolate"===o&&(p.size>0?b.current({[a]:Array.from(p)}):x.current())},[o,p,a]);const k=c(e=>{"highlight"===o&&(e?(m(e.label),g.onHover({[a]:e.label})):(m(null),g.onHover(null)))},[o,a,g]),w=c(e=>{"isolate"===o&&y(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===u.length?new Set:o})},[o,u.length]),[A,[S]]=cn([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const i of e){const e=26+7*i.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(l.map(([e])=>e),S),[l,S]);return e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e(to,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===o?k:void 0,customClickBehavior:"isolate"===o?w:void 0,highlightedCategory:v,isolatedCategories:p})})})}function Vs({children:o,selections:n,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:a="legend",legendField:l="category"}){const c=Ls(),u=void 0!==i?i:!(!c||0>=Object.keys(c).length);return e($s,{children:t(Is,{children:[n&&e(qs,{selections:n}),t(Gs.Provider,{value:u,children:[u&&"top"===r&&c&&e(Xs,{categoryColors:c,interaction:s,selectionName:a,field:l}),o,u&&"bottom"===r&&c&&e(Xs,{categoryColors:c,interaction:s,selectionName:a,field:l})]})]})})}function Us({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){const a=(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?n(s,t,o):o?o(i):nt[r%nt.length];return{label:i+"",color:a}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:a,label:""}]}}function Ks(e){return e?"string"==typeof e?{name:e}:e:null}function Qs(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}const Zs=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Js={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},ea={light:Ee,dark:Ye,"high-contrast":Ge,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function ta(e){return ea[e]}function oa(e,t=":root"){var o,n,i,r,s;const a=[];return a.push(` --semiotic-bg: ${e.colors.background};`),a.push(` --semiotic-text: ${e.colors.text};`),a.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),a.push(` --semiotic-grid: ${e.colors.grid};`),a.push(` --semiotic-border: ${e.colors.border};`),a.push(` --semiotic-primary: ${e.colors.primary};`),a.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&a.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&a.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&a.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&a.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(o=e.tooltip)||void 0===o?void 0:o.background)&&a.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(n=e.tooltip)||void 0===n?void 0:n.text)&&a.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&a.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&a.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(s=e.tooltip)||void 0===s?void 0:s.shadow)&&a.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&a.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&a.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&a.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&a.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&a.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),a.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),a.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&a.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&a.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&a.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&a.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&a.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${a.join("\n")}\n}`}function na(e){var t,o,n,i,r,s;return{semiotic:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.text)||e.colors.text,$type:"color"},radius:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(s=e.colors.selectionOpacity)&&void 0!==s?s:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{}),{secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"}}),e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{}),e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{}),e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{}),e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{}),e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{})}}const ia=n.createContext(void 0);function ra({theme:e}){const t=Xe(e=>e.setTheme),o=Xe(e=>e.theme),i=n.useRef(o);i.current=o;const r=n.useRef(null);return n.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=i.current,t(Ge)),ln(o,e=>{var o;e.matches?(r.current=i.current,t(Ge)):(t(null!==(o=r.current)&&void 0!==o?o:Ee),r.current=null)})},[e,t]),n.useEffect(()=>{if(void 0!==e)if("string"==typeof e){const o=ta(e);t(o||e)}else t(e)},[e,t]),null}function sa({children:t}){var o,i,r,s,a;const l=Xe(e=>e.theme),c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(o=l.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),u=n.useContext(ia),d={};return u&&(d["data-semiotic-theme"]=u),e("div",Object.assign({style:c},d,{children:t}))}function aa({theme:o,children:n}){const i="string"==typeof o&&ta(o)?o:void 0;return e(qe,{children:t(ia.Provider,{value:i,children:[e(ra,{theme:o}),e(sa,{children:n})]})})}function la(){return Xe(e=>e.theme)}const ca="#007bff";function ua(){var e;const t=la(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function da(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=tt[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:ca}function ha(e,t,o){const n=Ls(),i=ua();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=at(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return at(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=at(e,t,s);return e=>n[e]||o(e)}return at(e,t,s)}if(n&&Object.keys(n).length>0){const e=at([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}function ga(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}function fa({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:i,chartType:a,chartId:l,onClick:u,hoverHighlight:h,colorByField:g}){const p=f(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,o),v=Ws({name:(null==e?void 0:e.name)||"__unused__"}),m=Rs({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=Hs(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=d(null),A=g||o[0],S=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[h,k,A]),O=c(e=>{var o,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,o){const n=ko.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(ko={positions:new Map(ko.positions).set(e,{xValue:t,sourceId:o})},Ao())}(y.name||"hover",Number(e),p)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&So(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[A];w(null!=o?o+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,m,y,p,i,a,l,b,h,A]),j=c(e=>{var t,o,n,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[y.xField];null!=o&&Number.isFinite(Number(o))&&function(e,t,o){const n=ko.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(ko.positions);return t.delete(e),ko={positions:t},Ao(),!1}ko={positions:new Map(ko.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Ao()}(y.name||"hover",Number(o),p)}if(e&&u){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),u(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[u,i,b,a,l,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Oo(e,p),So(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:j,crosshairSourceId:p}}function pa(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function ya({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:c}){const u=l(Gs),d=void 0!==n?n:!u&&!!t,h=r(()=>{if(!d||!t)return;const n=Us({data:e,colorBy:t,colorScale:o,getColor:st,categories:c}),i=n.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?n:void 0},[d,t,e,o,c]),g=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return h&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,h,i]);return{legend:h,margin:g,legendPosition:i}}function va(e,t,o){const[n,i]=d(null),[s,a]=d(new Set),l=c(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=c(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return s.has(n)}}:null},[e,t,n,s]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:u,legendSelectionHook:h}}const ma={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function ba(e,t,o){var n,i,r,s,a,l,c;const u=ma[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:xa(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function xa(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function ka(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function wa({componentName:o,message:n,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:o}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Aa extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e(wa,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Sa(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function Oa(e,t,o=3){let n,i=o+1;for(const o of t){const t=Sa(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}function ja(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Ca(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=Oa(e,t,3))&&void 0!==o?o:null)}function Ma({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(o){const n=ja(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=Ca(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function Pa({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function _a({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==o)return null;if(i&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const o=ja(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in o)){const o=Ca(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}const La={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Ta={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Ba={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Da=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],$a=["vertical","horizontal"],Na={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Da},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Da},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Da},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ta),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$a},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$a},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:$a},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$a},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$a},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$a},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$a},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$a},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},La),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},La),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},La),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},La),Ba),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},La),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},La),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:$a},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},La),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},La),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},La),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},La),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},La),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},La),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},La),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},La),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},La),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},La),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},La),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Ia(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Ha=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Wa=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Ra=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Fa=new Set(["LineChart","AreaChart","StackedAreaChart"]),za=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Ea(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[o,n,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(o)+.7152*r(n)+.0722*r(i)}function Ya(e,t){const o=Ea(e),n=Ea(t);return null===o||null===n?null:(Math.max(o,n)+.05)/(Math.min(o,n)+.05)}const Ga=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];var qa;const Xa="undefined"!=typeof process&&"production"!==(null===(qa=process.env)||void 0===qa?void 0:qa.NODE_ENV);function Va({componentName:t,width:o,height:n,chartProps:i,children:r}){return e(Aa,{fallback:r=>{let s="";if(Xa&&i)try{const e=function(e,t){const o=[],n=function(e,t){const o=[],n=Na[e];if(!n)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Na).join(", ")}`]};for(const i of n.required)null==t[i]&&o.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=n.props[e];if(t){if(!Ia(i,t.type)){const n=Array.isArray(t.type)?t.type.join(" | "):t.type;o.push(`"${e}" should be ${n}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&o.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(n.props),r=new Set(i);for(const n of Object.keys(t))if(void 0!==t[n]&&!r.has(n)){const t=Oa(n,i),r=t?`Unknown prop "${n}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${n}" for ${e}. Valid props: ${i.join(", ")}.`;o.push(r)}if("array"===n.dataShape){const i=t.data,r={};for(const e of n.dataAccessors){const o=t[e];"string"==typeof o&&(r[e]=o)}const s=Ma({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&o.push(s)}else if("object"===n.dataShape){const n=Pa({componentName:e,data:t.data});n&&o.push(n)}else if("network"===n.dataShape){const i=_a({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:n.required.includes("nodes"),edgesRequired:n.required.includes("edges")});i&&o.push(i)}return{valid:0===o.length,errors:o}}(e,t);for(const e of n.errors)o.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Na[e]?(function(e,t,o){const n=Na[e];if(n){if("array"===n.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&o.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===n.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&o.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,o),function(e,t,o){const n=t.width,i=t.height;if(void 0===n||"number"==typeof n&&n>0||o.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(n)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||o.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,n]=t.size;(null!=e&&0>=e||null!=n&&0>=n)&&o.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${n}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,o),function(e,t,o){const n=Na[e];if(!n||"array"!==n.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of n.dataAccessors){const n=t[e];"string"==typeof n&&(n in r||o.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${n}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,o),function(e,t,o){Ha.has(e)&&Array.isArray(t.data)&&o.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,o),function(e,t,o){Wa.has(e)&&(t.edges||t.data||o.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,o),function(e,t,o){const n=Na[e];if(!n||"array"!==n.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&o.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,o),function(e,t,o){t.linkedHover&&!t.selection&&o.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,o),function(e,t,o){var n;if(!Ra.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&o.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(n=i[1])&&void 0!==n?n:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,o),function(e,t,o){if(!Fa.has(e))return;if(t.gapStrategy)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=t.yAccessor||"y";"string"==typeof i&&n.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&o.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,o),function(e,t,o){var n,i;const r=null!==(n=t.width)&&void 0!==n?n:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||o.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||o.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,o),function(e,t,o){var n;const i=Na[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let o=0;a>o;o++){const i=null===(n=r[o])||void 0===n?void 0:n[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&o.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,o),function(e,t,o){if(!za.has(e))return;const n=t.barPadding;"number"==typeof n&&10>n&&o.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${n} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,o),function(e,t,o){if("bottom"!==t.legendPosition)return;const n=t.margin;if(!n||"object"!=typeof n)return;const i=n.bottom;"number"==typeof i&&70>i&&o.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,o),function(e,t,o){var n;if(!t.showLegend)return;if("right"!==(null!==(n=t.legendPosition)&&void 0!==n?n:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&o.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,o),function(e,t,o){if("Heatmap"!==e)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=n[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const n=t[e];if("string"!=typeof n)continue;const r=i[n];"string"==typeof r&&o.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${n}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Ya(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&o.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n)||2>n.length)return;const i=n.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=Ya(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&o.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,o),function(e,t,o){const n="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;n||i||r||o.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,o),function(e,t,o){const n=[];for(const e of Ga)"function"==typeof t[e]&&n.push(e);n.length>0&&o.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${n.length>1?"s":""} detected: ${n.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,o),{ok:o.every(e=>"warning"===e.severity),diagnoses:o}):{ok:0===o.length,diagnoses:o}}(t,i);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e(wa,{componentName:t,message:r.message,diagnosticHint:s,width:o,height:n})},children:r})}const Ua={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Ka={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Qa(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Ua),{width:o,height:n}),children:i||"No data available"}):null}function Za(t,o,n){if(!t)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return e("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,n)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ka),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}function Ja(e,t,o,n){if(!Xa)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function el(e){const t=Xe(e=>e.theme.colors.selectionOpacity);return r(()=>{var o,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}function tl(e){const{data:t,rawData:o,colorBy:n,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:v,onClick:m,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,S="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:O,hoverSelectionHook:j,customHoverBehavior:C,customClickBehavior:M,crosshairSourceId:P}=fa({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:m,hoverHighlight:b,colorByField:S}),_=pa(c,P),L=ha(t,n,i),T=r(()=>{if(!n)return[];const e=new Set;for(const o of t){const t="function"==typeof n?n(o):o[n];null!=t&&e.add(t+"")}return Array.from(e)},[t,n]),B=va(s,n,T),D=r(()=>j||(B.legendSelectionHook?B.legendSelectionHook:O),[j,B.legendSelectionHook,O]),$=el(l),{legend:N,margin:I,legendPosition:H}=ya({data:t,colorBy:n,colorScale:L,showLegend:p,legendPosition:a,userMargin:y,defaults:v}),W=r(()=>{const e={};return N&&(e.legend=N,e.legendPosition=H),s&&"none"!==s&&(e.legendHoverBehavior=B.onLegendHover,e.legendClickBehavior=B.onLegendClick,e.legendHighlightedCategory=B.highlightedCategory,e.legendIsolatedCategories=B.isolatedCategories),e},[N,H,s,B.onLegendHover,B.onLegendClick,B.highlightedCategory,B.isolatedCategories]),R=Za(x,w,A),F=R?null:Qa(o,w,A,k);return{colorScale:L,allCategories:T,legendState:B,effectiveSelectionHook:D,activeSelectionHook:O,customHoverBehavior:C,customClickBehavior:M,legend:N,margin:I,legendPosition:H,earlyReturn:R||F||null,legendBehaviorProps:W,crosshairProps:_,resolvedSelection:$}}const ol=h(function(t,o){const s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:p="x",yAccessor:y="y",colorBy:v,colorScheme:m,sizeBy:b,sizeRange:x=[3,15],pointRadius:k=5,pointOpacity:w=.8,tooltip:A,marginalGraphics:S,pointIdAccessor:O,annotations:j,frameProps:C={},selection:M,linkedHover:P,linkedBrush:_,onObservation:L,onClick:T,hoverHighlight:B,chartId:D,loading:$,emptyContent:N,legendInteraction:I,legendPosition:H,color:W,stroke:R,strokeWidth:F,opacity:z}=t,E=a.width,Y=a.height,G=a.enableHover,q=a.showGrid,X=a.title,V=a.description,U=a.summary,K=a.accessibleTable,Q=a.xLabel,Z=a.yLabel,J=l||[],ee=tl({data:J,rawData:l,colorBy:v,colorScheme:m,legendInteraction:I,legendPosition:H,selection:M,linkedHover:P,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:B,chartType:"Scatterplot",chartId:D,showLegend:a.showLegend,userMargin:u,marginDefaults:a.marginDefaults,loading:$,emptyContent:N,width:E,height:Y}),te=Ks(_),oe=zs({name:(null==te?void 0:te.name)||"__unused_brush__",xField:(null==te?void 0:te.xField)||("string"==typeof p?p:void 0),yField:(null==te?void 0:te.yField)||("string"==typeof y?y:void 0)}),ne=te?"xyBrush"===oe.brushInteraction.brush?"xy":"xBrush"===oe.brushInteraction.brush?"x":"y":void 0,ie=n.useRef(oe.brushInteraction);ie.current=oe.brushInteraction;const re=c(e=>{const t=ie.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(ee.earlyReturn)return ee.earlyReturn;Ja("Scatterplot",J,"xAccessor",p),Ja("Scatterplot",J,"yAccessor",y);const se=r(()=>{if(!b||0===J.length)return;const e=J.map(e=>"function"==typeof b?b(e):e[b]);return[Math.min(...e),Math.max(...e)]},[J,b]),ae=r(()=>e=>{const t={fillOpacity:w};return v?ee.colorScale&&(t.fill=st(e,v,ee.colorScale)):t.fill=W||ca,t.r=b?lt(e,b,x,se):k,t},[v,ee.colorScale,b,x,se,k,w,W]),le=r(()=>ka(ae,{stroke:R,strokeWidth:F,opacity:z}),[ae,R,F,z]),ce=r(()=>Qs(le,ee.effectiveSelectionHook,ee.resolvedSelection),[le,ee.effectiveSelectionHook,ee.resolvedSelection]),ue=r(()=>Cs([{label:Q||As(p),accessor:p,role:"x",format:h},{label:Z||As(y),accessor:y,role:"y",format:f},...v?[{label:As(v),accessor:v,role:"color"}]:[],...b?[{label:As(b),accessor:b,role:"size"}]:[]]),[p,y,Q,Z,v,b,h,f]),de=Ma({componentName:"Scatterplot",data:l,accessors:{xAccessor:p,yAccessor:y}});if(de)return e(wa,{componentName:"Scatterplot",message:de,width:E,height:Y});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:J}),{xAccessor:p,yAccessor:y,colorAccessor:v||void 0,sizeAccessor:b||void 0,sizeRange:x,pointStyle:ce,colorScheme:m,size:[E,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,showAxes:a.showAxes,xLabel:Q,yLabel:Z,xFormat:h,yFormat:f,enableHover:G,showGrid:q}),ee.legendBehaviorProps),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===A?()=>null:ws(A)||ue}),(P||L||T||B)&&{customHoverBehavior:ee.customHoverBehavior}),(L||T||P)&&{customClickBehavior:ee.customClickBehavior}),S&&{marginalGraphics:S}),O&&{pointIdAccessor:O}),j&&j.length>0&&{annotations:j}),te&&{brush:{dimension:ne},onBrush:re}),ee.crosshairProps),C);return e(Va,{componentName:"Scatterplot",width:E,height:Y,children:e(Un,Object.assign({ref:s},he))})});function nl(e,t){return C(1===t?.5:e/(t-1))}ol.displayName="Scatterplot";const il=h(function(t,n){var s;const a=i(null);g(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,className:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:p="y",orderAccessor:y,orderLabel:v,pointRadius:m=4,tooltip:b,pointIdAccessor:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:_,legendInteraction:L,stroke:T,strokeWidth:B,opacity:D}=t,$=l.width,N=l.height,I=l.enableHover,H=l.showGrid,W=l.title,R=l.description,F=l.summary,z=l.accessibleTable,E=l.xLabel,Y=l.yLabel,G=c||[],{safeData:q,orderMap:X}=r(()=>{const e="function"==typeof f?f:e=>e[f],t="function"==typeof p?p:e=>e[p];let o=G;if(y&&G.length>0){const e="function"==typeof y?y:e=>e[y];o=[...G].sort((t,o)=>{const n=e(t),i=e(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const n=new WeakMap;let i=0;for(const n of o){const o=e(n),r=t(n);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i++}let r=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&n.set(s,{idx:r++,total:i})}return{safeData:o,orderMap:n}},[G,y,f,p]);Ja("ConnectedScatterplot",q,"xAccessor",f),Ja("ConnectedScatterplot",q,"yAccessor",p);const{activeSelectionHook:V,hoverSelectionHook:U,customHoverBehavior:K,customClickBehavior:Q,crosshairSourceId:Z}=fa({selection:A,linkedHover:S,fallbackFields:[],onObservation:O,onClick:j,chartType:"ConnectedScatterplot",chartId:M,hoverHighlight:C,colorByField:void 0}),J=el(A),ee=pa(S,Z),te=va(L,void 0,[]),oe=r(()=>U||(te.legendSelectionHook?te.legendSelectionHook:V),[U,te.legendSelectionHook,V]),ne=null!==(s=null==J?void 0:J.unselectedOpacity)&&void 0!==s?s:.5,ie=r(()=>(e,t)=>{var o,n;const i=t.filter(e=>"point"===e.type);if(2>i.length)return;const r=null==oe?void 0:oe.isActive,s=null==oe?void 0:oe.predicate,a=100>i.length,l=i.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=i[t],u=i[t+1],d=nl(t,l),h=!r||!s||s(null!==(o=c.datum)&&void 0!==o?o:c)||s(null!==(n=u.datum)&&void 0!==n?n:u),g=r?h?1:ne:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=m,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[m,oe,ne]),re=r(()=>[ie],[ie]),se=r(()=>(t,n,i)=>{var r,s;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const l=a.length,c=100>l,u=[];for(let t=0;l-1>t;t++){const o=a[t],n=a[t+1],i=nl(t,l),d="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,h="number"==typeof(null===(s=n.style)||void 0===s?void 0:s.opacity)?n.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:i,strokeWidth:m,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(o,{children:u})},[m]),ae=r(()=>[se],[se]),le=r(()=>e=>{var t,o;const n=X.get(e),i=null!==(t=null==n?void 0:n.idx)&&void 0!==t?t:0,r=null!==(o=null==n?void 0:n.total)&&void 0!==o?o:1;return{fill:r>0?nl(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,X]),ce=r(()=>ka(le,{stroke:T,strokeWidth:B,opacity:D}),[le,T,B,D]),ue=r(()=>Qs(ce,oe,J),[ce,oe,J]),de=Object.assign({top:50,right:40,bottom:60,left:70},"number"==typeof t.margin?{top:t.margin,bottom:t.margin,left:t.margin,right:t.margin}:t.margin),he=v||("string"==typeof y?y:"Order"),ge=r(()=>Cs([{label:E||As(f),accessor:f,role:"x",format:d},{label:Y||As(p),accessor:p,role:"y",format:h},...y?[{label:he,accessor:y,role:"group"}]:[]]),[f,p,E,Y,y,he,d,h]),fe=Ma({componentName:"ConnectedScatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}}),pe=Za(P,$,N),ye=pe?null:Qa(c,$,N,_),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:q}),{xAccessor:f,yAccessor:p,pointStyle:ue,size:[$,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de,showAxes:l.showAxes,xLabel:E,yLabel:Y,xFormat:d,yFormat:h,enableHover:I,showGrid:H}),W&&{title:W}),R&&{description:R}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:ws(b)||ge}),(S||O||j||C)&&{customHoverBehavior:K}),(O||j||S)&&{customClickBehavior:Q}),x&&{pointIdAccessor:x}),{canvasPreRenderers:re,svgPreRenderers:ae}),k&&k.length>0&&{annotations:k}),ee),w);return pe||ye||(fe?e(wa,{componentName:"ConnectedScatterplot",message:fe,width:$,height:N}):e(Va,{componentName:"ConnectedScatterplot",width:$,height:N,children:e(Un,Object.assign({ref:a},ve))}))});function rl(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof o?e:new o(function(t){t(e)})}(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())})}il.displayName="ConnectedScatterplot","function"==typeof SuppressedError&&SuppressedError;const sl="__forecastSegment";let al=null;function ll(){return rl(this,void 0,void 0,function*(){return al||(al=yield import("./semiotic-statisticalOverlays-Ckd_jM8z.js")),al})}const cl=h(function(o,n){var a,l;const u=i(null);g(n,()=>({push:e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=u.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=u.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=u.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=u.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const h=ba(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,summary:o.summary,accessibleTable:o.accessibleTable,xLabel:o.xLabel,yLabel:o.yLabel}),{data:f,margin:p,className:y,xFormat:v,yFormat:m,xAccessor:b="x",yAccessor:x="y",lineBy:k,lineDataAccessor:w="coordinates",colorBy:A,colorScheme:S,curve:O="linear",showPoints:j=!1,pointRadius:C=3,fillArea:M=!1,areaOpacity:P=.3,lineWidth:_=2,lineGradient:L,tooltip:T,pointIdAccessor:B,annotations:D,directLabel:$,gapStrategy:N="break",anomaly:I,forecast:H,frameProps:W={},selection:R,linkedHover:F,onObservation:z,onClick:E,hoverHighlight:Y,hoverRadius:G,chartId:q,loading:X,emptyContent:V,legendInteraction:U,legendPosition:K,xScaleType:Q,yScaleType:Z,color:J,stroke:ee,strokeWidth:te,opacity:oe}=o,ne=h.width,ie=h.height,re=h.enableHover,se=h.showGrid,ae=h.showLegend,le=h.title,ce=h.description,ue=h.summary,de=h.accessibleTable,he=h.xLabel,ge=h.yLabel,fe=Za(X,ne,ie),pe=fe?null:Qa(f,ne,ie,V),ye=f||[];Ja("LineChart",ye,"xAccessor",b),Ja("LineChart",ye,"yAccessor",x);const ve="string"==typeof b?b:"__semiotic_resolvedX",me="string"==typeof x?x:"__semiotic_resolvedY",[be,xe]=d(null),[ke,we]=d([]),Ae=r(()=>{if(!H&&!I)return ye;const e="function"==typeof b,t="function"==typeof x;return e||t?ye.map(o=>{const n=Object.assign({},o);return e&&(n.__semiotic_resolvedX=b(o)),t&&(n.__semiotic_resolvedY=x(o)),n}):ye},[ye,H,I,b,x]),Se=i(H),Oe=i(I);s(()=>{if(!H&&!I)return void((Se.current||Oe.current)&&(xe(null),we([]),Se.current=H,Oe.current=I));let e=!1;const t=H!==Se.current||I!==Oe.current;if(Se.current=H,Oe.current=I,t&&(xe(null),we([])),H){const t=k&&"string"==typeof k&&"object"==typeof H?Object.assign(Object.assign({},H),{_groupBy:k}):H;(function(...e){return rl(this,void 0,void 0,function*(){return(yield ll()).buildForecast(...e)})})(Ae,ve,me,t,I).then(t=>{e||(xe(t),we(t.annotations))}).catch(()=>{e||(xe(null),we([]))})}else I&&function(...e){return rl(this,void 0,void 0,function*(){return(yield ll()).buildAnomalyAnnotations(...e)})}(I).then(t=>{e||(xe(null),we(t))}).catch(()=>{e||we([])});return()=>{e=!0}},[Ae,H,I,ve,me]);const je=be?be.processedData:ye,Ce="__compoundGroup",Me=!(!H||!k),Pe=Me?Ce:H?sl:k,_e=r(()=>{if(!Me)return je;const e="function"==typeof k?k:e=>e[k];return je.map(t=>{const o=Object.assign({},t);return o[Ce]=`${e(t)}__${t[sl]||"observed"}`,o})},[je,Me,k]),Le=Me?_e:je,Te=r(()=>{if(!H)return;const e=H.upperBounds,t=H.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be?be.processedData:ye;for(const e of s){const t="function"==typeof x?x(e):+e[x];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[H,be,ye,x]),{activeSelectionHook:Be,hoverSelectionHook:De,customHoverBehavior:$e,customClickBehavior:Ne,crosshairSourceId:Ie}=fa({selection:R,linkedHover:F,fallbackFields:A?["string"==typeof A?A:""]:[],onObservation:z,onClick:E,chartType:"LineChart",chartId:q,hoverHighlight:Y,colorByField:"string"==typeof A?A:void 0}),He=el(R),We=pa(F,Ie),Re=c(e=>{const t="function"==typeof b?b(e):e[b],o="function"==typeof x?x(e):e[x];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[b,x]),Fe=void 0!==(null===(a=Le[0])||void 0===a?void 0:a[w]),ze=r(()=>{if(Fe)return Le;if(Pe){const e=Le.reduce((e,t)=>{const o="function"==typeof Pe?Pe(t):t[Pe];if(!e[o]){const n={[w]:[]};"string"==typeof Pe&&(n[Pe]=o),Me&&(n[sl]=t[sl],"string"==typeof k&&(n[k]=t[k])),e[o]=n}return e[o][w].push(t),e},{});return Object.values(e)}return[{[w]:Le}]},[Le,Pe,w,Fe]),{gapProcessedLineData:Ee,hasGaps:Ye}=r(()=>{if("interpolate"===N){let e=!1;const t=[];for(const o of ze){const n=(o[w]||[]).filter(t=>!Re(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[w]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const o of ze){const n=o[w]||[];let i=[],r=0;const s=Pe&&"string"==typeof Pe?o[Pe]:void 0;for(const a of n)if(Re(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[w]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},o),{[w]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof x?x:"y",o=[];for(const n of ze){const i=n[w]||[],r=[];for(const o of i)Re(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[w]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:ze,hasGaps:!1}},[ze,N,w,Re,Pe,x]),Ge=ha(je,A,S),qe=r(()=>{if(!A)return[];const e=new Set;for(const t of je){const o="function"==typeof A?A(t):t[A];null!=o&&e.add(o+"")}return Array.from(e)},[je,A]),Xe=va(U,A,qe),Ve=r(()=>De||(Xe.legendSelectionHook?Xe.legendSelectionHook:Be),[De,Xe.legendSelectionHook,Be]),Ue=r(()=>(e,t)=>{const o={strokeWidth:_},n=!0===M||Array.isArray(M)&&null!=t&&M.includes(t);return A?Ge&&(o.stroke=st(e,A,Ge),n&&(o.fill=o.stroke,o.fillOpacity=P)):(o.stroke=J||ca,n&&(o.fill=J||ca,o.fillOpacity=P)),o},[A,Ge,_,M,P,J]),[Ke,Qe]=d(null);s(()=>{if(!H)return void Qe(null);let e=!1;return function(...e){return rl(this,void 0,void 0,function*(){return(yield ll()).createSegmentLineStyle(...e)})}(Ue,H).then(t=>{e||Qe(()=>t)}).catch(()=>{e||Qe(null)}),()=>{e=!0}},[Ue,H]);const Ze=Ke||Ue,Je=r(()=>ka(Ze,{stroke:ee,strokeWidth:te,opacity:oe}),[Ze,ee,te,oe]),et=r(()=>Qs(Je,Ve,He),[Je,Ve,He]),tt=r(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return A?Ge&&(t.fill=st(e.parentLine||e,A,Ge)):t.fill=J||ca,t}},[j,C,A,Ge,J]),ot=Array.isArray(M)?"mixed":M?"area":"line",nt="object"==typeof $?$:{},it=nt.position||"end",rt=nt.fontSize||11,at=r(()=>{var e,t;if(!$||!A)return[];const o="function"==typeof b?b:e=>e[b],n="function"==typeof x?x:e=>e[x],i="function"==typeof A?A:e=>e[A],r=new Map;for(const o of Ee){const n=o[w]||[];if(0===n.length)continue;const s="end"===it?n[n.length-1]:n[0],a=null!==(t=null!==(e=i(s))&&void 0!==e?e:i(o))&&void 0!==t?t:"";a&&!r.has(a+"")&&r.set(a+"",s)}const s=Array.from(r.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof b?b:"x"]:o(t),["string"==typeof x?x:"y"]:n(t),dx:"end"===it?6:-6,dy:0,color:Ge?Ge(e):ca,fontSize:rt}));s.sort((e,t)=>{const o="string"==typeof x?x:"y";return e[o]-t[o]});for(let e=1;s.length>e;e++){const t="string"==typeof x?x:"y",o=s[e-1],n=s[e];rt+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=rt+2)}return s},[$,A,Ge,Ee,w,b,x,it,rt]),lt=(!$||void 0!==ae)&&ae,ct=r(()=>{if(!$)return h.marginDefaults;const e=at.reduce((e,t)=>{var o;const n=((null===(o=t.label)||void 0===o?void 0:o.length)||0)*(.6*rt);return Math.max(e,n)},0),t=e+10,o="end"===it?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[o]:Math.max(h.marginDefaults[o]||0,t)})},[$,at,rt,it,h.marginDefaults]),{legend:ut,margin:dt,legendPosition:ht}=ya({data:Ee,colorBy:A,colorScale:Ge,showLegend:lt,legendPosition:K,userMargin:p,defaults:ct}),gt=k||A,ft=r(()=>Cs([{label:he||As(b),accessor:b,role:"x",format:v},{label:ge||As(x),accessor:x,role:"y",format:m},...gt?[{label:As(gt),accessor:gt,role:"group"}]:[]]),[b,x,he,ge,gt,v,m]),pt=Ma({componentName:"LineChart",data:Fe?(null===(l=je[0])||void 0===l?void 0:l[w])||[]:f,accessors:{xAccessor:b,yAccessor:x}}),yt=r(()=>Fe||Pe||Ye?Ee.flatMap(e=>{const t=e[w]||[];return Pe&&"string"==typeof Pe?t.map(t=>Object.assign(Object.assign({},t),{[Pe]:e[Pe]})):t}):Le,[Ee,w,Fe,Pe,Le,Ye]),vt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ot},Array.isArray(M)&&{areaGroups:M}),L&&{lineGradient:L}),null!=G&&{hoverRadius:G}),null!=f&&{data:yt}),{xAccessor:b,yAccessor:x,xScaleType:Q,yScaleType:Z}),Te&&{yExtent:Te}),{groupAccessor:"break"===N&&Ye?"_gapSegment":Pe||void 0,curve:O,lineStyle:et}),j&&{pointStyle:tt}),{size:[ne,ie],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:dt,showAxes:h.showAxes,xLabel:he,yLabel:ge,xFormat:v,yFormat:m,enableHover:re,showGrid:se}),ut&&{legend:ut,legendPosition:ht}),U&&"none"!==U&&{legendHoverBehavior:Xe.onLegendHover,legendClickBehavior:Xe.onLegendClick,legendHighlightedCategory:Xe.highlightedCategory,legendIsolatedCategories:Xe.isolatedCategories}),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),y&&{className:y}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===T?()=>null:"multi"===T?o=>{var n,i,r,s,a,l,c,u,d,h;const g=o.allSeries;if(!g||0===g.length){const t=null!==(a=null!==(s=null!==(i=null===(n=o.data)||void 0===n?void 0:n.value)&&void 0!==i?i:null===(r=o.data)||void 0===r?void 0:r.y)&&void 0!==s?s:o.value)&&void 0!==a?a:o.y;return e("div",{className:"semiotic-tooltip",style:vs,children:e("div",{children:bs(t)})})}const f=null!==(h=null!==(u=null!==(l=o.xValue)&&void 0!==l?l:null===(c=o.data)||void 0===c?void 0:c.time)&&void 0!==u?u:null===(d=o.data)||void 0===d?void 0:d.x)&&void 0!==h?h:o.time;return t("div",{className:"semiotic-tooltip",style:vs,children:[null!=f&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:bs(f)}),g.map((o,n)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:o.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:o.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:bs(o.value)})]},n))]})}:ws(T)||ft}),"multi"===T&&{tooltipMode:"multi"}),(F||z||E||Y)&&{customHoverBehavior:$e}),(z||E||F)&&{customClickBehavior:Ne}),B&&{pointIdAccessor:B}),((null==D?void 0:D.length)||ke.length||at.length)&&{annotations:[...D||[],...ke,...at]}),We),W);return fe||pe||(pt?e(wa,{componentName:"LineChart",message:pt,width:ne,height:ie}):e(Va,{componentName:"LineChart",width:ne,height:ie,children:e(Un,Object.assign({ref:u},vt))}))});cl.displayName="LineChart";const ul=h(function(t,o){var n;const s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:p="y",areaBy:y,y0Accessor:v,gradientFill:m=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:S,showLine:O=!0,lineWidth:j=2,showPoints:C=!1,pointRadius:M=3,tooltip:P,annotations:_,frameProps:L={},selection:T,linkedHover:B,onObservation:D,onClick:$,hoverHighlight:N,chartId:I,loading:H,emptyContent:W,legendInteraction:R,legendPosition:F,color:z,stroke:E,strokeWidth:Y,opacity:G}=t,q=a.width,X=a.height,V=a.enableHover,U=a.showGrid,K=a.showLegend,Q=a.title,Z=a.description,J=a.summary,ee=a.accessibleTable,te=a.xLabel,oe=a.yLabel,ne=Za(H,q,X),ie=ne?null:Qa(l,q,X,W),re=l||[];Ja("AreaChart",re,"xAccessor",f),Ja("AreaChart",re,"yAccessor",p);const{activeSelectionHook:se,hoverSelectionHook:ae,customHoverBehavior:le,customClickBehavior:ce,crosshairSourceId:ue}=fa({selection:T,linkedHover:B,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:D,onClick:$,chartType:"AreaChart",chartId:I,hoverHighlight:N,colorByField:"string"==typeof x?x:void 0}),de=el(T),he=pa(B,ue),ge=void 0!==(null===(n=re[0])||void 0===n?void 0:n[b]),fe=r(()=>{if(ge)return re;if(y){const e=re.reduce((e,t)=>{const o="function"==typeof y?y(t):t[y];if(!e[o]){const t={[b]:[]};"string"==typeof y&&(t[y]=o),e[o]=t}return e[o][b].push(t),e},{});return Object.values(e)}return[{[b]:re}]},[re,y,b,ge]),pe=ha(re,x,k),ye=r(()=>{if(!x)return[];const e=new Set;for(const t of re){const o="function"==typeof x?x(t):t[x];null!=o&&e.add(o+"")}return Array.from(e)},[re,x]),ve=va(R,x,ye),me=r(()=>ae||(ve.legendSelectionHook?ve.legendSelectionHook:se),[ae,ve.legendSelectionHook,se]),be=r(()=>e=>{const t={};if(x){if(pe){const o=st(e,x,pe);t.fill=o,O?(t.stroke=o,t.strokeWidth=j):t.stroke="none"}}else{const e=z||ca;t.fill=e,O?(t.stroke=e,t.strokeWidth=j):t.stroke="none"}return t.fillOpacity=A,t},[x,pe,z,A,O,j]),xe=r(()=>ka(be,{stroke:E,strokeWidth:Y,opacity:G}),[be,E,Y,G]),ke=r(()=>Qs(xe,me,de),[xe,me,de]),we=r(()=>{if(C)return e=>{const t={r:M,fillOpacity:1};return x?pe&&(t.fill=st(e.parentLine||e,x,pe)):t.fill=ca,t}},[C,M,x,pe]),{legend:Ae,margin:Se,legendPosition:Oe}=ya({data:fe,colorBy:x,colorScale:pe,showLegend:K,legendPosition:F,userMargin:c,defaults:a.marginDefaults}),je=y||x,Ce=r(()=>Cs([{label:te||As(f),accessor:f,role:"x",format:d},{label:oe||As(p),accessor:p,role:"y",format:h},...je?[{label:As(je),accessor:je,role:"group"}]:[]]),[f,p,te,oe,je,d,h]),Me=Ma({componentName:"AreaChart",data:l,accessors:{xAccessor:f,yAccessor:p}}),Pe=r(()=>ge||y?fe.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):re,[fe,b,ge,y,re]),_e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:Pe}),{xAccessor:f,yAccessor:p,groupAccessor:y||void 0}),v&&{y0Accessor:v}),m&&{gradientFill:m}),S&&{lineGradient:S}),{curve:w,lineStyle:ke}),C&&we&&{pointStyle:we}),{size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Se,showAxes:a.showAxes,xLabel:te,yLabel:oe,xFormat:d,yFormat:h,enableHover:V}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:U}),Ae&&{legend:Ae,legendPosition:Oe}),R&&"none"!==R&&{legendHoverBehavior:ve.onLegendHover,legendClickBehavior:ve.onLegendClick,legendHighlightedCategory:ve.highlightedCategory,legendIsolatedCategories:ve.isolatedCategories}),Q&&{title:Q}),Z&&{description:Z}),J&&{summary:J}),void 0!==ee&&{accessibleTable:ee}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===P?()=>null:ws(P)||Ce}),(B||D||$||N)&&{customHoverBehavior:le}),(D||$||B)&&{customClickBehavior:ce}),_&&_.length>0&&{annotations:_}),he),L);return ne||ie||(Me?e(wa,{componentName:"AreaChart",message:Me,width:q,height:X}):e(Va,{componentName:"AreaChart",width:q,height:X,children:e(Un,Object.assign({ref:s},_e))}))});function dl({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:s="right"}){const a=i(new Set),l=i([]),[u,h]=d(0),g=c(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),f=c(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||a.current.has(t)||(a.current.add(t),l.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,g]),p=c(e=>t=>{f([t]),e(t)},[f]),y=c(e=>t=>{f(t),e(t)},[f]),v=c(()=>{a.current=new Set,l.current=[],h(e=>e+1)},[]),m=r(()=>{if(!e||!t||!1===n)return;const i=l.current;if(0===i.length)return;const r=Array.isArray(o)?o:nt,s=new Map;for(let e=0;i.length>e;e++)s.set(i[e],r[e%r.length]);const a="string"==typeof t?t:"__streamCat";return Us({data:i.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:st})},[e,t,n,o,u]),b=r(()=>{if(m)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[m,s]);return{wrapPush:p,wrapPushMany:y,resetCategories:v,streamingLegend:m,streamingMarginAdjust:b}}ul.displayName="AreaChart";const hl=h(function(t,o){var n;const s=i(null),a=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:p="x",yAccessor:y="y",areaBy:v,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:j=3,normalize:C=!1,tooltip:M,annotations:P,frameProps:_={},selection:L,linkedHover:T,onObservation:B,onClick:D,hoverHighlight:$,chartId:N,loading:I,emptyContent:H,legendInteraction:W,legendPosition:R,color:F,stroke:z,strokeWidth:E,opacity:Y}=t,G=a.width,q=a.height,X=a.enableHover,V=a.showGrid,U=a.showLegend,K=a.title,Q=a.description,Z=a.summary,J=a.accessibleTable,ee=a.xLabel,te=a.yLabel,oe=Za(I,G,q),ne=oe?null:Qa(l,G,q,H),ie=l||[],re=dl({isPushMode:void 0===l,colorBy:b||v,colorScheme:x,showLegend:U,legendPosition:R}),se=c(re.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[re.wrapPush]),ae=c(re.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[re.wrapPushMany]);g(o,()=>({push:se,pushMany:ae,remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;re.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[se,ae,re.resetCategories]);const{activeSelectionHook:le,hoverSelectionHook:ce,customHoverBehavior:ue,customClickBehavior:de,crosshairSourceId:he}=fa({selection:L,linkedHover:T,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:B,onClick:D,chartType:"StackedAreaChart",chartId:N,hoverHighlight:$,colorByField:"string"==typeof b?b:void 0}),ge=el(L),fe=pa(T,he),pe=void 0!==(null===(n=ie[0])||void 0===n?void 0:n[m]),ye=r(()=>{if(pe)return ie;if(v){const e=ie.reduce((e,t)=>{const o="function"==typeof v?v(t):t[v];if(!e[o]){const t={[m]:[]};"string"==typeof v&&(t[v]=o),e[o]=t}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:ie}]},[ie,v,m,pe]),ve=ha(ie,b,x),me=r(()=>{if(!b)return[];const e=new Set;for(const t of ie){const o="function"==typeof b?b(t):t[b];null!=o&&e.add(o+"")}return Array.from(e)},[ie,b]),be=va(W,b,me),xe=r(()=>ce||(be.legendSelectionHook?be.legendSelectionHook:le),[ce,be.legendSelectionHook,le]),ke=r(()=>e=>{const t={};if(b&&ve){const o=st(e,b,ve);t.fill=o,A?(t.stroke=o,t.strokeWidth=S):t.stroke="none"}else if(!b){const e=F||ca;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=S)}return t.fillOpacity=w,t},[b,ve,w,A,S,F]),we=r(()=>ka(ke,{stroke:z,strokeWidth:E,opacity:Y}),[ke,z,E,Y]),Ae=r(()=>Qs(we,xe,ge),[we,xe,ge]),Se=r(()=>{if(O)return e=>{const t={r:j,fillOpacity:1};return b?ve&&(t.fill=st(e.parentLine||e,b,ve)):t.fill=F||ca,t}},[O,j,b,ve,F]),{legend:Oe,margin:je,legendPosition:Ce}=ya({data:ye,colorBy:b,colorScale:ve,showLegend:U,legendPosition:R,userMargin:u,defaults:a.marginDefaults}),Me=re.streamingLegend||Oe,Pe=R||Ce,_e=r(()=>{if(re.streamingMarginAdjust){const e=Object.assign({},je);for(const[t,o]of Object.entries(re.streamingMarginAdjust))o>e[t]&&(e[t]=o);return e}return je},[je,re.streamingMarginAdjust]),Le=v||b,Te=r(()=>Cs([{label:ee||As(p),accessor:p,role:"x",format:h},{label:te||As(y),accessor:y,role:"y",format:f},...Le?[{label:As(Le),accessor:Le,role:"group"}]:[]]),[p,y,ee,te,Le,h,f]),Be=Ma({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:p,yAccessor:y}}),De=r(()=>pe||v?ye.flatMap(e=>{const t=e[m]||[];return v&&"string"==typeof v?t.map(t=>Object.assign(Object.assign({},t),{[v]:e[v]})):t}):ie,[ye,m,pe,v,ie]),$e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=l&&{data:De}),{xAccessor:p,yAccessor:y,groupAccessor:v||void 0,curve:k,normalize:C,lineStyle:Ae}),O&&Se&&{pointStyle:Se}),{size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:_e,showAxes:a.showAxes,xLabel:ee,yLabel:te,xFormat:h,yFormat:f,enableHover:X}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:V}),Me&&{legend:Me,legendPosition:Pe}),W&&"none"!==W&&{legendHoverBehavior:be.onLegendHover,legendClickBehavior:be.onLegendClick,legendHighlightedCategory:be.highlightedCategory,legendIsolatedCategories:be.isolatedCategories}),K&&{title:K}),Q&&{description:Q}),Z&&{summary:Z}),void 0!==J&&{accessibleTable:J}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===M?()=>null:ws(M)||Te}),(T||B||D||$)&&{customHoverBehavior:ue}),(B||D||T)&&{customClickBehavior:de}),P&&P.length>0&&{annotations:P}),fe),_);return oe||ne||(Be?e(wa,{componentName:"StackedAreaChart",message:Be,width:G,height:q}):e(Va,{componentName:"StackedAreaChart",width:G,height:q,children:e(Un,Object.assign({ref:s},$e))}))});hl.displayName="StackedAreaChart";const gl=h(function(t,o){var n;const s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=ba(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:f="value",xFormat:p,yFormat:y,colorScheme:v,customColorScale:m,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,frameProps:A={},selection:O,linkedHover:B,onObservation:D,onClick:$,hoverHighlight:F,chartId:z,loading:E,emptyContent:Y,showLegend:G,legendPosition:q,legendInteraction:X}=t,V=a.width,U=a.height,K=a.enableHover,Q=a.title,Z=a.description,J=a.summary,ee=a.accessibleTable,te=a.xLabel,oe=a.yLabel,ne=Za(E,V,U),ie=ne?null:Qa(l,V,U,Y),re=l||[],se=function(){var e;const t=la();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),ae=null!==(n=null!=v?v:se)&&void 0!==n?n:"blues",le=null!=G&&G,ce=null!=q?q:"right",{margin:ue}=ya({data:re,colorBy:le?"value":void 0,colorScale:void 0,showLegend:le,legendPosition:ce,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=fa({selection:O,linkedHover:B,fallbackFields:[],onObservation:D,onClick:$,chartType:"Heatmap",chartId:z,hoverHighlight:F,colorByField:void 0});el(O);const fe=pa(B,ge);va(X,void 0,[]);const pe=r(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),ye=r(()=>{const e=re.map(pe);return[Math.min(...e),Math.max(...e)]},[re,pe]),ve=r(()=>"custom"===ae&&m?m:S({blues:T,reds:L,greens:_,viridis:C,oranges:P,purples:M,greys:R,plasma:j,inferno:W,magma:H,cividis:I,turbo:N}[ae]||T).domain(ye),[ae,m,ye]),me=r(()=>Cs([{label:te||As(d),accessor:d,role:"x",format:p},{label:oe||As(h),accessor:h,role:"y",format:y},{label:As(f),accessor:f,role:"value",format:x}]),[d,h,te,oe,f,p,y,x]),be=Ma({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:f}}),xe=r(()=>{if(le)return{gradient:{colorFn:e=>ve(e),domain:ye,label:"string"==typeof f?f:"value",format:x}}},[le,ve,ye,f,x]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=l&&{data:re}),{xAccessor:d,yAccessor:h,valueAccessor:f,colorScheme:"custom"!==ae?ae:void 0,showValues:b,heatmapValueFormat:x,size:[V,U],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue,showAxes:a.showAxes,xLabel:te,yLabel:oe,xFormat:p,yFormat:y,enableHover:K}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),xe&&{legend:xe,legendPosition:ce}),Q&&{title:Q}),Z&&{description:Z}),J&&{summary:J}),void 0!==ee&&{accessibleTable:ee}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===k?()=>null:ws(k)||me}),(B||D||$||F)&&{customHoverBehavior:de}),(D||$||B)&&{customClickBehavior:he}),w&&w.length>0&&{annotations:w}),fe),A);return ne||ie||(be?e(wa,{componentName:"Heatmap",message:be,width:V,height:U}):e(Va,{componentName:"Heatmap",width:V,height:U,children:e(Un,Object.assign({ref:s},ke))}))});gl.displayName="Heatmap";const fl=h(function(t,o){const n=i(null),s=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:u,xFormat:h,yFormat:f,xAccessor:p="x",yAccessor:y="y",sizeBy:v,sizeRange:m=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:S,marginalGraphics:O,pointIdAccessor:j,annotations:C,frameProps:M={},selection:P,linkedHover:_,linkedBrush:L,onObservation:T,onClick:B,hoverHighlight:D,chartId:$,loading:N,emptyContent:I,legendInteraction:H,legendPosition:W,color:R,stroke:F,strokeWidth:z,opacity:E}=t,Y=s.width,G=s.height,q=s.enableHover,X=s.showGrid,V=s.showLegend,U=s.title,K=s.description,Q=s.summary,Z=s.accessibleTable,J=s.xLabel,ee=s.yLabel,te=Za(N,Y,G),oe=te?null:Qa(a,Y,G,I),ne=a||[],ie=void 0===a,re=i(null),[se,ae]=d(0),le=c(e=>{if(!ie)return;let t=!1;for(const o of e){const e="function"==typeof v?v(o):o[v];null!=e&&isFinite(e)&&(re.current?(re.current[0]>e&&(re.current[0]=e,t=!0),e>re.current[1]&&(re.current[1]=e,t=!0)):(re.current=[e,e],t=!0))}t&&ae(e=>e+1)},[ie,v]),ce=dl({isPushMode:ie,colorBy:b,colorScheme:x,showLegend:V,legendPosition:W}),ue=c(ce.wrapPush(e=>{var t;le([e]),null===(t=n.current)||void 0===t||t.push(e)}),[ce.wrapPush,le]),de=c(ce.wrapPushMany(e=>{var t;le(e),null===(t=n.current)||void 0===t||t.pushMany(e)}),[ce.wrapPushMany,le]);g(o,()=>({push:ue,pushMany:de,remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i;return null!==(i=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;ce.resetCategories(),re.current=null,ae(e=>e+1),null===(e=n.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ue,de,ce.resetCategories]);const{activeSelectionHook:he,hoverSelectionHook:ge,customHoverBehavior:fe,customClickBehavior:pe,crosshairSourceId:ye}=fa({selection:P,linkedHover:_,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:T,onClick:B,chartType:"BubbleChart",chartId:$,hoverHighlight:D,colorByField:"string"==typeof b?b:void 0}),ve=el(P),me=pa(_,ye),be=Ks(L);zs({name:(null==be?void 0:be.name)||"__unused_brush__",xField:(null==be?void 0:be.xField)||("string"==typeof p?p:void 0),yField:(null==be?void 0:be.yField)||("string"==typeof y?y:void 0)});const xe=ha(ne,b,x),ke=r(()=>{if(!b)return[];const e=new Set;for(const t of ne){const o="function"==typeof b?b(t):t[b];null!=o&&e.add(o+"")}return Array.from(e)},[ne,b]),we=va(H,b,ke),Ae=r(()=>ge||(we.legendSelectionHook?we.legendSelectionHook:he),[ge,we.legendSelectionHook,he]),Se=r(()=>{if(ie)return re.current||[0,1];const e=ne.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[ne,v,ie,se]),Oe=r(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?xe&&(t.fill=st(e,b,xe)):t.fill=R||ca,t.r=lt(e,v,m,Se),t},[b,xe,v,m,Se,k,w,A,R]),je=r(()=>ka(Oe,{stroke:F,strokeWidth:z,opacity:E}),[Oe,F,z,E]),Ce=r(()=>Qs(je,Ae,ve),[je,Ae,ve]),{legend:Me,margin:Pe,legendPosition:_e}=ya({data:ne,colorBy:b,colorScale:xe,showLegend:V,legendPosition:W,userMargin:l,defaults:s.marginDefaults}),Le=ce.streamingLegend||Me,Te=W||_e,Be=r(()=>{if(ce.streamingMarginAdjust){const e=Object.assign({},Pe);for(const[t,o]of Object.entries(ce.streamingMarginAdjust))o>e[t]&&(e[t]=o);return e}return Pe},[Pe,ce.streamingMarginAdjust]),De=r(()=>Cs([{label:J||As(p),accessor:p,role:"x",format:h},{label:ee||As(y),accessor:y,role:"y",format:f},{label:As(v),accessor:v,role:"size"},...b?[{label:As(b),accessor:b,role:"color"}]:[]]),[p,y,J,ee,v,b,h,f]),$e=Ma({componentName:"BubbleChart",data:a,accessors:{xAccessor:p,yAccessor:y},requiredProps:{sizeBy:v}});if($e)return e(wa,{componentName:"BubbleChart",message:$e,width:Y,height:G});const Ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=a&&{data:ne}),{xAccessor:p,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:v,sizeRange:m,pointStyle:Ce,colorScheme:x,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Be,showAxes:s.showAxes,xLabel:J,yLabel:ee,xFormat:h,yFormat:f,enableHover:q,showGrid:X}),Le&&{legend:Le,legendPosition:Te}),H&&"none"!==H&&{legendHoverBehavior:we.onLegendHover,legendClickBehavior:we.onLegendClick,legendHighlightedCategory:we.highlightedCategory,legendIsolatedCategories:we.isolatedCategories}),U&&{title:U}),K&&{description:K}),Q&&{summary:Q}),void 0!==Z&&{accessibleTable:Z}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===S?()=>null:ws(S)||De}),(_||T||B||D)&&{customHoverBehavior:fe}),(T||B||_)&&{customClickBehavior:pe}),O&&{marginalGraphics:O}),j&&{pointIdAccessor:j}),C&&C.length>0&&{annotations:C}),me),M);return te||oe||e(Va,{componentName:"BubbleChart",width:Y,height:G,children:e(Un,Object.assign({ref:n},Ne))})});fl.displayName="BubbleChart";const pl="__splomIdx",yl={top:4,bottom:4,left:4,right:4};function vl({frameRef:t,cellSize:o,onBrush:n}){const r=i(null),a=o-yl.left-yl.right,l=o-yl.top-yl.bottom;return s(()=>{if(!r.current)return;const e=p(r.current).select(".brush-g"),o=m().extent([[0,0],[a,l]]).on("brush end",e=>{var o;const i=null===(o=t.current)||void 0===o?void 0:o.getScales();if(!i)return;if(!e.selection)return void n(null);const[[r,s],[a,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(a),i.y.invert(l)]];n(c)});return e.call(o),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[a,l,t,n]),e("svg",{ref:r,width:o,height:o,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${yl.left},${yl.top})`})})}function ml({data:o,xField:n,yField:r,cellSize:s,pointRadius:a,pointOpacity:l,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const v=i(null),m=Ws({name:h,clientId:`splom-${n}-${r}`}),b=zs({name:h,xField:n,yField:r}),x=Ws({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=c(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=c(e=>{if(!e)return void(null==y||y(null));const t=e.data,o=null==t?void 0:t[pl];void 0!==o&&(k({[pl]:[o]}),null==y||y(t,e.x+yl.left,e.y+yl.top))},[k,y]),S=c(e=>{const t={opacity:l,r:a};return t.fill=u?st(e,u,d):ca,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=f),t},[u,d,l,a,p,m.isActive,m.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(Un,{ref:v,chartType:"scatter",data:o,size:[s,s],xAccessor:n,yAccessor:r,pointStyle:S,margin:yl,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(vl,{frameRef:v,cellSize:s,xField:n,yField:r,onBrush:w})]})}function bl({data:o,field:n,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=Ws({name:u,clientId:"splom-diag-"+n}),f=Ws({name:d,clientId:`splom-diag-${n}-hover`}),p="hover"===h?f:g,y=p.isActive,v=p.predicate,m=r(()=>{const e=o.map(e=>e[n]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/a||1,r="string"==typeof l?l:null,c=r?[...new Set(o.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),f=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const s=Math.min(Math.floor((o-t)/i),a-1);if(d[s]++,y&&!v(e)||h[s]++,r){const t=u.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!v(e)||f[s][t]++)}}const p=Math.max(...d,1),m=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})});return{bars:d.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),categoryBars:m,selectedCategoryBars:b,max:p,categories:c}},[o,n,a,s,y,v,l]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,o)=>t.map((t,n)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):ca,opacity:y?.3:.6},`bg-${o}-${n}`))):m.bars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:ca,opacity:y?.3:.6},"bg-"+o)),y&&(m.categories.length>0?m.selectedCategoryBars.map((t,o)=>t.map((t,n)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):ca,opacity:.7},`sel-${o}-${n}`))):m.selectedBars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:ca,opacity:.7},"sel-"+o)))]})}function xl({label:t,cellSize:o}){return e("svg",{width:o,height:o,children:e("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function kl(o){const{data:i,fields:s,fieldLabels:a={},colorBy:l,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:v=20,brushMode:m="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:j,chartId:C}=o,M="splom",P="splom-hover",_=b?"hover":m?"brush":"hover",L=Ns(e=>e.clearSelection),[T,B]=d(null),D=c(()=>{L(P),B(null)},[L,P]),$=r(()=>(i||[]).map((e,t)=>void 0!==e[pl]?e:Object.assign(Object.assign({},e),{[pl]:t})),[i]),N=ha($,l,u),I=void 0!==A?A:!!l,H=r(()=>{if(!I||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set($.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):ca})):null},[I,l,$,N]),W=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[s,h,g,40]);return t("div",{className:O,style:{position:"relative"},children:[H&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:H.map(o=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:o.color}}),e("span",{style:{fontSize:11},children:o.label})]},o.label))}),t("div",{style:W,onMouseLeave:"hover"===_?D:void 0,children:[s.map((o,i)=>t(n.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:a[o]||o}),s.map((t,n)=>i===n?"label"===y?e(xl,{label:a[o]||o,cellSize:h},"diag-"+o):e(bl,{data:$,field:o,label:a[o]||o,cellSize:h,bins:v,colorBy:l,colorScale:N,brushSelectionName:M,hoverSelectionName:P,unselectedOpacity:x,mode:_},"diag-"+o):e(ml,{data:$,xField:t,yField:o,fieldLabels:a,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:l,colorScale:N,brushSelectionName:M,hoverSelectionName:P,unselectedOpacity:x,showGrid:k,tooltip:w,mode:_,onPointHover:"hover"===_?(e,r,s)=>{e?(B({datum:e,xField:t,yField:o,colIndex:n,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),j&&j({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:C})):(B(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:C}))}:void 0},`cell-${o}-${t}`))]},"row-"+o)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:a[t]||t},"col-label-"+t))]}),T&&"hover"===_&&(()=>{const o=T.datum,n=a[T.xField]||T.xField,i=a[T.yField]||T.yField,r=l?"function"==typeof l?l(o):o[l]:null,s=S?"function"==typeof S?S(o):o[S]:"Row "+o[pl];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[n,": ",null!=o[T.xField]?Number(o[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=o[T.yField]?Number(o[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof l?l:"group",": ",r+""]})]})})()]})}function wl(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e(Vs,{selections:i,children:e(kl,Object.assign({},t))})}function Al({width:t,height:o,margin:n,scales:r,brushDirection:a,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+n.left+n.right,f=o+n.top+n.bottom;return s(()=>{if(!u.current||!r)return;const e=p(u.current).select(".brush-group"),n="x"===a?y().extent([[0,0],[t,o]]):v().extent([[0,0],[t,o]]);return n.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const o=("x"===a?r.x:r.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];c(n)}),e.call(n),d.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[r,t,o,a,c]),s(()=>{if(!d.current||!r||!u.current)return;const e=p(u.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const o=[t(l[0]),t(l[1])];e.call(d.current.move,o)}else e.call(d.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:u,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function Sl(o){var n,a;const{data:l,width:u=600,height:h=400,margin:g,className:f,title:p,description:y,summary:v,xLabel:m,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:j,colorScheme:C,curve:M="linear",lineWidth:P=2,fillArea:_=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:B=3,enableHover:D=!0,showGrid:$=!1,showLegend:N,legendPosition:I,tooltip:H,minimap:W={},renderBefore:R=!1,onBrush:F,brushExtent:z,frameProps:E={},loading:Y,emptyContent:G}=o,q=Za(Y,u,h),X=q?null:Qa(l,u,h,G),V=l||[],[U,K]=d(null),Q=null!=z?z:U,Z=c(e=>{z||K(e),null==F||F(e)},[z,F]),J=i(null),[ee,te]=d(null);s(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=J.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?te(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[l]);const oe=void 0!==(null===(n=V[0])||void 0===n?void 0:n[O]),ne=r(()=>{if(oe)return V;if(S){const e=V.reduce((e,t)=>{const o="function"==typeof S?S(t):t[S];if(!e[o]){const t={[O]:[]};"string"==typeof S&&(t[S]=o),e[o]=t}return e[o][O].push(t),e},{});return Object.values(e)}return[{[O]:V}]},[V,S,O,oe]),ie=r(()=>oe||S?ne.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):V,[ne,O,oe,S,V]),re=ha(V,j,C),se=r(()=>e=>{const t={strokeWidth:P};return t.stroke=j?st(e,j,re):ca,_&&(t.fill=t.stroke,t.fillOpacity=L),t},[j,re,P,_,L]),ae=r(()=>W.lineStyle?W.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=j?st(e,j,re):ca,t},[j,re,W.lineStyle]),le=r(()=>{if(T)return e=>{const t={r:B,fillOpacity:1};return t.fill=j?st(e.parentLine||e,j,re):ca,t}},[T,B,j,re]),{legend:ce,margin:ue,legendPosition:de}=ya({data:ne,colorBy:j,colorScale:re,showLegend:N,legendPosition:I,userMargin:g}),he=W.height||60,ge=r(()=>{var e,t,o,n,i,r,s,a;return{top:null!==(t=null===(e=W.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(n=null===(o=W.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(r=null===(i=W.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ue.left,right:null!==(a=null===(s=W.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[W.margin,ue]),fe=W.brushDirection||"x",pe=Ma({componentName:"MinimapChart",data:l,accessors:{xAccessor:w,yAccessor:A}});if(pe)return e(wa,{componentName:"MinimapChart",message:pe,width:u,height:h});const ye=_?"area":"line",ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ye,data:ie,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:se},T&&{pointStyle:le}),{size:[u,h],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue,showAxes:!0,xLabel:m,yLabel:b,xFormat:x,yFormat:k,enableHover:D,showGrid:$}),ce&&{legend:ce,legendPosition:de}),p&&{title:p}),y&&{description:y}),v&&{summary:v}),H&&{tooltipContent:ws(H)||void 0}),Q&&{xExtent:Q}),E),me={chartType:ye,data:ie,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:ae,size:[u,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(a=W.showAxes)&&void 0!==a&&a,background:W.background,enableHover:!1},be=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(Un,Object.assign({ref:J},me)),e(Al,{width:u-ge.left-ge.right,height:he,margin:ge,scales:ee,brushDirection:fe,extent:Q,onBrush:Z})]},"minimap"),xe=e("div",{style:{overflow:"hidden"},children:e(Un,Object.assign({},ve))},"main");return q||X||e(Va,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[R?be:xe,R?xe:be]})})}wl.displayName="ScatterplotMatrix",Sl.displayName="MinimapChart";const Ol=h(function(n,s){const a=i(null);g(s,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=ba(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:f,xAccessor:p="x",yAccessor:y="y",xCenter:v,yCenter:m,quadrants:b,centerlineStyle:x={},showQuadrantLabels:k=!0,quadrantLabelSize:w=12,colorBy:A,colorScheme:S,sizeBy:O,sizeRange:j=[3,15],pointRadius:C=5,pointOpacity:M=.8,tooltip:P,pointIdAccessor:_,annotations:L,frameProps:T={},selection:B,linkedHover:D,onObservation:$,onClick:N,hoverHighlight:I,chartId:H,loading:W,emptyContent:R,legendInteraction:F,legendPosition:z,color:E,stroke:Y,strokeWidth:G,opacity:q}=n,X=l.width,V=l.height,U=l.enableHover,K=l.showGrid,Q=l.showLegend,Z=l.title,J=l.description,ee=l.summary,te=l.accessibleTable,oe=l.xLabel,ne=l.yLabel,ie=Za(W,X,V),re=ie?null:Qa(c,X,V,R),se=c||[];Ja("QuadrantChart",se,"xAccessor",p),Ja("QuadrantChart",se,"yAccessor",y);const{activeSelectionHook:ae,hoverSelectionHook:le,customHoverBehavior:ce,customClickBehavior:ue,crosshairSourceId:de}=fa({selection:B,linkedHover:D,fallbackFields:"string"==typeof A?[A]:[],onObservation:$,onClick:N,chartType:"QuadrantChart",chartId:H,hoverHighlight:I,colorByField:"string"==typeof A?A:void 0}),he=el(B),ge=pa(D,de),fe=ha(se,A,S),pe=r(()=>{if(!A)return[];const e=new Set;for(const t of se){const o="function"==typeof A?A(t):t[A];null!=o&&e.add(o+"")}return Array.from(e)},[se,A]),ye=va(F,A,pe),ve=r(()=>le||(ye.legendSelectionHook?ye.legendSelectionHook:ae),[le,ye.legendSelectionHook,ae]),me=r(()=>{if(!se.length)return;const e="function"==typeof p?p:e=>+e[p],t="function"==typeof y?y:e=>+e[y];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of se){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=v&&isFinite(v)&&(o>v&&(o=v),v>n&&(n=v)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(r-i)||1;return{xExtent:[o-s,n+s],yExtent:[i-a,r+a]}},[se,p,y,v,m]),be=r(()=>{if(!O||0===se.length)return;const e=se.map(e=>"function"==typeof O?O(e):e[O]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[se,O]),xe=r(()=>"function"==typeof p?p:e=>+e[p],[p]),ke=r(()=>"function"==typeof y?y:e=>+e[y],[y]),we=r(()=>e=>{const t={fillOpacity:M};if(A)fe&&(t.fill=st(e,A,fe));else{const o=xe(e),n=ke(e),i=null!=v?o>=v:void 0,r=null!=m?n>=m:void 0;t.fill=void 0===r||void 0===i?E||ca:r&&i?b.topRight.color:r&&!i?b.topLeft.color:!r&&i?b.bottomRight.color:b.bottomLeft.color}return t.r=O?lt(e,O,j,be):C,t},[A,fe,O,j,be,C,M,xe,ke,v,m,b,E]),Ae=r(()=>ka(we,{stroke:Y,strokeWidth:G,opacity:q}),[we,Y,G,q]),Se=r(()=>Qs(Ae,ve,he),[Ae,ve,he]),{legend:Oe,margin:je,legendPosition:Ce}=ya({data:se,colorBy:A,colorScale:fe,showLegend:Q,legendPosition:z,userMargin:u,defaults:l.marginDefaults}),Me=r(()=>{if(!se.length)return;const e=new Set;"string"==typeof p&&e.add(p),"string"==typeof y&&e.add(y),"string"==typeof A&&e.add(A),"string"==typeof O&&e.add(O);const t=se[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[se,p,y,A,O]),Pe=r(()=>Cs([...Me?[{label:Me,accessor:Me,role:"title"}]:[],{label:oe||As(p),accessor:p,role:"x",format:h},{label:ne||As(y),accessor:y,role:"y",format:f},...A?[{label:As(A),accessor:A,role:"color"}]:[],...O?[{label:As(O),accessor:O,role:"size"}]:[]]),[Me,p,y,oe,ne,A,O,h,f]),_e=Ma({componentName:"QuadrantChart",data:c,accessors:{xAccessor:p,yAccessor:y}}),Le=r(()=>{var e;const t={stroke:x.stroke||"#999",strokeWidth:null!==(e=x.strokeWidth)&&void 0!==e?e:1,dashArray:x.strokeDasharray||[]};return[(e,o,n,i)=>{var r;if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const s=i.width,a=i.height,l=null!=v?n.x(v):s/2,c=null!=m?n.y(m):a/2;if(null!=v&&!isFinite(l))return;if(null!=m&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:b.topLeft,x:0,y:0,w:u,h:d},{config:b.topRight,x:u,y:0,w:s-u,h:d},{config:b.bottomLeft,x:0,y:d,w:u,h:a-d},{config:b.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[v,m,b,x]),Te=r(()=>k?[...Le,(e,t,o,n)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const i=n.width,r=n.height,s=null!=v?o.x(v):i/2,a=null!=m?o.y(m):r/2;(null==v||isFinite(s))&&(null==m||isFinite(a))&&(e.font=`600 ${w}px sans-serif`,e.globalAlpha=.5,e.fillStyle=b.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(b.topLeft.label,8,8),e.fillStyle=b.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(b.topRight.label,i-8,8),e.fillStyle=b.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(b.bottomLeft.label,8,r-8),e.fillStyle=b.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(b.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:Le,[Le,k,w,b,v,m]),Be=r(()=>{const e=T.canvasPreRenderers||[];return[...Te,...e]},[Te,T.canvasPreRenderers]),De=r(()=>{var n;const i={stroke:x.stroke||"#999",strokeWidth:null!==(n=x.strokeWidth)&&void 0!==n?n:1,dashArray:x.strokeDasharray?Array.isArray(x.strokeDasharray)?x.strokeDasharray.join(","):x.strokeDasharray:void 0};return[(n,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const a=s.width,l=s.height,c=null!=v?r.x(v):a/2,u=null!=m?r.y(m):l/2;if(null!=v&&!isFinite(c))return null;if(null!=m&&!isFinite(u))return null;const d=Math.max(0,Math.min(a,c)),h=Math.max(0,Math.min(l,u));return t(o,{children:[[{config:b.topLeft,x:0,y:0,w:d,h:h},{config:b.topRight,x:d,y:0,w:a-d,h:h},{config:b.bottomLeft,x:0,y:h,w:d,h:l-h},{config:b.bottomRight,x:d,y:h,w:a-d,h:l-h}].map((t,o)=>{var n;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(n=t.config.opacity)&&void 0!==n?n:.08},"qf-"+o):null}),e("line",{x1:d,y1:0,x2:d,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:a,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),k&&t(o,{children:[e("text",{x:8,y:8+w,fill:b.topLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:b.topLeft.label}),e("text",{x:a-8,y:8+w,fill:b.topRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:b.topRight.label}),e("text",{x:8,y:l-8,fill:b.bottomLeft.color,fontWeight:600,fontSize:w,opacity:.5,children:b.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:b.bottomRight.color,fontWeight:600,fontSize:w,opacity:.5,textAnchor:"end",children:b.bottomRight.label})]})]})}]},[v,m,b,x,k,w]),$e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:se}),{xAccessor:p,yAccessor:y,colorAccessor:A||void 0,sizeAccessor:O||void 0,sizeRange:j,pointStyle:Se,colorScheme:S,size:[X,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:je,showAxes:l.showAxes,xLabel:oe,yLabel:ne,xFormat:h,yFormat:f,enableHover:U,showGrid:K}),me&&{xExtent:me.xExtent,yExtent:me.yExtent}),Oe&&{legend:Oe,legendPosition:Ce}),F&&"none"!==F&&{legendHoverBehavior:ye.onLegendHover,legendClickBehavior:ye.onLegendClick,legendHighlightedCategory:ye.highlightedCategory,legendIsolatedCategories:ye.isolatedCategories}),Z&&{title:Z}),J&&{description:J}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===P?()=>null:!0===P||void 0===P?Pe:ws(P)||Pe}),(D||$||N||I)&&{customHoverBehavior:ce}),($||N||D)&&{customClickBehavior:ue}),_&&{pointIdAccessor:_}),L&&L.length>0&&{annotations:L}),{canvasPreRenderers:Be}),ge),T),Be.length>0&&{canvasPreRenderers:Be}),{svgPreRenderers:De});return ie||re||(_e?e(wa,{componentName:"QuadrantChart",message:_e,width:X,height:V}):e(Va,{componentName:"QuadrantChart",width:X,height:V,children:e(Un,Object.assign({ref:a},$e))}))});Ol.displayName="QuadrantChart";const jl="__ma_unitized",Cl="__ma_series";function Ml(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Pl(e,t){return t[0]+e*(t[1]-t[0])}const _l=h(function(t,o){var s,a;const l=i(null),c=i([]);g(o,()=>({push:e=>{if(!l.current)return;const o=e;for(let e=0;t.series.length>e&&2>e;e++){const n=t.series[e],i=n.extent||c.current[e];if(!i)continue;const r=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(o);null!=r&&isFinite(r)&&l.current.push(Object.assign(Object.assign({},o),{[jl]:Ml(r,i),[Cl]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!l.current)return;const o=[];for(const n of e)for(let e=0;t.series.length>e&&2>e;e++){const i=t.series[e],r=i.extent||c.current[e];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=s&&isFinite(s)&&o.push(Object.assign(Object.assign({},n),{[jl]:Ml(s,r),[Cl]:i.label||"Series "+(e+1)}))}l.current.pushMany(o)},remove:e=>{var t,o;return null!==(o=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=l.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const u=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:f,xFormat:p,xAccessor:y="x",series:v,colorScheme:m,curve:b="monotoneX",lineWidth:x=2,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,loading:_,emptyContent:L,legendInteraction:T,legendPosition:B,stroke:D,strokeWidth:$,opacity:N}=t,I=u.width,H=u.height,W=u.enableHover,R=u.showGrid,F=null===(s=u.showLegend)||void 0===s||s,z=u.title,E=u.description,Y=u.summary,G=u.accessibleTable,q=u.xLabel,X=2===v.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||X||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${v.length}. Rendering as a standard multi-line chart.`);const V=Za(_,I,H),U=V?null:Qa(d,I,H,L),K=d||[],Q=ua(),Z=r(()=>{let e;if(Array.isArray(m))e=m;else if(Q&&Q.length>0)e=Q;else{const t=tt[m];e=Array.isArray(t)?t:ot}return v.map((t,o)=>t.color||e[o%e.length])},[v,m,Q]),J=r(()=>v.map((e,t)=>e.label||"Series "+(t+1)),[v]),{unitizedData:ee,extents:te}=r(()=>{if(0===K.length){const e=v.map(e=>e.extent||null).filter(Boolean);return e.length===v.length&&(c.current=e),{unitizedData:[],extents:e.length===v.length?e:[]}}const e=v.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(K,e.yAccessor));if(c.current=e,!X){const t=[];for(const e of K)for(let o=0;v.length>o;o++){const n=v[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[jl]:i,[Cl]:J[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of K)for(let n=0;2>n;n++){const i=v[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[jl]:Ml(r,e[n]),[Cl]:J[n]}))}return{unitizedData:t,extents:e}},[K,v,X,J]),oe=r(()=>{if(X&&te.length>=2)return[{orient:"left",label:J[0],tickFormat:v[0].format||(e=>{const t=Pl(e,te[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:J[1],tickFormat:v[1].format||(e=>{const t=Pl(e,te[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[X,te,v,J]),ne=tl({data:r(()=>ee.length>0?ee:J.map(e=>({[Cl]:e})),[ee,J]),rawData:d,colorBy:Cl,colorScheme:Z,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:[Cl],unwrapData:!1,onObservation:j,onClick:C,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:P,showLegend:F,userMargin:h,marginDefaults:X?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:_,emptyContent:L,width:I,height:H});if(ne.earlyReturn)return ne.earlyReturn;const ie=r(()=>{const e=new Map;return J.forEach((t,o)=>e.set(t,Z[o])),t=>({stroke:e.get(t[Cl])||Z[0],strokeWidth:x,fill:"none"})},[J,Z,x]),re=r(()=>ka(ie,{stroke:D,strokeWidth:$,opacity:N}),[ie,D,$,N]),se=r(()=>Qs(re,ne.effectiveSelectionHook,ne.resolvedSelection),[re,ne.effectiveSelectionHook,ne.resolvedSelection]),ae=r(()=>{if(!1===k)return()=>null;return ws(k)||(e=>{var t;const o=e.data||e,i=o[Cl],r=J.indexOf(i),s=o[jl],a=X&&r>=0&&te[r]?Pl(s,te[r]):s,l=r>=0&&(null===(t=v[r])||void 0===t?void 0:t.format)?v[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(o):o[y];return n.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},n.createElement("div",{style:{fontWeight:600,marginBottom:4,color:Z[r]||"inherit"}},i),n.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),n.createElement("div",null,`${i}: ${l(a)}`))})},[k,J,Z,te,X,v,y]),le=Ma({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:y}}),ce=X?[0,1]:void 0,ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:ee}),{xAccessor:y,yAccessor:jl,groupAccessor:Cl,lineStyle:se,colorScheme:Z,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne.margin,showAxes:u.showAxes}),oe&&{axes:oe}),{xLabel:q}),X?{}:{yLabel:J[0]}),{xFormat:p}),X&&ce&&{yExtent:ce}),{enableHover:W}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:R,curve:b}),ne.legendBehaviorProps),z&&{title:z}),E&&{description:E}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:ae}),w&&{annotations:w}),(O||j||C||M)&&{customHoverBehavior:ne.customHoverBehavior}),(j||C||O)&&{customClickBehavior:ne.customClickBehavior}),ne.crosshairProps),A);return V||U||(le?e(wa,{componentName:"MultiAxisLineChart",message:le,width:I,height:H}):e(Va,{componentName:"MultiAxisLineChart",width:I,height:H,children:e(Un,Object.assign({ref:l},ue))}))});_l.displayName="MultiAxisLineChart";const Ll=h(function(t,o){const n=i(null);g(o,()=>({push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i;return null!==(i=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:a,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:f="high",lowAccessor:p="low",openAccessor:y,closeAccessor:v,candlestickStyle:m,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,chartId:j,loading:C,emptyContent:M}=t,P=s.width,_=s.height,L=s.enableHover,T=s.showGrid,B=s.title,D=s.description,$=s.summary,N=s.accessibleTable,I=s.xLabel,H=s.yLabel,W=Za(C,P,_),R=W?null:Qa(a,P,_,M),F=a||[],z=null==y||null==v;Ja("CandlestickChart",F,"xAccessor",h),Ja("CandlestickChart",F,"highAccessor",f),Ja("CandlestickChart",F,"lowAccessor",p),z||(Ja("CandlestickChart",F,"openAccessor",y),Ja("CandlestickChart",F,"closeAccessor",v));const{customHoverBehavior:E,customClickBehavior:Y,crosshairSourceId:G}=fa({selection:w,linkedHover:A,onObservation:S,onClick:O,chartType:"CandlestickChart",chartId:j}),q=pa(A,G),X=r(()=>{const e=s.marginDefaults,o="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?o:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},o),l)},[l,s.marginDefaults,t.mode]),V=r(()=>{const e=[{label:I||As(h),accessor:h,role:"x",format:u}];return z?(e.push({label:"High",accessor:f,role:"y",format:d}),e.push({label:"Low",accessor:p,format:d})):(e.push({label:"Open",accessor:y,format:d}),e.push({label:"High",accessor:f,format:d}),e.push({label:"Low",accessor:p,format:d}),e.push({label:"Close",accessor:v,format:d})),Cs(e)},[h,I,u,d,f,p,y,v,z]),U=Ma({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:f,lowAccessor:p},!z&&{openAccessor:y,closeAccessor:v})}),K=Math.max(2,Math.min(12,Math.round(P/40))),Q=P>200?.1:.02,Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=a&&{data:F}),{xAccessor:h,yAccessor:f,highAccessor:f,lowAccessor:p}),!z&&{openAccessor:y,closeAccessor:v}),m&&{candlestickStyle:m}),{scalePadding:K,extentPadding:Q,size:[P,_],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,showAxes:s.showAxes,xLabel:I,yLabel:H,xFormat:u,yFormat:d,enableHover:L,showGrid:T}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),B&&{title:B}),D&&{description:D}),$&&{summary:$}),void 0!==N&&{accessibleTable:N}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:ws(b)||V}),(A||S||O)&&{customHoverBehavior:E}),(S||O||A)&&{customClickBehavior:Y}),x&&x.length>0&&{annotations:x}),q),k);return W||R||(U?e(wa,{componentName:"CandlestickChart",message:U,width:P,height:_}):e(Va,{componentName:"CandlestickChart",width:P,height:_,children:e(Un,Object.assign({ref:n},Z))}))});Ll.displayName="CandlestickChart";const Tl=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:v=!1,barPadding:m=40,roundedTop:b,gradientFill:x=!1,baselinePadding:k=!1,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:j,onObservation:C,onClick:M,hoverHighlight:P,chartId:_,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:$,stroke:N,strokeWidth:I,opacity:H,showCategoryTicks:W,categoryFormat:R,dataIdAccessor:F}=t,z=n.width,E=n.height,Y=n.enableHover,G=n.showGrid,q=n.title,X=n.description,V=n.summary,U=n.accessibleTable,K=n.categoryLabel,Q=n.valueLabel,Z=a||[],J=tl({data:Z,rawData:a,colorBy:p,colorScheme:y,legendInteraction:B,legendPosition:D,selection:O,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"BarChart",chartId:_,showLegend:n.showLegend,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:z,height:E});if(J.earlyReturn)return J.earlyReturn;Ja("BarChart",Z,"categoryAccessor",u),Ja("BarChart",Z,"valueAccessor",d);const ee=ga(Z,v,d),te=ua(),oe=r(()=>new Map,[Z]),ne=r(()=>(e,t)=>{const o={};return o.fill=p?st(e,p,J.colorScale):da($,te,y,void 0,oe),o},[p,J.colorScale,$,te,y,oe]),ie=r(()=>{const e=null==S?void 0:S.pieceStyle;return ka(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},ne(t,o)),e(t,o)||{}):ne,{stroke:N,strokeWidth:I,opacity:H})},[ne,S,N,I,H]),re=r(()=>Qs(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Ms({categoryAccessor:u,valueAccessor:d,groupAccessor:p&&p!==u?p:void 0,groupLabel:"string"==typeof p?p:"group",valueFormat:f}),[u,d,p,f]),ae=Ma({componentName:"BarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return e(wa,{componentName:"BarChart",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[z,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:m}),null!=b&&{roundedTop:b}),x&&{gradientFill:!0===x?{topOpacity:.8,bottomOpacity:.05}:x}),F&&{dataIdAccessor:F}),{baselinePadding:k,enableHover:Y,showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:f}),R&&{oFormat:R}),{showGrid:G,showCategoryTicks:W,oSort:v}),J.legendBehaviorProps),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:ws(w)||se}),(j||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||j)&&{customClickBehavior:J.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"BarChart",width:z,height:E,children:e(Mi,Object.assign({ref:s},le))})});function Bl({ref:e,frameRef:t,isPushMode:o,colorBy:n,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const u=dl({isPushMode:o,colorBy:n,colorScheme:i,showLegend:s,legendPosition:a}),d=c(u.wrapPush(e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.push(e)}),[u.wrapPush]),h=c(u.wrapPushMany(e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.pushMany(e)}),[u.wrapPushMany]);return g(e,()=>({push:d,pushMany:h,remove:e=>{var o,n;return null!==(n=null===(o=t.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[]},update:(e,o)=>{var n,i;return null!==(i=null===(n=t.current)||void 0===n?void 0:n.update(e,o))&&void 0!==i?i:[]},clear:()=>{var e;u.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==o?o:[]}}),[d,h,u.resetCategories]),{effectiveLegendProps:r(()=>u.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:u.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,u.streamingLegend,a]),effectiveMargin:r(()=>{if(u.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,o]of Object.entries(u.streamingMarginAdjust))o>e[t]&&(e[t]=o);return e}return l.margin},[l.margin,u.streamingMarginAdjust])}}Tl.displayName="BarChart";const Dl=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:v=!1,sort:m=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:j,onObservation:C,onClick:M,hoverHighlight:P,chartId:_,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,color:$,stroke:N,strokeWidth:I,opacity:H,categoryFormat:W}=t,R=n.width,F=n.height,z=n.enableHover,E=n.showGrid,Y=n.showLegend,G=n.title,q=n.description,X=n.summary,V=n.accessibleTable,U=n.categoryLabel,K=n.valueLabel,Q=a||[],Z=p||d,J=void 0===a,ee=tl({data:Q,rawData:a,colorBy:Z,colorScheme:y,legendInteraction:B,legendPosition:D,selection:O,linkedHover:j,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"StackedBarChart",chartId:_,showLegend:Y,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:R,height:F});if(ee.earlyReturn)return ee.earlyReturn;const te=ua(),oe=r(()=>new Map,[Q]),ne=r(()=>(e,t)=>Z?ee.colorScale?{fill:st(e,Z,ee.colorScale)}:{}:{fill:da($,te,y,t,oe)},[Z,ee.colorScale,$,te,y,oe]),ie=r(()=>{const e=null==S?void 0:S.pieceStyle;return ka(e&&"function"==typeof e?(t,o)=>{const n=ne(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:ne,{stroke:N,strokeWidth:I,opacity:H})},[ne,S,N,I,H]),re=r(()=>Qs(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=r(()=>Ms({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ae=Ma({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=Bl({ref:o,frameRef:s,isPushMode:J,colorBy:Z,colorScheme:y,showLegend:Y,legendPosition:D,setup:ee}),ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:Q}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:v,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[R,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:f}),W&&{oFormat:W}),{showGrid:E}),le),G&&{title:G}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:ws(w)||se}),(j||C||M||P)&&{customHoverBehavior:ee.customHoverBehavior}),(C||M||j)&&{customClickBehavior:ee.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ae?e(wa,{componentName:"StackedBarChart",message:ae,width:R,height:F}):e(Va,{componentName:"StackedBarChart",width:R,height:F,children:e(Mi,Object.assign({ref:s},ue))})});Dl.displayName="StackedBarChart";const $l={RdBu:X,PiYG:q,PRGn:G,BrBG:Y,RdYlBu:E,RdYlGn:z,Spectral:F},Nl="__likert_neutral_neg",Il="__likert_neutral_pos";function Hl(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Wl(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function Rl(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Nl,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Il,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Fl(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Nl?r=o:o.__likertLevel===Il?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const zl=h(function(t,o){const s=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:l,margin:u,className:d,categoryAccessor:h="question",valueAccessor:f,levelAccessor:p,countAccessor:y="count",levels:v,orientation:m="horizontal",colorScheme:b,barPadding:x=20,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,valueFormat:_,loading:L,emptyContent:T,legendInteraction:B,legendPosition:D,categoryFormat:$,stroke:N,strokeWidth:I,opacity:H}=t,W=s.width,R=s.height,F=s.enableHover,z=s.showGrid,E=s.showLegend,Y=s.title,G=s.description,q=s.summary,X=s.accessibleTable,V=s.categoryLabel,U=s.valueLabel,K="horizontal"===m,Q=void 0===l,Z=!p,J=function(){var e;const t=la();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ee=r(()=>b&&Array.isArray(b)&&b.length>=v.length?b:function(e,t){if(0>=e)return[];if(t){const o=$l[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(v.length,J),[b,v.length,J]),te=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],ee[t]||"#888");return e},[v,ee]),{processedData:oe,reAggregate:ne,accumulatorRef:ie}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:s,countAccessor:a,isDiverging:l,frameRef:u}){const d=!s,h=r(()=>Hl(o,"question"),[o]),g=r(()=>d?Hl(n,"score"):null,[d,n]),f=r(()=>d?null:Hl(s,"level"),[d,s]),p=r(()=>d?null:Hl(a,"count"),[d,a]),y=e||[],v=i([]),m=r(()=>{if(0===y.length)return[];let e=Wl(y,t,h,g,f,p);return l&&(e=Rl(e,t),e=Fl(e,t)),e},[y,t,h,g,f,p,l]),b=c(e=>{var o;let n=Wl(e,t,h,g,f,p);l&&(n=Rl(n,t),n=Fl(n,t)),null===(o=u.current)||void 0===o||o.replace(n)},[t,h,g,f,p,l,u]);return{processedData:m,reAggregate:b,accumulatorRef:v}}({data:l,levels:v,categoryAccessor:h,valueAccessor:f,levelAccessor:p,countAccessor:y,isDiverging:K,frameRef:a}),re="__likertLevelLabel",se=dl({isPushMode:Q,colorBy:re,colorScheme:ee,showLegend:E,legendPosition:D}),ae=c(se.wrapPush(e=>{ie.current.push(e),ne(ie.current)}),[se.wrapPush,ne,ie]),le=c(se.wrapPushMany(e=>{ie.current.push(...e),ne(ie.current)}),[se.wrapPushMany,ne,ie]);g(o,()=>({push:ae,pushMany:le,remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;ie.current=[],se.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ae,le,se.resetCategories,ie]);const ce=tl({data:oe,rawData:l,colorBy:re,colorScheme:ee,legendInteraction:B,legendPosition:D,selection:S,linkedHover:O,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:M,chartType:"LikertChart",chartId:P,showLegend:E,userMargin:u,marginDefaults:s.marginDefaults,loading:L,emptyContent:T,width:W,height:R});if(ce.earlyReturn)return ce.earlyReturn;const ue=r(()=>{const e=v.length;return e%2!=0&&te.get(v[Math.floor(e/2)])||"#888"},[v,te]),de=A.pieceStyle,he=r(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Nl||r===Il)s={fill:ue};else{const e=i||r;s=e&&te.has(e)?{fill:te.get(e)}:{fill:"#888"}}if(de){const o=de(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[te,ue,de]),ge=r(()=>ka(he,{stroke:N,strokeWidth:I,opacity:H}),[he,N,I,H]),fe=r(()=>Qs(ge,ce.effectiveSelectionHook,ce.resolvedSelection),[ge,ce.effectiveSelectionHook,ce.resolvedSelection]),pe=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),ye=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Nl||o===Il?pe:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===Nl||o===Il?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:vs},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[pe]),ve=r(()=>{if(!v||2>v.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&p)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(p&&!y)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Z?f&&(e.valueAccessor=f):(p&&(e.levelAccessor=p),y&&(e.countAccessor=y)),Ma({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:v}})},[l,h,f,p,y,v,Z]),me=r(()=>[{styleFn:e=>({fill:te.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,te]),be=r(()=>!1!==E?Object.assign(Object.assign({},ce.legendBehaviorProps),{legend:{legendGroups:me},legendPosition:D||ce.legendPosition||"bottom"}):ce.legendBehaviorProps,[ce.legendBehaviorProps,ce.legendPosition,D,E,me]),xe=r(()=>{const e=Object.assign({},ce.margin);if(Q&&!1!==E){const t=D||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(se.streamingMarginAdjust)for(const[t,o]of Object.entries(se.streamingMarginAdjust))o>e[t]&&(e[t]=o);return K&&100>e.left&&(e.left=100),e},[ce.margin,se.streamingMarginAdjust,K,Q,E,D]),ke=r(()=>_||(K?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[K,_]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:oe}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:K?"horizontal":"vertical",pieceStyle:fe,size:[W,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:xe,barPadding:x,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:V,rLabel:U||(K?void 0:"Percentage"),rFormat:ke}),$&&{oFormat:$}),{showGrid:z}),be),Y&&{title:Y}),G&&{description:G}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===k?()=>null:!0===k?ye:ws(k)||ye}),(O||j||C||M)&&{customHoverBehavior:ce.customHoverBehavior}),(j||C||O)&&{customClickBehavior:ce.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ve?e(wa,{componentName:"LikertChart",message:ve,width:W,height:R}):e(Va,{componentName:"LikertChart",width:W,height:R,children:e(Mi,Object.assign({ref:a},we))})});function El({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=Ks("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),s=zs({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof n?n:"value")}),a=i(s.brushInteraction);a.current=s.brushInteraction;const l=c(e=>{if(r){a.current.end(e?e.r:null)}null==t||t(e)},[t,r]),u=!!(e||o||t);return{hasBrush:u,handleBrush:l,brushStreamProps:u?{brush:{dimension:"r"},onBrush:l}:{}}}zl.displayName="LikertChart";const Yl=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:f,colorBy:p,colorScheme:y,sizeBy:v,sizeRange:m=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,brush:S,onBrush:O,linkedBrush:j,frameProps:C={},selection:M,linkedHover:P,onObservation:_,onClick:L,hoverHighlight:T,chartId:B,loading:D,emptyContent:$,legendInteraction:N,legendPosition:I,color:H,stroke:W,strokeWidth:R,opacity:F,showCategoryTicks:z,categoryFormat:E}=t,Y=n.width,G=n.height,q=n.enableHover,X=n.showGrid,V=n.title,U=n.description,K=n.summary,Q=n.accessibleTable,Z=n.categoryLabel,J=n.valueLabel,ee=a||[],te=tl({data:ee,rawData:a,colorBy:p,colorScheme:y,legendInteraction:N,legendPosition:I,selection:M,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:B,showLegend:n.showLegend,userMargin:l,marginDefaults:n.marginDefaults,loading:D,emptyContent:$,width:Y,height:G}),oe=El({brushProp:S,onBrushProp:O,linkedBrush:j,valueAccessor:d});if(te.earlyReturn)return te.earlyReturn;const ne=r(()=>{if(!v)return;const e=ee.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[ee,v]),ie=ua(),re=r(()=>new Map,[ee]),se=C.pieceStyle,ae=r(()=>(e,t)=>{const o={fillOpacity:x};if(o.fill=p?st(e,p,te.colorScale):da(H,ie,y,void 0,re),o.r=v?lt(e,v,m,ne):b,se){const n=se(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[p,te.colorScale,v,m,ne,b,x,H,ie,y,re,se]),le=r(()=>ka(ae,{stroke:W,strokeWidth:R,opacity:F}),[ae,W,R,F]),ce=r(()=>Qs(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),ue=r(()=>Ms({categoryAccessor:u,valueAccessor:d,groupAccessor:p||void 0,valueFormat:f}),[u,d,p,f]),de=Ma({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(de)return e(wa,{componentName:"SwarmPlot",message:de,width:Y,height:G});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,barPadding:k,enableHover:q}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:f}),E&&{oFormat:E}),{showGrid:X,showCategoryTicks:z}),te.legendBehaviorProps),V&&{title:V}),U&&{description:U}),K&&{summary:K}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:ws(w)||ue}),(P||_||L||T)&&{customHoverBehavior:te.customHoverBehavior}),(_||L||P)&&{customClickBehavior:te.customClickBehavior}),A&&A.length>0&&{annotations:A}),oe.brushStreamProps),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"SwarmPlot",width:Y,height:G,children:e(Mi,Object.assign({ref:s},he))})});function Gl(o){return n=>{var i;const r=n.category||n.data&&(null===(i=n.data[0])||void 0===i?void 0:i.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return t("div",{className:"semiotic-tooltip",style:vs,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&t("div",{children:["n = ",s.n]}),null!=s.min&&t("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&t("div",{children:["Q1: ",s.q1.toLocaleString()]}),t("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&t("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&t("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&t("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==o?void 0:o.valueAccessor){const i=o.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return t("div",{className:"semiotic-tooltip",style:vs,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&t("div",{children:["n = ",a]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:vs,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}Yl.displayName="SwarmPlot";const ql=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:f,colorBy:p,colorScheme:y,showOutliers:v=!0,categoryPadding:m=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:j,chartId:C,loading:M,emptyContent:P,legendInteraction:_,legendPosition:L,color:T,stroke:B,strokeWidth:D,opacity:$,showCategoryTicks:N,categoryFormat:I}=t,H=n.width,W=n.height,R=n.enableHover,F=n.showGrid,z=n.title,E=n.description,Y=n.summary,G=n.accessibleTable,q=n.categoryLabel,X=n.valueLabel,V=a||[],U=tl({data:V,rawData:a,colorBy:p,colorScheme:y,legendInteraction:_,legendPosition:L,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:j,chartType:"BoxPlot",chartId:C,showLegend:n.showLegend,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:P,width:H,height:W});if(U.earlyReturn)return U.earlyReturn;const K=ua(),Q=r(()=>new Map,[V]),Z=r(()=>e=>{const t=p?st(e,p,U.colorScale):da(T,K,y,void 0,Q);return{fill:t,stroke:t,fillOpacity:.8}},[p,U.colorScale,T,K,y,Q]),J=r(()=>ka(Z,{stroke:B,strokeWidth:D,opacity:$}),[Z,B,D,$]),ee=r(()=>Qs(J,U.effectiveSelectionHook,U.resolvedSelection),[J,U.effectiveSelectionHook,U.resolvedSelection]),te=r(()=>Gl(),[]),oe=Ma({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return e(wa,{componentName:"BoxPlot",message:oe,width:H,height:W});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:V}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:v,size:[H,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,barPadding:m,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:q,rLabel:X,rFormat:f}),I&&{oFormat:I}),{showGrid:F,showCategoryTicks:N}),U.legendBehaviorProps),z&&{title:z}),E&&{description:E}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:ws(b)||te}),(A||S||O||j)&&{customHoverBehavior:U.customHoverBehavior}),(S||O||A)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"BoxPlot",width:H,height:W,children:e(Mi,Object.assign({ref:s},ne))})});ql.displayName="BoxPlot";const Xl=h(function(o,n){const s=ba(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=i(null);g(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",bins:f=25,relative:p=!1,valueFormat:y,colorBy:v,colorScheme:m,categoryPadding:b=20,tooltip:x,annotations:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:j,linkedHover:C,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:T,emptyContent:B,legendInteraction:D,legendPosition:$,color:N,stroke:I,strokeWidth:H,opacity:W,showCategoryTicks:R,categoryFormat:F}=o,z=s.width,E=s.height,Y=s.enableHover,G=s.showGrid,q=s.title,X=s.description,V=s.summary,U=s.accessibleTable,K=s.categoryLabel,Q=s.valueLabel,Z=l||[],J=tl({data:Z,rawData:l,colorBy:v,colorScheme:m,legendInteraction:D,legendPosition:$,selection:j,linkedHover:C,fallbackFields:v?["string"==typeof v?v:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,chartType:"Histogram",chartId:L,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=El({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=r(()=>{if(0===Z.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of Z){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[Z,h]),oe=ua(),ne=r(()=>new Map,[Z]),ie=r(()=>e=>{const t=v?st(e,v,J.colorScale):da(N,oe,m,void 0,ne);return{fill:t,stroke:t,fillOpacity:.8}},[v,J.colorScale,N,oe,m,ne]),re=r(()=>ka(ie,{stroke:I,strokeWidth:H,opacity:W}),[ie,I,H,W]),se=r(()=>Qs(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return t("div",{className:"semiotic-tooltip",style:vs,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),s&&2===s.length&&t("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=Ma({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return e(wa,{componentName:"Histogram",message:le,width:z,height:E});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:f,normalize:p}),te&&{rExtent:te}),{size:[z,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,barPadding:b,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:s.showAxes,oLabel:K,rLabel:Q,rFormat:y}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:R}),J.legendBehaviorProps),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===x?()=>null:ws(x)||ae}),(C||M||P||_)&&{customHoverBehavior:J.customHoverBehavior}),(M||P||C)&&{customClickBehavior:J.customClickBehavior}),k&&k.length>0&&{annotations:k}),ee.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"Histogram",width:z,height:E,children:e(Mi,Object.assign({ref:a},ce))})});Xl.displayName="Histogram";const Vl=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:f=25,showIQR:p=!0,valueFormat:y,colorBy:v,colorScheme:m,categoryPadding:b=20,tooltip:x,annotations:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:j,linkedHover:C,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:T,emptyContent:B,legendInteraction:D,legendPosition:$,color:N,stroke:I,strokeWidth:H,opacity:W,showCategoryTicks:R,categoryFormat:F}=t,z=n.width,E=n.height,Y=n.enableHover,G=n.showGrid,q=n.title,X=n.description,V=n.summary,U=n.accessibleTable,K=n.categoryLabel,Q=n.valueLabel,Z=a||[],J=tl({data:Z,rawData:a,colorBy:v,colorScheme:m,legendInteraction:D,legendPosition:$,selection:j,linkedHover:C,fallbackFields:v?["string"==typeof v?v:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,chartType:"ViolinPlot",chartId:L,showLegend:n.showLegend,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=El({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:d});if(J.earlyReturn)return J.earlyReturn;const te=ua(),oe=r(()=>new Map,[Z]),ne=r(()=>e=>{const t=v?st(e,v,J.colorScale):da(N,te,m,void 0,oe);return{fill:t,stroke:t,fillOpacity:.6}},[v,J.colorScale,N,te,m,oe]),ie=r(()=>ka(ne,{stroke:I,strokeWidth:H,opacity:W}),[ne,I,H,W]),re=r(()=>Qs(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Gl({valueAccessor:d}),[d]),ae=Ma({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return e(wa,{componentName:"ViolinPlot",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:f,showIQR:p,size:[z,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:b,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:y}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:R}),J.legendBehaviorProps),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:ws(x)||se}),(C||M||P||_)&&{customHoverBehavior:J.customHoverBehavior}),(M||P||C)&&{customClickBehavior:J.customClickBehavior}),k&&k.length>0&&{annotations:k}),ee.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"ViolinPlot",width:z,height:E,children:e(Mi,Object.assign({ref:s},le))})});Vl.displayName="ViolinPlot";const Ul=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=s.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:f=20,amplitude:p=1.5,valueFormat:y,colorBy:v,colorScheme:m,categoryPadding:b=5,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:_,legendInteraction:L,legendPosition:T,color:B,stroke:D,strokeWidth:$,opacity:N,showCategoryTicks:I,categoryFormat:H}=t,W=n.width,R=n.height,F=n.enableHover,z=n.showGrid,E=n.title,Y=n.description,G=n.summary,q=n.accessibleTable,X=n.categoryLabel,V=n.valueLabel,U=a||[],K=tl({data:U,rawData:a,colorBy:v,colorScheme:m,legendInteraction:L,legendPosition:T,selection:A,linkedHover:S,fallbackFields:v?["string"==typeof v?v:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:C,chartType:"RidgelinePlot",chartId:M,showLegend:n.showLegend,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:_,width:W,height:R});if(K.earlyReturn)return K.earlyReturn;const Q=ua(),Z=r(()=>new Map,[U]),J=r(()=>e=>{const t=v?st(e,v,K.colorScale):da(B,Q,m,void 0,Z);return{fill:t,stroke:t,fillOpacity:.5}},[v,K.colorScale,B,Q,m,Z]),ee=r(()=>ka(J,{stroke:D,strokeWidth:$,opacity:N}),[J,D,$,N]),te=r(()=>Qs(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),oe=r(()=>Gl(),[]),ne=Ma({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return e(wa,{componentName:"RidgelinePlot",message:ne,width:W,height:R});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:U}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:f,size:[W,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:b,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:X,rLabel:V,rFormat:y}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:I,oSort:!1,amplitude:p}),K.legendBehaviorProps),E&&{title:E}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:ws(x)||oe}),(S||O||j||C)&&{customHoverBehavior:K.customHoverBehavior}),(O||j||S)&&{customClickBehavior:K.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"RidgelinePlot",width:W,height:R,children:e(Mi,Object.assign({ref:s},ie))})});Ul.displayName="RidgelinePlot";const Kl=h(function(o,n){const s=ba(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=i(null);g(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:f,colorBy:p,colorScheme:y,orientation:v="horizontal",connectorOpacity:m=.3,showLabels:b=!0,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:j,hoverHighlight:C,chartId:M,loading:P,emptyContent:_,legendInteraction:L,legendPosition:T,color:B,stroke:D,strokeWidth:$,opacity:N,categoryFormat:I}=o,H="vertical"===v,W=s.width,R=s.height,F=s.enableHover,z=s.title,E=s.description,Y=s.summary,G=s.accessibleTable,q=l||[],X=p||f,V=!X,U=tl({data:q,rawData:l,colorBy:X,colorScheme:y,legendInteraction:L,legendPosition:T,selection:A,linkedHover:S,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:C,chartType:"FunnelChart",chartId:M,showLegend:s.showLegend,userMargin:c,marginDefaults:H?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},loading:P,emptyContent:_,width:W,height:R});if(U.earlyReturn)return U.earlyReturn;Ja("FunnelChart",q,"stepAccessor",d),Ja("FunnelChart",q,"valueAccessor",h);const K=ua(),Q=r(()=>new Map,[q]),Z=r(()=>{if(V)return B||((null==K?void 0:K[0])?K[0]:Array.isArray(y)&&y[0]?y[0]:"#4e79a7")},[V,B,K,y]),J=w.pieceStyle,ee=r(()=>(e,t)=>{const o={};if(o.fill=Z||(X?st(e,X,U.colorScale):da(B,K,y,t,Q)),J){const n=J(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[Z,X,U.colorScale,B,K,y,Q,J]),te=r(()=>ka(ee,{stroke:D,strokeWidth:$,opacity:N}),[ee,D,$,N]),oe=r(()=>Qs(te,U.effectiveSelectionHook,U.resolvedSelection),[te,U.effectiveSelectionHook,U.resolvedSelection]),ne=r(()=>o=>{var n,i,r,s,a,l;const c=(null==o?void 0:o.data)||o,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(n=null==c?void 0:c.__funnelValue)&&void 0!==n?n:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:vs,children:[u&&e("div",{style:{fontWeight:"bold"},children:u+""}),p&&p!==u&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[d+"",y]})]})},[]),ie=Ma({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(ie)return e(wa,{componentName:"FunnelChart",message:ie,width:W,height:R});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:H?"bar-funnel":"funnel"},null!=l&&{data:q}),{oAccessor:d,rAccessor:h}),f&&{stackBy:f}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:oe,size:[W,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),I&&{oFormat:I}),{showGrid:H}),!H&&{connectorOpacity:m}),{showLabels:b}),U.legendBehaviorProps),z&&{title:z}),E&&{description:E}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===x?()=>null:!0===x||null==x?ne:ws(x)||ne}),(S||O||j||C)&&{customHoverBehavior:U.customHoverBehavior}),(O||j||S)&&{customClickBehavior:U.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"FunnelChart",width:W,height:R,children:e(Mi,Object.assign({ref:a},re))})});Kl.displayName="FunnelChart";const Ql=h(function(t,o){var n;const s=ba(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:f="horizontal",valueFormat:p,colorBy:y,colorScheme:v,sort:m="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,loading:_,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:$,strokeWidth:N,opacity:I,categoryFormat:H}=t,W=s.width,R=s.height,F=s.enableHover,z=s.showGrid,E=s.title,Y=s.description,G=s.summary,q=s.accessibleTable,X=s.categoryLabel,V=s.valueLabel,U=l||[],K=tl({data:U,rawData:l,colorBy:y,colorScheme:v,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:M,chartType:"DotPlot",chartId:P,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:_,emptyContent:L,width:W,height:R});if(K.earlyReturn)return K.earlyReturn;const Q=ga(U,m,h),Z=ua(),J=r(()=>new Map,[U]),ee=A.pieceStyle,te=r(()=>(e,t)=>{const o={r:b,fillOpacity:.8};if(o.fill=y?st(e,y,K.colorScale):da(D,Z,v,void 0,J),ee){const n=ee(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[y,K.colorScale,b,D,Z,v,J,ee]),oe=r(()=>ka(te,{stroke:$,strokeWidth:N,opacity:I}),[te,$,N,I]),ne=r(()=>Qs(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),ie=r(()=>Ms({categoryAccessor:d,valueAccessor:h,valueFormat:p}),[d,h,p]),re=Ma({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e(wa,{componentName:"DotPlot",message:re,width:W,height:R});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:ne,size:[W,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:x,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:X,rLabel:V,rFormat:p}),H&&{oFormat:H}),{showGrid:z,oSort:m}),K.legendBehaviorProps),E&&{title:E}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),u&&{className:u}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===k?()=>null:ws(k)||ie}),(O||j||C||M)&&{customHoverBehavior:K.customHoverBehavior}),(j||C||O)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e(Va,{componentName:"DotPlot",width:W,height:R,children:e(Mi,Object.assign({ref:a},se))})});Ql.displayName="DotPlot";const Zl=h(function(t,o){var n,s;const a=ba(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:_,color:L,stroke:T,strokeWidth:B,opacity:D}=t,$=a.width,N=a.height,I=a.enableHover,H=a.showLegend,W=a.title,R=a.description,F=a.summary,z=a.accessibleTable,E=c||[],Y=f||h,G=void 0===c,q=tl({data:E,rawData:c,colorBy:Y,colorScheme:p,legendInteraction:P,legendPosition:_,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:j,showLegend:H,userMargin:u,marginDefaults:a.marginDefaults,loading:C,emptyContent:M,width:$,height:N});if(q.earlyReturn)return q.earlyReturn;const X=ua(),V=r(()=>new Map,[E]),U=r(()=>(e,t)=>Y?q.colorScale?{fill:st(e,Y,q.colorScale)}:{}:{fill:da(L,X,p,t,V)},[Y,q.colorScale,L,X,p,V]),K=r(()=>{const e=null==x?void 0:x.pieceStyle;return ka(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},U(t,o)),e(t,o)||{}):U,{stroke:T,strokeWidth:B,opacity:D})},[U,x,T,B,D]),Q=r(()=>Qs(K,q.effectiveSelectionHook,q.resolvedSelection),[K,q.effectiveSelectionHook,q.resolvedSelection]),Z=r(()=>Ms({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),J=Ma({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=Bl({ref:o,frameRef:l,isPushMode:G,colorBy:Y,colorScheme:p,showLegend:H,legendPosition:_,setup:q}),oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:E}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Q,startAngle:y}),null!=v&&{cornerRadius:v}),{size:[$,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),ee),W&&{title:W}),R&&{description:R}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:ws(m)||Z}),(w||A||S||O)&&{customHoverBehavior:q.customHoverBehavior}),(A||S||w)&&{customClickBehavior:q.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?e(wa,{componentName:"PieChart",message:J,width:$,height:N}):e(Va,{componentName:"PieChart",width:$,height:N,children:e(Mi,Object.assign({ref:l},oe))})});Zl.displayName="PieChart";const Jl=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:j,loading:C,emptyContent:M,legendInteraction:P,legendPosition:_,color:L,stroke:T,strokeWidth:B,opacity:D}=t,$=n.width,N=n.height,I=n.enableHover,H=n.showLegend,W=n.title,R=n.description,F=n.summary,z=n.accessibleTable,E=a||[],Y=f||u,G=void 0===a,q=tl({data:E,rawData:a,colorBy:Y,colorScheme:p,legendInteraction:P,legendPosition:_,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:j,showLegend:H,userMargin:l,marginDefaults:n.marginDefaults,loading:C,emptyContent:M,width:$,height:N});if(q.earlyReturn)return q.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min($,N)),V=ua(),U=r(()=>new Map,[E]),K=x.pieceStyle,Q=r(()=>(e,t)=>{let o;if(o=Y?q.colorScale?{fill:st(e,Y,q.colorScale)}:{}:{fill:da(L,V,p,t,U)},K){const n=K(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[Y,q.colorScale,L,V,p,U,K]),Z=r(()=>ka(Q,{stroke:T,strokeWidth:B,opacity:D}),[Q,T,B,D]),J=r(()=>Qs(Z,q.effectiveSelectionHook,q.resolvedSelection),[Z,q.effectiveSelectionHook,q.resolvedSelection]),ee=r(()=>Ms({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[u,d,f]),te=Ma({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:oe,effectiveMargin:ne}=Bl({ref:o,frameRef:s,isPushMode:G,colorBy:Y,colorScheme:p,showLegend:H,legendPosition:_,setup:q}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:E}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:y}),null!=v&&{cornerRadius:v}),{centerContent:g,size:[$,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),oe),W&&{title:W}),R&&{description:R}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:ws(m)||ee}),(w||A||S||O)&&{customHoverBehavior:q.customHoverBehavior}),(A||S||w)&&{customClickBehavior:q.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?e(wa,{componentName:"DonutChart",message:te,width:$,height:N}):e(Va,{componentName:"DonutChart",width:$,height:N,children:e(Mi,Object.assign({ref:s},ie))})});Jl.displayName="DonutChart";const ec=h(function(o,n){const s=ba(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),a=i(null),l="context"===o.mode,{compactMode:c}=s,{value:u,min:d=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:v=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!c,sweep:w=240,fillZones:A=!0,tooltip:S,annotations:O,frameProps:j={},className:C,stroke:M,strokeWidth:P,opacity:_}=o,L=s.width,T=s.height,B=s.title,D=s.description,$=s.summary,N=s.accessibleTable,I=Math.max(d,Math.min(h,u)),H=h-d||1,W=(I-d)/H,{gaugeData:R,pieceStyle:F,gaugeAnnotations:z}=r(()=>{const e=[],t=new Map,o=[];let n=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>n[n.length-1].value&&n.push({value:h,color:n[n.length-1].color});let i=d;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/H;if(A){const n=(i-d)/H,a=Math.max(0,Math.min(W,(r.value-d)/H)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:p,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(k&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:p},gaugeAnnotations:o}},[u,d,h,g,f,p,W,H,k,A]),E=r(()=>ka(F,{stroke:M,strokeWidth:P,opacity:_}),[F,M,P,_]),Y=w*Math.PI/180,G=180+(360-w)/2,q=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+G*Math.PI/180,V=[[Math.cos(X),Math.sin(X)],[Math.cos(X+Y),Math.sin(X+Y)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>Y+.001||V.push([Math.cos(e),Math.sin(e)]);const U=Math.min(...V.map(e=>e[0])),K=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),Z=Math.max(...V.map(e=>e[1])),J=(Q+Z)/2,ee=(U+K)/2,te=Math.max(4,Math.min((L-2*q)/(K-U),(T-2*q)/(Z-Q))-2),oe=Math.max(0,Math.min(te-1.5,te*(1-y))),ne=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b(I,d,h):b;const o=x?x(I):Math.round(I)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),k&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[b,I,d,h,x,k,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x(I):Math.round(I)+""}:null,[l,b,I,x]),le=r(()=>{if(!v)return null;const e=-Math.PI/2+G*Math.PI/180+W*Y,t=oe>20?oe-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[v,W,G,Y,oe,m]),ce=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-oe),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return t("g",{transform:`translate(${r},${s})`,children:[e("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const t=-Math.PI/2+G*Math.PI/180+(o.value-d)/H*Y,r=oe-14,s=(i.height||T)/2;return e("text",{x:(i.width||L)/2+Math.cos(t)*r,y:s+Math.sin(t)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label},"gauge-label-"+n)}return"gauge-value"===o.type?e("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*oe,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[L,T,d,H,G,Y,oe,te]),ue=r(()=>{const e=[...z,...O||[]];return le&&e.push(le),ae&&e.push(ae),e},[z,O,le,ae]),de=r(()=>o=>{var n;const i=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n[0])||(null==o?void 0:o.data)||o,r=null==i?void 0:i._isFill;return t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(I):"Remaining"})]})},[I]);if(0===R.length)return e(wa,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:R,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:oe,startAngle:G,sweepAngle:w,centerContent:se,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:ne-re/2,right:L-ne-re/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:ws(S)||de,svgAnnotationRules:ce},ue.length>0&&{annotations:ue}),B&&{title:B}),D&&{description:D}),$&&{summary:$}),void 0!==N&&{accessibleTable:N}),C&&{className:C}),null!=o.animate&&{animate:o.animate}),j);return e(Va,{componentName:"GaugeChart",width:L,height:T,children:e(Mi,Object.assign({ref:a},he))})});ec.displayName="GaugeChart";const tc=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:v=!1,barPadding:m=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,loading:_,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:$,strokeWidth:N,opacity:I,categoryFormat:H}=t,W=n.width,R=n.height,F=n.enableHover,z=n.showGrid,E=n.showLegend,Y=n.title,G=n.description,q=n.summary,X=n.accessibleTable,V=n.categoryLabel,U=n.valueLabel,K=a||[],Q=p||d,Z=void 0===a,J=tl({data:K,rawData:a,colorBy:Q,colorScheme:y,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:M,chartType:"GroupedBarChart",chartId:P,showLegend:E,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:L,width:W,height:R});if(J.earlyReturn)return J.earlyReturn;const ee=ua(),te=r(()=>new Map,[K]),oe=A.pieceStyle,ne=r(()=>(e,t)=>{const o=Q?J.colorScale?{fill:st(e,Q,J.colorScale)}:{}:{fill:da(D,ee,y,t,te)};if(oe){const n=oe(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[Q,J.colorScale,D,ee,y,te,oe]),ie=r(()=>ka(ne,{stroke:$,strokeWidth:N,opacity:I}),[ne,$,N,I]),re=r(()=>Qs(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Ms({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ae=Ma({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=Bl({ref:o,frameRef:s,isPushMode:Z,colorBy:Q,colorScheme:y,showLegend:E,legendPosition:B,setup:J}),ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[W,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,barPadding:m}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:V,rLabel:U,rFormat:f}),H&&{oFormat:H}),{showGrid:z}),le),Y&&{title:Y}),G&&{description:G}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===k?()=>null:ws(k)||se}),(O||j||C||M)&&{customHoverBehavior:J.customHoverBehavior}),(j||C||O)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ae?e(wa,{componentName:"GroupedBarChart",message:ae,width:W,height:R}):e(Va,{componentName:"GroupedBarChart",width:W,height:R,children:e(Mi,Object.assign({ref:s},ue))})});tc.displayName="GroupedBarChart";const oc=h(function(t,o){const n=ba(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:v,tooltip:m,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:j,onClick:C,hoverHighlight:M,chartId:P,loading:_,emptyContent:L,legendInteraction:T,legendPosition:B,color:D,stroke:$,strokeWidth:N,opacity:I,categoryFormat:H,rTickValues:W,tickLabelEdgeAlign:R,showCategoryTicks:F}=t,z=n.width,E=n.height,Y=n.enableHover,G=n.showGrid,q=n.showLegend,X=n.title,V=n.description,U=n.summary,K=n.accessibleTable,Q=n.categoryLabel,Z=n.valueLabel,J=a||[],ee=p||d,te=void 0===a,oe=r(()=>{if(null!=v)return v;if("sparkline"!==t.mode)return 40;const e=new Set(J.map(e=>"function"==typeof u?u(e):e[u])),o=Math.max(1,e.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?E:z)-2*o)/(o-1))):1},[v,t.mode,J,u,g,z,E]),ne=tl({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:M,chartType:"SwimlaneChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:L,width:z,height:E}),ie=El({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(ne.earlyReturn)return ne.earlyReturn;const re=ua(),se=r(()=>new Map,[J]),ae=A.pieceStyle,le=r(()=>(e,t)=>{const o=ee?ne.colorScale?{fill:st(e,ee,ne.colorScale)}:{}:{fill:da(D,re,y,t,se)};if(ae){const n=ae(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ee,ne.colorScale,D,re,y,se,ae]),ce=r(()=>ka(le,{stroke:$,strokeWidth:N,opacity:I}),[le,$,N,I]),ue=r(()=>Qs(ce,ne.effectiveSelectionHook,ne.resolvedSelection),[ce,ne.effectiveSelectionHook,ne.resolvedSelection]),de=r(()=>Ms({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),he=Ma({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:ge,effectiveMargin:fe}=Bl({ref:o,frameRef:s,isPushMode:te,colorBy:ee,colorScheme:y,showLegend:q,legendPosition:B,setup:ne}),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:J}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ue,size:[z,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:fe,barPadding:oe,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===F?void 0:Q,rLabel:Z,rFormat:f}),W&&{rTickValues:W}),null!=R&&{tickLabelEdgeAlign:R}),H&&{oFormat:H}),void 0!==F&&{showCategoryTicks:F}),{showGrid:G}),ge),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:ws(m)||de}),(O||j||C||M)&&{customHoverBehavior:ne.customHoverBehavior}),(j||C||O)&&{customClickBehavior:ne.customClickBehavior}),b&&b.length>0&&{annotations:b}),ie.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return he?e(wa,{componentName:"SwimlaneChart",message:he,width:z,height:E}):e(Va,{componentName:"SwimlaneChart",width:z,height:E,children:e(Mi,Object.assign({ref:s},pe))})});oc.displayName="SwimlaneChart";const nc=h(function(t,o){var n;const s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o,n,i,r;const a=Array.isArray(e)?e:[e],l=null!==(n=null===(o=null===(t=s.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==n?n:[],c=[];for(const e of a){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(i=t.data)&&void 0!==i?i:{}),{id:e})),null===(r=s.current)||void 0===r||r.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var o;const n=null===(o=s.current)||void 0===o?void 0:o.updateNode(e,t);return n?[Object.assign(Object.assign({},n),{id:e})]:[]}),clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=s.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==n?n:[]}}));const a=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:u,className:d,nodeIDAccessor:h="id",sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:v,colorScheme:m,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:j,frameProps:C={},onObservation:M,onClick:P,chartId:_,selection:L,linkedHover:T,loading:B,emptyContent:D,legendInteraction:$,legendPosition:N,stroke:I,strokeWidth:H,opacity:W}=t,R=a.width,F=a.height,z=a.enableHover,E=a.showLegend,Y=null!==(n=a.showLabels)&&void 0!==n&&n,G=a.title,q=a.description,X=a.summary,V=a.accessibleTable,U=Za(B,R,F),K=U?null:Qa(l,R,F,D),Q=l||[],Z=c||[],J=ha(Q,v,m),ee=r(()=>{if(!v)return[];const e=new Set;for(const t of Q){const o="function"==typeof v?v(t):t[v];null!=o&&e.add(o+"")}return Array.from(e)},[Q,v]),te=va($,v,ee),oe=ua(),ne=r(()=>new Map,[]),ie=r(()=>{if(Array.isArray(m))return m;if(oe&&oe.length>0)return oe;const e=tt[m];return Array.isArray(e)?e:ot},[m,oe]),re=r(()=>e=>{const t={};return t.fill=v?st(e.data||e,v,J):da(void 0,oe,m,void 0,ne),"number"==typeof b&&(t.r=b),t},[v,J,b,oe,m,ne]),se=r(()=>ka(re,{stroke:I,strokeWidth:H,opacity:W}),[re,I,H,W]),ae=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),le=r(()=>ka(ae,{stroke:I,strokeWidth:H,opacity:W}),[ae,I,H,W]),ce=r(()=>{if(Y&&y)return"function"==typeof y?y:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==o?o:e[y])&&void 0!==n?n:e.id}},[Y,y]),{legend:ue,margin:de,legendPosition:he}=ya({data:Q,colorBy:v,colorScale:J,showLegend:E,legendPosition:N,userMargin:u,defaults:a.marginDefaults}),{customHoverBehavior:ge,customClickBehavior:fe}=fa({selection:L,linkedHover:T,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:M,onClick:P,chartType:"ForceDirectedGraph",chartId:_}),pe=_a({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:h}});return pe?e(wa,{componentName:"ForceDirectedGraph",message:pe,width:R,height:F}):U||K||e(Va,{componentName:"ForceDirectedGraph",width:R,height:F,children:e(ys,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:Q},null!=c&&{edges:Z},{size:[R,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de,nodeIDAccessor:h,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:se,edgeStyle:le,colorBy:v,colorScheme:ie,nodeSize:b,nodeSizeRange:x,nodeLabel:ce,showLabels:Y,enableHover:z,tooltipContent:!1===j?()=>null:ws(j)||void 0,customHoverBehavior:T||M||P?ge:void 0,customClickBehavior:M||P?fe:void 0,legend:ue,legendPosition:he},$&&"none"!==$&&{legendHoverBehavior:te.onLegendHover,legendClickBehavior:te.onLegendClick,legendHighlightedCategory:te.highlightedCategory,legendIsolatedCategories:te.isolatedCategories},{className:d,title:G,description:q,summary:X,accessibleTable:V},null!=t.animate&&{animate:t.animate},C))})});function ic(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function rc(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function sc(e){return"function"==typeof e?e:t=>t[e]||1}function ac({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=st(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=st(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}nc.displayName="ForceDirectedGraph";const lc=h(function(t,o){var n;const s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o,n,i,r;const a=Array.isArray(e)?e:[e],l=null!==(n=null===(o=null===(t=s.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==n?n:[],c=[];for(const e of a){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(i=t.data)&&void 0!==i?i:{}),{id:e})),null===(r=s.current)||void 0===r||r.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var o;const n=null===(o=s.current)||void 0===o?void 0:o.updateNode(e,t);return n?[Object.assign(Object.assign({},n),{id:e})]:[]}),clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=s.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==n?n:[]}}));const a=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:u,className:d,sourceAccessor:h="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:v,colorScheme:m,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:O,frameProps:j={},onObservation:C,onClick:M,chartId:P,selection:_,linkedHover:L,loading:T,emptyContent:B,legendInteraction:D,stroke:$,strokeWidth:N,opacity:I}=t,H=a.width,W=a.height,R=a.enableHover,F=null===(n=a.showLabels)||void 0===n||n,z=a.title,E=a.description,Y=a.summary,G=a.accessibleTable,q=Za(T,H,W),X=q?null:Qa(c,H,W,B),V=c||[],U=r(()=>rc(l,V,h,f),[l,V,h,f]),K=ha(U,v,m),Q=r(()=>{if(!v)return[];const e=new Set;for(const t of U){const o="function"==typeof v?v(t):t[v];null!=o&&e.add(o+"")}return Array.from(e)},[U,v]),Z=va(D,v,Q),J=ua(),ee=r(()=>new Map,[]),te=r(()=>{if(Array.isArray(m))return m;if(J&&J.length>0)return J;const e=tt[m];return Array.isArray(e)?e:ot},[m,J]),oe=U.length>0,ne=r(()=>{if(oe)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(v)i.fill=st(e.data||e,v,K);else{const r=Array.isArray(m)?m:tt[m]||ot,s=Array.isArray(r)?r:ot,a=null!==(n=null!==(o=e.index)&&void 0!==o?o:t)&&void 0!==n?n:0;i.fill=s[a%s.length]}return i}},[oe,v,K,m]),ie=r(()=>ne?ka(ne,{stroke:$,strokeWidth:N,opacity:I}):void 0,[ne,$,N,I]),re=r(()=>{if(oe)return ac({edgeColorBy:b,colorBy:v,colorScale:K,nodeStyleFn:ie||(e=>({fill:da(void 0,J,m,void 0,ee)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[oe,b,v,K,ie,S,J,m,ee]),se=r(()=>re?ka(re,{stroke:$,strokeWidth:N,opacity:I}):void 0,[re,$,N,I]),ae=r(()=>{if(!F)return;const e=A||y;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[F,A,y]),le=Object.assign(Object.assign({},a.marginDefaults),"number"==typeof u?{top:u,bottom:u,left:u,right:u}:u),{customHoverBehavior:ce,customClickBehavior:ue}=fa({selection:_,linkedHover:L,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:C,onClick:M,chartType:"ChordDiagram",chartId:P}),de=_a({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return de?e(wa,{componentName:"ChordDiagram",message:de,width:H,height:W}):q||X||e(Va,{componentName:"ChordDiagram",width:H,height:W,children:e(ys,Object.assign({ref:s,chartType:"chord"},U.length>0&&{nodes:U},null!=c&&{edges:V},{size:[H,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,nodeIDAccessor:y,sourceAccessor:h,targetAccessor:f,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:ie,edgeStyle:se,colorBy:v,colorScheme:te,edgeColorBy:b,edgeOpacity:S,nodeLabel:ae,showLabels:F,enableHover:R,tooltipContent:!1===O?()=>null:ws(O)||void 0,customHoverBehavior:L||C||M?ce:void 0,customClickBehavior:C||M?ue:void 0},D&&"none"!==D&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories},{className:d,title:z,description:E,summary:Y,accessibleTable:G},null!=t.animate&&{animate:t.animate},j))})});lc.displayName="ChordDiagram";const cc=h(function(t,o){var n;const s=i(null);g(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o,n,i,r;const a=Array.isArray(e)?e:[e],l=null!==(n=null===(o=null===(t=s.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==n?n:[],c=[];for(const e of a){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(i=t.data)&&void 0!==i?i:{}),{id:e})),null===(r=s.current)||void 0===r||r.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var o;const n=null===(o=s.current)||void 0===o?void 0:o.updateNode(e,t);return n?[Object.assign(Object.assign({},n),{id:e})]:[]}),clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=s.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==n?n:[]}}));const a=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:l,edges:c,margin:u,className:d,sourceAccessor:h="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:v,colorScheme:m,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:O=.5,edgeSort:j,tooltip:C,frameProps:M={},onObservation:P,onClick:_,chartId:L,selection:T,linkedHover:B,loading:D,emptyContent:$,legendInteraction:N,stroke:I,strokeWidth:H,opacity:W}=t,R=a.width,F=a.height,z=a.enableHover,E=null===(n=a.showLabels)||void 0===n||n,Y=a.title,G=a.description,q=a.summary,X=a.accessibleTable,V=Za(D,R,F),U=V?null:Qa(c,R,F,$),K=c||[],Q=r(()=>rc(l,K,h,f),[l,K,h,f]),Z=ha(Q,v,m),J=r(()=>{if(!v)return[];const e=new Set;for(const t of Q){const o="function"==typeof v?v(t):t[v];null!=o&&e.add(o+"")}return Array.from(e)},[Q,v]),ee=va(N,v,J),te=ua(),oe=r(()=>new Map,[]),ne=r(()=>{if(Array.isArray(m))return m;if(te&&te.length>0)return te;const e=tt[m];return Array.isArray(e)?e:ot},[m,te]),ie=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=v?st(e.data||e,v,Z):da(void 0,te,m,void 0,oe),t},[v,Z,te,m,oe]),re=r(()=>ka(ie,{stroke:I,strokeWidth:H,opacity:W}),[ie,I,H,W]),se=r(()=>ac({edgeColorBy:b,colorBy:v,colorScale:Z,nodeStyleFn:re,edgeOpacity:O,baseStyle:{stroke:"none",strokeWidth:0}}),[b,v,Z,re,O]),ae=r(()=>ka(se,{stroke:I,strokeWidth:H,opacity:W}),[se,I,H,W]),le=r(()=>{if(!E)return;const e=S||y;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[E,S,y]),ce=Object.assign(Object.assign({},a.marginDefaults),"number"==typeof u?{top:u,bottom:u,left:u,right:u}:u),{customHoverBehavior:ue,customClickBehavior:de}=fa({selection:T,linkedHover:B,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:P,onClick:_,chartType:"SankeyDiagram",chartId:L}),he=_a({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return he?e(wa,{componentName:"SankeyDiagram",message:he,width:R,height:F}):V||U||e(Va,{componentName:"SankeyDiagram",width:R,height:F,children:e(ys,Object.assign({ref:s,chartType:"sankey"},Q.length>0&&{nodes:Q},null!=c&&{edges:K},{size:[R,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,nodeIDAccessor:y,sourceAccessor:h,targetAccessor:f,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:re,edgeStyle:ae,colorBy:v,colorScheme:ne,edgeColorBy:b,edgeOpacity:O,edgeSort:j,nodeLabel:le,showLabels:E,enableHover:z,tooltipContent:!1===C?()=>null:ws(C)||void 0,customHoverBehavior:B||P||_?ue:void 0,customClickBehavior:P||_?de:void 0},N&&"none"!==N&&{legendHoverBehavior:ee.onLegendHover,legendClickBehavior:ee.onLegendClick,legendHighlightedCategory:ee.highlightedCategory,legendIsolatedCategories:ee.isolatedCategories},{className:d,title:Y,description:G,summary:q,accessibleTable:X},null!=t.animate&&{animate:t.animate},M))})});function uc(t){var o;const n=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:s,className:a,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:f,colorByDepth:p=!1,edgeStyle:y="curve",nodeLabel:v,nodeSize:m=5,tooltip:b,frameProps:x={},onObservation:k,onClick:w,chartId:A,selection:S,linkedHover:O,loading:j,legendInteraction:C,stroke:M,strokeWidth:P,opacity:_}=t,L=n.width,T=n.height,B=n.enableHover,D=null===(o=n.showLabels)||void 0===o||o,$=n.title,N=n.description,I=n.summary,H=n.accessibleTable,W=Za(j,L,T),R=r(()=>ic(null!=i?i:null,u),[i,u]),F=ha(R,p?void 0:g,f),z=r(()=>{if(!g||p)return[];const e=new Set;for(const t of R){const o="function"==typeof g?g(t):t[g];null!=o&&e.add(o+"")}return Array.from(e)},[R,g,p]),E=va(C,p?void 0:g,z),Y=ua(),G=r(()=>new Map,[]),q=r(()=>{if(Array.isArray(f))return f;if(Y&&Y.length>0)return Y;const e=tt[f];return Array.isArray(e)?e:ot},[f,Y]),X=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?it[(e.depth||0)%it.length]:g?st(e.data||e,g,F):da(void 0,Y,f,void 0,G),t},[g,p,F,Y,f,G]),V=r(()=>ka(X,{stroke:M,strokeWidth:P,opacity:_}),[X,M,P,_]),U=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),K=r(()=>ka(U,{stroke:M,strokeWidth:P,opacity:_}),[U,M,P,_]),Q=r(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return sc(d)},[l,d]),Z=Object.assign(Object.assign({},n.marginDefaults),"number"==typeof s?{top:s,bottom:s,left:s,right:s}:s),{customHoverBehavior:J,customClickBehavior:ee}=fa({selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,onClick:w,chartType:"TreeDiagram",chartId:A}),te=Pa({componentName:"TreeDiagram",data:i});return te?e(wa,{componentName:"TreeDiagram",message:te,width:L,height:T}):W||e(Va,{componentName:"TreeDiagram",width:L,height:T,children:e(ys,Object.assign({chartType:l},null!=i&&{data:i},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:Q,treeOrientation:c,edgeType:y,nodeStyle:V,edgeStyle:K,colorBy:g,colorScheme:q,colorByDepth:p,nodeSize:m,nodeLabel:D?v||h:void 0,showLabels:D,enableHover:B,tooltipContent:!1===b?()=>null:ws(b)||void 0,customHoverBehavior:O||k||w?J:void 0,customClickBehavior:k||w?ee:void 0},C&&"none"!==C&&{legendHoverBehavior:E.onLegendHover,legendClickBehavior:E.onLegendClick,legendHighlightedCategory:E.highlightedCategory,legendIsolatedCategories:E.isolatedCategories},{className:a,title:$,description:N,summary:I,accessibleTable:H},null!=t.animate&&{animate:t.animate},x))})}function dc(t){var o;const n=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:i,margin:s,className:a,childrenAccessor:l="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,labelMode:p="leaf",nodeLabel:y,padding:v=4,paddingTop:m,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:j,legendInteraction:C,stroke:M,strokeWidth:P,opacity:_}=t,L=n.width,T=n.height,B=n.enableHover,D=null===(o=n.showLabels)||void 0===o||o,$=n.title,N=n.description,I=n.summary,H=n.accessibleTable,W=Za(j,L,T),{activeSelectionHook:R,customHoverBehavior:F,customClickBehavior:z}=fa({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,onClick:S,chartType:"Treemap",chartId:O}),E=el(k),Y=c(e=>{if(!e)return F(null);const t=e.data||e;F({data:(null==t?void 0:t.data)||t})},[F]),G=r(()=>ic(null!=i?i:null,l),[i,l]),q=ha(G,f?void 0:h,g),X=r(()=>{if(!h||f)return[];const e=new Set;for(const t of G){const o="function"==typeof h?h(t):t[h];null!=o&&e.add(o+"")}return Array.from(e)},[G,h,f]),V=va(C,f?void 0:h,X),U=ua(),K=r(()=>new Map,[]),Q=r(()=>{if(Array.isArray(g))return g;if(U&&U.length>0)return U;const e=tt[g];return Array.isArray(e)?e:ot},[g,U]),Z=r(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=f?it[(e.depth||0)%it.length]:h?st(e.data||e,h,q):da(void 0,U,g,void 0,K),t},[h,f,q,U,g,K]),J=r(()=>ka(Z,{stroke:M,strokeWidth:P,opacity:_}),[Z,M,P,_]),ee=r(()=>R?e=>{var t;const o=Object.assign({},J(e));if(R.isActive)if(R.predicate(e.data||e))(null==E?void 0:E.selectedStyle)&&Object.assign(o,E.selectedStyle);else{const e=null!==(t=null==E?void 0:E.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==E?void 0:E.unselectedStyle)&&Object.assign(o,E.unselectedStyle)}return o}:J,[J,R,E]),te=r(()=>sc(u),[u]),oe=void 0!==m?m:!D||"parent"!==p&&"all"!==p?void 0:18,ne=Object.assign(Object.assign({},n.marginDefaults),"number"==typeof s?{top:s,bottom:s,left:s,right:s}:s),ie=Pa({componentName:"Treemap",data:i});return ie?e(wa,{componentName:"Treemap",message:ie,width:L,height:T}):W||e(Va,{componentName:"Treemap",width:L,height:T,children:e(ys,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne,nodeIDAccessor:d,childrenAccessor:l,hierarchySum:te,padding:v,paddingTop:oe,nodeStyle:ee,colorBy:h,colorScheme:Q,colorByDepth:f,nodeLabel:D?y||d:void 0,showLabels:D,labelMode:p,enableHover:B,tooltipContent:!1===b?()=>null:ws(b)||void 0},(w||A||S)&&{customHoverBehavior:Y},(A||S)&&{customClickBehavior:z},C&&"none"!==C&&{legendHoverBehavior:V.onLegendHover,legendClickBehavior:V.onLegendClick,legendHighlightedCategory:V.highlightedCategory,legendIsolatedCategories:V.isolatedCategories},{className:a,title:$,description:N,summary:I,accessibleTable:H},null!=t.animate&&{animate:t.animate},x))})}function hc(t){var o;const n=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:s,className:a,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,nodeLabel:f,circleOpacity:p=.7,padding:y=4,tooltip:v,frameProps:m={},onObservation:b,onClick:x,chartId:k,selection:w,linkedHover:A,loading:S,legendInteraction:O,stroke:j,strokeWidth:C,opacity:M}=t,P=n.width,_=n.height,L=n.enableHover,T=null===(o=n.showLabels)||void 0===o||o,B=n.title,D=n.description,$=n.summary,N=n.accessibleTable,I=Za(S,P,_),H=r(()=>ic(null!=i?i:null,l),[i,l]),W=ha(H,g?void 0:d,h),R=r(()=>{if(!d||g)return[];const e=new Set;for(const t of H){const o="function"==typeof d?d(t):t[d];null!=o&&e.add(o+"")}return Array.from(e)},[H,d,g]),F=va(O,g?void 0:d,R),z=ua(),E=r(()=>new Map,[]),Y=r(()=>{if(Array.isArray(h))return h;if(z&&z.length>0)return z;const e=tt[h];return Array.isArray(e)?e:ot},[h,z]),G=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?it[(e.depth||0)%it.length]:d?st(e.data||e,d,W):da(void 0,z,h,void 0,E),t},[d,g,W,p,z,h,E]),q=r(()=>ka(G,{stroke:j,strokeWidth:C,opacity:M}),[G,j,C,M]),X=r(()=>sc(c),[c]),V=Object.assign(Object.assign({},n.marginDefaults),"number"==typeof s?{top:s,bottom:s,left:s,right:s}:s),{customHoverBehavior:U,customClickBehavior:K}=fa({selection:w,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),Q=Pa({componentName:"CirclePack",data:i});return Q?e(wa,{componentName:"CirclePack",message:Q,width:P,height:_}):I||e(Va,{componentName:"CirclePack",width:P,height:_,children:e(ys,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[P,_],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:X,padding:y,nodeStyle:q,colorBy:d,colorScheme:Y,colorByDepth:g,nodeLabel:T?f||u:void 0,showLabels:T,enableHover:L,tooltipContent:!1===v?()=>null:ws(v)||void 0,customHoverBehavior:A||b||x?U:void 0,customClickBehavior:b||x?K:void 0},O&&"none"!==O&&{legendHoverBehavior:F.onLegendHover,legendClickBehavior:F.onLegendClick,legendHighlightedCategory:F.highlightedCategory,legendIsolatedCategories:F.isolatedCategories},{className:a,title:B,description:D,summary:$,accessibleTable:N},null!=t.animate&&{animate:t.animate},m))})}cc.displayName="SankeyDiagram",uc.displayName="TreeDiagram",dc.displayName="Treemap",hc.displayName="CirclePack";const gc=it;function fc(t){const o=ba(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:v=1,showRings:m=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:j,onClick:C,chartId:M,selection:P,linkedHover:_,loading:L,stroke:T,strokeWidth:B,opacity:D}=t,$=o.width,N=o.height,I=o.enableHover,H=o.title,W=o.description,R=o.summary,F=o.accessibleTable,z=Za(L,$,N),E=ha(r(()=>ic(n,a),[n,a]),d?void 0:c,u),Y=ua(),G=r(()=>new Map,[]),q=r(()=>{if(Array.isArray(u))return u;if(Y&&Y.length>0)return Y;const e=tt[u];return Array.isArray(e)?e:ot},[u,Y]),X=r(()=>{if(Array.isArray(u))return u;const e=tt[u];return Array.isArray(e)?e:ot},[u]),V=r(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=d?n?X[0]:gc[(e.depth||0)%gc.length]:c?st(e.data||e,c,E):da(void 0,Y,u,void 0,G),o.opacity=n?1:.85,o},[c,d,E,X,Y,u,G]),U=r(()=>ka(V,{stroke:T,strokeWidth:B,opacity:D}),[V,T,B,D]),K=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof i?{top:i,bottom:i,left:i,right:i}:i),{customHoverBehavior:Z,customClickBehavior:J}=fa({selection:P,linkedHover:_,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"OrbitDiagram",chartId:M}),ee=r(()=>{if(Z)return e=>{Z(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[Z]),te=r(()=>{if(J)return e=>{J(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[J]),oe=Pa({componentName:"OrbitDiagram",data:n});return oe?e(wa,{componentName:"OrbitDiagram",message:oe,width:$,height:N}):z||e(Va,{componentName:"OrbitDiagram",width:$,height:N,children:e(ys,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[$,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:U,edgeStyle:K,colorBy:c,colorScheme:q,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&I,tooltipContent:k?void 0:!1===w?()=>null:ws(w)||void 0,customHoverBehavior:_||j||C?ee:void 0,customClickBehavior:j||C?te:void 0,foregroundGraphics:A,annotations:S,className:s,title:H,description:W,summary:R,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:v,orbitShowRings:m,orbitAnimated:k,accessibleTable:F},null!=t.animate&&{animate:t.animate},O))})}fc.displayName="OrbitDiagram";const pc=h(function(t,o){var n,r,s,a;const l=ba(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:v,timeAccessor:m,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:O,opacity:j,background:C,tooltipContent:M,tooltip:P,onHover:_,annotations:L,svgAnnotationRules:T,tickFormatTime:B,tickFormatValue:D,decay:$,pulse:N,staleness:I,transition:H,linkedHover:W,selection:R,onObservation:F,chartId:z,loading:E,emptyContent:Y,emphasis:G,legendPosition:q}=t,X=l.showAxes,V=l.enableHover,U=null!=d?d:l.marginDefaults,K=null!=u?u:[l.width,l.height],Q=null!=M?M:P,Z=i(null),{customHoverBehavior:J}=fa({selection:R,linkedHover:W,unwrapData:!0,onObservation:F,chartType:"RealtimeLineChart",chartId:z}),ee=c(e=>{_&&_(e),J(e)},[_,J]);g(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const te=Za(E,K[0],K[1]),oe=te?null:Qa(v,K[0],K[1],Y),ne={stroke:A,strokeWidth:S,strokeDasharray:O};return null!=j&&(ne.opacity=j),te||oe||e(Un,{ref:Z,chartType:"line",runtimeMode:"streaming",size:K,margin:U,className:G?`${h||""} semiotic-emphasis-${G}`.trim():h,arrowOfTime:f,windowMode:p,windowSize:y,data:v,timeAccessor:m,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:X,background:C,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:L,svgAnnotationRules:T,tickFormatTime:B,tickFormatValue:D,decay:$,pulse:N,staleness:I,transition:H,pointIdAccessor:t.pointIdAccessor,legendPosition:q})});pc.displayName="RealtimeLineChart";const yc=h(function(t,o){var n,r,s,a;const l=ba(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,showAxes:t.showAxes,enableHover:null!=t.enableHover?!!t.enableHover:void 0,linkedHover:t.linkedHover}),{binSize:u,size:d,margin:h,className:f,arrowOfTime:p="right",windowMode:y="sliding",windowSize:v=200,data:m,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,fill:j,stroke:C,strokeWidth:M,opacity:P,gap:_,background:L,tooltipContent:T,tooltip:B,onHover:D,annotations:$,svgAnnotationRules:N,tickFormatTime:I,tickFormatValue:H,linkedHover:W,selection:R,decay:F,pulse:z,staleness:E,transition:Y,onObservation:G,chartId:q,loading:X,emptyContent:V,emphasis:U,legendPosition:K,brush:Q,onBrush:Z,linkedBrush:J}=t,ee=l.showAxes,te=l.enableHover,oe=null!=h?h:l.marginDefaults,ne=null!=d?d:[l.width,l.height],ie=null!=T?T:B,re=i(null),{customHoverBehavior:se}=fa({selection:R,linkedHover:W,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:q}),ae=c(e=>{D&&D(e),se(e)},[D,se]),le=!0===Q?{dimension:"x",snap:"bin"}:"x"===Q?{dimension:"x"}:"object"==typeof Q?Q:void 0,ce=Ks(J),ue=zs(Object.assign({name:(null==ce?void 0:ce.name)||"__unused_hist_brush__",xField:(null==ce?void 0:ce.xField)||("string"==typeof b?b:"time")},(null==ce?void 0:ce.yField)?{yField:ce.yField}:{})),de=i(ue.brushInteraction);de.current=ue.brushInteraction;const he=c(e=>{if(Z&&Z(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:q}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:q}),ce){const t=de.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[Z,G,q,ce]);g(o,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=re.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=re.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const ge=Za(X,ne[0],ne[1]),fe=ge?null:Qa(m,ne[0],ne[1],V),pe={};return null!=j&&(pe.fill=j),null!=C&&(pe.stroke=C),null!=M&&(pe.strokeWidth=M),null!=P&&(pe.opacity=P),null!=_&&(pe.gap=_),ge||fe||e(Un,{ref:re,chartType:"bar",runtimeMode:"streaming",size:ne,margin:oe,className:U?`${f||""} semiotic-emphasis-${U}`.trim():f,arrowOfTime:p,windowMode:y,windowSize:v,data:m,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:u,categoryAccessor:S,barColors:O,barStyle:pe,showAxes:ee,background:L,hoverAnnotation:te,tooltipContent:ie,customHoverBehavior:ae,annotations:$,svgAnnotationRules:N,tickFormatTime:I,tickFormatValue:H,decay:F,pulse:z,staleness:E,transition:Y,pointIdAccessor:t.pointIdAccessor,legendPosition:K,brush:le||(J?{dimension:"x"}:void 0),onBrush:le||J?he:void 0})});yc.displayName="RealtimeTemporalHistogram";const vc=yc,mc=h(function(t,o){var n,r,s,a;const l=ba(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:v,timeAccessor:m,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:O,fill:j,opacity:C,stroke:M,strokeWidth:P,background:_,tooltipContent:L,tooltip:T,onHover:B,annotations:D,svgAnnotationRules:$,tickFormatTime:N,tickFormatValue:I,linkedHover:H,selection:W,onObservation:R,chartId:F,loading:z,emptyContent:E,emphasis:Y,legendPosition:G}=t,q=l.showAxes,X=l.enableHover,V=null!=d?d:l.marginDefaults,U=null!=u?u:[l.width,l.height],K=null!=L?L:T,Q=i(null),{customHoverBehavior:Z}=fa({selection:W,linkedHover:H,unwrapData:!0,onObservation:R,chartType:"RealtimeSwarmChart",chartId:F}),J=c(e=>{B&&B(e),Z(e)},[B,Z]);g(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Q.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const ee=Za(z,U[0],U[1]),te=ee?null:Qa(v,U[0],U[1],E),oe={};return null!=O&&(oe.radius=O),null!=j&&(oe.fill=j),null!=C&&(oe.opacity=C),null!=M&&(oe.stroke=M),null!=P&&(oe.strokeWidth=P),ee||te||e(Un,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:Y?`${h||""} semiotic-emphasis-${Y}`.trim():h,arrowOfTime:f,windowMode:p,windowSize:y,data:v,timeAccessor:m,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:oe,showAxes:q,background:_,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:D,svgAnnotationRules:$,tickFormatTime:N,tickFormatValue:I,legendPosition:G,pointIdAccessor:t.pointIdAccessor})});mc.displayName="RealtimeSwarmChart";const bc=h(function(t,o){var n,r,s,a;const l=ba(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:v,timeAccessor:m,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:O,connectorWidth:j,gap:C,stroke:M,strokeWidth:P,opacity:_,background:L,tooltipContent:T,tooltip:B,onHover:D,annotations:$,svgAnnotationRules:N,tickFormatTime:I,tickFormatValue:H,linkedHover:W,selection:R,onObservation:F,chartId:z,loading:E,emptyContent:Y,emphasis:G,legendPosition:q}=t,X=l.showAxes,V=l.enableHover,U=null!=d?d:l.marginDefaults,K=null!=u?u:[l.width,l.height],Q=null!=T?T:B,Z=i(null),{customHoverBehavior:J}=fa({selection:R,linkedHover:W,unwrapData:!0,onObservation:F,chartType:"RealtimeWaterfallChart",chartId:z}),ee=c(e=>{D&&D(e),J(e)},[D,J]);g(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const te=Za(E,K[0],K[1]),oe=te?null:Qa(v,K[0],K[1],Y),ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=O&&(ne.connectorStroke=O),null!=j&&(ne.connectorWidth=j),null!=C&&(ne.gap=C),null!=M&&(ne.stroke=M),null!=P&&(ne.strokeWidth=P),null!=_&&(ne.opacity=_),te||oe||e(Un,{ref:Z,chartType:"waterfall",runtimeMode:"streaming",size:K,margin:U,className:G?`${h||""} semiotic-emphasis-${G}`.trim():h,arrowOfTime:f,windowMode:p,windowSize:y,data:v,timeAccessor:m,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:X,background:L,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:$,svgAnnotationRules:N,tickFormatTime:I,tickFormatValue:H,legendPosition:q,pointIdAccessor:t.pointIdAccessor})});bc.displayName="RealtimeWaterfallChart";const xc=h(function(t,o){var n,r,s,a;const l=ba(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:v,timeAccessor:m,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:O=20,aggregation:j="count",background:C,tooltipContent:M,tooltip:P,onHover:_,annotations:L,svgAnnotationRules:T,tickFormatTime:B,tickFormatValue:D,decay:$,pulse:N,staleness:I,linkedHover:H,selection:W,onObservation:R,chartId:F,loading:z,emptyContent:E,emphasis:Y,legendPosition:G}=t,q=l.showAxes,X=l.enableHover,V=null!=d?d:l.marginDefaults,U=null!=u?u:[l.width,l.height],K=null!=M?M:P,Q=i(null),{customHoverBehavior:Z}=fa({selection:W,linkedHover:H,unwrapData:!0,onObservation:R,chartType:"RealtimeHeatmap",chartId:F}),J=c(e=>{_&&_(e),Z(e)},[_,Z]);g(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Q.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const ee=Za(z,U[0],U[1]),te=ee?null:Qa(v,U[0],U[1],E);return ee||te||e(Un,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:Y?`${h||""} semiotic-emphasis-${Y}`.trim():h,arrowOfTime:f,windowMode:p,windowSize:y,data:v,timeAccessor:m,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:O,heatmapAggregation:j,showAxes:q,background:C,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:L,svgAnnotationRules:T,tickFormatTime:B,tickFormatValue:D,decay:$,pulse:N,staleness:I,legendPosition:G,pointIdAccessor:t.pointIdAccessor})});function kc(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}xc.displayName="RealtimeHeatmap";const wc=864e5;function Ac(e){return 10>e?"0"+e:e+""}const Sc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Oc(e){let t,o=e;return(n,i,r)=>{const s=n instanceof Date?n:new Date(n);e||!r||2>r.length||r===t||(t=r,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 12e4>o?"seconds":72e5>o?"minutes":2*wc>o?"hours":60*wc>o?"days":400*wc>o?"months":"years"}(r));const a=o||"days";return null!=i&&0!==i&&r&&0!==r.length?function(e,t,o){const n=e.getUTCFullYear()!==t.getUTCFullYear(),i=n||e.getUTCMonth()!==t.getUTCMonth(),r=i||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=Sc[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=Ac(e.getUTCHours()),h=Ac(e.getUTCMinutes()),g=Ac(e.getUTCSeconds());switch(o){case"seconds":return n?`${l} ${c}, ${u} ${d}:${h}:${g}`:r?`${l} ${c} ${d}:${h}:${g}`:s?`${d}:${h}:${g}`:a?`${h}:${g}`:":"+g;case"minutes":return n?`${l} ${c}, ${u} ${d}:${h}`:r?`${l} ${c} ${d}:${h}`:s?`${d}:${h}`:":"+h;case"hours":return n?`${l} ${c}, ${u} ${d}:00`:i?`${l} ${c} ${d}:${h}`:r?`${l} ${c} ${d}:00`:d+":00";case"days":return n?`${l} ${c}, ${u}`:i?`${l} ${c}`:""+c;case"months":return n?`${l} ${u}`:""+l;case"years":return""+u}}(s,new Date(r[i-1]),a):function(e,t){const o=Sc[e.getUTCMonth()],n=e.getUTCDate(),i=e.getUTCFullYear(),r=Ac(e.getUTCHours()),s=Ac(e.getUTCMinutes()),a=Ac(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${n}, ${i} ${r}:${s}:${a}`;case"minutes":case"hours":return`${o} ${n}, ${i} ${r}:${s}`;case"days":return`${o} ${n}, ${i}`;case"months":return`${o} ${i}`;case"years":return""+i}}(s,a)}}function jc(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)*(1-t)),i=Math.round(parseInt(o[2],16)*(1-t)),r=Math.round(parseInt(o[3],16)*(1-t));return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Cc(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),i=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),r=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Mc(e,t){return rl(this,void 0,void 0,function*(){const{format:o="png",filename:n="chart",scale:i=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),Pc(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);_c(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*i,o=l.height*i,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,o),c.scale(i,i);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(_c(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function Pc(e,t){var o;const n=e.children,i=t.children,r=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const n=r.getPropertyValue(e);n&&"none"!==n&&""!==n&&(null===(o=t.style)||void 0===o||o.setProperty(e,n))}for(let e=0;Math.min(n.length,i.length)>e;e++)Pc(n[e],i[e])}function _c(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}const Lc=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Tc=new Set(["data","nodes","edges"]),Bc="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Dc(e,t,o){if(!Na[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Na).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(Lc.has(e)||!n&&Tc.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=Bc(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})}function $c(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Na[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Bc(e.props)}}function Nc(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ic(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}function Hc(e){return rl(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?Wc(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(o)})}function Wc(e){const{component:t,props:o}=e,n=["<"+t];for(const[e,t]of Object.entries(o))if("string"==typeof t)n.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)n.push(" "+e);else if("boolean"==typeof t&&!1===t)n.push(` ${e}={false}`);else if("number"==typeof t)n.push(` ${e}={${t}}`);else{const o=JSON.stringify(t);n.push(80>o.length?` ${e}={${o}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return n.push("/>"),n.join("\n")}function Rc(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function Fc(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function zc(e){return"nominal"===e||"ordinal"===e}function Ec(e){return"quantitative"===e||"temporal"===e}const Yc={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},Gc={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},qc={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Xc(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f;const p=[],{type:y,markProps:v}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);n.length>i;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}return o}(e,["type"])}}(e.mark),m=e.encoding||{},b=m.x,x=m.y,k=m.color,w=m.size,A=m.theta,S=m.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.url)&&p.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&p.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&p.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&p.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||e.encoding&&e.encoding.facet||e.encoding&&(e.encoding.row||e.encoding.column))&&p.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&p.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&p.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const j={};e.width&&(j.width=e.width),e.height&&(j.height=e.height);const C=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(C&&(j.title=C),(null==k?void 0:k.field)&&(j.colorBy=k.field,null===(n=k.scale)||void 0===n?void 0:n.scheme)){const e=Yc[k.scale.scheme];e&&(j.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(j.pointOpacity=S.value);const M=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(O&&(M||P)){const e=P?x:b,t=P?b:x,o=qc[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:o,value:n,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[o]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of r){let n;switch(i){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=Math.min(...t);break;case"max":n=Math.max(...t);break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}return s}(O,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const o of O){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}O=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(j.data=O),(null==b?void 0:b.bin)?(j.valueAccessor=b.field,(null==x?void 0:x.field)&&(j.categoryAccessor=x.field),(null===(i=b.axis)||void 0===i?void 0:i.title)&&(j.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(j.valueAccessor=x.field,(null==b?void 0:b.field)&&(j.categoryAccessor=b.field),(null===(r=x.axis)||void 0===r?void 0:r.title)&&(j.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(s=null==b?void 0:b.bin)||void 0===s?void 0:s.maxbins)||(null===(a=null==x?void 0:x.bin)||void 0===a?void 0:a.maxbins):void 0;return t&&(j.bins=t),Uc(e,j,p)}let _;switch(y){case"bar":_=function(e,t,o,n,i,r,s){var a,l,c,u,d,h;let g;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",n.stackBy=o.field):g="BarChart",zc(null==e?void 0:e.type)&&Ec(null==t?void 0:t.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(n.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(n.valueLabel=t.axis.title)):Ec(null==e?void 0:e.type)&&zc(null==t?void 0:t.type)?(n.categoryAccessor=t.field,n.valueAccessor=r?"value":e.field,n.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(n.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(n.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(n.categoryAccessor=e.field),(null==t?void 0:t.field)&&(n.valueAccessor=s?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(n.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(n.valueLabel=t.axis.title)),i&&(n.data=i),g}(b,x,k,j,O,M,P);break;case"line":if(_="LineChart",Vc(b,x,j,M,P),(null==k?void 0:k.field)&&(j.lineBy=k.field),v.interpolate){const e=Gc[v.interpolate];e&&(j.curve=e)}!0===v.point&&(j.showPoints=!0),O&&(j.data=O);break;case"area":if((null==k?void 0:k.field)?(_="StackedAreaChart",j.areaBy=k.field):_="AreaChart",Vc(b,x,j,M,P),v.interpolate){const e=Gc[v.interpolate];e&&(j.curve=e)}void 0!==v.opacity&&(j.areaOpacity=v.opacity),O&&(j.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(_="BubbleChart",j.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(j.sizeRange=w.scale.range)):_="Scatterplot",Vc(b,x,j,M,P),O&&(j.data=O);break;case"rect":_="Heatmap",(null==b?void 0:b.field)&&(j.xAccessor=b.field),(null==x?void 0:x.field)&&(j.yAccessor=x.field),(null==k?void 0:k.field)&&(j.valueAccessor=k.field,delete j.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(j.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(j.yLabel=x.axis.title),O&&(j.data=O);break;case"arc":v.innerRadius&&v.innerRadius>0?(_="DonutChart",j.innerRadius=v.innerRadius):_="PieChart",(null==A?void 0:A.field)?j.valueAccessor=A.field:(null==x?void 0:x.field)&&(j.valueAccessor=P?"value":x.field),(null==k?void 0:k.field)&&(j.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(j.categoryAccessor=b.field),O&&(j.data=O);break;case"tick":_="DotPlot",zc(null==b?void 0:b.type)?(j.categoryAccessor=b.field,(null==x?void 0:x.field)&&(j.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(j.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(j.valueLabel=x.axis.title)):zc(null==x?void 0:x.type)?(j.categoryAccessor=x.field,(null==b?void 0:b.field)&&(j.valueAccessor=M?"value":b.field),j.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(j.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(j.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(j.categoryAccessor=b.field),(null==x?void 0:x.field)&&(j.valueAccessor=P?"value":x.field)),O&&(j.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),_="Scatterplot",Vc(b,x,j,M,P),O&&(j.data=O)}return Uc(_,j,p)}function Vc(e,t,o,n,i){var r,s;(null==e?void 0:e.field)&&(o.xAccessor=n?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(o.xLabel=e.axis.title),(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(o.yLabel=t.axis.title)}function Uc(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}function Kc(){const o=function(){const e=n.useContext(Wo);return e?()=>e.setVisible(e=>!e):null}();return o?e("button",{className:"semiotic-chart-action",onClick:o,title:"Data summary","aria-label":"Toggle data summary",style:tu,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const Qc={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function Zc({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function Jc({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const eu=n.forwardRef(function({title:i,subtitle:r,children:s,width:a="100%",height:l=400,actions:c,chartConfig:u,controls:d,loading:h=!1,error:g,errorBoundary:f=!1,status:p,detailsPanel:y,className:v,style:m},b){const x=n.useRef(null),k=n.useRef(null),[w,A]=n.useState(!1),S=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),O=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),j=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&u,C=!0===(null==c?void 0:c.dataSummary),M="object"==typeof(null==c?void 0:c.export)?c.export:{},P="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",_=n.useCallback(e=>rl(this,void 0,void 0,function*(){k.current&&(yield Mc(k.current,Object.assign(Object.assign({},M),e)))}),[M]),L=n.useCallback(()=>{x.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):x.current.requestFullscreen().catch(()=>{}))},[]),T=n.useCallback(e=>rl(this,void 0,void 0,function*(){u&&(yield Hc(u,e||P||"json"))}),[u,P]);n.useEffect(()=>{const e=()=>{A(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),n.useImperativeHandle(b,()=>({export:_,toggleFullscreen:L,copyConfig:T,element:x.current}),[_,L,T]);const B=i||r||d||S||O||j||C||p,D=h?e(Zc,{height:l}):g?e(Jc,{error:g}):f?e(Aa,{children:s}):s;return $=t(o,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:x,className:"semiotic-chart-container"+(v?" "+v:""),style:Object.assign(Object.assign({width:a,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),m),children:[B&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[d,S&&e("button",{className:"semiotic-chart-action",onClick:()=>_(),title:"Export chart","aria-label":"Export chart",style:tu,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),C&&e(Kc,{}),O&&e("button",{className:"semiotic-chart-action",onClick:L,title:w?"Exit fullscreen":"Fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",style:tu,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(o,w?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),j&&e("button",{className:"semiotic-chart-action",onClick:()=>T(),title:"Copy config","aria-label":"Copy chart configuration",style:tu,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),p&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Qc[p].bg,color:Qc[p].color,lineHeight:"18px"},children:p})]})]}),t("div",{className:"semiotic-chart-body",ref:k,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},w?{flex:1}:{height:l}),children:[D,y]})]})]}),C?e(Ro,{children:$}):$;var $}),tu={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function ou({children:t,columns:o="auto",minCellWidth:i=300,gap:r=16,className:s,style:a}){const l="number"==typeof o?o:void 0;return e("div",{className:"semiotic-chart-grid"+(s?" "+s:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${o}, 1fr)`,gap:r,width:"100%"},a),children:n.Children.map(t,t=>n.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function nu({children:o,context:n,position:i="right",contextSize:r=250,gap:s=12,className:a,style:l}){const c="left"===i||"right"===i,u="left"===i||"top"===i,d=Object.assign({display:"flex",flexDirection:c?u?"row-reverse":"row":u?"column-reverse":"column",gap:s,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:d,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:o}),e("div",{style:h,children:n})]})}ou.displayName="ChartGrid",nu.displayName="ContextLayout";function iu({children:o,position:n="right",size:r=300,trigger:a="click",chartId:l,observation:u,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[v,m]=d(null),[b,x]=d(null),[k,w]=d(!1),[A,S]=d(!1),O=i(null),j=i(void 0),C="click"===a?["click","click-end"]:["hover","hover-end"],{latest:M}=Ys({types:C,chartId:l,limit:1}),P=void 0!==u?u:M;s(()=>{if(P)if("click"===P.type||"hover"===P.type){const e=P;m(e.datum),x(e),k||(w(!0),S(!0),clearTimeout(j.current),j.current=setTimeout(()=>S(!1),200))}else!h||"click-end"!==P.type&&"hover-end"!==P.type||_()},[P]),s(()=>{null==f||f(k)},[k,f]);const _=c(()=>{S(!0),w(!1),clearTimeout(j.current),j.current=setTimeout(()=>{S(!1),m(null),x(null)},200)},[]);if(s(()=>()=>clearTimeout(j.current),[]),!v&&!A)return null;const L=v&&b?o(v,b):null;if(null===L&&!A)return null;const T=function(e,t,o,n){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${n}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:_,"aria-label":"Close details",style:ru,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const ru={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};iu.displayName="DetailsPanel";export{ul as AreaChart,Tl as BarChart,ql as BoxPlot,fl as BubbleChart,Js as CARBON_ALERT,Zs as CARBON_CATEGORICAL_14,ze as COLOR_BLIND_SAFE_CATEGORICAL,Ll as CandlestickChart,_s as CategoryColorProvider,eu as ChartContainer,Aa as ChartErrorBoundary,ou as ChartGrid,lc as ChordDiagram,hc as CirclePack,il as ConnectedScatterplot,nu as ContextLayout,Ye as DARK_THEME,iu as DetailsPanel,Jl as DonutChart,Ql as DotPlot,nc as ForceDirectedGraph,Kl as FunnelChart,ec as GaugeChart,tc as GroupedBarChart,Ge as HIGH_CONTRAST_THEME,gl as Heatmap,Xl as Histogram,Ue as IncrementalExtent,Ee as LIGHT_THEME,zl as LikertChart,cl as LineChart,Vs as LinkedCharts,Sl as MinimapChart,_l as MultiAxisLineChart,ks as MultiLineTooltip,fc as OrbitDiagram,Zl as PieChart,Ol as QuadrantChart,xc as RealtimeHeatmap,vc as RealtimeHistogram,pc as RealtimeLineChart,mc as RealtimeSwarmChart,yc as RealtimeTemporalHistogram,bc as RealtimeWaterfallChart,Ul as RidgelinePlot,Ve as RingBuffer,cc as SankeyDiagram,ol as Scatterplot,wl as ScatterplotMatrix,hl as StackedAreaChart,Dl as StackedBarChart,ys as StreamNetworkFrame,Mi as StreamOrdinalFrame,Un as StreamXYFrame,Yl as SwarmPlot,oc as SwimlaneChart,ea as THEME_PRESETS,aa as ThemeProvider,xs as Tooltip,uc as TreeDiagram,dc as Treemap,Vl as ViolinPlot,Oc as adaptiveTimeTicks,Wc as configToJSX,Hc as copyConfig,vi as createHatchPattern,jc as darkenColor,Fc as deserializeSelections,Mc as exportChart,$c as fromConfig,Ic as fromURL,Xc as fromVegaLite,Cc as lightenColor,ws as normalizeTooltip,ta as resolveThemePreset,Rc as serializeSelections,kc as smartTickFormat,oa as themeToCSS,na as themeToTokens,Dc as toConfig,Nc as toURL,zs as useBrushSelection,Ls as useCategoryColors,Ys as useChartObserver,Es as useFilteredData,Rs as useLinkedHover,Ws as useSelection,la as useTheme};