semiotic 3.1.2 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CLAUDE.md +173 -213
  2. package/LICENSE +197 -10
  3. package/README.md +12 -11
  4. package/ai/dist/componentRegistry.js +6 -0
  5. package/ai/dist/mcp-server.js +115 -5
  6. package/ai/examples.md +184 -0
  7. package/ai/schema.json +4140 -888
  8. package/ai/system-prompt.md +36 -1
  9. package/dist/components/ChartContainer.d.ts +2 -0
  10. package/dist/components/DataSummaryContext.d.ts +12 -0
  11. package/dist/components/ThemeProvider.d.ts +5 -3
  12. package/dist/components/Tooltip/FlippingTooltip.d.ts +34 -0
  13. package/dist/components/charts/geo/ChoroplethMap.d.ts +1 -1
  14. package/dist/components/charts/index.d.ts +12 -1
  15. package/dist/components/charts/ordinal/BarChart.d.ts +4 -1
  16. package/dist/components/charts/ordinal/BoxPlot.d.ts +4 -1
  17. package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
  18. package/dist/components/charts/ordinal/DotPlot.d.ts +4 -1
  19. package/dist/components/charts/ordinal/FunnelChart.d.ts +57 -0
  20. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -1
  21. package/dist/components/charts/ordinal/Histogram.d.ts +17 -2
  22. package/dist/components/charts/ordinal/LikertChart.d.ts +94 -0
  23. package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
  24. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +12 -7
  25. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -1
  26. package/dist/components/charts/ordinal/SwarmPlot.d.ts +15 -1
  27. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +65 -0
  28. package/dist/components/charts/ordinal/ViolinPlot.d.ts +17 -2
  29. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +20 -0
  30. package/dist/components/charts/shared/annotationResolvers.d.ts +28 -0
  31. package/dist/components/charts/shared/colorManipulation.d.ts +15 -0
  32. package/dist/components/charts/shared/formatUtils.d.ts +28 -0
  33. package/dist/components/charts/shared/hatchPattern.d.ts +35 -0
  34. package/dist/components/charts/shared/hooks.d.ts +39 -3
  35. package/dist/components/charts/shared/legendUtils.d.ts +2 -1
  36. package/dist/components/charts/shared/selectionUtils.d.ts +16 -1
  37. package/dist/components/charts/shared/statisticalOverlays.d.ts +49 -5
  38. package/dist/components/charts/shared/statsTooltip.d.ts +11 -0
  39. package/dist/components/charts/shared/types.d.ts +26 -2
  40. package/dist/components/charts/shared/useChartSetup.d.ts +12 -2
  41. package/dist/components/charts/shared/useLikertAggregation.d.ts +51 -0
  42. package/dist/components/charts/shared/useOrdinalBrush.d.ts +28 -0
  43. package/dist/components/charts/shared/useOrdinalStreaming.d.ts +54 -0
  44. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
  45. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  46. package/dist/components/charts/shared/validationMap.d.ts +12 -0
  47. package/dist/components/charts/xy/AreaChart.d.ts +11 -0
  48. package/dist/components/charts/xy/Heatmap.d.ts +1 -1
  49. package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
  50. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +71 -0
  51. package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -0
  52. package/dist/components/realtime/types.d.ts +6 -0
  53. package/dist/components/semiotic-ai.d.ts +4 -0
  54. package/dist/components/semiotic-ordinal.d.ts +5 -0
  55. package/dist/components/semiotic-themes.d.ts +80 -0
  56. package/dist/components/semiotic-utils.d.ts +30 -0
  57. package/dist/components/semiotic-xy.d.ts +1 -0
  58. package/dist/components/semiotic.d.ts +11 -5
  59. package/dist/components/store/LinkedCrosshairStore.d.ts +11 -0
  60. package/dist/components/store/ThemeStore.d.ts +22 -2
  61. package/dist/components/store/useSelection.d.ts +1 -0
  62. package/dist/components/stream/AccessibleDataTable.d.ts +28 -6
  63. package/dist/components/stream/FocusRing.d.ts +33 -0
  64. package/dist/components/stream/OrdinalBrushOverlay.d.ts +43 -0
  65. package/dist/components/stream/OrdinalPipelineStore.d.ts +16 -0
  66. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
  67. package/dist/components/stream/PipelineStore.d.ts +7 -47
  68. package/dist/components/stream/SVGOverlay.d.ts +9 -3
  69. package/dist/components/stream/SceneGraph.d.ts +6 -1
  70. package/dist/components/stream/XYBrushOverlay.d.ts +47 -0
  71. package/dist/components/stream/accessorUtils.d.ts +14 -0
  72. package/dist/components/stream/geoTypes.d.ts +5 -1
  73. package/dist/components/stream/keyboardNav.d.ts +85 -9
  74. package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +35 -0
  75. package/dist/components/stream/layouts/hierarchyUtils.d.ts +25 -0
  76. package/dist/components/stream/networkTypes.d.ts +7 -1
  77. package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +27 -0
  78. package/dist/components/stream/ordinalSceneBuilders/funnelScene.d.ts +26 -0
  79. package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +12 -0
  80. package/dist/components/stream/ordinalTypes.d.ts +30 -4
  81. package/dist/components/stream/pipelineDecay.d.ts +20 -0
  82. package/dist/components/stream/pipelinePulse.d.ts +24 -0
  83. package/dist/components/stream/pipelineTransitions.d.ts +59 -0
  84. package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +12 -0
  85. package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +2 -1
  86. package/dist/components/stream/renderers/trapezoidCanvasRenderer.d.ts +15 -0
  87. package/dist/components/stream/sceneUtils.d.ts +10 -0
  88. package/dist/components/stream/types.d.ts +29 -4
  89. package/dist/components/stream/useMediaPreferences.d.ts +11 -0
  90. package/dist/components/stream/xySceneBuilders/areaScene.d.ts +13 -0
  91. package/dist/components/stream/xySceneBuilders/barScene.d.ts +18 -0
  92. package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +8 -0
  93. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +10 -0
  94. package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +13 -0
  95. package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +3 -0
  96. package/dist/components/stream/xySceneBuilders/lineScene.d.ts +12 -0
  97. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +12 -0
  98. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +10 -0
  99. package/dist/components/stream/xySceneBuilders/types.d.ts +93 -0
  100. package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +12 -0
  101. package/dist/geo.min.js +1 -1
  102. package/dist/geo.module.min.js +1 -1
  103. package/dist/network.min.js +1 -1
  104. package/dist/network.module.min.js +1 -1
  105. package/dist/ordinal.min.js +1 -1
  106. package/dist/ordinal.module.min.js +1 -1
  107. package/dist/realtime.min.js +1 -1
  108. package/dist/realtime.module.min.js +1 -1
  109. package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +1 -0
  110. package/dist/semiotic-ai.d.ts +4 -0
  111. package/dist/semiotic-ai.min.js +1 -1
  112. package/dist/semiotic-ai.module.min.js +1 -1
  113. package/dist/semiotic-ordinal.d.ts +5 -0
  114. package/dist/semiotic-statisticalOverlays-DGX_WWc5.js +1 -0
  115. package/dist/semiotic-themes.d.ts +80 -0
  116. package/dist/semiotic-themes.min.js +1 -0
  117. package/dist/semiotic-themes.module.min.js +1 -0
  118. package/dist/semiotic-utils.d.ts +30 -0
  119. package/dist/semiotic-utils.min.js +1 -0
  120. package/dist/semiotic-utils.module.min.js +1 -0
  121. package/dist/semiotic-xy.d.ts +1 -0
  122. package/dist/semiotic.d.ts +11 -5
  123. package/dist/semiotic.min.js +1 -1
  124. package/dist/semiotic.module.min.js +1 -1
  125. package/dist/server.min.js +1 -1
  126. package/dist/server.module.min.js +1 -1
  127. package/dist/xy-statisticalOverlays-C2PPlmXv.js +1 -0
  128. package/dist/xy.min.js +1 -1
  129. package/dist/xy.module.min.js +1 -1
  130. package/package.json +38 -12
  131. package/dist/semiotic-ai-statisticalOverlays-C1f7TYyD.js +0 -1
  132. package/dist/semiotic-statisticalOverlays-C1f7TYyD.js +0 -1
  133. package/dist/xy-statisticalOverlays-C1f7TYyD.js +0 -1
