semiotic 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CLAUDE.md +227 -27
  2. package/README.md +43 -11
  3. package/ai/examples.md +358 -18
  4. package/ai/schema.json +64 -2
  5. package/ai/system-prompt.md +50 -12
  6. package/dist/components/Legend.d.ts +7 -1
  7. package/dist/components/charts/geo/ChoroplethMap.d.ts +53 -0
  8. package/dist/components/charts/geo/DistanceCartogram.d.ts +90 -0
  9. package/dist/components/charts/geo/FlowMap.d.ts +83 -0
  10. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +67 -0
  11. package/dist/components/charts/geo/index.d.ts +8 -0
  12. package/dist/components/charts/index.d.ts +2 -0
  13. package/dist/components/charts/network/ChordDiagram.d.ts +6 -5
  14. package/dist/components/charts/network/CirclePack.d.ts +2 -2
  15. package/dist/components/charts/network/ForceDirectedGraph.d.ts +9 -7
  16. package/dist/components/charts/network/OrbitDiagram.d.ts +21 -20
  17. package/dist/components/charts/network/SankeyDiagram.d.ts +6 -5
  18. package/dist/components/charts/network/TreeDiagram.d.ts +2 -2
  19. package/dist/components/charts/network/Treemap.d.ts +2 -2
  20. package/dist/components/charts/ordinal/BarChart.d.ts +7 -5
  21. package/dist/components/charts/ordinal/BoxPlot.d.ts +8 -6
  22. package/dist/components/charts/ordinal/DonutChart.d.ts +8 -6
  23. package/dist/components/charts/ordinal/DotPlot.d.ts +8 -6
  24. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +7 -5
  25. package/dist/components/charts/ordinal/Histogram.d.ts +8 -5
  26. package/dist/components/charts/ordinal/PieChart.d.ts +8 -6
  27. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
  28. package/dist/components/charts/ordinal/StackedBarChart.d.ts +7 -5
  29. package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -6
  30. package/dist/components/charts/ordinal/ViolinPlot.d.ts +8 -5
  31. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +24 -6
  32. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +28 -7
  33. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +23 -5
  34. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +24 -6
  35. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +23 -5
  36. package/dist/components/charts/shared/colorUtils.d.ts +5 -0
  37. package/dist/components/charts/shared/hooks.d.ts +13 -1
  38. package/dist/components/charts/shared/legendUtils.d.ts +2 -3
  39. package/dist/components/charts/shared/statisticalOverlays.d.ts +1 -2
  40. package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +10 -0
  41. package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
  42. package/dist/components/charts/shared/types.d.ts +10 -4
  43. package/dist/components/charts/shared/useChartSetup.d.ts +112 -0
  44. package/dist/components/charts/shared/useStreamingLegend.d.ts +65 -0
  45. package/dist/components/charts/xy/AreaChart.d.ts +11 -6
  46. package/dist/components/charts/xy/BubbleChart.d.ts +11 -6
  47. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -6
  48. package/dist/components/charts/xy/Heatmap.d.ts +16 -5
  49. package/dist/components/charts/xy/LineChart.d.ts +21 -5
  50. package/dist/components/charts/xy/MinimapChart.d.ts +3 -0
  51. package/dist/components/charts/xy/QuadrantChart.d.ts +120 -0
  52. package/dist/components/charts/xy/Scatterplot.d.ts +9 -6
  53. package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -6
  54. package/dist/components/geo/mergeData.d.ts +18 -0
  55. package/dist/components/geo/referenceGeography.d.ts +10 -0
  56. package/dist/components/geo/useReferenceAreas.d.ts +13 -0
  57. package/dist/components/realtime/RingBuffer.d.ts +1 -0
  58. package/dist/components/realtime/types.d.ts +17 -0
  59. package/dist/components/semiotic-data.d.ts +1 -0
  60. package/dist/components/semiotic-geo.d.ts +16 -0
  61. package/dist/components/semiotic-server.d.ts +1 -1
  62. package/dist/components/semiotic-xy.d.ts +1 -0
  63. package/dist/components/semiotic.d.ts +4 -4
  64. package/dist/components/server/renderToStaticSVG.d.ts +4 -2
  65. package/dist/components/stream/AccessibleDataTable.d.ts +50 -0
  66. package/dist/components/stream/CanvasHitTester.d.ts +8 -2
  67. package/dist/components/stream/DataSourceAdapter.d.ts +33 -4
  68. package/dist/components/stream/GeoCanvasHitTester.d.ts +19 -0
  69. package/dist/components/stream/GeoParticlePool.d.ts +46 -0
  70. package/dist/components/stream/GeoPipelineStore.d.ts +81 -0
  71. package/dist/components/stream/GeoTileRenderer.d.ts +31 -0
  72. package/dist/components/stream/NetworkPipelineStore.d.ts +16 -4
  73. package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
  74. package/dist/components/stream/OrdinalPipelineStore.d.ts +8 -4
  75. package/dist/components/stream/OrdinalSVGOverlay.d.ts +23 -1
  76. package/dist/components/stream/PipelineStore.d.ts +57 -5
  77. package/dist/components/stream/SVGOverlay.d.ts +28 -1
  78. package/dist/components/stream/SceneGraph.d.ts +7 -3
  79. package/dist/components/stream/SceneToSVG.d.ts +2 -0
  80. package/dist/components/stream/StreamGeoFrame.d.ts +4 -0
  81. package/dist/components/stream/accessorUtils.d.ts +1 -0
  82. package/dist/components/stream/canvasSetup.d.ts +26 -0
  83. package/dist/components/stream/geoTypes.d.ts +186 -0
  84. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +0 -7
  85. package/dist/components/stream/layouts/index.d.ts +2 -1
  86. package/dist/components/stream/layouts/orbitLayoutPlugin.d.ts +2 -0
  87. package/dist/components/stream/legendRenderer.d.ts +33 -0
  88. package/dist/components/stream/networkTypes.d.ts +49 -1
  89. package/dist/components/stream/ordinalTypes.d.ts +10 -0
  90. package/dist/components/stream/pipelineTransitionUtils.d.ts +42 -0
  91. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +9 -0
  92. package/dist/components/stream/renderers/heatmapCanvasRenderer.d.ts +2 -1
  93. package/dist/components/stream/renderers/lineCanvasRenderer.d.ts +1 -0
  94. package/dist/components/stream/renderers/renderPulse.d.ts +50 -0
  95. package/dist/components/stream/types.d.ts +77 -3
  96. package/dist/components/types/legendTypes.d.ts +27 -3
  97. package/dist/geo.min.js +1 -0
  98. package/dist/geo.module.min.js +1 -0
  99. package/dist/network.min.js +1 -1
  100. package/dist/network.module.min.js +1 -1
  101. package/dist/ordinal.min.js +1 -1
  102. package/dist/ordinal.module.min.js +1 -1
  103. package/dist/realtime.min.js +1 -1
  104. package/dist/realtime.module.min.js +1 -1
  105. package/dist/semiotic-ai.min.js +1 -1
  106. package/dist/semiotic-ai.module.min.js +1 -1
  107. package/dist/semiotic-data.d.ts +1 -0
  108. package/dist/semiotic-data.min.js +1 -1
  109. package/dist/semiotic-data.module.min.js +1 -1
  110. package/dist/semiotic-geo.d.ts +16 -0
  111. package/dist/semiotic-server.d.ts +1 -1
  112. package/dist/semiotic-xy.d.ts +1 -0
  113. package/dist/semiotic.d.ts +4 -4
  114. package/dist/semiotic.min.js +1 -1
  115. package/dist/semiotic.module.min.js +1 -1
  116. package/dist/server.min.js +1 -1
  117. package/dist/server.module.min.js +1 -1
  118. package/dist/test-utils/canvasMock.d.ts +3 -0
  119. package/dist/xy.min.js +1 -1
  120. package/dist/xy.module.min.js +1 -1
  121. package/package.json +29 -7
  122. package/dist/test/canvasMock.d.ts +0 -2
