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
- "use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-quadtree"),o=require("d3-scale-chromatic"),r=require("d3-array"),i=require("d3-hierarchy"),s=require("d3-shape"),a=require("regression"),l=require("d3-selection"),c=require("d3-brush");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const h=d(e),g=u(a);class p{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 y{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,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}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 f{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 m(e,t,n){return e+(t-e)*n}function v(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function b(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function x(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const w={category10:o.schemeCategory10,tableau10:o.schemeTableau10,set3:o.schemeSet3,blues:o.interpolateBlues,reds:o.interpolateReds,greens:o.interpolateGreens,oranges:o.interpolateOranges,purples:o.interpolatePurples,viridis:o.interpolateViridis,plasma:o.interpolatePlasma},k=o.schemeCategory10,A=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],O=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 j(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")||O.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):k[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+""))%k.length]}function S(e,n,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[n]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(r).range(o).unknown("#999");const s=w[o]||w.category10;if(i&&"function"==typeof s){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:k;return t.scaleOrdinal().domain(r).range(e).unknown("#999")}}function M(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function E(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="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:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return i}function _(e){var t,n,o;const i=e.length,s=e[0],a=e[i-1];return{n:i,min:s,q1:null!==(t=r.quantile(e,.25))&&void 0!==t?t:s,median:null!==(n=r.quantile(e,.5))&&void 0!==n?n:(s+a)/2,q3:null!==(o=r.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}const C={bar:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,getStack:a,resolvePieceStyle:l}=e,{r:c,projection:u}=o,d=[],h="vertical"===u,g="horizontal"===u,p=i.normalize,y=[];if(a){const e=new Set;for(const t of Object.values(r))for(const n of t.pieceData){const t=a(n);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(r)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=s(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of y){const s=t.get(i);if(!s)continue;let u=s.total;p&&n>0&&(u/=n);const y=l(s.pieces[0],a?i:e.name),f=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.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(M(e.x,t,e.width,Math.abs(n),y,f,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(M(t,e.x,Math.abs(n),e.width,y,f,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:s,resolvePieceStyle:a}=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=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),g=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(M(i,Math.min(a,d),o,Math.abs(a-d),g,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(M(Math.min(a,d),i,Math.abs(d-a),o,g,r,h[s]))}}}}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:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-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:s(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,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:s,projection:a}=n,l=[],c="vertical"===a;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],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:E,donut:E,boxplot:function(e,t){var n,o,i,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:p}=l,y=[],f="vertical"===p,m=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(n=r.quantile(t,.25))&&void 0!==n?n:l,p=null!==(o=r.quantile(t,.5))&&void 0!==o?o:(l+c)/2,v=null!==(i=r.quantile(t,.75))&&void 0!==i?i:c,b=v-u,x=u-1.5*b,w=v+1.5*b,k=null!==(s=t.find(e=>e>=x))&&void 0!==s?s:l,A=null!==(a=[...t].reverse().find(e=>w>=e))&&void 0!==a?a:c,O=h(e.pieceData[0],e.name),j=[];if(m)for(const t of e.pieceData){const n=d(t);if(x>n||n>w){const o=f?e.middle:g(n),r=f?g(n):e.middle;j.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(k),q1Pos:g(u),medianPos:g(p),q3Pos:g(v),maxPos:g(A),stats:{n:t.length,min:k,q1:u,median:p,q3:v,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:O,datum:e.pieceData,category:e.name,outliers:j}),m)for(const e of j)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:O.fill||"#999",opacity:.6},datum:e.datum})}return y},violin:function(e,t){var n,o,i;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],p="vertical"===h,y=l.bins||20,f=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/y||1,h=Array(y).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),y-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(p){b=`M ${e.middle} ${d(s)}`;for(let t=0;y>t;t++){const n=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=y-1;t>=0;t--){const n=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${n}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;y>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=y-1;t>=0;t--)b+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(f&&t.length>=4){const l=null!==(n=r.quantile(t,.25))&&void 0!==n?n:s,c=null!==(o=r.quantile(t,.5))&&void 0!==o?o:(s+a)/2,u=null!==(i=r.quantile(t,.75))&&void 0!==i?i:a;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:p}}const k=p?{x:e.x,y:Math.min(d(a),d(s)),width:e.width,height:Math.abs(d(a)-d(s))}:{x:Math.min(d(s),d(a)),y:e.x,width:Math.abs(d(a)-d(s)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:_(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=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,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p: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,y=Math.max(...i,1),f=a(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]/y)*e.width*.9,s=l(n+t*r),a=l(n+(t+1)*r);c.push(M(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{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:s,resolveSummaryStyle:a}=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=>s(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 p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=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]/p*f}`;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]/p*f} ${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:_(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.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:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(M(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(M(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,n){var o,r,i,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,p=[],y=n.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===m.length)return p;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let k=0;for(const e of m){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=d(o);r.total+=i,r.pieces.push(o),n+=i}w.push({col:e,groups:t,stepTotal:n}),x||n>k&&(k=n)}if(x)for(const e of w){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>k&&(k=o)}if(0===k)return p;const A=new Map;for(const e of v){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,j=x?.95*y:.9*n.width,S=t.scaleLinear().domain([0,k]).range([0,j]),E=null!==(r=e.config.connectorOpacity)&&void 0!==r?r:.3;let _=new Map;for(let e=0;w.length>e;e++){const t=w[e],n=t.col,o=0===e,r=n.width,u=.55*r,d=n.x+(r-u)/2,h=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=S(o.total))}let r=y,i=y;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=S(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=g(c.pieces[0],l),k=null!==(a=A.get(l))&&void 0!==a?a:c.total,O=k>0?c.total/k*100:0,j=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:O,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});f&&(0===s&&(j.__funnelStepLabel=n.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=d,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+m/2,j.__funnelValueLabelY=d,j.__funnelBarW=m),p.push(M(x,d,m,u,w,j,l)),h.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,r=S(e),a=y-r/2,l=v[0],c="_default"!==l,m=null!==(s=null===(i=t.groups.get(l))||void 0===i?void 0:i.pieces[0])&&void 0!==s?s:n.pieceData[0],b=c?l:n.name,x=g(m,b),w=O>0?e/O*100:0,k=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});f&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=y,k.__funnelStepLabelY=d,k.__funnelRowWidth=r,k.__funnelValueLabelX=y,k.__funnelValueLabelY=d,k.__funnelBarW=r),p.push(M(a,d,r,u,x,k,b)),h.set(l,{x:a,y:d,w:r,h:u})}if(e>0&&_.size>0){const e=x?v:[v[0]];for(const o of e){const e=_.get(o),r=h.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return g(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),s={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:E},datum:null!==(c=null===(l=t.groups.get(o))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===o?n.name:o};p.push(s)}}_=h}return p},"bar-funnel":function(e,t){var n,o,r,i;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=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];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=a(o);r.total+=i,r.pieces.push(o),n+=i}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[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=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(i=null==w?void 0:w.total)&&void 0!==i?i:f,A=o?0:Math.max(0,k-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,E=c(p.pieces[0],y?h:n.name),_=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+A)});if(d.push(M(O,j,u,S,E,_,y?h:n.name)),A>0){const e=v(f+A),t=j-e,o=Object.assign({},E),r=Object.assign(Object.assign({},p.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:y?h:n.name});d.push(M(O,e,u,t,o,r,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,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=s(n,l);if(u){const r=a(t),i=a(t+o);c.push(M(r,e.x,i-r,e.width,d,n,l))}else{const r=a(t+o),i=a(t);c.push(M(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class P{constructor(e){this.rExtent=new f,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 y(e.windowSize),this.getO=x(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>b(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new f)):(this.getR=b(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=x(e.stackBy),this.getGroup=x(e.groupBy),this.getColor=x(e.colorAccessor),this.getConnector=x(e.connectorAccessor),this.getDataId=x(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new y(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:n,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 r=o.toArray(),i=n.projection||"vertical",s=n.oExtent||this.resolveCategories(r),a=this.computeValueDomain(r,s),l="horizontal"===i,c="radial"===i,u=Math.min(.9,Math.max(0,null!=n.barPadding?n.barPadding/("vertical"===i?e.width:e.height):.1));let d,h;if(c){d=t.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=n.innerRadius||0;h=t.scaleLinear().domain(a).range([r,o])}else l?(d=t.scaleBand().domain(s).range([0,e.height]).padding(u),h=t.scaleLinear().domain(a).range([0,e.width])):(d=t.scaleBand().domain(s).range([0,e.width]).padding(u),h=t.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:i},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((r,i)=>{var s;const a=this.rExtents[i];a.dirty&&a.recalculate(o,r);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=n.extentPadding)&&void 0!==s?s:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?t.scaleLinear().domain([c,u]).range([0,e.width]):t.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=r;this.rAccessors.length>1&&(g=r.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(g,s,d,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),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 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 i.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.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,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"===a){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"===a){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"===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===(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"!==a){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===(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,n,o,r){var i;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"===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=a.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=a.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()),s[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 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 n=this.getSceneContext(),o=C[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 s=[],{projection:a}=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,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,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};s.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return s}(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||A,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?function(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}(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 s=e[i],a=n?t(s):s[o];let l=r.get(a);l||(l=[],r.set(a,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,P.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let r=0;for(const e of this.scene)"point"===e.type&&(o[r++]=e);this._pointQuadtree=n.quadtree().x(e=>e.x).y(e=>e.y).addAll(o)}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 s=this.computeDecayOpacity(e,r),a=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:a*s})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=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(s>n){const e=1-n/s;e>r&&(r=e)}}r>0&&(n._pulseIntensity=r,n._pulseColor=a);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;s>r&&(n._pulseIntensity=1-r/s,n._pulseColor=a,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,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="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,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,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,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=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 k=!1;const A=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,O);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),k=!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}),k=!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,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!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,k=!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}),k=!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!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2;this.exitNodes.push({type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(f=t.innerRadius)&&void 0!==f?f: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})}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,r;if(!this.activeTransition)return!1;const i=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(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=m(r,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=m(o.x,e._targetX,s),e.y=m(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=m(o.r,e._targetR,s))}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=m(r,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=m(n.x,e._targetX,s),e.y=m(n.y,e._targetY,s),void 0!==n.w&&(e.w=m(n.w,e._targetW,s),e.h=m(n.h,e._targetH,s))}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:m(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=m(n.startAngle,e._targetStartAngle,s),e.endAngle=m(n.endAngle,e._targetEndAngle,s))}}}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&&!v(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!v(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!v(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(v(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=x(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)=>!v(e,i[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>b(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new f)):(this.getR=b(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!v(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?x(this.config.stackBy):void 0),"groupBy"in e&&!v(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?x(this.config.groupBy):void 0),"colorAccessor"in e&&!v(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?x(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!v(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?x(this.config.connectorAccessor):void 0)}}function L(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function T(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function B(e,t,n){const o=function(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}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function R(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>L(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function I(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 s=T(Math.atan2(r,o)),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 H(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 $(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}function D(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 N(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})}P.QUADTREE_THRESHOLD=500;const F={fill:e=>h.createElement("rect",{style:e,width:16,height:16}),line:e=>h.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function z(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,F[n])(o(e,t)),r}function W(){return h.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function q(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function G({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+h.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(h.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return h.createElement("g",{"aria-label":i||"Gradient legend"},h.createElement("defs",null,h.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&h.createElement("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),h.createElement("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),h.createElement("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])),h.createElement("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(h.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return h.createElement("g",{"aria-label":i||"Gradient legend"},i&&h.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),h.createElement("defs",null,h.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),h.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),h.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])),h.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])))}function V(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[d,g]=h.useState(0),[p,y]=h.useState(0),f=h.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const d=[];return e.forEach((e,g)=>{u+=5,d.push(h.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,d.push(h.createElement("text",{key:"legend-text-"+g,y:u,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},e.label)),u+=8),d.push(h.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,s,a,l,c)=>{const{type:u="fill",styleFn:d,items:g}=e,p=[];let y=0;const f=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return g.forEach((e,c)=>{const v=z(e,c,u,d),b=q(e,o,r),x=r&&r.size>0&&r.has(e.label);p.push(h.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:f?a===i&&c===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:f?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+g.length)%g.length;l(a,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:f?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&h.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&h.createElement(W,null),h.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},e.label))),y+=22}),p})(e,n,o,r,i,s,a,g,l,c))),u+=22*e.items.length+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:s}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=0;const g=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:g,items:p}=e,y=[];let f=0,m=0;const v=!(!t&&!n),b="isolate"===c||void 0===c&&null!=r;p.forEach((e,c)=>{const x=z(e,c,d,g),w=q(e,o,r),k=r&&r.size>0&&r.has(e.label),A=26+7*e.label.length;u&&u>0&&f>0&&f+A>u&&(m++,f=0),y.push(h.createElement("g",{key:"legend-item-"+c,transform:`translate(${f},${22*m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:v?a===i&&c===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?k||!1:void 0,"aria-current":v&&!b&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:v?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:v?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&h.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&h.createElement(W,null),h.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},e.label))),f+=A});let x=0,w=0;for(const e of p){const t=26+7*e.label.length;u&&u>0&&w>0&&w+t>u?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const k=m+1;return{items:y,offset:x,totalRows:k,totalHeight:22*k}})(e,o,r,i,s,a,l,t,c,u,n);p+=y.offset+5,g.push(Object.assign(Object.assign({label:e.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),d+=p+12});let p=d>n?0:Math.max(0,(n-d)/2);const y=[];return g.forEach((n,o)=>{const r=e[o];r.label&&(y.push(h.createElement("text",{key:"legend-text-"+o,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)"},r.label)),p+=16),y.push(h.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${p},0)`},n.items)),p+=n.offset+5,e[o+1]&&y.push(h.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8})),p+=12}),h.createElement("g",null,y)})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:s}),v=!(!n&&!o);return h.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==a&&""!==a&&"vertical"===u&&h.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},a),m)}function X(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Y(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 Q(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:g,disable:p,events:y={},"data-testid":f}=e,m=new Set(Array.isArray(p)?p:[]);let v=o||0,b=r||0;null!=i&&(v=i-t),null!=s&&(b=s-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===v&&0===b)if(void 0!==c.width){v=c.width/2;const e=c.depth||30;b=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;v=e+(0>e?-5:5),b=c.height/2}return h.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":f},y),!m.has("connector")&&function(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-a,2)+Math.pow(t-l,2))>.5&&(s.push(h.createElement("line",{key:"connector-line",x1:a,y1:l,x2:e,y2:t,stroke:o||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-a);s.push(h.createElement("path",{key:"connector-arrow",d:`M${a},${l}L${a+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${a+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return h.createElement("g",{className:"annotation-connector"},s)}(v,b,l,d,x,c),!m.has("subject")&&function(e,t,n,o,r){var i;const s=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&s.push(h.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&s.push(h.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==t?void 0:t.custom)&&s.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;s.push(h.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;s.push(h.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?s.push(h.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||s.push(h.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&s.push(h.createElement("path",{key:"bracket-path",d:Y((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}}return h.createElement("g",{className:"annotation-subject"},s)}(x,c,d,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return h.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return h.createElement("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===u?"right"===d?g="end":"middle"===d&&(g="middle"):g=0>t?"end":"start";const p=16,y=i?c?[i]:X(i,l):[],f=r?c?[r]:X(r,l):[],m="leftRight"===u?"end"===g?-4:4:0;let v=0;const b=[],x=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(b.push(h.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},y.map((e,t)=>h.createElement("tspan",{key:t,x:m,dy:0===t?0:p},e)))),v=y.length*p),f.length>0&&b.push(h.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},f.map((e,t)=>h.createElement("tspan",{key:t,x:m,dy:0===t?0:p},e))));let w=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),w=h.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+f.length)*p+(f.length>0?p:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),w=h.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+f.length-1)*p;let A=0;return"topBottom"===u?A=0>n?-(k+2):18:"leftRight"===u&&(A="middle"===d?-(k+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===d||0>n?-(k+2):18),h.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},h.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),w)}(a,v,b,d))}function K(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",s=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),s=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),a=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:s});return h.createElement(Q,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return h.createElement("g",null,a)}const a=o.note||{title:"none",label:o.label};return h.createElement(Q,Object.assign({"data-testid":"semiotic-annotation",key:`${a.label}-${a.title}-${o.i}`,events:s},o,{type:i}))}function U(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 Z(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 J(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){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,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.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===(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)}}(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=U(e,n),c=Z(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"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function ee(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const te={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};function ne(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:s,scales:a,showAxes:l,showGrid:c,rFormat:u}=t,{rTickValues:d}=t,g="radial"===(null==a?void 0:a.projection),p="horizontal"===(null==a?void 0:a.projection),y=e.useMemo(()=>!a||g?[]:(d||a.r.ticks(5)).map(e=>({value:e,pixel:a.r(e),label:(u||oe)(e)})),[a,u,g,d]),f=c&&a&&!g,m=l&&a&&!g;return f||m?h.createElement("svg",{width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},h.createElement("g",{transform:`translate(${s.left},${s.top})`},f&&h.createElement("g",{className:"ordinal-grid"},y.map((e,t)=>h.createElement("line",{key:"grid-"+t,x1:p?e.pixel:0,y1:p?0:e.pixel,x2:p?e.pixel:n,y2:p?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&h.createElement(h.Fragment,null,p?h.createElement(h.Fragment,null,h.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),h.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):h.createElement(h.Fragment,null,h.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),h.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function oe(e){return Math.round(100*e)/100+""}function re(t){var n,o;const{width:r,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:p,showCategoryTicks:y,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:E,annotations:_,svgAnnotationRules:C,xAccessor:P,yAccessor:L,annotationData:T,underlayRendered:B,children:R}=t,I="radial"===(null==d?void 0:d.projection),H="horizontal"===(null==d?void 0:d.projection),$=!1!==y,D=e.useMemo(()=>p&&$&&d&&!I?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:v?v(e,t):e}}):[],[p,$,d,v,I]),N=t.rTickValues,F=t.tickLabelEdgeAlign,z=e.useMemo(()=>p&&d&&!I?(N||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(b||oe)(e)})):[],[p,d,b,I,N]),W=e.useRef(new Map),q=e.useRef(null!==(n=null==_?void 0:_.length)&&void 0!==n?n:0),X=null!==(o=null==_?void 0:_.length)&&void 0!==o?o:0;q.current!==X&&(q.current=X,W.current=new Map);const Y=e.useMemo(()=>{if(!_||0===_.length)return null;const e=function(e,t,n){var o,r,a,l,c,u,d,p,y,f,m,v,b,x,w,k,A,O,j,S,M,E,_,C,P,L,T,B,R,I,H,$,D,N,F,z,W,q,G,V,X,Y,Q,ne,oe,re,ie,se;switch(e.type){case"label":{const o=J(e,t,n);if(!o)return null;const{x:r,y:i}=o;return ee(r,i,n)?h.createElement(K,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=J(e,t,n);if(!o)return null;const{x:r,y:i}=o;return ee(r,i,n)?h.createElement(K,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=U(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;return s="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12,h.createElement("g",{key:"ann-"+t},h.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&h.createElement("text",{x:o+4,y:s,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=Z(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(n.width||0)/2,a="middle"):(s=(n.width||0)-4,a="end"),h.createElement("g",{key:"ann-"+t},h.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&h.createElement("text",{x:s,y:o-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:U(Object.assign(Object.assign({},e),{type:"point"}),n),y:Z(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=i.packEnclose(o),s=e.padding||10;return h.createElement("g",{key:"ann-"+t},h.createElement("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&h.createElement("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:U(Object.assign(Object.assign({},e),{type:"point"}),n),y:Z(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),s=o.map(e=>e.y),a=Math.min(...i)-r,l=Math.max(...i)+r,c=Math.min(...s)-r,u=Math.max(...s)+r;return h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:a,y:c,width:l-a,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&h.createElement("text",{x:(a+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return h.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=U(t,n),s=Z(t,n);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return h.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:s,r:a},l))}))}case"bracket":{const o=U(e,n),r=Z(e,n);return h.createElement(K,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const i=n.data||[];if(2>i.length)return null;const s=n.xAccessor||"x",p=n.yAccessor||"y",y=i.map(e=>[e[s],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(r=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==r?r:null===(a=n.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!f||!m)return null;const v=e.method||"linear";let b;b="loess"===v?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]),s=Math.max(2,Math.ceil(t*n)),a=[];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(s-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,p=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],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(y,null!==(d=e.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?g.default.polynomial(y,{order:e.order||2}):g.default.linear(y)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=e.color||"#6366f1";return h.createElement("g",{key:"ann-"+t},h.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&h.createElement("text",{x:f(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:w,fontSize:11},e.label))}case"band":{const o=null!==(y=null===(p=n.scales)||void 0===p?void 0:p.y)&&void 0!==y?y:null===(f=n.scales)||void 0===f?void 0:f.value,r=null!==(m=null==o?void 0:o(e.y0))&&void 0!==m?m:0,i=null!==(v=null==o?void 0:o(e.y1))&&void 0!==v?v:n.height||0;return h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&h.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",i=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=n.scales)||void 0===w?void 0:w.time,a=null!==(A=null===(k=n.scales)||void 0===k?void 0:k.y)&&void 0!==A?A:null===(O=n.scales)||void 0===O?void 0:O.value;if(!i||!a)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const g=te[n.curve||"linear"]||s.curveLinear,p=s.area().x(e=>i(e[r])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(g)(d);if(!p)return null;const y=e.fill||"#6366f1";return h.createElement("g",{key:"ann-"+t},h.createElement("path",{d:p,fill:y,fillOpacity:null!==(j=e.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),e.label&&d.length>0&&h.createElement("text",{x:i(d[d.length-1][r])+4,y:a(d[d.length-1][l])-4,fill:y,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(M=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(E=n.scales)||void 0===E?void 0:E.time,s=null!==(C=null===(_=n.scales)||void 0===_?void 0:_.y)&&void 0!==C?C:null===(P=n.scales)||void 0===P?void 0:P.value;if(!i||!s)return null;const a=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+Math.pow(t-l,2),0)/a.length,u=Math.sqrt(c),d=null!==(L=e.threshold)&&void 0!==L?L:2,g=l-d*u,p=!1!==e.showBand,y=e.fill||"#6366f1",f=null!==(T=e.fillOpacity)&&void 0!==T?T:.1,m=e.anomalyColor||"#ef4444",v=null!==(B=e.anomalyRadius)&&void 0!==B?B:6,b=s(l+d*u),x=s(g),w=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return h.createElement("g",{key:"ann-"+t},p&&h.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),w.map((e,t)=>{const o=U(e,n),r=Z(e,n);return null==o||null==r?null:h.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&h.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s=null!==(I=null===(R=n.scales)||void 0===R?void 0:R.x)&&void 0!==I?I:null===(H=n.scales)||void 0===H?void 0:H.time,a=null!==(D=null===($=n.scales)||void 0===$?void 0:$.y)&&void 0!==D?D:null===(N=n.scales)||void 0===N?void 0:N.value;if(!s||!a)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=g.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)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 s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(d/Math.max(u-2,1)),y=l.reduce((e,t)=>e+t[0],0)/u,f=l.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(F=e.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=e.steps)&&void 0!==z?z:5,x=l[u-1][0],w=(x-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=c(e),n=p*Math.sqrt(1+1/u+(f>0?Math.pow(e-y,2)/f:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,j=A.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),S=`${s(x)},${a(c(x))}`,M=e.strokeColor||"#6366f1";return h.createElement("g",{key:"ann-"+t},h.createElement("path",{d:O,fill:e.fill||"#6366f1",fillOpacity:null!==(W=e.fillOpacity)&&void 0!==W?W:.15,stroke:"none"}),h.createElement("polyline",{points:`${S} ${j}`,fill:"none",stroke:M,strokeWidth:null!==(q=e.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=e.strokeDasharray)&&void 0!==G?G:"6,3"}),e.label&&A.length>0&&h.createElement("text",{x:s(A[A.length-1].x)+4,y:a(A[A.length-1].yCenter)-4,fill:M,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=J(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!ee(o,r,n))return null;const i=null!==(V=e.dx)&&void 0!==V?V:0,s=null!==(X=e.dy)&&void 0!==X?X:0,a=null!==(Y=e.width)&&void 0!==Y?Y:32,l=null!==(Q=e.height)&&void 0!==Q?Q:32,c=null!==(ne=e.content)&&void 0!==ne?ne:h.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return h.createElement("foreignObject",{key:"ann-"+t,x:o+i-a/2,y:r+s-l/2,width:a,height:l,style:{overflow:"visible",pointerEvents:"auto"}},h.createElement("div",{style:{width:a,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=J(e,t,n);if(!o)return null;const{x:r,y:i}=o;return h.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=null===(oe=n.scales)||void 0===oe?void 0:oe.o,i=null===(re=n.scales)||void 0===re?void 0:re.x,s=null===(ie=n.scales)||void 0===ie?void 0:ie.y,a=(null==r?void 0:r.bandwidth)?r:(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:null;if(!a)return null;const l=a(o);if(null==l)return null;const c=a.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",d=null!==(se=e.opacity)&&void 0!==se?se:.15,g=e.label;return(n.projection?"vertical"===n.projection:a===i)?h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:l,y:0,width:c,height:n.height||0,fill:u,fillOpacity:d}),g&&h.createElement("text",{x:l+c/2,y:12,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold"},g)):h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:0,y:l,width:n.width||0,height:c,fill:u,fillOpacity:d}),g&&h.createElement("text",{x:12,y:l+c/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold"},g))}default:return null}},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:L,width:r,height:a,data:T,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:W.current};return _.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)},[_,C,r,a,d,P,L,T]);return p||w||k||E||Y&&Y.length>0||x||R?h.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},h.createElement("title",null,"string"==typeof w?w:"Ordinal Chart"),h.createElement("desc",null,"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"),h.createElement("g",{transform:`translate(${u.left},${u.top})`},x&&d&&!I&&!B&&h.createElement("g",{className:"ordinal-grid"},z.map((e,t)=>h.createElement("line",{key:"grid-"+t,x1:H?e.pixel:0,y1:H?0:e.pixel,x2:H?e.pixel:r,y2:H?a:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),p&&d&&!I&&h.createElement("g",{className:"ordinal-axes"},H?h.createElement(h.Fragment,null,!B&&h.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((e,t)=>h.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},h.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?h.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label):h.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},h.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},e.label)))),f&&h.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},f),!B&&h.createElement("line",{x1:0,y1:a,x2:r,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!B&&(null==d?void 0:d.r)&&(()=>{const e=d.r(0);return e>1&&r-1>e?h.createElement("line",{x1:e,y1:0,x2:e,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),z.map((e,t)=>{const n=F?0===t?"start":t===z.length-1?"end":"middle":"middle";return h.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${a})`},h.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),h.createElement("text",{y:18,textAnchor:n,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))}),m&&h.createElement("text",{x:r/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},m)):h.createElement(h.Fragment,null,!B&&(()=>{const e=(null==d?void 0:d.r)?d.r(0):a,t=0>e||e>a?a:e;return h.createElement("line",{x1:0,y1:t,x2:r,y2:t,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((e,t)=>h.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${a})`},h.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?h.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label):h.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},h.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},e.label)))),f&&h.createElement("text",{x:r/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!B&&h.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((e,t)=>h.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},h.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),h.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&h.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},m))),Y,E,R),w&&h.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:s,legendHoverBehavior:a,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const g="top"===i||"bottom"===i;let p,y;return"left"===i?(p=4,y=r.top):"top"===i?(p=0,y=s?32:8):"bottom"===i?(p=0,y=o-r.bottom+50):(p=n-r.right+10,y=r.top),h.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=t)&&null!==f&&"gradient"in f?h.createElement(G,{config:t.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?h.createElement(V,{legendGroups:t.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t);var f}({legend:k,totalWidth:l,totalHeight:c,margin:u,legendPosition:M,title:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S})):null}function ie({width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,onBrush:a}){const u=e.useRef(null),d=e.useRef(null),g=e.useRef(a);g.current=a;const p=e.useRef(s);p.current=s;const y=e.useRef(!1),f=e.useRef(null),m="horizontal"===(null==s?void 0:s.projection),v=e.useRef(m);return v.current=m,e.useEffect(()=>{if(!u.current)return;const e=l.select(u.current).select(".brush-g"),o=m?c.brushX():c.brushY();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(y.current)return;const t=p.current;if(!t)return;if(!e.selection)return f.current=null,void g.current(null);const[n,o]=e.selection;let r;r=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};f.current=i,g.current(i)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[t,n,m]),e.useEffect(()=>{if(!s||!d.current||!f.current)return;if(!u.current)return;const e=f.current,t=l.select(u.current).select(".brush-g"),n=s.r(e.r[0]),o=s.r(e.r[1]);m?(y.current=!0,t.call(d.current.move,[n,o]),y.current=!1):(y.current=!0,t.call(d.current.move,[o,n]),y.current=!1)},[s,m]),h.createElement("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},h.createElement("g",{className:"brush-g",transform:`translate(${i.left},${i.top})`,style:{pointerEvents:"all"}}))}function se(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const ae="undefined"==typeof window||"undefined"==typeof document,le=h.createContext(null),ce={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ue(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"],s=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 s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const de=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},he={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"},ge={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},pe={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)"},ye={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},fe={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)"},me={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},ve={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function be({scene:e,chartType:t,tableId:n,chartTitle:o}){var r;const[i,s]=h.useState(!1),a=h.useContext(le),l=null!==(r=null==a?void 0:a.visible)&&void 0!==r&&r,c=i||l,u=h.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t,g=h.useCallback(()=>{i||l||s(!0)},[i,l]),p=h.useCallback(e=>{var t;l||(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[l]);if(!e||0===e.length)return n?h.createElement("span",{id:n,tabIndex:-1,style:ce}):null;if(!c)return h.createElement("div",{id:n,tabIndex:-1,onFocus:g,style:ce,role:"region","aria-label":d},h.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",e.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,k,A,O,j;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=M.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=M.cx)&&void 0!==g?g:M.x,y:null!==(p=M.cy)&&void 0!==p?p:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=M.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(v=M.cy)&&void 0!==v?v:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(A=null!==(w=null===(x=null===(b=M.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(k=M.datum)||void 0===k?void 0:k.name)&&void 0!==A?A:"",value:null!==(j=null===(O=M.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(e),f=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}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${de(e.min)} to ${de(e.max)}, mean ${de(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(" ")}(y.length,f),v=y.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 h.createElement("div",{ref:u,id:n,tabIndex:-1,onBlur:p,style:he,role:"region","aria-label":d},h.createElement("button",{type:"button",onClick:()=>{l&&a&&a.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:pe},"×"),h.createElement("div",{role:"note",style:ge},m),h.createElement("table",{role:"table","aria-label":"Sample data for "+t,style:ye},h.createElement("caption",{style:ve},"First ",v.length," of ",y.length," data points"),h.createElement("thead",null,h.createElement("tr",null,h.createElement("th",{style:fe},"type"),x.map(e=>h.createElement("th",{key:e,style:fe},e)))),h.createElement("tbody",null,v.map((e,t)=>h.createElement("tr",{key:t},h.createElement("td",{style:me},e.label),x.map(t=>{return h.createElement("td",{key:t,style:me},null==(n=e.values[t])||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":de(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"");var n}))))))}function xe({summary:e}){return e?h.createElement("div",{role:"note",style:ce},e):null}function we({tableId:e}){return h.createElement("a",{href:"#"+e,style:ce,onClick:t=>{t.preventDefault();const n=document.getElementById(e);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,ce)}},"Skip to data table")}function ke({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return h.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:ce},t)}const Ae="var(--semiotic-focus, #005fcc)";function Oe({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s}){if(!e||!t)return null;const a=t.x+n.left,l=t.y+n.top;let c;if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);c=h.createElement("rect",{x:a-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ae,strokeWidth:2,strokeDasharray:"4,2"})}else c=h.createElement("circle","wedge"===r?{cx:a,cy:l,r:12,fill:"none",stroke:Ae,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:l,r:8,fill:"none",stroke:Ae,strokeWidth:2,strokeDasharray:"4,2"});return h.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},c)}function je({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=h.useRef(null),[c,u]=h.useState(null);h.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();u(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,n,o]);let d;return d=c?`translate(${c.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${c.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`,h.createElement("div",{ref:l,className:s,style:{position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"}},i)}function Se(t){const n=e.createContext(null),o=Me(t);return[function({children:o}){const r=e.useMemo(()=>Me(t),[]);return h.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,s=e.useRef(t);s.current=t;const a=e.useCallback(()=>s.current(i.getState()),[i]),l=e.useCallback(()=>s.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,a,l)}]}function Me(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 Ee(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:_e})})),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 _e=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Ce={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}},Pe={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}},Le={mode:"light",colors:{primary:"#0000cc",categorical:_e,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"},[Te,Be]=Se(e=>({theme:Ce,setTheme(t){e(e=>{if("light"===t)return{theme:Ce};if("dark"===t)return{theme:Pe};if("high-contrast"===t)return{theme:Le};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Pe:Ce;return{theme:Ee(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:Ee(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||{})}))}})}}));const Re=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ie=new WeakMap;let He=0,$e=!1,De=null,Ne=null,Fe=null;function ze(e,t){var n,o;if(!t)return t;const r=Re.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($e)return;if("undefined"==typeof window||"undefined"==typeof document)return;$e=!0;const e=()=>{He++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(De=new MutationObserver(e),De.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Ne=window.matchMedia("(prefers-color-scheme: dark)"),Fe=e,"function"==typeof Ne.addEventListener?Ne.addEventListener("change",Fe):"function"==typeof Ne.addListener&&Ne.addListener(Fe)}catch(e){}}();let s=Ie.get(i);s&&s.version===He||(s={version:He,map:new Map},Ie.set(i,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function We(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function qe(t){const n=function(){const[t,n]=e.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return e.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),t}(),o=e.useRef(n);o.current=n;const[r,i]=function(t,n,o){const r=e.useRef(null),[i,s]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.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,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),s=e.useMemo(()=>Object.assign(Object.assign({},t.marginDefault),t.userMargin),[t.marginDefault,t.userMargin]),a=i[0]-s.left-s.right,l=i[1]-s.top-s.bottom,c=We(t.foregroundGraphics,i,s),u=We(t.backgroundGraphics,i,s),d=Be(e=>e.theme),{transition:g,introEnabled:p}=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)}}(t.animate,t.transitionProp),y="semiotic-table-"+h.useId(),f=e.useRef(0),m=e.useRef(()=>{}),v=e.useCallback(()=>{f.current||(f.current=requestAnimationFrame(()=>m.current()))},[]);e.useEffect(()=>()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0)},[]);const b=e.useRef(()=>{}),x=e.useRef(()=>{}),w=e.useRef(null),k=e.useRef(0),A=e.useCallback(()=>{k.current=0;const e=w.current;w.current=null,e&&b.current(e)},[]),O=e.useCallback(e=>{w.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(A))},[A]),j=e.useCallback(()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);e.useEffect(()=>()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=t.themeDirtyRef;return e.useEffect(()=>{S&&(He++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:r,size:i,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:g,introEnabled:p,tableId:y,rafRef:f,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:O,onPointerLeave:j}}function Ge(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ve(e,t,n=.3){Ge(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 Xe(e,t,n=.6){var o,r,i,s,a;if(!Ge(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!==(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*n,e.stroke()}function Ye(e,t,n,o=.35){Ge(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const Qe=(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)Ke(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?ze(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:s}=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+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o,r+s);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+s-n),e.arcTo(o,r+s,o+n,r+s,n),e.lineTo(o+i,r+s);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o+n,r+s),e.arcTo(o,r+s,o,r+s-n,n);break;default:e.moveTo(o,r+s),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+s)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?ze(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=ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));Ve(e,t),e.globalAlpha=1}};function Ke(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,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}const Ue=(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?ze(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?ze(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Xe(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Ze(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 Je(e,t){const n=s.arc().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()}const et=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s){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?ze(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Je(e,t)):(Ze(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Ze(e,t),Ye(e,t)),e.globalAlpha=1}};const tt=(e,t,n,o)=>{var r,i;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 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?ze(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ze(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()}},nt=(e,t,n,o)=>{var r,i,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 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=ze(e,n.style.stroke)||("string"==typeof n.style.fill?ze(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function ot(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 rt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let it=null;function st(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(it||(it=document.createElement("canvas")),it.width=e,it.height=e,it)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,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+=i)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+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const at=new Map;function lt(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=at.get(n);if(void 0!==o)return o;const r=st({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return at.set(n,r),r}function ct(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 ut(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 dt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const ht=e=>[nt,...e],gt={bar:ht([Qe]),clusterbar:ht([Qe]),point:ht([Ue]),swarm:ht([Ue]),pie:[et],donut:[et],boxplot:ht([(e,t,n,o)=>{var r,i;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=t.style.fill||"#007bff",a=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=a,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=s,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()}},Ue]),violin:ht([tt]),histogram:ht([Qe]),ridgeline:ht([tt]),timeline:ht([Qe]),funnel:[Qe,(e,t,n,o)=>{var r,i,s,a;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===(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=ze(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,s,a;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 s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s: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?ot(r):null!=i?`${ot(r)} (${rt(i)})`:ot(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=ot(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__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":[Qe,(e,t,n,o)=>{var r,i;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 n="string"==typeof t.style.fill?t.style.fill:"#999",o=lt(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,s=i?dt(r):"",a=ut(o);e.font="bold 13px sans-serif";const l=i?e.measureText(s).width:0;e.font="11px sans-serif";const c=e.measureText(a).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,p=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(),ct(e,g,p,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),ct(e,g,p,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(s,h,p+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(a,h,p+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(a,h,p+3))}e.lineWidth=1}}],swimlane:ht([Qe])},pt={top:50,right:40,bottom:60,left:70},yt={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 ft({hover:e}){var t,n,o,r,i,s;const a=e.data||{},l=e.stats,c=e.category;if(Array.isArray(a)){const e=c||(null===(t=a[0])||void 0===t?void 0:t.category)||"";if(l)return h.createElement("div",{className:"semiotic-tooltip",style:yt},e&&h.createElement("div",{style:{fontWeight:"bold"}},e+""),h.createElement("div",null,"n = ",l.n),h.createElement("div",null,"Min: ",l.min.toLocaleString()),h.createElement("div",null,"Q1: ",l.q1.toLocaleString()),h.createElement("div",null,"Median: ",l.median.toLocaleString()),h.createElement("div",null,"Q3: ",l.q3.toLocaleString()),h.createElement("div",null,"Max: ",l.max.toLocaleString()),h.createElement("div",{style:{opacity:.8}},"Mean: ",l.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=a.length;return h.createElement("div",{className:"semiotic-tooltip",style:yt},e&&h.createElement("div",{style:{fontWeight:"bold"}},e+""),h.createElement("div",null,n," items"))}if(null!=a.bin&&null!=a.count){const e=a.range||[];return h.createElement("div",{className:"semiotic-tooltip",style:yt},a.category&&h.createElement("div",{style:{fontWeight:"bold"}},a.category+""),h.createElement("div",null,"Count: ",a.count),2===e.length&&h.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const u=e.__oAccessor,d=e.__rAccessor,g=e.__chartType;if("swarm"===g||"point"===g){const e=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return h.createElement("div",{className:"semiotic-tooltip",style:yt},e.map(([e,t])=>h.createElement("div",{key:e},h.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}const p=(u&&null!=a[u]?a[u]:null)||a.category||a.name||a.group||a.__rName||"",y=null!==(s=null!==(i=null!==(r=null!==(o=null!==(n=a.__aggregateValue)&&void 0!==n?n:d&&null!=a[d]?a[d]:null)&&void 0!==o?o:a.value)&&void 0!==r?r:a.__rValue)&&void 0!==i?i:a.pct)&&void 0!==s?s:"";if(!p&&""===y){const e=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return h.createElement("div",{className:"semiotic-tooltip",style:yt},e.map(([e,t])=>h.createElement("div",{key:e},h.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return h.createElement("div",{className:"semiotic-tooltip",style:yt},p&&h.createElement("div",{style:{fontWeight:"bold"}},p+""),""!==y&&h.createElement("div",null,"number"==typeof y?y.toLocaleString():y+""))}const mt=e.forwardRef(function(t,n){var o,r,i,a,l,c,u,d,g,y;const{chartType:f,runtimeMode:m,data:v,oAccessor:b="category",rAccessor:x="value",colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:j,valueAccessor:S,categoryAccessor:M,projection:E="vertical",size:_=[600,400],responsiveWidth:C,responsiveHeight:T,margin:F,barPadding:z,roundedTop:W,baselinePadding:q,innerRadius:G,cornerRadius:V,normalize:X,startAngle:Y,sweepAngle:Q,dynamicColumnWidth:K,bins:U,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:le,connectorStyle:ce,dataIdAccessor:de,rExtent:he,oExtent:ge,extentPadding:pe=.05,oSort:ye,windowMode:fe="sliding",windowSize:me=200,pieceStyle:ve,summaryStyle:Ae,colorScheme:Se,barColors:Me,showAxes:Ee=!0,showCategoryTicks:_e,categoryLabel:Ce,valueLabel:Pe,categoryFormat:Le,valueFormat:Te,oLabel:Be,rLabel:Re,oFormat:Ie,rFormat:He,rTickValues:$e,tickLabelEdgeAlign:De,enableHover:Ne=!0,hoverAnnotation:Fe,tooltipContent:ze,customHoverBehavior:We,annotations:Ge,svgAnnotationRules:Ve,showGrid:Xe=!1,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Ze,legendPosition:Je,backgroundGraphics:et,foregroundGraphics:tt,title:nt,className:ot,background:rt,centerContent:it,decay:st,pulse:at,transition:lt,animate:ct,staleness:ut,brush:dt,onBrush:ht,accessibleTable:yt=!0,description:mt,summary:vt}=t,bt=e.useRef(!0),xt=qe({sizeProp:_,responsiveWidth:C,responsiveHeight:T,userMargin:F,marginDefault:pt,foregroundGraphics:tt,backgroundGraphics:et,animate:ct,transitionProp:lt,themeDirtyRef:bt}),{reducedMotionRef:wt,responsiveRef:kt,size:At,margin:Ot,adjustedWidth:jt,adjustedHeight:St,resolvedForeground:Mt,resolvedBackground:Et,currentTheme:_t,transition:Ct,introEnabled:Pt,tableId:Lt,rafRef:Tt,renderFnRef:Bt,scheduleRender:Rt}=xt,It=null!=Ce?Ce:Be,Ht=null!=Pe?Pe:Re,$t=null!=Le?Le:Ie,Dt=null!=Te?Te:He,Nt=e.useRef(null),Ft=e.useRef(null),[zt,Wt]=e.useState(null),[qt,Gt]=e.useState(null),[Vt,Xt]=e.useState(0),[Yt,Qt]=e.useState(!1),Kt=Ne||Fe,Ut="streaming"===m,Zt=e.useMemo(()=>{var e;return{chartType:f,runtimeMode:Ut?"streaming":"bounded",windowSize:me,windowMode:fe,extentPadding:pe,projection:E,oAccessor:Ut?void 0:b,rAccessor:Ut?void 0:x,colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:Ut?j:void 0,valueAccessor:Ut?S||("string"==typeof x||"function"==typeof x?x:void 0):void 0,categoryAccessor:Ut?M||b:void 0,rExtent:he,oExtent:ge,barPadding:z,roundedTop:W,baselinePadding:q,innerRadius:G,cornerRadius:V,normalize:X,startAngle:Y,sweepAngle:Q,dynamicColumnWidth:K,bins:U,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:le,connectorStyle:ce,dataIdAccessor:de,oSort:ye,pieceStyle:ve,summaryStyle:Ae,colorScheme:Se,themeCategorical:null===(e=null==_t?void 0:_t.colors)||void 0===e?void 0:e.categorical,barColors:Me,decay:st,pulse:at,transition:Ct,introAnimation:Pt,staleness:ut}},[f,me,fe,pe,E,b,x,w,k,A,O,j,S,M,he,ge,z,W,q,G,V,X,Y,Q,K,U,Z,J,ee,te,oe,le,ce,de,ye,ve,Ae,Se,Me,st,at,null==Ct?void 0:Ct.duration,null==Ct?void 0:Ct.easing,Pt,ut,Ut,_t]),Jt=e.useRef(null);Jt.current||(Jt.current=new P(Zt)),e.useEffect(()=>{var e;null===(e=Jt.current)||void 0===e||e.updateConfig(Zt),bt.current=!0,Rt()},[Zt,Rt]);const en=e.useRef(null);en.current||(en.current=new p(e=>{const t=Jt.current;t&&t.ingest(e)&&(bt.current=!0,Rt())}));const tn=e.useCallback(e=>{var t;null===(t=en.current)||void 0===t||t.push(e)},[]),nn=e.useCallback(e=>{var t;null===(t=en.current)||void 0===t||t.pushMany(e)},[]),on=e.useCallback(()=>{var e,t;null===(e=en.current)||void 0===e||e.clear(),null===(t=Jt.current)||void 0===t||t.clear(),bt.current=!0,Rt()},[Rt]),rn=e.useCallback(e=>{var t,n;null===(t=en.current)||void 0===t||t.clearLastData(),null===(n=en.current)||void 0===n||n.setReplacementData(e)},[]);e.useImperativeHandle(n,()=>({push:tn,pushMany:nn,replace:rn,remove:e=>{var t,n,o,r;null===(t=en.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Jt.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(i.length>0){const e=null===(r=Ft.current)||void 0===r?void 0:r.data;!!Ft.current&&i.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Ft.current=null,Wt(null)),bt.current=!0,Rt()}return i},update:(e,t)=>{var n,o,r;null===(n=en.current)||void 0===n||n.flush();const i=null!==(r=null===(o=Jt.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(bt.current=!0,Rt()),i},clear:on,getData:()=>{var e,t,n;return null===(e=en.current)||void 0===e||e.flush(),null!==(n=null===(t=Jt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Jt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[tn,nn,rn,on,Rt]),e.useEffect(()=>{var e;v&&(null===(e=en.current)||void 0===e||e.setBoundedData(v))},[v]);const{hoverHandlerRef:sn,hoverLeaveRef:an,onPointerMove:ln,onPointerLeave:cn}=xt;sn.current=e=>{if(!Kt)return;const t=Nt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ot.left,r=e.clientY-n.top-Ot.top;if(0>o||o>jt||0>r||r>St)return void(Ft.current&&(Ft.current=null,Wt(null),We&&We(null),Rt()));const i=Jt.current;if(!i||0===i.scene.length)return;const s="radial"===E,a=function(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),s=t-i,a=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,g)=>{if(r>a||s>h||i>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,s=e.y-n,a=Math.sqrt(i*i+s*s);L(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,i);e&&(s={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=B(i,t,n);break;case"point":if(r)break;e=R(i,t,n,o);break;case"wedge":e=I(i,t,n);break;case"boxplot":e=H(i,t,n);break;case"violin":e=$(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(i.scene,s?o-jt/2:o,s?r-St/2:r,30,i.pointQuadtree,i.maxPointRadius);if(!a)return void(Ft.current&&(Ft.current=null,Wt(null),We&&We(null),Rt()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;Ft.current=l,Wt(l),We&&(We(l),bt.current=!0),Rt()},an.current=()=>{Ft.current&&(Ft.current=null,Wt(null),We&&(We(null),bt.current=!0),Rt())};const un=e.useRef(-1),dn=e.useRef(null),hn=e.useRef(null),gn=e.useCallback(e=>{const t=Jt.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(hn.current&&hn.current.version===n)o=hn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(r=s.group)&&void 0!==r?r:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;i.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.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=function(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 s=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&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),hn.current={version:n,graph:o}}const r=un.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),un.current=0;const t=o.flat[0];dn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},N(t)),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});return Ft.current=n,Wt(n),We&&We(n),void Rt()}const i=function(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}}(o,r),s=function(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?D(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?D(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}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return un.current=-1,dn.current=null,Ft.current=null,Wt(null),We&&We(null),void Rt();un.current=s;const a=o.flat[s];dn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},N(a)),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});Ft.current=l,Wt(l),We&&We(l),Rt()},[We,Rt]),pn=e.useCallback(e=>{un.current=-1,dn.current=null,ln(e)},[ln]);Bt.current=()=>{var e,t;Tt.current=0;const n=Nt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Jt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(wt.current?i+1e6:i),a=!wt.current&&s,l=bt.current;l&&!s&&(r.computeScene({width:jt,height:St}),bt.current=!1),(l||a)&&n.setAttribute("aria-label",ue(r.scene,f+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=At[0]*c,d=At[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=At[0]+"px",n.style.height=At[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,At[0],At[1]);const h=null!==(e=null==ut?void 0:ut.threshold)&&void 0!==e?e:5e3,g=ut&&r.lastIngestTime>0&&i-r.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==ut?void 0:ut.dimOpacity)&&void 0!==t?t:.5),"transparent"!==rt&&!et){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=rt||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,At[0],At[1]))}const p="radial"===E;o.save(),o.beginPath(),o.rect(Ot.left,Ot.top,jt,St),o.clip(),p?(o.save(),o.translate(Ot.left+jt/2,Ot.top+St/2)):o.translate(Ot.left,Ot.top);const y=gt[f]||[],m={width:jt,height:St};for(const e of y)e(o,r.scene,r.scales,m);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(Gt(r.scales),Xt(e=>e+1)),(null==ut?void 0:ut.showBadge)&&Qt(!!g),(a||null!=r.activeTransition||r.hasActivePulses)&&(Tt.current=requestAnimationFrame(()=>Bt.current()))},e.useEffect(()=>(Rt(),()=>{var e;null===(e=en.current)||void 0===e||e.clear()}),[Rt]),e.useEffect(()=>{bt.current=!0,Rt()},[f,jt,St,Ee,rt,Rt]),function(t,n,o,r,i,s){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(ut,Jt,bt,Rt,Yt,Qt);const yn=Kt&&zt?ze?ze(zt):h.createElement(ft,{hover:zt}):null,fn="radial"===E,mn=yn?h.createElement(je,{x:zt?fn?zt.x+jt/2:zt.x:0,y:zt?fn?zt.y+St/2:zt.y:0,containerWidth:jt,containerHeight:St,margin:Ot,className:"stream-ordinal-tooltip"},yn):null;if(ae){const e=Jt.current;e&&v&&(e.ingest({inserts:v,bounded:!0}),e.computeScene({width:jt,height:St}));const t=null!==(o=null==e?void 0:e.scene)&&void 0!==o?o:[],n=null!==(r=null==e?void 0:e.scales)&&void 0!==r?r:null,i="radial"===E,a=i?Ot.left+jt/2:Ot.left,l=i?Ot.top+St/2:Ot.top;return h.createElement("div",{className:"stream-ordinal-frame"+(ot?" "+ot:""),role:"img","aria-label":mt||("string"==typeof nt?nt:"Ordinal chart"),style:{position:"relative",width:At[0],height:At[1]}},h.createElement(xe,{summary:vt}),h.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:At[0],height:At[1],style:{position:"absolute",left:0,top:0}},Et&&h.createElement("g",{transform:`translate(${Ot.left},${Ot.top})`},Et),h.createElement("g",{transform:`translate(${a},${l})`},rt&&h.createElement("rect",{x:0,y:0,width:jt,height:St,fill:rt}),t.map((e,t)=>function(e,t){var n,o,r,i,a;const l=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",c=n=>`ord-${e.type}-${l}-${t}-${n}`,u=`ord-${e.type}-${l}-${t}`;switch(e.type){case"rect":{const t=e;if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:o,w:r,h:i}=t;let s;switch(t.roundedEdge){case"right":s=`M${n},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+i-e} A${e},${e} 0 0 1 ${n+r-e},${o+i} L${n},${o+i} Z`;break;case"left":s=`M${n+r},${o} L${n+e},${o} A${e},${e} 0 0 0 ${n},${o+e} L${n},${o+i-e} A${e},${e} 0 0 0 ${n+e},${o+i} L${n+r},${o+i} Z`;break;case"bottom":s=`M${n},${o} L${n+r},${o} L${n+r},${o+i-e} A${e},${e} 0 0 1 ${n+r-e},${o+i} L${n+e},${o+i} A${e},${e} 0 0 1 ${n},${o+i-e} Z`;break;default:s=`M${n},${o+i} L${n},${o+e} A${e},${e} 0 0 1 ${n+e},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+i} Z`}return h.createElement("path",{key:u,d:s,fill:se(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}return h.createElement("rect",{key:u,x:t.x,y:t.y,width:t.w,height:t.h,fill:se(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}case"point":{const t=e;return h.createElement("circle",{key:u,cx:t.x,cy:t.y,r:t.r,fill:se(t.style.fill),opacity:null!==(n=t.style.opacity)&&void 0!==n?n:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}case"wedge":{const t=e,n=s.arc().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 o=n({})||"";return h.createElement("path",{key:u,d:o,transform:`translate(${t.cx},${t.cy})`,fill:se(t.style.fill),stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity})}case"boxplot":{const t=e,n=t.columnWidth/2;return"vertical"===t.projection?h.createElement("g",{key:u},h.createElement("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),h.createElement("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:se(t.style.fill),fillOpacity:null!==(o=t.style.fillOpacity)&&void 0!==o?o:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),h.createElement("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),h.createElement("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),h.createElement("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})):h.createElement("g",{key:u},h.createElement("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),h.createElement("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:se(t.style.fill),fillOpacity:null!==(r=t.style.fillOpacity)&&void 0!==r?r:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),h.createElement("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),h.createElement("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),h.createElement("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}))}case"violin":{const t=e,n=[h.createElement("path",{key:c("path"),d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:se(t.style.fill),fillOpacity:null!==(i=t.style.fillOpacity)&&void 0!==i?i:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1})];if(t.iqrLine&&t.bounds){const e=t.bounds,o=e.x+e.width/2,r=e.y+e.height/2;e.height>e.width?n.push(h.createElement("line",{key:c("iqr"),x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2}),h.createElement("circle",{key:c("med"),cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1})):n.push(h.createElement("line",{key:c("iqr"),x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2}),h.createElement("circle",{key:c("med"),cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1}))}return h.createElement("g",{key:u},n)}case"connector":return h.createElement("line",{key:u,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:null!==(a=e.style.opacity)&&void 0!==a?a:.5});case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return h.createElement("polygon",{key:u,points:n,fill:se(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}default:return null}}(e,t)).filter(Boolean))),h.createElement(re,{width:jt,height:St,totalWidth:At[0],totalHeight:At[1],margin:Ot,scales:n,showAxes:Ee,showCategoryTicks:_e,oLabel:It,rLabel:Ht,oFormat:$t,rFormat:Dt,rTickValues:$e,tickLabelEdgeAlign:De,showGrid:Xe,title:nt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Ze,legendPosition:Je,foregroundGraphics:Mt,annotations:Ge,svgAnnotationRules:Ve,annotationFrame:0,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null==e?void 0:e.getData()}),it&&"radial"===E&&h.createElement("div",{style:{position:"absolute",left:Ot.left+jt/2,top:Ot.top+St/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},it))}return h.createElement("div",{ref:kt,className:"stream-ordinal-frame"+(ot?" "+ot:""),role:"group","aria-label":mt||("string"==typeof nt?nt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:C?"100%":At[0],height:T?"100%":At[1],overflow:"visible"},onKeyDown:gn},yt&&h.createElement(we,{tableId:Lt}),yt&&h.createElement(be,{scene:null!==(a=null===(i=Jt.current)||void 0===i?void 0:i.scene)&&void 0!==a?a:[],chartType:f+" chart",tableId:Lt,chartTitle:"string"==typeof nt?nt:void 0}),h.createElement(xe,{summary:vt}),h.createElement("div",{role:"img","aria-label":mt||("string"==typeof nt?nt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Kt?pn:void 0,onMouseLeave:Kt?cn:void 0},Et&&h.createElement("svg",{style:{position:"absolute",top:0,left:0,width:At[0],height:At[1],pointerEvents:"none"}},h.createElement("g",{transform:`translate(${Ot.left},${Ot.top})`},Et)),h.createElement(ne,{width:jt,height:St,totalWidth:At[0],totalHeight:At[1],margin:Ot,scales:qt,showAxes:Ee,showGrid:Xe,rFormat:Dt,rTickValues:$e}),h.createElement("canvas",{ref:Nt,"aria-label":ue(null!==(c=null===(l=Jt.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],f+" chart"),style:{position:"absolute",top:0,left:0,width:At[0],height:At[1]}}),h.createElement(ke,{hoverPoint:zt}),h.createElement(re,{width:jt,height:St,totalWidth:At[0],totalHeight:At[1],margin:Ot,scales:qt,showAxes:Ee,showCategoryTicks:_e,oLabel:It,rLabel:Ht,oFormat:$t,rFormat:Dt,showGrid:Xe,title:nt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Ze,legendPosition:Je,foregroundGraphics:Mt,annotations:Ge,svgAnnotationRules:Ve,annotationFrame:Vt,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null===(u=Jt.current)||void 0===u?void 0:u.getData(),underlayRendered:!0}),(dt||ht)&&"radial"!==E&&h.createElement(ie,{width:jt,height:St,totalWidth:At[0],totalHeight:At[1],margin:Ot,scales:qt,onBrush:ht||(()=>{})}),it&&"radial"===E&&h.createElement("div",{style:{position:"absolute",left:Ot.left+jt/2,top:Ot.top+St/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},it),(null==ut?void 0:ut.showBadge)&&h.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ut.badgePosition?{top:4,left:4}:"bottom-left"===ut.badgePosition?{bottom:4,left:4}:"bottom-right"===ut.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Yt?"#dc3545":"#28a745",color:"white"})},Yt?"STALE":"LIVE"),h.createElement(Oe,{active:un.current>=0,hoverPoint:zt,margin:Ot,size:At,shape:null===(d=dn.current)||void 0===d?void 0:d.shape,width:null===(g=dn.current)||void 0===g?void 0:g.w,height:null===(y=dn.current)||void 0===y?void 0:y.h}),mn))});mt.displayName="StreamOrdinalFrame";const vt=e.createContext(null);function bt(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 xt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[wt,kt]=Se(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=xt(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=xt(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}})}})),[At,Ot]=Se(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}))}}));let jt={positions:new Map};const St=new Set;function Mt(){for(const e of St)e()}function Et(e,t){const n=jt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(jt.positions);o.delete(e),jt={positions:o},Mt()}function _t(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=kt(e=>e.selections.get(r)),s=kt(e=>e.setClause),a=kt(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(bt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:e.useCallback(()=>{a(r,o)},[a,r,o]),clientId:o}}const Ct=e.createContext(!1);function Pt({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories: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&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):A[i%A.length];return{label:r+"",color:a}}),label:""}]}}function Lt(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}function Tt(){var e;const t=Be(e=>e.theme),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 Bt(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=w[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]:"#007bff"}function Rt(t,n,o){return e.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return t;const e=[...t],r="function"==typeof(i=o)?i:e=>e[i];var i;return e.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[t,n,o])}h.createContext(void 0);const It={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 Ht(e,t,n){var o,r,i,s,a,l,c;const u=It[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(r=t.height)&&void 0!==r?r:u.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i: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:$t(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function $t(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}const Dt={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 Nt(e,t){return"function"==typeof t?t(e):e[t]}function Ft(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 zt(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=Nt(e,n);s=Ft(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=Nt(e,r);a.push({label:n,value:Ft(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Ft(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Ft(e[t[0]],o))}}const l=Object.assign(Object.assign({},Dt),r);return h.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},s&&h.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},s),a.map((e,t)=>h.createElement("div",{key:t,style:{marginTop:0===t&&s?"4px":0}},e.label&&h.createElement("span",null,e.label,": "),e.value)))}}function Wt(e){if(!0===e)return zt();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:h.createElement("div",{className:"semiotic-tooltip",style:Dt},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?zt(e):zt())}function qt(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Gt(e,t){return"function"==typeof t?t(e):e[t]}function Vt({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1,valueFormat:i}){return s=>{var a;const l=r?(null===(a=s.data)||void 0===a?void 0:a[0])||s.data||s:s.data||s,c=Gt(l,e),u=Gt(l,t),d=n?Gt(l,n):void 0;return h.createElement("div",{className:"semiotic-tooltip",style:Dt},h.createElement("div",{style:{fontWeight:"bold"}},qt(c)),h.createElement("div",{style:{marginTop:4}},function(e,t){if(!t)return qt(e);try{const n=t(e);return null==n?qt(e):n}catch(t){return qt(e)}}(u,i)),null!=d&&h.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(g=n)?g:"value"),": ",qt(d)));var g}}function Xt({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return h.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,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"}},h.createElement("div",{style:{textAlign:"center",maxWidth:400}},h.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),h.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&h.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}},n)))}class Yt extends h.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:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:h.createElement(Xt,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Qt(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 s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Kt(e,t,n=3){let o,r=n+1;for(const n of t){const t=Qt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Ut(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Zt(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=Kt(e,t,3))&&void 0!==n?n:null)}function Jt({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=Ut(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=Zt(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const en={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"}},tn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},nn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},on=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],rn=["vertical","horizontal"],sn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},en),tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:on},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({},en),tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:on},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},en),tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:on},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({},en),tn),{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({},en),tn),{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({},en),tn),{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({},en),tn),{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({},en),tn),{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({},en),tn),{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({},en),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:rn},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({},en),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:rn},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({},en),nn),{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:rn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},en),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:rn},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({},en),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:rn},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({},en),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:rn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},en),nn),{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({},en),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:rn},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({},en),nn),{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({},en),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:rn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},en),{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({},en),{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({},en),{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({},en),nn),{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({},en),nn),{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({},en),{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({},en),{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:rn},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({},en),{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({},en),{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({},en),{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({},en),{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({},en),{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({},en),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},en),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},en),{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({},en),{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({},en),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},en),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function an(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ln=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),cn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),un=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),dn=new Set(["LineChart","AreaChart","StackedAreaChart"]),hn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function gn(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 pn(e,t){const n=gn(e),o=gn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const yn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function fn(e,t){const n=[],o=function(e,t){const n=[],o=sn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(sn).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(!an(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=Kt(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 s=Jt({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({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}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({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=Ut(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=Zt(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({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 sn[e]?(function(e,t,n){const o=sn[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=sn[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 s=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: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){ln.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){cn.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=sn[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 s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.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,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(!un.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(!dn.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,s=null!==(r=t.height)&&void 0!==r?r: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);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."}),s>c||n.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,n),function(e,t,n){var o;const r=sn[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.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(i.length,5);for(const e of s){let t=!0;for(let n=0;a>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(!hn.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=pn(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=pn(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 yn)"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}}var mn;const vn="undefined"!=typeof process&&"production"!==(null===(mn=process.env)||void 0===mn?void 0:mn.NODE_ENV);function bn({componentName:e,width:t,height:n,chartProps:o,children:r}){return h.createElement(Yt,{fallback:r=>{let i="";if(vn&&o)try{const t=fn(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return h.createElement(Xt,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const xn={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"},wn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function kn(e,t,n,o){if(!vn)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 An(t){const{data:n,rawData:o,colorBy:r,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:g,chartType:p,chartId:y,showLegend:f,userMargin:m,marginDefaults:v,onClick:b,hoverHighlight:x,loading:w,emptyContent:k,width:A,height:O}=t,M="string"==typeof t.colorBy?t.colorBy:void 0,{activeSelectionHook:E,hoverSelectionHook:_,customHoverBehavior:C,customClickBehavior:P,crosshairSourceId:L}=function({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=e.useId(),h=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}(n,o),g=_t({name:(null==t?void 0:t.name)||"__unused__"}),p=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:s,clear:a}=_t({name:n});return{onHover:e.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:r,isActive:i}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),y=Ot(e=>e.pushObservation),f=t?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=e.useState(null),b=u||o[0],x=e.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),w=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=jt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(jt={positions:new Map(jt.positions).set(e,{xValue:t,sourceId:n})},Mt())}(h.name||"hover",Number(e),d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Et(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(i||y){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),y&&y(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),y&&y(e)}}},[n,p,h,d,i,s,a,y,c,b]),k=e.useCallback(e=>{var t,n,o,r;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[h.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=jt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(jt.positions);return t.delete(e),jt={positions:t},Mt(),!1}jt={positions:new Map(jt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Mt()}(h.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||y){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=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});i&&i(s),y&&y(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),y&&y(e)}}},[l,i,y,s,a,h,d]);return e.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const n=jt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(jt.positions);o.delete(e),jt={positions:o},Mt()}(e,d),Et(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:f,hoverSelectionHook:x,customHoverBehavior:w,customClickBehavior:k,crosshairSourceId:d}}({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:g,chartType:p,chartId:y,onClick:b,hoverHighlight:x,colorByField:M}),T=function(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}}(c,L),B=function(t,n,o){const r=e.useContext(vt),i=Tt();return e.useMemo(()=>{var e;if(!n)return;const s=null!==(e=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==e?e:"category10";if(0!==t.length){if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const t=S(e.map(e=>({_cat:e})),"_cat",s);return e=>r[e]||t(e)}return S(e.map(e=>({_cat:e})),"_cat",s)}if(r&&Object.keys(r).length>0){const e=S(t,n,s);return t=>r[t]||e(t)}return S(t,n,s)}if(r&&Object.keys(r).length>0){const e=S([{_:"a"}],"_",s);return t=>r[t]||e(t)}},[t,n,o,r,i])}(n,r,i),R=e.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of n){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[n,r]),I=function(t,n,o){const[r,i]=e.useState(null),[s,a]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&a(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&s.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return s.has(o)}}:null},[t,n,r,s]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(s,r,R),H=e.useMemo(()=>_||(I.legendSelectionHook?I.legendSelectionHook:E),[_,I.legendSelectionHook,E]),$=function(t){const n=Be(e=>e.theme.colors.selectionOpacity);return e.useMemo(()=>{var e,o;if(void 0!==t||void 0!==n)return Object.assign(Object.assign({name:null!==(e=null==t?void 0:t.name)&&void 0!==e?e:""},t),{unselectedOpacity:null!==(o=null==t?void 0:t.unselectedOpacity)&&void 0!==o?o:n})},[t,n])}(l),{legend:D,margin:N,legendPosition:F}=function({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=e.useContext(Ct),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return Pt({data:t,colorBy:n,colorScale:o,getColor:j,categories:l})},[u,n,t,o,l]),h=e.useMemo(()=>{const e=Object.assign(Object.assign({},a),s);return d&&("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},[a,s,d,i]);return{legend:d,margin:h,legendPosition:i}}({data:n,colorBy:r,colorScale:B,showLegend:f,legendPosition:a,userMargin:m,defaults:v}),z=e.useMemo(()=>{const e={};return D&&(e.legend=D,e.legendPosition=F),s&&"none"!==s&&(e.legendHoverBehavior=I.onLegendHover,e.legendClickBehavior=I.onLegendClick,e.legendHighlightedCategory=I.highlightedCategory,e.legendIsolatedCategories=I.isolatedCategories),e},[D,F,s,I.onLegendHover,I.onLegendClick,I.highlightedCategory,I.isolatedCategories]),W=function(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(r+i)-i))/2);return h.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>h.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},wn),{position:"absolute",top:s+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}(w,A,O),q=W?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?h.createElement("div",{style:Object.assign(Object.assign({},xn),{width:t,height:n})},o||"No data available"):null}(o,A,O,k);return{colorScale:B,allCategories:R,legendState:I,effectiveSelectionHook:H,activeSelectionHook:E,customHoverBehavior:C,customClickBehavior:P,legend:D,margin:N,legendPosition:F,earlyReturn:W||q||null,legendBehaviorProps:z,crosshairProps:T,resolvedSelection:$}}const On=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:g,colorScheme:p,sort:y=!1,barPadding:f=40,roundedTop:m,baselinePadding:v=!1,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,chartId:E,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,showCategoryTicks:B,categoryFormat:R,dataIdAccessor:I}=t,H=o.width,$=o.height,D=o.enableHover,N=o.showGrid,F=o.title,z=o.description,W=o.summary,q=o.accessibleTable,G=o.categoryLabel,V=o.valueLabel,X=i||[],Y=An({data:X,rawData:i,colorBy:g,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:M,chartType:"BarChart",chartId:E,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:_,emptyContent:C,width:H,height:$});if(Y.earlyReturn)return Y.earlyReturn;kn("BarChart",X,"categoryAccessor",l),kn("BarChart",X,"valueAccessor",c);const Q=Rt(X,y,c),K=Tt(),U=e.useMemo(()=>new Map,[X]),Z=e.useMemo(()=>(e,t)=>{const n={};return n.fill=g?j(e,g,Y.colorScale):Bt(T,K,p,void 0,U),n},[g,Y.colorScale,T,K,p,U]),J=e.useMemo(()=>{const e=null==w?void 0:w.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Z(t,n)),e(t,n)||{}):Z},[Z,w]),ee=e.useMemo(()=>Lt(J,Y.effectiveSelectionHook,Y.resolvedSelection),[J,Y.effectiveSelectionHook,Y.resolvedSelection]),te=e.useMemo(()=>Vt({categoryAccessor:l,valueAccessor:c,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:d}),[l,c,g,d]),ne=Jt({componentName:"BarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(ne)return h.createElement(Xt,{componentName:"BarChart",message:ne,width:H,height:$});const 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(Object.assign({chartType:"bar"},null!=i&&{data:Q}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ee,size:[H,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y.margin,barPadding:f}),null!=m&&{roundedTop:m}),I&&{dataIdAccessor:I}),{baselinePadding:v,enableHover:D,showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:d}),R&&{oFormat:R}),{showGrid:N,showCategoryTicks:B,oSort:y}),Y.legendBehaviorProps),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:Wt(b)||te}),(A||O||S||M)&&{customHoverBehavior:Y.customHoverBehavior}),(O||S||A)&&{customClickBehavior:Y.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"BarChart",width:H,height:$},h.createElement(mt,Object.assign({ref:r},oe)))});function jn({isPushMode:t,colorBy:n,colorScheme:o,showLegend:r,legendPosition:i="right"}){const s=e.useRef(new Set),a=e.useRef([]),[l,c]=e.useState(0),u=e.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=e.useCallback(e=>{if(!t||!n)return;let o=!1;for(const t of e){if(!t||"object"!=typeof t)continue;const e=u(t);null==e||s.current.has(e)||(s.current.add(e),a.current.push(e),o=!0)}o&&c(e=>e+1)},[t,n,u]),h=e.useCallback(e=>t=>{d([t]),e(t)},[d]),g=e.useCallback(e=>t=>{d(t),e(t)},[d]),p=e.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]),y=e.useMemo(()=>{if(!t||!n||!1===r)return;const e=a.current;if(0===e.length)return;const i=Array.isArray(o)?o:A,s=new Map;for(let t=0;e.length>t;t++)s.set(e[t],i[t%i.length]);const l="string"==typeof n?n:"__streamCat";return Pt({data:e.map(e=>({[l]:e})),colorBy:l,colorScale:e=>s.get(e)||"#999",getColor:j})},[t,n,r,o,l]),f=e.useMemo(()=>{if(y)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[y,i]);return{wrapPush:h,wrapPushMany:g,resetCategories:p,streamingLegend:y,streamingMarginAdjust:f}}function Sn({ref:t,frameRef:n,isPushMode:o,colorBy:r,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const c=jn({isPushMode:o,colorBy:r,colorScheme:i,showLegend:s,legendPosition:a}),u=e.useCallback(c.wrapPush(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)}),[c.wrapPush]),d=e.useCallback(c.wrapPushMany(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)}),[c.wrapPushMany]);return e.useImperativeHandle(t,()=>({push:u,pushMany:d,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,r;return null!==(r=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[]},clear:()=>{var e;c.resetCategories(),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:[]}}),[u,d,c.resetCategories]),{effectiveLegendProps:e.useMemo(()=>c.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:c.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,c.streamingLegend,a]),effectiveMargin:e.useMemo(()=>{if(c.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(c.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,c.streamingMarginAdjust])}}On.displayName="BarChart";const Mn=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",stackBy:c,valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:p,colorScheme:y,normalize:f=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:E,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:R,categoryFormat:I}=t,H=o.width,$=o.height,D=o.enableHover,N=o.showGrid,F=o.showLegend,z=o.title,W=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=i||[],Q=p||c,K=void 0===i,U=An({data:Y,rawData:i,colorBy:Q,colorScheme:y,legendInteraction:T,legendPosition:B,selection:O,linkedHover:S,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:M,onClick:E,hoverHighlight:_,chartType:"StackedBarChart",chartId:C,showLegend:F,userMargin:s,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:H,height:$});if(U.earlyReturn)return U.earlyReturn;const Z=Tt(),J=e.useMemo(()=>new Map,[Y]),ee=e.useMemo(()=>(e,t)=>Q?U.colorScale?{fill:j(e,Q,U.colorScale)}:{}:{fill:Bt(R,Z,y,t,J)},[Q,U.colorScale,R,Z,y,J]),te=e.useMemo(()=>{const e=null==A?void 0:A.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,A]),ne=e.useMemo(()=>Lt(te,U.effectiveSelectionHook,U.resolvedSelection),[te,U.effectiveSelectionHook,U.resolvedSelection]),oe=e.useMemo(()=>Vt({categoryAccessor:c,valueAccessor:u,groupAccessor:l,valueFormat:g}),[c,l,u,g]),re=Jt({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{stackBy:c}}),{effectiveLegendProps:ie,effectiveMargin:se}=Sn({ref:n,frameRef:r,isPushMode:K,colorBy:Q,colorScheme:y,showLegend:F,legendPosition:B,setup:U}),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:"bar"},null!=i&&{data:Y}),{oAccessor:l,rAccessor:u,stackBy:c,normalize:f,oSort:m,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ne,size:[H,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:D}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:g}),I&&{oFormat:I}),{showGrid:N}),ie),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:Wt(w)||oe}),(S||M||E||_)&&{customHoverBehavior:U.customHoverBehavior}),(M||E||S)&&{customClickBehavior:U.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return re?h.createElement(Xt,{componentName:"StackedBarChart",message:re,width:H,height:$}):h.createElement(bn,{componentName:"StackedBarChart",width:H,height:$},h.createElement(mt,Object.assign({ref:r},ae)))});Mn.displayName="StackedBarChart";const En=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",groupBy:c,valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:p,colorScheme:y,sort:f=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:E,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,categoryFormat:R}=t,I=o.width,H=o.height,$=o.enableHover,D=o.showGrid,N=o.showLegend,F=o.title,z=o.description,W=o.summary,q=o.accessibleTable,G=o.categoryLabel,V=o.valueLabel,X=i||[],Y=p||c,Q=void 0===i,K=An({data:X,rawData:i,colorBy:Y,colorScheme:y,legendInteraction:L,legendPosition:T,selection:A,linkedHover:O,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:E,chartType:"GroupedBarChart",chartId:_,showLegend:N,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:P,width:I,height:H});if(K.earlyReturn)return K.earlyReturn;const U=Tt(),Z=e.useMemo(()=>new Map,[X]),J=k.pieceStyle,ee=e.useMemo(()=>(e,t)=>{const n=Y?K.colorScale?{fill:j(e,Y,K.colorScale)}:{}:{fill:Bt(B,U,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},[Y,K.colorScale,B,U,y,Z,J]),te=e.useMemo(()=>Lt(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),ne=e.useMemo(()=>Vt({categoryAccessor:c,valueAccessor:u,groupAccessor:l,valueFormat:g}),[c,l,u,g]),oe=Jt({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{groupBy:c}}),{effectiveLegendProps:re,effectiveMargin:ie}=Sn({ref:n,frameRef:r,isPushMode:Q,colorBy:Y,colorScheme:y,showLegend:N,legendPosition:T,setup:K}),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:"clusterbar"},null!=i&&{data:X}),{oAccessor:l,rAccessor:u,groupBy:c,oSort:f,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:te,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:g}),R&&{oFormat:R}),{showGrid:D}),re),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:Wt(x)||ne}),(O||S||M||E)&&{customHoverBehavior:K.customHoverBehavior}),(S||M||O)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return oe?h.createElement(Xt,{componentName:"GroupedBarChart",message:oe,width:I,height:H}):h.createElement(bn,{componentName:"GroupedBarChart",width:I,height:H},h.createElement(mt,Object.assign({ref:r},se)))});function _n({brushProp:t,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=(s="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(t){const{name:n,xField:o,yField:r}=t,{predicate:i,isActive:s,selectInterval:a,clear:l}=_t({name:n}),c=o&&r?"xyBrush":o?"xBrush":"yBrush",u=e.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&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"===c&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,r,a,l]);return{brushInteraction:e.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),l=e.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=e.useCallback(e=>{if(i){l.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(t||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}En.displayName="GroupedBarChart";const Cn=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",subcategoryAccessor:c,valueAccessor:u="value",orientation:d="horizontal",valueFormat:g,colorBy:p,colorScheme:y,barPadding:f=40,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:E,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,categoryFormat:R,rTickValues:I,tickLabelEdgeAlign:H,showCategoryTicks:$}=t,D=o.width,N=o.height,F=o.enableHover,z=o.showGrid,W=o.showLegend,q=o.title,G=o.description,V=o.summary,X=o.accessibleTable,Y=o.categoryLabel,Q=o.valueLabel,K=i||[],U=p||c,Z=void 0===i,J=An({data:K,rawData:i,colorBy:U,colorScheme:y,legendInteraction:L,legendPosition:T,selection:A,linkedHover:O,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:E,chartType:"SwimlaneChart",chartId:_,showLegend:W,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:P,width:D,height:N}),ee=_n({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:u});if(J.earlyReturn)return J.earlyReturn;const te=Tt(),ne=e.useMemo(()=>new Map,[K]),oe=k.pieceStyle,re=e.useMemo(()=>(e,t)=>{const n=U?J.colorScale?{fill:j(e,U,J.colorScale)}:{}:{fill:Bt(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},[U,J.colorScale,B,te,y,ne,oe]),ie=e.useMemo(()=>Lt(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),se=e.useMemo(()=>Vt({categoryAccessor:c,valueAccessor:u,groupAccessor:l,valueFormat:g}),[c,l,u,g]),ae=Jt({componentName:"SwimlaneChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u,subcategoryAccessor:c},requiredProps:{subcategoryAccessor:c}}),{effectiveLegendProps:le,effectiveMargin:ce}=Sn({ref:n,frameRef:r,isPushMode:Z,colorBy:U,colorScheme:y,showLegend:W,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!=i&&{data:K}),{oAccessor:l,rAccessor:u,stackBy:c,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ie,size:[D,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,barPadding:f,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===$?void 0:Y,rLabel:Q,rFormat:g}),I&&{rTickValues:I}),null!=H&&{tickLabelEdgeAlign:H}),R&&{oFormat:R}),void 0!==$&&{showCategoryTicks:$}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:Wt(m)||se}),(O||S||M||E)&&{customHoverBehavior:J.customHoverBehavior}),(S||M||O)&&{customClickBehavior:J.customClickBehavior}),v&&v.length>0&&{annotations:v}),ee.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?h.createElement(Xt,{componentName:"SwimlaneChart",message:ae,width:D,height:N}):h.createElement(bn,{componentName:"SwimlaneChart",width:D,height:N},h.createElement(mt,Object.assign({ref:r},ue)))});Cn.displayName="SwimlaneChart";const Pn=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:g,colorScheme:p,sizeBy:y,sizeRange:f=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:M,linkedHover:E,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:R,legendPosition:I,color:H,showCategoryTicks:$,categoryFormat:D}=t,N=o.width,F=o.height,z=o.enableHover,W=o.showGrid,q=o.title,G=o.description,V=o.summary,X=o.accessibleTable,Y=o.categoryLabel,Q=o.valueLabel,K=i||[],U=An({data:K,rawData:i,colorBy:g,colorScheme:p,legendInteraction:R,legendPosition:I,selection:M,linkedHover:E,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"SwarmPlot",chartId:L,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:T,emptyContent:B,width:N,height:F}),Z=_n({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:c});if(U.earlyReturn)return U.earlyReturn;const J=e.useMemo(()=>{if(!y)return;const e=K.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[K,y]),ee=Tt(),te=e.useMemo(()=>new Map,[K]),ne=S.pieceStyle,oe=e.useMemo(()=>(e,t)=>{const n={fillOpacity:v};if(n.fill=g?j(e,g,U.colorScale):Bt(H,ee,p,void 0,te),n.r=y?function(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,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}(e,y,f,J):m,ne){const o=ne(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[g,U.colorScale,y,f,J,m,v,H,ee,p,te,ne]),re=e.useMemo(()=>Lt(oe,U.effectiveSelectionHook,U.resolvedSelection),[oe,U.effectiveSelectionHook,U.resolvedSelection]),ie=e.useMemo(()=>Vt({categoryAccessor:l,valueAccessor:c,groupAccessor:g||void 0,valueFormat:d}),[l,c,g,d]),se=Jt({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(se)return h.createElement(Xt,{componentName:"SwarmPlot",message:se,width:N,height:F});const 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({chartType:"swarm"},null!=i&&{data:K}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[N,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,barPadding:b,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Y,rLabel:Q,rFormat:d}),D&&{oFormat:D}),{showGrid:W,showCategoryTicks:$}),U.legendBehaviorProps),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:Wt(x)||ie}),(E||_||C||P)&&{customHoverBehavior:U.customHoverBehavior}),(_||C||E)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Z.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"SwarmPlot",width:N,height:F},h.createElement(mt,Object.assign({ref:r},ae)))});function Ln(e){return t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats||(t.data||t).stats;if(r&&null!=r.median)return h.createElement("div",{className:"semiotic-tooltip",style:Dt},o&&h.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r.n&&h.createElement("div",null,"n = ",r.n),null!=r.min&&h.createElement("div",null,"Min: ",r.min.toLocaleString()),null!=r.q1&&h.createElement("div",null,"Q1: ",r.q1.toLocaleString()),h.createElement("div",null,"Median: ",r.median.toLocaleString()),null!=r.q3&&h.createElement("div",null,"Q3: ",r.q3.toLocaleString()),null!=r.max&&h.createElement("div",null,"Max: ",r.max.toLocaleString()),null!=r.mean&&h.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==e?void 0:e.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return h.createElement("div",{className:"semiotic-tooltip",style:Dt},o&&h.createElement("div",{style:{fontWeight:"bold"}},o+""),i>0&&h.createElement("div",null,"n = ",i),null!=s&&h.createElement("div",null,"Median: ",s.toLocaleString()))}return h.createElement("div",{className:"semiotic-tooltip",style:Dt},h.createElement("div",{style:{fontWeight:"bold"}},o+""))}}Pn.displayName="SwarmPlot";const Tn=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:g,colorScheme:p,showOutliers:y=!0,categoryPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:E,legendInteraction:_,legendPosition:C,color:P,showCategoryTicks:L,categoryFormat:T}=t,B=o.width,R=o.height,I=o.enableHover,H=o.showGrid,$=o.title,D=o.description,N=o.summary,F=o.accessibleTable,z=o.categoryLabel,W=o.valueLabel,q=i||[],G=An({data:q,rawData:i,colorBy:g,colorScheme:p,legendInteraction:_,legendPosition:C,selection:x,linkedHover:w,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"BoxPlot",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:M,emptyContent:E,width:B,height:R});if(G.earlyReturn)return G.earlyReturn;const V=Tt(),X=e.useMemo(()=>new Map,[q]),Y=e.useMemo(()=>e=>{const t=g?j(e,g,G.colorScale):Bt(P,V,p,void 0,X);return{fill:t,stroke:t,fillOpacity:.8}},[g,G.colorScale,P,V,p,X]),Q=e.useMemo(()=>Lt(Y,G.effectiveSelectionHook,G.resolvedSelection),[Y,G.effectiveSelectionHook,G.resolvedSelection]),K=e.useMemo(()=>Ln(),[]),U=Jt({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(U)return h.createElement(Xt,{componentName:"BoxPlot",message:U,width:B,height:R});const 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:"boxplot"},null!=i&&{data:q}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:Q,showOutliers:y,size:[B,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,barPadding:f,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:z,rLabel:W,rFormat:d}),T&&{oFormat:T}),{showGrid:H,showCategoryTicks:L}),G.legendBehaviorProps),$&&{title:$}),D&&{description:D}),N&&{summary:N}),void 0!==F&&{accessibleTable:F}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:Wt(m)||K}),(w||k||A||O)&&{customHoverBehavior:G.customHoverBehavior}),(k||A||w)&&{customClickBehavior:G.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"BoxPlot",width:B,height:R},h.createElement(mt,Object.assign({ref:r},Z)))});Tn.displayName="BoxPlot";const Bn=e.forwardRef(function(t,n){const o=Ht(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:"horizontal"}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:c="value",bins:u=25,relative:d=!1,valueFormat:g,colorBy:p,colorScheme:y,categoryPadding:f=20,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:E,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,showCategoryTicks:R,categoryFormat:I}=t,H=o.width,$=o.height,D=o.enableHover,N=o.showGrid,F=o.title,z=o.description,W=o.summary,q=o.accessibleTable,G=o.categoryLabel,V=o.valueLabel,X=i||[],Y=An({data:X,rawData:i,colorBy:p,colorScheme:y,legendInteraction:L,legendPosition:T,selection:A,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:E,chartType:"Histogram",chartId:_,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:P,width:H,height:$}),Q=_n({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:c});if(Y.earlyReturn)return Y.earlyReturn;const K=e.useMemo(()=>{if(0===X.length)return;const e="function"==typeof c?c:e=>e[c];let t=1/0,n=-1/0;for(const o of X){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[X,c]),U=Tt(),Z=e.useMemo(()=>new Map,[X]),J=e.useMemo(()=>e=>{const t=p?j(e,p,Y.colorScale):Bt(B,U,y,void 0,Z);return{fill:t,stroke:t,fillOpacity:.8}},[p,Y.colorScale,B,U,y,Z]),ee=e.useMemo(()=>Lt(J,Y.effectiveSelectionHook,Y.resolvedSelection),[J,Y.effectiveSelectionHook,Y.resolvedSelection]),te=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return h.createElement("div",{className:"semiotic-tooltip",style:Dt},n&&h.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&h.createElement("div",null,"Count: ",o),r&&2===r.length&&h.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),ne=Jt({componentName:"Histogram",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(ne)return h.createElement(Xt,{componentName:"Histogram",message:ne,width:H,height:$});const 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(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=i&&{data:X}),{oAccessor:l,rAccessor:c,projection:"horizontal",summaryStyle:ee,bins:u,normalize:d}),K&&{rExtent:K}),{size:[H,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y.margin,barPadding:f,enableHover:D}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:g}),I&&{oFormat:I}),{showGrid:N,showCategoryTicks:R}),Y.legendBehaviorProps),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:Wt(m)||te}),(O||S||M||E)&&{customHoverBehavior:Y.customHoverBehavior}),(S||M||O)&&{customClickBehavior:Y.customClickBehavior}),v&&v.length>0&&{annotations:v}),Q.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"Histogram",width:H,height:$},h.createElement(mt,Object.assign({ref:r},oe)))});Bn.displayName="Histogram";const Rn=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",bins:d=25,showIQR:g=!0,valueFormat:p,colorBy:y,colorScheme:f,categoryPadding:m=20,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:E,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:R,showCategoryTicks:I,categoryFormat:H}=t,$=o.width,D=o.height,N=o.enableHover,F=o.showGrid,z=o.title,W=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=i||[],Q=An({data:Y,rawData:i,colorBy:y,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:M,onClick:E,hoverHighlight:_,chartType:"ViolinPlot",chartId:C,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:$,height:D}),K=_n({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:c});if(Q.earlyReturn)return Q.earlyReturn;const U=Tt(),Z=e.useMemo(()=>new Map,[Y]),J=e.useMemo(()=>e=>{const t=y?j(e,y,Q.colorScale):Bt(R,U,f,void 0,Z);return{fill:t,stroke:t,fillOpacity:.6}},[y,Q.colorScale,R,U,f,Z]),ee=e.useMemo(()=>Lt(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=e.useMemo(()=>Ln({valueAccessor:c}),[c]),ne=Jt({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(ne)return h.createElement(Xt,{componentName:"ViolinPlot",message:ne,width:$,height:D});const 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(Object.assign({chartType:"violin"},null!=i&&{data:Y}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:ee,bins:d,showIQR:g,size:[$,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:N}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:I}),Q.legendBehaviorProps),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===v?()=>null:Wt(v)||te}),(S||M||E||_)&&{customHoverBehavior:Q.customHoverBehavior}),(M||E||S)&&{customClickBehavior:Q.customClickBehavior}),b&&b.length>0&&{annotations:b}),K.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"ViolinPlot",width:$,height:D},h.createElement(mt,Object.assign({ref:r},oe)))});Rn.displayName="ViolinPlot";const In=e.forwardRef(function(t,n){var o;const r=Ht(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,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}),i=e.useRef(null);e.useImperativeHandle(n,()=>({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{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",valueFormat:g,colorBy:p,colorScheme:y,sort:f="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,chartId:E,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,categoryFormat:B}=t,R=r.width,I=r.height,H=r.enableHover,$=r.showGrid,D=r.title,N=r.description,F=r.summary,z=r.accessibleTable,W=r.categoryLabel,q=r.valueLabel,G=s||[],V=An({data:G,rawData:s,colorBy:p,colorScheme:y,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:M,chartType:"DotPlot",chartId:E,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:_,emptyContent:C,width:R,height:I});if(V.earlyReturn)return V.earlyReturn;const X=Rt(G,f,u),Y=Tt(),Q=e.useMemo(()=>new Map,[G]),K=w.pieceStyle,U=e.useMemo(()=>(e,t)=>{const n={r:m,fillOpacity:.8};if(n.fill=p?j(e,p,V.colorScale):Bt(T,Y,y,void 0,Q),K){const o=K(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,V.colorScale,m,T,Y,y,Q,K]),Z=e.useMemo(()=>Lt(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),J=e.useMemo(()=>Vt({categoryAccessor:c,valueAccessor:u,valueFormat:g}),[c,u,g]),ee=Jt({componentName:"DotPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ee)return h.createElement(Xt,{componentName:"DotPlot",message:ee,width:R,height:I});const 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:"point"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:Z,size:[R,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V.margin,barPadding:v,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:r.showAxes,oLabel:W,rLabel:q,rFormat:g}),B&&{oFormat:B}),{showGrid:$,oSort:f}),V.legendBehaviorProps),D&&{title:D}),N&&{description:N}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),l&&{className:l}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:Wt(b)||J}),(A||O||S||M)&&{customHoverBehavior:V.customHoverBehavior}),(O||S||A)&&{customClickBehavior:V.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"DotPlot",width:R,height:I},h.createElement(mt,Object.assign({ref:i},te)))});In.displayName="DotPlot";const Hn=e.forwardRef(function(t,n){var o,r;const i=Ht(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",colorBy:g,colorScheme:p,startAngle:y=0,cornerRadius:f,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:E,legendInteraction:_,legendPosition:C,color:P}=t,L=i.width,T=i.height,B=i.enableHover,R=i.showLegend,I=i.title,H=i.description,$=i.summary,D=i.accessibleTable,N=a||[],F=g||u,z=void 0===a,W=An({data:N,rawData:a,colorBy:F,colorScheme:p,legendInteraction:_,legendPosition:C,selection:x,linkedHover:w,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"PieChart",chartId:S,showLegend:R,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:E,width:L,height:T});if(W.earlyReturn)return W.earlyReturn;const q=Tt(),G=e.useMemo(()=>new Map,[N]),V=e.useMemo(()=>(e,t)=>F?W.colorScale?{fill:j(e,F,W.colorScale)}:{}:{fill:Bt(P,q,p,t,G)},[F,W.colorScale,P,q,p,G]),X=e.useMemo(()=>{const e=null==b?void 0:b.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},V(t,n)),e(t,n)||{}):V},[V,b]),Y=e.useMemo(()=>Lt(X,W.effectiveSelectionHook,W.resolvedSelection),[X,W.effectiveSelectionHook,W.resolvedSelection]),Q=e.useMemo(()=>Vt({categoryAccessor:u,valueAccessor:d,groupAccessor:g&&g!==u?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[u,d,g]),K=Jt({componentName:"PieChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:U,effectiveMargin:Z}=Sn({ref:n,frameRef:s,isPushMode:z,colorBy:F,colorScheme:p,showLegend:R,legendPosition:C,setup:W}),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!=a&&{data:N}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:Y,startAngle:y}),null!=f&&{cornerRadius:f}),{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,enableHover:B}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),U),I&&{title:I}),H&&{description:H}),$&&{summary:$}),void 0!==D&&{accessibleTable:D}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:Wt(m)||Q}),(w||k||A||O)&&{customHoverBehavior:W.customHoverBehavior}),(k||A||w)&&{customClickBehavior:W.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return K?h.createElement(Xt,{componentName:"PieChart",message:K,width:L,height:T}):h.createElement(bn,{componentName:"PieChart",width:L,height:T},h.createElement(mt,Object.assign({ref:s},J)))});Hn.displayName="PieChart";const $n=e.forwardRef(function(t,n){var o,r;const i=Ht(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:g=60,centerContent:p,colorBy:y,colorScheme:f,startAngle:m=0,cornerRadius:v,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,chartId:E,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:T}=t,B=i.width,R=i.height,I=i.enableHover,H=i.showLegend,$=i.title,D=i.description,N=i.summary,F=i.accessibleTable,z=a||[],W=y||u,q=void 0===a,G=An({data:z,rawData:a,colorBy:W,colorScheme:f,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:M,chartType:"DonutChart",chartId:E,showLegend:H,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:C,width:B,height:R});if(G.earlyReturn)return G.earlyReturn;const V=Tt(),X=e.useMemo(()=>new Map,[z]),Y=w.pieceStyle,Q=e.useMemo(()=>(e,t)=>{let n;if(n=W?G.colorScale?{fill:j(e,W,G.colorScale)}:{}:{fill:Bt(T,V,f,t,X)},Y){const o=Y(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[W,G.colorScale,T,V,f,X,Y]),K=e.useMemo(()=>Lt(Q,G.effectiveSelectionHook,G.resolvedSelection),[Q,G.effectiveSelectionHook,G.resolvedSelection]),U=e.useMemo(()=>Vt({categoryAccessor:u,valueAccessor:d,groupAccessor:y&&y!==u?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[u,d,y]),Z=Jt({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:J,effectiveMargin:ee}=Sn({ref:n,frameRef:s,isPushMode:q,colorBy:W,colorScheme:f,showLegend:H,legendPosition:L,setup:G}),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!=a&&{data:z}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:K,innerRadius:g,startAngle:m}),null!=v&&{cornerRadius:v}),{centerContent:p,size:[B,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),$&&{title:$}),D&&{description:D}),N&&{summary:N}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:Wt(b)||U}),(A||O||S||M)&&{customHoverBehavior:G.customHoverBehavior}),(O||S||A)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return Z?h.createElement(Xt,{componentName:"DonutChart",message:Z,width:B,height:R}):h.createElement(bn,{componentName:"DonutChart",width:B,height:R},h.createElement(mt,Object.assign({ref:s},te)))});$n.displayName="DonutChart";const Dn=e.forwardRef(function(t,n){var o,r,i;const s=Ht(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:300,height:null!==(r=t.height)&&void 0!==r?r:250,enableHover:null===(i=t.enableHover)||void 0===i||i,showLegend:!1,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),a=e.useRef(null),{value:l,min:c=0,max:u=100,thresholds:d,color:g,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:f=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:v,valueFormat:b,showScaleLabels:x=!0,sweep:w=240,fillZones:k=!0,tooltip:A,annotations:O,frameProps:j={},className:S}=t,M=s.width,E=s.height,_=s.title,C=s.description,P=s.summary,L=s.accessibleTable,T=Math.max(c,Math.min(u,l)),B=u-c||1,R=(T-c)/B,{gaugeData:I,pieceStyle:H,gaugeAnnotations:$}=e.useMemo(()=>{const e=[],t=new Map,n=[];let o=d&&d.length>0?[...d].sort((e,t)=>e.value-t.value):[{value:u,color:g||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(c,Math.min(u,e.value))})),u>o[o.length-1].value&&o.push({value:u,color:o[o.length-1].color});let r=c;for(let n=0;o.length>n;n++){const i=o[n],s=(i.value-r)/B;if(k){const o=(r-c)/B,a=Math.max(0,Math.min(R,(i.value-c)/B)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_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:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(x&&d&&d.length>0)for(const e of d)e.value>c&&u>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}},[l,c,u,d,g,p,R,B,x,k]),D=w*Math.PI/180,N=180+(360-w)/2,F=-Math.PI/2+N*Math.PI/180,z=[[Math.cos(F),Math.sin(F)],[Math.cos(F+D),Math.sin(F+D)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-F)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>D+.001||z.push([Math.cos(e),Math.sin(e)]);const W=Math.min(...z.map(e=>e[0])),q=Math.max(...z.map(e=>e[0])),G=Math.min(...z.map(e=>e[1])),V=Math.max(...z.map(e=>e[1])),X=(G+V)/2,Y=(W+q)/2,Q=Math.max(10,Math.min((M-20)/(q-W),(E-20)/(V-G))-4),K=Math.max(10,Q*(1-y)),U=M/2-Y*Q,Z=E/2-X*Q,J=2*(Q+4),ee=e.useMemo(()=>{if(null!=v)return"function"==typeof v?v(T,c,u):v;const e=b?b(T):Math.round(T)+"";return h.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},h.createElement("div",{style:{fontSize:Math.max(16,.3*Q),fontWeight:700,color:"var(--semiotic-text, #333)"}},e),x&&h.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},c," – ",u))},[v,T,c,u,b,x,Q]),te=e.useMemo(()=>{if(!f)return null;const e=-Math.PI/2+N*Math.PI/180+R*D,t=K-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[f,R,N,D,K,m]),ne=e.useMemo(()=>(e,t,n)=>{if("gauge-needle"===e.type)return h.createElement("g",{key:"gauge-needle-"+t,transform:`translate(${(n.width||M)/2},${(n.height||E)/2})`},h.createElement("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:2.5,strokeLinecap:"round"}),h.createElement("circle",{cx:0,cy:0,r:5,fill:e.color}));if("gauge-label"===e.type){const o=-Math.PI/2+N*Math.PI/180+(e.value-c)/B*D,r=K-14,i=(n.height||E)/2;return h.createElement("text",{key:"gauge-label-"+t,x:(n.width||M)/2+Math.cos(o)*r,y:i+Math.sin(o)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label)}return null},[M,E,c,B,N,D,K]),oe=e.useMemo(()=>{const e=[...$,...O||[]];return te&&e.push(te),e},[$,O,te]),re=e.useMemo(()=>e=>{var t;const n=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t[0])||(null==e?void 0:e.data)||e,o=null==n?void 0:n._isFill;return h.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))"}},h.createElement("div",{style:{fontWeight:600}},(null==n?void 0:n._zone)||""),h.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},o?"Current: "+Math.round(T):"Remaining"))},[T]);if(0===I.length)return h.createElement(Xt,{componentName:"GaugeChart",message:"No data to display",width:M,height:E});const ie=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:H,innerRadius:K,startAngle:N,sweepAngle:w,centerContent:ee,size:[M,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:{top:Z-J/2,bottom:E-Z-J/2,left:U-J/2,right:M-U-J/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:Wt(A)||re,svgAnnotationRules:ne},oe.length>0&&{annotations:oe}),_&&{title:_}),C&&{description:C}),P&&{summary:P}),void 0!==L&&{accessibleTable:L}),S&&{className:S}),null!=t.animate&&{animate:t.animate}),j);return h.createElement(bn,{componentName:"GaugeChart",width:M,height:E},h.createElement(mt,Object.assign({ref:a},ie)))});Dn.displayName="GaugeChart";const Nn=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",bins:d=20,amplitude:g=1.5,valueFormat:p,colorBy:y,colorScheme:f,categoryPadding:m=5,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:M,loading:E,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,showCategoryTicks:T,categoryFormat:B}=t,R=o.width,I=o.height,H=o.enableHover,$=o.showGrid,D=o.title,N=o.description,F=o.summary,z=o.accessibleTable,W=o.categoryLabel,q=o.valueLabel,G=i||[],V=An({data:G,rawData:i,colorBy:y,colorScheme:f,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"RidgelinePlot",chartId:M,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:E,emptyContent:_,width:R,height:I});if(V.earlyReturn)return V.earlyReturn;const X=Tt(),Y=e.useMemo(()=>new Map,[G]),Q=e.useMemo(()=>e=>{const t=y?j(e,y,V.colorScale):Bt(L,X,f,void 0,Y);return{fill:t,stroke:t,fillOpacity:.5}},[y,V.colorScale,L,X,f,Y]),K=e.useMemo(()=>Lt(Q,V.effectiveSelectionHook,V.resolvedSelection),[Q,V.effectiveSelectionHook,V.resolvedSelection]),U=e.useMemo(()=>Ln(),[]),Z=Jt({componentName:"RidgelinePlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(Z)return h.createElement(Xt,{componentName:"RidgelinePlot",message:Z,width:R,height:I});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:"ridgeline"},null!=i&&{data:G}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:K,bins:d,size:[R,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V.margin,barPadding:m,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:W,rLabel:q,rFormat:p}),B&&{oFormat:B}),{showGrid:$,showCategoryTicks:T,oSort:!1,amplitude:g}),V.legendBehaviorProps),D&&{title:D}),N&&{description:N}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===v?()=>null:Wt(v)||U}),(k||A||O||S)&&{customHoverBehavior:V.customHoverBehavior}),(A||O||k)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"RidgelinePlot",width:R,height:I},h.createElement(mt,Object.assign({ref:r},J)))});Nn.displayName="RidgelinePlot";const Fn=e.forwardRef(function(t,n){const o=Ht(t.mode,{width:t.width,height:t.height,showGrid:!1,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:!1}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:s,className:a,stepAccessor:l="step",valueAccessor:c="value",categoryAccessor:u,colorBy:d,colorScheme:g,orientation:p="horizontal",connectorOpacity:y=.3,showLabels:f=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:E,legendInteraction:_,legendPosition:C,color:P,categoryFormat:L}=t,T="vertical"===p,B=o.width,R=o.height,I=o.enableHover,H=o.title,$=o.description,D=o.summary,N=o.accessibleTable,F=i||[],z=d||u,W=!z,q=An({data:F,rawData:i,colorBy:z,colorScheme:g,legendInteraction:_,legendPosition:C,selection:x,linkedHover:w,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"FunnelChart",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:T?{top:H?60:40,right:20,bottom:60,left:60}:{top:H?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:E,width:B,height:R});if(q.earlyReturn)return q.earlyReturn;kn("FunnelChart",F,"stepAccessor",l),kn("FunnelChart",F,"valueAccessor",c);const G=Tt(),V=e.useMemo(()=>new Map,[F]),X=e.useMemo(()=>{if(W)return P||((null==G?void 0:G[0])?G[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[W,P,G,g]),Y=b.pieceStyle,Q=e.useMemo(()=>(e,t)=>{const n={};if(n.fill=X||(z?j(e,z,q.colorScale):Bt(P,G,g,t,V)),Y){const o=Y(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[X,z,q.colorScale,P,G,g,V,Y]),K=e.useMemo(()=>Lt(Q,q.effectiveSelectionHook,q.resolvedSelection),[Q,q.effectiveSelectionHook,q.resolvedSelection]),U=e.useMemo(()=>e=>{var t,n,o,r,i,s;const a=(null==e?void 0:e.data)||e,l=(null==a?void 0:a.__funnelStep)||(null==a?void 0:a.__barFunnelStep)||(null==a?void 0:a.step)||"",c=null!==(o=null!==(n=null!==(t=null==a?void 0:a.__funnelValue)&&void 0!==t?t:null==a?void 0:a.__barFunnelValue)&&void 0!==n?n:null==a?void 0:a.value)&&void 0!==o?o:"",u=null!==(r=null==a?void 0:a.__funnelPercent)&&void 0!==r?r:null==a?void 0:a.__barFunnelPercent,d=null!==(i=null==a?void 0:a.__funnelIsFirstStep)&&void 0!==i?i:null==a?void 0:a.__barFunnelIsFirstStep,g=null==a?void 0:a.__barFunnelIsDropoff,p=null!==(s=null==a?void 0:a.__barFunnelCategory)&&void 0!==s?s:null==a?void 0:a.category,y=null==u||d?"":` (${.05>Math.abs(u-Math.round(u))?Math.round(u)+"%":u.toFixed(1)+"%"})`;return h.createElement("div",{className:"semiotic-tooltip",style:Dt},l&&h.createElement("div",{style:{fontWeight:"bold"}},l+""),p&&p!==l&&h.createElement("div",{style:{marginTop:2,opacity:.8}},p+""),g&&h.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),h.createElement("div",{style:{marginTop:4}},c+"",y))},[]),Z=Jt({componentName:"FunnelChart",data:i,accessors:{stepAccessor:l,valueAccessor:c}});if(Z)return h.createElement(Xt,{componentName:"FunnelChart",message:Z,width:B,height:R});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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:T?"bar-funnel":"funnel"},null!=i&&{data:F}),{oAccessor:l,rAccessor:c}),u&&{stackBy:u}),{projection:T?"vertical":"horizontal",barPadding:T?40:0,pieceStyle:K,size:[B,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q.margin,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:T,showCategoryTicks:T}),L&&{oFormat:L}),{showGrid:T}),!T&&{connectorOpacity:y}),{showLabels:f}),q.legendBehaviorProps),H&&{title:H}),$&&{description:$}),D&&{summary:D}),void 0!==N&&{accessibleTable:N}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?U:Wt(m)||U}),(w||k||A||O)&&{customHoverBehavior:q.customHoverBehavior}),(k||A||w)&&{customClickBehavior:q.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return h.createElement(bn,{componentName:"FunnelChart",width:B,height:R},h.createElement(mt,Object.assign({ref:r},J)))});Fn.displayName="FunnelChart";const zn="__likert_neutral_neg",Wn="__likert_neutral_pos";function qn(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Gn(e,t,n,o,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.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(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){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],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function Vn(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:zn,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:Wn,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function Xn(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 s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===zn?i=n:n.__likertLevel===Wn?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Yn=e.forwardRef(function(t,n){const o=Ht(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}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="question",valueAccessor:c,levelAccessor:u,countAccessor:d="count",levels:g,orientation:p="horizontal",colorScheme:y,barPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:j,valueFormat:S,loading:M,emptyContent:E,legendInteraction:_,legendPosition:C,categoryFormat:P}=t,L=o.width,T=o.height,B=o.enableHover,R=o.showGrid,I=o.showLegend,H=o.title,$=o.description,D=o.summary,N=o.accessibleTable,F=o.categoryLabel,z=o.valueLabel,W="horizontal"===p,q=void 0===i,G=!u,V=e.useMemo(()=>y&&Array.isArray(y)&&y.length>=g.length?y: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),s=[];for(let e=0;i>e;e++)s.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&s.push(o);for(let e=0;i>e;e++)s.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return s}(g.length),[y,g.length]),X=e.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],V[t]||"#888");return e},[g,V]),{processedData:Y,reAggregate:Q,accumulatorRef:K}=function({data:t,levels:n,categoryAccessor:o,valueAccessor:r,levelAccessor:i,countAccessor:s,isDiverging:a,frameRef:l}){const c=!i,u=e.useMemo(()=>qn(o,"question"),[o]),d=e.useMemo(()=>c?qn(r,"score"):null,[c,r]),h=e.useMemo(()=>c?null:qn(i,"level"),[c,i]),g=e.useMemo(()=>c?null:qn(s,"count"),[c,s]),p=t||[],y=e.useRef([]),f=e.useMemo(()=>{if(0===p.length)return[];let e=Gn(p,n,u,d,h,g);return a&&(e=Vn(e,n),e=Xn(e,n)),e},[p,n,u,d,h,g,a]),m=e.useCallback(e=>{var t;let o=Gn(e,n,u,d,h,g);a&&(o=Vn(o,n),o=Xn(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,g,a,l]);return{processedData:f,reAggregate:m,accumulatorRef:y}}({data:i,levels:g,categoryAccessor:l,valueAccessor:c,levelAccessor:u,countAccessor:d,isDiverging:W,frameRef:r}),U="__likertLevelLabel",Z=jn({isPushMode:q,colorBy:U,colorScheme:V,showLegend:I,legendPosition:C}),J=e.useCallback(Z.wrapPush(e=>{K.current.push(e),Q(K.current)}),[Z.wrapPush,Q,K]),ee=e.useCallback(Z.wrapPushMany(e=>{K.current.push(...e),Q(K.current)}),[Z.wrapPushMany,Q,K]);e.useImperativeHandle(n,()=>({push:J,pushMany:ee,remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;K.current=[],Z.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[J,ee,Z.resetCategories,K]);const te=An({data:Y,rawData:i,colorBy:U,colorScheme:V,legendInteraction:_,legendPosition:C,selection:x,linkedHover:w,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"LikertChart",chartId:j,showLegend:I,userMargin:s,marginDefaults:o.marginDefaults,loading:M,emptyContent:E,width:L,height:T});if(te.earlyReturn)return te.earlyReturn;const ne=e.useMemo(()=>{const e=g.length;return e%2!=0&&X.get(g[Math.floor(e/2)])||"#888"},[g,X]),oe=b.pieceStyle,re=e.useMemo(()=>(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 s;if(i===zn||i===Wn)s={fill:ne};else{const e=r||i;s=e&&X.has(e)?{fill:X.get(e)}:{fill:"#888"}}if(oe){const n=oe(e,t);n.stroke&&(s.stroke=n.stroke),null!=n.strokeWidth&&(s.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(s.strokeOpacity=n.strokeOpacity)}return s},[X,ne,oe]),ie=e.useMemo(()=>Lt(re,te.effectiveSelectionHook,te.resolvedSelection),[re,te.effectiveSelectionHook,te.resolvedSelection]),se=e.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),ae=e.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===zn||n===Wn?se:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=n===zn||n===Wn?2*i:i,a=t.__likertCount||0;return h.createElement("div",{className:"semiotic-tooltip",style:Dt},h.createElement("div",{style:{fontWeight:"bold"}},r),h.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[se]),le=e.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(c&&u)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(u&&!d)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==i&&0===i.length)return null;const e={categoryAccessor:l};return G?c&&(e.valueAccessor=c):(u&&(e.levelAccessor=u),d&&(e.countAccessor=d)),Jt({componentName:"LikertChart",data:i,accessors:e,requiredProps:{levels:g}})},[i,l,c,u,d,g,G]),ce=e.useMemo(()=>[{styleFn:e=>({fill:X.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,X]),ue=e.useMemo(()=>!1!==I?Object.assign(Object.assign({},te.legendBehaviorProps),{legend:{legendGroups:ce},legendPosition:C||te.legendPosition||"bottom"}):te.legendBehaviorProps,[te.legendBehaviorProps,te.legendPosition,C,I,ce]),de=e.useMemo(()=>{const e=Object.assign({},te.margin);if(q&&!1!==I){const t=C||"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(Z.streamingMarginAdjust)for(const[t,n]of Object.entries(Z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return W&&100>e.left&&(e.left=100),e},[te.margin,Z.streamingMarginAdjust,W,q,I,C]),he=e.useMemo(()=>S||(W?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[W,S]),ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=i&&{data:Y}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:W?"horizontal":"vertical",pieceStyle:ie,size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de,barPadding:f,enableHover:B}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:F,rLabel:z||(W?void 0:"Percentage"),rFormat:he}),P&&{oFormat:P}),{showGrid:R}),ue),H&&{title:H}),$&&{description:$}),D&&{summary:D}),void 0!==N&&{accessibleTable:N}),a&&{className:a}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===m?()=>null:!0===m?ae:Wt(m)||ae}),(w||k||A||O)&&{customHoverBehavior:te.customHoverBehavior}),(k||A||w)&&{customClickBehavior:te.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return le?h.createElement(Xt,{componentName:"LikertChart",message:le,width:L,height:T}):h.createElement(bn,{componentName:"LikertChart",width:L,height:T},h.createElement(mt,Object.assign({ref:r},ge)))});Yn.displayName="LikertChart",exports.BarChart=On,exports.BoxPlot=Tn,exports.DonutChart=$n,exports.DotPlot=In,exports.FunnelChart=Fn,exports.GaugeChart=Dn,exports.GroupedBarChart=En,exports.Histogram=Bn,exports.LikertChart=Yn,exports.PieChart=Hn,exports.RidgelinePlot=Nn,exports.StackedBarChart=Mn,exports.StreamOrdinalFrame=mt,exports.SwarmPlot=Pn,exports.SwimlaneChart=Cn,exports.ViolinPlot=Rn,exports.createHatchPattern=st;
1
+ "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-scale"),o=require("d3-quadtree"),r=require("d3-scale-chromatic"),s=require("d3-array"),i=require("d3-hierarchy"),a=require("d3-shape"),l=require("regression"),c=require("d3-selection"),u=require("d3-brush");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const g=h(t),p=d(l);class f{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 y{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;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 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 s=(o+r)%this._capacity,i=this.buffer[s];if(e(i)){let e;e="object"!=typeof i||null===i?i:Array.isArray(i)?[...i]:Object.assign({},i),n.push(e),this.buffer[s]=t(i)}}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 m{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 v(e,t,n){return e+(t-e)*n}function b(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function x(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function j(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const w={category10:r.schemeCategory10,tableau10:r.schemeTableau10,set3:r.schemeSet3,blues:r.interpolateBlues,reds:r.interpolateReds,greens:r.interpolateGreens,oranges:r.interpolateOranges,purples:r.interpolatePurples,viridis:r.interpolateViridis,plasma:r.interpolatePlasma},k=r.schemeCategory10,A=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],O=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 S(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")||O.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):k[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+""))%k.length]}function M(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),s=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const i=w[o]||w.category10;if(s&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:k;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function _(e,t,n,o,r,s,i){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:s,group:i}}function C(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,s=[],i=Math.min(t.width,t.height)/2-4,a="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);s.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:i,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return s}function P(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=s.quantile(e,.25))&&void 0!==t?t:i,median:null!==(n=s.quantile(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=s.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}const L={bar:function(e,t){var n,o,r;const{scales:s,columns:i,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=s,g=[],p="vertical"===h,f="horizontal"===h,y=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(i))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(i)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const s of m){const i=t.get(s);if(!i)continue;let a=i.total;y&&n>0&&(a/=n);const l=u(i.pieces[0],c?s:e.name),h=Object.assign(Object.assign({},i.pieces[0]),{__aggregateValue:i.total,__pieceCount:i.pieces.length,category:e.name});if(p){const t=d(0>a?r:o+a),n=0>a?d(r+a)-d(r):d(o)-d(o+a);g.push(_(e.x,t,e.width,Math.abs(n),l,h,s)),0>a?r+=a:o+=a}else if(f){const t=d(0>a?r+a:o),n=0>a?d(r)-d(r+a):d(o+a)-d(o);g.push(_(t,e.x,Math.abs(n),e.width,l,h,s)),0>a?r+=a:o+=a}}}const v="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!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?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 n=(null===(r=t.datum)||void 0===r?void 0:r.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.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}),n=t.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)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(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:n,columns:o,config:r,getR:s,getGroup:i,resolvePieceStyle:a}=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=i?i(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let i=0;h.length>i;i++){const c=r.get(h[i])||[];for(const r of c){const c=s(r),g=a(r,h[i]);if(d){const s=e.x+i*t+n/2,a=l(0),d=l(c);u.push(_(s,Math.min(a,d),o,Math.abs(a-d),g,r,h[i]))}else{const s=e.x+i*t+n/2,a=l(0),d=l(c);u.push(_(Math.min(a,d),s,Math.abs(d-a),o,g,r,h[i]))}}}}const f=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=s(e.datum);f>0&&(e.roundedTop=f),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){var n,o;const{scales:r,columns:s,getR:i,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,f=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(s))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,s=null!==(o=t.__rValue)&&void 0!==o?o:i(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*f,n=u(s);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(s)):(b=u(s),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:s}=e,{r:i,projection:a}=n,l=[],c="vertical"===a;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],a=r(o),u=s(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:i(a),p=c?i(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:C,donut:C,boxplot:function(e,t){var n,o,r,i,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:p,projection:f}=c,y=[],m="vertical"===f,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],f=null!==(n=s.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=s.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(r=s.quantile(c,.75))&&void 0!==r?r:d,j=x-f,w=f-1.5*j,k=x+1.5*j,A=null!==(i=c.find(e=>e>=w))&&void 0!==i?i:u,O=null!==(a=[...c].reverse().find(e=>k>=e))&&void 0!==a?a:d,S=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(w>n||n>k){const o=m?t.middle:p(n),r=m?p(n):t.middle;M.push({px:o,py:r,value:n,datum:e})}}if(y.push({type:"boxplot",x:m?t.middle:0,y:m?0:t.middle,projection:m?"vertical":"horizontal",columnWidth:.6*t.width,minPos:p(A),q1Pos:p(f),medianPos:p(b),q3Pos:p(x),maxPos:p(O),stats:{n:c.length,min:A,q1:f,median:b,q3:x,max:O,mean:c.reduce((e,t)=>e+t,0)/c.length},style:S,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:S.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=i,g=[],p="vertical"===h,f=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(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],l=(a-i)/f||1,h=Array(f).fill(0);for(const e of t)h[Math.min(Math.floor((e-i)/l),f-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(p){b=`M ${e.middle} ${d(i)}`;for(let t=0;f>t;t++){const n=d(i+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=f-1;t>=0;t--){const n=d(i+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${n}`}b+=" Z"}else{b=`M ${d(i)} ${e.middle}`;for(let t=0;f>t;t++)b+=` L ${d(i+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)b+=` L ${d(i+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let j;if(y&&t.length>=4){const l=null!==(n=s.quantile(t,.25))&&void 0!==n?n:i,c=null!==(o=s.quantile(t,.5))&&void 0!==o?o:(i+a)/2,u=null!==(r=s.quantile(t,.75))&&void 0!==r?r:a;j={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:p}}const w=p?{x:e.x,y:Math.min(d(a),d(i)),width:e.width,height:Math.abs(d(a)-d(i))}:{x:Math.min(d(i),d(a)),y:e.x,width:Math.abs(d(a)-d(i)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:j,stats:P(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var n;const{scales:o,columns:r,config:s,getR:i,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=s.bins||25,d=s.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,s=Array(u).fill(0);for(const e of t)n>e||e>o||s[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,f=Math.max(...s,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===s[t])continue;const o=(d?s[t]/h:s[t]/f)*e.width*.9,i=l(n+t*r),a=l(n+(t+1)*r);c.push(_(Math.min(i,a),e.x+e.width-o,Math.abs(a-i),o,y,{bin:t,count:s[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:s,getR:i,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=s.bins||20,h="horizontal"===c,g=s.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(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],s=(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)/s),d-1)]++;const p=Math.max(...c,1),f=a(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)*s)} ${t-c[e]/p*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)*s);m+=` L ${t+c[e]/p*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:P(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.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:s}=e,{r:i,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=s(t,e.name);if(c){const n=i(Math.min(o,a)),r=i(Math.max(o,a));l.push(_(n,e.x,r-n,e.width,u,t,e.name))}else{const n=i(Math.max(o,a)),r=i(Math.min(o,a));l.push(_(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var o,r,s,i,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:p}=e,f=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return f;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const j=b.length>1&&"_default"!==b[0],w=[];let k=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=g?g(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),s=h(o);r.total+=s,r.pieces.push(o),n+=s}w.push({col:e,groups:t,stepTotal:n}),j||n>k&&(k=n)}if(j)for(const e of w){let t=0,n=0;for(let o=0;b.length>o;o++){const r=e.groups.get(b[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>k&&(k=o)}if(0===k)return f;const A=new Map;for(const e of b){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,S=j?.95*y:.9*t.width,M=n.scaleLinear().domain([0,k]).range([0,S]),C=null!==(r=e.config.connectorOpacity)&&void 0!==r?r:.3;let P=new Map;for(let t=0;w.length>t;t++){const n=w[t],o=n.col,r=0===t,d=o.width,h=.55*d,g=o.x+(d-h)/2,v=new Map;if(j){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=y,s=y;for(let i=0;b.length>i;i++){const l=b[i],c=n.groups.get(l);if(!c)continue;const u=M(c.total),d=i%2==0,x=d?t:s-u;d?t+=u:s-=u;const j=p(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,k=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});m&&(0===i&&(O.__funnelStepLabel=o.name,O.__funnelStepLabelX=y,O.__funnelStepLabelY=g,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+u/2,O.__funnelValueLabelY=g,O.__funnelBarW=u),f.push(_(x,g,u,h,j,O,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=y-t/2,l=b[0],c="_default"!==l,u=null!==(i=null===(s=n.groups.get(l))||void 0===s?void 0:s.pieces[0])&&void 0!==i?i:o.pieceData[0],d=c?l:o.name,x=p(u,d),j=O>0?e/O*100:0,w=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:j,__funnelStep:o.name,__funnelIsFirstStep:r,category:c?l:o.name});m&&(w.__funnelStepLabel=o.name,w.__funnelStepLabelX=y,w.__funnelStepLabelY=g,w.__funnelRowWidth=t,w.__funnelValueLabelX=y,w.__funnelValueLabelY=g,w.__funnelBarW=t),f.push(_(a,g,t,h,x,w,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&P.size>0){const t=j?b:[b[0]];for(const r of t){const t=P.get(r),s=v.get(r);if(!t||!s)continue;const i=(()=>{const e=n.groups.get(r);return p(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[s.x+s.w,s.y],[s.x,s.y]],style:{fill:i.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=n.groups.get(r))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===r?o.name:r};f.push(a)}}P=v}return f},"bar-funnel":function(e,t){var n,o,r,s;const{columns:i,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>i[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const f=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),s=a(o);r.total+=s,r.pieces.push(o),n+=s}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=f?g.length:1,x=f?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,i=e>0?y[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const y=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,j=null==i?void 0:i.groups.get(h),w=null!==(s=null==j?void 0:j.total)&&void 0!==s?s:y,k=o?0:Math.max(0,w-y),A=n.x+e*a+l/2,O=v(y),S=v(0)-O,M=c(p.pieces[0],f?h:n.name),C=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:f?h:n.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(y+k)});if(d.push(_(A,O,u,S,M,C,f?h:n.name)),k>0){const e=v(y+k),t=O-e,o=Object.assign({},M),r=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:f?h:n.name});d.push(_(A,e,u,t,o,r,f?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:s,resolvePieceStyle:i}=e,{r:a,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=s?s(n):e.name,d=i(n,l);if(u){const r=a(t),s=a(t+o);c.push(_(r,e.x,s-r,e.width,d,n,l))}else{const r=a(t+o),s=a(t);c.push(_(e.x,r,e.width,s-r,d,n,l))}t+=o}}return c}};class B{constructor(e){this.rExtent=new m,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 y(e.windowSize),this.getO=j(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new m)):(this.getR=x(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=j(e.stackBy),this.getGroup=j(e.groupBy),this.getColor=j(e.colorAccessor),this.getConnector=j(e.connectorAccessor),this.getDataId=j(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new y(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: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 r=o.toArray(),s=t.projection||"vertical",i=t.oExtent||this.resolveCategories(r),a=this.computeValueDomain(r,i),l="horizontal"===s,c="radial"===s,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1));let d,h;if(c){d=n.scaleBand().domain(i).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=t.innerRadius||0;h=n.scaleLinear().domain(a).range([r,o])}else l?(d=n.scaleBand().domain(i).range([0,e.height]).padding(u),h=n.scaleLinear().domain(a).range([0,e.width])):(d=n.scaleBand().domain(i).range([0,e.width]).padding(u),h=n.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:s},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((r,s)=>{var i;const a=this.rExtents[s];a.dirty&&a.recalculate(o,r);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(i=t.extentPadding)&&void 0!==i?i:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?n.scaleLinear().domain([c,u]).range([0,e.width]):n.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=r;this.rAccessors.length>1&&(g=r.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(g,i,d,s,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),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 s=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 s}if(!1===o)return s;if("function"==typeof o)return s.sort(o);const i=new Map;for(const t of e){const e=this.getO(t);i.set(e,(i.get(e)||0)+Math.abs(this.getR(t)))}return s.sort("asc"===o?(e,t)=>(i.get(e)||0)-(i.get(t)||0):(e,t)=>(i.get(t)||0)-(i.get(e)||0))}computeValueDomain(e,t){var n,o,r,s,i;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.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,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"===a){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"===a){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"===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===(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"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var s;const i={},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"===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=a.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 s=("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*s)}let d=0,h=0;for(const e of t){const t=a.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!==(s=n(e))&&void 0!==s?s:0,g=n.bandwidth()),i[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 i}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=L[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:r,config:s,getConnector:i,getO:a}=e;if(!i||!r)return[];const l=[],{projection:c}=r,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=i(t);if(!n)continue;let o,r;"point"===e.type?(o=e.x,r=e.y):(o=e.x+e.w/2,r=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:r,datum:t,category:a(t)})}const d=r.o.domain(),h=s.connectorStyle;for(const[t,r]of u)if(r.length>=2){r.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let s=0;r.length-1>s;s++){const i=r[s],a=r[s+1],c="function"==typeof h?h(i.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:i.x,y1:i.y,x2:a.x,y2:a.y,style:c,datum:i.datum,group:t})}}return l}(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||A,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?function(e,t,n){var o,r,s;if(1>=n)return 1;const i=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return i+(1-a/(n-1))*(1-i);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return i+Math.pow(.5,a/t)*(1-i)}case"step":return(null!==(s=e.stepThreshold)&&void 0!==s?s:.5*n)>a?1:i;default:return 1}}(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 s=0;e.length>s;s++){const i=e[s],a=n?t(i):i[o];let l=r.get(a);l||(l=[],r.set(a,l)),l.push(s)}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,B.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let r=0;for(const e of this.scene)"point"===e.type&&(n[r++]=e);this._pointQuadtree=o.quadtree().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 s=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const i=this.computeDecayOpacity(e,r),a=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:a*i})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const s="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=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=s-t;if(i>n){const e=1-n/i;e>r&&(r=e)}}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=s-o;i>r&&(n._pulseIntensity=1-r/i,n._pulseColor=a,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 s=new Map,i=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="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,s);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:i,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:i,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,s,i,a,l,c,u,d,h,g,p,f,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const j=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 k=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(k.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?(k.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!==(s=d.h)&&void 0!==s?s:c.h,w=!0)):(c._targetOpacity=null!==(i=c.style.opacity)&&void 0!==i?i:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)k.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(!k.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!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(f=t.endAngle)&&void 0!==f?f:0))/2,o={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};this.exitNodes.push(o)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:j})}advanceTransition(e){var t,n,o,r;if(!this.activeTransition)return!1;const s=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(s,"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=v(r,e._targetOpacity,i)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=v(o.x,e._targetX,i),e.y=v(o.y,e._targetY,i)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=v(o.r,e._targetR,i))}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=v(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=v(n.x,e._targetX,i),e.y=v(n.y,e._targetY,i),void 0!==n.w&&(e.w=v(n.w,e._targetW,i),e.h=v(n.h,e._targetH,i))}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:v(o,e._targetOpacity,i)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=v(n.startAngle,e._targetStartAngle,i),e.endAngle=v(n.endAngle,e._targetEndAngle,i))}}}if(s>=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 s=this.buffer.update(e=>n.has(o(e)),t);if(0===s.length)return s;for(const e of s)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++,s}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&&!b(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!b(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!b(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(b(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=j(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],s=Array.isArray(o)?o:[o];if(r.length!==s.length||r.some((e,t)=>!b(e,s[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new m)):(this.getR=x(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!b(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?j(this.config.stackBy):void 0),"groupBy"in e&&!b(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?j(this.config.groupBy):void 0),"colorAccessor"in e&&!b(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?j(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!b(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?j(this.config.connectorAccessor):void 0)}}function T(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function R(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function I(e,t,n){const o=function(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}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function H(e,t,n,o=30){const r=t-e.x,s=n-e.y,i=Math.sqrt(r*r+s*s);return i>T(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function $(e,t,n){const o=t-e.cx,r=n-e.cy,s=Math.sqrt(o*o+r*r);if(e.innerRadius>s||s>e.outerRadius)return null;const i=R(Math.atan2(r,o)),a=R(e.startAngle),l=R(e.endAngle);if(!(a>l?i>=a||l>=i:i>=a&&l>=i))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 D(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,s=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>s))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function N(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:s,height:i}=e.bounds;return o>t||t>o+s||r>n||n>r+i?null:{datum:e.datum,x:o+s/2,y:r+i/2,distance:0,category:e.category,stats:e.stats}}function F(e,t,n){const o=e.byGroup.get(t);let r=0,s=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);s>t&&(s=t,r=e)}return o[r]._flatIndex}function W(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})}B.QUADTREE_THRESHOLD=500;const z={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function E(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,z[n])(o(e,t)),r}function q(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function G(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const V=(t,n,o,r,s,i,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let f=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=s;return g.forEach((t,u)=>{const v=E(t,u,d,h),b=G(t,r,s),x=s&&s.size>0&&s.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${f})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===i&&u===a?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"},children:[y&&e.jsx("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.jsx(q,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),f+=22}),p};function Y({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:s,label:i,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+g.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(s[0]+n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":i||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),i&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(s[1]-n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":i||"Gradient legend",children:[i&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[0])})]})}function X(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,p]=g.useState(0),[f,y]=g.useState(0),m=g.useCallback((e,t)=>{p(e),y(t)},[]),v="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e.jsx("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.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:V(t,o,r,s,i,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const f=((t,n,o,r,s,i,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,f=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=s;p.forEach((t,u)=>{const x=E(t,u,h,g),j=G(t,r,s),w=s&&s.size>0&&s.has(t.label),k=26+7*t.label.length;d&&d>0&&y>0&&y+k>d&&(m++,y=0),f.push(e.jsxs("g",{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===i&&u===a?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)+p.length)%p.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:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("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.jsx(q,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k});let x=0,j=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&j>0&&j+t>d?(x=Math.max(x,j),j=t):j+=t}x=Math.max(x,j);const w=m+1;return{items:f,offset:x,totalRows:w,totalHeight:22*w}})(t,r,s,i,a,l,c,n,u,d,o);p+=f.offset+5,g.push(Object.assign(Object.assign({label:t.label},f),{offset:p,totalRows:f.totalRows,totalHeight:f.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const f=[];return g.forEach((o,r)=>{const s=t[r];s.label&&(f.push(e.jsx("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:s.label},"legend-text-"+r)),p+=16),f.push(e.jsx("g",{className:"legend-item",transform:`translate(${p},0)`,children:o.items},"legend-group-"+r)),p+=o.offset+5,t[r+1]&&f.push(e.jsx("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),e.jsx("g",{children:f})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}),b=!(!o&&!r);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),v]})}function Q(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function U(t){const{legend:n,totalWidth:o,totalHeight:r,margin:s,legendPosition:i="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===i||"bottom"===i;let p,f;return"left"===i?(p=4,f=s.top):"top"===i?(p=0,f=a?32:8):"bottom"===i?(p=0,f=r-s.bottom+50):(p=o-s.right+10,f=s.top),e.jsx("g",{transform:`translate(${p}, ${f})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(Y,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Q(n)?e.jsx(X,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function K(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),s=[];let i="";for(const e of r)i&&i.length+1+e.length>o?(s.push(i),i=e):i=i?`${i} ${e}`:e;return i&&s.push(i),s}function Z(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 J(t,n,o,r){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:s,title:i,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!s&&!i)return e.jsx("g",{className:"annotation-note"});let d=a;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 p=16,f=i?u?[i]:K(i,c):[],y=s?u?[s]:K(s,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:f.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=f.length*p),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=null;if((i||s)&&(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),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(f.length+y.length)*p+(y.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+y.length-1)*p;let k=0;return"topBottom"===d?k=0>o?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+p+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),j]})}function ee(t,n,o,r,s){var i;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));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)&&a.push(e.jsx("rect",{width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,i=s||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.jsx("line",{x1:r,y1:(n.y1||0)-i,x2:r,y2:(n.y2||0)-i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-i;a.push(e.jsx("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"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.jsx("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"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-i,x2:0,y2:(n.y2||0)-i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(i=null==n?void 0:n.width)&&void 0!==i?i:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:Z((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)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function te(t,n,o,r,s,i){const a=[];let l=0,c=0;if("callout-circle"!==s&&"label"!==s||!(null==i?void 0:i.radius)){if("callout-rect"===s&&i){const e=i.width||0,o=i.height||0;if(e>0||o>0){const r=e/2,s=o/2,i=t-r,a=n-s;if(0!==i||0!==a){const t=Math.abs(i),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+i*h,c=s+a*h}}}else if("bracket"===s&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(i.radius||0)+(i.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&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,s=16/180*Math.PI,i=Math.atan2(n-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+o*Math.cos(i+s)},${c+o*Math.sin(i+s)}L${l+o*Math.cos(i-s)},${c+o*Math.sin(i-s)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:a})}function ne(t){const{x:n=0,y:o=0,dx:r,dy:s,nx:i,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:f={},"data-testid":y}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=s||0;null!=i&&(v=i-n),null!=a&&(b=a-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.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f,{children:[!m.has("connector")&&te(v,b,c,h,x,u),!m.has("subject")&&ee(x,u,h,n,o),!m.has("note")&&J(l,v,b,h)]}))}function oe(t){var n,o;const{noteData:r}=t,{screenCoordinates:s}=r,i="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&s){const t=r.nx||s[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||s[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=s.map((n,o)=>{const s=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(ne,Object.assign({"data-testid":"semiotic-annotation"},s,{type:i}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=r.note||{title:"none",label:r.label},c=`${l.label}-${l.title}-${r.i}`;return e.jsx(ne,Object.assign({"data-testid":"semiotic-annotation",events:a},r,{type:i}),c)}function re(e,t){var n,o,r;const s=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 s?null!=e.x?s(e.x):t.xAccessor&&null!=e[t.xAccessor]?s(e[t.xAccessor]):null:null}function se(e,t){var n,o,r;const s=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 s?null!=e.y?s(e.y):t.yAccessor&&null!=e[t.yAccessor]?s(e[t.yAccessor]):null:null}function ie(e,t,n){var o,r,s,i;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const s=n.pointNodes[r];if(s.pointId===e.pointId){const e={x:s.x,y:s.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const s=function(e){var t,n,o,r,s,i;const a=e.data;if(!a||0===a.length)return null;const l=a[a.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!==(s=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==s?s:null===(i=e.scales)||void 0===i?void 0:i.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 s&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,s)),s}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=re(e,n),c=se(e,n)),null!=l&&null!=c)return null===(s=n.stickyPositionCache)||void 0===s||s.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function ae(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const le={linear:a.curveLinear,monotoneX:a.curveMonotoneX,monotoneY:a.curveMonotoneY,step:a.curveStep,stepAfter:a.curveStepAfter,stepBefore:a.curveStepBefore,basis:a.curveBasis,cardinal:a.curveCardinal,catmullRom:a.curveCatmullRom};function ce(n){const{width:o,height:r,totalWidth:s,totalHeight:i,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h}=n,g="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),f=t.useMemo(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||ue)(e)})),[l,d,g,h]),y=u&&l&&!g,m=c&&l&&!g;return y||m?e.jsx("svg",{width:s,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[y&&e.jsx("g",{className:"ordinal-grid",children:f.map((t,n)=>e.jsx("line",{x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:o,y2:p?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),m&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,p?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function ue(e){return Math.round(100*e)/100+""}function de(n){var o,r;const{width:s,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,showCategoryTicks:f,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:j,legend:w,legendHoverBehavior:k,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:_,annotations:C,svgAnnotationRules:P,xAccessor:L,yAccessor:B,annotationData:T,underlayRendered:R,children:I}=n,H="radial"===(null==h?void 0:h.projection),$="horizontal"===(null==h?void 0:h.projection),D=!1!==f,N=t.useMemo(()=>g&&D&&h&&!H?h.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=h.o(e))&&void 0!==n?n:0)+h.o.bandwidth()/2,label:v?v(e,t):e}}):[],[g,D,h,v,H]),F=n.rTickValues,W=n.tickLabelEdgeAlign,z=t.useMemo(()=>g&&h&&!H?(F||h.r.ticks(5)).map(e=>({value:e,pixel:h.r(e),label:(b||ue)(e)})):[],[g,h,b,H,F]),E=t.useRef(new Map),q=t.useRef(null!==(o=null==C?void 0:C.length)&&void 0!==o?o:0),G=null!==(r=null==C?void 0:C.length)&&void 0!==r?r:0;q.current!==G&&(q.current=G,E.current=new Map);const V=t.useMemo(()=>{if(!C||0===C.length)return null;const t=function(t,n,o){var r,s,l,c,u,d,h,g,f,y,m,v,b,x,j,w,k,A,O,S,M,_,C,P,L,B,T,R,I,H,$,D,N,F,W,z,E,q,G,V,Y,X,Q,U,K,Z,J,ee;switch(t.type){case"label":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return ae(s,i,o)?e.jsx(oe,{noteData:{x:s,y:i,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}},"ann-"+n):null}case"callout":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return ae(s,i,o)?e.jsx(oe,{noteData:{x:s,y:i,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}},"ann-"+n):null}case"x-threshold":{const r=re(t,o);if(null==r)return null;const s=t.color||"#f97316",i=t.labelPosition||"top";let a;return a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:r+4,y:a,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const r=se(t,o);if(null==r)return null;const s=t.color||"#f97316",i=t.labelPosition||"right";let a,l;return"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:r-4,textAnchor:l,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:re(Object.assign(Object.assign({},e),{type:"point"}),o),y:se(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 s=i.packEnclose(r),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.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.jsx("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:re(Object.assign(Object.assign({},e),{type:"point"}),o),y:se(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=t.padding||10,i=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...i)-s,c=Math.max(...i)+s,u=Math.min(...a)-s,d=Math.max(...a)+s;return e.jsxs("g",{children:[e.jsx("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.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const r=o.data||[],s="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],i={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:s.map((n,r)=>{const s=re(n,o),a=se(n,o);if(null==s||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||i;return e.jsx("circle",Object.assign({cx:s,cy:a,r:l},c),"hl-"+r)})},"ann-"+n)}case"bracket":{const r=re(t,o),s=se(t,o);return e.jsx(oe,{noteData:{x:null!=r?r:0,y:null!=s?s: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}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const a=o.xAccessor||"x",g=o.yAccessor||"y",f=i.map(e=>[e[a],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(s=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(l=o.scales)||void 0===l?void 0:l.time,m=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!y||!m)return null;const v=t.method||"linear";let b;b="loess"===v?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]),s=o.map(e=>e[1]),i=Math.max(2,Math.ceil(t*n)),a=[];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(i-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,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*s[e],g+=t*r[e]*r[e],p+=t*r[e]*s[e])}if(0===u){a.push([t,s[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*p-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?p.default.polynomial(f,{order:t.order||2}):p.default.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),j=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:j,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:j,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const r=null!==(f=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(y=o.scales)||void 0===y?void 0:y.value,s=null!==(m=null==r?void 0:r(t.y0))&&void 0!==m?m:0,i=null!==(v=null==r?void 0:r(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(s,i),width:o.width||0,height:Math.abs(i-s),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(s,i)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const s=o.xAccessor||"x",i=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(j=o.scales)||void 0===j?void 0:j.time,l=null!==(k=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==k?k:null===(A=o.scales)||void 0===A?void 0:A.value;if(!i||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.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=le[o.curve||"linear"]||a.curveLinear,p=a.area().x(e=>i(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const f=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:f,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:i(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const s=o.yAccessor||"y",i=null!==(M=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(_=o.scales)||void 0===_?void 0:_.time,a=null!==(P=null===(C=o.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.value;if(!i||!a)return null;const l=r.map(e=>e[s]).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!==(B=t.threshold)&&void 0!==B?B:2,g=c-h*d,p=!1!==t.showBand,f=t.fill||"#6366f1",y=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,m=t.anomalyColor||"#ef4444",v=null!==(R=t.anomalyRadius)&&void 0!==R?R:6,b=a(c+h*d),x=a(g),j=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),j.map((t,n)=>{const r=re(t,o),s=se(t,o);return null==r||null==s?null:e.jsx("circle",{cx:r,cy:s,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const s=o.xAccessor||"x",i=o.yAccessor||"y",a=null!==(H=null===(I=o.scales)||void 0===I?void 0:I.x)&&void 0!==H?H:null===($=o.scales)||void 0===$?void 0:$.time,l=null!==(N=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==N?N:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!l)return null;const c=r.map(e=>[e[s],e[i]]).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=p.default.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,s]of c)t+=e,n+=s,o+=e*e,r+=e*s;const s=e*o-t*t;if(1e-12>Math.abs(s))return null;const i=(e*r-t*n)/s,a=(n-i*t)/e;u=e=>a+i*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,y=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(W=t.confidence)&&void 0!==W?W:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=t.steps)&&void 0!==z?z:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*j);const k=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-f,2)/y:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&k.length>0&&e.jsx("text",{x:a(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let r=null,s=null;if(null!=t.px&&null!=t.py)r=t.px,s=t.py;else{const e=ie(t,n,o);if(!e)return null;r=e.x,s=e.y}if(null==r||null==s)return null;if(!ae(r,s,o))return null;const i=null!==(V=t.dx)&&void 0!==V?V:0,a=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(X=t.width)&&void 0!==X?X:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(U=t.content)&&void 0!==U?U:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:r+i-l/2,y:s+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return e.jsx("text",{x:s+(t.dx||0),y:i+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const r=t.category;if(null==r)return null;const s=null===(K=o.scales)||void 0===K?void 0:K.o,i=null===(Z=o.scales)||void 0===Z?void 0:Z.x,a=null===(J=o.scales)||void 0===J?void 0:J.y,l=(null==s?void 0:s.bandwidth)?s:(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a: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!==(ee=t.opacity)&&void 0!==ee?ee:.15,g=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:l===i)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+n)}default:return null}},n="horizontal"===(null==h?void 0:h.projection),o=(null==h?void 0:h.o)?e=>{var t;return(null!==(t=h.o(e))&&void 0!==t?t:0)+h.o.bandwidth()/2}:null,r={scales:h?{x:n?h.r:o||h.r,y:n&&o||h.r,time:h.r,value:h.r,o:h.o}:null,timeAxis:"x",xAccessor:L,yAccessor:B,width:s,height:l,data:T,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:E.current};return C.map((e,n)=>{if(P){const o=P(e,n,r);return null!=o?o:t(e,n,r)}return t(e,n,r)}).filter(Boolean)},[C,P,s,l,h,L,B,T]);return g||j||w||_||V&&V.length>0||x||I?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof j?j:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof j?j+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[x&&h&&!H&&!R&&e.jsx("g",{className:"ordinal-grid",children:z.map((t,n)=>e.jsx("line",{x1:$?t.pixel:0,y1:$?0:t.pixel,x2:$?t.pixel:s,y2:$?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),g&&h&&!H&&e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,$?{children:[!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((t,n)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+n)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:y}),!R&&e.jsx("line",{x1:0,y1:l,x2:s,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!R&&(null==h?void 0:h.r)&&(()=>{const t=h.r(0);return t>1&&s-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),z.map((t,n)=>{const o=W?0===n?"start":n===z.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+n)}),m&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m})]}:{children:[!R&&(()=>{const t=(null==h?void 0:h.r)?h.r(0):l,n=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:n,x2:s,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),N.map((t,n)=>e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+n)),y&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,n)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+n)),m&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:m})]})}),V,_,I]}),j&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof j?j:null}),U({legend:w,totalWidth:c,totalHeight:u,margin:d,legendPosition:M,title:j,legendHoverBehavior:k,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S})]}):null}function he({width:n,height:o,totalWidth:r,totalHeight:s,margin:i,scales:a,onBrush:l}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(l);g.current=l;const p=t.useRef(a);p.current=a;const f=t.useRef(!1),y=t.useRef(null),m="horizontal"===(null==a?void 0:a.projection),v=t.useRef(m);return v.current=m,t.useEffect(()=>{if(!d.current)return;const e=c.select(d.current).select(".brush-g"),t=m?u.brushX():u.brushY();return t.extent([[0,0],[n,o]]),t.on("brush end",e=>{if(f.current)return;const t=p.current;if(!t)return;if(!e.selection)return y.current=null,void g.current(null);const[n,o]=e.selection;let r;r=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const s={r:r};y.current=s,g.current(s)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[n,o,m]),t.useEffect(()=>{if(!a||!h.current||!y.current)return;if(!d.current)return;const e=y.current,t=c.select(d.current).select(".brush-g"),n=a.r(e.r[0]),o=a.r(e.r[1]);m?(f.current=!0,t.call(h.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(h.current.move,[o,n]),f.current=!1)},[a,m]),e.jsx("svg",{ref:d,width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${i.left},${i.top})`,style:{pointerEvents:"all"}})})}function ge(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const pe="undefined"==typeof window||"undefined"==typeof document,fe=g.createContext(null),ye={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function me(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"},s=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],i=Object.keys(n).sort((e,t)=>{const n=s.indexOf(e),o=s.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of i)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const ve=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},be={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"},xe={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},je={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)"},we={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ke={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)"},Ae={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Oe={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Se({scene:t,chartType:n,tableId:o,chartTitle:r}){var s;const[i,a]=g.useState(!1),l=g.useContext(fe),c=null!==(s=null==l?void 0:l.visible)&&void 0!==s&&s,u=i||c,d=g.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,p=g.useCallback(()=>{i||c||a(!0)},[i,c]),f=g.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:ye}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:p,style:ye,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,r,s,i,a,l,c,u,d,h,g,p,f,y,m,v,b,x,j,w,k,A,O;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},s=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",i=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:s,value:null!=i?i:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(i=null===(s=M.datum)||void 0===s?void 0:s.category)&&void 0!==i?i:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=M.cx)&&void 0!==g?g:M.x,y:null!==(p=M.cy)&&void 0!==p?p:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(f=M.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(v=M.cy)&&void 0!==v?v:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(j=null===(x=null===(b=M.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==j?j:null===(w=M.datum)||void 0===w?void 0:w.name)&&void 0!==k?k:"",value:null!==(O=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),m=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],s=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),s+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:s/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}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ve(e.min)} to ${ve(e.max)}, mean ${ve(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(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const j=Array.from(x);return e.jsxs("div",{ref:d,id:o,tabIndex:-1,onBlur:f,style:be,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:je,children:"×"}),e.jsx("div",{role:"note",style:xe,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:we,children:[e.jsxs("caption",{style:Oe,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:ke,children:"type"}),j.map(t=>e.jsx("th",{style:ke,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Ae,children:t.label}),j.map(n=>{return e.jsx("td",{style:Ae,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":ve(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function Me({summary:t}){return t?e.jsx("div",{role:"note",style:ye,children:t}):null}function _e({tableId:t}){return e.jsx("a",{href:"#"+t,style:ye,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,ye)},children:"Skip to data table"})}function Ce({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.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:ye,children:n})}const Pe="var(--semiotic-focus, #005fcc)";function Le({active:t,hoverPoint:n,margin:o,size:r,shape:s="circle",width:i,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===s&&null!=i&&null!=a){const t=Math.max(i,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Pe,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===s?{cx:l,cy:c,r:12,fill:"none",stroke:Pe,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Pe,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Be({x:t,y:n,containerWidth:o,containerHeight:r,margin:s,children:i,className:a="stream-frame-tooltip",zIndex:l=1}){const c=g.useRef(null),[u,d]=g.useState(null);g.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})},[i,a,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.jsx("div",{ref:c,className:a,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"},children:i})}function Te(n){const o=t.createContext(null),r=Re(n);return[function({children:r}){const s=t.useMemo(()=>Re(n),[]);return e.jsx(o.Provider,{value:s,children:r})},e=>{var n;const s=null!==(n=t.useContext(o))&&void 0!==n?n:r,i=t.useRef(e);i.current=e;const a=t.useCallback(()=>i.current(s.getState()),[s]),l=t.useCallback(()=>i.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,l)}]}function Re(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 Ie(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 He(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:$e})})),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 $e=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],De={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}},Ne={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}},Fe={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:$e,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"},[We,ze]=Te(e=>({theme:De,setTheme(t){e(e=>{if("light"===t)return{theme:De};if("dark"===t)return{theme:Ne};if("high-contrast"===t)return{theme:Fe};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ne:De;return{theme:He(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:He(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||{})}))}})}}));const Ee=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,qe=new WeakMap;let Ge=0,Ve=!1,Ye=null,Xe=null,Qe=null;function Ue(e,t){var n,o;if(!t)return t;const r=Ee.exec(t);if(!r)return t;const s=e.canvas;if(!s)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Ve)return;if("undefined"==typeof window||"undefined"==typeof document)return;Ve=!0;const e=()=>{Ge++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ye=new MutationObserver(e),Ye.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Xe=window.matchMedia("(prefers-color-scheme: dark)"),Qe=e,"function"==typeof Xe.addEventListener?Xe.addEventListener("change",Qe):"function"==typeof Xe.addListener&&Xe.addListener(Qe)}catch(e){}}();let i=qe.get(s);i&&i.version===Ge||(i={version:Ge,map:new Map},qe.set(s,i));const a=i.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(s).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return i.map.set(t,l),l}function Ke(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ze(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[r,s]=function(e,n,o){const r=t.useRef(null),[s,i]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&s?s.w:e[0],o&&s?s.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=s[0]-i.left-i.right,l=s[1]-i.top-i.bottom,c=Ke(e.foregroundGraphics,s,i),u=Ke(e.backgroundGraphics,s,i),d=ze(e=>e.theme),{transition:h,introEnabled:p}=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)}}(e.animate,e.transitionProp),f="semiotic-table-"+g.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),w=t.useRef(0),k=t.useCallback(()=>{w.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(k))},[k]),O=t.useCallback(()=>{j.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const S=e.themeDirtyRef;return t.useEffect(()=>{S&&(Ge++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:r,size:s,margin:i,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function Je(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function et(e,t,n=.3){Je(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 tt(e,t,n=.6){var o,r,s,i,a;if(!Je(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(s=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==s?s:0,d=null!==(a=null!==(i=t.cy)&&void 0!==i?i: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*n,e.stroke()}function nt(e,t,n,o=.35){Je(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function ot(e,t,n){const o=t.fillGradient;if(!o)return null;const r=t.roundedEdge;let s=t.x,i=t.y,a=t.x,l=t.y+t.h;if("bottom"===r?(i=t.y+t.h,l=t.y):"right"===r?(s=t.x+t.w,i=t.y,a=t.x,l=t.y):"left"===r&&(s=t.x,i=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.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 n=e.createLinearGradient(s,i,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(s,i,a,l),[u,d,h]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const s=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return s?[+s[1],+s[2],+s[3]]:[78,121,167]}(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const rt=(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)st(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||Ue(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?ot(e,t,n):null;e.fillStyle=o||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:i,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(s,i),e.lineTo(s+a-r,i),e.arcTo(s+a,i,s+a,i+r,r),e.lineTo(s+a,i+l-r),e.arcTo(s+a,i+l,s+a-r,i+l,r),e.lineTo(s,i+l);break;case"left":e.moveTo(s+a,i),e.lineTo(s+r,i),e.arcTo(s,i,s,i+r,r),e.lineTo(s,i+l-r),e.arcTo(s,i+l,s+r,i+l,r),e.lineTo(s+a,i+l);break;case"bottom":e.moveTo(s,i),e.lineTo(s+a,i),e.lineTo(s+a,i+l-r),e.arcTo(s+a,i+l,s+a-r,i+l,r),e.lineTo(s+r,i+l),e.arcTo(s,i+l,s,i+l-r,r);break;default:e.moveTo(s,i+l),e.lineTo(s,i+r),e.arcTo(s,i,s+r,i,r),e.lineTo(s+a-r,i),e.arcTo(s+a,i,s+a,i+r,r),e.lineTo(s+a,i+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||Ue(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?ot(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}et(e,t),e.globalAlpha=1}};function st(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 s=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),s){const s=r+o,i=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=s)e.drawImage(n,i,o,r,r)}else{const s=r+o,i=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=s)e.drawImage(n,o,i,r,r)}e.restore()}const it=(e,t,n,o)=>{var r;const s=t.filter(e=>"point"===e.type);if(0!==s.length){e.save();try{for(const t of s){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?Ue(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Ue(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),tt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function at(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 lt(e,t){const n=a.arc().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()}const ct=(e,t,n,o)=>{var r,s;const i=t.filter(e=>"wedge"===e.type);for(const t of i){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:1,o=null!==(s=t.style.opacity)&&void 0!==s?s:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),lt(e,t)):(at(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(at(e,t),nt(e,t)),e.globalAlpha=1}};const ut=(e,t,n,o)=>{var r,s;const i=t.filter(e=>"violin"===e.type);for(const t of i){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.6,e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(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()}},dt=(e,t,n,o)=>{var r,s,i;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 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!==(s=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==s?s:.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=Ue(e,n.style.stroke)||("string"==typeof n.style.fill?Ue(e,n.style.fill):n.style.fill)||Ue(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(i=n.style.opacity)&&void 0!==i?i:.5,e.stroke(),e.globalAlpha=1}};function ht(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 gt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let pt=null;function ft(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:s=6,angle:i=45}=e,a=Math.max(8,Math.ceil(2*s));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(pt||(pt=document.createElement("canvas")),pt.width=e,pt.height=e,pt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=i*Math.PI/180;if(45===i||-45===i){const e=i>0?1:-1;for(let t=-a;2*a>=t;t+=s)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+=s)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const yt=new Map;function mt(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=yt.get(n);if(void 0!==o)return o;const r=ft({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return yt.set(n,r),r}function vt(e,t,n,o,r,s){e.moveTo(t+s,n),e.lineTo(t+o-s,n),e.quadraticCurveTo(t+o,n,t+o,n+s),e.lineTo(t+o,n+r-s),e.quadraticCurveTo(t+o,n+r,t+o-s,n+r),e.lineTo(t+s,n+r),e.quadraticCurveTo(t,n+r,t,n+r-s),e.lineTo(t,n+s),e.quadraticCurveTo(t,n,t+s,n),e.closePath()}function bt(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 xt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const jt=e=>[dt,...e],wt={bar:jt([rt]),clusterbar:jt([rt]),point:jt([it]),swarm:jt([it]),pie:[ct],donut:[ct],boxplot:jt([(e,t,n,o)=>{var r,s;const i=t.filter(e=>"boxplot"===e.type);for(const t of i){const n=t.columnWidth/2,o="vertical"===t.projection,i=Ue(e,"var(--semiotic-primary, #007bff)"),a=Ue(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?Ue(e,l)||l:null!=l?l:i,u=t.style.stroke,d="string"==typeof u?Ue(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,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=g,e.fillStyle=c,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()}},it]),violin:jt([ut]),histogram:jt([rt]),ridgeline:jt([ut]),timeline:jt([rt]),funnel:[rt,(e,t,n,o)=>{var r,s,i,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s: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===(i=t.style)||void 0===i?void 0:i.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,s,i,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__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)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(s=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==s?s:0))continue;const i=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,i,a),e.fillStyle="#fff",e.fillText(o,i,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(i=n.__funnelBarW)&&void 0!==i?i:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const s=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?ht(r):null!=s?`${ht(r)} (${gt(s)})`:ht(r),e.measureText(c).width+16>o){if(l||null==s)continue;if(c=ht(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__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":[rt,(e,t,n,o)=>{var r,s;const i=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 i){const n=("string"==typeof t.style.fill?t.style.fill:null)||Ue(e,"var(--semiotic-border, #999)"),o=mt(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!==(s=t.style.opacity)&&void 0!==s?s: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)return;const s=Ue(e,"var(--semiotic-text, #333)"),i=Ue(e,"var(--semiotic-text-secondary, #666)");for(const t of r){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,a=!(!0===n.__barFunnelIsFirstStep)&&null!=r,l=a?xt(r):"",c=bt(o);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,p=n.__barFunnelLabelX,f=p-h/2,y=n.__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(),vt(e,f,y,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),vt(e,f,y,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=s,e.fillText(l,p,y+3),e.font="11px sans-serif",e.fillStyle=i,e.fillText(c,p,y+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=s,e.fillText(c,p,y+3))}e.lineWidth=1}],swimlane:jt([rt])},kt={top:50,right:40,bottom:60,left:70},At={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 Ot({hover:t}){var n,o,r,s,i,a;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.jsxs("div",{className:"semiotic-tooltip",style:At,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[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.jsx("div",{className:"semiotic-tooltip",style:At,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const p=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",f=null!==(a=null!==(i=null!==(s=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!==s?s:l.__rValue)&&void 0!==i?i:l.pct)&&void 0!==a?a:"";if(!p&&""===f){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:At,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[p&&e.jsx("div",{style:{fontWeight:"bold"},children:p+""}),""!==f&&e.jsx("div",{children:"number"==typeof f?f.toLocaleString():f+""})]})}const St=t.forwardRef(function(n,o){var r,s,i,l,c,u,d,h,p,y;const{chartType:m,runtimeMode:v,data:b,oAccessor:x="category",rAccessor:j="value",colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:S,valueAccessor:M,categoryAccessor:_,projection:C="vertical",size:P=[600,400],responsiveWidth:L,responsiveHeight:R,margin:z,barPadding:E,roundedTop:q,gradientFill:G,baselinePadding:V,innerRadius:Y,cornerRadius:X,normalize:Q,startAngle:U,sweepAngle:K,dynamicColumnWidth:Z,bins:J,showOutliers:ee,showIQR:te,amplitude:ne,connectorOpacity:oe,showLabels:re,connectorAccessor:se,connectorStyle:ie,dataIdAccessor:ae,rExtent:le,oExtent:ue,extentPadding:fe=.05,oSort:ye,windowMode:ve="sliding",windowSize:be=200,pieceStyle:xe,summaryStyle:je,colorScheme:we,barColors:ke,showAxes:Ae=!0,showCategoryTicks:Oe,categoryLabel:Pe,valueLabel:Te,categoryFormat:Re,valueFormat:He,oLabel:$e,rLabel:De,oFormat:Ne,rFormat:Fe,rTickValues:We,tickLabelEdgeAlign:ze,enableHover:Ee=!0,hoverAnnotation:qe,tooltipContent:Ge,customHoverBehavior:Ve,annotations:Ye,svgAnnotationRules:Xe,showGrid:Qe=!1,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,backgroundGraphics:ot,foregroundGraphics:rt,title:st,className:it,background:at,centerContent:lt,decay:ct,pulse:ut,transition:dt,animate:ht,staleness:gt,brush:pt,onBrush:ft,accessibleTable:yt=!0,description:mt,summary:vt}=n,bt=t.useRef(!0),xt=Ze({sizeProp:P,responsiveWidth:L,responsiveHeight:R,userMargin:z,marginDefault:kt,foregroundGraphics:rt,backgroundGraphics:ot,animate:ht,transitionProp:dt,themeDirtyRef:bt}),{reducedMotionRef:jt,responsiveRef:At,size:St,margin:Mt,adjustedWidth:_t,adjustedHeight:Ct,resolvedForeground:Pt,resolvedBackground:Lt,currentTheme:Bt,transition:Tt,introEnabled:Rt,tableId:It,rafRef:Ht,renderFnRef:$t,scheduleRender:Dt}=xt,Nt=null!=Pe?Pe:$e,Ft=null!=Te?Te:De,Wt=null!=Re?Re:Ne,zt=null!=He?He:Fe,Et=t.useRef(null),qt=t.useRef(null),[Gt,Vt]=t.useState(null),[Yt,Xt]=t.useState(null),[Qt,Ut]=t.useState(0),[Kt,Zt]=t.useState(!1),Jt=Ee||qe,en="streaming"===v,tn=t.useMemo(()=>{var e,t,n;return{chartType:m,runtimeMode:en?"streaming":"bounded",windowSize:be,windowMode:ve,extentPadding:fe,projection:C,oAccessor:en?void 0:x,rAccessor:en?void 0:j,colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:en?S:void 0,valueAccessor:en?M||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:en?_||x:void 0,rExtent:le,oExtent:ue,barPadding:E,roundedTop:q,gradientFill:G,baselinePadding:V,innerRadius:Y,cornerRadius:X,normalize:Q,startAngle:U,sweepAngle:K,dynamicColumnWidth:Z,bins:J,showOutliers:ee,showIQR:te,amplitude:ne,connectorOpacity:oe,showLabels:re,connectorAccessor:se,connectorStyle:ie,dataIdAccessor:ae,oSort:ye,pieceStyle:xe,summaryStyle:je,colorScheme:we,themeCategorical:null===(e=null==Bt?void 0:Bt.colors)||void 0===e?void 0:e.categorical,themeSemantic:Ie(Bt),themeSequential:null===(t=null==Bt?void 0:Bt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Bt?void 0:Bt.colors)||void 0===n?void 0:n.diverging,barColors:ke,decay:ct,pulse:ut,transition:Tt,introAnimation:Rt,staleness:gt}},[m,be,ve,fe,C,x,j,w,k,A,O,S,M,_,le,ue,E,q,G,V,Y,X,Q,U,K,Z,J,ee,te,ne,oe,re,se,ie,ae,ye,xe,je,we,ke,ct,ut,null==Tt?void 0:Tt.duration,null==Tt?void 0:Tt.easing,Rt,gt,en,Bt]),nn=t.useRef(null);nn.current||(nn.current=new B(tn)),t.useEffect(()=>{var e;null===(e=nn.current)||void 0===e||e.updateConfig(tn),bt.current=!0,Dt()},[tn,Dt]);const on=t.useRef(null);on.current||(on.current=new f(e=>{const t=nn.current;t&&t.ingest(e)&&(bt.current=!0,Dt())}));const rn=t.useCallback(e=>{var t;null===(t=on.current)||void 0===t||t.push(e)},[]),sn=t.useCallback(e=>{var t;null===(t=on.current)||void 0===t||t.pushMany(e)},[]),an=t.useCallback(()=>{var e,t;null===(e=on.current)||void 0===e||e.clear(),null===(t=nn.current)||void 0===t||t.clear(),bt.current=!0,Dt()},[Dt]),ln=t.useCallback(e=>{var t,n;null===(t=on.current)||void 0===t||t.clearLastData(),null===(n=on.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:rn,pushMany:sn,replace:ln,remove:e=>{var t,n,o,r;null===(t=on.current)||void 0===t||t.flush();const s=null!==(o=null===(n=nn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(s.length>0){const e=null===(r=qt.current)||void 0===r?void 0:r.data;!!qt.current&&s.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(qt.current=null,Vt(null)),bt.current=!0,Dt()}return s},update:(e,t)=>{var n,o,r;null===(n=on.current)||void 0===n||n.flush();const s=null!==(r=null===(o=nn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return s.length>0&&(bt.current=!0,Dt()),s},clear:an,getData:()=>{var e,t,n;return null===(e=on.current)||void 0===e||e.flush(),null!==(n=null===(t=nn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[rn,sn,ln,an,Dt]),t.useEffect(()=>{var e;b&&(null===(e=on.current)||void 0===e||e.setBoundedData(b))},[b]);const{hoverHandlerRef:cn,hoverLeaveRef:un,onPointerMove:dn,onPointerLeave:hn}=xt;cn.current=e=>{if(!Jt)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,r=e.clientY-n.top-Mt.top;if(0>o||o>_t||0>r||r>Ct)return void(qt.current&&(qt.current=null,Vt(null),Ve&&Ve(null),Dt()));const s=nn.current;if(!s||0===s.scene.length)return;const i="radial"===C,a=function(e,t,n,o=30,r,s=0){let i=null;if(r){const e=function(e,t,n,o,r){const s=Math.max(o,r+5,12),i=t-s,a=t+s,l=n-s,c=n+s;let u=null,d=1/0;return e.visit((e,r,s,h,g)=>{if(r>a||i>h||s>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,s=e.x-t,i=e.y-n,a=Math.sqrt(s*s+i*i);T(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,s);e&&(i={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const s of e){let e=null;switch(s.type){case"rect":e=I(s,t,n);break;case"point":if(r)break;e=H(s,t,n,o);break;case"wedge":e=$(s,t,n);break;case"boxplot":e=D(s,t,n);break;case"violin":e=N(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(s.scene,i?o-_t/2:o,i?r-Ct/2:r,30,s.pointQuadtree,s.maxPointRadius);if(!a)return void(qt.current&&(qt.current=null,Vt(null),Ve&&Ve(null),Dt()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;qt.current=l,Vt(l),Ve&&(Ve(l),bt.current=!0),Dt()},un.current=()=>{qt.current&&(qt.current=null,Vt(null),Ve&&(Ve(null),bt.current=!0),Dt())};const gn=t.useRef(-1),pn=t.useRef(null),fn=t.useRef(null),yn=t.useCallback(e=>{const t=nn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(fn.current&&fn.current.version===n)o=fn.current.graph;else{const e=function(e){var t,n,o;const r=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";r.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)r.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;r.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return r.sort((e,t)=>e.x-t.x||e.y-t.y),r}(t.scene);if(0===e.length)return;o=function(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)}),s=Array.from(o.values()).flat();s.sort((e,t)=>e.x-t.x||e.y-t.y);const i=new Map;for(let e=0;s.length>e;e++){s[e]._flatIndex=e;const t=null===(n=s[e].datum)||void 0===n?void 0:n.id;null!=t&&i.set(t+"",e)}return{flat:s,groups:r,byGroup:o,idToIdx:i}}(e),fn.current={version:n,graph:o}}const r=gn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),gn.current=0;const t=o.flat[0];pn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},W(t)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});return qt.current=n,Vt(n),Ve&&Ve(n),void Dt()}const s=function(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)),s=e.flat[r];return{flatIndex:r,group:null!==(n=s.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=s._groupIndex)&&void 0!==o?o:0}}(o,r),i=function(e,t,n){const{group:o,indexInGroup:r}=t,s=n.byGroup.get(o);switch(e){case"ArrowRight":return s.length-1>r?s[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?s[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?F(n,n.groups[e+1],s[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?F(n,n.groups[e-1],s[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}}(e.key,s,o);if(null===i)return;if(e.preventDefault(),0>i)return gn.current=-1,pn.current=null,qt.current=null,Vt(null),Ve&&Ve(null),void Dt();gn.current=i;const a=o.flat[i];pn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},W(a)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});qt.current=l,Vt(l),Ve&&Ve(l),Dt()},[Ve,Dt]),mn=t.useCallback(e=>{gn.current=-1,pn.current=null,dn(e)},[dn]);$t.current=()=>{var e,t;Ht.current=0;const n=Et.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=nn.current;if(!r)return;const s="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(jt.current?s+1e6:s),a=!jt.current&&i,l=bt.current;l&&!i&&(r.computeScene({width:_t,height:Ct}),bt.current=!1),(l||a)&&n.setAttribute("aria-label",me(r.scene,m+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=St[0]*c,d=St[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=St[0]+"px",n.style.height=St[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,St[0],St[1]);const h=null!==(e=null==gt?void 0:gt.threshold)&&void 0!==e?e:5e3,g=gt&&r.lastIngestTime>0&&s-r.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==gt?void 0:gt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==at&&!ot){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=at||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,St[0],St[1]))}const p="radial"===C;o.save(),o.beginPath(),o.rect(Mt.left,Mt.top,_t,Ct),o.clip(),p?(o.save(),o.translate(Mt.left+_t/2,Mt.top+Ct/2)):o.translate(Mt.left,Mt.top);const f=wt[m]||[],y={width:_t,height:Ct};for(const e of f)e(o,r.scene,r.scales,y);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(Xt(r.scales),Ut(e=>e+1)),(null==gt?void 0:gt.showBadge)&&Zt(!!g),(a||null!=r.activeTransition||r.hasActivePulses)&&(Ht.current=requestAnimationFrame(()=>$t.current()))},t.useEffect(()=>(Dt(),()=>{var e;null===(e=on.current)||void 0===e||e.clear()}),[Dt]),t.useEffect(()=>{bt.current=!0,Dt()},[m,_t,Ct,Ae,at,Dt]),function(e,n,o,r,s,i){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==s&&(i(u),o.current=!0,r())},1e3);return()=>clearInterval(t)},[e,s,r])}(gt,nn,bt,Dt,Kt,Zt);const vn=Jt&&Gt?Ge?Ge(Gt):e.jsx(Ot,{hover:Gt}):null,bn="radial"===C,xn=vn?e.jsx(Be,{x:Gt?bn?Gt.x+_t/2:Gt.x:0,y:Gt?bn?Gt.y+Ct/2:Gt.y:0,containerWidth:_t,containerHeight:Ct,margin:Mt,className:"stream-ordinal-tooltip",children:vn}):null;if(pe){const t=nn.current;t&&b&&(t.ingest({inserts:b,bounded:!0}),t.computeScene({width:_t,height:Ct}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[],o=null!==(s=null==t?void 0:t.scales)&&void 0!==s?s:null,i="radial"===C,l=i?Mt.left+_t/2:Mt.left,c=i?Mt.top+Ct/2:Mt.top;return e.jsxs("div",{className:"stream-ordinal-frame"+(it?" "+it:""),role:"img","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:St[0],height:St[1]},children:[e.jsx(Me,{summary:vt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:St[0],height:St[1],style:{position:"absolute",left:0,top:0},children:[Lt&&e.jsx("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Lt}),e.jsxs("g",{transform:`translate(${l},${c})`,children:[at&&e.jsx("rect",{x:0,y:0,width:_t,height:Ct,fill:at}),n.map((t,n)=>function(t,n){var o,r,s,i,l;const c=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",u=e=>`ord-${t.type}-${c}-${n}-${e}`,d=`ord-${t.type}-${c}-${n}`;switch(t.type){case"rect":{const n=t,o=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(d)+"-grad",r=function(t,n){const o=t.fillGradient;if(!o)return null;let r=t.x,s=t.y,i=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(s=t.y+t.h,a=t.y):"right"===t.roundedEdge?(r=t.x+t.w,s=t.y,i=t.x,a=t.y):"left"===t.roundedEdge&&(r=t.x,s=t.y,i=t.x+t.w,a=t.y);const l=[];if("colorStops"in o){const t=o.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 n=0;t.length>n;n++)l.push(e.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=ge(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:r,y1:s,x2:i,y2:a,children:l})}(n,o),s=r?`url(#${o})`:ge(n.style.fill);if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:i,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${i} L${o+a-t},${i} A${t},${t} 0 0 1 ${o+a},${i+t} L${o+a},${i+l-t} A${t},${t} 0 0 1 ${o+a-t},${i+l} L${o},${i+l} Z`;break;case"left":c=`M${o+a},${i} L${o+t},${i} A${t},${t} 0 0 0 ${o},${i+t} L${o},${i+l-t} A${t},${t} 0 0 0 ${o+t},${i+l} L${o+a},${i+l} Z`;break;case"bottom":c=`M${o},${i} L${o+a},${i} L${o+a},${i+l-t} A${t},${t} 0 0 1 ${o+a-t},${i+l} L${o+t},${i+l} A${t},${t} 0 0 1 ${o},${i+l-t} Z`;break;default:c=`M${o},${i+l} L${o},${i+t} A${t},${t} 0 0 1 ${o+t},${i} L${o+a-t},${i} A${t},${t} 0 0 1 ${o+a},${i+t} L${o+a},${i+l} Z`}return e.jsxs(g.Fragment,{children:[r&&e.jsx("defs",{children:r}),e.jsx("path",{d:c,fill:s,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},d)}return e.jsxs(g.Fragment,{children:[r&&e.jsx("defs",{children:r}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:s,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},d)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:ge(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},d)}case"wedge":{const n=t,o=a.arc().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.jsx("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:ge(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},d)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:ge(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("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.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:ge(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("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.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},d)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:ge(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},u("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,s=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},u("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:s,x2:n.iqrLine.q3Pos,y2:s,stroke:n.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:s,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},u("med")))}return e.jsx("g",{children:o},d)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(l=t.style.opacity)&&void 0!==l?l:.5},d);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:ge(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},d)}default:return null}}(t,n)).filter(Boolean)]})]}),e.jsx(de,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:o,showAxes:Ae,showCategoryTicks:Oe,oLabel:Nt,rLabel:Ft,oFormat:Wt,rFormat:zt,rTickValues:We,tickLabelEdgeAlign:ze,showGrid:Qe,title:st,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,foregroundGraphics:Pt,annotations:Ye,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:"string"==typeof x?x:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==t?void 0:t.getData()}),lt&&"radial"===C&&e.jsx("div",{style:{position:"absolute",left:Mt.left+_t/2,top:Mt.top+Ct/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:lt})]})}return e.jsxs("div",{ref:At,className:"stream-ordinal-frame"+(it?" "+it:""),role:"group","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:L?"100%":St[0],height:R?"100%":St[1],overflow:"visible"},onKeyDown:yn,children:[yt&&e.jsx(_e,{tableId:It}),yt&&e.jsx(Se,{scene:null!==(l=null===(i=nn.current)||void 0===i?void 0:i.scene)&&void 0!==l?l:[],chartType:m+" chart",tableId:It,chartTitle:"string"==typeof st?st:void 0}),e.jsx(Me,{summary:vt}),e.jsxs("div",{role:"img","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?mn:void 0,onMouseLeave:Jt?hn:void 0,children:[Lt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:St[0],height:St[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Lt})}),e.jsx(ce,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,showAxes:Ae,showGrid:Qe,rFormat:zt,rTickValues:We}),e.jsx("canvas",{ref:Et,"aria-label":me(null!==(u=null===(c=nn.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],m+" chart"),style:{position:"absolute",top:0,left:0,width:St[0],height:St[1]}}),e.jsx(Ce,{hoverPoint:Gt}),e.jsx(de,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,showAxes:Ae,showCategoryTicks:Oe,oLabel:Nt,rLabel:Ft,oFormat:Wt,rFormat:zt,showGrid:Qe,title:st,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,foregroundGraphics:Pt,annotations:Ye,svgAnnotationRules:Xe,annotationFrame:Qt,xAccessor:"string"==typeof x?x:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(d=nn.current)||void 0===d?void 0:d.getData(),underlayRendered:!0}),(pt||ft)&&"radial"!==C&&e.jsx(he,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,onBrush:ft||(()=>{})}),lt&&"radial"===C&&e.jsx("div",{style:{position:"absolute",left:Mt.left+_t/2,top:Mt.top+Ct/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:lt}),(null==gt?void 0:gt.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===gt.badgePosition?{top:4,left:4}:"bottom-left"===gt.badgePosition?{bottom:4,left:4}:"bottom-right"===gt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Kt?"#dc3545":"#28a745",color:"white"}),children:Kt?"STALE":"LIVE"}),e.jsx(Le,{active:gn.current>=0,hoverPoint:Gt,margin:Mt,size:St,shape:null===(h=pn.current)||void 0===h?void 0:h.shape,width:null===(p=pn.current)||void 0===p?void 0:p.w,height:null===(y=pn.current)||void 0===y?void 0:y.h}),xn]})]})});St.displayName="StreamOrdinalFrame";const Mt=t.createContext(null);function _t(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 Ct(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Pt,Lt]=Te(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Ct(o,t),s=new Map(r.clauses);return s.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:s})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),s=new Map(o.clauses);return s.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:s})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Ct(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}})}})),[Bt,Tt]=Te(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}))}}));let Rt={positions:new Map};const It=new Set;function Ht(){for(const e of It)e()}function $t(e,t){const n=Rt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Rt.positions);o.delete(e),Rt={positions:o},Ht()}function Dt(e){const n=t.useId(),o=e.clientId||n,{name:r}=e,s=Lt(e=>e.selections.get(r)),i=Lt(e=>e.setClause),a=Lt(e=>e.clearClause),l=t.useMemo(()=>!!s&&s.clauses.size>0,[s]);return{predicate:t.useMemo(()=>s&&0!==s.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(_t(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(s,o):()=>!0,[s,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};i(r,{clientId:o,type:"point",fields:t})},[o,r,i]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};i(r,{clientId:o,type:"interval",fields:t})},[o,r,i]),clear:t.useCallback(()=>{a(r,o)},[a,r,o]),clientId:o}}function Nt(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const Ft=t.createContext(!1);function Wt({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:s,categories:i}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==s&&(n.strokeWidth=s),n},type:"fill",items:(i&&i.length>0?i:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,s)=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):A[s%A.length];return{label:r+"",color:a}}),label:""}]}}function zt(e,t,n){return t?o=>{var r;const s=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function Et(){return ze(e=>e.theme)}function qt(){var e;const t=Et(),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 Gt(e,t,n,o,r){if(e)return e;let s;if(Array.isArray(n))s=n;else if(t&&t.length>0)s=t;else if("string"==typeof n){const e=w[n];Array.isArray(e)&&(s=e)}return s&&0!==s.length?null!=o?(r.has(o)||r.set(o,r.size),s[r.get(o)%s.length]):s[0]:"#007bff"}function Vt(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],r="function"==typeof(s=o)?s:e=>e[s];var s;return t.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,n,o])}g.createContext(void 0);const Yt={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 Xt(e,t,n){var o,r,s,i,a,l,c;const u=Yt[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!==(s=t.showAxes)&&void 0!==s?s:u.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i: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:Qt(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Qt(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 Ut(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}const Kt={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 Zt(e,t){return"function"==typeof t?t(e):e[t]}function Jt(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 en(t={}){const{fields:n,title:o,format:r,style:s={},className:i=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Zt(t,o);a=Jt(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,s;"string"==typeof e?(n=e,o=e,s=r):(n=e.label,o=e.accessor||e.key||"",s=e.format||r);const i=Zt(t,o);l.push({label:n,value:Jt(i,s)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Jt(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Jt(t[e[0]],r))}}const c=Object.assign(Object.assign({},Kt),s);return e.jsxs("div",{className:("semiotic-tooltip "+i).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function tn(t){if(!0===t)return en();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.jsx("div",{className:"semiotic-tooltip",style:Kt,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?en(t):en())}function nn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function on(e,t){if(!t)return nn(e);try{const n=t(e);return null==n?nn(e):n}catch(t){return nn(e)}}function rn(e,t){return"function"==typeof t?t(e):e[t]}function sn({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:s=!1,valueFormat:i}){return a=>{var l;const c=s?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=rn(c,t),d=rn(c,n),h=o?rn(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[e.jsx("div",{style:{fontWeight:"bold"},children:nn(u)}),e.jsx("div",{style:{marginTop:4},children:on(d,i)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[r||(g=o,"string"==typeof g?g:"value"),": ",nn(h)]})]});var g}}function an({componentName:t,message:n,diagnosticHint:o,width:r,height:s}){return e.jsx("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:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("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:o})]})})}class ln extends g.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.jsx(an,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function cn(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 s=1;n>=s;s++){let n=r[0];r[0]=s;for(let i=1;o>=i;i++){const o=r[i];r[i]=e[s-1]===t[i-1]?n:1+Math.min(n,r[i],r[i-1]),n=o}}return r[o]}function un(e,t,n=3){let o,r=n+1;for(const n of t){const t=cn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function dn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function hn(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=un(e,t,3))&&void 0!==n?n:null)}function gn({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=dn(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,s]of Object.entries(n))if(s&&"string"==typeof s&&!(s in o)){const n=hn(s,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${s}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const pn={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"}},fn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},yn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},mn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],vn=["vertical","horizontal"],bn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:mn},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({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:mn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:mn},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({},pn),fn),{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({},pn),fn),{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({},pn),fn),{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({},pn),fn),{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({},pn),fn),{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({},pn),fn),{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({},pn),fn),{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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{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:vn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),yn),{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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},pn),{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({},pn),{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({},pn),{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({},pn),yn),{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({},pn),yn),{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({},pn),{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({},pn),{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:vn},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({},pn),{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({},pn),{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({},pn),{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({},pn),{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({},pn),{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({},pn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},pn),{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({},pn),{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({},pn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function xn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const jn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),wn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),kn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),An=new Set(["LineChart","AreaChart","StackedAreaChart"]),On=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Sn(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],s=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*s(n)+.7152*s(o)+.0722*s(r)}function Mn(e,t){const n=Sn(e),o=Sn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const _n=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Cn(e,t){const n=[],o=function(e,t){const n=[],o=bn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(bn).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(!xn(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),s=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!s.has(o)){const t=un(o,r),s=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(s)}if("array"===o.dataShape){const r=t.data,s={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(s[e]=n)}const i=gn({componentName:e,data:r,accessors:Object.keys(s).length>0?s:void 0});i&&n.push(i)}else if("object"===o.dataShape){const o=function({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}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:s}){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(s&&t&&t.length>0){const n=dn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(s))if(r&&"string"==typeof r&&!(r in n)){const n=hn(r,t),s=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${s}`}}}return null}({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 bn[e]?(function(e,t,n){const o=bn[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=bn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=r[0];if(!s||"object"!=typeof s)return;const i=Object.keys(s);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in s||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${i.join(", ")}.`,fix:`Change ${e} to one of: ${i.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){jn.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){wn.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=bn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=r[0];if(!s||"object"!=typeof s)return;const i=t.xAccessor;"string"==typeof i&&s[i]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${i}" 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(!kn.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(!An.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 s=null!==(o=t.width)&&void 0!==o?o:600,i=null!==(r=t.height)&&void 0!==r?r: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);s>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${s}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),i>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${i}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=bn[e];if(!r||"array"!==r.dataShape)return;const s=t.data;if(!s||!Array.isArray(s)||0===s.length)return;const i=[];t.xAccessor&&"string"==typeof t.xAccessor&&i.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&i.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&i.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(s.length,5);for(const e of i){let t=!0;for(let n=0;a>n;n++){const r=null===(o=s[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(!On.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 s=r.right;"number"==typeof s&&100>s&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${s}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 s=r[o];"string"==typeof s&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${s}"). 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 s=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Mn(e,r);null!==t&&3>t&&s.push(`${e} (${t.toFixed(1)}:1)`)}s.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${s.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${s.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 s=[];for(let e=0;r.length-1>e;e++){const t=Mn(r[e],r[e+1]);null!==t&&1.5>t&&s.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}s.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${s.length} adjacent color pair(s) in colorScheme have very similar luminance: ${s.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,s="string"==typeof t.summary&&t.summary.trim().length>0;o||r||s||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 _n)"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}}var Pn;const Ln="undefined"!=typeof process&&"production"!==(null===(Pn=process.env)||void 0===Pn?void 0:Pn.NODE_ENV);function Bn({componentName:t,width:n,height:o,chartProps:r,children:s}){return e.jsx(ln,{fallback:s=>{let i="";if(Ln&&r)try{const e=Cn(t,r);e.ok||(i=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.jsx(an,{componentName:t,message:s.message,diagnosticHint:i,width:n,height:o})},children:s})}const Tn={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"},Rn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function In(e,t,n,o){if(!Ln)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 s=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${s}`)}function Hn(n){const{data:o,rawData:r,colorBy:s,colorScheme:i,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:p,chartId:f,showLegend:y,userMargin:m,marginDefaults:v,onClick:b,hoverHighlight:x,loading:j,emptyContent:w,width:k,height:A}=n,O="string"==typeof n.colorBy?n.colorBy:void 0,{activeSelectionHook:_,hoverSelectionHook:C,customHoverBehavior:P,customClickBehavior:L,crosshairSourceId:B}=function({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:s,chartType:i,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=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}(n,o),g=Dt({name:(null==e?void 0:e.name)||"__unused__"}),p=function(e){const n=e.name||"hover",{fields:o}=e,{predicate:r,isActive:s,selectPoints:i,clear:a}=Dt({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&i(t)},[o,i,a,n]),predicate:r,isActive:s}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),f=Tt(e=>e.pushObservation),y=e?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),j=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Rt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Rt={positions:new Map(Rt.positions).set(e,{xValue:t,sourceId:n})},Ht())}(h.name||"hover",Number(e),d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&$t(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(s||f){const n={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(i),f&&f(i)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});s&&s(e),f&&f(e)}}},[n,p,h,d,s,i,a,f,c,b]),w=t.useCallback(e=>{var t,n,o,r;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[h.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Rt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Rt.positions);return t.delete(e),Rt={positions:t},Ht(),!1}Rt={positions:new Map(Rt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ht()}(h.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||f){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};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});s&&s(i),f&&f(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),f&&f(e)}}},[l,s,f,i,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const n=Rt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Rt.positions);o.delete(e),Rt={positions:o},Ht()}(e,d),$t(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:j,customClickBehavior:w,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:p,chartId:f,onClick:b,hoverHighlight:x,colorByField:O}),T=function(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}}(u,B),R=function(e,n,o){const r=t.useContext(Mt),s=qt();return t.useMemo(()=>{var t;if(!n)return;const i=null!==(t=null!=o?o:s&&s.length>0?s:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const e=M(t.map(e=>({_cat:e})),"_cat",i);return t=>r[t]||e(t)}return M(t.map(e=>({_cat:e})),"_cat",i)}if(r&&Object.keys(r).length>0){const t=M(e,n,i);return e=>r[e]||t(e)}return M(e,n,i)}if(r&&Object.keys(r).length>0){const e=M([{_:"a"}],"_",i);return t=>r[t]||e(t)}},[e,n,o,r,s])}(o,s,i),I=t.useMemo(()=>{if(!s)return[];const e=new Set;for(const t of o){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[o,s]),H=function(e,n,o){const[r,s]=t.useState(null),[i,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&s(t?t.label:null)},[e]),c=t.useCallback(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]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return i.has(o)}}:null},[e,n,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,s,I),$=t.useMemo(()=>C||(H.legendSelectionHook?H.legendSelectionHook:_),[C,H.legendSelectionHook,_]),D=function(e){const n=ze(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}(c),{legend:N,margin:F,legendPosition:W}=function({data:e,colorBy:n,colorScale:o,showLegend:r,legendPosition:s="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Ft),u=void 0!==r?r:!c&&!!n,d=t.useMemo(()=>{if(!u||!n)return;const t=Wt({data:e,colorBy:n,colorScale:o,getColor:S,categories:l});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[u,n,e,o,l]),h=t.useMemo(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:null!=i?i:{},t=Object.assign(Object.assign({},a),e);return d&&("right"===s&&110>t.right?t.right=110:"left"===s&&110>t.left?t.left=110:"top"===s&&50>t.top?t.top=50:"bottom"===s&&80>t.bottom&&(t.bottom=80)),t},[a,i,d,s]);return{legend:d,margin:h,legendPosition:s}}({data:o,colorBy:s,colorScale:R,showLegend:y,legendPosition:l,userMargin:m,defaults:v}),z=t.useMemo(()=>{const e={};return N&&(e.legend=N,e.legendPosition=W),a&&"none"!==a&&(e.legendHoverBehavior=H.onLegendHover,e.legendClickBehavior=H.onLegendClick,e.legendHighlightedCategory=H.highlightedCategory,e.legendIsolatedCategories=H.isolatedCategories),e},[N,W,a,H.onLegendHover,H.onLegendClick,H.highlightedCategory,H.isolatedCategories]),E=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),i=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+i)-i))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Rn),{position:"absolute",top:a+o*(s+i),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(j,k,A),q=E?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Tn),{width:n,height:o}),children:r||"No data available"}):null}(r,k,A,w);return{colorScale:R,allCategories:I,legendState:H,effectiveSelectionHook:$,activeSelectionHook:_,customHoverBehavior:P,customClickBehavior:L,legend:N,margin:F,legendPosition:W,earlyReturn:E||q||null,legendBehaviorProps:z,crosshairProps:T,resolvedSelection:D}}const $n=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(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,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:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,sort:f=!1,barPadding:y=40,roundedTop:m,gradientFill:v=!1,baselinePadding:b=!1,tooltip:x,annotations:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,showCategoryTicks:D,categoryFormat:N,dataIdAccessor:F}=n,W=r.width,z=r.height,E=r.enableHover,q=r.showGrid,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=Hn({data:K,rawData:i,colorBy:g,colorScheme:p,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"BarChart",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:W,height:z});if(Z.earlyReturn)return Z.earlyReturn;In("BarChart",K,"categoryAccessor",c),In("BarChart",K,"valueAccessor",u);const J=Vt(K,f,u),ee=qt(),te=t.useMemo(()=>new Map,[K]),ne=t.useMemo(()=>(e,t)=>{const n={};return n.fill=g?S(e,g,Z.colorScale):Gt(R,ee,p,void 0,te),n},[g,Z.colorScale,R,ee,p,te]),oe=t.useMemo(()=>{const e=null==w?void 0:w.pieceStyle;return Ut(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},ne(t,n)),e(t,n)||{}):ne,{stroke:I,strokeWidth:H,opacity:$})},[ne,w,I,H,$]),re=t.useMemo(()=>zt(oe,Z.effectiveSelectionHook,Z.resolvedSelection),[oe,Z.effectiveSelectionHook,Z.resolvedSelection]),se=t.useMemo(()=>sn({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ie=gn({componentName:"BarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(an,{componentName:"BarChart",message:ie,width:W,height:z});const 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:"bar"},null!=i&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:re,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:y}),null!=m&&{roundedTop:m}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),F&&{dataIdAccessor:F}),{baselinePadding:b,enableHover:E,showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:h}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:D,oSort:f}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:tn(x)||se}),(A||O||M||_)&&{customHoverBehavior:Z.customHoverBehavior}),(O||M||A)&&{customClickBehavior:Z.customClickBehavior}),j&&j.length>0&&{annotations:j}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"BarChart",width:W,height:z,children:e.jsx(St,Object.assign({ref:s},ae))})});function Dn({isPushMode:e,colorBy:n,colorScheme:o,showLegend:r,legendPosition:s="right"}){const i=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=t.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=t.useCallback(t=>{if(!e||!n)return;let o=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=u(e);null==t||i.current.has(t)||(i.current.add(t),a.current.push(t),o=!0)}o&&c(e=>e+1)},[e,n,u]),h=t.useCallback(e=>t=>{d([t]),e(t)},[d]),g=t.useCallback(e=>t=>{d(t),e(t)},[d]),p=t.useCallback(()=>{i.current=new Set,a.current=[],c(e=>e+1)},[]),f=t.useMemo(()=>{if(!e||!n||!1===r)return;const t=a.current;if(0===t.length)return;const s=Array.isArray(o)?o:A,i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],s[e%s.length]);const l="string"==typeof n?n:"__streamCat";return Wt({data:t.map(e=>({[l]:e})),colorBy:l,colorScale:e=>i.get(e)||"#999",getColor:S})},[e,n,r,o,l]),y=t.useMemo(()=>{if(f)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[f,s]);return{wrapPush:h,wrapPushMany:g,resetCategories:p,streamingLegend:f,streamingMarginAdjust:y}}function Nn({ref:e,frameRef:n,isPushMode:o,colorBy:r,colorScheme:s,showLegend:i,legendPosition:a,setup:l}){const c=Dn({isPushMode:o,colorBy:r,colorScheme:s,showLegend:i,legendPosition:a}),u=t.useCallback(c.wrapPush(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)}),[c.wrapPush]),d=t.useCallback(c.wrapPushMany(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)}),[c.wrapPushMany]);return t.useImperativeHandle(e,()=>({push:u,pushMany:d,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,r;return null!==(r=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[]},clear:()=>{var e;c.resetCategories(),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:[]}}),[u,d,c.resetCategories]),{effectiveLegendProps:t.useMemo(()=>c.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:c.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,c.streamingLegend,a]),effectiveMargin:t.useMemo(()=>{if(c.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(c.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,c.streamingMarginAdjust])}}$n.displayName="BarChart";const Fn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:f,normalize:y=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:j,annotations:w,frameProps:k={},selection:A,linkedHover:O,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:B,legendInteraction:T,legendPosition:R,color:I,stroke:H,strokeWidth:$,opacity:D,categoryFormat:N}=n,F=r.width,W=r.height,z=r.enableHover,E=r.showGrid,q=r.showLegend,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=p||u,J=void 0===i,ee=Hn({data:K,rawData:i,colorBy:Z,colorScheme:f,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:r.marginDefaults,loading:L,emptyContent:B,width:F,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=qt(),ne=t.useMemo(()=>new Map,[K]),oe=t.useMemo(()=>(e,t)=>Z?ee.colorScale?{fill:S(e,Z,ee.colorScale)}:{}:{fill:Gt(I,te,f,t,ne)},[Z,ee.colorScale,I,te,f,ne]),re=t.useMemo(()=>{const e=null==k?void 0:k.pieceStyle;return Ut(e&&"function"==typeof e?(t,n)=>{const o=oe(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:oe,{stroke:H,strokeWidth:$,opacity:D})},[oe,k,H,$,D]),se=t.useMemo(()=>zt(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ie=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=gn({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Nn({ref:o,frameRef:s,isPushMode:J,colorBy:Z,colorScheme:f,showLegend:q,legendPosition:R,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!=i&&{data:K}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[F,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:g}),N&&{oFormat:N}),{showGrid:E}),le),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===j?()=>null:tn(j)||ie}),(O||M||_||C)&&{customHoverBehavior:ee.customHoverBehavior}),(M||_||O)&&{customClickBehavior:ee.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(an,{componentName:"StackedBarChart",message:ae,width:F,height:W}):e.jsx(Bn,{componentName:"StackedBarChart",width:F,height:W,children:e.jsx(St,Object.assign({ref:s},ue))})});Fn.displayName="StackedBarChart";const Wn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:f,sort:y=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,categoryFormat:D}=n,N=r.width,F=r.height,W=r.enableHover,z=r.showGrid,E=r.showLegend,q=r.title,G=r.description,V=r.summary,Y=r.accessibleTable,X=r.categoryLabel,Q=r.valueLabel,U=i||[],K=p||u,Z=void 0===i,J=Hn({data:U,rawData:i,colorBy:K,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"GroupedBarChart",chartId:C,showLegend:E,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:N,height:F});if(J.earlyReturn)return J.earlyReturn;const ee=qt(),te=t.useMemo(()=>new Map,[U]),ne=w.pieceStyle,oe=t.useMemo(()=>(e,t)=>{const n=K?J.colorScale?{fill:S(e,K,J.colorScale)}:{}:{fill:Gt(R,ee,f,t,te)};if(ne){const o=ne(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[K,J.colorScale,R,ee,f,te,ne]),re=t.useMemo(()=>Ut(oe,{stroke:I,strokeWidth:H,opacity:$}),[oe,I,H,$]),se=t.useMemo(()=>zt(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ie=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=gn({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Nn({ref:o,frameRef:s,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:E,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({chartType:"clusterbar"},null!=i&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[N,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:X,rLabel:Q,rFormat:g}),D&&{oFormat:D}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==Y&&{accessibleTable:Y}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:tn(x)||ie}),(A||O||M||_)&&{customHoverBehavior:J.customHoverBehavior}),(O||M||A)&&{customClickBehavior:J.customClickBehavior}),j&&j.length>0&&{annotations:j}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(an,{componentName:"GroupedBarChart",message:ae,width:N,height:F}):e.jsx(Bn,{componentName:"GroupedBarChart",width:N,height:F,children:e.jsx(St,Object.assign({ref:s},ue))})});function zn({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const s=(i="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const a=function(e){const{name:n,xField:o,yField:r}=e,{predicate:s,isActive:i,selectInterval:a,clear:l}=Dt({name:n}),c=o&&r?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&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])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Nt(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Nt(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,r,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:s,isActive:i,clear:l}}({name:(null==s?void 0:s.name)||"__unused_ordinal_brush__",xField:(null==s?void 0:s.xField)||("string"==typeof r?r:"value")}),l=t.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=t.useCallback(e=>{if(s){l.current.end(e?e.r:null)}null==n||n(e)},[n,s]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Wn.displayName="GroupedBarChart";const En=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:f,barPadding:y,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:F,showCategoryTicks:W}=n,z=r.width,E=r.height,q=r.enableHover,G=r.showGrid,V=r.showLegend,Y=r.title,X=r.description,Q=r.summary,U=r.accessibleTable,K=r.categoryLabel,Z=r.valueLabel,J=i||[],ee=p||u,te=void 0===i,ne=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==n.mode)return 40;const e=new Set(J.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?E:z)-2*t)/(t-1))):1},[y,n.mode,J,c,h,z,E]),oe=Hn({data:J,rawData:i,colorBy:ee,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"SwimlaneChart",chartId:C,showLegend:V,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:z,height:E}),re=zn({brushProp:b,onBrushProp:x,linkedBrush:j,valueAccessor:d});if(oe.earlyReturn)return oe.earlyReturn;const se=qt(),ie=t.useMemo(()=>new Map,[J]),ae=w.pieceStyle,le=t.useMemo(()=>(e,t)=>{const n=ee?oe.colorScale?{fill:S(e,ee,oe.colorScale)}:{}:{fill:Gt(R,se,f,t,ie)};if(ae){const o=ae(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[ee,oe.colorScale,R,se,f,ie,ae]),ce=t.useMemo(()=>Ut(le,{stroke:I,strokeWidth:H,opacity:$}),[le,I,H,$]),ue=t.useMemo(()=>zt(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),de=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),he=gn({componentName:"SwimlaneChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ge,effectiveMargin:pe}=Nn({ref:o,frameRef:s,isPushMode:te,colorBy:ee,colorScheme:f,showLegend:V,legendPosition:T,setup:oe}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=i&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ue,size:[z,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,barPadding:ne,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:!1===W?void 0:K,rLabel:Z,rFormat:g}),N&&{rTickValues:N}),null!=F&&{tickLabelEdgeAlign:F}),D&&{oFormat:D}),void 0!==W&&{showCategoryTicks:W}),{showGrid:G}),ge),Y&&{title:Y}),X&&{description:X}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||de}),(A||O||M||_)&&{customHoverBehavior:oe.customHoverBehavior}),(O||M||A)&&{customClickBehavior:oe.customClickBehavior}),v&&v.length>0&&{annotations:v}),re.brushStreamProps),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return he?e.jsx(an,{componentName:"SwimlaneChart",message:he,width:z,height:E}):e.jsx(Bn,{componentName:"SwimlaneChart",width:z,height:E,children:e.jsx(St,Object.assign({ref:s},fe))})});En.displayName="SwimlaneChart";const qn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(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,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:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,sizeBy:f,sizeRange:y=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:j,brush:w,onBrush:k,linkedBrush:A,frameProps:O={},selection:M,linkedHover:_,onObservation:C,onClick:P,hoverHighlight:L,chartId:B,loading:T,emptyContent:R,legendInteraction:I,legendPosition:H,color:$,stroke:D,strokeWidth:N,opacity:F,showCategoryTicks:W,categoryFormat:z}=n,E=r.width,q=r.height,G=r.enableHover,V=r.showGrid,Y=r.title,X=r.description,Q=r.summary,U=r.accessibleTable,K=r.categoryLabel,Z=r.valueLabel,J=i||[],ee=Hn({data:J,rawData:i,colorBy:g,colorScheme:p,legendInteraction:I,legendPosition:H,selection:M,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:L,chartType:"SwarmPlot",chartId:B,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:T,emptyContent:R,width:E,height:q}),te=zn({brushProp:w,onBrushProp:k,linkedBrush:A,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const ne=t.useMemo(()=>{if(!f)return;const e=J.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[J,f]),oe=qt(),re=t.useMemo(()=>new Map,[J]),se=O.pieceStyle,ie=t.useMemo(()=>(e,t)=>{const n={fillOpacity:v};if(n.fill=g?S(e,g,ee.colorScale):Gt($,oe,p,void 0,re),n.r=f?function(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[s,i]=o,[a,l]=n;return i===s?(a+l)/2:a+(r-s)/(i-s)*(l-a)}(e,f,y,ne):m,se){const o=se(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[g,ee.colorScale,f,y,ne,m,v,$,oe,p,re,se]),ae=t.useMemo(()=>Ut(ie,{stroke:D,strokeWidth:N,opacity:F}),[ie,D,N,F]),le=t.useMemo(()=>zt(ae,ee.effectiveSelectionHook,ee.resolvedSelection),[ae,ee.effectiveSelectionHook,ee.resolvedSelection]),ce=t.useMemo(()=>sn({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),ue=gn({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(an,{componentName:"SwarmPlot",message:ue,width:E,height:q});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=i&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[E,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:b,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:K,rLabel:Z,rFormat:h}),z&&{oFormat:z}),{showGrid:V,showCategoryTicks:W}),ee.legendBehaviorProps),Y&&{title:Y}),X&&{description:X}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:tn(x)||ce}),(_||C||P||L)&&{customHoverBehavior:ee.customHoverBehavior}),(C||P||_)&&{customClickBehavior:ee.customClickBehavior}),j&&j.length>0&&{annotations:j}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"SwarmPlot",width:E,height:q,children:e.jsx(St,Object.assign({ref:s},de))})});function Gn(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[r&&e.jsx("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e.jsxs("div",{children:["n = ",s.n]}),null!=s.min&&e.jsxs("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e.jsxs("div",{children:["Q1: ",s.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e.jsxs("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e.jsxs("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,s=(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),i=s.length,a=i>0?i%2!=0?s[Math.floor(i/2)]:(s[i/2-1]+s[i/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[r&&e.jsx("div",{style:{fontWeight:"bold"},children:r+""}),i>0&&e.jsxs("div",{children:["n = ",i]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:Kt,children:e.jsx("div",{style:{fontWeight:"bold"},children:r+""})})}}qn.displayName="SwarmPlot";const Vn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(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,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:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,showOutliers:f=!0,categoryPadding:y=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R,showCategoryTicks:I,categoryFormat:H}=n,$=r.width,D=r.height,N=r.enableHover,F=r.showGrid,W=r.title,z=r.description,E=r.summary,q=r.accessibleTable,G=r.categoryLabel,V=r.valueLabel,Y=i||[],X=Hn({data:Y,rawData:i,colorBy:g,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"BoxPlot",chartId:O,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:M,emptyContent:_,width:$,height:D});if(X.earlyReturn)return X.earlyReturn;const Q=qt(),U=t.useMemo(()=>new Map,[Y]),K=t.useMemo(()=>e=>{const t=g?S(e,g,X.colorScale):Gt(L,Q,p,void 0,U);return{fill:t,stroke:t,fillOpacity:.8}},[g,X.colorScale,L,Q,p,U]),Z=t.useMemo(()=>Ut(K,{stroke:B,strokeWidth:T,opacity:R}),[K,B,T,R]),J=t.useMemo(()=>zt(Z,X.effectiveSelectionHook,X.resolvedSelection),[Z,X.effectiveSelectionHook,X.resolvedSelection]),ee=t.useMemo(()=>Gn(),[]),te=gn({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(te)return e.jsx(an,{componentName:"BoxPlot",message:te,width:$,height:D});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!=i&&{data:Y}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[$,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:X.margin,barPadding:y,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:G,rLabel:V,rFormat:h}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:I}),X.legendBehaviorProps),W&&{title:W}),z&&{description:z}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||ee}),(j||w||k||A)&&{customHoverBehavior:X.customHoverBehavior}),(w||k||j)&&{customClickBehavior:X.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"BoxPlot",width:$,height:D,children:e.jsx(St,Object.assign({ref:s},ne))})});Vn.displayName="BoxPlot";const Yn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),s=t.useRef(null);t.useImperativeHandle(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,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:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:p,colorScheme:f,categoryPadding:y=20,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,showCategoryTicks:D,categoryFormat:N}=n,F=r.width,W=r.height,z=r.enableHover,E=r.showGrid,q=r.title,G=r.description,V=r.summary,Y=r.accessibleTable,X=r.categoryLabel,Q=r.valueLabel,U=i||[],K=Hn({data:U,rawData:i,colorBy:p,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"Histogram",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:F,height:W}),Z=zn({brushProp:b,onBrushProp:x,linkedBrush:j,valueAccessor:u});if(K.earlyReturn)return K.earlyReturn;const J=t.useMemo(()=>{if(0===U.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of U){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[U,u]),ee=qt(),te=t.useMemo(()=>new Map,[U]),ne=t.useMemo(()=>e=>{const t=p?S(e,p,K.colorScale):Gt(R,ee,f,void 0,te);return{fill:t,stroke:t,fillOpacity:.8}},[p,K.colorScale,R,ee,f,te]),oe=t.useMemo(()=>Ut(ne,{stroke:I,strokeWidth:H,opacity:$}),[ne,I,H,$]),re=t.useMemo(()=>zt(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,s=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),null!=r&&e.jsxs("div",{children:["Count: ",r]}),s&&2===s.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),ie=gn({componentName:"Histogram",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(an,{componentName:"Histogram",message:ie,width:F,height:W});const 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(Object.assign({chartType:"histogram"},null!=i&&{data:U}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),J&&{rExtent:J}),{size:[F,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:y,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:X,rLabel:Q,rFormat:g}),N&&{oFormat:N}),{showGrid:E,showCategoryTicks:D}),K.legendBehaviorProps),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==Y&&{accessibleTable:Y}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||se}),(A||O||M||_)&&{customHoverBehavior:K.customHoverBehavior}),(O||M||A)&&{customClickBehavior:K.customClickBehavior}),v&&v.length>0&&{annotations:v}),Z.brushStreamProps),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"Histogram",width:F,height:W,children:e.jsx(St,Object.assign({ref:s},ae))})});Yn.displayName="Histogram";const Xn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(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,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:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:m=20,tooltip:v,annotations:b,brush:x,onBrush:j,linkedBrush:w,frameProps:k={},selection:A,linkedHover:O,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:B,legendInteraction:T,legendPosition:R,color:I,stroke:H,strokeWidth:$,opacity:D,showCategoryTicks:N,categoryFormat:F}=n,W=r.width,z=r.height,E=r.enableHover,q=r.showGrid,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=Hn({data:K,rawData:i,colorBy:f,colorScheme:y,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"ViolinPlot",chartId:P,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:L,emptyContent:B,width:W,height:z}),J=zn({brushProp:x,onBrushProp:j,linkedBrush:w,valueAccessor:u});if(Z.earlyReturn)return Z.earlyReturn;const ee=qt(),te=t.useMemo(()=>new Map,[K]),ne=t.useMemo(()=>e=>{const t=f?S(e,f,Z.colorScale):Gt(I,ee,y,void 0,te);return{fill:t,stroke:t,fillOpacity:.6}},[f,Z.colorScale,I,ee,y,te]),oe=t.useMemo(()=>Ut(ne,{stroke:H,strokeWidth:$,opacity:D}),[ne,H,$,D]),re=t.useMemo(()=>zt(oe,Z.effectiveSelectionHook,Z.resolvedSelection),[oe,Z.effectiveSelectionHook,Z.resolvedSelection]),se=t.useMemo(()=>Gn({valueAccessor:u}),[u]),ie=gn({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(an,{componentName:"ViolinPlot",message:ie,width:W,height:z});const 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({chartType:"violin"},null!=i&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:p}),F&&{oFormat:F}),{showGrid:q,showCategoryTicks:N}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:tn(v)||se}),(O||M||_||C)&&{customHoverBehavior:Z.customHoverBehavior}),(M||_||O)&&{customClickBehavior:Z.customClickBehavior}),b&&b.length>0&&{annotations:b}),J.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"ViolinPlot",width:W,height:z,children:e.jsx(St,Object.assign({ref:s},ae))})});Xn.displayName="ViolinPlot";const Qn=t.forwardRef(function(n,o){var r;const s=Xt(n.mode,{width:n.width,height:n.height,showGrid:null===(r=n.showGrid)||void 0===r||r,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),i=t.useRef(null);t.useImperativeHandle(o,()=>({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{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:f,sort:y="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:j={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:M,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:B,color:T,stroke:R,strokeWidth:I,opacity:H,categoryFormat:$}=n,D=s.width,N=s.height,F=s.enableHover,W=s.showGrid,z=s.title,E=s.description,q=s.summary,G=s.accessibleTable,V=s.categoryLabel,Y=s.valueLabel,X=a||[],Q=Hn({data:X,rawData:a,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:B,selection:w,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:M,chartType:"DotPlot",chartId:_,showLegend:s.showLegend,userMargin:l,marginDefaults:s.marginDefaults,loading:C,emptyContent:P,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Vt(X,y,d),K=qt(),Z=t.useMemo(()=>new Map,[X]),J=j.pieceStyle,ee=t.useMemo(()=>(e,t)=>{const n={r:m,fillOpacity:.8};if(n.fill=p?S(e,p,Q.colorScale):Gt(T,K,f,void 0,Z),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},[p,Q.colorScale,m,T,K,f,Z,J]),te=t.useMemo(()=>Ut(ee,{stroke:R,strokeWidth:I,opacity:H}),[ee,R,I,H]),ne=t.useMemo(()=>zt(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),re=gn({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(an,{componentName:"DotPlot",message:re,width:D,height:N});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!=a&&{data:U}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:s.showAxes,oLabel:V,rLabel:Y,rFormat:g}),$&&{oFormat:$}),{showGrid:W,oSort:y}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:tn(b)||oe}),(k||A||O||M)&&{customHoverBehavior:Q.customHoverBehavior}),(A||O||k)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"DotPlot",width:D,height:N,children:e.jsx(St,Object.assign({ref:i},se))})});Qn.displayName="DotPlot";const Un=t.forwardRef(function(n,o){var r,s;const i=Xt(n.mode,{width:null!==(r=n.width)&&void 0!==r?r:400,height:null!==(s=n.height)&&void 0!==s?s:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:p,startAngle:f=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R}=n,I=i.width,H=i.height,$=i.enableHover,D=i.showLegend,N=i.title,F=i.description,W=i.summary,z=i.accessibleTable,E=l||[],q=g||d,G=void 0===l,V=Hn({data:E,rawData:l,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"PieChart",chartId:O,showLegend:D,userMargin:c,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const Y=qt(),X=t.useMemo(()=>new Map,[E]),Q=t.useMemo(()=>(e,t)=>q?V.colorScale?{fill:S(e,q,V.colorScale)}:{}:{fill:Gt(L,Y,p,t,X)},[q,V.colorScale,L,Y,p,X]),U=t.useMemo(()=>{const e=null==b?void 0:b.pieceStyle;return Ut(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Q(t,n)),e(t,n)||{}):Q,{stroke:B,strokeWidth:T,opacity:R})},[Q,b,B,T,R]),K=t.useMemo(()=>zt(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),Z=t.useMemo(()=>sn({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),J=gn({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:ee,effectiveMargin:te}=Nn({ref:o,frameRef:a,isPushMode:G,colorBy:q,colorScheme:p,showLegend:D,legendPosition:P,setup:V}),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:"pie"},null!=l&&{data:E}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:K,startAngle:f}),null!=y&&{cornerRadius:y}),{size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),ee),N&&{title:N}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||Z}),(j||w||k||A)&&{customHoverBehavior:V.customHoverBehavior}),(w||k||j)&&{customClickBehavior:V.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return J?e.jsx(an,{componentName:"PieChart",message:J,width:I,height:H}):e.jsx(Bn,{componentName:"PieChart",width:I,height:H,children:e.jsx(St,Object.assign({ref:a},ne))})});Un.displayName="PieChart";const Kn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks},{width:400,height:400}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:p,startAngle:f=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R}=n,I=r.width,H=r.height,$=r.enableHover,D=r.showLegend,N=r.title,F=r.description,W=r.summary,z=r.accessibleTable,E=i||[],q=g||c,G=void 0===i,V=Hn({data:E,rawData:i,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"DonutChart",chartId:O,showLegend:D,userMargin:a,marginDefaults:r.marginDefaults,loading:M,emptyContent:_,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const Y=null!=d?d:Math.max(2,.15*Math.min(I,H)),X=qt(),Q=t.useMemo(()=>new Map,[E]),U=b.pieceStyle,K=t.useMemo(()=>(e,t)=>{let n;if(n=q?V.colorScale?{fill:S(e,q,V.colorScale)}:{}:{fill:Gt(L,X,p,t,Q)},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},[q,V.colorScale,L,X,p,Q,U]),Z=t.useMemo(()=>Ut(K,{stroke:B,strokeWidth:T,opacity:R}),[K,B,T,R]),J=t.useMemo(()=>zt(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=t.useMemo(()=>sn({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),te=gn({componentName:"DonutChart",data:i,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:ne,effectiveMargin:oe}=Nn({ref:o,frameRef:s,isPushMode:G,colorBy:q,colorScheme:p,showLegend:D,legendPosition:P,setup:V}),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({chartType:"donut"},null!=i&&{data:E}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:Y,startAngle:f}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:oe,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),ne),N&&{title:N}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||ee}),(j||w||k||A)&&{customHoverBehavior:V.customHoverBehavior}),(w||k||j)&&{customClickBehavior:V.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return te?e.jsx(an,{componentName:"DonutChart",message:te,width:I,height:H}):e.jsx(Bn,{componentName:"DonutChart",width:I,height:H,children:e.jsx(St,Object.assign({ref:s},re))})});Kn.displayName="DonutChart";const Zn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),s=t.useRef(null),i="context"===n.mode,{compactMode:a}=r,{value:l,min:c=0,max:u=100,thresholds:d,color:h,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,showNeedle:f=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:m,valueFormat:v,showScaleLabels:b=!a,sweep:x=240,fillZones:j=!0,tooltip:w,annotations:k,frameProps:A={},className:O,stroke:S,strokeWidth:M,opacity:_}=n,C=r.width,P=r.height,L=r.title,B=r.description,T=r.summary,R=r.accessibleTable,I=Math.max(c,Math.min(u,l)),H=u-c||1,$=(I-c)/H,{gaugeData:D,pieceStyle:N,gaugeAnnotations:F}=t.useMemo(()=>{const e=[],t=new Map,n=[];let o=d&&d.length>0?[...d].sort((e,t)=>e.value-t.value):[{value:u,color:h||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(c,Math.min(u,e.value))})),u>o[o.length-1].value&&o.push({value:u,color:o[o.length-1].color});let r=c;for(let n=0;o.length>n;n++){const s=o[n],i=(s.value-r)/H;if(j){const o=(r-c)/H,a=Math.max(0,Math.min($,(s.value-c)/H)-o),l=i-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:s.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:s.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:s.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:g,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:i,_zone:s.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:s.color})}r=s.value}if(b&&d&&d.length>0)for(const e of d)e.value>c&&u>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:g},gaugeAnnotations:n}},[l,c,u,d,h,g,$,H,b,j]),W=t.useMemo(()=>Ut(N,{stroke:S,strokeWidth:M,opacity:_}),[N,S,M,_]),z=x*Math.PI/180,E=180+(360-x)/2,q=Math.min(10,Math.max(1,Math.min(C,P)/12)),G=-Math.PI/2+E*Math.PI/180,V=[[Math.cos(G),Math.sin(G)],[Math.cos(G+z),Math.sin(G+z)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-G)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>z+.001||V.push([Math.cos(e),Math.sin(e)]);const Y=Math.min(...V.map(e=>e[0])),X=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),U=Math.max(...V.map(e=>e[1])),K=(Q+U)/2,Z=(Y+X)/2,J=Math.max(4,Math.min((C-2*q)/(X-Y),(P-2*q)/(U-Q))-2),ee=Math.max(0,Math.min(J-1.5,J*(1-p))),te=C/2-Z*J,ne=P/2-K*J,oe=2*(J+4),re=t.useMemo(()=>{if(a&&null==m)return null;if(null!=m)return"function"==typeof m?m(I,c,u):m;const t=v?v(I):Math.round(I)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),b&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[m,I,c,u,v,b,J,a]),se=t.useMemo(()=>i&&null==m?{type:"gauge-value",text:v?v(I):Math.round(I)+""}:null,[i,m,I,v]),ie=t.useMemo(()=>{if(!f)return null;const e=-Math.PI/2+E*Math.PI/180+$*z,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[f,$,E,z,ee,y]),ae=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const r=(o.width||C)/2,s=(o.height||P)/2,i=Math.max(1,J-ee),a=Math.max(1,Math.min(2.5,.4*i)),l=Math.max(1,Math.min(5,.6*i));return e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+n)}if("gauge-label"===t.type){const r=-Math.PI/2+E*Math.PI/180+(t.value-c)/H*z,s=ee-14,i=(o.height||P)/2;return e.jsx("text",{x:(o.width||C)/2+Math.cos(r)*s,y:i+Math.sin(r)*s,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||C)/2,y:(o.height||P)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[C,P,c,H,E,z,ee,J]),le=t.useMemo(()=>{const e=[...F,...k||[]];return ie&&e.push(ie),se&&e.push(se),e},[F,k,ie,se]),ce=t.useMemo(()=>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.jsxs("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.jsx("div",{style:{fontWeight:600},children:(null==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(I):"Remaining"})]})},[I]);if(0===D.length)return e.jsx(an,{componentName:"GaugeChart",message:"No data to display",width:C,height:P});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:D,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:ee,startAngle:E,sweepAngle:x,centerContent:re,size:[C,P],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:P-ne-oe/2,left:te-oe/2,right:C-te-oe/2},enableHover:r.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===w?()=>null:tn(w)||ce,svgAnnotationRules:ae},le.length>0&&{annotations:le}),L&&{title:L}),B&&{description:B}),T&&{summary:T}),void 0!==R&&{accessibleTable:R}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),A);return e.jsx(Bn,{componentName:"GaugeChart",width:C,height:P,children:e.jsx(St,Object.assign({ref:s},ue))})});Zn.displayName="GaugeChart";const Jn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(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,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:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:m=5,tooltip:v,annotations:b,frameProps:x={},selection:j,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:B,stroke:T,strokeWidth:R,opacity:I,showCategoryTicks:H,categoryFormat:$}=n,D=r.width,N=r.height,F=r.enableHover,W=r.showGrid,z=r.title,E=r.description,q=r.summary,G=r.accessibleTable,V=r.categoryLabel,Y=r.valueLabel,X=i||[],Q=Hn({data:X,rawData:i,colorBy:f,colorScheme:y,legendInteraction:P,legendPosition:L,selection:j,linkedHover:w,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"RidgelinePlot",chartId:M,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:_,emptyContent:C,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=qt(),K=t.useMemo(()=>new Map,[X]),Z=t.useMemo(()=>e=>{const t=f?S(e,f,Q.colorScale):Gt(B,U,y,void 0,K);return{fill:t,stroke:t,fillOpacity:.5}},[f,Q.colorScale,B,U,y,K]),J=t.useMemo(()=>Ut(Z,{stroke:T,strokeWidth:R,opacity:I}),[Z,T,R,I]),ee=t.useMemo(()=>zt(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=t.useMemo(()=>Gn(),[]),ne=gn({componentName:"RidgelinePlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(an,{componentName:"RidgelinePlot",message:ne,width:D,height:N});const 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:"ridgeline"},null!=i&&{data:X}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,bins:h,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:V,rLabel:Y,rFormat:p}),$&&{oFormat:$}),{showGrid:W,showCategoryTicks:H,oSort:!1,amplitude:g}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:tn(v)||te}),(w||k||A||O)&&{customHoverBehavior:Q.customHoverBehavior}),(k||A||w)&&{customClickBehavior:Q.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"RidgelinePlot",width:D,height:N,children:e.jsx(St,Object.assign({ref:s},oe))})});Jn.displayName="RidgelinePlot";const eo=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),s=t.useRef(null);t.useImperativeHandle(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,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:i,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:p="horizontal",connectorOpacity:f=.3,showLabels:y=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R,categoryFormat:I}=n,H="vertical"===p,$=r.width,D=r.height,N=r.enableHover,F=r.title,W=r.description,z=r.summary,E=r.accessibleTable,q=i||[],G=h||d,V=!G,Y=Hn({data:q,rawData:i,colorBy:G,colorScheme:g,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"FunnelChart",chartId:O,showLegend:r.showLegend,userMargin:a,marginDefaults:H?{top:F?60:40,right:20,bottom:60,left:60}:{top:F?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:_,width:$,height:D});if(Y.earlyReturn)return Y.earlyReturn;In("FunnelChart",q,"stepAccessor",c),In("FunnelChart",q,"valueAccessor",u);const X=qt(),Q=t.useMemo(()=>new Map,[q]),U=t.useMemo(()=>{if(V)return L||((null==X?void 0:X[0])?X[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[V,L,X,g]),K=b.pieceStyle,Z=t.useMemo(()=>(e,t)=>{const n={};if(n.fill=U||(G?S(e,G,Y.colorScale):Gt(L,X,g,t,Q)),K){const o=K(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[U,G,Y.colorScale,L,X,g,Q,K]),J=t.useMemo(()=>Ut(Z,{stroke:B,strokeWidth:T,opacity:R}),[Z,B,T,R]),ee=t.useMemo(()=>zt(J,Y.effectiveSelectionHook,Y.resolvedSelection),[J,Y.effectiveSelectionHook,Y.resolvedSelection]),te=t.useMemo(()=>t=>{var n,o,r,s,i,a;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!==(s=null==l?void 0:l.__funnelPercent)&&void 0!==s?s:null==l?void 0:l.__barFunnelPercent,h=null!==(i=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==i?i:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,p=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,f=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),p&&p!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:p+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",f]})]})},[]),ne=gn({componentName:"FunnelChart",data:i,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(an,{componentName:"FunnelChart",message:ne,width:$,height:D});const 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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:H?"bar-funnel":"funnel"},null!=i&&{data:q}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:ee,size:[$,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Y.margin,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),I&&{oFormat:I}),{showGrid:H}),!H&&{connectorOpacity:f}),{showLabels:y}),Y.legendBehaviorProps),F&&{title:F}),W&&{description:W}),z&&{summary:z}),void 0!==E&&{accessibleTable:E}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?te:tn(m)||te}),(j||w||k||A)&&{customHoverBehavior:Y.customHoverBehavior}),(w||k||j)&&{customClickBehavior:Y.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"FunnelChart",width:$,height:D,children:e.jsx(St,Object.assign({ref:s},oe))})});eo.displayName="FunnelChart";const to={RdBu:r.interpolateRdBu,PiYG:r.interpolatePiYG,PRGn:r.interpolatePRGn,BrBG:r.interpolateBrBG,RdYlBu:r.interpolateRdYlBu,RdYlGn:r.interpolateRdYlGn,Spectral:r.interpolateSpectral},no="__likert_neutral_neg",oo="__likert_neutral_pos";function ro(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function so(e,t,n,o,r,s){const i=new Map,a=new Set(t);for(const l of e){const e=n(l);i.has(e)||i.set(e,new Map);const c=i.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&&s){const e=r(l),t=s(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of i){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 s=t[r],i=n.get(s)||0;l.push({__likertCategory:e,__likertLevel:s,__likertLevelLabel:s,__likertCount:i,__likertPct:i/o*100,__likertLevelIndex:r})}}return l}function io(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),s=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;s.push(Object.assign(Object.assign({},t),{__likertLevel:no,__likertPct:-e})),s.push(Object.assign(Object.assign({},t),{__likertLevel:oo,__likertPct:e}))}else s.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return s}function ao(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),s=new Map;for(const t of e){const e=s.get(t.__likertCategory)||[];e.push(t),s.set(t.__likertCategory,e)}const i=[];for(const[,e]of s){const t=new Map;let s,a;for(const n of e)n.__likertLevel===no?s=n:n.__likertLevel===oo?a=n:t.set(n.__likertLevelIndex,n);o&&s&&i.push(s);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&i.push(n)}o&&a&&i.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&i.push(n)}}return i}const lo=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:h="count",levels:p,orientation:f="horizontal",colorScheme:y,barPadding:m=20,tooltip:v,annotations:b,frameProps:x={},selection:j,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:S,valueFormat:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,categoryFormat:B,stroke:T,strokeWidth:R,opacity:I}=n,H=r.width,$=r.height,D=r.enableHover,N=r.showGrid,F=r.showLegend,W=r.title,z=r.description,E=r.summary,q=r.accessibleTable,G=r.categoryLabel,V=r.valueLabel,Y="horizontal"===f,X=void 0===i,Q=!d,U=function(){var e;const t=Et();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),K=t.useMemo(()=>y&&Array.isArray(y)&&y.length>=p.length?y:function(e,t){if(0>=e)return[];if(t){const n=to[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const s=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);s&&a.push(r);for(let e=0;i>e;e++)a.push(o[Math.min(Math.floor(e*o.length/i),o.length-1)]);return a}(p.length,U),[y,p.length,U]),Z=t.useMemo(()=>{const e=new Map;for(let t=0;p.length>t;t++)e.set(p[t],K[t]||"#888");return e},[p,K]),{processedData:J,reAggregate:ee,accumulatorRef:te}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:r,levelAccessor:s,countAccessor:i,isDiverging:a,frameRef:l}){const c=!s,u=t.useMemo(()=>ro(o,"question"),[o]),d=t.useMemo(()=>c?ro(r,"score"):null,[c,r]),h=t.useMemo(()=>c?null:ro(s,"level"),[c,s]),g=t.useMemo(()=>c?null:ro(i,"count"),[c,i]),p=e||[],f=t.useRef([]),y=t.useMemo(()=>{if(0===p.length)return[];let e=so(p,n,u,d,h,g);return a&&(e=io(e,n),e=ao(e,n)),e},[p,n,u,d,h,g,a]),m=t.useCallback(e=>{var t;let o=so(e,n,u,d,h,g);a&&(o=io(o,n),o=ao(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,g,a,l]);return{processedData:y,reAggregate:m,accumulatorRef:f}}({data:i,levels:p,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:h,isDiverging:Y,frameRef:s}),ne="__likertLevelLabel",oe=Dn({isPushMode:X,colorBy:ne,colorScheme:K,showLegend:F,legendPosition:L}),re=t.useCallback(oe.wrapPush(e=>{te.current.push(e),ee(te.current)}),[oe.wrapPush,ee,te]),se=t.useCallback(oe.wrapPushMany(e=>{te.current.push(...e),ee(te.current)}),[oe.wrapPushMany,ee,te]);t.useImperativeHandle(o,()=>({push:re,pushMany:se,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;te.current=[],oe.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}}),[re,se,oe.resetCategories,te]);const ie=Hn({data:J,rawData:i,colorBy:ne,colorScheme:K,legendInteraction:P,legendPosition:L,selection:j,linkedHover:w,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"LikertChart",chartId:S,showLegend:F,userMargin:a,marginDefaults:r.marginDefaults,loading:_,emptyContent:C,width:H,height:$});if(ie.earlyReturn)return ie.earlyReturn;const ae=t.useMemo(()=>{const e=p.length;return e%2!=0&&Z.get(p[Math.floor(e/2)])||"#888"},[p,Z]),le=x.pieceStyle,ce=t.useMemo(()=>(e,t)=>{var n,o;const r=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),s=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let i;if(s===no||s===oo)i={fill:ae};else{const e=r||s;i=e&&Z.has(e)?{fill:Z.get(e)}:{fill:"#888"}}if(le){const n=le(e,t);n.stroke&&(i.stroke=n.stroke),null!=n.strokeWidth&&(i.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(i.strokeOpacity=n.strokeOpacity)}return i},[Z,ae,le]),ue=t.useMemo(()=>Ut(ce,{stroke:T,strokeWidth:R,opacity:I}),[ce,T,R,I]),de=t.useMemo(()=>zt(ue,ie.effectiveSelectionHook,ie.resolvedSelection),[ue,ie.effectiveSelectionHook,ie.resolvedSelection]),he=t.useMemo(()=>{const e=p.length;return e%2!=0?p[Math.floor(e/2)]:""},[p]),ge=t.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===no||n===oo?he:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),i=n===no||n===oo?2*s:s,a=t.__likertCount||0;return g.createElement("div",{className:"semiotic-tooltip",style:Kt},g.createElement("div",{style:{fontWeight:"bold"}},r),g.createElement("div",{style:{marginTop:4}},`${o}: ${i.toFixed(1)}% (n=${a})`))},[he]),pe=t.useMemo(()=>{if(!p||2>p.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==i&&0===i.length)return null;const e={categoryAccessor:c};return Q?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),h&&(e.countAccessor=h)),gn({componentName:"LikertChart",data:i,accessors:e,requiredProps:{levels:p}})},[i,c,u,d,h,p,Q]),fe=t.useMemo(()=>[{styleFn:e=>({fill:Z.get(e.label)||"#888"}),items:p.map(e=>({label:e})),label:""}],[p,Z]),ye=t.useMemo(()=>!1!==F?Object.assign(Object.assign({},ie.legendBehaviorProps),{legend:{legendGroups:fe},legendPosition:L||ie.legendPosition||"bottom"}):ie.legendBehaviorProps,[ie.legendBehaviorProps,ie.legendPosition,L,F,fe]),me=t.useMemo(()=>{const e=Object.assign({},ie.margin);if(X&&!1!==F){const t=L||"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(oe.streamingMarginAdjust)for(const[t,n]of Object.entries(oe.streamingMarginAdjust))n>e[t]&&(e[t]=n);return Y&&100>e.left&&(e.left=100),e},[ie.margin,oe.streamingMarginAdjust,Y,X,F,L]),ve=t.useMemo(()=>M||(Y?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Y,M]),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=i&&{data:J}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Y?"horizontal":"vertical",pieceStyle:de,size:[H,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:me,barPadding:m,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:G,rLabel:V||(Y?void 0:"Percentage"),rFormat:ve}),B&&{oFormat:B}),{showGrid:N}),ye),W&&{title:W}),z&&{description:z}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:!0===v?ge:tn(v)||ge}),(w||k||A||O)&&{customHoverBehavior:ie.customHoverBehavior}),(k||A||w)&&{customClickBehavior:ie.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return pe?e.jsx(an,{componentName:"LikertChart",message:pe,width:H,height:$}):e.jsx(Bn,{componentName:"LikertChart",width:H,height:$,children:e.jsx(St,Object.assign({ref:s},be))})});lo.displayName="LikertChart",exports.BarChart=$n,exports.BoxPlot=Vn,exports.DonutChart=Kn,exports.DotPlot=Qn,exports.FunnelChart=eo,exports.GaugeChart=Zn,exports.GroupedBarChart=Wn,exports.Histogram=Yn,exports.LikertChart=lo,exports.PieChart=Un,exports.RidgelinePlot=Jn,exports.StackedBarChart=Fn,exports.StreamOrdinalFrame=St,exports.SwarmPlot=qn,exports.SwimlaneChart=En,exports.ViolinPlot=Xn,exports.createHatchPattern=ft;