@@ -1 +1 @@
1
- import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as a,useCallback as s,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{scaleOrdinal as h,scaleBand as g,scaleLinear as y}from"d3-scale";import{schemeCategory10 as p,interpolatePlasma as m,interpolateViridis as f,interpolatePurples as v,interpolateOranges as b,interpolateGreens as x,interpolateReds as w,interpolateBlues as A,schemeSet3 as k,schemeTableau10 as S}from"d3-scale-chromatic";import{quantile as j}from"d3-array";import{packEnclose as O}from"d3-hierarchy";import{area as E,curveCatmullRom as P,curveCardinal as M,curveBasis as L,curveStepBefore as C,curveStepAfter as B,curveStep as H,curveMonotoneY as D,curveMonotoneX as _,curveLinear as N,arc as $}from"d3-shape";import z from"regression";class R{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;if(e!==this.lastBoundedData)return;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 I{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}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 W{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 T(e,t,n){return e+(t-e)*n}function q(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function F(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const G={category10:p,tableau10:S,set3:k,blues:A,reds:w,greens:x,oranges:b,purples:v,viridis:f,plasma:m},V=p,X=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Y=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 Q(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")||Y.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):V[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+""))%V.length]}function K(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return h().domain(o).range(n).unknown("#999");const i=G[n]||G.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:V;return h().domain(o).range(e).unknown("#999")}}function Z(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function U(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function J(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=j(e,.25))&&void 0!==t?t:i,median:null!==(n=j(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=j(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}const ee={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize;for(const e of Object.values(o)){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+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[i,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=s(c.pieces[0],a?i:e.name),p=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),a=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(Z(e.x,n,e.width,Math.abs(a),y,p,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),a=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(Z(n,e.x,Math.abs(a),e.width,y,p,i)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,l=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let i=0;d.length>i;i++){const h=l.get(d[i])||[];for(const l of h){const h=r(l),g=a(l,d[i]);if(u){const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(Z(r,Math.min(a,u),o,Math.abs(a-u),g,l,d[i]))}else{const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(Z(Math.min(a,u),r,Math.abs(u-a),o,g,l,d[i]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,y=s.length>0,p=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=y&&s[r]||c,f=l(t,e.name),v=f.r||5;let b,x;if(g){const t=m+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:f,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),y=c?a(s):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:U,donut:U,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,y=[],p="vertical"===g,m=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=j(t,.25))&&void 0!==n?n:s,g=null!==(o=j(t,.5))&&void 0!==o?o:(s+l)/2,f=null!==(r=j(t,.75))&&void 0!==r?r:l,v=f-c,b=c-1.5*v,x=f+1.5*v,w=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,A=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,k=d(e.pieceData[0],e.name),S=[];if(m)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=p?e.middle:h(n),r=p?h(n):e.middle;S.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(g),q3Pos:h(f),maxPos:h(A),stats:{n:t.length,min:w,q1:c,median:g,q3:f,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:k,datum:e.pieceData,category:e.name,outliers:S}),m)for(const e of S)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:k.fill||"#999",opacity:.6},datum:e.datum})}return y},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,y=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],s=(a-i)/y||1,d=Array(y).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),y-1)]++;const m=Math.max(...d,1),f=e.width/2*.9;let v="";if(g){for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/m*f;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/m*f} ${n}`}v+=" Z"}else{for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/m*f;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/m*f}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=j(t,.25))&&void 0!==n?n:i,l=null!==(o=j(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=j(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:J(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,a=s(n+t*o),c=s(n+(t+1)*o);l.push(Z(Math.min(a,c),e.x+e.width-i,Math.abs(c-a),i,g,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),p=s(e.pieceData[0],e.name),m=e.width*g;let f="";if(h){const t=e.x+e.width;f=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)f+=` L ${l(o+(e+.5)*i)} ${t-c[e]/y*m}`;f+=` L ${l(r)} ${t} Z`}else{const t=e.x;f=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);f+=` L ${t+c[e]/y*m} ${n}`}f+=` 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:f,translateX:0,translateY:0,bounds:v,stats:J(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(Z(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(Z(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class te{constructor(e){this.rExtent=new W,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.config=e,this.buffer=new I(e.windowSize),this.getO=F(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>q(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new W)):(this.getR=q(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=F(e.stackBy),this.getGroup=F(e.groupBy),this.getColor=F(e.colorAccessor),this.getConnector=F(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new I(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),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.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=g().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=y().domain(a).range([o,n])}else s?(c=g().domain(i).range([0,e.height]).padding(l),u=y().domain(a).range([0,e.width])):(c=g().domain(i).range([0,e.width]).padding(l),u=y().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[a,l]=i.extent;a===1/0&&(a=0,l=1);const c=l-a,u=c>0?c*(t.extentPadding||.05):1;return a-=u,l+=u,a>0&&(a=0),s?y().domain([a,l]).range([0,e.width]):y().domain([a,l]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=[];for(const e of t)n.has(e)?o.push(e):this.categories.delete(e);return o}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let a=0,s=0;if("bar"===r&&this.getStack&&this.config.normalize)a=0,s=1;else if("bar"===r&&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>s&&(s=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===r){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>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(a-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(s+=c),"bar"!==r&&"clusterbar"!==r||(a>0&&(a=0),0>s&&(s=0)),[a,s]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=ee[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:X,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){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);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;let o=0;for(let n=0;t.length>n;n++){const r=t[n],s=this.config.oAccessor;if(("function"==typeof s?s(r):r[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;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:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=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 g=!1;const y=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,p);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(y.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(y.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)y.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=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)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=T(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=T(o.x,e._targetX,i),e.y=T(o.y,e._targetY,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=T(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=T(n.x,e._targetX,i),e.y=T(n.y,e._targetY,i),void 0!==n.w&&(e.w=T(n.w,e._targetW,i),e.h=T(n.h,e._targetH,i))}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}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()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!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.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function ne(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function oe(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 re(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function ie(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=ne(Math.atan2(r,o)),s=ne(e.startAngle),l=ne(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function ae(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 se(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}const le={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function ce(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,le[n])(o(e,t)),r}function ue(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function de(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function he({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function ge(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[y,p]=e.useState(0),m=e.useCallback((e,t)=>{g(e),p(t)},[]),f="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,y=[];let p=0;const m=!(!n&&!o),f="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=ce(t,u,d,h),b=de(t,r,i),x=i&&i.size>0&&i.has(t.label);y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:m?l===a&&u===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&f?x||!1:void 0,"aria-current":m&&!f&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:m?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:m?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},m&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(ue,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),y})(t,o,r,i,a,s,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let o=0;t.label&&(o+=16);const y=((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,y=[];let p=0;const m=!(!n&&!o),f="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=ce(t,u,d,h),b=de(t,r,i),x=i&&i.size>0&&i.has(t.label);y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${p},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:m?l===a&&u===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&f?x||!1:void 0,"aria-current":m&&!f&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:m?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)+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:m?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},m&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(ue,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=26+7*t.label.length}),{items:y,offset:p}})(t,r,i,a,s,l,c,n,u,d);o+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:o})),h+=o+12});let y=Math.max(0,(o-h)/2);const p=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(p.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),y+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${y},0)`},o.items)),y+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:y,y1:-8,x2:y,y2:n+0+8})),y+=12}),e.createElement("g",null,p)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:s}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend"},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),f)}function ye(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function pe(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 me(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:y,events:p={},"data-testid":m}=t,f=new Set(Array.isArray(y)?y:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":m},p),!f.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!f.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:pe((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||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,h,n,o),!f.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const y=16,p=a?u?[a]:ye(a,c):[],m=i?u?[i]:ye(i,c):[],f="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:f,dy:0===n?0:y},t)))),v=p.length*y),m.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},m.map((t,n)=>e.createElement("tspan",{key:n,x:f,dy:0===n?0:y},t))));let x=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(p.length+m.length)*y+(m.length>0?y:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const w=Math.max(0,p.length+m.length-1)*y;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+y+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),x)}(l,v,b,h))}function fe(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(me,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(me,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}const ve={linear:N,monotoneX:_,monotoneY:D,step:H,stepAfter:B,stepBefore:C,basis:L,cardinal:M,catmullRom:P};function be(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 xe(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 we(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=be(e,n),c=xe(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Ae(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function ke(t){const{width:n,height:o,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,h="radial"===(null==l?void 0:l.projection),g="horizontal"===(null==l?void 0:l.projection),y=r(()=>!l||h?[]:l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(d||Se)(e)})),[l,d,h]),p=u&&l&&!h,m=c&&l&&!h;return p||m?e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},p&&e.createElement("g",{className:"ordinal-grid"},y.map((t,r)=>e.createElement("line",{key:"grid-"+r,x1:g?t.pixel:0,y1:g?0:t.pixel,x2:g?t.pixel:n,y2:g?o:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,g?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Se(e){return Math.round(100*e)/100+""}function je(n){var o,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,oLabel:g,rLabel:y,oFormat:p,rFormat:m,showGrid:f,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:k,legendPosition:S="right",foregroundGraphics:j,annotations:P,svgAnnotationRules:M,xAccessor:L,yAccessor:C,annotationData:B,underlayRendered:H,children:D}=n,_="radial"===(null==d?void 0:d.projection),$="horizontal"===(null==d?void 0:d.projection),R=r(()=>h&&d&&!_?d.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2,label:p?p(e):e}}):[],[h,d,p,_]),I=r(()=>h&&d&&!_?d.r.ticks(5).map(e=>({value:e,pixel:d.r(e),label:(m||Se)(e)})):[],[h,d,m,_]),W=t(new Map),T=t(null!==(o=null==P?void 0:P.length)&&void 0!==o?o:0),q=null!==(i=null==P?void 0:P.length)&&void 0!==i?i:0;T.current!==q&&(T.current=q,W.current=new Map);const F=r(()=>{if(!P||0===P.length)return null;const t=function(t,n,o){var r,i,a,s,l,c,u,d,h,g,y,p,m,f,v,b,x,w,A,k,S,j,P,M,L,C,B,H,D,_,$,R,I,W,T,q,F,G,V,X,Y,Q,K,Z;switch(t.type){case"label":{const r=we(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Ae(i,a,o)?e.createElement(fe,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=we(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Ae(i,a,o)?e.createElement(fe,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=be(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=xe(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:be(Object.assign(Object.assign({},e),{type:"point"}),o),y:xe(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=O(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:be(Object.assign(Object.assign({},e),{type:"point"}),o),y:xe(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a=t.style||{stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=be(n,o),s=xe(n,o);return null==i||null==s?null:e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:t.r||6},a))}))}case"bracket":{const r=be(t,o),i=xe(t,o);return e.createElement(fe,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",y=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const p=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,m=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!p||!m)return null;const f=t.method||"linear";let v;v="loess"===f?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,y=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],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*y-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(y,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===f?z.polynomial(y,{order:t.order||2}):z.linear(y)).points;const b=v.map(([e,t])=>`${p(e)},${m(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:p(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(y=null==r?void 0:r(t.y0))&&void 0!==y?y:0,a=null!==(p=null==r?void 0:r(t.y1))&&void 0!==p?p:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"#6366f1",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",a=null!==(f=null===(m=o.scales)||void 0===m?void 0:m.x)&&void 0!==f?f:null===(v=o.scales)||void 0===v?void 0:v.time,s=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.value;if(!a||!s)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=ve[o.curve||"linear"]||N,g=E().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const y=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:y,fillOpacity:null!==(A=t.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:y,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(S=null===(k=o.scales)||void 0===k?void 0:k.x)&&void 0!==S?S:null===(j=o.scales)||void 0===j?void 0:j.time,s=null!==(M=null===(P=o.scales)||void 0===P?void 0:P.y)&&void 0!==M?M:null===(L=o.scales)||void 0===L?void 0:L.value;if(!a||!s)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(C=t.threshold)&&void 0!==C?C:2,g=c-h*d,y=!1!==t.showBand,p=t.fill||"#6366f1",m=null!==(B=t.fillOpacity)&&void 0!==B?B:.1,f=t.anomalyColor||"#ef4444",v=null!==(H=t.anomalyRadius)&&void 0!==H?H:6,b=s(c+h*d),x=s(g),w=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},y&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:m}),w.map((t,n)=>{const r=be(t,o),i=xe(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:f,fillOpacity:.7,stroke:f,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(_=null===(D=o.scales)||void 0===D?void 0:D.x)&&void 0!==_?_:null===($=o.scales)||void 0===$?void 0:$.time,l=null!==(I=null===(R=o.scales)||void 0===R?void 0:R.y)&&void 0!==I?I:null===(W=o.scales)||void 0===W?void 0:W.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=z.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),y=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(T=t.confidence)&&void 0!==T?T:.95,f=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(q=t.steps)&&void 0!==q?q:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const A=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-y,2)/p:0))*f;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const k=`M${A.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),j=`${s(b)},${l(u(b))}`,O=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:k,fill:t.fill||"#6366f1",fillOpacity:null!==(F=t.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),e.createElement("polyline",{points:`${j} ${S}`,fill:"none",stroke:O,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&A.length>0&&e.createElement("text",{x:s(A[A.length-1].x)+4,y:l(A[A.length-1].yCenter)-4,fill:O,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=we(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ae(r,i,o))return null;const a=null!==(X=t.dx)&&void 0!==X?X:0,s=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(Q=t.width)&&void 0!==Q?Q:32,c=null!==(K=t.height)&&void 0!==K?K:32,u=null!==(Z=t.content)&&void 0!==Z?Z:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=we(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}default:return null}},n="horizontal"===(null==d?void 0:d.projection),o=(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,r={scales:d?{x:n?d.r:o||d.r,y:n&&o||d.r,time:d.r,value:d.r}:null,timeAxis:"x",xAccessor:L,yAccessor:C,width:a,height:s,data:B,frameType:"ordinal",stickyPositionCache:W.current};return P.map((e,n)=>{if(M){const o=M(e,n,r);return null!=o?o:t(e,n,r)}return t(e,n,r)}).filter(Boolean)},[P,M,a,s,d,L,C,B]);return h||v||b||j||F&&F.length>0||f||D?e.createElement("svg",{role:"img",width:l,height:c,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof v?v:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof v?v+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},f&&d&&!_&&!H&&e.createElement("g",{className:"ordinal-grid"},I.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:$?t.pixel:0,y1:$?0:t.pixel,x2:$?t.pixel:a,y2:$?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!_&&e.createElement("g",{className:"ordinal-axes"},$?e.createElement(e.Fragment,null,!H&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),R.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),g&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},g),!H&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),y&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):e.createElement(e.Fragment,null,!H&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),R.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),g&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},g),!H&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),y&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},y))),F,j,D),v&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof v?v:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===a||"bottom"===a;let y,p;return"left"===a?(y=4,p=i.top):"top"===a?(y=0,p=s?32:8):"bottom"===a?(y=0,p=r-i.bottom+50):(y=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${y}, ${p})`},"object"==typeof(m=n)&&null!==m&&"gradient"in m?e.createElement(he,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(ge,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var m}({legend:b,totalWidth:l,totalHeight:c,margin:u,legendPosition:S,title:v,legendHoverBehavior:x,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:k})):null}const Oe="undefined"==typeof window||"undefined"==typeof document,Ee={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Pe(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"},i=["point","line","area","rect","heatcell","circle","candlestick"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function Me({scene:t,chartType:n}){var o,r,i,a;const s=[];for(const e of t){if(s.length>=50)break;"point"===e.type?s.push({label:"Point",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+""}}):"rect"===e.type?s.push({label:"Bar",values:{category:(null===(o=e.datum)||void 0===o?void 0:o.category)||"",value:Math.round(100*(null!==(i=null===(r=e.datum)||void 0===r?void 0:r.value)&&void 0!==i?i:0))/100+""}}):"heatcell"===e.type&&s.push({label:"Cell",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+"",value:Math.round(100*(null!==(a=e.value)&&void 0!==a?a:0))/100+""}})}if(0===s.length)return null;const l=new Set;for(const e of s)for(const t of Object.keys(e.values))l.add(t);const c=Array.from(l);return e.createElement("table",{style:Ee,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,c.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,s.map((t,n)=>e.createElement("tr",{key:n},c.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:c.length},"...and ",t.length-50," more items"))))}function Le({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:Ee},n)}function Ce(n){const o=i(null),c=Be(n);return[function({children:t}){const i=r(()=>Be(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=a(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=s(()=>i.current(r.getState()),[r]),d=s(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,d)}]}function Be(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)}}}const He={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},De={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[_e,Ne]=Ce(e=>({theme:He,setTheme(t){e(e=>"light"===t?{theme:He}:"dark"===t?{theme:De}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}}));function $e(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ze(e,t,n=.3){$e(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 Re(e,t,n=.6){var o,r,i,a,s;if(!$e(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ie(e,t,n,o=.35){$e(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const We=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?Te(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),ze(e,t),e.globalAlpha=1};function Te(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}const qe=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);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=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Re(e,t),e.globalAlpha=1}}finally{e.restore()}};function Fe(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()}const Ge=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)Fe(e,t),e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(Fe(e,t),Ie(e,t)),e.globalAlpha=1},Ve=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=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()}},Xe=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},Ye=e=>[Xe,...e],Qe={bar:Ye([We]),clusterbar:Ye([We]),point:Ye([qe]),swarm:Ye([qe]),pie:[Ge],donut:[Ge],boxplot:Ye([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},qe]),violin:Ye([Ve]),histogram:Ye([We]),ridgeline:Ye([Ve]),timeline:Ye([We])},Ke={top:50,right:40,bottom:60,left:70},Ze={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 Ue({hover:t}){var n,o,r,i,a,s;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:Ze},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:Ze},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:Ze},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Ze},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const y=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(s=null!==(a=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==a?a:l.pct)&&void 0!==s?s:"";if(!y&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Ze},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:Ze},y&&e.createElement("div",{style:{fontWeight:"bold"}},y+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const Je=c(function(i,a){var l,c,d,h,g,y,p;const{chartType:m,runtimeMode:f,data:v,oAccessor:b="category",rAccessor:x="value",colorAccessor:w,stackBy:A,groupBy:k,multiAxis:S,timeAccessor:j,valueAccessor:O,categoryAccessor:E,projection:P="vertical",size:M=[600,400],responsiveWidth:L,responsiveHeight:C,margin:B,barPadding:H,innerRadius:D,normalize:_,startAngle:N,dynamicColumnWidth:z,bins:I,showOutliers:W,showIQR:T,amplitude:q,connectorAccessor:F,connectorStyle:G,rExtent:V,oExtent:X,extentPadding:Y=.05,oSort:Q,windowMode:K="sliding",windowSize:Z=200,pieceStyle:U,summaryStyle:J,colorScheme:ee,barColors:ne,showAxes:le=!0,oLabel:ce,rLabel:ue,oFormat:de,rFormat:he,enableHover:ge=!0,hoverAnnotation:ye,tooltipContent:pe,customHoverBehavior:me,annotations:fe,svgAnnotationRules:ve,showGrid:be=!1,legend:xe,legendHoverBehavior:we,legendClickBehavior:Ae,legendHighlightedCategory:Se,legendIsolatedCategories:Ee,legendPosition:Ce,backgroundGraphics:Be,foregroundGraphics:He,title:De,className:_e,background:$e,centerContent:ze,decay:Re,pulse:Ie,transition:We,staleness:Te,accessibleTable:qe}=i,[Fe,Ge]=function(e,r,i){const a=t(null),[s,l]=n(null);return o(()=>{if(!r&&!i)return;const e=a.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[r,i]),[a,[r&&s?s.w:e[0],i&&s?s.h:e[1]]]}(M,L,C),Ve=r(()=>Object.assign(Object.assign({},Ke),B),[B]),Xe=Ge[0]-Ve.left-Ve.right,Ye=Ge[1]-Ve.top-Ve.bottom,Ze="function"==typeof He?He({size:Ge,margin:Ve}):He,Je=t(null),et=t(!0),tt=Ne(e=>e.theme),nt=t(0),ot=t(null),rt=t(()=>{}),[it,at]=n(null),[st,lt]=n(null),[ct,ut]=n(0),[dt,ht]=n(!1),gt=ge||ye,yt="streaming"===f,pt=r(()=>({chartType:m,runtimeMode:yt?"streaming":"bounded",windowSize:Z,windowMode:K,extentPadding:Y,projection:P,oAccessor:yt?void 0:b,rAccessor:yt?void 0:x,colorAccessor:w,stackBy:A,groupBy:k,multiAxis:S,timeAccessor:yt?j:void 0,valueAccessor:yt?O||("string"==typeof x||"function"==typeof x?x:void 0):void 0,categoryAccessor:yt?E||b:void 0,rExtent:V,oExtent:X,barPadding:H,innerRadius:D,normalize:_,startAngle:N,dynamicColumnWidth:z,bins:I,showOutliers:W,showIQR:T,amplitude:q,connectorAccessor:F,connectorStyle:G,oSort:Q,pieceStyle:U,summaryStyle:J,colorScheme:ee,barColors:ne,decay:Re,pulse:Ie,transition:We,staleness:Te}),[m,Z,K,Y,P,b,x,w,A,k,S,j,O,E,V,X,H,D,_,N,z,I,W,T,q,F,G,Q,U,J,ee,ne,Re,Ie,We,Te,yt]),mt=t(null);mt.current||(mt.current=new te(pt));const ft=s(()=>{nt.current||(nt.current=requestAnimationFrame(()=>rt.current()))},[]);o(()=>{var e;null===(e=mt.current)||void 0===e||e.updateConfig(pt),et.current=!0,ft()},[pt,ft]),o(()=>{et.current=!0,ft()},[tt,ft]);const vt=t(null);vt.current||(vt.current=new R(e=>{const t=mt.current;t&&t.ingest(e)&&(et.current=!0,ft())}));const bt=s(e=>{var t;null===(t=vt.current)||void 0===t||t.push(e)},[]),xt=s(e=>{var t;null===(t=vt.current)||void 0===t||t.pushMany(e)},[]),wt=s(()=>{var e,t;null===(e=vt.current)||void 0===e||e.clear(),null===(t=mt.current)||void 0===t||t.clear(),et.current=!0,ft()},[ft]);u(a,()=>({push:bt,pushMany:xt,clear:wt,getData:()=>{var e,t,n;return null===(e=vt.current)||void 0===e||e.flush(),null!==(n=null===(t=mt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=mt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[bt,xt,wt]),o(()=>{var e;v&&(null===(e=vt.current)||void 0===e||e.setBoundedData(v))},[v]);const At=t(()=>{}),kt=t(()=>{});At.current=e=>{if(!gt)return;const t=Je.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ve.left,r=e.clientY-n.top-Ve.top;if(0>o||o>Xe||0>r||r>Ye)return void(ot.current&&(ot.current=null,at(null),me&&me(null),ft()));const i=mt.current;if(!i||0===i.scene.length)return;const a="radial"===P,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=oe(i,t,n);break;case"point":e=re(i,t,n);break;case"wedge":e=ie(i,t,n);break;case"boxplot":e=ae(i,t,n);break;case"violin":e=se(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-Xe/2:o,a?r-Ye/2:r);if(!s)return void(ot.current&&(ot.current=null,at(null),me&&me(null),ft()));const l=s.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,time:s.x,value:s.y,x:s.x,y:s.y}),s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:m});ot.current=c,at(c),me&&(me(c),et.current=!0),ft()},kt.current=()=>{ot.current&&(ot.current=null,at(null),me&&(me(null),et.current=!0),ft())},s(e=>At.current(e),[]);const St=s(()=>kt.current(),[]),jt=t(-1),Ot=s(e=>{const t=mt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x)t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum});else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum});else if("wedge"===n.type&&null!=n.cx){const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=jt.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return jt.current=-1,ot.current=null,at(null),me&&me(null),void ft();const i=0>o?0:r;jt.current=i;const a=Object.assign(Object.assign({},function(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})}(n[i])),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:m});ot.current=a,at(a),me&&me(a),ft()},[me,ft]),Et=s(e=>{jt.current=-1,At.current(e)},[]);rt.current=()=>{var e,t;nt.current=0;const n=Je.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=mt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=et.current;s&&!a&&(r.computeScene({width:Xe,height:Ye}),et.current=!1),(s||a)&&n.setAttribute("aria-label",Pe(r.scene,m+" chart"));const l="undefined"!=typeof window&&window.devicePixelRatio||1,c=Ge[0]*l,u=Ge[1]*l;n.width===c&&n.height===u||(n.width=c,n.height=u,n.style.width=Ge[0]+"px",n.style.height=Ge[1]+"px"),o.setTransform(l,0,0,l,0,0),o.clearRect(0,0,Ge[0],Ge[1]);const d=null!==(e=null==Te?void 0:Te.threshold)&&void 0!==e?e:5e3,h=Te&&r.lastIngestTime>0&&i-r.lastIngestTime>d;h&&(o.globalAlpha=null!==(t=null==Te?void 0:Te.dimOpacity)&&void 0!==t?t:.5);const g=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",y=$e||(g&&"transparent"!==g?g:null);y&&(o.fillStyle=y,o.fillRect(0,0,Ge[0],Ge[1]));const p="radial"===P;p?(o.save(),o.translate(Ve.left+Xe/2,Ve.top+Ye/2)):o.translate(Ve.left,Ve.top);const f=Qe[m]||[],v={width:Xe,height:Ye};for(const e of f)e(o,r.scene,r.scales,v);p&&o.restore(),h&&(o.globalAlpha=1),s&&r.scales&&(lt(r.scales),ut(e=>e+1)),(null==Te?void 0:Te.showBadge)&&ht(!!h),(a||r.hasActivePulses)&&(nt.current=requestAnimationFrame(()=>rt.current()))},o(()=>(ft(),()=>{nt.current&&(cancelAnimationFrame(nt.current),nt.current=0)}),[ft]),o(()=>{et.current=!0,ft()},[m,Xe,Ye,le,$e,ft]),function(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(Te,mt,et,ft,dt,ht);const Pt=gt&&it?pe?pe(it):e.createElement(Ue,{hover:it}):null,Mt="radial"===P,Lt=it?Mt?it.x+Xe/2:it.x:0,Ct=it?Mt?it.y+Ye/2:it.y:0,Bt=Pt?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Ve.left+Lt,top:Ve.top+Ct,transform:`translate(${Lt>.7*Xe?"calc(-100% - 12px)":"12px"}, ${.3*Ye>Ct?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},Pt):null;if(Oe){const t=mt.current;t&&v&&(t.ingest({inserts:v,bounded:!0}),t.computeScene({width:Xe,height:Ye}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===P,i=r?Ve.left+Xe/2:Ve.left,a=r?Ve.top+Ye/2:Ve.top;return e.createElement("div",{className:"stream-ordinal-frame"+(_e?" "+_e:""),role:"img","aria-label":"string"==typeof De?De:"Ordinal chart",style:{position:"relative",width:Ge[0],height:Ge[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ge[0],height:Ge[1],style:{position:"absolute",left:0,top:0}},Be&&e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},Be),e.createElement("g",{transform:`translate(${i},${a})`},$e&&e.createElement("rect",{x:0,y:0,width:Xe,height:Ye,fill:$e}),n.map((t,n)=>function(t,n){var o,r,i,a,s;const l=t.category||t.group||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":return e.createElement("rect",{key:u,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.style.fill||"#4e79a7",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"point":return e.createElement("circle",{key:u,cx:t.x,cy:t.y,r:t.r,fill:t.style.fill||"#4e79a7",opacity:null!==(o=t.style.opacity)&&void 0!==o?o:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth});case"wedge":{const n=t,o=$().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return e.createElement("path",{key:u,d:o,transform:`translate(${n.cx},${n.cy})`,fill:n.style.fill||"#4e79a7",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:n.style.fill||"#4e79a7",fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:n.style.fill||"#4e79a7",fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:n.style.fill||"#4e79a7",fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.5});default:return null}}(t,n)).filter(Boolean))),e.createElement(je,{width:Xe,height:Ye,totalWidth:Ge[0],totalHeight:Ge[1],margin:Ve,scales:o,showAxes:le,oLabel:ce,rLabel:ue,oFormat:de,rFormat:he,showGrid:be,title:De,legend:xe,legendHoverBehavior:we,legendClickBehavior:Ae,legendHighlightedCategory:Se,legendIsolatedCategories:Ee,legendPosition:Ce,foregroundGraphics:Ze,annotations:fe,svgAnnotationRules:ve,annotationFrame:0,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null==t?void 0:t.getData()}),ze&&"radial"===P&&e.createElement("div",{style:{position:"absolute",left:Ve.left+Xe/2,top:Ve.top+Ye/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ze))}return e.createElement("div",{ref:Fe,className:"stream-ordinal-frame"+(_e?" "+_e:""),role:"img","aria-label":"string"==typeof De?De:"Ordinal chart",tabIndex:0,style:{position:"relative",width:L?"100%":Ge[0],height:C?"100%":Ge[1],overflow:"visible"},onMouseMove:gt?Et:void 0,onMouseLeave:gt?St:void 0,onKeyDown:Ot},Be&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Ge[0],height:Ge[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Ve.left},${Ve.top})`},Be)),e.createElement(ke,{width:Xe,height:Ye,totalWidth:Ge[0],totalHeight:Ge[1],margin:Ve,scales:st,showAxes:le,showGrid:be,rFormat:he}),e.createElement("canvas",{ref:Je,"aria-label":Pe(null!==(h=null===(d=mt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],m+" chart"),style:{position:"absolute",top:0,left:0,width:Ge[0],height:Ge[1]}}),e.createElement(Le,{hoverPoint:it}),qe&&e.createElement(Me,{scene:null!==(y=null===(g=mt.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:m+" chart"}),e.createElement(je,{width:Xe,height:Ye,totalWidth:Ge[0],totalHeight:Ge[1],margin:Ve,scales:st,showAxes:le,oLabel:ce,rLabel:ue,oFormat:de,rFormat:he,showGrid:be,title:De,legend:xe,legendHoverBehavior:we,legendClickBehavior:Ae,legendHighlightedCategory:Se,legendIsolatedCategories:Ee,legendPosition:Ce,foregroundGraphics:Ze,annotations:fe,svgAnnotationRules:ve,annotationFrame:ct,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null===(p=mt.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),ze&&"radial"===P&&e.createElement("div",{style:{position:"absolute",left:Ve.left+Xe/2,top:Ve.top+Ye/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ze),(null==Te?void 0:Te.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Te.badgePosition?{top:4,left:4}:"bottom-left"===Te.badgePosition?{bottom:4,left:4}:"bottom-right"===Te.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:dt?"#dc3545":"#28a745",color:"white"})},dt?"STALE":"LIVE"),Bt)});Je.displayName="StreamOrdinalFrame";const et=i(null);function tt(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 nt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[ot,rt]=Ce(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=nt(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=nt(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}})}})),[it,at]=Ce(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function st(e){const t=d(),n=e.clientId||t,{name:o}=e,i=rt(e=>e.selections.get(o)),a=rt(e=>e.setClause),l=rt(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(tt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:s(()=>{l(o,n)},[l,o,n]),clientId:n}}const lt=i(!1);function ct({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){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:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}}),label:""}]}}function ut(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:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const dt="#007bff";function ht(e,t,n){return r(()=>{if(!t)return e;const o=[...e];if("function"==typeof t)return o.sort(t);const r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}const gt={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 yt(e,t,n){var o,r,i,a,s,l;const c=gt[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const pt={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function mt(e,t){return"function"==typeof t?t(e):e[t]}function ft(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 vt(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=mt(t,o);s=ft(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=mt(t,o);l.push({label:n,value:ft(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=ft(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=ft(t[e[0]],r))}}const c=Object.assign(Object.assign({},pt),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function bt(t){if(!0===t)return vt();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:pt},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?vt(t):vt())}function xt(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function wt(e,t){return"function"==typeof t?t(e):e[t]}function At({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return a=>{var s;const l=i?(null===(s=a.data)||void 0===s?void 0:s[0])||a.data||a:a.data||a,c=wt(l,t),u=wt(l,n),d=o?wt(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:pt},e.createElement("div",{style:{fontWeight:"bold"}},xt(c)),e.createElement("div",{style:{marginTop:4}},xt(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||("string"==typeof(h=o)?h:"value"),": ",xt(d)));var h}}function kt({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class St extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(kt,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function jt(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ot(e,t,n=3){let o,r=n+1;for(const n of t){const t=jt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Et(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Pt(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=Ot(e,t,3))&&void 0!==n?n:null)}function Mt({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=Et(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=Pt(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Lt={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"]},frameProps:{type:"object"}},Ct={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Bt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},Ht=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Dt=["vertical","horizontal"],_t={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Ct),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ht},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({},Lt),Ct),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ht},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Ct),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ht},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({},Lt),Ct),{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({},Lt),Ct),{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({},Lt),Ct),{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({},Lt),Ct),{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"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Ct),{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({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Dt},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Dt},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Dt},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Dt},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Dt},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Dt},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Lt),Bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Dt},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Lt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Lt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Lt),{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({},Lt),{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:Dt},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({},Lt),{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({},Lt),{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({},Lt),{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({},Lt),{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({},Lt),{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"},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"}}}};function Nt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const $t=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),zt=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Rt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),It=new Set(["LineChart","AreaChart","StackedAreaChart"]),Wt=new Set(["BarChart","StackedBarChart","GroupedBarChart"]);function Tt(e,t){const n=[],o=function(e,t){const n=[],o=_t[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(_t).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(!Nt(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=Ot(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=Mt({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}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=Et(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=Pt(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 _t[e]?(function(e,t,n){const o=_t[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=_t[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){$t.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){zt.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=_t[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Rt.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(!It.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=_t[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!Wt.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),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var qt;const Ft="undefined"!=typeof process&&"production"!==(null===(qt=process.env)||void 0===qt?void 0:qt.NODE_ENV);function Gt({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(St,{fallback:i=>{let a="";if(Ft&&r)try{const e=Tt(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(kt,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const Vt={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"},Xt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Yt(e,t,n,o){if(!Ft)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 Qt(t){const{data:o,rawData:i,colorBy:l,colorScheme:c,legendInteraction:u,legendPosition:d,selection:h,linkedHover:g,fallbackFields:y,unwrapData:p=!1,onObservation:m,chartType:f,chartId:v,showLegend:b,userMargin:x,marginDefaults:w,loading:A,emptyContent:k,width:S,height:j}=t,{activeSelectionHook:O,customHoverBehavior:E,customClickBehavior:P}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:a}){const l=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}:null}(t,n),c=st({name:(null==e?void 0:e.name)||"__unused__"}),u=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=st({name:t});return{onHover:s(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||n||[]}),d=at(e=>e.pushObservation),h=e?{isActive:c.isActive,predicate:c.predicate}:null,g=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),d&&d(e)}}},[t,u,r,i,a,d]),y=s(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,i,a]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:y}}({selection:h,linkedHover:g,fallbackFields:y,unwrapData:p,onObservation:m,chartType:f,chartId:v}),M=function(e,t,n="category10"){const o=a(et);return r(()=>{if(t){if(0===e.length)return o&&Object.keys(o).length>0?e=>o[e]||"#999":void 0;if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));return o&&Object.keys(o).length>0?e=>o[e]||"#999":K(r.map(e=>({_cat:e})),"_cat",n)}if(o&&Object.keys(o).length>0){const r=K(e,t,n);return e=>o[e]||r(e)}return K(e,t,n)}},[e,t,n,o])}(o,l,c),L=r(()=>{if(!l)return[];const e=new Set;for(const t of o){const n="function"==typeof l?l(t):t[l];null!=n&&e.add(n+"")}return Array.from(e)},[o,l]),C=function(e,t,o){const[i,a]=n(null),[l,c]=n(new Set),u=s(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}(u,l,L),B=r(()=>C.legendSelectionHook?C.legendSelectionHook:O,[C.legendSelectionHook,O]),{legend:H,margin:D,legendPosition:_}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40}}){const c=a(lt),u=void 0!==o?o:!c&&!!t,d=r(()=>{if(u&&t)return ct({data:e,colorBy:t,colorScale:n,getColor:Q})},[u,t,e,n]),h=r(()=>{const e=Object.assign(Object.assign({},l),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},[l,s,d,i]);return{legend:d,margin:h,legendPosition:i}}({data:o,colorBy:l,colorScale:M,showLegend:b,legendPosition:d,userMargin:x,defaults:w}),N=r(()=>{const e={};return H&&(e.legend=H,e.legendPosition=_),u&&"none"!==u&&(e.legendHoverBehavior=C.onLegendHover,e.legendClickBehavior=C.onLegendClick,e.legendHighlightedCategory=C.highlightedCategory,e.legendIsolatedCategories=C.isolatedCategories),e},[H,_,u,C.onLegendHover,C.onLegendClick,C.highlightedCategory,C.isolatedCategories]),$=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Xt),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}(A,S,j),z=$?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Vt),{width:n,height:o})},r||"No data available"):null}(i,S,j,k);return{colorScale:M,allCategories:L,legendState:C,effectiveSelectionHook:B,activeSelectionHook:O,customHoverBehavior:E,customClickBehavior:P,legend:H,margin:D,legendPosition:_,earlyReturn:$||z||null,legendBehaviorProps:N}}const Kt=c(function(n,o){const i=yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:y,colorBy:p,colorScheme:m="category10",sort:f=!1,barPadding:v=40,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:S,chartId:j,loading:O,emptyContent:E,legendInteraction:P,legendPosition:M}=n,L=i.width,C=i.height,B=i.enableHover,H=i.showGrid,D=i.title,_=i.categoryLabel,N=i.valueLabel,$=s||[],z=Qt({data:$,rawData:s,colorBy:p,colorScheme:m,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:S,chartType:"BarChart",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:E,width:L,height:C});if(z.earlyReturn)return z.earlyReturn;Yt("BarChart",$,"categoryAccessor",d),Yt("BarChart",$,"valueAccessor",h);const R=ht($,f,h),I=r(()=>e=>{const t={};return t.fill=p?Q(e,p,z.colorScale):dt,t},[p,z.colorScale]),W=r(()=>ut(I,z.effectiveSelectionHook,A),[I,z.effectiveSelectionHook,A]),T=r(()=>At({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group"}),[d,h,p]),q=Mt({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(q)return e.createElement(kt,{componentName:"BarChart",message:q,width:L,height:C});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:R}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:W,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:z.margin,barPadding:v,enableHover:B,showAxes:i.showAxes,oLabel:_,rLabel:N,rFormat:y,showGrid:H,oSort:f}),z.legendBehaviorProps),D&&{title:D}),c&&{className:c}),{tooltipContent:!1===b?()=>null:bt(b)||T}),(k||S)&&{customHoverBehavior:z.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Gt,{componentName:"BarChart",width:L,height:C},e.createElement(Je,Object.assign({ref:a},F)))});function Zt({isPushMode:e,colorBy:o,colorScheme:i,showLegend:a,legendPosition:l="right"}){const c=t(new Set),u=t([]),[d,h]=n(0),g=s(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),y=s(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),p=s(e=>t=>{y([t]),e(t)},[y]),m=s(e=>t=>{y(t),e(t)},[y]),f=s(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:X,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const s="string"==typeof o?o:"__streamCat";return ct({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>r.get(e)||"#999",getColor:Q})},[e,o,a,i,d]),b=r(()=>{if(v)return"right"===l?{right:110}:"left"===l?{left:110}:"top"===l?{top:50}:"bottom"===l?{bottom:80}:{right:110}},[v,l]);return{wrapPush:p,wrapPushMany:m,resetCategories:f,streamingLegend:v,streamingMarginAdjust:b}}Kt.displayName="BarChart";const Ut=c(function(n,o){const i=yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null),{data:l,margin:c,className:d,categoryAccessor:h="category",stackBy:g,valueAccessor:y="value",orientation:p="vertical",valueFormat:m,colorBy:f,colorScheme:v="category10",normalize:b=!1,barPadding:x=40,tooltip:w,annotations:A,frameProps:k={},selection:S,linkedHover:j,onObservation:O,chartId:E,loading:P,emptyContent:M,legendInteraction:L,legendPosition:C}=n,B=i.width,H=i.height,D=i.enableHover,_=i.showGrid,N=i.showLegend,$=i.title,z=i.categoryLabel,R=i.valueLabel,I=l||[],W=f||g,T=Zt({isPushMode:void 0===l,colorBy:W,colorScheme:v,showLegend:N,legendPosition:C}),q=s(T.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[T.wrapPush]),F=s(T.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[T.wrapPushMany]);u(o,()=>({push:q,pushMany:F,clear:()=>{var e;T.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[q,F,T.resetCategories]);const G=Qt({data:I,rawData:l,colorBy:W,colorScheme:v,legendInteraction:L,legendPosition:C,selection:S,linkedHover:j,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:O,chartType:"StackedBarChart",chartId:E,showLegend:N,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:B,height:H});if(G.earlyReturn)return G.earlyReturn;const V=r(()=>e=>W?G.colorScale?{fill:Q(e,W,G.colorScale)}:{}:{fill:dt},[W,G.colorScale]),X=r(()=>ut(V,G.effectiveSelectionHook,S),[V,G.effectiveSelectionHook,S]),Y=r(()=>At({categoryAccessor:g,valueAccessor:y,groupAccessor:h}),[g,h,y]),K=Mt({componentName:"StackedBarChart",data:l,accessors:{categoryAccessor:h,valueAccessor:y},requiredProps:{stackBy:g}});if(K)return e.createElement(kt,{componentName:"StackedBarChart",message:K,width:B,height:H});const Z=r(()=>T.streamingLegend?Object.assign(Object.assign({},G.legendBehaviorProps),{legend:T.streamingLegend,legendPosition:C||G.legendPosition}):G.legendBehaviorProps,[G.legendBehaviorProps,G.legendPosition,T.streamingLegend,C]),U=r(()=>{if(T.streamingMarginAdjust){const e=Object.assign({},G.margin);for(const[t,n]of Object.entries(T.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return G.margin},[G.margin,T.streamingMarginAdjust]),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:I}),{oAccessor:h,rAccessor:y,stackBy:g,normalize:b,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:X,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U,barPadding:x,enableHover:D,showAxes:i.showAxes,oLabel:z,rLabel:R,rFormat:m,showGrid:_}),Z),$&&{title:$}),d&&{className:d}),{tooltipContent:!1===w?()=>null:bt(w)||Y}),(j||O)&&{customHoverBehavior:G.customHoverBehavior}),A&&A.length>0&&{annotations:A}),k);return e.createElement(Gt,{componentName:"StackedBarChart",width:B,height:H},e.createElement(Je,Object.assign({ref:a},J)))});Ut.displayName="StackedBarChart";const Jt=c(function(n,o){const i=yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null),{data:l,margin:c,className:d,categoryAccessor:h="category",groupBy:g,valueAccessor:y="value",orientation:p="vertical",valueFormat:m,colorBy:f,colorScheme:v="category10",barPadding:b=60,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:S,onObservation:j,chartId:O,loading:E,emptyContent:P,legendInteraction:M,legendPosition:L}=n,C=i.width,B=i.height,H=i.enableHover,D=i.showGrid,_=i.showLegend,N=i.title,$=i.categoryLabel,z=i.valueLabel,R=l||[],I=f||g,W=Zt({isPushMode:void 0===l,colorBy:I,colorScheme:v,showLegend:_,legendPosition:L}),T=s(W.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[W.wrapPush]),q=s(W.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[W.wrapPushMany]);u(o,()=>({push:T,pushMany:q,clear:()=>{var e;W.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[T,q,W.resetCategories]);const F=Qt({data:R,rawData:l,colorBy:I,colorScheme:v,legendInteraction:M,legendPosition:L,selection:k,linkedHover:S,fallbackFields:I?["string"==typeof I?I:""]:[],unwrapData:!0,onObservation:j,chartType:"GroupedBarChart",chartId:O,showLegend:_,userMargin:c,marginDefaults:i.marginDefaults,loading:E,emptyContent:P,width:C,height:B});if(F.earlyReturn)return F.earlyReturn;const G=r(()=>e=>I?F.colorScale?{fill:Q(e,I,F.colorScale)}:{}:{fill:dt},[I,F.colorScale]),V=r(()=>ut(G,F.effectiveSelectionHook,k),[G,F.effectiveSelectionHook,k]),X=r(()=>At({categoryAccessor:g,valueAccessor:y,groupAccessor:h}),[g,h,y]),Y=Mt({componentName:"GroupedBarChart",data:l,accessors:{categoryAccessor:h,valueAccessor:y},requiredProps:{groupBy:g}});if(Y)return e.createElement(kt,{componentName:"GroupedBarChart",message:Y,width:C,height:B});const K=r(()=>W.streamingLegend?Object.assign(Object.assign({},F.legendBehaviorProps),{legend:W.streamingLegend,legendPosition:L||F.legendPosition}):F.legendBehaviorProps,[F.legendBehaviorProps,F.legendPosition,W.streamingLegend,L]),Z=r(()=>{if(W.streamingMarginAdjust){const e=Object.assign({},F.margin);for(const[t,n]of Object.entries(W.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return F.margin},[F.margin,W.streamingMarginAdjust]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=l&&{data:R}),{oAccessor:h,rAccessor:y,groupBy:g,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:V,size:[C,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z,barPadding:b,enableHover:H,showAxes:i.showAxes,oLabel:$,rLabel:z,rFormat:m,showGrid:D}),K),N&&{title:N}),d&&{className:d}),{tooltipContent:!1===x?()=>null:bt(x)||X}),(S||j)&&{customHoverBehavior:F.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(Gt,{componentName:"GroupedBarChart",width:C,height:B},e.createElement(Je,Object.assign({ref:a},U)))});Jt.displayName="GroupedBarChart";const en=c(function(n,o){const i=yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:y,colorBy:p,colorScheme:m="category10",sizeBy:f,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,frameProps:S={},selection:j,linkedHover:O,onObservation:E,chartId:P,loading:M,emptyContent:L,legendInteraction:C,legendPosition:B}=n,H=i.width,D=i.height,_=i.enableHover,N=i.showGrid,$=i.title,z=i.categoryLabel,R=i.valueLabel,I=s||[],W=Qt({data:I,rawData:s,colorBy:p,colorScheme:m,legendInteraction:C,legendPosition:B,selection:j,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,chartType:"SwarmPlot",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:H,height:D});if(W.earlyReturn)return W.earlyReturn;const T=r(()=>{if(!f)return;const e=I.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[I,f]),q=r(()=>e=>{const t={fillOpacity:x};return t.fill=p?Q(e,p,W.colorScale):dt,t.r=f?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}(e,f,v,T):b,t},[p,W.colorScale,f,v,T,b,x]),F=r(()=>ut(q,W.effectiveSelectionHook,j),[q,W.effectiveSelectionHook,j]),G=r(()=>At({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0}),[d,h,p]),V=Mt({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(V)return e.createElement(kt,{componentName:"SwarmPlot",message:V,width:H,height:D});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:I}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:F,size:[H,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:W.margin,barPadding:w,enableHover:_,showAxes:i.showAxes,oLabel:z,rLabel:R,rFormat:y,showGrid:N}),W.legendBehaviorProps),$&&{title:$}),c&&{className:c}),{tooltipContent:!1===A?()=>null:bt(A)||G}),(O||E)&&{customHoverBehavior:W.customHoverBehavior}),k&&k.length>0&&{annotations:k}),S);return e.createElement(Gt,{componentName:"SwarmPlot",width:H,height:D},e.createElement(Je,Object.assign({ref:a},X)))});en.displayName="SwarmPlot";const tn=c(function(n,o){const i=yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:y,colorBy:p,colorScheme:m="category10",showOutliers:f=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:S,chartId:j,loading:O,emptyContent:E,legendInteraction:P,legendPosition:M}=n,L=i.width,C=i.height,B=i.enableHover,H=i.showGrid,D=i.title,_=i.categoryLabel,N=i.valueLabel,$=s||[],z=Qt({data:$,rawData:s,colorBy:p,colorScheme:m,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,chartType:"BoxPlot",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:E,width:L,height:C});if(z.earlyReturn)return z.earlyReturn;const R=r(()=>e=>{const t=p?Q(e,p,z.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.8}},[p,z.colorScale]),I=r(()=>ut(R,z.effectiveSelectionHook,A),[R,z.effectiveSelectionHook,A]),W=r(()=>t=>{const n=t.stats||(t.data||t).stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:pt},e.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(t.category||(t.data||t).category||"")+""),null!=n.median&&e.createElement(e.Fragment,null,null!=n.n&&e.createElement("div",null,"n = ",n.n),e.createElement("div",null,"Median: ",n.median.toLocaleString()),e.createElement("div",null,"Q1: ",n.q1.toLocaleString()),e.createElement("div",null,"Q3: ",n.q3.toLocaleString()),e.createElement("div",null,"Min: ",n.min.toLocaleString()),e.createElement("div",null,"Max: ",n.max.toLocaleString())))},[]),T=Mt({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(T)return e.createElement(kt,{componentName:"BoxPlot",message:T,width:L,height:C});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:$}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:I,showOutliers:f,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:z.margin,barPadding:v,enableHover:B,showAxes:i.showAxes,oLabel:_,rLabel:N,rFormat:y,showGrid:H}),z.legendBehaviorProps),D&&{title:D}),c&&{className:c}),{tooltipContent:!1===b?()=>null:bt(b)||W}),(k||S)&&{customHoverBehavior:z.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Gt,{componentName:"BoxPlot",width:L,height:C},e.createElement(Je,Object.assign({ref:a},q)))});tn.displayName="BoxPlot";const nn=c(function(n,o){const i=yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:y=!1,valueFormat:p,colorBy:m,colorScheme:f="category10",categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:S,chartId:j,loading:O,emptyContent:E,legendPosition:P}=n,M=i.width,L=i.height,C=i.enableHover,B=i.showGrid,H=i.title,D=i.categoryLabel,_=i.valueLabel,N=s||[],$=Qt({data:N,rawData:s,colorBy:m,colorScheme:f,legendInteraction:void 0,legendPosition:P,selection:A,linkedHover:k,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,chartType:"Histogram",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:O,emptyContent:E,width:M,height:L});if($.earlyReturn)return $.earlyReturn;const z=r(()=>e=>{const t=m?Q(e,m,$.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.8}},[m,$.colorScale]),R=r(()=>ut(z,$.activeSelectionHook,A),[z,$.activeSelectionHook,A]),I=r(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:pt},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),W=Mt({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(W)return e.createElement(kt,{componentName:"Histogram",message:W,width:M,height:L});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:N}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:R,bins:g,normalize:y,size:[M,L],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:$.margin,barPadding:v,enableHover:C,showAxes:i.showAxes,oLabel:D,rLabel:_,rFormat:p,showGrid:B}),$.legendBehaviorProps),H&&{title:H}),c&&{className:c}),{tooltipContent:!1===b?()=>null:bt(b)||I}),(k||S)&&{customHoverBehavior:$.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Gt,{componentName:"Histogram",width:M,height:L},e.createElement(Je,Object.assign({ref:a},T)))});nn.displayName="Histogram";const on=c(function(n,o){const i=yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:y=25,showIQR:p=!0,valueFormat:m,colorBy:f,colorScheme:v="category10",categoryPadding:b=20,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:S,onObservation:j,chartId:O,loading:E,emptyContent:P,legendPosition:M}=n,L=i.width,C=i.height,B=i.enableHover,H=i.showGrid,D=i.title,_=i.categoryLabel,N=i.valueLabel,$=s||[],z=Qt({data:$,rawData:s,colorBy:f,colorScheme:v,legendInteraction:void 0,legendPosition:M,selection:k,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,chartType:"ViolinPlot",chartId:O,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:E,emptyContent:P,width:L,height:C});if(z.earlyReturn)return z.earlyReturn;const R=r(()=>e=>{const t=f?Q(e,f,z.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.6}},[f,z.colorScale]),I=r(()=>ut(R,z.activeSelectionHook,k),[R,z.activeSelectionHook,k]),W=r(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;if(r)return e.createElement("div",{className:"semiotic-tooltip",style:pt},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(t.data)?t.data:[]).map(e=>{const t="function"==typeof h?h(e):e[h];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),a=i.length,s=a>0?i[Math.floor(a/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:pt},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))},[h]),T=Mt({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(T)return e.createElement(kt,{componentName:"ViolinPlot",message:T,width:L,height:C});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:$}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:I,bins:y,showIQR:p,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:z.margin,barPadding:b,enableHover:B,showAxes:i.showAxes,oLabel:_,rLabel:N,rFormat:m,showGrid:H}),z.legendBehaviorProps),D&&{title:D}),c&&{className:c}),{tooltipContent:!1===x?()=>null:bt(x)||W}),(S||j)&&{customHoverBehavior:z.customHoverBehavior}),w&&w.length>0&&{annotations:w}),A);return e.createElement(Gt,{componentName:"ViolinPlot",width:L,height:C},e.createElement(Je,Object.assign({ref:a},q)))});on.displayName="ViolinPlot";const rn=c(function(n,o){var i;const a=yt(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),s=t(null);u(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)},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:[]}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:y="horizontal",valueFormat:p,colorBy:m,colorScheme:f="category10",sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:S,linkedHover:j,onObservation:O,chartId:E,loading:P,emptyContent:M,legendInteraction:L,legendPosition:C}=n,B=a.width,H=a.height,D=a.enableHover,_=a.showGrid,N=a.title,$=a.categoryLabel,z=a.valueLabel,R=l||[],I=Qt({data:R,rawData:l,colorBy:m,colorScheme:f,legendInteraction:L,legendPosition:C,selection:S,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:O,chartType:"DotPlot",chartId:E,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:P,emptyContent:M,width:B,height:H});if(I.earlyReturn)return I.earlyReturn;const W=ht(R,v,g),T=r(()=>e=>{const t={r:b,fillOpacity:.8};return t.fill=m?Q(e,m,I.colorScale):dt,t},[m,I.colorScale,b]),q=r(()=>ut(T,I.effectiveSelectionHook,S),[T,I.effectiveSelectionHook,S]),F=r(()=>At({categoryAccessor:h,valueAccessor:g}),[h,g]),G=Mt({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(G)return e.createElement(kt,{componentName:"DotPlot",message:G,width:B,height:H});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:W}),{oAccessor:h,rAccessor:g,projection:"horizontal"===y?"horizontal":"vertical",pieceStyle:q,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:I.margin,barPadding:x,enableHover:D,showAxes:a.showAxes,oLabel:$,rLabel:z,rFormat:p,showGrid:_,oSort:v}),I.legendBehaviorProps),N&&{title:N}),d&&{className:d}),{tooltipContent:!1===w?()=>null:bt(w)||F}),(j||O)&&{customHoverBehavior:I.customHoverBehavior}),A&&A.length>0&&{annotations:A}),k);return e.createElement(Gt,{componentName:"DotPlot",width:B,height:H},e.createElement(Je,Object.assign({ref:s},V)))});rn.displayName="DotPlot";const an=c(function(n,o){var i,a;const l=yt(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(a=n.height)&&void 0!==a?a:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title}),c=t(null),{data:d,margin:h,className:g,categoryAccessor:y="category",valueAccessor:p="value",colorBy:m,colorScheme:f="category10",startAngle:v=0,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:S,chartId:j,loading:O,emptyContent:E,legendInteraction:P,legendPosition:M}=n,L=l.width,C=l.height,B=l.enableHover,H=l.showLegend,D=l.title,_=d||[],N=m||y,$=Zt({isPushMode:void 0===d,colorBy:N,colorScheme:f,showLegend:H,legendPosition:M}),z=s($.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[$.wrapPush]),R=s($.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[$.wrapPushMany]);u(o,()=>({push:z,pushMany:R,clear:()=>{var e;$.resetCategories(),null===(e=c.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=c.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[z,R,$.resetCategories]);const I=Qt({data:_,rawData:d,colorBy:N,colorScheme:f,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:S,chartType:"PieChart",chartId:j,showLegend:H,userMargin:h,marginDefaults:l.marginDefaults,loading:O,emptyContent:E,width:L,height:C});if(I.earlyReturn)return I.earlyReturn;const W=r(()=>e=>N?I.colorScale?{fill:Q(e,N,I.colorScale)}:{}:{fill:dt},[N,I.colorScale]),T=r(()=>ut(W,I.effectiveSelectionHook,A),[W,I.effectiveSelectionHook,A]),q=r(()=>At({categoryAccessor:y,valueAccessor:p,groupAccessor:m&&m!==y?m:void 0,groupLabel:"string"==typeof m?m:"group",pieData:!0}),[y,p,m]),F=Mt({componentName:"PieChart",data:d,accessors:{categoryAccessor:y,valueAccessor:p}});if(F)return e.createElement(kt,{componentName:"PieChart",message:F,width:L,height:C});const G=r(()=>$.streamingLegend?Object.assign(Object.assign({},I.legendBehaviorProps),{legend:$.streamingLegend,legendPosition:M||I.legendPosition}):I.legendBehaviorProps,[I.legendBehaviorProps,I.legendPosition,$.streamingLegend,M]),V=r(()=>{if($.streamingMarginAdjust){const e=Object.assign({},I.margin);for(const[t,n]of Object.entries($.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return I.margin},[I.margin,$.streamingMarginAdjust]),X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=d&&{data:_}),{oAccessor:y,rAccessor:p,projection:"radial",pieceStyle:T,startAngle:v,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V,enableHover:B,showAxes:!1}),G),D&&{title:D}),g&&{className:g}),{tooltipContent:!1===b?()=>null:bt(b)||q}),(k||S)&&{customHoverBehavior:I.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Gt,{componentName:"PieChart",width:L,height:C},e.createElement(Je,Object.assign({ref:c},X)))});an.displayName="PieChart";const sn=c(function(n,o){var i,a;const l=yt(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(a=n.height)&&void 0!==a?a:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,linkedHover:n.linkedHover}),c=t(null),{data:d,margin:h,className:g,categoryAccessor:y="category",valueAccessor:p="value",innerRadius:m=60,centerContent:f,colorBy:v,colorScheme:b="category10",startAngle:x=0,tooltip:w,annotations:A,frameProps:k={},selection:S,linkedHover:j,onObservation:O,chartId:E,loading:P,emptyContent:M,legendInteraction:L,legendPosition:C}=n,B=l.width,H=l.height,D=l.enableHover,_=l.showLegend,N=l.title,$=d||[],z=v||y,R=Zt({isPushMode:void 0===d,colorBy:z,colorScheme:b,showLegend:_,legendPosition:C}),I=s(R.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[R.wrapPush]),W=s(R.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[R.wrapPushMany]);u(o,()=>({push:I,pushMany:W,clear:()=>{var e;R.resetCategories(),null===(e=c.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=c.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[I,W,R.resetCategories]);const T=Qt({data:$,rawData:d,colorBy:z,colorScheme:b,legendInteraction:L,legendPosition:C,selection:S,linkedHover:j,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:O,chartType:"DonutChart",chartId:E,showLegend:_,userMargin:h,marginDefaults:l.marginDefaults,loading:P,emptyContent:M,width:B,height:H});if(T.earlyReturn)return T.earlyReturn;const q=r(()=>e=>z?T.colorScale?{fill:Q(e,z,T.colorScale)}:{}:{fill:dt},[z,T.colorScale]),F=r(()=>ut(q,T.effectiveSelectionHook,S),[q,T.effectiveSelectionHook,S]),G=r(()=>At({categoryAccessor:y,valueAccessor:p,groupAccessor:v&&v!==y?v:void 0,groupLabel:"string"==typeof v?v:"group",pieData:!0}),[y,p,v]),V=Mt({componentName:"DonutChart",data:d,accessors:{categoryAccessor:y,valueAccessor:p}});if(V)return e.createElement(kt,{componentName:"DonutChart",message:V,width:B,height:H});const X=r(()=>R.streamingLegend?Object.assign(Object.assign({},T.legendBehaviorProps),{legend:R.streamingLegend,legendPosition:C||T.legendPosition}):T.legendBehaviorProps,[T.legendBehaviorProps,T.legendPosition,R.streamingLegend,C]),Y=r(()=>{if(R.streamingMarginAdjust){const e=Object.assign({},T.margin);for(const[t,n]of Object.entries(R.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return T.margin},[T.margin,R.streamingMarginAdjust]),K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=d&&{data:$}),{oAccessor:y,rAccessor:p,projection:"radial",pieceStyle:F,innerRadius:m,startAngle:x,centerContent:f,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Y,enableHover:D,showAxes:!1}),X),N&&{title:N}),g&&{className:g}),{tooltipContent:!1===w?()=>null:bt(w)||G}),(j||O)&&{customHoverBehavior:T.customHoverBehavior}),A&&A.length>0&&{annotations:A}),k);return e.createElement(Gt,{componentName:"DonutChart",width:B,height:H},e.createElement(Je,Object.assign({ref:c},K)))});function ln(t){const n=yt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:p=5,tooltip:m,annotations:f,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:A,loading:k,emptyContent:S,legendPosition:j}=t,O=n.width,E=n.height,P=n.enableHover,M=n.showGrid,L=n.title,C=n.categoryLabel,B=n.valueLabel,H=o||[],D=Qt({data:H,rawData:o,colorBy:g,colorScheme:y,legendInteraction:void 0,legendPosition:j,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:A,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:k,emptyContent:S,width:O,height:E});if(D.earlyReturn)return D.earlyReturn;const _=r(()=>e=>{const t=g?Q(e,g,D.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.5}},[g,D.colorScale]),N=r(()=>ut(_,D.activeSelectionHook,b),[_,D.activeSelectionHook,b]),$=r(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;return r?e.createElement("div",{className:"semiotic-tooltip",style:pt},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):e.createElement("div",{className:"semiotic-tooltip",style:pt},e.createElement("div",{style:{fontWeight:"bold"}},o+""))},[]),z=Mt({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:s,valueAccessor:l}});if(z)return e.createElement(kt,{componentName:"RidgelinePlot",message:z,width:O,height:E});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=o&&{data:H}),{oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:N,bins:u,size:[O,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D.margin,barPadding:p,enableHover:P,showAxes:n.showAxes,oLabel:C,rLabel:B,rFormat:h,showGrid:M,oSort:!1,amplitude:d}),D.legendBehaviorProps),L&&{title:L}),a&&{className:a}),{tooltipContent:!1===m?()=>null:bt(m)||$}),(x||w)&&{customHoverBehavior:D.customHoverBehavior}),f&&f.length>0&&{annotations:f}),v);return e.createElement(Gt,{componentName:"RidgelinePlot",width:O,height:E},e.createElement(Je,Object.assign({},R)))}sn.displayName="DonutChart",ln.displayName="RidgelinePlot";export{Kt as BarChart,tn as BoxPlot,sn as DonutChart,rn as DotPlot,Jt as GroupedBarChart,nn as Histogram,an as PieChart,ln as RidgelinePlot,Ut as StackedBarChart,Je as StreamOrdinalFrame,en as SwarmPlot,on as ViolinPlot};
1
+ import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as s,useCallback as a,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{scaleOrdinal as h,scaleLinear as g,scaleBand as p}from"d3-scale";import{schemeCategory10 as y,interpolatePlasma as f,interpolateViridis as m,interpolatePurples as v,interpolateOranges as b,interpolateGreens as x,interpolateReds as w,interpolateBlues as k,schemeSet3 as A,schemeTableau10 as O}from"d3-scale-chromatic";import{quantile as j}from"d3-array";import{packEnclose as S}from"d3-hierarchy";import{area as E,curveCatmullRom as _,curveCardinal as C,curveBasis as P,curveStepBefore as L,curveStepAfter as M,curveStep as B,curveMonotoneY as T,curveMonotoneX as H,curveLinear as D,arc as N}from"d3-shape";import I from"regression";import{select as $}from"d3-selection";import{brushX as R,brushY as z}from"d3-brush";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;if(e!==this.lastBoundedData)return;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 W{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}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 q{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 G(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 X(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Y(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const K={category10:y,tableau10:O,set3:A,blues:k,reds:w,greens:x,oranges:b,purples:v,viridis:m,plasma:f},U=y,Q=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Z=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")||Z.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):U[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+""))%U.length]}function ee(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return h().domain(o).range(n).unknown("#999");const i=K[n]||K.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:U;return h().domain(o).range(e).unknown("#999")}}function te(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 ne(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=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function oe(e){var t,n,o;const r=e.length,i=e[0],s=e[r-1];return{n:r,min:i,q1:null!==(t=j(e,.25))&&void 0!==t?t:i,median:null!==(n=j(e,.5))&&void 0!==n?n:(i+s)/2,q3:null!==(o=j(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/r}}const re={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize,p=[];if(s){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of p){const c=t.get(i);if(!c)continue;let p=c.total;g&&n>0&&(p/=n);const y=a(c.pieces[0],s?i:e.name),f=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const t=l(0>p?r:o+p),n=0>p?l(r+p)-l(r):l(o)-l(o+p);u.push(te(e.x,t,e.width,Math.abs(n),y,f,i)),0>p?r+=p:o+=p}else if(h){const t=l(0>p?r+p:o),n=0>p?l(r)-l(r+p):l(o+p)-l(o);u.push(te(t,e.x,Math.abs(n),e.width,y,f,i)),0>p?r+=p:o+=p}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,l=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let i=0;d.length>i;i++){const h=l.get(d[i])||[];for(const l of h){const h=r(l),g=s(l,d[i]);if(u){const r=e.x+i*t+n/2,s=a(0),u=a(h);c.push(te(r,Math.min(s,u),o,Math.abs(s-u),g,l,d[i]))}else{const r=e.x+i*t+n/2,s=a(0),u=a(h);c.push(te(Math.min(s,u),r,Math.abs(u-s),o,g,l,d[i]))}}}}return c},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:ne,donut:ne,boxplot:function(e,t){var n,o,r,i,s;const{scales:a,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=a,p=[],y="vertical"===g,f=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const a=t[0],l=t[t.length-1],c=null!==(n=j(t,.25))&&void 0!==n?n:a,g=null!==(o=j(t,.5))&&void 0!==o?o:(a+l)/2,m=null!==(r=j(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,w=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:a,k=null!==(s=[...t].reverse().find(e=>x>=e))&&void 0!==s?s:l,A=d(e.pieceData[0],e.name),O=[];if(f)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=y?e.middle:h(n),r=y?h(n):e.middle;O.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(k),stats:{n:t.length,min:w,q1:c,median:g,q3:m,max:k,mean:t.reduce((e,t)=>e+t,0)/t.length},style:A,datum:e.pieceData,category:e.name,outliers:O}),f)for(const e of O)p.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,o,r;const{scales:i,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],s=t[t.length-1],a=(s-i)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;p>t;t++){const n=u(i+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(i+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(i+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(i+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=j(t,.25))&&void 0!==n?n:i,l=null!==(o=j(t,.5))&&void 0!==o?o:(i+s)/2,c=null!==(r=j(t,.75))&&void 0!==r?r:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(i)),width:e.width,height:Math.abs(u(s)-u(i))}:{x:Math.min(u(i),u(s)),y:e.x,width:Math.abs(u(s)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:oe(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR: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(te(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:oe(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(te(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(te(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,s,a,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,p=[],y=t.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>c[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=d?d(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=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}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!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=w[0].stepTotal,j=x?.95*y:.9*t.width,S=g().domain([0,k]).range([0,j]),E=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let _=new Map;for(let e=0;w.length>e;e++){const t=w[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,g=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 a=0;v.length>a;a++){const l=v[a],c=t.groups.get(l);if(!c)continue;const m=S(c.total),b=a%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=h(c.pieces[0],l),k=null!==(s=A.get(l))&&void 0!==s?s: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===a&&(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(te(x,d,m,u,w,j,l)),g.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,s=S(e),a=y-s/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),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=s,k.__funnelValueLabelX=y,k.__funnelValueLabelY=d,k.__funnelBarW=s),p.push(te(a,d,s,u,x,k,b)),g.set(l,{x:a,y:d,w:s,h:u})}if(e>0&&_.size>0){const e=x?v:[v[0]];for(const o of e){const e=_.get(o),r=g.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),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!==(l=null===(a=t.groups.get(o))||void 0===a?void 0:a.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};p.push(s)}}_=g}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(te(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(te(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(te(r,e.x,i-r,e.width,d,n,l))}else{const r=a(t+o),i=a(t);c.push(te(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class ie{constructor(e){this.rExtent=new q,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.config=e,this.buffer=new W(e.windowSize),this.getO=Y(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>X(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new q)):(this.getR=X(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Y(e.stackBy),this.getGroup=Y(e.groupBy),this.getColor=Y(e.colorAccessor),this.getConnector=Y(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new W(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),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.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,i),a="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=p().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=g().domain(s).range([o,n])}else a?(c=p().domain(i).range([0,e.height]).padding(l),u=g().domain(s).range([0,e.width])):(c=p().domain(i).range([0,e.width]).padding(l),u=g().domain(s).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[s,l]=i.extent;s===1/0&&(s=0,l=1);const c=l-s,u=c>0?c*(t.extentPadding||.05):1;return s-=u,l+=u,s>0&&(s=0),a?g().domain([s,l]).range([0,e.width]):g().domain([s,l]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=Math.max(50,3*n.size);if(this.categories.size>o){let e=this.categories.size-o;for(const t of this.categories){if(0>=e)break;n.has(t)||(this.categories.delete(t),e--)}}return t.filter(e=>n.has(e))}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o,r,i;const s=this.config.chartType,a=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let l=0,c=0;if("bar"===s&&this.getStack&&this.config.normalize)l=0,c=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>c&&(c=e);for(const e of n.values())l>e&&(l=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>c&&(c=e),l>e&&(l=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>c&&(c=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>c&&(c=e),l>e&&(l=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(l=e),t!==-1/0&&(c=t)}if(this.config.rExtent&&(null!=this.config.rExtent[0]&&(l=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(c=this.config.rExtent[1])),"bar-funnel"!==s){const e=c-l,t=e>0?e*a:1;null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&(l-=t),null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])&&(c+=t)}return"bar"!==s&&"clusterbar"!==s&&"bar-funnel"!==s&&"swimlane"!==s||null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(l>0&&(l=0),0>c&&(c=0)),[l,c]}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=re[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:Q,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){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>a?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);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=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);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;let o=0;for(let n=0;t.length>n;n++){const r=t[n],a=this.config.oAccessor;if(("function"==typeof a?a(r):r[a||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(s>c){const e=1-c/s;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,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}getNodeKey(e,t){var n,o;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:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,s,a,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=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 g=!1;const p=new Set,y=new Map;for(let e=0;this.scene.length>e;e++){const a=this.scene[e],l=this.getNodeKey(a,y);if(!l)continue;a._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===a.type?c?(p.add(l),a._targetOpacity=null!==(t=a.style.opacity)&&void 0!==t?t:1,c.x===a.x&&c.y===a.y||(a._targetX=a.x,a._targetY=a.y,a.x=c.x,a.y=c.y,g=!0)):(a._targetOpacity=null!==(n=a.style.opacity)&&void 0!==n?n:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0):"rect"===a.type&&(c?(p.add(l),a._targetOpacity=null!==(o=a.style.opacity)&&void 0!==o?o:1,c.x===a.x&&c.y===a.y&&c.w===a.w&&c.h===a.h||(a._targetX=a.x,a._targetY=a.y,a._targetW=a.w,a._targetH=a.h,a.x=c.x,a.y=c.y,a.w=null!==(r=c.w)&&void 0!==r?r:a.w,a.h=null!==(i=c.h)&&void 0!==i?i:a.h,g=!0)):(a._targetOpacity=null!==(s=a.style.opacity)&&void 0!==s?s:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)p.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(a=t.r)&&void 0!==a?a:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=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)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=G(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=G(o.x,e._targetX,i),e.y=G(o.y,e._targetY,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=G(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=G(n.x,e._targetX,i),e.y=G(n.y,e._targetY,i),void 0!==n.w&&(e.w=G(n.w,e._targetW,i),e.h=G(n.h,e._targetH,i))}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}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()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!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.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e),(void 0!==e.oAccessor||void 0!==e.categoryAccessor)&&(V(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=Y(this.config.oAccessor||this.config.categoryAccessor,"category"),this.categories.clear())),void 0!==e.rAccessor){const n=Array.isArray(e.rAccessor)?e.rAccessor:[e.rAccessor],o=Array.isArray(t.rAccessor)?t.rAccessor:[t.rAccessor];if(n.length!==o.length||n.some((e,t)=>!V(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>X(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new q)):(this.getR=X(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!V(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Y(this.config.stackBy):void 0),"groupBy"in e&&!V(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Y(this.config.groupBy):void 0),"colorAccessor"in e&&!V(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Y(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!V(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Y(this.config.connectorAccessor):void 0)}}function se(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function ae(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 le(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r+5,12)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function ce(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=se(Math.atan2(r,o)),a=se(e.startAngle),l=se(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 ue(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 de(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 he(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 ge(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})}const pe={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function ye(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,pe[n])(o(e,t)),r}function fe(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function me(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function ve({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.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.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function be(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[p,y]=e.useState(0),f=e.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=ye(t,u,d,h),b=me(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?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:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(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&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(fe,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),p})(t,o,r,i,s,a,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,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 y=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,y=[];let f=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;p.forEach((t,u)=>{const x=ye(t,u,h,g),w=me(t,r,i),k=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&f>0&&f+A>d&&(m++,f=0),y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?k||!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:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&e.createElement(fe,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),f+=A});let x=0,w=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&w>0&&w+t>d?(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}})(t,r,i,s,a,l,c,n,u,d,o);p+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const y=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),p+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8})),p+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function xe(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 we(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 ke(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-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.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.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.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;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.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));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,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:we((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||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("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,y=s?u?[s]:xe(s,c):[],f=i?u?[i]:xe(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let x=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(y.length+f.length)*p+(f.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const w=Math.max(0,y.length+f.length-1)*p;let k=0;return"topBottom"===d?k=0>o?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(l,v,b,h))}function Ae(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(ke,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(ke,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}function Oe(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 je(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 Se(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=Oe(e,n),c=je(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 _e={linear:D,monotoneX:H,monotoneY:T,step:B,stepAfter:M,stepBefore:L,basis:P,cardinal:C,catmullRom:_};function Ce(t){const{width:n,height:o,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,h="radial"===(null==l?void 0:l.projection),g="horizontal"===(null==l?void 0:l.projection),p=r(()=>!l||h?[]:l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(d||Pe)(e)})),[l,d,h]),y=u&&l&&!h,f=c&&l&&!h;return y||f?e.createElement("svg",{width:i,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},y&&e.createElement("g",{className:"ordinal-grid"},p.map((t,r)=>e.createElement("line",{key:"grid-"+r,x1:g?t.pixel:0,y1:g?0:t.pixel,x2:g?t.pixel:n,y2:g?o:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),f&&e.createElement(e.Fragment,null,g?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Pe(e){return Math.round(100*e)/100+""}function Le(n){var o,i;const{width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:p,rLabel:y,oFormat:f,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:w,legendClickBehavior:k,legendHighlightedCategory:A,legendIsolatedCategories:O,legendPosition:j="right",foregroundGraphics:_,annotations:C,svgAnnotationRules:P,xAccessor:L,yAccessor:M,annotationData:B,underlayRendered:T,children:H}=n,N="radial"===(null==d?void 0:d.projection),$="horizontal"===(null==d?void 0:d.projection),R=!1!==g,z=r(()=>h&&R&&d&&!N?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:f?f(e,t):e}}):[],[h,R,d,f,N]),F=r(()=>h&&d&&!N?d.r.ticks(5).map(e=>({value:e,pixel:d.r(e),label:(m||Pe)(e)})):[],[h,d,m,N]),W=t(new Map),q=t(null!==(o=null==C?void 0:C.length)&&void 0!==o?o:0),G=null!==(i=null==C?void 0:C.length)&&void 0!==i?i:0;q.current!==G&&(q.current=G,W.current=new Map);const V=r(()=>{if(!C||0===C.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,k,A,O,j,_,C,P,L,M,B,T,H,N,$,R,z,F,W,q,G,V,X,Y,K,U,Q,Z,J,ee,te;switch(t.type){case"label":{const r=Se(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ee(i,s,o)?e.createElement(Ae,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=Se(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ee(i,s,o)?e.createElement(Ae,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Oe(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=je(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=S(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Oe(n,o),a=je(n,o);if(null==i||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||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=Oe(t,o),i=je(t,o);return e.createElement(Ae,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",p=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,f=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),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}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?I.polynomial(p,{order:t.order||2}):I.linear(p)).points;const b=v.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(v[v.length-1][0])+4,y:f(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=_e[o.curve||"linear"]||D,g=E().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(h)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(k=t.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:s(d[d.length-1][i])+4,y:a(d[d.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==O?O:null===(j=o.scales)||void 0===j?void 0:j.time,a=null!==(C=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==C?C:null===(P=o.scales)||void 0===P?void 0:P.value;if(!s||!a)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(L=t.threshold)&&void 0!==L?L:2,g=c-h*d,p=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(M=t.fillOpacity)&&void 0!==M?M:.1,m=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B:6,b=a(c+h*d),x=a(g),w=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),w.map((t,n)=>{const r=Oe(t,o),i=je(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(H=null===(T=o.scales)||void 0===T?void 0:T.x)&&void 0!==H?H:null===(N=o.scales)||void 0===N?void 0:N.time,l=null!==(R=null===($=o.scales)||void 0===$?void 0:$.y)&&void 0!==R?R:null===(z=o.scales)||void 0===z?void 0:z.value;if(!a||!l)return null;const c=r.map(e=>[e[i],e[s]]).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=I.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*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)),p=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(F=t.confidence)&&void 0!==F?F:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=null!==(W=t.steps)&&void 0!==W?W:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const k=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-p,2)/y:0))*m;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(" "),j=`${a(b)},${l(u(b))}`,S=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.createElement("polyline",{points:`${j} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&k.length>0&&e.createElement("text",{x:a(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:S,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=Se(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ee(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(K=t.width)&&void 0!==K?K:32,c=null!==(U=t.height)&&void 0!==U?U:32,u=null!==(Q=t.content)&&void 0!==Q?Q:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=Se(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(Z=o.scales)||void 0===Z?void 0:Z.o,s=null===(J=o.scales)||void 0===J?void 0:J.x,a=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(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!==(te=t.opacity)&&void 0!==te?te:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===s)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}},n="horizontal"===(null==d?void 0:d.projection),o=(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,r={scales:d?{x:n?d.r:o||d.r,y:n&&o||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:L,yAccessor:M,width:s,height:a,data:B,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:W.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,a,d,L,M,B]);return h||b||x||_||V&&V.length>0||v||H?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!N&&!T&&e.createElement("g",{className:"ordinal-grid"},F.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:$?t.pixel:0,y1:$?0:t.pixel,x2:$?t.pixel:s,y2:$?a:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!N&&e.createElement("g",{className:"ordinal-axes"},$?e.createElement(e.Fragment,null,!T&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},p),!T&&e.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),y&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):e.createElement(e.Fragment,null,!T&&e.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p),!T&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),y&&e.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"}},y))),V,_,H),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=i.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=r-i.bottom+50):(p=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(ve,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(be,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var f}({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:j,title:b,legendHoverBehavior:w,legendClickBehavior:k,legendHighlightedCategory:A,legendIsolatedCategories:O})):null}function Me({width:n,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,onBrush:c}){const u=t(null),d=t(null),h=t(c);h.current=c;const g=t(l);g.current=l;const p=t(!1),y=t(null),f="horizontal"===(null==l?void 0:l.projection),m=t(f);return m.current=f,o(()=>{if(!u.current)return;const e=$(u.current).select(".brush-g"),t=f?R():z();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let r;r=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};y.current=i,h.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,f]),o(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=$(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),e.createElement("svg",{ref:u,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}}))}function Be(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Te="undefined"==typeof window||"undefined"==typeof document,He=e.createContext(null),De={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ne(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 Ie=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},$e={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"},Re={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},ze={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)"},Fe={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},We={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)"},qe={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ge={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ve({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=e.useState(!1),l=e.useContext(He),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{s||c||a(!0)},[s,c]),p=e.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.createElement("span",{id:o,tabIndex:-1,style:De}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:De,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",t.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 E of e)if(E&&"object"==typeof E)try{switch(E.type){case"point":S.push({label:"Point",values:{x:E.x,y:E.y}});break;case"line":{const e=E.path,t=Array.isArray(E.datum)?E.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=E.topPath,t=Array.isArray(E.datum)?E.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!=E.datum&&"object"==typeof E.datum?E.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:E.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:E.x,y:E.y,value:E.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=E.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=E.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=E.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=E.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=E.cx)&&void 0!==g?g:E.x,y:null!==(p=E.cy)&&void 0!==p?p:E.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=E.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=E.cx)&&void 0!==m?m:E.x,y:null!==(v=E.cy)&&void 0!==v?v:E.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:E.x,open:E.open,high:E.high,low:E.low,close:E.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(A=null!==(w=null===(x=null===(b=E.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(k=E.datum)||void 0===k?void 0:k.name)&&void 0!==A?A:"",value:null!==(j=null===(O=E.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(t),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}: ${Ie(e.min)} to ${Ie(e.max)}, mean ${Ie(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 e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:p,style:$e,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:ze},"×"),e.createElement("div",{role:"note",style:Re},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:Fe},e.createElement("caption",{style:Ge},"First ",v.length," of ",y.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:We},"type"),x.map(t=>e.createElement("th",{key:t,style:We},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:qe},t.label),x.map(n=>{return e.createElement("td",{key:n,style:qe},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ie(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function Xe({summary:t}){return t?e.createElement("div",{role:"note",style:De},t):null}function Ye({tableId:t}){return e.createElement("a",{href:"#"+t,style:De,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,De)}},"Skip to data table")}function Ke({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:De},n)}const Ue="var(--semiotic-focus, #005fcc)";function Qe({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ue,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ue,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ue,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function Ze({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,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.createElement("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},s)}function Je(n){const o=i(null),c=et(n);return[function({children:t}){const i=r(()=>et(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=s(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=a(()=>i.current(r.getState()),[r]),d=a(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,d)}]}function et(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)}}}const tt={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},nt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ot={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],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"},[rt,it]=Je(e=>({theme:tt,setTheme(t){e(e=>{if("light"===t)return{theme:tt};if("dark"===t)return{theme:nt};if("high-contrast"===t)return{theme:ot};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?nt:tt;return{theme: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:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}}));function st(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function at(e,t,n=.3){st(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 lt(e,t,n=.6){var o,r,i,s,a;if(!st(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 ct(e,t,n,o=.35){st(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const ut=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?dt(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),at(e,t),e.globalAlpha=1};function dt(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 ht=(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=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),lt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function gt(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()}const pt=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s)gt(e,t),e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(gt(e,t),ct(e,t)),e.globalAlpha=1},yt=(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=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=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()}},ft=(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=n.style.stroke||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 mt(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 vt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let bt=null;function xt(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):(bt||(bt=document.createElement("canvas")),bt.width=e,bt.height=e,bt)}(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 wt=new Map;function kt(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=wt.get(n);if(void 0!==o)return o;const r=xt({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return wt.set(n,r),r}function At(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 Ot(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 jt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const St=e=>[ft,...e],Et={bar:St([ut]),clusterbar:St([ut]),point:St([ht]),swarm:St([ht]),pie:[pt],donut:[pt],boxplot:St([(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()}},ht]),violin:St([yt]),histogram:St([ut]),ridgeline:St([yt]),timeline:St([ut]),funnel:[ut,(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=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?mt(r):null!=i?`${mt(r)} (${vt(i)})`:mt(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=mt(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":[ut,(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=kt(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?jt(r):"",a=Ot(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(),At(e,g,p,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),At(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:St([ut])},_t={top:50,right:40,bottom:60,left:70},Ct={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 Pt({hover:t}){var n,o,r,i,s,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.createElement("div",{className:"semiotic-tooltip",style:Ct},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:Ct},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:Ct},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Ct},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const p=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",y=null!==(a=null!==(s=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!p&&""===y){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Ct},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:Ct},p&&e.createElement("div",{style:{fontWeight:"bold"}},p+""),""!==y&&e.createElement("div",null,"number"==typeof y?y.toLocaleString():y+""))}const Lt=c(function(i,s){var l,c,d,h,g,p,y,f,m,v;const{chartType:b,runtimeMode:x,data:w,oAccessor:k="category",rAccessor:A="value",colorAccessor:O,stackBy:j,groupBy:S,multiAxis:E,timeAccessor:_,valueAccessor:C,categoryAccessor:P,projection:L="vertical",size:M=[600,400],responsiveWidth:B,responsiveHeight:T,margin:H,barPadding:D,innerRadius:I,normalize:$,startAngle:R,dynamicColumnWidth:z,bins:W,showOutliers:q,showIQR:G,amplitude:V,connectorOpacity:X,showLabels:Y,connectorAccessor:K,connectorStyle:U,rExtent:Q,oExtent:Z,extentPadding:J=.05,oSort:ee,windowMode:te="sliding",windowSize:ne=200,pieceStyle:oe,summaryStyle:re,colorScheme:se,barColors:pe,showAxes:ye=!0,showCategoryTicks:fe,oLabel:me,rLabel:ve,oFormat:be,rFormat:xe,enableHover:we=!0,hoverAnnotation:ke,tooltipContent:Ae,customHoverBehavior:Oe,annotations:je,svgAnnotationRules:Se,showGrid:Ee=!1,legend:_e,legendHoverBehavior:Pe,legendClickBehavior:He,legendHighlightedCategory:De,legendIsolatedCategories:Ie,legendPosition:$e,backgroundGraphics:Re,foregroundGraphics:ze,title:Fe,className:We,background:qe,centerContent:Ge,decay:Ue,pulse:Je,transition:et,staleness:tt,brush:nt,onBrush:ot,accessibleTable:rt=!0,description:st,summary:at}=i,lt=function(){const[e,t]=n(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),ct=t(lt);ct.current=lt;const[ut,dt]=function(e,r,i){const s=t(null),[a,l]=n(null);return o(()=>{if(!r&&!i)return;const e=s.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[r,i]),[s,[r&&a?a.w:e[0],i&&a?a.h:e[1]]]}(M,B,T),ht=r(()=>Object.assign(Object.assign({},_t),H),[H]),gt=dt[0]-ht.left-ht.right,pt=dt[1]-ht.top-ht.bottom,yt="function"==typeof ze?ze({size:dt,margin:ht}):ze,ft=t(null),mt=t(!0),vt=it(e=>e.theme),bt=t(0),xt=t(null),wt=t(()=>{}),[kt,At]=n(null),[Ot,jt]=n(null),[St,Ct]=n(0),[Lt,Mt]=n(!1),Bt=we||ke,Tt="streaming"===x,Ht=r(()=>({chartType:b,runtimeMode:Tt?"streaming":"bounded",windowSize:ne,windowMode:te,extentPadding:J,projection:L,oAccessor:Tt?void 0:k,rAccessor:Tt?void 0:A,colorAccessor:O,stackBy:j,groupBy:S,multiAxis:E,timeAccessor:Tt?_:void 0,valueAccessor:Tt?C||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:Tt?P||k:void 0,rExtent:Q,oExtent:Z,barPadding:D,innerRadius:I,normalize:$,startAngle:R,dynamicColumnWidth:z,bins:W,showOutliers:q,showIQR:G,amplitude:V,connectorOpacity:X,showLabels:Y,connectorAccessor:K,connectorStyle:U,oSort:ee,pieceStyle:oe,summaryStyle:re,colorScheme:se,barColors:pe,decay:Ue,pulse:Je,transition:et,staleness:tt}),[b,ne,te,J,L,k,A,O,j,S,E,_,C,P,Q,Z,D,I,$,R,z,W,q,G,V,X,Y,K,U,ee,oe,re,se,pe,Ue,Je,et,tt,Tt]),Dt=t(null);Dt.current||(Dt.current=new ie(Ht));const Nt=a(()=>{bt.current||(bt.current=requestAnimationFrame(()=>wt.current()))},[]);o(()=>{var e;null===(e=Dt.current)||void 0===e||e.updateConfig(Ht),mt.current=!0,Nt()},[Ht,Nt]),o(()=>{mt.current=!0,Nt()},[vt,Nt]);const It=t(null);It.current||(It.current=new F(e=>{const t=Dt.current;t&&t.ingest(e)&&(mt.current=!0,Nt())}));const $t=a(e=>{var t;null===(t=It.current)||void 0===t||t.push(e)},[]),Rt=a(e=>{var t;null===(t=It.current)||void 0===t||t.pushMany(e)},[]),zt=a(()=>{var e,t;null===(e=It.current)||void 0===e||e.clear(),null===(t=Dt.current)||void 0===t||t.clear(),mt.current=!0,Nt()},[Nt]);u(s,()=>({push:$t,pushMany:Rt,clear:zt,getData:()=>{var e,t,n;return null===(e=It.current)||void 0===e||e.flush(),null!==(n=null===(t=Dt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Dt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[$t,Rt,zt]),o(()=>{var e;w&&(null===(e=It.current)||void 0===e||e.setBoundedData(w))},[w]);const Ft=t(()=>{}),Wt=t(()=>{});Ft.current=e=>{if(!Bt)return;const t=ft.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ht.left,r=e.clientY-n.top-ht.top;if(0>o||o>gt||0>r||r>pt)return void(xt.current&&(xt.current=null,At(null),Oe&&Oe(null),Nt()));const i=Dt.current;if(!i||0===i.scene.length)return;const s="radial"===L,a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=ae(i,t,n);break;case"point":e=le(i,t,n);break;case"wedge":e=ce(i,t,n);break;case"boxplot":e=ue(i,t,n);break;case"violin":e=de(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,s?o-gt/2:o,s?r-pt/2:r);if(!a)return void(xt.current&&(xt.current=null,At(null),Oe&&Oe(null),Nt()));const l=a.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,time:a.x,value:a.y,x:a.x,y:a.y}),a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});xt.current=c,At(c),Oe&&(Oe(c),mt.current=!0),Nt()},Wt.current=()=>{xt.current&&(xt.current=null,At(null),Oe&&(Oe(null),mt.current=!0),Nt())},a(e=>Ft.current(e),[]);const qt=a(()=>Wt.current(),[]),Gt=t(-1),Vt=t(null),Xt=t(null),Yt=a(e=>{const t=Dt.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Xt.current&&Xt.current.version===n)o=Xt.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),Xt.current={version:n,graph:o}}const r=Gt.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Gt.current=0;const t=o.flat[0];Vt.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},ge(t)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});return xt.current=n,At(n),Oe&&Oe(n),void Nt()}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?he(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?he(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 Gt.current=-1,Vt.current=null,xt.current=null,At(null),Oe&&Oe(null),void Nt();Gt.current=s;const a=o.flat[s];Vt.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},ge(a)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});xt.current=l,At(l),Oe&&Oe(l),Nt()},[Oe,Nt]),Kt=a(e=>{Gt.current=-1,Vt.current=null,Ft.current(e)},[]);wt.current=()=>{var e,t;bt.current=0;const n=ft.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Dt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(ct.current?i+1e6:i),a=!ct.current&&s,l=mt.current;l&&!s&&(r.computeScene({width:gt,height:pt}),mt.current=!1),(l||a)&&n.setAttribute("aria-label",Ne(r.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=dt[0]*c,d=dt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=dt[0]+"px",n.style.height=dt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,dt[0],dt[1]);const h=null!==(e=null==tt?void 0:tt.threshold)&&void 0!==e?e:5e3,g=tt&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==tt?void 0:tt.dimOpacity)&&void 0!==t?t:.5);const p=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",y=qe||(p&&"transparent"!==p?p:null);y&&(o.fillStyle=y,o.fillRect(0,0,dt[0],dt[1]));const f="radial"===L;o.save(),o.beginPath(),o.rect(ht.left,ht.top,gt,pt),o.clip(),f?(o.save(),o.translate(ht.left+gt/2,ht.top+pt/2)):o.translate(ht.left,ht.top);const m=Et[b]||[],v={width:gt,height:pt};for(const e of m)e(o,r.scene,r.scales,v);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(jt(r.scales),Ct(e=>e+1)),(null==tt?void 0:tt.showBadge)&&Mt(!!g),(a||r.hasActivePulses)&&(bt.current=requestAnimationFrame(()=>wt.current()))},o(()=>(Nt(),()=>{bt.current&&(cancelAnimationFrame(bt.current),bt.current=0)}),[Nt]),o(()=>{mt.current=!0,Nt()},[b,gt,pt,ye,qe,Nt]),function(e,t,n,r,i,s){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(tt,Dt,mt,Nt,Lt,Mt);const Ut=Bt&&kt?Ae?Ae(kt):e.createElement(Pt,{hover:kt}):null,Qt="radial"===L,Zt=Ut?e.createElement(Ze,{x:kt?Qt?kt.x+gt/2:kt.x:0,y:kt?Qt?kt.y+pt/2:kt.y:0,containerWidth:gt,containerHeight:pt,margin:ht,className:"stream-ordinal-tooltip"},Ut):null;if(Te){const t=Dt.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:gt,height:pt}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===L,i=r?ht.left+gt/2:ht.left,s=r?ht.top+pt/2:ht.top;return e.createElement("div",{className:"stream-ordinal-frame"+(We?" "+We:""),role:"img","aria-label":st||("string"==typeof Fe?Fe:"Ordinal chart"),style:{position:"relative",width:dt[0],height:dt[1]}},e.createElement(Xe,{summary:at}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:dt[0],height:dt[1],style:{position:"absolute",left:0,top:0}},Re&&e.createElement("g",{transform:`translate(${ht.left},${ht.top})`},Re),e.createElement("g",{transform:`translate(${i},${s})`},qe&&e.createElement("rect",{x:0,y:0,width:gt,height:pt,fill:qe}),n.map((t,n)=>function(t,n){var o,r,i,s,a;const l=t.category||t.group||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:Be(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:Be(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=N().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return e.createElement("path",{key:u,d:o,transform:`translate(${n.cx},${n.cy})`,fill:Be(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:Be(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:Be(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:Be(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(a=t.style.opacity)&&void 0!==a?a:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:Be(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Le,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:o,showAxes:ye,showCategoryTicks:fe,oLabel:me,rLabel:ve,oFormat:be,rFormat:xe,showGrid:Ee,title:Fe,legend:_e,legendHoverBehavior:Pe,legendClickBehavior:He,legendHighlightedCategory:De,legendIsolatedCategories:Ie,legendPosition:$e,foregroundGraphics:yt,annotations:je,svgAnnotationRules:Se,annotationFrame:0,xAccessor:"string"==typeof k?k:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null==t?void 0:t.getData()}),Ge&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:ht.left+gt/2,top:ht.top+pt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ge))}const Jt="semiotic-table-"+e.useId();return e.createElement("div",{ref:ut,className:"stream-ordinal-frame"+(We?" "+We:""),role:"group","aria-label":st||("string"==typeof Fe?Fe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:B?"100%":dt[0],height:T?"100%":dt[1],overflow:"visible"},onKeyDown:Yt},rt&&e.createElement(Ye,{tableId:Jt}),rt&&e.createElement(Ve,{scene:null!==(h=null===(d=Dt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:Jt,chartTitle:"string"==typeof Fe?Fe:void 0}),e.createElement(Xe,{summary:at}),e.createElement("div",{role:"img","aria-label":st||("string"==typeof Fe?Fe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Bt?Kt:void 0,onMouseLeave:Bt?qt:void 0},Re&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:dt[0],height:dt[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${ht.left},${ht.top})`},Re)),e.createElement(Ce,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:Ot,showAxes:ye,showGrid:Ee,rFormat:xe}),e.createElement("canvas",{ref:ft,"aria-label":Ne(null!==(p=null===(g=Dt.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:dt[0],height:dt[1]}}),e.createElement(Ke,{hoverPoint:kt}),e.createElement(Le,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:Ot,showAxes:ye,showCategoryTicks:fe,oLabel:me,rLabel:ve,oFormat:be,rFormat:xe,showGrid:Ee,title:Fe,legend:_e,legendHoverBehavior:Pe,legendClickBehavior:He,legendHighlightedCategory:De,legendIsolatedCategories:Ie,legendPosition:$e,foregroundGraphics:yt,annotations:je,svgAnnotationRules:Se,annotationFrame:St,xAccessor:"string"==typeof k?k:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null===(y=Dt.current)||void 0===y?void 0:y.getData(),underlayRendered:!0}),(nt||ot)&&"radial"!==L&&e.createElement(Me,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:Ot,onBrush:ot||(()=>{})}),Ge&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:ht.left+gt/2,top:ht.top+pt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ge),(null==tt?void 0:tt.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===tt.badgePosition?{top:4,left:4}:"bottom-left"===tt.badgePosition?{bottom:4,left:4}:"bottom-right"===tt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Lt?"#dc3545":"#28a745",color:"white"})},Lt?"STALE":"LIVE"),e.createElement(Qe,{active:Gt.current>=0,hoverPoint:kt,margin:ht,size:dt,shape:null===(f=Vt.current)||void 0===f?void 0:f.shape,width:null===(m=Vt.current)||void 0===m?void 0:m.w,height:null===(v=Vt.current)||void 0===v?void 0:v.h}),Zt))});Lt.displayName="StreamOrdinalFrame";const Mt=i(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 Tt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Ht,Dt]=Je(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Tt(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=Tt(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}})}})),[Nt,It]=Je(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 $t={positions:new Map};const Rt=new Set;function zt(){for(const e of Rt)e()}function Ft(e,t){const n=$t.positions.get(e);if(!n||n.sourceId!==t)return;const o=new Map($t.positions);o.delete(e),$t={positions:o},zt()}function Wt(e){const t=d(),n=e.clientId||t,{name:o}=e,i=Dt(e=>e.selections.get(o)),s=Dt(e=>e.setClause),l=Dt(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>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,n):()=>!0,[i,n]),isActive:c,selectPoints:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:a(()=>{l(o,n)},[l,o,n]),clientId:n}}const qt=i(!1);function Gt({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):Q[i%Q.length];return{label:r+"",color:a}}),label:""}]}}function Vt(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:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}function Xt(){var e;const t=it(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 Yt(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=K[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 Kt(e,t,n){return r(()=>{if(!t)return e;const o=[...e];if("function"==typeof t)return o.sort(t);const r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}e.createContext(void 0);const Ut={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 Qt(e,t,n){var o,r,i,s,a,l;const c=Ut[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||c.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:Zt(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function Zt(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 Jt={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 en(e,t){return"function"==typeof t?t(e):e[t]}function tn(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 nn(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=en(t,o);a=tn(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=en(t,o);l.push({label:n,value:tn(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=tn(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=tn(t[e[0]],r))}}const c=Object.assign(Object.assign({},Jt),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function on(t){if(!0===t)return nn();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:Jt},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?nn(t):nn())}function rn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function sn(e,t){return"function"==typeof t?t(e):e[t]}function an({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return s=>{var a;const l=i?(null===(a=s.data)||void 0===a?void 0:a[0])||s.data||s:s.data||s,c=sn(l,t),u=sn(l,n),d=o?sn(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:Jt},e.createElement("div",{style:{fontWeight:"bold"}},rn(c)),e.createElement("div",{style:{marginTop:4}},rn(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||("string"==typeof(h=o)?h:"value"),": ",rn(d)));var h}}function ln({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class cn extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(ln,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function un(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 dn(e,t,n=3){let o,r=n+1;for(const n of t){const t=un(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function hn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function gn(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=dn(e,t,3))&&void 0!==n?n:null)}function pn({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=hn(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=gn(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const yn={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"}},mn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},vn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],bn=["vertical","horizontal"],xn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vn},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({},yn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vn},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({},yn),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({},yn),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({},yn),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({},yn),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({},yn),fn),{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({},yn),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({},yn),mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bn},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),mn),{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:bn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bn},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bn},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({},yn),mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),mn),{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({},yn),mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bn},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({},yn),mn),{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({},yn),mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yn),mn),{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({},yn),mn),{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({},yn),{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({},yn),{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:bn},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({},yn),{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({},yn),{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({},yn),{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({},yn),{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({},yn),{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"},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"}}}};function wn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const kn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),An=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),On=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),jn=new Set(["LineChart","AreaChart","StackedAreaChart"]),Sn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function En(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 _n(e,t){const n=En(e),o=En(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Cn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Pn(e,t){const n=[],o=function(e,t){const n=[],o=xn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(xn).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(!wn(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=dn(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=pn({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=hn(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=gn(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 xn[e]?(function(e,t,n){const o=xn[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=xn[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){kn.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){An.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=xn[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(!On.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(!jn.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=xn[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(!Sn.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=_n(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=_n(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 Cn)"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 Ln;const Mn="undefined"!=typeof process&&"production"!==(null===(Ln=process.env)||void 0===Ln?void 0:Ln.NODE_ENV);function Bn({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(cn,{fallback:i=>{let s="";if(Mn&&r)try{const e=Pn(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(ln,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}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"},Hn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Dn(e,t,n,o){if(!Mn)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 Nn(t){const{data:i,rawData:l,colorBy:c,colorScheme:u,legendInteraction:h,legendPosition:g,selection:p,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:k,marginDefaults:A,onClick:O,loading:j,emptyContent:S,width:E,height:_}=t,{activeSelectionHook:C,customHoverBehavior:P,customClickBehavior:L,crosshairSourceId:M}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:r=!1,onObservation:i,chartType:s,chartId:l,onClick:c}){const u=d(),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}(t,n),g=Wt({name:(null==e?void 0:e.name)||"__unused__"}),p=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Wt({name:t});return{onHover:a(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||n||[]}),y=It(e=>e.pushObservation),f=e?{isActive:g.isActive,predicate:g.predicate}:null,m=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==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=$t.positions.get(e);o&&o.xValue===t&&o.sourceId===n||($t={positions:new Map($t.positions).set(e,{xValue:t,sourceId:n})},zt())}(h.name||"hover",Number(e),u)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Ft(h.name||"hover",u),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(i||y){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),y&&y(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),y&&y(e)}}},[t,p,h,u,i,s,l,y]),v=a(e=>{var t,n,o,r;if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(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:l};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)}}},[c,i,y,s,l]);return o(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{Ft(e,u)}},[null==h?void 0:h.mode,null==h?void 0:h.name,u]),{activeSelectionHook:f,customHoverBehavior:m,customClickBehavior:v,crosshairSourceId:u}}({selection:p,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O}),B=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}}(y,M),T=function(e,t,n){const o=s(Mt),i=Xt();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=ee(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return ee(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=ee(e,t,s);return e=>o[e]||n(e)}return ee(e,t,s)}if(o&&Object.keys(o).length>0){const e=ee([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(i,c,u),H=r(()=>{if(!c)return[];const e=new Set;for(const t of i){const n="function"==typeof c?c(t):t[c];null!=n&&e.add(n+"")}return Array.from(e)},[i,c]),D=function(e,t,o){const[i,s]=n(null),[l,c]=n(new Set),u=a(t=>{"highlight"===e&&s(t?t.label:null)},[e]),d=a(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}(h,c,H),N=r(()=>D.legendSelectionHook?D.legendSelectionHook:C,[D.legendSelectionHook,C]),{legend:I,margin:$,legendPosition:R}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(qt),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(d&&t)return Gt({data:e,colorBy:t,colorScale:n,getColor:J,categories:c})},[d,t,e,n,c]),g=r(()=>{const e=Object.assign(Object.assign({},l),a);return h&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,a,h,i]);return{legend:h,margin:g,legendPosition:i}}({data:i,colorBy:c,colorScale:T,showLegend:w,legendPosition:g,userMargin:k,defaults:A}),z=r(()=>{const e={};return I&&(e.legend=I,e.legendPosition=R),h&&"none"!==h&&(e.legendHoverBehavior=D.onLegendHover,e.legendClickBehavior=D.onLegendClick,e.legendHighlightedCategory=D.highlightedCategory,e.legendIsolatedCategories=D.isolatedCategories),e},[I,R,h,D.onLegendHover,D.onLegendClick,D.highlightedCategory,D.isolatedCategories]),F=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Hn),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}(j,E,_),W=F?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Tn),{width:n,height:o})},r||"No data available"):null}(l,E,_,S);return{colorScale:T,allCategories:H,legendState:D,effectiveSelectionHook:N,activeSelectionHook:C,customHoverBehavior:P,customClickBehavior:L,legend:I,margin:$,legendPosition:R,earlyReturn:F||W||null,legendBehaviorProps:z,crosshairProps:B}}const In=c(function(n,o){const i=Qt(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(null);u(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)},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:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:j,chartId:S,loading:E,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,showCategoryTicks:M,categoryFormat:B}=n,T=i.width,H=i.height,D=i.enableHover,N=i.showGrid,I=i.title,$=i.description,R=i.summary,z=i.accessibleTable,F=i.categoryLabel,W=i.valueLabel,q=a||[],G=Nn({data:q,rawData:a,colorBy:y,colorScheme:f,legendInteraction:C,legendPosition:P,selection:k,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:O,onClick:j,chartType:"BarChart",chartId:S,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:E,emptyContent:_,width:T,height:H});if(G.earlyReturn)return G.earlyReturn;Dn("BarChart",q,"categoryAccessor",d),Dn("BarChart",q,"valueAccessor",h);const V=Kt(q,m,h),X=Xt(),Y=r(()=>new Map,[q]),K=r(()=>(e,t)=>{const n={};return n.fill=y?J(e,y,G.colorScale):Yt(L,X,f,void 0,Y),n},[y,G.colorScale,L,X,f,Y]),U=r(()=>Vt(K,G.effectiveSelectionHook,k),[K,G.effectiveSelectionHook,k]),Q=r(()=>an({categoryAccessor:d,valueAccessor:h,groupAccessor:y&&y!==d?y:void 0,groupLabel:"string"==typeof y?y:"group"}),[d,h,y]),Z=pn({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(ln,{componentName:"BarChart",message:Z,width:T,height:H});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:U,size:[T,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:G.margin,barPadding:v,enableHover:D,showAxes:i.showAxes,oLabel:F,rLabel:W,rFormat:p}),B&&{oFormat:B}),{showGrid:N,showCategoryTicks:M,oSort:m}),G.legendBehaviorProps),I&&{title:I}),$&&{description:$}),R&&{summary:R}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:on(b)||Q}),(A||O||j)&&{customHoverBehavior:G.customHoverBehavior}),(O||j)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Bn,{componentName:"BarChart",width:T,height:H},e.createElement(Lt,Object.assign({ref:s},ee)))});function $n({isPushMode:e,colorBy:o,colorScheme:i,showLegend:s,legendPosition:l="right"}){const c=t(new Set),u=t([]),[d,h]=n(0),g=a(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),p=a(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),y=a(e=>t=>{p([t]),e(t)},[p]),f=a(e=>t=>{p(t),e(t)},[p]),m=a(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!o||!1===s)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:Q,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const a="string"==typeof o?o:"__streamCat";return Gt({data:t.map(e=>({[a]:e})),colorBy:a,colorScale:e=>r.get(e)||"#999",getColor:J})},[e,o,s,i,d]),b=r(()=>{if(v)return"right"===l?{right:110}:"left"===l?{left:110}:"top"===l?{top:50}:"bottom"===l?{bottom:80}:{right:110}},[v,l]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function Rn({ref:e,frameRef:t,isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:l,setup:c}){const d=$n({isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:l}),h=a(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=a(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:r(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:l||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,l]),effectiveMargin:r(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}In.displayName="BarChart";const zn=c(function(n,o){const i=Qt(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(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,barPadding:v=40,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:j,chartId:S,loading:E,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,categoryFormat:M}=n,B=i.width,T=i.height,H=i.enableHover,D=i.showGrid,N=i.showLegend,I=i.title,$=i.description,R=i.summary,z=i.accessibleTable,F=i.categoryLabel,W=i.valueLabel,q=a||[],G=y||d,V=void 0===a,X=Nn({data:q,rawData:a,colorBy:G,colorScheme:f,legendInteraction:C,legendPosition:P,selection:k,linkedHover:A,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:O,onClick:j,chartType:"StackedBarChart",chartId:S,showLegend:N,userMargin:l,marginDefaults:i.marginDefaults,loading:E,emptyContent:_,width:B,height:T});if(X.earlyReturn)return X.earlyReturn;const Y=Xt(),K=r(()=>new Map,[q]),U=r(()=>(e,t)=>G?X.colorScale?{fill:J(e,G,X.colorScale)}:{}:{fill:Yt(L,Y,f,t,K)},[G,X.colorScale,L,Y,f,K]),Q=r(()=>Vt(U,X.effectiveSelectionHook,k),[U,X.effectiveSelectionHook,k]),Z=r(()=>an({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ee=pn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:te,effectiveMargin:ne}=Rn({ref:o,frameRef:s,isPushMode:V,colorBy:G,colorScheme:f,showLegend:N,legendPosition:P,setup:X}),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({chartType:"bar"},null!=a&&{data:q}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:Q,size:[B,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne,barPadding:v,enableHover:H,showAxes:i.showAxes,oLabel:F,rLabel:W,rFormat:p}),M&&{oFormat:M}),{showGrid:D}),te),I&&{title:I}),$&&{description:$}),R&&{summary:R}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:on(b)||Z}),(A||O||j)&&{customHoverBehavior:X.customHoverBehavior}),(O||j)&&{customClickBehavior:X.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return ee?e.createElement(ln,{componentName:"StackedBarChart",message:ee,width:B,height:T}):e.createElement(Bn,{componentName:"StackedBarChart",width:B,height:T},e.createElement(Lt,Object.assign({ref:s},oe)))});zn.displayName="StackedBarChart";const Fn=c(function(n,o){const i=Qt(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(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m=60,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,chartId:j,loading:S,emptyContent:E,legendInteraction:_,legendPosition:C,color:P,categoryFormat:L}=n,M=i.width,B=i.height,T=i.enableHover,H=i.showGrid,D=i.showLegend,N=i.title,I=i.description,$=i.summary,R=i.accessibleTable,z=i.categoryLabel,F=i.valueLabel,W=a||[],q=y||d,G=void 0===a,V=Nn({data:W,rawData:a,colorBy:q,colorScheme:f,legendInteraction:_,legendPosition:C,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:A,onClick:O,chartType:"GroupedBarChart",chartId:j,showLegend:D,userMargin:l,marginDefaults:i.marginDefaults,loading:S,emptyContent:E,width:M,height:B});if(V.earlyReturn)return V.earlyReturn;const X=Xt(),Y=r(()=>new Map,[W]),K=r(()=>(e,t)=>q?V.colorScale?{fill:J(e,q,V.colorScale)}:{}:{fill:Yt(P,X,f,t,Y)},[q,V.colorScale,P,X,f,Y]),U=r(()=>Vt(K,V.effectiveSelectionHook,w),[K,V.effectiveSelectionHook,w]),Q=r(()=>an({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),Z=pn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:ee,effectiveMargin:te}=Rn({ref:o,frameRef:s,isPushMode:G,colorBy:q,colorScheme:f,showLegend:D,legendPosition:C,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({chartType:"clusterbar"},null!=a&&{data:W}),{oAccessor:u,rAccessor:h,groupBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:U,size:[M,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te,barPadding:m,enableHover:T,showAxes:i.showAxes,oLabel:z,rLabel:F,rFormat:p}),L&&{oFormat:L}),{showGrid:H}),ee),N&&{title:N}),I&&{description:I}),$&&{summary:$}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===v?()=>null:on(v)||Q}),(k||A||O)&&{customHoverBehavior:V.customHoverBehavior}),(A||O)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return Z?e.createElement(ln,{componentName:"GroupedBarChart",message:Z,width:M,height:B}):e.createElement(Bn,{componentName:"GroupedBarChart",width:M,height:B},e.createElement(Lt,Object.assign({ref:s},ne)))});function Wn({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:i}){const s=(l="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof l?{name:l}:l:null;var l;const c=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:l,clear:c}=Wt({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=a(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}({name:(null==s?void 0:s.name)||"__unused_ordinal_brush__",xField:(null==s?void 0:s.xField)||("string"==typeof i?i:"value")}),u=t(c.brushInteraction);u.current=c.brushInteraction;const d=a(e=>{if(s){u.current.end(e?e.r:null)}null==n||n(e)},[n,s]),h=!!(e||o||n);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}Fn.displayName="GroupedBarChart";const qn=c(function(n,o){const i=Qt(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(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m=40,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:j,onObservation:S,onClick:E,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:M,color:B,categoryFormat:T}=n,H=i.width,D=i.height,N=i.enableHover,I=i.showGrid,$=i.showLegend,R=i.title,z=i.description,F=i.summary,W=i.accessibleTable,q=i.categoryLabel,G=i.valueLabel,V=a||[],X=y||d,Y=void 0===a,K=Nn({data:V,rawData:a,colorBy:X,colorScheme:f,legendInteraction:L,legendPosition:M,selection:O,linkedHover:j,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:S,onClick:E,chartType:"SwimlaneChart",chartId:_,showLegend:$,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:H,height:D}),U=Wn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Q=Xt(),Z=r(()=>new Map,[V]),ee=r(()=>(e,t)=>X?K.colorScale?{fill:J(e,X,K.colorScale)}:{}:{fill:Yt(B,Q,f,t,Z)},[X,K.colorScale,B,Q,f,Z]),te=r(()=>Vt(ee,K.effectiveSelectionHook,O),[ee,K.effectiveSelectionHook,O]),ne=r(()=>an({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),oe=pn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:re,effectiveMargin:ie}=Rn({ref:o,frameRef:s,isPushMode:Y,colorBy:X,colorScheme:f,showLegend:$,legendPosition:M,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({chartType:"swimlane"},null!=a&&{data:V}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:te,size:[H,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,barPadding:m,enableHover:N,showAxes:i.showAxes,oLabel:q,rLabel:G,rFormat:p}),T&&{oFormat:T}),{showGrid:I}),re),R&&{title:R}),z&&{description:z}),F&&{summary:F}),void 0!==W&&{accessibleTable:W}),c&&{className:c}),{tooltipContent:!1===v?()=>null:on(v)||ne}),(j||S||E)&&{customHoverBehavior:K.customHoverBehavior}),(S||E)&&{customClickBehavior:K.customClickBehavior}),b&&b.length>0&&{annotations:b}),U.brushStreamProps),A);return oe?e.createElement(ln,{componentName:"SwimlaneChart",message:oe,width:H,height:D}):e.createElement(Bn,{componentName:"SwimlaneChart",width:H,height:D},e.createElement(Lt,Object.assign({ref:s},se)))});qn.displayName="SwimlaneChart";const Gn=c(function(n,o){const i=Qt(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(null);u(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)},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:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:k,annotations:A,brush:O,onBrush:j,linkedBrush:S,frameProps:E={},selection:_,linkedHover:C,onObservation:P,onClick:L,chartId:M,loading:B,emptyContent:T,legendInteraction:H,legendPosition:D,color:N,showCategoryTicks:I,categoryFormat:$}=n,R=i.width,z=i.height,F=i.enableHover,W=i.showGrid,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,K=i.valueLabel,U=a||[],Q=Nn({data:U,rawData:a,colorBy:y,colorScheme:f,legendInteraction:H,legendPosition:D,selection:_,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,chartType:"SwarmPlot",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:T,width:R,height:z}),Z=Wn({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:h});if(Q.earlyReturn)return Q.earlyReturn;const ee=r(()=>{if(!m)return;const e=U.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[U,m]),te=Xt(),ne=r(()=>new Map,[U]),oe=r(()=>(e,t)=>{const n={fillOpacity:x};return n.fill=y?J(e,y,Q.colorScale):Yt(N,te,f,void 0,ne),n.r=m?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):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,m,v,ee):b,n},[y,Q.colorScale,m,v,ee,b,x,N,te,f,ne]),re=r(()=>Vt(oe,Q.effectiveSelectionHook,_),[oe,Q.effectiveSelectionHook,_]),ie=r(()=>an({categoryAccessor:d,valueAccessor:h,groupAccessor:y||void 0}),[d,h,y]),se=pn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(se)return e.createElement(ln,{componentName:"SwarmPlot",message:se,width:R,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({chartType:"swarm"},null!=a&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[R,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:w,enableHover:F,showAxes:i.showAxes,oLabel:Y,rLabel:K,rFormat:p}),$&&{oFormat:$}),{showGrid:W,showCategoryTicks:I}),Q.legendBehaviorProps),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===k?()=>null:on(k)||ie}),(C||P||L)&&{customHoverBehavior:Q.customHoverBehavior}),(P||L)&&{customClickBehavior:Q.customClickBehavior}),A&&A.length>0&&{annotations:A}),Z.brushStreamProps),E);return e.createElement(Bn,{componentName:"SwarmPlot",width:R,height:z},e.createElement(Lt,Object.assign({ref:s},ae)))});function Vn(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:Jt},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=i.length,a=s>0?s%2!=0?i[Math.floor(s/2)]:(i[s/2-1]+i[s/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:Jt},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),s>0&&e.createElement("div",null,"n = ",s),null!=a&&e.createElement("div",null,"Median: ",a.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:Jt},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}Gn.displayName="SwarmPlot";const Xn=c(function(n,o){const i=Qt(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(null);u(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)},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:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:j,chartId:S,loading:E,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,showCategoryTicks:M,categoryFormat:B}=n,T=i.width,H=i.height,D=i.enableHover,N=i.showGrid,I=i.title,$=i.description,R=i.summary,z=i.accessibleTable,F=i.categoryLabel,W=i.valueLabel,q=a||[],G=Nn({data:q,rawData:a,colorBy:y,colorScheme:f,legendInteraction:C,legendPosition:P,selection:k,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:j,chartType:"BoxPlot",chartId:S,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:E,emptyContent:_,width:T,height:H});if(G.earlyReturn)return G.earlyReturn;const V=Xt(),X=r(()=>new Map,[q]),Y=r(()=>e=>{const t=y?J(e,y,G.colorScale):Yt(L,V,f,void 0,X);return{fill:t,stroke:t,fillOpacity:.8}},[y,G.colorScale,L,V,f,X]),K=r(()=>Vt(Y,G.effectiveSelectionHook,k),[Y,G.effectiveSelectionHook,k]),U=r(()=>Vn(),[]),Q=pn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(Q)return e.createElement(ln,{componentName:"BoxPlot",message:Q,width:T,height:H});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({chartType:"boxplot"},null!=a&&{data:q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[T,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:G.margin,barPadding:v,enableHover:D,showAxes:i.showAxes,oLabel:F,rLabel:W,rFormat:p}),B&&{oFormat:B}),{showGrid:N,showCategoryTicks:M}),G.legendBehaviorProps),I&&{title:I}),$&&{description:$}),R&&{summary:R}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:on(b)||U}),(A||O||j)&&{customHoverBehavior:G.customHoverBehavior}),(O||j)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Bn,{componentName:"BoxPlot",width:T,height:H},e.createElement(Lt,Object.assign({ref:s},Z)))});Xn.displayName="BoxPlot";const Yn=c(function(n,o){const i=Qt(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(null);u(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)},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:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:p=!1,valueFormat:y,colorBy:f,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:w,onBrush:k,linkedBrush:A,frameProps:O={},selection:j,linkedHover:S,onObservation:E,onClick:_,chartId:C,loading:P,emptyContent:L,legendInteraction:M,legendPosition:B,color:T,showCategoryTicks:H,categoryFormat:D}=n,N=i.width,I=i.height,$=i.enableHover,R=i.showGrid,z=i.title,F=i.description,W=i.summary,q=i.accessibleTable,G=i.categoryLabel,V=i.valueLabel,X=a||[],Y=Nn({data:X,rawData:a,colorBy:f,colorScheme:m,legendInteraction:M,legendPosition:B,selection:j,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,onClick:_,chartType:"Histogram",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:N,height:I}),K=Wn({brushProp:w,onBrushProp:k,linkedBrush:A,valueAccessor:h});if(Y.earlyReturn)return Y.earlyReturn;const U=r(()=>{if(0===X.length)return;const e="function"==typeof h?h:e=>e[h];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,h]),Q=Xt(),Z=r(()=>new Map,[X]),ee=r(()=>e=>{const t=f?J(e,f,Y.colorScale):Yt(T,Q,m,void 0,Z);return{fill:t,stroke:t,fillOpacity:.8}},[f,Y.colorScale,T,Q,m,Z]),te=r(()=>Vt(ee,Y.effectiveSelectionHook,j),[ee,Y.effectiveSelectionHook,j]),ne=r(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:Jt},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),oe=pn({componentName:"Histogram",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(ln,{componentName:"Histogram",message:oe,width:N,height:I});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=a&&{data:X}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:te,bins:g,normalize:p}),U&&{rExtent:U}),{size:[N,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Y.margin,barPadding:v,enableHover:$,showAxes:i.showAxes,oLabel:G,rLabel:V,rFormat:y}),D&&{oFormat:D}),{showGrid:R,showCategoryTicks:H}),Y.legendBehaviorProps),z&&{title:z}),F&&{description:F}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),{tooltipContent:!1===b?()=>null:on(b)||ne}),(S||E||_)&&{customHoverBehavior:Y.customHoverBehavior}),(E||_)&&{customClickBehavior:Y.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),O);return e.createElement(Bn,{componentName:"Histogram",width:N,height:I},e.createElement(Lt,Object.assign({ref:s},re)))});Yn.displayName="Histogram";const Kn=c(function(n,o){const i=Qt(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(null);u(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)},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:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:k,onBrush:A,linkedBrush:O,frameProps:j={},selection:S,linkedHover:E,onObservation:_,onClick:C,chartId:P,loading:L,emptyContent:M,legendInteraction:B,legendPosition:T,color:H,showCategoryTicks:D,categoryFormat:N}=n,I=i.width,$=i.height,R=i.enableHover,z=i.showGrid,F=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],K=Nn({data:Y,rawData:a,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:T,selection:S,linkedHover:E,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:C,chartType:"ViolinPlot",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:M,width:I,height:$}),U=Wn({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Q=Xt(),Z=r(()=>new Map,[Y]),ee=r(()=>e=>{const t=m?J(e,m,K.colorScale):Yt(H,Q,v,void 0,Z);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,H,Q,v,Z]),te=r(()=>Vt(ee,K.effectiveSelectionHook,S),[ee,K.effectiveSelectionHook,S]),ne=r(()=>Vn({valueAccessor:h}),[h]),oe=pn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(ln,{componentName:"ViolinPlot",message:oe,width:I,height:$});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:te,bins:p,showIQR:y,size:[I,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:b,enableHover:R,showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:f}),N&&{oFormat:N}),{showGrid:z,showCategoryTicks:D}),K.legendBehaviorProps),F&&{title:F}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),{tooltipContent:!1===x?()=>null:on(x)||ne}),(E||_||C)&&{customHoverBehavior:K.customHoverBehavior}),(_||C)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),U.brushStreamProps),j);return e.createElement(Bn,{componentName:"ViolinPlot",width:I,height:$},e.createElement(Lt,Object.assign({ref:s},re)))});Kn.displayName="ViolinPlot";const Un=c(function(n,o){var i;const s=Qt(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,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}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:k,frameProps:A={},selection:O,linkedHover:j,onObservation:S,onClick:E,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:M,color:B,categoryFormat:T}=n,H=s.width,D=s.height,N=s.enableHover,I=s.showGrid,$=s.title,R=s.description,z=s.summary,F=s.accessibleTable,W=s.categoryLabel,q=s.valueLabel,G=l||[],V=Nn({data:G,rawData:l,colorBy:f,colorScheme:m,legendInteraction:L,legendPosition:M,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:S,onClick:E,chartType:"DotPlot",chartId:_,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:C,emptyContent:P,width:H,height:D});if(V.earlyReturn)return V.earlyReturn;const X=Kt(G,v,g),Y=Xt(),K=r(()=>new Map,[G]),U=r(()=>(e,t)=>{const n={r:b,fillOpacity:.8};return n.fill=f?J(e,f,V.colorScale):Yt(B,Y,m,void 0,K),n},[f,V.colorScale,b,B,Y,m,K]),Q=r(()=>Vt(U,V.effectiveSelectionHook,O),[U,V.effectiveSelectionHook,O]),Z=r(()=>an({categoryAccessor:h,valueAccessor:g}),[h,g]),ee=pn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(ee)return e.createElement(ln,{componentName:"DotPlot",message:ee,width:H,height:D});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({chartType:"point"},null!=l&&{data:X}),{oAccessor:h,rAccessor:g,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:Q,size:[H,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V.margin,barPadding:x,enableHover:N,showAxes:s.showAxes,oLabel:W,rLabel:q,rFormat:y}),T&&{oFormat:T}),{showGrid:I,oSort:v}),V.legendBehaviorProps),$&&{title:$}),R&&{description:R}),z&&{summary:z}),void 0!==F&&{accessibleTable:F}),d&&{className:d}),{tooltipContent:!1===w?()=>null:on(w)||Z}),(j||S||E)&&{customHoverBehavior:V.customHoverBehavior}),(S||E)&&{customClickBehavior:V.customClickBehavior}),k&&k.length>0&&{annotations:k}),A);return e.createElement(Bn,{componentName:"DotPlot",width:H,height:D},e.createElement(Lt,Object.assign({ref:a},te)))});Un.displayName="DotPlot";const Qn=c(function(n,o){var i,s;const a=Qt(n.mode,{width:null!==(i=n.width)&&void 0!==i?i: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}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,chartId:O,loading:j,emptyContent:S,legendInteraction:E,legendPosition:_,color:C}=n,P=a.width,L=a.height,M=a.enableHover,B=a.showLegend,T=a.title,H=a.description,D=a.summary,N=a.accessibleTable,I=c||[],$=p||h,R=void 0===c,z=Nn({data:I,rawData:c,colorBy:$,colorScheme:y,legendInteraction:E,legendPosition:_,selection:x,linkedHover:w,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:k,onClick:A,chartType:"PieChart",chartId:O,showLegend:B,userMargin:u,marginDefaults:a.marginDefaults,loading:j,emptyContent:S,width:P,height:L});if(z.earlyReturn)return z.earlyReturn;const F=Xt(),W=r(()=>new Map,[I]),q=r(()=>(e,t)=>$?z.colorScale?{fill:J(e,$,z.colorScale)}:{}:{fill:Yt(C,F,y,t,W)},[$,z.colorScale,C,F,y,W]),G=r(()=>Vt(q,z.effectiveSelectionHook,x),[q,z.effectiveSelectionHook,x]),V=r(()=>an({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),X=pn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Y,effectiveMargin:K}=Rn({ref:o,frameRef:l,isPushMode:R,colorBy:$,colorScheme:y,showLegend:B,legendPosition:_,setup:z}),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:I}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:G,startAngle:f,size:[P,L],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,enableHover:M,showAxes:!1}),Y),T&&{title:T}),H&&{description:H}),D&&{summary:D}),void 0!==N&&{accessibleTable:N}),d&&{className:d}),{tooltipContent:!1===m?()=>null:on(m)||V}),(w||k||A)&&{customHoverBehavior:z.customHoverBehavior}),(k||A)&&{customClickBehavior:z.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return X?e.createElement(ln,{componentName:"PieChart",message:X,width:P,height:L}):e.createElement(Bn,{componentName:"PieChart",width:P,height:L},e.createElement(Lt,Object.assign({ref:l},U)))});Qn.displayName="PieChart";const Zn=c(function(n,o){var i,s;const a=Qt(n.mode,{width:null!==(i=n.width)&&void 0!==i?i: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,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:p=60,centerContent:y,colorBy:f,colorScheme:m,startAngle:v=0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:j,chartId:S,loading:E,emptyContent:_,legendInteraction:C,legendPosition:P,color:L}=n,M=a.width,B=a.height,T=a.enableHover,H=a.showLegend,D=a.title,N=a.description,I=a.summary,$=a.accessibleTable,R=c||[],z=f||h,F=void 0===c,W=Nn({data:R,rawData:c,colorBy:z,colorScheme:m,legendInteraction:C,legendPosition:P,selection:k,linkedHover:A,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:O,onClick:j,chartType:"DonutChart",chartId:S,showLegend:H,userMargin:u,marginDefaults:a.marginDefaults,loading:E,emptyContent:_,width:M,height:B});if(W.earlyReturn)return W.earlyReturn;const q=Xt(),G=r(()=>new Map,[R]),V=r(()=>(e,t)=>z?W.colorScale?{fill:J(e,z,W.colorScale)}:{}:{fill:Yt(L,q,m,t,G)},[z,W.colorScale,L,q,m,G]),X=r(()=>Vt(V,W.effectiveSelectionHook,k),[V,W.effectiveSelectionHook,k]),Y=r(()=>an({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),K=pn({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:U,effectiveMargin:Q}=Rn({ref:o,frameRef:l,isPushMode:F,colorBy:z,colorScheme:m,showLegend:H,legendPosition:P,setup:W}),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({chartType:"donut"},null!=c&&{data:R}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:X,innerRadius:p,startAngle:v,centerContent:y,size:[M,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q,enableHover:T,showAxes:!1}),U),D&&{title:D}),N&&{description:N}),I&&{summary:I}),void 0!==$&&{accessibleTable:$}),d&&{className:d}),{tooltipContent:!1===b?()=>null:on(b)||Y}),(A||O||j)&&{customHoverBehavior:W.customHoverBehavior}),(O||j)&&{customClickBehavior:W.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return K?e.createElement(ln,{componentName:"DonutChart",message:K,width:M,height:B}):e.createElement(Bn,{componentName:"DonutChart",width:M,height:B},e.createElement(Lt,Object.assign({ref:l},Z)))});Zn.displayName="DonutChart";const Jn=c(function(n,o){const i=Qt(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(null);u(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)},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:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:O,onObservation:j,onClick:S,chartId:E,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:M,showCategoryTicks:B,categoryFormat:T}=n,H=i.width,D=i.height,N=i.enableHover,I=i.showGrid,$=i.title,R=i.description,z=i.summary,F=i.accessibleTable,W=i.categoryLabel,q=i.valueLabel,G=a||[],V=Nn({data:G,rawData:a,colorBy:m,colorScheme:v,legendInteraction:P,legendPosition:L,selection:A,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:S,chartType:"RidgelinePlot",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:C,width:H,height:D});if(V.earlyReturn)return V.earlyReturn;const X=Xt(),Y=r(()=>new Map,[G]),K=r(()=>e=>{const t=m?J(e,m,V.colorScale):Yt(M,X,v,void 0,Y);return{fill:t,stroke:t,fillOpacity:.5}},[m,V.colorScale,M,X,v,Y]),U=r(()=>Vt(K,V.effectiveSelectionHook,A),[K,V.effectiveSelectionHook,A]),Q=r(()=>Vn(),[]),Z=pn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(ln,{componentName:"RidgelinePlot",message:Z,width:H,height:D});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:G}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:U,bins:p,size:[H,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V.margin,barPadding:b,enableHover:N,showAxes:i.showAxes,oLabel:W,rLabel:q,rFormat:f}),T&&{oFormat:T}),{showGrid:I,showCategoryTicks:B,oSort:!1,amplitude:y}),V.legendBehaviorProps),$&&{title:$}),R&&{description:R}),z&&{summary:z}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),{tooltipContent:!1===x?()=>null:on(x)||Q}),(O||j||S)&&{customHoverBehavior:V.customHoverBehavior}),(j||S)&&{customClickBehavior:V.customClickBehavior}),w&&w.length>0&&{annotations:w}),k);return e.createElement(Bn,{componentName:"RidgelinePlot",width:H,height:D},e.createElement(Lt,Object.assign({ref:s},ee)))});Jn.displayName="RidgelinePlot";const eo=c(function(n,o){const i=Qt(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(null);u(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)},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:[]}}));const{data:a,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:p,colorScheme:y,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:j,chartId:S,loading:E,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,categoryFormat:M}=n,B="vertical"===f,T=i.width,H=i.height,D=i.enableHover,N=i.title,I=i.description,$=i.summary,R=i.accessibleTable,z=a||[],F=p||g,W=!F,q=Nn({data:z,rawData:a,colorBy:F,colorScheme:y,legendInteraction:C,legendPosition:P,selection:k,linkedHover:A,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:O,onClick:j,chartType:"FunnelChart",chartId:S,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:N?60:40,right:20,bottom:60,left:60}:{top:N?40:10,right:10,bottom:10,left:10},loading:E,emptyContent:_,width:T,height:H});if(q.earlyReturn)return q.earlyReturn;Dn("FunnelChart",z,"stepAccessor",d),Dn("FunnelChart",z,"valueAccessor",h);const G=Xt(),V=r(()=>new Map,[z]),X=r(()=>{if(W)return L||((null==G?void 0:G[0])?G[0]:Array.isArray(y)&&y[0]?y[0]:"#4e79a7")},[W,L,G,y]),Y=r(()=>(e,t)=>{const n={};return n.fill=X||(F?J(e,F,q.colorScale):Yt(L,G,y,t,V)),n},[X,F,q.colorScale,L,G,y,V]),K=r(()=>Vt(Y,q.effectiveSelectionHook,k),[Y,q.effectiveSelectionHook,k]),U=r(()=>t=>{var n,o,r,i,s,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!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s: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,y=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:Jt},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),p&&p!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},p+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",y))},[]),Q=pn({componentName:"FunnelChart",data:a,accessors:{stepAccessor:d,valueAccessor:h}});if(Q)return e.createElement(ln,{componentName:"FunnelChart",message:Q,width:T,height:H});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(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=a&&{data:z}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:K,size:[T,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:q.margin,enableHover:D,showAxes:B,showCategoryTicks:B}),M&&{oFormat:M}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),q.legendBehaviorProps),N&&{title:N}),I&&{description:I}),$&&{summary:$}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===b?()=>null:!0===b||null==b?U:on(b)||U}),(A||O||j)&&{customHoverBehavior:q.customHoverBehavior}),(O||j)&&{customClickBehavior:q.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Bn,{componentName:"FunnelChart",width:T,height:H},e.createElement(Lt,Object.assign({ref:s},Z)))});eo.displayName="FunnelChart";const to="__likert_neutral_neg",no="__likert_neutral_pos";function oo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ro(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 io(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:to,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:no,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function so(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===to?i=n:n.__likertLevel===no?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 ao=c(function(n,o){const i=Qt(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(null),{data:l,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:p,countAccessor:y="count",levels:f,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:O,onObservation:j,onClick:S,chartId:E,valueFormat:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:M,categoryFormat:B}=n,T=i.width,H=i.height,D=i.enableHover,N=i.showGrid,I=i.showLegend,$=i.title,R=i.description,z=i.summary,F=i.accessibleTable,W=i.categoryLabel,q=i.valueLabel,G="horizontal"===m,V=void 0===l,X=!p,Y=r(()=>v&&Array.isArray(v)&&v.length>=f.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),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}(f.length),[v,f.length]),K=r(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],Y[t]||"#888");return e},[f,Y]),{processedData:U,reAggregate:Q,accumulatorRef:Z}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:i,levelAccessor:s,countAccessor:l,isDiverging:c,frameRef:u}){const d=!s,h=r(()=>oo(o,"question"),[o]),g=r(()=>d?oo(i,"score"):null,[d,i]),p=r(()=>d?null:oo(s,"level"),[d,s]),y=r(()=>d?null:oo(l,"count"),[d,l]),f=e||[],m=t([]),v=r(()=>{if(0===f.length)return[];let e=ro(f,n,h,g,p,y);return c&&(e=io(e,n),e=so(e,n)),e},[f,n,h,g,p,y,c]),b=a(e=>{var t,o;let r=ro(e,n,h,g,p,y);c&&(r=io(r,n),r=so(r,n)),null===(t=u.current)||void 0===t||t.clear(),r.length>0&&(null===(o=u.current)||void 0===o||o.pushMany(r))},[n,h,g,p,y,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:f,categoryAccessor:h,valueAccessor:g,levelAccessor:p,countAccessor:y,isDiverging:G,frameRef:s}),J="__likertLevelLabel",ee=$n({isPushMode:V,colorBy:J,colorScheme:Y,showLegend:I,legendPosition:M}),te=a(ee.wrapPush(e=>{Z.current.push(e),Q(Z.current)}),[ee.wrapPush,Q,Z]),ne=a(ee.wrapPushMany(e=>{Z.current.push(...e),Q(Z.current)}),[ee.wrapPushMany,Q,Z]);u(o,()=>({push:te,pushMany:ne,clear:()=>{var e;Z.current=[],ee.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:[]}}),[te,ne,ee.resetCategories,Z]);const oe=Nn({data:U,rawData:l,colorBy:J,colorScheme:Y,legendInteraction:L,legendPosition:M,selection:A,linkedHover:O,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:S,chartType:"LikertChart",chartId:E,showLegend:I,userMargin:c,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:T,height:H});if(oe.earlyReturn)return oe.earlyReturn;const re=r(()=>{const e=f.length;return e%2!=0&&K.get(f[Math.floor(e/2)])||"#888"},[f,K]),ie=r(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===to||r===no)return{fill:re};const i=o||r;return i&&K.has(i)?{fill:K.get(i)}:{fill:"#888"}},[K,re]),se=r(()=>Vt(ie,oe.effectiveSelectionHook,A),[ie,oe.effectiveSelectionHook,A]),ae=r(()=>{const e=f.length;return e%2!=0?f[Math.floor(e/2)]:""},[f]),le=r(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===to||o===no?ae:o,i=n.__likertCategory||"",s=Math.abs(n.__likertPct||0),a=o===to||o===no?2*s:s,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:Jt},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${a.toFixed(1)}% (n=${l})`))},[ae]),ce=r(()=>{if(!f||2>f.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&p)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(p&&!y)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return X?g&&(e.valueAccessor=g):(p&&(e.levelAccessor=p),y&&(e.countAccessor=y)),pn({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:f}})},[l,h,g,p,y,f,X]),ue=r(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,K]),de=r(()=>!1!==I?Object.assign(Object.assign({},oe.legendBehaviorProps),{legend:{legendGroups:ue},legendPosition:M||oe.legendPosition||"bottom"}):oe.legendBehaviorProps,[oe.legendBehaviorProps,oe.legendPosition,M,I,ue]),he=r(()=>{const e=Object.assign({},oe.margin);if(V&&!1!==I){const t=M||"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(ee.streamingMarginAdjust)for(const[t,n]of Object.entries(ee.streamingMarginAdjust))n>e[t]&&(e[t]=n);return G&&100>e.left&&(e.left=100),e},[oe.margin,ee.streamingMarginAdjust,G,V,I,M]),ge=r(()=>_||(G?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[G,_]),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:U}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:G?"horizontal":"vertical",pieceStyle:se,size:[T,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:he,barPadding:b,enableHover:D,showAxes:i.showAxes,oLabel:W,rLabel:q||(G?void 0:"Percentage"),rFormat:ge}),B&&{oFormat:B}),{showGrid:N}),de),$&&{title:$}),R&&{description:R}),z&&{summary:z}),void 0!==F&&{accessibleTable:F}),d&&{className:d}),{tooltipContent:!1===x?()=>null:!0===x?le:on(x)||le}),(O||j||S)&&{customHoverBehavior:oe.customHoverBehavior}),(j||S)&&{customClickBehavior:oe.customClickBehavior}),w&&w.length>0&&{annotations:w}),k);return ce?e.createElement(ln,{componentName:"LikertChart",message:ce,width:T,height:H}):e.createElement(Bn,{componentName:"LikertChart",width:T,height:H},e.createElement(Lt,Object.assign({ref:s},pe)))});ao.displayName="LikertChart";export{In as BarChart,Xn as BoxPlot,Zn as DonutChart,Un as DotPlot,eo as FunnelChart,Fn as GroupedBarChart,Yn as Histogram,ao as LikertChart,Qn as PieChart,Jn as RidgelinePlot,zn as StackedBarChart,Lt as StreamOrdinalFrame,Gn as SwarmPlot,qn as SwimlaneChart,Kn as ViolinPlot,xt as createHatchPattern};