@@ -1 +1 @@
1
- import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as i,forwardRef as r,useCallback as s,useImperativeHandle as l,useContext as a,createContext as c,useLayoutEffect as d,useId as h}from"react";import{scaleBand as u,scaleLinear as g,scaleOrdinal as m}from"d3-scale";import{quantile as f}from"d3-array";import{packEnclose as y}from"d3-hierarchy";import p from"regression";import{arc as v}from"d3-shape";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as w,interpolatePurples as k,interpolateOranges as A,interpolateGreens as E,interpolateReds as S,interpolateBlues as O,schemeSet3 as L,schemeTableau10 as M}from"d3-scale-chromatic";const j=5e3;class H{constructor(e){this.lastBoundedData=null,this.chunkTimer=0,this.callback=e}clearLastData(){this.lastBoundedData=null,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,j),bounded:!0,totalSize:e.length});let t=j;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+j,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)}push(e){this.callback({inserts:[e],bounded:!1})}pushMany(e){0!==e.length&&this.callback({inserts:e,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class C{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}}}toArray(){const e=[];for(const t of this)e.push(t);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 P{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 B(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function N(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function $(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function _(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,l="donut"===o.chartType?o.innerRadius||60:0,a=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=a+e.pctStart*c,n=a+(e.pctStart+e.pct)*c,o=i(e.pieceData[0],e.name);r.push({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:s,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return r}function W(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=f(e,.25))&&void 0!==t?t:r,median:null!==(n=f(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=f(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}const D={bar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getStack:s,resolvePieceStyle:l}=e,{r:a,projection:c}=n,d=[],h="vertical"===c,u="horizontal"===c,g=i.normalize;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+=r(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const[r,c]of t){let t=c.total;g&&n>0&&(t/=n);const m=l(c.pieces[0],s?r:e.name),f=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(h){const n=a(0>t?i:o+t),s=0>t?a(i+t)-a(i):a(o)-a(o+t);d.push($(e.x,n,e.width,Math.abs(s),m,f,r)),0>t?i+=t:o+=t}else if(u){const n=a(0>t?i+t:o),s=0>t?a(i)-a(i+t):a(o+t)-a(o);d.push($(n,e.x,Math.abs(s),e.width,m,f,r)),0>t?i+=t:o+=t}}}return d},clusterbar:function(e,t){const{scales:n,columns:o,getR:i,getGroup:r,resolvePieceStyle:s}=e,{r:l,projection:a}=n,c=[],d="vertical"===a,h=[],u=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),h.push(e))}const g=h.length||1;for(const e of Object.values(o)){const t=e.width/g,n=new Map;for(const t of e.pieceData){const e=r?r(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;h.length>o;o++){const r=n.get(h[o])||[];for(const n of r){const r=i(n),a=s(n,e.name);if(d){const i=e.x+o*t,s=l(0),d=l(r);c.push($(i,Math.min(s,d),t,Math.abs(s-d),a,n,h[o]))}else{const i=e.x+o*t,s=l(0),d=l(r);c.push($(Math.min(s,d),i,Math.abs(d-s),t,a,n,h[o]))}}}}return c},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:l,resolvePieceStyle:a}=e,{r:c,projection:d}=i,h=[],u="vertical"===d,g="radial"===d,m=l.length>0,f=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),d=m&&l[i]||c,p=a(t,e.name),v=p.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*f,n=d(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else u?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);h.push({type:"point",x:b,y:x,r:v,style:p,datum:t})}return h},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:l}=n,a=[],c="vertical"===l;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],l=i(o),d=r(o,e.name),h=d.r||4,u=(7919*n%100/100-.5)*t*.8,g=c?e.middle+u:s(l),m=c?s(l):e.middle+u;a.push({type:"point",x:g,y:m,r:h,style:d,datum:o})}}return a},pie:_,donut:_,boxplot:function(e,t){var n,o,i,r,s;const{scales:l,columns:a,config:c,getR:d,resolveSummaryStyle:h}=e,{r:u,projection:g}=l,m=[],y="vertical"===g,p=!1!==c.showOutliers;for(const e of Object.values(a)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],a=t[t.length-1],c=null!==(n=f(t,.25))&&void 0!==n?n:l,g=null!==(o=f(t,.5))&&void 0!==o?o:(l+a)/2,v=null!==(i=f(t,.75))&&void 0!==i?i:a,b=v-c,x=c-1.5*b,w=v+1.5*b,k=null!==(r=t.find(e=>e>=x))&&void 0!==r?r:l,A=null!==(s=[...t].reverse().find(e=>w>=e))&&void 0!==s?s:a,E=h(e.pieceData[0],e.name),S=[];if(p)for(const t of e.pieceData){const n=d(t);if(x>n||n>w){const o=y?e.middle:u(n),i=y?u(n):e.middle;S.push({px:o,py:i,value:n,datum:t})}}if(m.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:u(k),q1Pos:u(c),medianPos:u(g),q3Pos:u(v),maxPos:u(A),stats:{n:t.length,min:k,q1:c,median:g,q3:v,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:E,datum:e.pieceData,category:e.name,outliers:S}),p)for(const e of S)m.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return m},violin:function(e,t){var n,o,i;const{scales:r,columns:s,config:l,getR:a,resolveSummaryStyle:c}=e,{r:d,projection:h}=r,u=[],g="vertical"===h,m=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(s)){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 r=t[0],s=t[t.length-1],l=(s-r)/m||1,h=Array(m).fill(0);for(const e of t)h[Math.min(Math.floor((e-r)/l),m-1)]++;const p=Math.max(...h,1),v=e.width/2*.9;let b="";if(g){for(let t=0;m>t;t++){const n=d(r+(t+.5)*l),o=h[t]/p*v;b+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=m-1;t>=0;t--){const n=d(r+(t+.5)*l);b+=` L ${e.middle-h[t]/p*v} ${n}`}b+=" Z"}else{for(let t=0;m>t;t++){const n=d(r+(t+.5)*l),o=h[t]/p*v;b+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=m-1;t>=0;t--)b+=` L ${d(r+(t+.5)*l)} ${e.middle+h[t]/p*v}`;b+=" Z"}const x=c(e.pieceData[0],e.name);let w;if(y&&t.length>=4){const l=null!==(n=f(t,.25))&&void 0!==n?n:r,a=null!==(o=f(t,.5))&&void 0!==o?o:(r+s)/2,c=null!==(i=f(t,.75))&&void 0!==i?i:s;w={q1Pos:d(l),medianPos:d(a),q3Pos:d(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};u.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:W(t),style:x,datum:e.pieceData,category:e.name})}return u},histogram:function(e,t){const{scales:n,columns:o,config:i,getR:r,resolveSummaryStyle:s}=e,{r:l}=n,a=[],c=i.bins||25,d=i.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>r(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,i=Array(c).fill(0);for(const e of t)i[Math.min(Math.floor((e-n)/o),c-1)]++;const h=t.length,u=Math.max(...i,1),g=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===i[t])continue;const r=(d?i[t]/h:i[t]/u)*e.width*.9,s=l(n+t*o),c=l(n+(t+1)*o);a.push($(Math.min(s,c),e.x+e.width-r,Math.abs(c-s),r,g,{bin:t,count:i[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return a},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:l}=e,{r:a,projection:c}=o,d=[],h=r.bins||20,u="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/h||1,c=Array(h).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/r),h-1)]++;const m=Math.max(...c,1),f=l(e.pieceData[0],e.name),y=e.width*g;let p="";if(u){const t=e.x+e.width;p=`M ${a(o)} ${t}`;for(let e=0;h>e;e++)p+=` L ${a(o+(e+.5)*r)} ${t-c[e]/m*y}`;p+=` L ${a(i)} ${t} Z`}else{const t=e.x;p=`M ${t} ${a(o)}`;for(let e=0;h>e;e++){const n=a(o+(e+.5)*r);p+=` L ${t+c[e]/m*y} ${n}`}p+=` L ${t} ${a(i)} Z`}const v=u?{x:Math.min(a(o),a(i)),y:e.x,width:Math.abs(a(i)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(i),a(o)),width:e.width,height:Math.abs(a(i)-a(o))};d.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:v,stats:W(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:l}=n,a=[],c="horizontal"===l;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,l]=n,d=r(t,e.name);if(c){const n=s(Math.min(o,l)),i=s(Math.max(o,l));a.push($(n,e.x,i-n,e.width,d,t,e.name))}else{const n=s(Math.max(o,l)),i=s(Math.min(o,l));a.push($(e.x,n,e.width,i-n,d,t,e.name))}}return a}};class z{constructor(e){this.rExtent=new P,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new C(e.windowSize),this.getO=N(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>B(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new P)):(this.getR=B(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=N(e.stackBy),this.getGroup=N(e.groupBy),this.getColor=N(e.colorAccessor),this.getConnector=N(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new C(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 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(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,r),l="horizontal"===i,a=null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1;let c,d;if("radial"===i){c=u().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=g().domain(s).range([o,n])}else l?(c=u().domain(r).range([0,e.height]).padding(a),d=g().domain(s).range([0,e.width])):(c=u().domain(r).range([0,e.width]).padding(a),d=g().domain(s).range([e.height,0]));this.scales={o:c,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{const r=this.rExtents[i];r.dirty&&r.recalculate(n,o);let[s,a]=r.extent;s===1/0&&(s=0,a=1);const c=a-s,d=c>0?c*(t.extentPadding||.05):1;return s-=d,a+=d,s>0&&(s=0),l?g().domain([s,a]).range([0,e.width]):g().domain([s,a]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,c,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,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&&void 0===n)return t;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 i=this.config.chartType,r=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===i||"donut"===i))return[0,1];let s=0,l=0;if("bar"===i&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>l&&(l=e);for(const e of n.values())s>e&&(s=e)}else if("bar"===i){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>l&&(l=e),s>e&&(s=e)}else if("clusterbar"===i)for(const t of e){const e=this.getR(t);e>l&&(l=e),s>e&&(s=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(s=e),t!==-1/0&&(l=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(s=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(l=this.config.rExtent[1]));const a=l-s,c=a>0?a*r:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(s-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(l+=c),"bar"!==i&&"clusterbar"!==i||(s>0&&(s=0),0>l&&(l=0)),[s,l]}buildColumns(e,t,n,o,i){var r;const s={},l=new Map;for(const t of e){const e=this.getO(t);l.has(e)||l.set(e,[]),l.get(e).push(t)}let a=0;if("radial"===o)for(const t of e)a+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==o){d=new Map;let e=0;for(const n of t){const t=l.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of d)d.set(t,n/e*r)}let h=0,u=0;for(const e of t){const t=l.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=a>0?o/a:0;let c,g;d?(c=u,g=d.get(e)||n.bandwidth(),u+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r: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:i,pctStart:h},h+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=D[this.config.chartType];let i=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:i,getO:r}=e;if(!i||!n)return[];const s=[],{projection:l}=n,a=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=i(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===l?0:e.h/2)),a.has(n)||a.set(n,[]),a.get(n).push({x:o,y:s,datum:t,category:r(t)})}const c=n.o.domain(),d=o.connectorStyle;for(const[e,t]of a)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],i=t[n+1],r="function"==typeof d?d(o.datum):d||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:o.x,y1:o.y,x2:i.x,y2:i.y,style:r,datum:o.datum,group:e})}}return s}(n,i);i=[...e,...i]}return i}resolvePieceStyle(e,t){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(e,t):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:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],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,i;const r=this.config.decay;if(!r||1>=t)return 1;const s=null!==(n=r.minOpacity)&&void 0!==n?n:.1,l=t-1-e;switch(r.type){case"linear":return s+(1-l/(t-1))*(1-s);case"exponential":{const e=null!==(o=r.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,l/e)*(1-s)}case"step":return(null!==(i=r.stepThreshold)&&void 0!==i?i:.5*t)>l?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=new Map;for(let e=0;t.length>e;e++)r.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=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),l=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:l*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,l=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",a=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i: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 i=t[n],l=this.config.oAccessor;if(("function"==typeof l?l(i):i[l||"category"])!==e)continue;const a=this.timestampBuffer.get(n);if(null==a)continue;const c=r-a;if(s>c){const e=1-c/s;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=l);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=l,n._pulseGlowRadius=a)}}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}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const i=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,i;if(!this.config.transition||0===this.prevPositionMap.size)return;const r=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let s=!1;for(let e=0;this.scene.length>e;e++){const r=this.scene[e];let l=null;if("point"===r.type?l="p:"+e:"rect"===r.type&&(l=`r:${r.group||""}:${null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!l)continue;const a=this.prevPositionMap.get(l);a&&("point"===r.type?a.x===r.x&&a.y===r.y||(r._targetX=r.x,r._targetY=r.y,r.x=a.x,r.y=a.y,s=!0):"rect"===r.type&&(a.x===r.x&&a.y===r.y&&a.w===r.w&&a.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=a.x,r.y=a.y,r.w=null!==(o=a.w)&&void 0!==o?o:r.w,r.h=null!==(i=a.h)&&void 0!==i?i:r.h,s=!0)))}s&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:r})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const i=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),r="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?i:1-Math.pow(1-i,3);for(let e=0;this.scene.length>e;e++){const t=this.scene[e];if("point"===t.type){if(void 0===t._targetX)continue;const n=this.prevPositionMap.get("p:"+e);if(!n)continue;t.x=n.x+(t._targetX-n.x)*r,t.y=n.y+(t._targetY-n.y)*r}else if("rect"===t.type){if(void 0===t._targetX)continue;const i=`r:${t.group||""}:${null!==(o=null===(n=t.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:e}`,s=this.prevPositionMap.get(i);if(!s)continue;t.x=s.x+(t._targetX-s.x)*r,t.y=s.y+(t._targetY-s.y)*r,void 0!==s.w&&(t.w=s.w+(t._targetW-s.w)*r,t.h=s.h+(t._targetH-s.h)*r)}}if(i>=1){for(const e of this.scene)if("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}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),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 I(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function R(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 T(e,t,n){const o=t-e.x,i=n-e.y,r=Math.sqrt(o*o+i*i);return r>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:r}}function q(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=I(Math.atan2(i,o)),l=I(e.startAngle),a=I(e.endAngle);if(!(l>a?s>=l||a>=s:s>=l&&a>=s))return null;const c=(e.startAngle+e.endAngle)/2,d=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*d,y:e.cy+Math.sin(c)*d,distance:0,category:e.category}}function F(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 i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function G(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}const V={fill:t=>e.createElement("rect",{style:t,width:20,height:20}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:20,y2:20})};function X(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,V[n])(o(e,t)),i}function Y(){return e.createElement("path",{d:"M2,6 L5,9 L10,3",fill:"none",stroke:"currentColor",strokeWidth:1.5,transform:"translate(-14, 5)"})}function Q(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function Z(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,title:l="Legend",width:a=100,height:c=20,orientation:d="vertical"}=t,h="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s})=>{let l=30;const a=[];return t.forEach((t,c)=>{l+=5,a.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+c,stroke:"gray",x1:0,y1:l,x2:n,y2:l})),l+=10,t.label&&(l+=20,a.push(e.createElement("text",{key:"legend-text-"+c,y:l,className:"legend-group-label"},t.label)),l+=10),a.push(e.createElement("g",{key:"legend-group-"+c,className:"legend-item",transform:`translate(0,${l})`},((t,n,o,i,r)=>{const{type:s="fill",styleFn:l,items:a}=t,c=[];let d=0;const h=!(!n&&!o);return a.forEach((t,a)=>{const u=X(t,a,s,l),g=Q(t,i,r),m=r&&r.size>0&&r.has(t.label);c.push(e.createElement("g",{key:"legend-item-"+a,transform:`translate(0,${d})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,style:{cursor:h?"pointer":"default",opacity:g,transition:"opacity 150ms ease",pointerEvents:"all"}},m&&e.createElement(Y,null),u,e.createElement("text",{y:15,x:30},t.label))),d+=25}),c})(t,o,i,r,s))),l+=25*t.items.length+10}),a})({legendGroups:n,width:a,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s}):(({legendGroups:t,title:n,height:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:l})=>{let a=0;const c=[],d=!1===n?10:40;return t.forEach((n,h)=>{n.label&&(c.push(e.createElement("text",{key:"legend-text-"+h,transform:`translate(${a},${d}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},n.label)),a+=20);const u=((t,n,o,i,r)=>{const{type:s="fill",styleFn:l,items:a}=t,c=[];let d=0;const h=!(!n&&!o);return a.forEach((t,a)=>{const u=X(t,a,s,l),g=Q(t,i,r),m=r&&r.size>0&&r.has(t.label);c.push(e.createElement("g",{key:"legend-item-"+a,transform:`translate(${d},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,style:{cursor:h?"pointer":"default",opacity:g,transition:"opacity 150ms ease",pointerEvents:"all"}},m&&e.createElement(Y,null),u,e.createElement("text",{y:15,x:25},t.label))),d+=35,d+=8*t.label.length}),{items:c,offset:d}})(n,i,r,s,l);c.push(e.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(${a},${d})`},u.items)),a+=u.offset+5,t[h+1]&&c.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:a,y1:d-10,x2:a,y2:o+d+10})),a+=15}),e.createElement("g",null,!1!==n&&e.createElement("line",{x1:0,x2:a+10,y1:d-10,y2:d-10,stroke:"gray",className:"title-neatline"}),c)})({legendGroups:n,title:l,height:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s});return e.createElement("g",null,void 0!==l&&e.createElement("text",{className:"legend-title",y:20,x:"horizontal"===d?0:a/2,textAnchor:"horizontal"===d?"start":"middle"},l),h)}function U(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function J(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 K(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:l,note:a,connector:c,subject:d,type:h,color:u,className:g,disable:m,events:f={},"data-testid":y}=t,p=new Set(Array.isArray(m)?m:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=l&&(b=l-o);const x="string"==typeof h?h:"label";if("bracket"===x&&d&&0===v&&0===b)if(void 0!==d.width){v=d.width/2;const e=d.depth||30;b=e+(0>e?-5:5)}else if(void 0!==d.height){const e=d.depth||30;v=e+(0>e?-5:5),b=d.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f),!p.has("connector")&&function(t,n,o,i,r,s){const l=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),d=e/2,h=o/2,u=t*h>n*d?d/t:h/n;a=i+s*u,c=r+l*u}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=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);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(l.push(e.createElement("line",{key:"connector-line",x1:a,y1:c,x2:t,y2:n,stroke:i||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-a);l.push(e.createElement("path",{key:"connector-arrow",d:`M${a},${c}L${a+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${a+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},l)}(v,b,c,u,x,d),!p.has("subject")&&function(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.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,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e.createElement("rect",{key:"subject-rect",width:t,height:i,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.createElement("line",{key:"threshold-line",x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.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)||l.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&&l.push(e.createElement("path",{key:"bracket-path",d:J((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"},l)}(x,d,u,n,o),!p.has("note")&&function(t,n,o,i){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:r,title:s,orientation:l,align:a,wrap:c=120,noWrap:d}=t;if(!r&&!s)return e.createElement("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let u=a;u&&"dynamic"!==u||(u="topBottom"===h?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===h?"right"===u?g="end":"middle"===u&&(g="middle"):g=0>n?"end":"start";const m=16,f=s?d?[s]:U(s,c):[],y=r?d?[r]:U(r,c):[],p="leftRight"===h?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:i||void 0,textAnchor:g,fontWeight:"bold"},f.map((t,n)=>e.createElement("tspan",{key:n,x:p,dy:0===n?0:m},t)))),v=f.length*m),y.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:i||void 0,textAnchor:g,y:v},y.map((t,n)=>e.createElement("tspan",{key:n,x:p,dy:0===n?0:m},t))));let x=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===h){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:i||"currentColor"})}else{const t=(f.length+y.length)*m+(y.length>0?m:0);let n=0,o=t;"bottom"===u?(n=-t,o=0):"middle"===u&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"currentColor"})}const w=Math.max(0,f.length+y.length-1)*m;let k=0;return"topBottom"===h?k=0>o?-(w+2):18:"leftRight"===h&&(k="middle"===u?-(w+m+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===u||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)}(a,v,b,u))}function ee(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e.createElement(K,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},r,{type:s}))});return e.createElement("g",null,a)}const a=i.note||{title:"none",label:i.label};return e.createElement(K,Object.assign({"data-testid":"semiotic-annotation",key:`${a.label}-${a.title}-${i.i}`,events:l},i,{type:s}))}function te(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function ne(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function oe(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function ie(e){return Math.round(100*e)/100+""}function re(t){const{width:n,height:o,totalWidth:r,totalHeight:s,margin:l,scales:a,showAxes:c,oLabel:d,rLabel:h,oFormat:u,rFormat:g,showGrid:m,title:f,legend:v,legendHoverBehavior:b,legendClickBehavior:x,legendHighlightedCategory:w,legendIsolatedCategories:k,foregroundGraphics:A,annotations:E,svgAnnotationRules:S,annotationFrame:O,xAccessor:L,yAccessor:M,annotationData:j,children:H}=t,C="radial"===(null==a?void 0:a.projection),P="horizontal"===(null==a?void 0:a.projection),B=i(()=>c&&a&&!C?a.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=a.o(e))&&void 0!==t?t:0)+a.o.bandwidth()/2,label:u?u(e):e}}):[],[c,a,u,C]),N=i(()=>c&&a&&!C?a.r.ticks(5).map(e=>({value:e,pixel:a.r(e),label:(g||ie)(e)})):[],[c,a,g,C]),$=i(()=>{if(!E||0===E.length)return null;const t=function(t,n,o){var i,r,s,l,a,c,d,h,u,g,m,f,v,b,x,w,k,A,E,S,O,L,M,j,H,C,P,B,N,$,_,W,D,z,I,R,T,q,F,G,V,X,Y,Q;switch(t.type){case"label":{let i=null,r=null;if(null!=t.pointId&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===t.pointId);if(!e)return null;i=e.x,r=e.y}else i=te(t,o),r=ne(t,o);return null==i||null==r?null:oe(i,r,o)?e.createElement(ee,{key:"ann-"+n,noteData:{x:i,y:r,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":{let i=null,r=null;if(null!=t.pointId&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===t.pointId);if(!e)return null;i=e.x,r=e.y}else i=te(t,o),r=ne(t,o);return null==i||null==r?null:oe(i,r,o)?e.createElement(ee,{key:"ann-"+n,noteData:{x:i,y:r,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 i=te(t,o);if(null==i)return null;const r=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:i+4,y:12,fill:r,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const i=ne(t,o);if(null==i)return null;const r=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:i-4,textAnchor:"end",fill:r,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:te(Object.assign(Object.assign({},e),{type:"point"}),o),y:ne(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=y(i),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:te(Object.assign(Object.assign({},e),{type:"point"}),o),y:ne(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),l=i.map(e=>e.y),a=Math.min(...s)-r,c=Math.max(...s)+r,d=Math.min(...l)-r,h=Math.max(...l)+r;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:a,y:d,width:c-a,height:h-d,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(a+c)/2,y:d-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s=t.style||{stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},r.map((n,i)=>{const r=te(n,o),l=ne(n,o);return null==r||null==l?null:e.createElement("circle",Object.assign({key:i,cx:r,cy:l,r:t.r||6},s))}))}case"bracket":{const i=te(t,o),r=ne(t,o);return e.createElement(ee,{key:"ann-"+n,noteData:{x:null!=i?i:0,y:null!=r?r: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 h=o.data||[];if(2>h.length)return null;const u=o.xAccessor||"x",g=o.yAccessor||"y",m=h.map(e=>[e[u],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>m.length)return null;const f=null!==(r=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(s=o.scales)||void 0===s?void 0:s.time,y=null!==(a=null===(l=o.scales)||void 0===l?void 0:l.y)&&void 0!==a?a:null===(c=o.scales)||void 0===c?void 0:c.value;if(!f||!y)return null;const v=t.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=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===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,h=0,u=0,g=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(d+=t,h+=t*i[e],u+=t*r[e],g+=t*i[e]*i[e],m+=t*i[e]*r[e])}if(0===d){l.push([t,r[e]]);continue}const f=d*g-h*h;if(1e-12>Math.abs(f))l.push([t,u/d]);else{const e=(d*m-h*u)/f;l.push([t,(u-e*h)/d+e*t])}}return l}(m,null!==(d=t.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?p.polynomial(m,{order:t.order||2}):p.linear(m)).points;const x=b.map(([e,t])=>`${f(e)},${y(t)}`).join(" "),w=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:f(b[b.length-1][0])+4,y:y(b[b.length-1][1])-4,fill:w,fontSize:11},t.label))}case"band":{const i=null!==(u=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==u?u:null===(g=o.scales)||void 0===g?void 0:g.value,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,s=null!==(f=null==i?void 0:i(t.y1))&&void 0!==f?f:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"#6366f1",fontSize:11},t.label))}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=null!==(b=null===(v=o.scales)||void 0===v?void 0:v.x)&&void 0!==b?b:null===(x=o.scales)||void 0===x?void 0:x.time,l=null!==(k=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==k?k:null===(A=o.scales)||void 0===A?void 0:A.value;if(!s||!l)return null;const a=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[a]&&null!=e[c]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const u=h.map(e=>`${s(e[r])},${l(e[a])}`).join(" L"),g=h.slice().reverse().map(e=>`${s(e[r])},${l(e[c])}`).join(" L"),m=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:`M${u} L${g} Z`,fill:m,fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),t.label&&h.length>0&&e.createElement("text",{x:s(h[h.length-1][r])+4,y:l(h[h.length-1][a])-4,fill:m,fontSize:11},t.label))}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(O=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(L=o.scales)||void 0===L?void 0:L.time,l=null!==(j=null===(M=o.scales)||void 0===M?void 0:M.y)&&void 0!==j?j:null===(H=o.scales)||void 0===H?void 0:H.value;if(!s||!l)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,d=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,h=Math.sqrt(d),u=null!==(C=t.threshold)&&void 0!==C?C:2,g=c-u*h,m=!1!==t.showBand,f=t.fill||"#6366f1",y=null!==(P=t.fillOpacity)&&void 0!==P?P:.1,p=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B:6,b=l(c+u*h),x=l(g),w=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>u*h});return e.createElement("g",{key:"ann-"+n},m&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),w.map((t,n)=>{const i=te(t,o),r=ne(t,o);return null==i||null==r?null:e.createElement("circle",{key:n,cx:i,cy:r,r:v,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11},t.label))}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l=null!==($=null===(N=o.scales)||void 0===N?void 0:N.x)&&void 0!==$?$:null===(_=o.scales)||void 0===_?void 0:_.time,a=null!==(D=null===(W=o.scales)||void 0===W?void 0:W.y)&&void 0!==D?D:null===(z=o.scales)||void 0===z?void 0:z.value;if(!l||!a)return null;const c=i.map(e=>[e[r],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 d;if("polynomial"===(t.method||"linear")){const e=p.polynomial(c,{order:t.order||2}).equation;d=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,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,l=(n-s*t)/e;d=e=>l+s*e}const h=c.length,u=c.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(u/Math.max(h-2,1)),m=c.reduce((e,t)=>e+t[0],0)/h,f=c.reduce((e,t)=>e+Math.pow(t[0]-m,2),0),y=null!==(I=t.confidence)&&void 0!==I?I:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(R=t.steps)&&void 0!==R?R:5,x=c[h-1][0],w=(x-c[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=d(e),n=g*Math.sqrt(1+1/h+(f>0?Math.pow(e-m,2)/f:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const E=`M${A.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),O=`${l(x)},${a(d(x))}`,L=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:E,fill:t.fill||"#6366f1",fillOpacity:null!==(T=t.fillOpacity)&&void 0!==T?T:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${S}`,fill:"none",stroke:L,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(F=t.strokeDasharray)&&void 0!==F?F:"6,3"}),t.label&&A.length>0&&e.createElement("text",{x:l(A[A.length-1].x)+4,y:a(A[A.length-1].yCenter)-4,fill:L,fontSize:11},t.label))}case"widget":{let i=null,r=null;if(null!=t.pointId&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===t.pointId);if(!e)return null;i=e.x,r=e.y}else null!=t.px&&null!=t.py?(i=t.px,r=t.py):(i=te(t,o),r=ne(t,o));if(null==i||null==r)return null;if(!oe(i,r,o))return null;const s=null!==(G=t.dx)&&void 0!==G?G:0,l=null!==(V=t.dy)&&void 0!==V?V:0,a=null!==(X=t.width)&&void 0!==X?X:32,c=null!==(Y=t.height)&&void 0!==Y?Y:32,d=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:i+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},d))}case"text":{const i=te(t,o),r=ne(t,o);return null==i||null==r?null:e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:r+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}default:return null}},i="horizontal"===(null==a?void 0:a.projection),r=(null==a?void 0:a.o)?e=>{var t;return(null!==(t=a.o(e))&&void 0!==t?t:0)+a.o.bandwidth()/2}:null,s={scales:a?{x:i?a.r:r||a.r,y:i&&r||a.r,time:a.r,value:a.r}:null,timeAxis:"x",xAccessor:L,yAccessor:M,width:n,height:o,data:j,frameType:"ordinal"};return E.map((e,n)=>{if(S){const o=S(e,n,s);return null!=o?o:t(e,n,s)}return t(e,n,s)}).filter(Boolean)},[E,S,n,o,O,L,M,j]);return c||f||v||A||$&&$.length>0||m||H?e.createElement("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${l.left},${l.top})`},m&&a&&!C&&e.createElement("g",{className:"ordinal-grid"},N.map((t,i)=>e.createElement("line",{key:"grid-"+i,x1:P?t.pixel:0,y1:P?0:t.pixel,x2:P?t.pixel:n,y2:P?o:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),c&&a&&!C&&e.createElement("g",{className:"ordinal-axes"},P?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.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))),d&&e.createElement("text",{x:15-l.left,y:o/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-l.left}, ${o/2})`,style:{userSelect:"none"}},d),e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${o})`},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))),h&&e.createElement("text",{x:n/2,y:o+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},h)):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${o})`},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))),d&&e.createElement("text",{x:n/2,y:o+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},d),e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.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))),h&&e.createElement("text",{x:15-l.left,y:o/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-l.left}, ${o/2})`,style:{userSelect:"none"}},h))),$,A,H),f&&e.createElement("text",{x:r/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof f?f:null),v&&e.createElement("g",{transform:`translate(${r-l.right+10}, ${l.top})`},"object"==typeof(_=v)&&null!==_&&!e.isValidElement(_)&&"legendGroups"in _?e.createElement(Z,{legendGroups:v.legendGroups,title:"",width:100,customHoverBehavior:b,customClickBehavior:x,highlightedCategory:w,isolatedCategories:k}):v)):null;var _}const se="undefined"==typeof window||"undefined"==typeof document,le=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?ae(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))),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1};function ae(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.w)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const ce=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);for(const t of s){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;if(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()),t._pulseIntensity&&t._pulseIntensity>0){const n=null!==(r=t._pulseGlowRadius)&&void 0!==r?r:4,o=t.r+n*t._pulseIntensity;e.beginPath(),e.arc(t.x,t.y,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.6*t._pulseIntensity,e.stroke()}e.globalAlpha=1}};function de(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 he=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s)de(e,t),e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r: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&&(de(e,t),e.globalAlpha=.35*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill()),e.globalAlpha=1},ue=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=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()}},ge=(e,t,n,o)=>{var i,r,s;const l=t.filter(e=>"connector"===e.type);if(0===l.length)return;const a=new Map;for(const e of l){const t=e.group||"_default";a.has(t)||a.set(t,[]),a.get(t).push(e)}for(const[,t]of a){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!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.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}},me=e=>[ge,...e],fe={bar:me([le]),clusterbar:me([le]),point:me([ce]),swarm:me([ce]),pie:[he],donut:[he],boxplot:me([(e,t,n,o)=>{var i,r;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",l=t.style.stroke||"#333",a=t.style.strokeWidth||1,c=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=l,e.lineWidth=a,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),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,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()}},ce]),violin:me([ue]),histogram:me([le]),ridgeline:me([ue]),timeline:me([le])},ye={top:50,right:40,bottom:60,left:70},pe={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 ve({hover:t}){var n,o,i,r;const s=t.data||{},l=t.stats,a=t.category;if(Array.isArray(s)){const t=a||(null===(n=s[0])||void 0===n?void 0:n.category)||"";if(l)return e.createElement("div",{className:"semiotic-tooltip",style:pe},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",l.n),e.createElement("div",null,"Min: ",l.min.toLocaleString()),e.createElement("div",null,"Q1: ",l.q1.toLocaleString()),e.createElement("div",null,"Median: ",l.median.toLocaleString()),e.createElement("div",null,"Q3: ",l.q3.toLocaleString()),e.createElement("div",null,"Max: ",l.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",l.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=s.length;return e.createElement("div",{className:"semiotic-tooltip",style:pe},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=s.bin&&null!=s.count){const t=s.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:pe},s.category&&e.createElement("div",{style:{fontWeight:"bold"}},s.category+""),e.createElement("div",null,"Count: ",s.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const c=s.category||s.name||s.group||s.__rName||"",d=null!==(r=null!==(i=null!==(o=s.value)&&void 0!==o?o:s.__rValue)&&void 0!==i?i:s.pct)&&void 0!==r?r:"";if(!c&&""===d){const t=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:pe},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:pe},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),""!==d&&e.createElement("div",null,"number"==typeof d?d.toLocaleString():d+""))}const be=r(function(r,a){var c,d,h;const{chartType:u,runtimeMode:g,data:m,oAccessor:f="category",rAccessor:y="value",colorAccessor:p,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:k,valueAccessor:A,categoryAccessor:E,projection:S="vertical",size:O=[600,400],responsiveWidth:L,responsiveHeight:M,margin:j,barPadding:C,innerRadius:P,normalize:B,startAngle:N,dynamicColumnWidth:$,bins:_,showOutliers:W,showIQR:D,amplitude:I,connectorAccessor:V,connectorStyle:X,rExtent:Y,oExtent:Q,extentPadding:Z=.05,oSort:U,windowMode:J="sliding",windowSize:K=200,pieceStyle:ee,summaryStyle:te,colorScheme:ne,barColors:oe,showAxes:ie=!0,oLabel:le,rLabel:ae,oFormat:ce,rFormat:de,enableHover:he=!0,hoverAnnotation:ue,tooltipContent:ge,customHoverBehavior:me,annotations:pe,svgAnnotationRules:be,showGrid:xe=!1,legend:we,legendHoverBehavior:ke,legendClickBehavior:Ae,legendHighlightedCategory:Ee,legendIsolatedCategories:Se,backgroundGraphics:Oe,foregroundGraphics:Le,title:Me,className:je,background:He,centerContent:Ce,decay:Pe,pulse:Be,transition:Ne,staleness:$e}=r,[_e,We]=function(e,i,r){const s=t(null),[l,a]=n(null);return o(()=>{if(!i&&!r)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;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[i,r]),[s,[i&&l?l.w:e[0],r&&l?l.h:e[1]]]}(O,L,M),De=i(()=>Object.assign(Object.assign({},ye),j),[j]),ze=We[0]-De.left-De.right,Ie=We[1]-De.top-De.bottom,Re=t(null),Te=t(!0),qe=t(0),Fe=t(null),Ge=t(()=>{}),[Ve,Xe]=n(null),[Ye,Qe]=n(null),[Ze,Ue]=n(0),[Je,Ke]=n(!1),et=he||ue,tt="streaming"===g,nt=i(()=>({chartType:u,runtimeMode:tt?"streaming":"bounded",windowSize:K,windowMode:J,extentPadding:Z,projection:S,oAccessor:tt?void 0:f,rAccessor:tt?void 0:y,colorAccessor:p,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:tt?k:void 0,valueAccessor:tt?A||("string"==typeof y||"function"==typeof y?y:void 0):void 0,categoryAccessor:tt?E||f:void 0,rExtent:Y,oExtent:Q,barPadding:C,innerRadius:P,normalize:B,startAngle:N,dynamicColumnWidth:$,bins:_,showOutliers:W,showIQR:D,amplitude:I,connectorAccessor:V,connectorStyle:X,oSort:U,pieceStyle:ee,summaryStyle:te,colorScheme:ne,barColors:oe,decay:Pe,pulse:Be,transition:Ne,staleness:$e}),[u,K,J,Z,S,f,y,p,b,x,w,k,A,E,Y,Q,C,P,B,N,$,_,W,D,I,V,X,U,ee,te,ne,oe,Pe,Be,Ne,$e,tt]),ot=t(null);ot.current||(ot.current=new z(nt));const it=s(()=>{qe.current||(qe.current=requestAnimationFrame(()=>Ge.current()))},[]);o(()=>{var e;null===(e=ot.current)||void 0===e||e.updateConfig(nt),Te.current=!0,it()},[nt,it]);const rt=t(null);rt.current||(rt.current=new H(e=>{const t=ot.current;t&&t.ingest(e)&&(Te.current=!0,it())}));const st=s(e=>{var t;null===(t=rt.current)||void 0===t||t.push(e)},[]),lt=s(e=>{var t;null===(t=rt.current)||void 0===t||t.pushMany(e)},[]),at=s(()=>{var e,t;null===(e=rt.current)||void 0===e||e.clear(),null===(t=ot.current)||void 0===t||t.clear(),Te.current=!0,it()},[it]);l(a,()=>({push:st,pushMany:lt,clear:at,getData:()=>{var e,t;return null!==(t=null===(e=ot.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ot.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[st,lt,at]),o(()=>{var e;m&&(null===(e=rt.current)||void 0===e||e.setBoundedData(m))},[m]);const ct=t(()=>{}),dt=t(()=>{});ct.current=e=>{if(!et)return;const t=Re.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-De.left,i=e.clientY-n.top-De.top;if(0>o||o>ze||0>i||i>Ie)return void(Fe.current&&(Fe.current=null,Xe(null),me&&me(null),it()));const r=ot.current;if(!r||0===r.scene.length)return;const s="radial"===S,l=function(e,t,n,o=30){let i=null;for(const r of e){let e=null;switch(r.type){case"rect":e=R(r,t,n);break;case"point":e=T(r,t,n);break;case"wedge":e=q(r,t,n);break;case"boxplot":e=F(r,t,n);break;case"violin":e=G(r,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(r.scene,s?o-ze/2:o,s?i-Ie/2:i);if(!l)return void(Fe.current&&(Fe.current=null,Xe(null),me&&me(null),it()));const a=Object.assign(Object.assign({data:l.datum,time:l.x,value:l.y,x:l.x,y:l.y},l.stats&&{stats:l.stats}),l.category&&{category:l.category});Fe.current=a,Xe(a),me&&(me(a),Te.current=!0),it()},dt.current=()=>{Fe.current&&(Fe.current=null,Xe(null),me&&(me(null),Te.current=!0),it())},s(e=>ct.current(e),[]);const ht=s(()=>dt.current(),[]),ut=t(-1),gt=s(e=>{const t=ot.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=ut.current,i=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===i)return;if(e.preventDefault(),0>i)return ut.current=-1,Fe.current=null,Xe(null),me&&me(null),void it();const r=0>o?0:i;ut.current=r;const s={data:(l=n[r]).datum,x:l.x,y:l.y,time:l.x,value:l.y};var l;Fe.current=s,Xe(s),me&&me(s),it()},[me,it]),mt=s(e=>{ut.current=-1,ct.current(e)},[]);Ge.current=()=>{var e,t;qe.current=0;const n=Re.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=ot.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(r),l=Te.current;l&&!s&&(i.computeScene({width:ze,height:Ie}),Te.current=!1);const a="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=We[0]*a,n.height=We[1]*a,n.style.width=We[0]+"px",n.style.height=We[1]+"px",o.scale(a,a),o.clearRect(0,0,We[0],We[1]);const c=null!==(e=null==$e?void 0:$e.threshold)&&void 0!==e?e:5e3,d=$e&&i.lastIngestTime>0&&r-i.lastIngestTime>c;d&&(o.globalAlpha=null!==(t=null==$e?void 0:$e.dimOpacity)&&void 0!==t?t:.5);const h=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=He||(h&&"transparent"!==h?h:null);g&&(o.fillStyle=g,o.fillRect(0,0,We[0],We[1]));const m="radial"===S;m?(o.save(),o.translate(De.left+ze/2,De.top+Ie/2)):o.translate(De.left,De.top);const f=fe[u]||[],y={width:ze,height:Ie};for(const e of f)e(o,i.scene,i.scales,y);m&&o.restore(),d&&(o.globalAlpha=1),l&&i.scales&&(Qe(i.scales),Ue(e=>e+1)),(null==$e?void 0:$e.showBadge)&&Ke(!!d),(s||i.hasActivePulses)&&(qe.current=requestAnimationFrame(()=>Ge.current()))},o(()=>(it(),()=>{qe.current&&(cancelAnimationFrame(qe.current),qe.current=0)}),[it]),o(()=>{Te.current=!0,it()},[u,ze,Ie,ie,He,it]),function(e,t,n,i,r,s){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const l=t.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,d=a-l.lastIngestTime>c;d!==r&&(s(d),n.current=!0,i())},1e3);return()=>clearInterval(o)},[e,r,i])}($e,ot,Te,it,Je,Ke);const ft=et&&Ve?ge?ge(Ve):e.createElement(ve,{hover:Ve}):null,yt="radial"===S,pt=Ve?yt?Ve.x+ze/2:Ve.x:0,vt=Ve?yt?Ve.y+Ie/2:Ve.y:0,bt=ft?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:De.left+pt,top:De.top+vt,transform:`translate(${pt>.7*ze?"calc(-100% - 12px)":"12px"}, ${.3*Ie>vt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},ft):null;if(se){const t=ot.current;t&&m&&(t.ingest({inserts:m,bounded:!0}),t.computeScene({width:ze,height:Ie}));const n=null!==(c=null==t?void 0:t.scene)&&void 0!==c?c:[],o=null!==(d=null==t?void 0:t.scales)&&void 0!==d?d:null,i="radial"===S,r=i?De.left+ze/2:De.left,s=i?De.top+Ie/2:De.top;return e.createElement("div",{className:"stream-ordinal-frame"+(je?" "+je:""),role:"img","aria-label":"string"==typeof Me?Me:"Ordinal chart",style:{position:"relative",width:We[0],height:We[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:We[0],height:We[1],style:{position:"absolute",left:0,top:0}},Oe&&e.createElement("g",{transform:`translate(${De.left},${De.top})`},Oe),e.createElement("g",{transform:`translate(${r},${s})`},He&&e.createElement("rect",{x:0,y:0,width:ze,height:Ie,fill:He}),n.map((t,n)=>function(t,n){var o,i,r,s,l;switch(t.type){case"rect":return e.createElement("rect",{key:"ord-rect-"+n,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:"ord-point-"+n,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 o=t,i=v().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle).endAngle(o.endAngle)({})||"";return e.createElement("path",{key:"ord-wedge-"+n,d:i,transform:`translate(${o.cx},${o.cy})`,fill:o.style.fill||"#4e79a7",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"boxplot":{const o=t,s=o.columnWidth/2;return"vertical"===o.projection?e.createElement("g",{key:"ord-boxplot-"+n},e.createElement("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:o.x-s,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:o.style.fill||"#4e79a7",fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:o.x-s,y1:o.medianPos,x2:o.x+s,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:o.x-.5*s,y1:o.minPos,x2:o.x+.5*s,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:o.x-.5*s,y1:o.maxPos,x2:o.x+.5*s,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:"ord-boxplot-"+n},e.createElement("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-s,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:o.style.fill||"#4e79a7",fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:o.medianPos,y1:o.y-s,x2:o.medianPos,y2:o.y+s,stroke:o.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:o.minPos,y1:o.y-.5*s,x2:o.minPos,y2:o.y+.5*s,stroke:o.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:o.maxPos,y1:o.y-.5*s,x2:o.maxPos,y2:o.y+.5*s,stroke:o.style.stroke||"#333",strokeWidth:1}))}case"violin":{const o=t,i=[e.createElement("path",{key:"ord-violin-path-"+n,d:o.pathString,transform:o.translateX||o.translateY?`translate(${o.translateX},${o.translateY})`:void 0,fill:o.style.fill||"#4e79a7",fillOpacity:null!==(s=o.style.fillOpacity)&&void 0!==s?s:.6,stroke:o.style.stroke||"#333",strokeWidth:o.style.strokeWidth||1})];if(o.iqrLine&&o.bounds){const t=o.bounds,r=t.x+t.width/2,s=t.y+t.height/2;t.height>t.width?i.push(e.createElement("line",{key:"ord-violin-iqr-"+n,x1:r,y1:o.iqrLine.q1Pos,x2:r,y2:o.iqrLine.q3Pos,stroke:o.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:"ord-violin-med-"+n,cx:r,cy:o.iqrLine.medianPos,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1})):i.push(e.createElement("line",{key:"ord-violin-iqr-"+n,x1:o.iqrLine.q1Pos,y1:s,x2:o.iqrLine.q3Pos,y2:s,stroke:o.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:"ord-violin-med-"+n,cx:o.iqrLine.medianPos,cy:s,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:"ord-violin-"+n},i)}case"connector":return e.createElement("line",{key:"ord-conn-"+n,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(l=t.style.opacity)&&void 0!==l?l:.5});default:return null}}(t,n)).filter(Boolean))),e.createElement(re,{width:ze,height:Ie,totalWidth:We[0],totalHeight:We[1],margin:De,scales:o,showAxes:ie,oLabel:le,rLabel:ae,oFormat:ce,rFormat:de,showGrid:xe,title:Me,legend:we,legendHoverBehavior:ke,legendClickBehavior:Ae,legendHighlightedCategory:Ee,legendIsolatedCategories:Se,foregroundGraphics:Le,annotations:pe,svgAnnotationRules:be,annotationFrame:0,xAccessor:"string"==typeof f?f:void 0,yAccessor:"string"==typeof y?y:void 0,annotationData:null==t?void 0:t.getData()}),Ce&&"radial"===S&&e.createElement("div",{style:{position:"absolute",left:De.left+ze/2,top:De.top+Ie/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ce))}return e.createElement("div",{ref:_e,className:"stream-ordinal-frame"+(je?" "+je:""),role:"img","aria-label":"string"==typeof Me?Me:"Ordinal chart",tabIndex:0,style:{position:"relative",width:L?"100%":We[0],height:M?"100%":We[1]},onMouseMove:et?mt:void 0,onMouseLeave:et?ht:void 0,onKeyDown:gt},Oe&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:We[0],height:We[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${De.left},${De.top})`},Oe)),e.createElement("canvas",{ref:Re,style:{position:"absolute",top:0,left:0,width:We[0],height:We[1]}}),e.createElement(re,{width:ze,height:Ie,totalWidth:We[0],totalHeight:We[1],margin:De,scales:Ye,showAxes:ie,oLabel:le,rLabel:ae,oFormat:ce,rFormat:de,showGrid:xe,title:Me,legend:we,legendHoverBehavior:ke,legendClickBehavior:Ae,legendHighlightedCategory:Ee,legendIsolatedCategories:Se,foregroundGraphics:Le,annotations:pe,svgAnnotationRules:be,annotationFrame:Ze,xAccessor:"string"==typeof f?f:void 0,yAccessor:"string"==typeof y?y:void 0,annotationData:null===(h=ot.current)||void 0===h?void 0:h.getData()}),Ce&&"radial"===S&&e.createElement("div",{style:{position:"absolute",left:De.left+ze/2,top:De.top+Ie/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ce),(null==$e?void 0:$e.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===$e.badgePosition?{top:4,left:4}:"bottom-left"===$e.badgePosition?{bottom:4,left:4}:"bottom-right"===$e.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Je?"#dc3545":"#28a745",color:"white"})},Je?"STALE":"LIVE"),bt)});be.displayName="StreamOrdinalFrame";const xe={category10:b,tableau10:M,set3:L,blues:O,reds:S,greens:E,oranges:A,purples:k,viridis:w,plasma:x},we=b;function ke(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):we[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+""))%we.length]}function Ae(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>e[t]))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return m().domain(o).range(n).unknown("#999");const r=xe[n]||xe.category10;if(i&&"function"==typeof r)return e=>r(Number(e)/Math.max(...o.map(Number)));{const e=Array.isArray(r)?r:we;return m().domain(o).range(e).unknown("#999")}}const Ee=c(null),Se="undefined"!=typeof window?d:o;function Oe(t){const o=c(null),r=Le(t);return[function({children:n}){const r=i(()=>Le(t),[]);return e.createElement(o.Provider,{value:r,children:n})},e=>{var t;const i=null!==(t=a(o))&&void 0!==t?t:r;return function(e,t){const[o,i]=n(t);return Se(()=>e(()=>i(t)),[e]),o}(i.subscribe,()=>e(i.getState()))}]}function Le(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Me(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,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function je(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[He,Ce]=Oe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=je(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=je(o,t);return o.set(t,Object.assign(Object.assign({},i),{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}})}})),[Pe,Be]=Oe(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 Ne(e){const t=h(),n=e.clientId||t,{name:o}=e,r=Ce(e=>e.selections.get(o)),l=Ce(e=>e.setClause),a=Ce(e=>e.clearClause),c=i(()=>!!r&&r.clauses.size>0,[r]);return{predicate:i(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Me(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};l(o,{clientId:n,type:"point",fields:t})},[n,o,l]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};l(o,{clientId:n,type:"interval",fields:t})},[n,o,l]),clear:s(()=>{a(o,n)},[a,o,n]),clientId:n}}const $e=c(!1);function _e(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.2;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}const We="#007bff";function De(e,t,n="category10"){const o=a(Ee);return i(()=>{if(t&&"function"!=typeof t)return o&&Object.keys(o).length>0?i=>o[i]||Ae(e,t,n)(i):Ae(e,t,n)},[e,t,n,o])}function ze(e,t,n){return i(()=>{if(!t)return e;const o=[...e];if("function"==typeof t)return o.sort(t);const i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}function Ie({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:r,chartId:l}){const a=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=Ne({name:(null==e?void 0:e.name)||"__unused__"}),d=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:l}=Ne({name:t});return{onHover:s(e=>{if(!e)return void l();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,l,t]),predicate:o,isActive:i}}({name:(null==a?void 0:a.name)||"hover",fields:(null==a?void 0:a.fields)||n||[]}),h=Be(e=>e.pushObservation),u=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]),d.onHover(t)}else d.onHover(null);if(i||h){const t={timestamp:Date.now(),chartType:r||"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),h&&h(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),h&&h(e)}}},[t,d,i,r,l,h]),m=s(e=>{var t,n;if(i||h){const o={timestamp:Date.now(),chartType:r||"unknown",chartId:l};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},o),{type:"click",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(s),h&&h(s)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),h&&h(e)}}},[i,h,r,l]);return{activeSelectionHook:u,customHoverBehavior:g,customClickBehavior:m}}function Re({data:e,colorBy:t,colorScale:n,showLegend:o,userMargin:r,defaults:s={top:50,bottom:60,left:70,right:40}}){const l=a($e),c=void 0!==o?o:!l&&!!t,d=i(()=>{if(c&&t)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r}){return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==i&&(t.stroke=i),void 0!==r&&(t.strokeWidth=r),t},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(i=>{const r=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=r?o(r,t,n):n?n(i):"#000000";return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:ke})},[c,t,e,n]),h=i(()=>{const e=Object.assign(Object.assign({},s),r);return d&&120>e.right&&(e.right=120),e},[s,r,d]);return{legend:d,margin:h}}function Te(e,t,o){const[r,l]=n(null),[a,c]=n(new Set),d=s(t=>{"highlight"===e&&l(t?t.label:null)},[e]),h=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]),u=i(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,r,a]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:d,onLegendClick:h,legendSelectionHook:u}}const qe={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 Fe(e,t,n){var o,i,r,s,l,a;const c=qe[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(i=t.height)&&void 0!==i?i:c.height,showAxes:c.showAxes,showGrid:null!==(r=t.showGrid)&&void 0!==r?r:c.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||c.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:c.showLegend,showLabels:null!==(a=t.showLabels)&&void 0!==a?a:c.showLabels,title:d?void 0:t.title,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const Ge={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 Ve(e,t){return"function"==typeof t?t(e):e[t]}function Xe(e,t){return t?t(e):null==e?"":"number"==typeof e?e.toLocaleString():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 Ye(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=Ve(t,o);l=Xe(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=Ve(t,o);a.push({label:n,value:Xe(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Xe(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Xe(t[e[0]],i))}}const c=Object.assign(Object.assign({},Ge),r);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},l&&e.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},l),a.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&l?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function Qe(e){return!0===e?Ye():"function"==typeof e?e:!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Ye(e):Ye())}function Ze(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ue(e,t){return"function"==typeof t?t(e):e[t]}function Je({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:i,pieData:r=!1}){return s=>{var l;const a=r?(null===(l=s.data)||void 0===l?void 0:l[0])||s.data||s:s.data||s,c=Ue(a,t),d=Ue(a,n),h=o?Ue(a,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:Ge},e.createElement("div",{style:{fontWeight:"bold"}},Ze(c)),e.createElement("div",{style:{marginTop:4}},Ze(d)),null!=h&&e.createElement("div",{style:{marginTop:2,opacity:.8}},i||("string"==typeof(u=o)?u:"value"),": ",Ze(h)));var u}}function Ke({componentName:t,message:n,width:o,height:i}){return e.createElement("div",{role:"alert",style:{width:o,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)))}class et 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(Ke,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var tt;const nt="undefined"!=typeof process&&"production"!==(null===(tt=process.env)||void 0===tt?void 0:tt.NODE_ENV);function ot({componentName:t,width:n,height:o,children:i}){return e.createElement(et,{fallback:i=>e.createElement(Ke,{componentName:t,message:i.message,width:n,height:o})},i)}const it={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"},rt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function st(t,n,o,i){return!1===i||t&&Array.isArray(t)&&t.length>0||t&&!Array.isArray(t)?null:e.createElement("div",{style:Object.assign(Object.assign({},it),{width:n,height:o})},i||"No data available")}function lt(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),l=Math.floor((o-(i*(r+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:i},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},rt),{position:"absolute",top:l+o*(r+s),left:Math.floor(.1*n),width:30+Math.round(50*Math.random())+"%",height:r,opacity:.5+o%2*.2})})))}function at(e,t,n,o){if(!nt)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function ct(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function dt(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=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=ct(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function ht({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(!t||!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=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=dt(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function ut(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",valueAccessor:a="value",orientation:c="vertical",valueFormat:d,colorBy:h,colorScheme:u="category10",sort:g=!1,barPadding:m=5,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A,legendInteraction:E}=t,S=n.width,O=n.height,L=n.enableHover,M=n.showGrid,j=n.showLegend,H=n.title,C=n.categoryLabel,P=n.valueLabel,B=lt(k,S,O);if(B)return B;const N=st(o,S,O,A);if(N)return N;const $=o||[];at("BarChart",$,"categoryAccessor",l),at("BarChart",$,"valueAccessor",a);const{activeSelectionHook:_,customHoverBehavior:W}=Ie({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:x,chartType:"BarChart",chartId:w}),D=ze($,g,a),z=De($,h,u),I=i(()=>{if(!h)return[];const e=new Set;for(const t of $){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[$,h]),R=Te(E,h,I),T=i(()=>R.legendSelectionHook?R.legendSelectionHook:_,[R.legendSelectionHook,_]),q=i(()=>e=>{const t={};return t.fill=h?ke(e,h,z):We,t},[h,z]),F=i(()=>_e(q,T,v),[q,T,v]),{legend:G,margin:V}=Re({data:D,colorBy:h,colorScale:z,showLegend:j,userMargin:r,defaults:n.marginDefaults}),X=i(()=>Je({categoryAccessor:l,valueAccessor:a,groupAccessor:h&&h!==l?h:void 0,groupLabel:"string"==typeof h?h:"group"}),[l,a,h]),Y=ht({componentName:"BarChart",data:$,accessors:{categoryAccessor:l,valueAccessor:a}});if(Y)return e.createElement(Ke,{componentName:"BarChart",message:Y,width:S,height:O});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:D,oAccessor:l,rAccessor:a,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:F,size:[S,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,barPadding:m,enableHover:L,showAxes:n.showAxes,oLabel:C,rLabel:P,rFormat:d,showGrid:M,oSort:g},G&&{legend:G}),E&&"none"!==E&&{legendHoverBehavior:R.onLegendHover,legendClickBehavior:R.onLegendClick,legendHighlightedCategory:R.highlightedCategory,legendIsolatedCategories:R.isolatedCategories}),H&&{title:H}),s&&{className:s}),{tooltipContent:Qe(f)||X}),(b||x)&&{customHoverBehavior:W}),y&&y.length>0&&{annotations:y}),p);return e.createElement(ot,{componentName:"BarChart",width:S,height:O},e.createElement(be,Object.assign({},Q)))}function gt(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",stackBy:a,valueAccessor:c="value",orientation:d="vertical",valueFormat:h,colorBy:u,colorScheme:g="category10",normalize:m=!1,barPadding:f=5,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E,legendInteraction:S}=t,O=n.width,L=n.height,M=n.enableHover,j=n.showGrid,H=n.showLegend,C=n.title,P=n.categoryLabel,B=n.valueLabel,N=lt(A,O,L);if(N)return N;const $=st(o,O,L,E);if($)return $;const _=o||[],W=u||a,{activeSelectionHook:D,customHoverBehavior:z}=Ie({selection:b,linkedHover:x,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:w,chartType:"StackedBarChart",chartId:k}),I=De(_,W,g),R=i(()=>{if(!W)return[];const e=new Set;for(const t of _){const n="function"==typeof W?W(t):t[W];null!=n&&e.add(n+"")}return Array.from(e)},[_,W]),T=Te(S,W,R),q=i(()=>T.legendSelectionHook?T.legendSelectionHook:D,[T.legendSelectionHook,D]),F=i(()=>e=>W?{fill:ke(e,W,I)}:{fill:We},[W,I]),G=i(()=>_e(F,q,b),[F,q,b]),{legend:V,margin:X}=Re({data:_,colorBy:W,colorScale:I,showLegend:H,userMargin:r,defaults:n.marginDefaults}),Y=i(()=>Je({categoryAccessor:a,valueAccessor:c,groupAccessor:l}),[a,l,c]),Q=ht({componentName:"StackedBarChart",data:_,accessors:{categoryAccessor:l,valueAccessor:c},requiredProps:{stackBy:a}});if(Q)return e.createElement(Ke,{componentName:"StackedBarChart",message:Q,width:O,height:L});const Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:_,oAccessor:l,rAccessor:c,stackBy:a,normalize:m,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:G,size:[O,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,barPadding:f,enableHover:M,showAxes:n.showAxes,oLabel:P,rLabel:B,rFormat:h,showGrid:j},V&&{legend:V}),S&&"none"!==S&&{legendHoverBehavior:T.onLegendHover,legendClickBehavior:T.onLegendClick,legendHighlightedCategory:T.highlightedCategory,legendIsolatedCategories:T.isolatedCategories}),C&&{title:C}),s&&{className:s}),{tooltipContent:Qe(y)||Y}),(x||w)&&{customHoverBehavior:z}),p&&p.length>0&&{annotations:p}),v);return e.createElement(ot,{componentName:"StackedBarChart",width:O,height:L},e.createElement(be,Object.assign({},Z)))}function mt(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",groupBy:a,valueAccessor:c="value",orientation:d="vertical",valueFormat:h,colorBy:u,colorScheme:g="category10",barPadding:m=5,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A,legendInteraction:E}=t,S=n.width,O=n.height,L=n.enableHover,M=n.showGrid,j=n.showLegend,H=n.title,C=n.categoryLabel,P=n.valueLabel,B=lt(k,S,O);if(B)return B;const N=st(o,S,O,A);if(N)return N;const $=o||[],_=u||a,{activeSelectionHook:W,customHoverBehavior:D}=Ie({selection:v,linkedHover:b,fallbackFields:_?["string"==typeof _?_:""]:[],unwrapData:!0,onObservation:x,chartType:"GroupedBarChart",chartId:w}),z=De($,_,g),I=i(()=>{if(!_)return[];const e=new Set;for(const t of $){const n="function"==typeof _?_(t):t[_];null!=n&&e.add(n+"")}return Array.from(e)},[$,_]),R=Te(E,_,I),T=i(()=>R.legendSelectionHook?R.legendSelectionHook:W,[R.legendSelectionHook,W]),q=i(()=>e=>_?{fill:ke(e,_,z)}:{fill:We},[_,z]),F=i(()=>_e(q,T,v),[q,T,v]),{legend:G,margin:V}=Re({data:$,colorBy:_,colorScale:z,showLegend:j,userMargin:r,defaults:n.marginDefaults}),X=i(()=>Je({categoryAccessor:a,valueAccessor:c,groupAccessor:l}),[a,l,c]),Y=ht({componentName:"GroupedBarChart",data:$,accessors:{categoryAccessor:l,valueAccessor:c},requiredProps:{groupBy:a}});if(Y)return e.createElement(Ke,{componentName:"GroupedBarChart",message:Y,width:S,height:O});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:$,oAccessor:l,rAccessor:c,groupBy:a,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:F,size:[S,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,barPadding:m,enableHover:L,showAxes:n.showAxes,oLabel:C,rLabel:P,rFormat:h,showGrid:M},G&&{legend:G}),E&&"none"!==E&&{legendHoverBehavior:R.onLegendHover,legendClickBehavior:R.onLegendClick,legendHighlightedCategory:R.highlightedCategory,legendIsolatedCategories:R.isolatedCategories}),H&&{title:H}),s&&{className:s}),{tooltipContent:Qe(f)||X}),(b||x)&&{customHoverBehavior:D}),y&&y.length>0&&{annotations:y}),p);return e.createElement(ot,{componentName:"GroupedBarChart",width:S,height:O},e.createElement(be,Object.assign({},Q)))}function ft(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",valueAccessor:a="value",orientation:c="vertical",valueFormat:d,colorBy:h,colorScheme:u="category10",sizeBy:g,sizeRange:m=[3,8],pointRadius:f=4,pointOpacity:y=.7,categoryPadding:p=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:E,loading:S,emptyContent:O,legendInteraction:L}=t,M=n.width,j=n.height,H=n.enableHover,C=n.showGrid,P=n.showLegend,B=n.title,N=n.categoryLabel,$=n.valueLabel,_=lt(S,M,j);if(_)return _;const W=st(o,M,j,O);if(W)return W;const D=o||[],{activeSelectionHook:z,customHoverBehavior:I}=Ie({selection:w,linkedHover:k,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:A,chartType:"SwarmPlot",chartId:E}),R=De(D,h,u),T=i(()=>{if(!h)return[];const e=new Set;for(const t of D){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[D,h]),q=Te(L,h,T),F=i(()=>q.legendSelectionHook?q.legendSelectionHook:z,[q.legendSelectionHook,z]),G=i(()=>{if(!g)return;const e=D.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[D,g]),V=i(()=>e=>{const t={fillOpacity:y};return t.fill=h?ke(e,h,R):We,t.r=g?function(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):e[t],!o)return i;const[r,s]=o,[l,a]=n;return s===r?(l+a)/2:l+(i-r)/(s-r)*(a-l)}(e,g,m,G):f,t},[h,R,g,m,G,f,y]),X=i(()=>_e(V,F,w),[V,F,w]),{legend:Y,margin:Q}=Re({data:D,colorBy:h,colorScale:R,showLegend:P,userMargin:r,defaults:n.marginDefaults}),Z=i(()=>Je({categoryAccessor:l,valueAccessor:a,groupAccessor:h||void 0}),[l,a,h]),U=ht({componentName:"SwarmPlot",data:D,accessors:{categoryAccessor:l,valueAccessor:a}});if(U)return e.createElement(Ke,{componentName:"SwarmPlot",message:U,width:M,height:j});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:D,oAccessor:l,rAccessor:a,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:X,size:[M,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,barPadding:p,enableHover:H,showAxes:n.showAxes,oLabel:N,rLabel:$,rFormat:d,showGrid:C},Y&&{legend:Y}),L&&"none"!==L&&{legendHoverBehavior:q.onLegendHover,legendClickBehavior:q.onLegendClick,legendHighlightedCategory:q.highlightedCategory,legendIsolatedCategories:q.isolatedCategories}),B&&{title:B}),s&&{className:s}),{tooltipContent:Qe(v)||Z}),(k||A)&&{customHoverBehavior:I}),b&&b.length>0&&{annotations:b}),x);return e.createElement(ot,{componentName:"SwarmPlot",width:M,height:j},e.createElement(be,Object.assign({},J)))}function yt(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",valueAccessor:a="value",orientation:c="vertical",valueFormat:d,colorBy:h,colorScheme:u="category10",showOutliers:g=!0,categoryPadding:m=20,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A,legendInteraction:E}=t,S=n.width,O=n.height,L=n.enableHover,M=n.showGrid,j=n.showLegend,H=n.title,C=n.categoryLabel,P=n.valueLabel,B=lt(k,S,O);if(B)return B;const N=st(o,S,O,A);if(N)return N;const $=o||[],{activeSelectionHook:_,customHoverBehavior:W}=Ie({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:x,chartType:"BoxPlot",chartId:w}),D=De($,h,u),z=i(()=>{if(!h)return[];const e=new Set;for(const t of $){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[$,h]),I=Te(E,h,z),R=i(()=>I.legendSelectionHook?I.legendSelectionHook:_,[I.legendSelectionHook,_]),T=i(()=>e=>{const t=h?ke(e,h,D):We;return{fill:t,stroke:t,fillOpacity:.8}},[h,D]),q=i(()=>_e(T,R,v),[T,R,v]),{legend:F,margin:G}=Re({data:$,colorBy:h,colorScale:D,showLegend:j,userMargin:r,defaults:n.marginDefaults}),V=i(()=>t=>{const n=t.stats||(t.data||t).stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:Ge},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())))},[]),X=ht({componentName:"BoxPlot",data:$,accessors:{categoryAccessor:l,valueAccessor:a}});if(X)return e.createElement(Ke,{componentName:"BoxPlot",message:X,width:S,height:O});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:$,oAccessor:l,rAccessor:a,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:q,showOutliers:g,size:[S,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,barPadding:m,enableHover:L,showAxes:n.showAxes,oLabel:C,rLabel:P,rFormat:d,showGrid:M},F&&{legend:F}),E&&"none"!==E&&{legendHoverBehavior:I.onLegendHover,legendClickBehavior:I.onLegendClick,legendHighlightedCategory:I.highlightedCategory,legendIsolatedCategories:I.isolatedCategories}),H&&{title:H}),s&&{className:s}),{tooltipContent:Qe(f)||V}),(b||x)&&{customHoverBehavior:W}),y&&y.length>0&&{annotations:y}),p);return e.createElement(ot,{componentName:"BoxPlot",width:S,height:O},e.createElement(be,Object.assign({},Y)))}function pt(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",valueAccessor:a="value",bins:c=25,relative:d=!1,valueFormat:h,colorBy:u,colorScheme:g="category10",categoryPadding:m=20,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A}=t,E=n.width,S=n.height,O=n.enableHover,L=n.showGrid,M=n.showLegend,j=n.title,H=n.categoryLabel,C=n.valueLabel,P=lt(k,E,S);if(P)return P;const B=st(o,E,S,A);if(B)return B;const N=o||[],{activeSelectionHook:$,customHoverBehavior:_}=Ie({selection:v,linkedHover:b,fallbackFields:u?["string"==typeof u?u:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:x,chartType:"Histogram",chartId:w}),W=De(N,u,g),D=i(()=>e=>{const t=u?ke(e,u,W):We;return{fill:t,stroke:t,fillOpacity:.8}},[u,W]),z=i(()=>_e(D,$,v),[D,$,v]),{legend:I,margin:R}=Re({data:N,colorBy:u,colorScale:W,showLegend:M,userMargin:r,defaults:n.marginDefaults}),T=i(()=>t=>{const n=t.data||t,o=n.category||t.category||"",i=n.count,r=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:Ge},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=i&&e.createElement("div",null,"Count: ",i),r&&2===r.length&&e.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),q=ht({componentName:"Histogram",data:N,accessors:{categoryAccessor:l,valueAccessor:a}});if(q)return e.createElement(Ke,{componentName:"Histogram",message:q,width:E,height:S});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:N,oAccessor:l,rAccessor:a,projection:"horizontal",summaryStyle:z,bins:c,normalize:d,size:[E,S],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:R,barPadding:m,enableHover:O,showAxes:n.showAxes,oLabel:H,rLabel:C,rFormat:h,showGrid:L},I&&{legend:I}),j&&{title:j}),s&&{className:s}),{tooltipContent:Qe(f)||T}),(b||x)&&{customHoverBehavior:_}),y&&y.length>0&&{annotations:y}),p);return e.createElement(ot,{componentName:"Histogram",width:E,height:S},e.createElement(be,Object.assign({},F)))}function vt(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",valueAccessor:a="value",orientation:c="vertical",bins:d=25,showIQR:h=!0,valueFormat:u,colorBy:g,colorScheme:m="category10",categoryPadding:f=20,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E}=t,S=n.width,O=n.height,L=n.enableHover,M=n.showGrid,j=n.showLegend,H=n.title,C=n.categoryLabel,P=n.valueLabel,B=lt(A,S,O);if(B)return B;const N=st(o,S,O,E);if(N)return N;const $=o||[],{activeSelectionHook:_,customHoverBehavior:W}=Ie({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:w,chartType:"ViolinPlot",chartId:k}),D=De($,g,m),z=i(()=>e=>{const t=g?ke(e,g,D):We;return{fill:t,stroke:t,fillOpacity:.6}},[g,D]),I=i(()=>_e(z,_,b),[z,_,b]),{legend:R,margin:T}=Re({data:$,colorBy:g,colorScale:D,showLegend:j,userMargin:r,defaults:n.marginDefaults}),q=i(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",i=t.stats;if(i)return e.createElement("div",{className:"semiotic-tooltip",style:Ge},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",i.n),e.createElement("div",null,"Min: ",i.min.toLocaleString()),e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),e.createElement("div",null,"Max: ",i.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const r=(Array.isArray(t.data)?t.data:[]).map(e=>{const t="function"==typeof a?a(e):e[a];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),s=r.length,l=s>0?r[Math.floor(s/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Ge},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),s>0&&e.createElement("div",null,"n = ",s),null!=l&&e.createElement("div",null,"Median: ",l.toLocaleString()))},[a]),F=ht({componentName:"ViolinPlot",data:$,accessors:{categoryAccessor:l,valueAccessor:a}});if(F)return e.createElement(Ke,{componentName:"ViolinPlot",message:F,width:S,height:O});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:$,oAccessor:l,rAccessor:a,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:I,bins:d,showIQR:h,size:[S,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,barPadding:f,enableHover:L,showAxes:n.showAxes,oLabel:C,rLabel:P,rFormat:u,showGrid:M},R&&{legend:R}),H&&{title:H}),s&&{className:s}),{tooltipContent:Qe(y)||q}),(x||w)&&{customHoverBehavior:W}),p&&p.length>0&&{annotations:p}),v);return e.createElement(ot,{componentName:"ViolinPlot",width:S,height:O},e.createElement(be,Object.assign({},G)))}function bt(t){var n;const o=Fe(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:r,margin:s,className:l,categoryAccessor:a="category",valueAccessor:c="value",orientation:d="horizontal",valueFormat:h,colorBy:u,colorScheme:g="category10",sort:m=!0,dotRadius:f=5,categoryPadding:y=10,tooltip:p,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:A,loading:E,emptyContent:S,legendInteraction:O}=t,L=o.width,M=o.height,j=o.enableHover,H=o.showGrid,C=o.showLegend,P=o.title,B=o.categoryLabel,N=o.valueLabel,$=lt(E,L,M);if($)return $;const _=st(r,L,M,S);if(_)return _;const W=r||[],{activeSelectionHook:D,customHoverBehavior:z}=Ie({selection:x,linkedHover:w,fallbackFields:u?["string"==typeof u?u:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,chartType:"DotPlot",chartId:A}),I=ze(W,m,c),R=De(W,u,g),T=i(()=>{if(!u)return[];const e=new Set;for(const t of W){const n="function"==typeof u?u(t):t[u];null!=n&&e.add(n+"")}return Array.from(e)},[W,u]),q=Te(O,u,T),F=i(()=>q.legendSelectionHook?q.legendSelectionHook:D,[q.legendSelectionHook,D]),G=i(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=u?ke(e,u,R):We,t},[u,R,f]),V=i(()=>_e(G,F,x),[G,F,x]),{legend:X,margin:Y}=Re({data:I,colorBy:u,colorScale:R,showLegend:C,userMargin:s,defaults:o.marginDefaults}),Q=i(()=>Je({categoryAccessor:a,valueAccessor:c}),[a,c]),Z=ht({componentName:"DotPlot",data:W,accessors:{categoryAccessor:a,valueAccessor:c}});if(Z)return e.createElement(Ke,{componentName:"DotPlot",message:Z,width:L,height:M});const U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:I,oAccessor:a,rAccessor:c,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:V,size:[L,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y,barPadding:y,enableHover:j,showAxes:o.showAxes,oLabel:B,rLabel:N,rFormat:h,showGrid:H,oSort:m},X&&{legend:X}),O&&"none"!==O&&{legendHoverBehavior:q.onLegendHover,legendClickBehavior:q.onLegendClick,legendHighlightedCategory:q.highlightedCategory,legendIsolatedCategories:q.isolatedCategories}),P&&{title:P}),l&&{className:l}),{tooltipContent:Qe(p)||Q}),(w||k)&&{customHoverBehavior:z}),v&&v.length>0&&{annotations:v}),b);return e.createElement(ot,{componentName:"DotPlot",width:L,height:M},e.createElement(be,Object.assign({},U)))}function xt(t){var n,o;const r=Fe(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title}),{data:s,margin:l,className:a,categoryAccessor:c="category",valueAccessor:d="value",colorBy:h,colorScheme:u="category10",startAngle:g=0,tooltip:m,annotations:f,frameProps:y={},selection:p,linkedHover:v,onObservation:b,chartId:x,loading:w,emptyContent:k,legendInteraction:A}=t,E=r.width,S=r.height,O=r.enableHover,L=r.showLegend,M=r.title,j=lt(w,E,S);if(j)return j;const H=st(s,E,S,k);if(H)return H;const C=s||[],P=h||c,{activeSelectionHook:B,customHoverBehavior:N}=Ie({selection:p,linkedHover:v,fallbackFields:P?["string"==typeof P?P:""]:[],unwrapData:!0,onObservation:b,chartType:"PieChart",chartId:x}),$=De(C,P,u),_=i(()=>{if(!P)return[];const e=new Set;for(const t of C){const n="function"==typeof P?P(t):t[P];null!=n&&e.add(n+"")}return Array.from(e)},[C,P]),W=Te(A,P,_),D=i(()=>W.legendSelectionHook?W.legendSelectionHook:B,[W.legendSelectionHook,B]),z=i(()=>e=>P?{fill:ke(e,P,$)}:{fill:We},[P,$]),I=i(()=>_e(z,D,p),[z,D,p]),{legend:R,margin:T}=Re({data:C,colorBy:P,colorScale:$,showLegend:L,userMargin:l,defaults:r.marginDefaults}),q=i(()=>Je({categoryAccessor:c,valueAccessor:d,groupAccessor:h&&h!==c?h:void 0,groupLabel:"string"==typeof h?h:"group",pieData:!0}),[c,d,h]),F=ht({componentName:"PieChart",data:C,accessors:{categoryAccessor:c,valueAccessor:d}});if(F)return e.createElement(Ke,{componentName:"PieChart",message:F,width:E,height:S});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:C,oAccessor:c,rAccessor:d,projection:"radial",pieceStyle:I,startAngle:g,size:[E,S],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,enableHover:O,showAxes:!1},R&&{legend:R}),A&&"none"!==A&&{legendHoverBehavior:W.onLegendHover,legendClickBehavior:W.onLegendClick,legendHighlightedCategory:W.highlightedCategory,legendIsolatedCategories:W.isolatedCategories}),M&&{title:M}),a&&{className:a}),{tooltipContent:Qe(m)||q}),(v||b)&&{customHoverBehavior:N}),f&&f.length>0&&{annotations:f}),y);return e.createElement(ot,{componentName:"PieChart",width:E,height:S},e.createElement(be,Object.assign({},G)))}function wt(t){var n,o;const r=Fe(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover}),{data:s,margin:l,className:a,categoryAccessor:c="category",valueAccessor:d="value",innerRadius:h=60,centerContent:u,colorBy:g,colorScheme:m="category10",startAngle:f=0,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E,legendInteraction:S}=t,O=r.width,L=r.height,M=r.enableHover,j=r.showLegend,H=r.title,C=lt(A,O,L);if(C)return C;const P=st(s,O,L,E);if(P)return P;const B=s||[],N=g||c,{activeSelectionHook:$,customHoverBehavior:_}=Ie({selection:b,linkedHover:x,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:w,chartType:"DonutChart",chartId:k}),W=De(B,N,m),D=i(()=>{if(!N)return[];const e=new Set;for(const t of B){const n="function"==typeof N?N(t):t[N];null!=n&&e.add(n+"")}return Array.from(e)},[B,N]),z=Te(S,N,D),I=i(()=>z.legendSelectionHook?z.legendSelectionHook:$,[z.legendSelectionHook,$]),R=i(()=>e=>N?{fill:ke(e,N,W)}:{fill:We},[N,W]),T=i(()=>_e(R,I,b),[R,I,b]),{legend:q,margin:F}=Re({data:B,colorBy:N,colorScale:W,showLegend:j,userMargin:l,defaults:r.marginDefaults}),G=i(()=>Je({categoryAccessor:c,valueAccessor:d,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,d,g]),V=ht({componentName:"DonutChart",data:B,accessors:{categoryAccessor:c,valueAccessor:d}});if(V)return e.createElement(Ke,{componentName:"DonutChart",message:V,width:O,height:L});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:B,oAccessor:c,rAccessor:d,projection:"radial",pieceStyle:T,innerRadius:h,startAngle:f,centerContent:u,size:[O,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,enableHover:M,showAxes:!1},q&&{legend:q}),S&&"none"!==S&&{legendHoverBehavior:z.onLegendHover,legendClickBehavior:z.onLegendClick,legendHighlightedCategory:z.highlightedCategory,legendIsolatedCategories:z.isolatedCategories}),H&&{title:H}),a&&{className:a}),{tooltipContent:Qe(y)||G}),(x||w)&&{customHoverBehavior:_}),p&&p.length>0&&{annotations:p}),v);return e.createElement(ot,{componentName:"DonutChart",width:O,height:L},e.createElement(be,Object.assign({},X)))}function kt(t){const n=Fe(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:r,className:s,categoryAccessor:l="category",valueAccessor:a="value",orientation:c="horizontal",bins:d=20,amplitude:h=1.5,valueFormat:u,colorBy:g,colorScheme:m="category10",categoryPadding:f=5,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E}=t,S=n.width,O=n.height,L=n.enableHover,M=n.showGrid,j=n.showLegend,H=n.title,C=n.categoryLabel,P=n.valueLabel,B=lt(A,S,O);if(B)return B;const N=st(o,S,O,E);if(N)return N;const $=o||[],{activeSelectionHook:_,customHoverBehavior:W}=Ie({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:k}),D=De($,g,m),z=i(()=>e=>{const t=g?ke(e,g,D):We;return{fill:t,stroke:t,fillOpacity:.5}},[g,D]),I=i(()=>_e(z,_,b),[z,_,b]),{legend:R,margin:T}=Re({data:$,colorBy:g,colorScale:D,showLegend:j,userMargin:r,defaults:n.marginDefaults}),q=i(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",i=t.stats;return i?e.createElement("div",{className:"semiotic-tooltip",style:Ge},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",i.n),e.createElement("div",null,"Min: ",i.min.toLocaleString()),e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),e.createElement("div",null,"Max: ",i.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):e.createElement("div",{className:"semiotic-tooltip",style:Ge},e.createElement("div",{style:{fontWeight:"bold"}},o+""))},[]),F=ht({componentName:"RidgelinePlot",data:$,accessors:{categoryAccessor:l,valueAccessor:a}});if(F)return e.createElement(Ke,{componentName:"RidgelinePlot",message:F,width:S,height:O});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline",data:$,oAccessor:l,rAccessor:a,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:I,bins:d,size:[S,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,barPadding:f,enableHover:L,showAxes:n.showAxes,oLabel:C,rLabel:P,rFormat:u,showGrid:M,oSort:!1,amplitude:h},R&&{legend:R}),H&&{title:H}),s&&{className:s}),{tooltipContent:Qe(y)||q}),(x||w)&&{customHoverBehavior:W}),p&&p.length>0&&{annotations:p}),v);return e.createElement(ot,{componentName:"RidgelinePlot",width:S,height:O},e.createElement(be,Object.assign({},G)))}ut.displayName="BarChart",gt.displayName="StackedBarChart",mt.displayName="GroupedBarChart",ft.displayName="SwarmPlot",yt.displayName="BoxPlot",pt.displayName="Histogram",vt.displayName="ViolinPlot",bt.displayName="DotPlot",xt.displayName="PieChart",wt.displayName="DonutChart",kt.displayName="RidgelinePlot";export{ut as BarChart,yt as BoxPlot,wt as DonutChart,bt as DotPlot,mt as GroupedBarChart,pt as Histogram,xt as PieChart,kt as RidgelinePlot,gt as StackedBarChart,be as StreamOrdinalFrame,ft as SwarmPlot,vt as ViolinPlot};
1
+ import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as i,createContext as r,useContext as a,useCallback as l,useSyncExternalStore as s,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{scaleOrdinal as h,scaleBand as g,scaleLinear as m}from"d3-scale";import{schemeCategory10 as f,interpolatePlasma as y,interpolateViridis as p,interpolatePurples as v,interpolateOranges as b,interpolateGreens as x,interpolateReds as w,interpolateBlues as k,schemeSet3 as A,schemeTableau10 as E}from"d3-scale-chromatic";import{quantile as S}from"d3-array";import{packEnclose as O}from"d3-hierarchy";import{area as P,curveCatmullRom as j,curveCardinal as M,curveBasis as L,curveStepBefore as C,curveStepAfter as B,curveStep as H,curveMonotoneY as _,curveMonotoneX as D,curveLinear as N,arc as z}from"d3-shape";import W from"regression";class ${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 R{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 F(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const G={category10:f,tableau10:E,set3:A,blues:k,reds:w,greens:x,oranges:b,purples:v,viridis:p,plasma:y},V=f,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))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return h().domain(o).range(n).unknown("#999");const r=G[n]||G.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:V;return h().domain(o).range(e).unknown("#999")}}function Z(e,t,n,o,i,r,a){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:a}}function U(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],a=Math.min(t.width,t.height)/2-4,l="donut"===o.chartType?o.innerRadius||60:0,s=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=s+e.pctStart*c,n=s+(e.pctStart+e.pct)*c,o=i(e.pieceData[0],e.name);r.push({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return r}function J(e){var t,n,o;const i=e.length,r=e[0],a=e[i-1];return{n:i,min:r,q1:null!==(t=S(e,.25))&&void 0!==t?t:r,median:null!==(n=S(e,.5))&&void 0!==n?n:(r+a)/2,q3:null!==(o=S(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}const ee={bar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getStack:a,resolvePieceStyle:l}=e,{r:s,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=i.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+=r(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const[r,c]of t){let t=c.total;g&&n>0&&(t/=n);const m=l(c.pieces[0],a?r:e.name),f=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=s(0>t?i:o+t),a=0>t?s(i+t)-s(i):s(o)-s(o+t);u.push(Z(e.x,n,e.width,Math.abs(a),m,f,r)),0>t?i+=t:o+=t}else if(h){const n=s(0>t?i+t:o),a=0>t?s(i)-s(i+t):s(o+t)-s(o);u.push(Z(n,e.x,Math.abs(a),e.width,m,f,r)),0>t?i+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:i,getGroup:r,resolvePieceStyle:a}=e,{r:l,projection:s}=n,c=[],u="vertical"===s,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=r?r(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,s=new Map;for(const t of e.pieceData){const e=r?r(t):"_default";s.has(e)||s.set(e,[]),s.get(e).push(t)}for(let r=0;d.length>r;r++){const h=s.get(d[r])||[];for(const s of h){const h=i(s),g=a(s,d[r]);if(u){const i=e.x+r*t+n/2,a=l(0),u=l(h);c.push(Z(i,Math.min(a,u),o,Math.abs(a-u),g,s,d[r]))}else{const i=e.x+r*t+n/2,a=l(0),u=l(h);c.push(Z(Math.min(a,u),i,Math.abs(u-a),o,g,s,d[r]))}}}}return c},point:function(e,t){var n,o;const{scales:i,columns:r,getR:a,multiScales:l,resolvePieceStyle:s}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,m=l.length>0,f=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=m&&l[i]||c,p=s(t,e.name),v=p.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*f,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:p,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:a,projection:l}=n,s=[],c="vertical"===l;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],l=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(l),m=c?a(l):e.middle+h;s.push({type:"point",x:g,y:m,r:d,style:u,datum:o})}}return s},pie:U,donut:U,boxplot:function(e,t){var n,o,i,r,a;const{scales:l,columns:s,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=l,m=[],f="vertical"===g,y=!1!==c.showOutliers;for(const e of Object.values(s)){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 l=t[0],s=t[t.length-1],c=null!==(n=S(t,.25))&&void 0!==n?n:l,g=null!==(o=S(t,.5))&&void 0!==o?o:(l+s)/2,p=null!==(i=S(t,.75))&&void 0!==i?i:s,v=p-c,b=c-1.5*v,x=p+1.5*v,w=null!==(r=t.find(e=>e>=b))&&void 0!==r?r:l,k=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:s,A=d(e.pieceData[0],e.name),E=[];if(y)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=f?e.middle:h(n),i=f?h(n):e.middle;E.push({px:o,py:i,value:n,datum:t})}}if(m.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(g),q3Pos:h(p),maxPos:h(k),stats:{n:t.length,min:w,q1:c,median:g,q3:p,max:k,mean:t.reduce((e,t)=>e+t,0)/t.length},style:A,datum:e.pieceData,category:e.name,outliers:E}),y)for(const e of E)m.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return m},violin:function(e,t){var n,o,i;const{scales:r,columns:a,config:l,getR:s,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,m=l.bins||20,f=!1!==l.showIQR;for(const e of Object.values(a)){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 r=t[0],a=t[t.length-1],l=(a-r)/m||1,d=Array(m).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/l),m-1)]++;const y=Math.max(...d,1),p=e.width/2*.9;let v="";if(g){for(let t=0;m>t;t++){const n=u(r+(t+.5)*l),o=d[t]/y*p;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=m-1;t>=0;t--){const n=u(r+(t+.5)*l);v+=` L ${e.middle-d[t]/y*p} ${n}`}v+=" Z"}else{for(let t=0;m>t;t++){const n=u(r+(t+.5)*l),o=d[t]/y*p;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=m-1;t>=0;t--)v+=` L ${u(r+(t+.5)*l)} ${e.middle+d[t]/y*p}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(f&&t.length>=4){const l=null!==(n=S(t,.25))&&void 0!==n?n:r,s=null!==(o=S(t,.5))&&void 0!==o?o:(r+a)/2,c=null!==(i=S(t,.75))&&void 0!==i?i:a;x={q1Pos:u(l),medianPos:u(s),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(a),u(r)),width:e.width,height:Math.abs(u(a)-u(r))}:{x:Math.min(u(r),u(a)),y:e.x,width:Math.abs(u(a)-u(r)),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:i,getR:r,resolveSummaryStyle:a}=e,{r:l}=n,s=[],c=i.bins||25,u=i.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>r(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,i=Array(c).fill(0);for(const e of t)i[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...i,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===i[t])continue;const r=(u?i[t]/d:i[t]/h)*e.width*.9,a=l(n+t*o),c=l(n+(t+1)*o);s.push(Z(Math.min(a,c),e.x+e.width-r,Math.abs(c-a),r,g,{bin:t,count:i[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return s},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:l}=e,{r:s,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/r),d-1)]++;const m=Math.max(...c,1),f=l(e.pieceData[0],e.name),y=e.width*g;let p="";if(h){const t=e.x+e.width;p=`M ${s(o)} ${t}`;for(let e=0;d>e;e++)p+=` L ${s(o+(e+.5)*r)} ${t-c[e]/m*y}`;p+=` L ${s(i)} ${t} Z`}else{const t=e.x;p=`M ${t} ${s(o)}`;for(let e=0;d>e;e++){const n=s(o+(e+.5)*r);p+=` L ${t+c[e]/m*y} ${n}`}p+=` L ${t} ${s(i)} Z`}const v=h?{x:Math.min(s(o),s(i)),y:e.x,width:Math.abs(s(i)-s(o)),height:e.width}:{x:e.x,y:Math.min(s(i),s(o)),width:e.width,height:Math.abs(s(i)-s(o))};u.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:v,stats:J(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:a,projection:l}=n,s=[],c="horizontal"===l;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,l]=n,u=r(t,e.name);if(c){const n=a(Math.min(o,l)),i=a(Math.max(o,l));s.push(Z(n,e.x,i-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,l)),i=a(Math.min(o,l));s.push(Z(e.x,n,e.width,i-n,u,t,e.name))}}return s}};class te{constructor(e){this.rExtent=new R,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=q(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>F(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new R)):(this.getR=F(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(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(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,r),l="horizontal"===i,s=null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1;let c,u;if("radial"===i){c=g().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(a).range([o,n])}else l?(c=g().domain(r).range([0,e.height]).padding(s),u=m().domain(a).range([0,e.width])):(c=g().domain(r).range([0,e.width]).padding(s),u=m().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{const r=this.rExtents[i];r.dirty&&r.recalculate(n,o);let[a,s]=r.extent;a===1/0&&(a=0,s=1);const c=s-a,u=c>0?c*(t.extentPadding||.05):1;return a-=u,s+=u,a>0&&(a=0),l?m().domain([a,s]).range([0,e.width]):m().domain([a,s]).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,r,c,i,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 i=this.config.chartType,r=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===i||"donut"===i))return[0,1];let a=0,l=0;if("bar"===i&&this.getStack&&this.config.normalize)a=0,l=1;else if("bar"===i&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>l&&(l=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===i){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>l&&(l=e),a>e&&(a=e)}else if("clusterbar"===i)for(const t of e){const e=this.getR(t);e>l&&(l=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&&(l=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(l=this.config.rExtent[1]));const s=l-a,c=s>0?s*r: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])||(l+=c),"bar"!==i&&"clusterbar"!==i||(a>0&&(a=0),0>l&&(l=0)),[a,l]}buildColumns(e,t,n,o,i){var r;const a={},l=new Map;for(const t of e){const e=this.getO(t);l.has(e)||l.set(e,[]),l.get(e).push(t)}let s=0;if("radial"===o)for(const t of e)s+=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=l.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 r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=l.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=s>0?o/s:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r: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:i,pctStart:d},d+=i}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 i=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:i,getO:r}=e;if(!i||!n)return[];const a=[],{projection:l}=n,s=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=i(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===l?0:e.h/2)),s.has(n)||s.set(n,[]),s.get(n).push({x:o,y:a,datum:t,category:r(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of s)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],i=t[n+1],r="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:i.x,y2:i.y,style:r,datum:o.datum,group:e})}}return a}(n,i);i=[...e,...i]}return i}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,i;const r=this.config.decay;if(!r||1>=t)return 1;const a=null!==(n=r.minOpacity)&&void 0!==n?n:.1,l=t-1-e;switch(r.type){case"linear":return a+(1-l/(t-1))*(1-a);case"exponential":{const e=null!==(o=r.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,l/e)*(1-a)}case"step":return(null!==(i=r.stepThreshold)&&void 0!==i?i:.5*t)>l?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=new Map;for(let e=0;t.length>e;e++)r.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=r.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,i),l=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:l*a})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,l=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",s=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i: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 i=t[n],l=this.config.oAccessor;if(("function"==typeof l?l(i):i[l||"category"])!==e)continue;const s=this.timestampBuffer.get(n);if(null==s)continue;const c=r-s;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=l);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;a>i&&(n._pulseIntensity=1-i/a,n._pulseColor=l,n._pulseGlowRadius=s)}}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,i,r,a,l,s,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 m=new Set,f=new Map;for(let e=0;this.scene.length>e;e++){const l=this.scene[e],s=this.getNodeKey(l,f);if(!s)continue;l._transitionKey=s;const c=this.prevPositionMap.get(s);"point"===l.type?c?(m.add(s),l._targetOpacity=null!==(t=l.style.opacity)&&void 0!==t?t:1,c.x===l.x&&c.y===l.y||(l._targetX=l.x,l._targetY=l.y,l.x=c.x,l.y=c.y,g=!0)):(l._targetOpacity=null!==(n=l.style.opacity)&&void 0!==n?n:1,l.style=Object.assign(Object.assign({},l.style),{opacity:0}),g=!0):"rect"===l.type&&(c?(m.add(s),l._targetOpacity=null!==(o=l.style.opacity)&&void 0!==o?o:1,c.x===l.x&&c.y===l.y&&c.w===l.w&&c.h===l.h||(l._targetX=l.x,l._targetY=l.y,l._targetW=l.w,l._targetH=l.h,l.x=c.x,l.y=c.y,l.w=null!==(i=c.w)&&void 0!==i?i:l.w,l.h=null!==(r=c.h)&&void 0!==r?r:l.h,g=!0)):(l._targetOpacity=null!==(a=l.style.opacity)&&void 0!==a?a:1,l.style=Object.assign(Object.assign({},l.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)m.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(l=t.r)&&void 0!==l?l:3,style:{opacity:null!==(s=t.opacity)&&void 0!==s?s: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 i=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),r=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(i,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=T(i,e._targetOpacity,r)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=T(o.x,e._targetX,r),e.y=T(o.y,e._targetY,r)}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=T(i,e._targetOpacity,r)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=T(n.x,e._targetX,r),e.y=T(n.y,e._targetY,r),void 0!==n.w&&(e.w=T(n.w,e._targetW,r),e.h=T(n.h,e._targetH,r))}}if(i>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX)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 ie(e,t,n){const o=t-e.x,i=n-e.y,r=Math.sqrt(o*o+i*i);return r>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:r}}function re(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const a=ne(Math.atan2(i,o)),l=ne(e.startAngle),s=ne(e.endAngle);if(!(l>s?a>=l||s>=a:a>=l&&s>=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 i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function le(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:a}=e.bounds;return o>t||t>o+r||i>n||n>i+a?null:{datum:e.datum,x:o+r/2,y:i+a/2,distance:0,category:e.category,stats:e.stats}}const se={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 i;return i="function"==typeof n?n(e):(0,se[n])(o(e,t)),i}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:i,domain:r,label:a,format:l}=t,s=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=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:i(r[0]+n*(r[1]-r[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:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),e.createElement("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[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:i(r[1]-n*(r[1]-r[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)"},s(r[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function ge(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,legendInteraction:l,title:s="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[m,f]=e.useState(0),y=e.useCallback((e,t)=>{g(e),f(t)},[]),p="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:s,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,i,r,a,l,s,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,m=[];let f=0;const y=!(!n&&!o),p="isolate"===u||void 0===u&&null!=r;return g.forEach((t,u)=>{const v=ce(t,u,d,h),b=de(t,i,r),x=r&&r.size>0&&r.has(t.label);m.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${f})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?s===a&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?x||!1:void 0,"aria-current":y&&!p&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(s,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(s,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(ue,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),f+=22}),m})(t,o,i,r,a,l,s,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:l}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let o=0;t.label&&(o+=16);const m=((t,n,o,i,r,a,l,s,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,m=[];let f=0;const y=!(!n&&!o),p="isolate"===u||void 0===u&&null!=r;return g.forEach((t,u)=>{const v=ce(t,u,d,h),b=de(t,i,r),x=r&&r.size>0&&r.has(t.label);m.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?s===a&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?x||!1:void 0,"aria-current":y&&!p&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?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(s,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(s,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(ue,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),f+=26+7*t.label.length}),{items:m,offset:f}})(t,i,r,a,l,s,c,n,u,d);o+=m.offset+5,g.push(Object.assign(Object.assign({label:t.label},m),{offset:o})),h+=o+12});let m=Math.max(0,(o-h)/2);const f=[];return g.forEach((o,i)=>{const r=t[i];r.label&&(f.push(e.createElement("text",{key:"legend-text-"+i,transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),m+=16),f.push(e.createElement("g",{key:"legend-group-"+i,className:"legend-item",transform:`translate(${m},0)`},o.items)),m+=o.offset+5,t[i+1]&&f.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+i,stroke:"gray",x1:m,y1:-8,x2:m,y2:n+0+8})),m+=12}),e.createElement("g",null,f)})({legendGroups:n||[],title:s,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:l}),v=!(!o&&!i);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==l&&(void 0!==l||null==a))||void 0,"aria-label":"Chart legend"},void 0!==s&&""!==s&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),p)}function me(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let a="";for(const e of i)a&&a.length+1+e.length>o?(r.push(a),a=e):a=a?`${a} ${e}`:e;return a&&r.push(a),r}function fe(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 ye(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:a,ny:l,note:s,connector:c,subject:u,type:d,color:h,className:g,disable:m,events:f={},"data-testid":y}=t,p=new Set(Array.isArray(m)?m:[]);let v=i||0,b=r||0;null!=a&&(v=a-n),null!=l&&(b=l-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f),!p.has("connector")&&function(t,n,o,i,r,a){const l=[];let s=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==a?void 0:a.radius)){if("callout-rect"===r&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const i=e/2,r=o/2,a=t-i,l=n-r;if(0!==a||0!==l){const t=Math.abs(a),n=Math.abs(l),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;s=i+a*h,c=r+l*h}}}else if("bracket"===r&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(s=e/2,c=n):void 0!==t&&(s=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);s=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-s,2)+Math.pow(n-c,2))>.5&&(l.push(e.createElement("line",{key:"connector-line",x1:s,y1:c,x2:t,y2:n,stroke:i||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,a=Math.atan2(n-c,t-s);l.push(e.createElement("path",{key:"connector-arrow",d:`M${s},${c}L${s+o*Math.cos(a+r)},${c+o*Math.sin(a+r)}L${s+o*Math.cos(a-r)},${c+o*Math.sin(a-r)}Z`,fill:i||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},l)}(v,b,c,h,x,u),!p.has("subject")&&function(t,n,o,i,r){var a;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.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,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e.createElement("rect",{key:"subject-rect",width:t,height:i,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,a=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.createElement("line",{key:"threshold-line",x1:i,y1:(n.y1||0)-a,x2:i,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-a;l.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.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)||l.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&&l.push(e.createElement("path",{key:"bracket-path",d:fe((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"},l)}(x,u,h,n,o),!p.has("note")&&function(t,n,o,i){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:r,title:a,orientation:l,align:s,wrap:c=120,noWrap:u}=t;if(!r&&!a)return e.createElement("g",{className:"annotation-note"});let d=l;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=s;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 m=16,f=a?u?[a]:me(a,c):[],y=r?u?[r]:me(r,c):[],p="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:i||void 0,textAnchor:g,fontWeight:"bold"},f.map((t,n)=>e.createElement("tspan",{key:n,x:p,dy:0===n?0:m},t)))),v=f.length*m),y.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:i||void 0,textAnchor:g,y:v},y.map((t,n)=>e.createElement("tspan",{key:n,x:p,dy:0===n?0:m},t))));let x=null;if((a||r)&&(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:i||"currentColor"})}else{const t=(f.length+y.length)*m+(y.length>0?m: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:i||"currentColor"})}const w=Math.max(0,f.length+y.length-1)*m;let k=0;return"topBottom"===d?k=0>o?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+m+(y.length>0&&f.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)}(s,v,b,h))}function pe(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,a="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),s=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e.createElement(ye,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},r,{type:a}))});return e.createElement("g",null,s)}const s=i.note||{title:"none",label:i.label};return e.createElement(ye,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${i.i}`,events:l},i,{type:a}))}const ve={linear:N,monotoneX:D,monotoneY:_,step:H,stepAfter:B,stepBefore:C,basis:L,cardinal:M,catmullRom:j};function be(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function xe(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function we(e,t,n){var o,i,r,a;const l=e.anchor||"fixed";if("latest"===l){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,a;const l=e.data;if(!l||0===l.length)return null;const s=l[l.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!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=s[e.xAccessor||"x"],h=s[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let s=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,c=t.y)}if(null!=s&&null!=c||(s=be(e,n),c=xe(e,n)),null!=s&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:s,y:c}),{x:s,y:c};if("sticky"===l){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function ke(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Ae(t){const{width:n,height:o,totalWidth:r,totalHeight:a,margin:l,scales:s,showAxes:c,showGrid:u,rFormat:d}=t,h="radial"===(null==s?void 0:s.projection),g="horizontal"===(null==s?void 0:s.projection),m=i(()=>!s||h?[]:s.r.ticks(5).map(e=>({value:e,pixel:s.r(e),label:(d||Ee)(e)})),[s,d,h]),f=u&&s&&!h,y=c&&s&&!h;return f||y?e.createElement("svg",{width:r,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${l.left},${l.top})`},f&&e.createElement("g",{className:"ordinal-grid"},m.map((t,i)=>e.createElement("line",{key:"grid-"+i,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}))),y&&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 Ee(e){return Math.round(100*e)/100+""}function Se(n){var o,r;const{width:a,height:l,totalWidth:s,totalHeight:c,margin:u,scales:d,showAxes:h,oLabel:g,rLabel:m,oFormat:f,rFormat:y,showGrid:p,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:w,legendHighlightedCategory:k,legendIsolatedCategories:A,legendPosition:E="right",foregroundGraphics:S,annotations:j,svgAnnotationRules:M,xAccessor:L,yAccessor:C,annotationData:B,underlayRendered:H,children:_}=n,D="radial"===(null==d?void 0:d.projection),z="horizontal"===(null==d?void 0:d.projection),$=i(()=>h&&d&&!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:f?f(e):e}}):[],[h,d,f,D]),I=i(()=>h&&d&&!D?d.r.ticks(5).map(e=>({value:e,pixel:d.r(e),label:(y||Ee)(e)})):[],[h,d,y,D]),R=t(new Map),T=t(null!==(o=null==j?void 0:j.length)&&void 0!==o?o:0),F=null!==(r=null==j?void 0:j.length)&&void 0!==r?r:0;T.current!==F&&(T.current=F,R.current=new Map);const q=i(()=>{if(!j||0===j.length)return null;const t=function(t,n,o){var i,r,a,l,s,c,u,d,h,g,m,f,y,p,v,b,x,w,k,A,E,S,j,M,L,C,B,H,_,D,z,$,I,R,T,F,q,G,V,X,Y,Q,K,Z;switch(t.type){case"label":{const i=we(t,n,o);if(!i)return null;const{x:r,y:a}=i;return ke(r,a,o)?e.createElement(pe,{key:"ann-"+n,noteData:{x:r,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 i=we(t,n,o);if(!i)return null;const{x:r,y:a}=i;return ke(r,a,o)?e.createElement(pe,{key:"ann-"+n,noteData:{x:r,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 i=be(t,o);if(null==i)return null;const r=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:i+4,y:12,fill:r,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const i=xe(t,o);if(null==i)return null;const r=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:i-4,textAnchor:"end",fill:r,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const i=(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>i.length)return null;const r=O(i),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:r.x,cy:r.y,r:r.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:r.x,y:r.y-r.r-a-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"rect-enclose":{const i=(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>i.length)return null;const r=t.padding||10,a=i.map(e=>e.x),l=i.map(e=>e.y),s=Math.min(...a)-r,c=Math.max(...a)+r,u=Math.min(...l)-r,d=Math.max(...l)+r;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:s,y:u,width:c-s,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:(s+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.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},r.map((n,i)=>{const r=be(n,o),l=xe(n,o);return null==r||null==l?null:e.createElement("circle",Object.assign({key:"hl-"+i,cx:r,cy:l,r:t.r||6},a))}))}case"bracket":{const i=be(t,o),r=xe(t,o);return e.createElement(pe,{key:"ann-"+n,noteData:{x:null!=i?i:0,y:null!=r?r: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",m=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>m.length)return null;const f=null!==(r=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(a=o.scales)||void 0===a?void 0:a.time,y=null!==(s=null===(l=o.scales)||void 0===l?void 0:l.y)&&void 0!==s?s:null===(c=o.scales)||void 0===c?void 0:c.value;if(!f||!y)return null;const p=t.method||"linear";let v;v="loess"===p?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]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),s=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===s?0:o[e]/s;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],m+=t*i[e]*r[e])}if(0===u){l.push([t,r[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))l.push([t,h/u]);else{const e=(u*m-d*h)/f;l.push([t,(h-e*d)/u+e*t])}}return l}(m,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===p?W.polynomial(m,{order:t.order||2}):W.linear(m)).points;const b=v.map(([e,t])=>`${f(e)},${y(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:f(v[v.length-1][0])+4,y:y(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const i=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,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,a=null!==(f=null==i?void 0:i(t.y1))&&void 0!==f?f:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(r,a),width:o.width||0,height:Math.abs(a-r),fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(r,a)-4,textAnchor:"end",fill:t.color||"#6366f1",fontSize:11},t.label))}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",a=null!==(p=null===(y=o.scales)||void 0===y?void 0:y.x)&&void 0!==p?p:null===(v=o.scales)||void 0===v?void 0:v.time,l=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||!l)return null;const s=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=i.filter(e=>null!=e[s]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const h=ve[o.curve||"linear"]||N,g=P().x(e=>a(e[r])).y0(e=>l(e[c])).y1(e=>l(e[s])).curve(h)(d);if(!g)return null;const m=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:m,fillOpacity:null!==(k=t.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][r])+4,y:l(d[d.length-1][s])-4,fill:m,fontSize:11},t.label))}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",a=null!==(E=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==E?E:null===(S=o.scales)||void 0===S?void 0:S.time,l=null!==(M=null===(j=o.scales)||void 0===j?void 0:j.y)&&void 0!==M?M:null===(L=o.scales)||void 0===L?void 0:L.value;if(!a||!l)return null;const s=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const c=s.reduce((e,t)=>e+t,0)/s.length,u=s.reduce((e,t)=>e+Math.pow(t-c,2),0)/s.length,d=Math.sqrt(u),h=null!==(C=t.threshold)&&void 0!==C?C:2,g=c-h*d,m=!1!==t.showBand,f=t.fill||"#6366f1",y=null!==(B=t.fillOpacity)&&void 0!==B?B:.1,p=t.anomalyColor||"#ef4444",v=null!==(H=t.anomalyRadius)&&void 0!==H?H:6,b=l(c+h*d),x=l(g),w=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},m&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),w.map((t,n)=>{const i=be(t,o),r=xe(t,o);return null==i||null==r?null:e.createElement("circle",{key:"anomaly-"+n,cx:i,cy:r,r:v,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11},t.label))}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",a=o.yAccessor||"y",l=null!==(D=null===(_=o.scales)||void 0===_?void 0:_.x)&&void 0!==D?D:null===(z=o.scales)||void 0===z?void 0:z.time,s=null!==(I=null===($=o.scales)||void 0===$?void 0:$.y)&&void 0!==I?I:null===(R=o.scales)||void 0===R?void 0:R.value;if(!l||!s)return null;const c=i.map(e=>[e[r],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=W.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,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const a=(e*i-t*n)/r,l=(n-a*t)/e;u=e=>l+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)),m=c.reduce((e,t)=>e+t[0],0)/d,f=c.reduce((e,t)=>e+Math.pow(t[0]-m,2),0),y=null!==(T=t.confidence)&&void 0!==T?T:.95,p=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,v=null!==(F=t.steps)&&void 0!==F?F: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+(f>0?Math.pow(e-m,2)/f:0))*p;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${l(e.x)},${s(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${l(e.x)},${s(e.yLower)}`).join(" L")} Z`,E=k.map(e=>`${l(e.x)},${s(e.yCenter)}`).join(" "),S=`${l(b)},${s(u(b))}`,O=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:`${S} ${E}`,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&&k.length>0&&e.createElement("text",{x:l(k[k.length-1].x)+4,y:s(k[k.length-1].yCenter)-4,fill:O,fontSize:11},t.label))}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=we(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!ke(i,r,o))return null;const a=null!==(X=t.dx)&&void 0!==X?X:0,l=null!==(Y=t.dy)&&void 0!==Y?Y:0,s=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:i+a-s/2,y:r+l-c/2,width:s,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:s,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const i=we(t,n,o);if(!i)return null;const{x:r,y:a}=i;return e.createElement("text",{key:"ann-text-"+n,x:r+(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,i={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:l,data:B,frameType:"ordinal",stickyPositionCache:R.current};return j.map((e,n)=>{if(M){const o=M(e,n,i);return null!=o?o:t(e,n,i)}return t(e,n,i)}).filter(Boolean)},[j,M,a,l,d,L,C,B]);return h||v||b||S||q&&q.length>0||p||_?e.createElement("svg",{role:"img",width:s,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})`},p&&d&&!D&&!H&&e.createElement("g",{className:"ordinal-grid"},I.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:z?t.pixel:0,y1:z?0:t.pixel,x2:z?t.pixel:a,y2:z?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!D&&e.createElement("g",{className:"ordinal-axes"},z?e.createElement(e.Fragment,null,!H&&e.createElement("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.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:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${l/2})`,style:{userSelect:"none"}},g),!H&&e.createElement("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${l})`},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))),m&&e.createElement("text",{x:a/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},m)):e.createElement(e.Fragment,null,!H&&e.createElement("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${l})`},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:l+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:l,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))),m&&e.createElement("text",{x:15-u.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${l/2})`,style:{userSelect:"none"}},m))),q,S,_),v&&e.createElement("text",{x:s/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:i,margin:r,legendPosition:a="right",title:l,legendHoverBehavior:s,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===a||"bottom"===a;let m,f;return"left"===a?(m=4,f=r.top):"top"===a?(m=0,f=l?32:8):"bottom"===a?(m=0,f=i-r.bottom+50):(m=o-r.right+10,f=r.top),e.createElement("g",{transform:`translate(${m}, ${f})`},"object"==typeof(y=n)&&null!==y&&"gradient"in y?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:s,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var y}({legend:b,totalWidth:s,totalHeight:c,margin:u,legendPosition:E,title:v,legendHoverBehavior:x,legendClickBehavior:w,legendHighlightedCategory:k,legendIsolatedCategories:A})):null}const Oe="undefined"==typeof window||"undefined"==typeof document,Pe={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function je(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=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks"},r=["point","line","area","rect","heatcell","circle","candlestick"],a=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}function Me({scene:t,chartType:n}){var o,i,r,a;const l=[];for(const e of t){if(l.length>=50)break;"point"===e.type?l.push({label:"Point",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+""}}):"rect"===e.type?l.push({label:"Bar",values:{category:(null===(o=e.datum)||void 0===o?void 0:o.category)||"",value:Math.round(100*(null!==(r=null===(i=e.datum)||void 0===i?void 0:i.value)&&void 0!==r?r:0))/100+""}}):"heatcell"===e.type&&l.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===l.length)return null;const s=new Set;for(const e of l)for(const t of Object.keys(e.values))s.add(t);const c=Array.from(s);return e.createElement("table",{style:Pe,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,l.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:Pe},n)}function Ce(n){const o=r(null),c=Be(n);return[function({children:t}){const r=i(()=>Be(n),[]);return e.createElement(o.Provider,{value:r,children:t})},e=>{var n;const i=null!==(n=a(o))&&void 0!==n?n:c,r=t(e);r.current=e;const u=l(()=>r.current(i.getState()),[i]),d=l(()=>r.current(i.getState()),[i]);return s(i.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}},_e={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}},[De,Ne]=Ce(e=>({theme:He,setTheme(t){e(e=>"light"===t?{theme:He}:"dark"===t?{theme:_e}:{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 ze(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function We(e,t,n=.3){ze(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 $e(e,t,n=.6){var o,i,r,a,l;if(!ze(t))return;const s=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+s*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(l=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==l?l: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){ze(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const Re=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i)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))),We(e,t),e.globalAlpha=1};function Te(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,a=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,a,o,i,i)}else{const r=i+o,a=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,a,i,i)}e.restore()}const Fe=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i: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()),$e(e,t),e.globalAlpha=1}}finally{e.restore()}};function qe(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 i,r;const a=t.filter(e=>"wedge"===e.type);for(const t of a)qe(e,t),e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r: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&&(qe(e,t),Ie(e,t)),e.globalAlpha=1},Ve=(e,t,n,o)=>{var i,r;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!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.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 i,r,a;const l=t.filter(e=>"connector"===e.type);if(0===l.length)return;const s=new Map;for(const e of l){const t=e.group||"_default";s.has(t)||s.set(t,[]),s.get(t).push(e)}for(const[,t]of s){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!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.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([Re]),clusterbar:Ye([Re]),point:Ye([Fe]),swarm:Ye([Fe]),pie:[Ge],donut:[Ge],boxplot:Ye([(e,t,n,o)=>{var i,r;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",l=t.style.stroke||"#333",s=t.style.strokeWidth||1,c=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=l,e.lineWidth=s,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),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,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()}},Fe]),violin:Ye([Ve]),histogram:Ye([Re]),ridgeline:Ye([Ve]),timeline:Ye([Re])},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,i,r,a,l;const s=t.data||{},c=t.stats,u=t.category;if(Array.isArray(s)){const t=u||(null===(n=s[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=s.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!=s.bin&&null!=s.count){const t=s.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:Ze},s.category&&e.createElement("div",{style:{fontWeight:"bold"}},s.category+""),e.createElement("div",null,"Count: ",s.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(s).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 m=(d&&null!=s[d]?s[d]:null)||s.category||s.name||s.group||s.__rName||"",f=null!==(l=null!==(a=null!==(r=null!==(i=null!==(o=s.__aggregateValue)&&void 0!==o?o:h&&null!=s[h]?s[h]:null)&&void 0!==i?i:s.value)&&void 0!==r?r:s.__rValue)&&void 0!==a?a:s.pct)&&void 0!==l?l:"";if(!m&&""===f){const t=Object.entries(s).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},m&&e.createElement("div",{style:{fontWeight:"bold"}},m+""),""!==f&&e.createElement("div",null,"number"==typeof f?f.toLocaleString():f+""))}const Je=c(function(r,a){var s,c,d,h,g,m,f;const{chartType:y,runtimeMode:p,data:v,oAccessor:b="category",rAccessor:x="value",colorAccessor:w,stackBy:k,groupBy:A,multiAxis:E,timeAccessor:S,valueAccessor:O,categoryAccessor:P,projection:j="vertical",size:M=[600,400],responsiveWidth:L,responsiveHeight:C,margin:B,barPadding:H,innerRadius:_,normalize:D,startAngle:N,dynamicColumnWidth:W,bins:I,showOutliers:R,showIQR:T,amplitude:F,connectorAccessor:q,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:se=!0,oLabel:ce,rLabel:ue,oFormat:de,rFormat:he,enableHover:ge=!0,hoverAnnotation:me,tooltipContent:fe,customHoverBehavior:ye,annotations:pe,svgAnnotationRules:ve,showGrid:be=!1,legend:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Ee,legendIsolatedCategories:Pe,legendPosition:Ce,backgroundGraphics:Be,foregroundGraphics:He,title:_e,className:De,background:ze,centerContent:We,decay:$e,pulse:Ie,transition:Re,staleness:Te,accessibleTable:Fe}=r,[qe,Ge]=function(e,i,r){const a=t(null),[l,s]=n(null);return o(()=>{if(!i&&!r)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;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[i,r]),[a,[i&&l?l.w:e[0],r&&l?l.h:e[1]]]}(M,L,C),Ve=i(()=>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),it=t(()=>{}),[rt,at]=n(null),[lt,st]=n(null),[ct,ut]=n(0),[dt,ht]=n(!1),gt=ge||me,mt="streaming"===p,ft=i(()=>({chartType:y,runtimeMode:mt?"streaming":"bounded",windowSize:Z,windowMode:K,extentPadding:Y,projection:j,oAccessor:mt?void 0:b,rAccessor:mt?void 0:x,colorAccessor:w,stackBy:k,groupBy:A,multiAxis:E,timeAccessor:mt?S:void 0,valueAccessor:mt?O||("string"==typeof x||"function"==typeof x?x:void 0):void 0,categoryAccessor:mt?P||b:void 0,rExtent:V,oExtent:X,barPadding:H,innerRadius:_,normalize:D,startAngle:N,dynamicColumnWidth:W,bins:I,showOutliers:R,showIQR:T,amplitude:F,connectorAccessor:q,connectorStyle:G,oSort:Q,pieceStyle:U,summaryStyle:J,colorScheme:ee,barColors:ne,decay:$e,pulse:Ie,transition:Re,staleness:Te}),[y,Z,K,Y,j,b,x,w,k,A,E,S,O,P,V,X,H,_,D,N,W,I,R,T,F,q,G,Q,U,J,ee,ne,$e,Ie,Re,Te,mt]),yt=t(null);yt.current||(yt.current=new te(ft));const pt=l(()=>{nt.current||(nt.current=requestAnimationFrame(()=>it.current()))},[]);o(()=>{var e;null===(e=yt.current)||void 0===e||e.updateConfig(ft),et.current=!0,pt()},[ft,pt]),o(()=>{et.current=!0,pt()},[tt,pt]);const vt=t(null);vt.current||(vt.current=new $(e=>{const t=yt.current;t&&t.ingest(e)&&(et.current=!0,pt())}));const bt=l(e=>{var t;null===(t=vt.current)||void 0===t||t.push(e)},[]),xt=l(e=>{var t;null===(t=vt.current)||void 0===t||t.pushMany(e)},[]),wt=l(()=>{var e,t;null===(e=vt.current)||void 0===e||e.clear(),null===(t=yt.current)||void 0===t||t.clear(),et.current=!0,pt()},[pt]);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=yt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=yt.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 kt=t(()=>{}),At=t(()=>{});kt.current=e=>{if(!gt)return;const t=Je.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ve.left,i=e.clientY-n.top-Ve.top;if(0>o||o>Xe||0>i||i>Ye)return void(ot.current&&(ot.current=null,at(null),ye&&ye(null),pt()));const r=yt.current;if(!r||0===r.scene.length)return;const a="radial"===j,l=function(e,t,n,o=30){let i=null;for(const r of e){let e=null;switch(r.type){case"rect":e=oe(r,t,n);break;case"point":e=ie(r,t,n);break;case"wedge":e=re(r,t,n);break;case"boxplot":e=ae(r,t,n);break;case"violin":e=le(r,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(r.scene,a?o-Xe/2:o,a?i-Ye/2:i);if(!l)return void(ot.current&&(ot.current=null,at(null),ye&&ye(null),pt()));const s=l.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{data:s,time:l.x,value:l.y,x:l.x,y:l.y}),l.stats&&{stats:l.stats}),l.category&&{category:l.category}),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:y});ot.current=c,at(c),ye&&(ye(c),et.current=!0),pt()},At.current=()=>{ot.current&&(ot.current=null,at(null),ye&&(ye(null),et.current=!0),pt())},l(e=>kt.current(e),[]);const Et=l(()=>At.current(),[]),St=t(-1),Ot=l(e=>{const t=yt.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=St.current,i=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===i)return;if(e.preventDefault(),0>i)return St.current=-1,ot.current=null,at(null),ye&&ye(null),void pt();const r=0>o?0:i;St.current=r;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[r])),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:y});ot.current=a,at(a),ye&&ye(a),pt()},[ye,pt]),Pt=l(e=>{St.current=-1,kt.current(e)},[]);it.current=()=>{var e,t;nt.current=0;const n=Je.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=yt.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(r),l=et.current;l&&!a&&(i.computeScene({width:Xe,height:Ye}),et.current=!1),(l||a)&&n.setAttribute("aria-label",je(i.scene,y+" chart"));const s="undefined"!=typeof window&&window.devicePixelRatio||1,c=Ge[0]*s,u=Ge[1]*s;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(s,0,0,s,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&&i.lastIngestTime>0&&r-i.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():"",m=ze||(g&&"transparent"!==g?g:null);m&&(o.fillStyle=m,o.fillRect(0,0,Ge[0],Ge[1]));const f="radial"===j;f?(o.save(),o.translate(Ve.left+Xe/2,Ve.top+Ye/2)):o.translate(Ve.left,Ve.top);const p=Qe[y]||[],v={width:Xe,height:Ye};for(const e of p)e(o,i.scene,i.scales,v);f&&o.restore(),h&&(o.globalAlpha=1),l&&i.scales&&(st(i.scales),ut(e=>e+1)),(null==Te?void 0:Te.showBadge)&&ht(!!h),(a||i.hasActivePulses)&&(nt.current=requestAnimationFrame(()=>it.current()))},o(()=>(pt(),()=>{nt.current&&(cancelAnimationFrame(nt.current),nt.current=0)}),[pt]),o(()=>{et.current=!0,pt()},[y,Xe,Ye,se,ze,pt]),function(e,t,n,i,r,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const l=t.current;if(!l||0===l.lastIngestTime)return;const s="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=s-l.lastIngestTime>c;u!==r&&(a(u),n.current=!0,i())},1e3);return()=>clearInterval(o)},[e,r,i])}(Te,yt,et,pt,dt,ht);const jt=gt&&rt?fe?fe(rt):e.createElement(Ue,{hover:rt}):null,Mt="radial"===j,Lt=rt?Mt?rt.x+Xe/2:rt.x:0,Ct=rt?Mt?rt.y+Ye/2:rt.y:0,Bt=jt?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"}},jt):null;if(Oe){const t=yt.current;t&&v&&(t.ingest({inserts:v,bounded:!0}),t.computeScene({width:Xe,height:Ye}));const n=null!==(s=null==t?void 0:t.scene)&&void 0!==s?s:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,i="radial"===j,r=i?Ve.left+Xe/2:Ve.left,a=i?Ve.top+Ye/2:Ve.top;return e.createElement("div",{className:"stream-ordinal-frame"+(De?" "+De:""),role:"img","aria-label":"string"==typeof _e?_e:"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(${r},${a})`},ze&&e.createElement("rect",{x:0,y:0,width:Xe,height:Ye,fill:ze}),n.map((t,n)=>function(t,n){var o,i,r,a,l;const s=t.category||t.group||"",c=e=>`ord-${t.type}-${s}-${n}-${e}`,u=`ord-${t.type}-${s}-${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=z().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!==(i=n.style.fillOpacity)&&void 0!==i?i:.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!==(r=n.style.fillOpacity)&&void 0!==r?r:.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,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:i,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:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:r,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!==(l=t.style.opacity)&&void 0!==l?l:.5});default:return null}}(t,n)).filter(Boolean))),e.createElement(Se,{width:Xe,height:Ye,totalWidth:Ge[0],totalHeight:Ge[1],margin:Ve,scales:o,showAxes:se,oLabel:ce,rLabel:ue,oFormat:de,rFormat:he,showGrid:be,title:_e,legend:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Ee,legendIsolatedCategories:Pe,legendPosition:Ce,foregroundGraphics:Ze,annotations:pe,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()}),We&&"radial"===j&&e.createElement("div",{style:{position:"absolute",left:Ve.left+Xe/2,top:Ve.top+Ye/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},We))}return e.createElement("div",{ref:qe,className:"stream-ordinal-frame"+(De?" "+De:""),role:"img","aria-label":"string"==typeof _e?_e:"Ordinal chart",tabIndex:0,style:{position:"relative",width:L?"100%":Ge[0],height:C?"100%":Ge[1],overflow:"visible"},onMouseMove:gt?Pt:void 0,onMouseLeave:gt?Et: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(Ae,{width:Xe,height:Ye,totalWidth:Ge[0],totalHeight:Ge[1],margin:Ve,scales:lt,showAxes:se,showGrid:be,rFormat:he}),e.createElement("canvas",{ref:Je,"aria-label":je(null!==(h=null===(d=yt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],y+" chart"),style:{position:"absolute",top:0,left:0,width:Ge[0],height:Ge[1]}}),e.createElement(Le,{hoverPoint:rt}),Fe&&e.createElement(Me,{scene:null!==(m=null===(g=yt.current)||void 0===g?void 0:g.scene)&&void 0!==m?m:[],chartType:y+" chart"}),e.createElement(Se,{width:Xe,height:Ye,totalWidth:Ge[0],totalHeight:Ge[1],margin:Ve,scales:lt,showAxes:se,oLabel:ce,rLabel:ue,oFormat:de,rFormat:he,showGrid:be,title:_e,legend:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Ee,legendIsolatedCategories:Pe,legendPosition:Ce,foregroundGraphics:Ze,annotations:pe,svgAnnotationRules:ve,annotationFrame:ct,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null===(f=yt.current)||void 0===f?void 0:f.getData(),underlayRendered:!0}),We&&"radial"===j&&e.createElement("div",{style:{position:"absolute",left:Ve.left+Xe/2,top:Ve.top+Ye/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},We),(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=r(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,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=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,it]=Ce(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=nt(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=nt(o,t);return o.set(t,Object.assign(Object.assign({},i),{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}})}})),[rt,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 lt(e){const t=d(),n=e.clientId||t,{name:o}=e,r=it(e=>e.selections.get(o)),a=it(e=>e.setClause),s=it(e=>e.clearClause),c=i(()=>!!r&&r.clauses.size>0,[r]);return{predicate:i(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(tt(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:c,selectPoints:l(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:l(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:l(()=>{s(o,n)},[s,o,n]),clientId:n}}const st=r(!1);function ct({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(i=>{const r=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=r?o(r,t,n):n?n(i):"#000000";return{label:i+"",color:a}}),label:""}]}}function ut(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.2;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}const dt="#007bff";function ht(e,t,n){return i(()=>{if(!t)return e;const o=[...e];if("function"==typeof t)return o.sort(t);const i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(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 mt(e,t,n){var o,i,r,a,l,s;const c=gt[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(i=t.height)&&void 0!==i?i:c.height,showAxes:c.showAxes,showGrid:null!==(r=t.showGrid)&&void 0!==r?r:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:c.showLegend,showLabels:null!==(s=t.showLabels)&&void 0!==s?s: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 ft={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 yt(e,t){return"function"==typeof t?t(e):e[t]}function pt(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:i,style:r={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const s=[];if(o){const e=yt(t,o);l=pt(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const a=yt(t,o);s.push({label:n,value:pt(a,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=pt(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=pt(t[e[0]],i))}}const c=Object.assign(Object.assign({},ft),r);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},l&&e.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},l),s.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&l?"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:ft},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 kt({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:i,pieData:r=!1}){return a=>{var l;const s=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,c=wt(s,t),u=wt(s,n),d=o?wt(s,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:ft},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}},i||("string"==typeof(h=o)?h:"value"),": ",xt(d)));var h}}function At({componentName:t,message:n,width:o,height:i}){return e.createElement("div",{role:"alert",style:{width:o,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)))}class Et 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(At,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var St;const Ot="undefined"!=typeof process&&"production"!==(null===(St=process.env)||void 0===St?void 0:St.NODE_ENV);function Pt({componentName:t,width:n,height:o,children:i}){return e.createElement(Et,{fallback:i=>e.createElement(At,{componentName:t,message:i.message,width:n,height:o})},i)}const jt={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"},Mt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Lt(e,t,n,o){if(!Ot)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Ct(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let a=1;o>=a;a++){const o=i[a];i[a]=e[r-1]===t[a-1]?n:1+Math.min(n,i[a],i[a-1]),n=o}}return i[o]}function Bt(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=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Ct(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Ht({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=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Bt(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function _t(t){const{data:o,rawData:r,colorBy:s,colorScheme:c,legendInteraction:u,legendPosition:d,selection:h,linkedHover:g,fallbackFields:m,unwrapData:f=!1,onObservation:y,chartType:p,chartId:v,showLegend:b,userMargin:x,marginDefaults:w,loading:k,emptyContent:A,width:E,height:S}=t,{activeSelectionHook:O,customHoverBehavior:P,customClickBehavior:j}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:r,chartId:a}){const s=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=lt({name:(null==e?void 0:e.name)||"__unused__"}),u=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:a}=lt({name:t});return{onHover:l(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&&r(t)},[n,r,a,t]),predicate:o,isActive:i}}({name:(null==s?void 0:s.name)||"hover",fields:(null==s?void 0:s.fields)||n||[]}),d=at(e=>e.pushObservation),h=e?{isActive:c.isActive,predicate:c.predicate}:null,g=l(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(i||d){const t={timestamp:Date.now(),chartType:r||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=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(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),d&&d(e)}}},[t,u,i,r,a,d]),m=l(e=>{var t,n;if(i||d){const o={timestamp:Date.now(),chartType:r||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),d&&d(e)}}},[i,d,r,a]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:m}}({selection:h,linkedHover:g,fallbackFields:m,unwrapData:f,onObservation:y,chartType:p,chartId:v}),M=function(e,t,n="category10"){const o=a(et);return i(()=>{if(t){if(0===e.length)return o&&Object.keys(o).length>0?e=>o[e]||"#999":void 0;if("function"==typeof t){const i=Array.from(new Set(e.map(e=>t(e)+"")));return o&&Object.keys(o).length>0?e=>o[e]||"#999":K(i.map(e=>({_cat:e})),"_cat",n)}if(o&&Object.keys(o).length>0){const i=K(e,t,n);return e=>o[e]||i(e)}return K(e,t,n)}},[e,t,n,o])}(o,s,c),L=i(()=>{if(!s)return[];const e=new Set;for(const t of o){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[o,s]),C=function(e,t,o){const[r,a]=n(null),[s,c]=n(new Set),u=l(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=l(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=i(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,r,s]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}(u,s,L),B=i(()=>C.legendSelectionHook?C.legendSelectionHook:O,[C.legendSelectionHook,O]),{legend:H,margin:_,legendPosition:D}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:l,defaults:s={top:50,bottom:60,left:70,right:40}}){const c=a(st),u=void 0!==o?o:!c&&!!t,d=i(()=>{if(u&&t)return ct({data:e,colorBy:t,colorScale:n,getColor:Q})},[u,t,e,n]),h=i(()=>{const e=Object.assign(Object.assign({},s),l);return d&&("right"===r&&110>e.right?e.right=110:"left"===r&&110>e.left?e.left=110:"top"===r&&50>e.top?e.top=50:"bottom"===r&&80>e.bottom&&(e.bottom=80)),e},[s,l,d,r]);return{legend:d,margin:h,legendPosition:r}}({data:o,colorBy:s,colorScale:M,showLegend:b,legendPosition:d,userMargin:x,defaults:w}),N=i(()=>{const e={};return H&&(e.legend=H,e.legendPosition=D),u&&"none"!==u&&(e.legendHoverBehavior=C.onLegendHover,e.legendClickBehavior=C.onLegendClick,e.legendHighlightedCategory=C.highlightedCategory,e.legendIsolatedCategories=C.isolatedCategories),e},[H,D,u,C.onLegendHover,C.onLegendClick,C.highlightedCategory,C.isolatedCategories]),z=function(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),a=Math.max(6,Math.floor(o/(2.5*i))),l=Math.floor((o-(i*(r+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:i},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mt),{position:"absolute",top:l+o*(r+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})})))}(k,E,S),W=z?null:function(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},jt),{width:n,height:o})},i||"No data available"):null}(r,E,S,A);return{colorScale:M,allCategories:L,legendState:C,effectiveSelectionHook:B,activeSelectionHook:O,customHoverBehavior:P,customClickBehavior:j,legend:H,margin:_,legendPosition:D,earlyReturn:z||W||null,legendBehaviorProps:N}}const Dt=c(function(n,o){const r=mt(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:l,margin:s,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:m,colorBy:f,colorScheme:y="category10",sort:p=!1,barPadding:v=40,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:E,chartId:S,loading:O,emptyContent:P,legendInteraction:j,legendPosition:M}=n,L=r.width,C=r.height,B=r.enableHover,H=r.showGrid,_=r.title,D=r.categoryLabel,N=r.valueLabel,z=l||[],W=_t({data:z,rawData:l,colorBy:f,colorScheme:y,legendInteraction:j,legendPosition:M,selection:k,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:E,chartType:"BarChart",chartId:S,showLegend:r.showLegend,userMargin:s,marginDefaults:r.marginDefaults,loading:O,emptyContent:P,width:L,height:C});if(W.earlyReturn)return W.earlyReturn;Lt("BarChart",z,"categoryAccessor",d),Lt("BarChart",z,"valueAccessor",h);const $=ht(z,p,h),I=i(()=>e=>{const t={};return t.fill=f?Q(e,f,W.colorScale):dt,t},[f,W.colorScale]),R=i(()=>ut(I,W.effectiveSelectionHook,k),[I,W.effectiveSelectionHook,k]),T=i(()=>kt({categoryAccessor:d,valueAccessor:h,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group"}),[d,h,f]),F=Ht({componentName:"BarChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(F)return e.createElement(At,{componentName:"BarChart",message:F,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:"bar"},null!=l&&{data:$}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:R,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:W.margin,barPadding:v,enableHover:B,showAxes:r.showAxes,oLabel:D,rLabel:N,rFormat:m,showGrid:H,oSort:p}),W.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===b?()=>null:bt(b)||T}),(A||E)&&{customHoverBehavior:W.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Pt,{componentName:"BarChart",width:L,height:C},e.createElement(Je,Object.assign({ref:a},q)))});function Nt({isPushMode:e,colorBy:o,colorScheme:r,showLegend:a,legendPosition:s="right"}){const c=t(new Set),u=t([]),[d,h]=n(0),g=l(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),m=l(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]),f=l(e=>t=>{m([t]),e(t)},[m]),y=l(e=>t=>{m(t),e(t)},[m]),p=l(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=i(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(r)?r:X,i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],n[e%n.length]);const l="string"==typeof o?o:"__streamCat";return ct({data:t.map(e=>({[l]:e})),colorBy:l,colorScale:e=>i.get(e)||"#999",getColor:Q})},[e,o,a,r,d]),b=i(()=>{if(v)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[v,s]);return{wrapPush:f,wrapPushMany:y,resetCategories:p,streamingLegend:v,streamingMarginAdjust:b}}Dt.displayName="BarChart";const zt=c(function(n,o){const r=mt(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:s,margin:c,className:d,categoryAccessor:h="category",stackBy:g,valueAccessor:m="value",orientation:f="vertical",valueFormat:y,colorBy:p,colorScheme:v="category10",normalize:b=!1,barPadding:x=40,tooltip:w,annotations:k,frameProps:A={},selection:E,linkedHover:S,onObservation:O,chartId:P,loading:j,emptyContent:M,legendInteraction:L,legendPosition:C}=n,B=r.width,H=r.height,_=r.enableHover,D=r.showGrid,N=r.showLegend,z=r.title,W=r.categoryLabel,$=r.valueLabel,I=s||[],R=p||g,T=Nt({isPushMode:void 0===s,colorBy:R,colorScheme:v,showLegend:N,legendPosition:C}),F=l(T.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[T.wrapPush]),q=l(T.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[T.wrapPushMany]);u(o,()=>({push:F,pushMany:q,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:[]}}),[F,q,T.resetCategories]);const G=_t({data:I,rawData:s,colorBy:R,colorScheme:v,legendInteraction:L,legendPosition:C,selection:E,linkedHover:S,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:O,chartType:"StackedBarChart",chartId:P,showLegend:N,userMargin:c,marginDefaults:r.marginDefaults,loading:j,emptyContent:M,width:B,height:H});if(G.earlyReturn)return G.earlyReturn;const V=i(()=>e=>R?G.colorScale?{fill:Q(e,R,G.colorScale)}:{}:{fill:dt},[R,G.colorScale]),X=i(()=>ut(V,G.effectiveSelectionHook,E),[V,G.effectiveSelectionHook,E]),Y=i(()=>kt({categoryAccessor:g,valueAccessor:m,groupAccessor:h}),[g,h,m]),K=Ht({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:h,valueAccessor:m},requiredProps:{stackBy:g}});if(K)return e.createElement(At,{componentName:"StackedBarChart",message:K,width:B,height:H});const Z=i(()=>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=i(()=>{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!=s&&{data:I}),{oAccessor:h,rAccessor:m,stackBy:g,normalize:b,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:X,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U,barPadding:x,enableHover:_,showAxes:r.showAxes,oLabel:W,rLabel:$,rFormat:y,showGrid:D}),Z),z&&{title:z}),d&&{className:d}),{tooltipContent:!1===w?()=>null:bt(w)||Y}),(S||O)&&{customHoverBehavior:G.customHoverBehavior}),k&&k.length>0&&{annotations:k}),A);return e.createElement(Pt,{componentName:"StackedBarChart",width:B,height:H},e.createElement(Je,Object.assign({ref:a},J)))});zt.displayName="StackedBarChart";const Wt=c(function(n,o){const r=mt(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:s,margin:c,className:d,categoryAccessor:h="category",groupBy:g,valueAccessor:m="value",orientation:f="vertical",valueFormat:y,colorBy:p,colorScheme:v="category10",barPadding:b=60,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:E,onObservation:S,chartId:O,loading:P,emptyContent:j,legendInteraction:M,legendPosition:L}=n,C=r.width,B=r.height,H=r.enableHover,_=r.showGrid,D=r.showLegend,N=r.title,z=r.categoryLabel,W=r.valueLabel,$=s||[],I=p||g,R=Nt({isPushMode:void 0===s,colorBy:I,colorScheme:v,showLegend:D,legendPosition:L}),T=l(R.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[R.wrapPush]),F=l(R.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[R.wrapPushMany]);u(o,()=>({push:T,pushMany:F,clear:()=>{var e;R.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,F,R.resetCategories]);const q=_t({data:$,rawData:s,colorBy:I,colorScheme:v,legendInteraction:M,legendPosition:L,selection:A,linkedHover:E,fallbackFields:I?["string"==typeof I?I:""]:[],unwrapData:!0,onObservation:S,chartType:"GroupedBarChart",chartId:O,showLegend:D,userMargin:c,marginDefaults:r.marginDefaults,loading:P,emptyContent:j,width:C,height:B});if(q.earlyReturn)return q.earlyReturn;const G=i(()=>e=>I?q.colorScale?{fill:Q(e,I,q.colorScale)}:{}:{fill:dt},[I,q.colorScale]),V=i(()=>ut(G,q.effectiveSelectionHook,A),[G,q.effectiveSelectionHook,A]),X=i(()=>kt({categoryAccessor:g,valueAccessor:m,groupAccessor:h}),[g,h,m]),Y=Ht({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:h,valueAccessor:m},requiredProps:{groupBy:g}});if(Y)return e.createElement(At,{componentName:"GroupedBarChart",message:Y,width:C,height:B});const K=i(()=>R.streamingLegend?Object.assign(Object.assign({},q.legendBehaviorProps),{legend:R.streamingLegend,legendPosition:L||q.legendPosition}):q.legendBehaviorProps,[q.legendBehaviorProps,q.legendPosition,R.streamingLegend,L]),Z=i(()=>{if(R.streamingMarginAdjust){const e=Object.assign({},q.margin);for(const[t,n]of Object.entries(R.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return q.margin},[q.margin,R.streamingMarginAdjust]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:$}),{oAccessor:h,rAccessor:m,groupBy:g,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:V,size:[C,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z,barPadding:b,enableHover:H,showAxes:r.showAxes,oLabel:z,rLabel:W,rFormat:y,showGrid:_}),K),N&&{title:N}),d&&{className:d}),{tooltipContent:!1===x?()=>null:bt(x)||X}),(E||S)&&{customHoverBehavior:q.customHoverBehavior}),w&&w.length>0&&{annotations:w}),k);return e.createElement(Pt,{componentName:"GroupedBarChart",width:C,height:B},e.createElement(Je,Object.assign({ref:a},U)))});Wt.displayName="GroupedBarChart";const $t=c(function(n,o){const r=mt(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:l,margin:s,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:m,colorBy:f,colorScheme:y="category10",sizeBy:p,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:k,annotations:A,frameProps:E={},selection:S,linkedHover:O,onObservation:P,chartId:j,loading:M,emptyContent:L,legendInteraction:C,legendPosition:B}=n,H=r.width,_=r.height,D=r.enableHover,N=r.showGrid,z=r.title,W=r.categoryLabel,$=r.valueLabel,I=l||[],R=_t({data:I,rawData:l,colorBy:f,colorScheme:y,legendInteraction:C,legendPosition:B,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,chartType:"SwarmPlot",chartId:j,showLegend:r.showLegend,userMargin:s,marginDefaults:r.marginDefaults,loading:M,emptyContent:L,width:H,height:_});if(R.earlyReturn)return R.earlyReturn;const T=i(()=>{if(!p)return;const e=I.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[I,p]),F=i(()=>e=>{const t={fillOpacity:x};return t.fill=f?Q(e,f,R.colorScale):dt,t.r=p?function(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):e[t],!o)return i;const[r,a]=o,[l,s]=n;return a===r?(l+s)/2:l+(i-r)/(a-r)*(s-l)}(e,p,v,T):b,t},[f,R.colorScale,p,v,T,b,x]),q=i(()=>ut(F,R.effectiveSelectionHook,S),[F,R.effectiveSelectionHook,S]),G=i(()=>kt({categoryAccessor:d,valueAccessor:h,groupAccessor:f||void 0}),[d,h,f]),V=Ht({componentName:"SwarmPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(V)return e.createElement(At,{componentName:"SwarmPlot",message:V,width:H,height:_});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=l&&{data:I}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:q,size:[H,_],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:R.margin,barPadding:w,enableHover:D,showAxes:r.showAxes,oLabel:W,rLabel:$,rFormat:m,showGrid:N}),R.legendBehaviorProps),z&&{title:z}),c&&{className:c}),{tooltipContent:!1===k?()=>null:bt(k)||G}),(O||P)&&{customHoverBehavior:R.customHoverBehavior}),A&&A.length>0&&{annotations:A}),E);return e.createElement(Pt,{componentName:"SwarmPlot",width:H,height:_},e.createElement(Je,Object.assign({ref:a},X)))});$t.displayName="SwarmPlot";const It=c(function(n,o){const r=mt(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:l,margin:s,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:m,colorBy:f,colorScheme:y="category10",showOutliers:p=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:E,chartId:S,loading:O,emptyContent:P,legendInteraction:j,legendPosition:M}=n,L=r.width,C=r.height,B=r.enableHover,H=r.showGrid,_=r.title,D=r.categoryLabel,N=r.valueLabel,z=l||[],W=_t({data:z,rawData:l,colorBy:f,colorScheme:y,legendInteraction:j,legendPosition:M,selection:k,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,chartType:"BoxPlot",chartId:S,showLegend:r.showLegend,userMargin:s,marginDefaults:r.marginDefaults,loading:O,emptyContent:P,width:L,height:C});if(W.earlyReturn)return W.earlyReturn;const $=i(()=>e=>{const t=f?Q(e,f,W.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.8}},[f,W.colorScale]),I=i(()=>ut($,W.effectiveSelectionHook,k),[$,W.effectiveSelectionHook,k]),R=i(()=>t=>{const n=t.stats||(t.data||t).stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:ft},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=Ht({componentName:"BoxPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(T)return e.createElement(At,{componentName:"BoxPlot",message:T,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:"boxplot"},null!=l&&{data:z}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:I,showOutliers:p,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:W.margin,barPadding:v,enableHover:B,showAxes:r.showAxes,oLabel:D,rLabel:N,rFormat:m,showGrid:H}),W.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===b?()=>null:bt(b)||R}),(A||E)&&{customHoverBehavior:W.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Pt,{componentName:"BoxPlot",width:L,height:C},e.createElement(Je,Object.assign({ref:a},F)))});It.displayName="BoxPlot";const Rt=c(function(n,o){const r=mt(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:l,margin:s,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:m=!1,valueFormat:f,colorBy:y,colorScheme:p="category10",categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:E,chartId:S,loading:O,emptyContent:P,legendPosition:j}=n,M=r.width,L=r.height,C=r.enableHover,B=r.showGrid,H=r.title,_=r.categoryLabel,D=r.valueLabel,N=l||[],z=_t({data:N,rawData:l,colorBy:y,colorScheme:p,legendInteraction:void 0,legendPosition:j,selection:k,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,chartType:"Histogram",chartId:S,showLegend:r.showLegend,userMargin:s,marginDefaults:r.marginDefaults,loading:O,emptyContent:P,width:M,height:L});if(z.earlyReturn)return z.earlyReturn;const W=i(()=>e=>{const t=y?Q(e,y,z.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.8}},[y,z.colorScale]),$=i(()=>ut(W,z.activeSelectionHook,k),[W,z.activeSelectionHook,k]),I=i(()=>t=>{const n=t.data||t,o=n.category||t.category||"",i=n.count,r=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:ft},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=i&&e.createElement("div",null,"Count: ",i),r&&2===r.length&&e.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),R=Ht({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(R)return e.createElement(At,{componentName:"Histogram",message:R,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!=l&&{data:N}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:$,bins:g,normalize:m,size:[M,L],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:z.margin,barPadding:v,enableHover:C,showAxes:r.showAxes,oLabel:_,rLabel:D,rFormat:f,showGrid:B}),z.legendBehaviorProps),H&&{title:H}),c&&{className:c}),{tooltipContent:!1===b?()=>null:bt(b)||I}),(A||E)&&{customHoverBehavior:z.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Pt,{componentName:"Histogram",width:M,height:L},e.createElement(Je,Object.assign({ref:a},T)))});Rt.displayName="Histogram";const Tt=c(function(n,o){const r=mt(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:l,margin:s,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:m=25,showIQR:f=!0,valueFormat:y,colorBy:p,colorScheme:v="category10",categoryPadding:b=20,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:E,onObservation:S,chartId:O,loading:P,emptyContent:j,legendPosition:M}=n,L=r.width,C=r.height,B=r.enableHover,H=r.showGrid,_=r.title,D=r.categoryLabel,N=r.valueLabel,z=l||[],W=_t({data:z,rawData:l,colorBy:p,colorScheme:v,legendInteraction:void 0,legendPosition:M,selection:A,linkedHover:E,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,chartType:"ViolinPlot",chartId:O,showLegend:r.showLegend,userMargin:s,marginDefaults:r.marginDefaults,loading:P,emptyContent:j,width:L,height:C});if(W.earlyReturn)return W.earlyReturn;const $=i(()=>e=>{const t=p?Q(e,p,W.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.6}},[p,W.colorScale]),I=i(()=>ut($,W.activeSelectionHook,A),[$,W.activeSelectionHook,A]),R=i(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",i=t.stats;if(i)return e.createElement("div",{className:"semiotic-tooltip",style:ft},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",i.n),e.createElement("div",null,"Min: ",i.min.toLocaleString()),e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),e.createElement("div",null,"Max: ",i.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const r=(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=r.length,l=a>0?r[Math.floor(a/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:ft},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),a>0&&e.createElement("div",null,"n = ",a),null!=l&&e.createElement("div",null,"Median: ",l.toLocaleString()))},[h]),T=Ht({componentName:"ViolinPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(T)return e.createElement(At,{componentName:"ViolinPlot",message:T,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:"violin"},null!=l&&{data:z}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:I,bins:m,showIQR:f,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:W.margin,barPadding:b,enableHover:B,showAxes:r.showAxes,oLabel:D,rLabel:N,rFormat:y,showGrid:H}),W.legendBehaviorProps),_&&{title:_}),c&&{className:c}),{tooltipContent:!1===x?()=>null:bt(x)||R}),(E||S)&&{customHoverBehavior:W.customHoverBehavior}),w&&w.length>0&&{annotations:w}),k);return e.createElement(Pt,{componentName:"ViolinPlot",width:L,height:C},e.createElement(Je,Object.assign({ref:a},F)))});Tt.displayName="ViolinPlot";const Ft=c(function(n,o){var r;const a=mt(n.mode,{width:n.width,height:n.height,showGrid:null===(r=n.showGrid)||void 0===r||r,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),l=t(null);u(o,()=>({push:e=>{var t;return null===(t=l.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=l.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:m="horizontal",valueFormat:f,colorBy:y,colorScheme:p="category10",sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:k,frameProps:A={},selection:E,linkedHover:S,onObservation:O,chartId:P,loading:j,emptyContent:M,legendInteraction:L,legendPosition:C}=n,B=a.width,H=a.height,_=a.enableHover,D=a.showGrid,N=a.title,z=a.categoryLabel,W=a.valueLabel,$=s||[],I=_t({data:$,rawData:s,colorBy:y,colorScheme:p,legendInteraction:L,legendPosition:C,selection:E,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:O,chartType:"DotPlot",chartId:P,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:j,emptyContent:M,width:B,height:H});if(I.earlyReturn)return I.earlyReturn;const R=ht($,v,g),T=i(()=>e=>{const t={r:b,fillOpacity:.8};return t.fill=y?Q(e,y,I.colorScale):dt,t},[y,I.colorScale,b]),F=i(()=>ut(T,I.effectiveSelectionHook,E),[T,I.effectiveSelectionHook,E]),q=i(()=>kt({categoryAccessor:h,valueAccessor:g}),[h,g]),G=Ht({componentName:"DotPlot",data:s,accessors:{categoryAccessor:h,valueAccessor:g}});if(G)return e.createElement(At,{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!=s&&{data:R}),{oAccessor:h,rAccessor:g,projection:"horizontal"===m?"horizontal":"vertical",pieceStyle:F,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:I.margin,barPadding:x,enableHover:_,showAxes:a.showAxes,oLabel:z,rLabel:W,rFormat:f,showGrid:D,oSort:v}),I.legendBehaviorProps),N&&{title:N}),d&&{className:d}),{tooltipContent:!1===w?()=>null:bt(w)||q}),(S||O)&&{customHoverBehavior:I.customHoverBehavior}),k&&k.length>0&&{annotations:k}),A);return e.createElement(Pt,{componentName:"DotPlot",width:B,height:H},e.createElement(Je,Object.assign({ref:l},V)))});Ft.displayName="DotPlot";const qt=c(function(n,o){var r,a;const s=mt(n.mode,{width:null!==(r=n.width)&&void 0!==r?r: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:m="category",valueAccessor:f="value",colorBy:y,colorScheme:p="category10",startAngle:v=0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:E,chartId:S,loading:O,emptyContent:P,legendInteraction:j,legendPosition:M}=n,L=s.width,C=s.height,B=s.enableHover,H=s.showLegend,_=s.title,D=d||[],N=y||m,z=Nt({isPushMode:void 0===d,colorBy:N,colorScheme:p,showLegend:H,legendPosition:M}),W=l(z.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[z.wrapPush]),$=l(z.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[z.wrapPushMany]);u(o,()=>({push:W,pushMany:$,clear:()=>{var e;z.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:[]}}),[W,$,z.resetCategories]);const I=_t({data:D,rawData:d,colorBy:N,colorScheme:p,legendInteraction:j,legendPosition:M,selection:k,linkedHover:A,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:E,chartType:"PieChart",chartId:S,showLegend:H,userMargin:h,marginDefaults:s.marginDefaults,loading:O,emptyContent:P,width:L,height:C});if(I.earlyReturn)return I.earlyReturn;const R=i(()=>e=>N?I.colorScale?{fill:Q(e,N,I.colorScale)}:{}:{fill:dt},[N,I.colorScale]),T=i(()=>ut(R,I.effectiveSelectionHook,k),[R,I.effectiveSelectionHook,k]),F=i(()=>kt({categoryAccessor:m,valueAccessor:f,groupAccessor:y&&y!==m?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[m,f,y]),q=Ht({componentName:"PieChart",data:d,accessors:{categoryAccessor:m,valueAccessor:f}});if(q)return e.createElement(At,{componentName:"PieChart",message:q,width:L,height:C});const G=i(()=>z.streamingLegend?Object.assign(Object.assign({},I.legendBehaviorProps),{legend:z.streamingLegend,legendPosition:M||I.legendPosition}):I.legendBehaviorProps,[I.legendBehaviorProps,I.legendPosition,z.streamingLegend,M]),V=i(()=>{if(z.streamingMarginAdjust){const e=Object.assign({},I.margin);for(const[t,n]of Object.entries(z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return I.margin},[I.margin,z.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:D}),{oAccessor:m,rAccessor:f,projection:"radial",pieceStyle:T,startAngle:v,size:[L,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V,enableHover:B,showAxes:!1}),G),_&&{title:_}),g&&{className:g}),{tooltipContent:!1===b?()=>null:bt(b)||F}),(A||E)&&{customHoverBehavior:I.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Pt,{componentName:"PieChart",width:L,height:C},e.createElement(Je,Object.assign({ref:c},X)))});qt.displayName="PieChart";const Gt=c(function(n,o){var r,a;const s=mt(n.mode,{width:null!==(r=n.width)&&void 0!==r?r: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:m="category",valueAccessor:f="value",innerRadius:y=60,centerContent:p,colorBy:v,colorScheme:b="category10",startAngle:x=0,tooltip:w,annotations:k,frameProps:A={},selection:E,linkedHover:S,onObservation:O,chartId:P,loading:j,emptyContent:M,legendInteraction:L,legendPosition:C}=n,B=s.width,H=s.height,_=s.enableHover,D=s.showLegend,N=s.title,z=d||[],W=v||m,$=Nt({isPushMode:void 0===d,colorBy:W,colorScheme:b,showLegend:D,legendPosition:C}),I=l($.wrapPush(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.push(e)}),[$.wrapPush]),R=l($.wrapPushMany(e=>{var t;return null===(t=c.current)||void 0===t?void 0:t.pushMany(e)}),[$.wrapPushMany]);u(o,()=>({push:I,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:[]}}),[I,R,$.resetCategories]);const T=_t({data:z,rawData:d,colorBy:W,colorScheme:b,legendInteraction:L,legendPosition:C,selection:E,linkedHover:S,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:O,chartType:"DonutChart",chartId:P,showLegend:D,userMargin:h,marginDefaults:s.marginDefaults,loading:j,emptyContent:M,width:B,height:H});if(T.earlyReturn)return T.earlyReturn;const F=i(()=>e=>W?T.colorScale?{fill:Q(e,W,T.colorScale)}:{}:{fill:dt},[W,T.colorScale]),q=i(()=>ut(F,T.effectiveSelectionHook,E),[F,T.effectiveSelectionHook,E]),G=i(()=>kt({categoryAccessor:m,valueAccessor:f,groupAccessor:v&&v!==m?v:void 0,groupLabel:"string"==typeof v?v:"group",pieData:!0}),[m,f,v]),V=Ht({componentName:"DonutChart",data:d,accessors:{categoryAccessor:m,valueAccessor:f}});if(V)return e.createElement(At,{componentName:"DonutChart",message:V,width:B,height:H});const X=i(()=>$.streamingLegend?Object.assign(Object.assign({},T.legendBehaviorProps),{legend:$.streamingLegend,legendPosition:C||T.legendPosition}):T.legendBehaviorProps,[T.legendBehaviorProps,T.legendPosition,$.streamingLegend,C]),Y=i(()=>{if($.streamingMarginAdjust){const e=Object.assign({},T.margin);for(const[t,n]of Object.entries($.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return T.margin},[T.margin,$.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:z}),{oAccessor:m,rAccessor:f,projection:"radial",pieceStyle:q,innerRadius:y,startAngle:x,centerContent:p,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Y,enableHover:_,showAxes:!1}),X),N&&{title:N}),g&&{className:g}),{tooltipContent:!1===w?()=>null:bt(w)||G}),(S||O)&&{customHoverBehavior:T.customHoverBehavior}),k&&k.length>0&&{annotations:k}),A);return e.createElement(Pt,{componentName:"DonutChart",width:B,height:H},e.createElement(Je,Object.assign({ref:c},K)))});function Vt(t){const n=mt(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:r,className:a,categoryAccessor:l="category",valueAccessor:s="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:m="category10",categoryPadding:f=5,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E,legendPosition:S}=t,O=n.width,P=n.height,j=n.enableHover,M=n.showGrid,L=n.title,C=n.categoryLabel,B=n.valueLabel,H=o||[],_=_t({data:H,rawData:o,colorBy:g,colorScheme:m,legendInteraction:void 0,legendPosition:S,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:k,showLegend:n.showLegend,userMargin:r,marginDefaults:n.marginDefaults,loading:A,emptyContent:E,width:O,height:P});if(_.earlyReturn)return _.earlyReturn;const D=i(()=>e=>{const t=g?Q(e,g,_.colorScale):dt;return{fill:t,stroke:t,fillOpacity:.5}},[g,_.colorScale]),N=i(()=>ut(D,_.activeSelectionHook,b),[D,_.activeSelectionHook,b]),z=i(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",i=t.stats;return i?e.createElement("div",{className:"semiotic-tooltip",style:ft},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",i.n),e.createElement("div",null,"Min: ",i.min.toLocaleString()),e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),e.createElement("div",null,"Max: ",i.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):e.createElement("div",{className:"semiotic-tooltip",style:ft},e.createElement("div",{style:{fontWeight:"bold"}},o+""))},[]),W=Ht({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:l,valueAccessor:s}});if(W)return e.createElement(At,{componentName:"RidgelinePlot",message:W,width:O,height:P});const $=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:l,rAccessor:s,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:N,bins:u,size:[O,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:_.margin,barPadding:f,enableHover:j,showAxes:n.showAxes,oLabel:C,rLabel:B,rFormat:h,showGrid:M,oSort:!1,amplitude:d}),_.legendBehaviorProps),L&&{title:L}),a&&{className:a}),{tooltipContent:!1===y?()=>null:bt(y)||z}),(x||w)&&{customHoverBehavior:_.customHoverBehavior}),p&&p.length>0&&{annotations:p}),v);return e.createElement(Pt,{componentName:"RidgelinePlot",width:O,height:P},e.createElement(Je,Object.assign({},$)))}Gt.displayName="DonutChart",Vt.displayName="RidgelinePlot";export{Dt as BarChart,It as BoxPlot,Gt as DonutChart,Ft as DotPlot,Wt as GroupedBarChart,Rt as Histogram,qt as PieChart,Vt as RidgelinePlot,zt as StackedBarChart,Je as StreamOrdinalFrame,$t as SwarmPlot,Tt as ViolinPlot};