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.
- package/CLAUDE.md +227 -27
- package/README.md +43 -11
- package/ai/examples.md +358 -18
- package/ai/schema.json +64 -2
- package/ai/system-prompt.md +50 -12
- package/dist/components/Legend.d.ts +7 -1
- package/dist/components/charts/geo/ChoroplethMap.d.ts +53 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +90 -0
- package/dist/components/charts/geo/FlowMap.d.ts +83 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +67 -0
- package/dist/components/charts/geo/index.d.ts +8 -0
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +6 -5
- package/dist/components/charts/network/CirclePack.d.ts +2 -2
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +9 -7
- package/dist/components/charts/network/OrbitDiagram.d.ts +21 -20
- package/dist/components/charts/network/SankeyDiagram.d.ts +6 -5
- package/dist/components/charts/network/TreeDiagram.d.ts +2 -2
- package/dist/components/charts/network/Treemap.d.ts +2 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +7 -5
- package/dist/components/charts/ordinal/BoxPlot.d.ts +8 -6
- package/dist/components/charts/ordinal/DonutChart.d.ts +8 -6
- package/dist/components/charts/ordinal/DotPlot.d.ts +8 -6
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +7 -5
- package/dist/components/charts/ordinal/Histogram.d.ts +8 -5
- package/dist/components/charts/ordinal/PieChart.d.ts +8 -6
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +7 -5
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -6
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +8 -5
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +24 -6
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +28 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +23 -5
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +24 -6
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +23 -5
- package/dist/components/charts/shared/colorUtils.d.ts +5 -0
- package/dist/components/charts/shared/hooks.d.ts +13 -1
- package/dist/components/charts/shared/legendUtils.d.ts +2 -3
- package/dist/components/charts/shared/statisticalOverlays.d.ts +1 -2
- package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +10 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
- package/dist/components/charts/shared/types.d.ts +10 -4
- package/dist/components/charts/shared/useChartSetup.d.ts +112 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +65 -0
- package/dist/components/charts/xy/AreaChart.d.ts +11 -6
- package/dist/components/charts/xy/BubbleChart.d.ts +11 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -6
- package/dist/components/charts/xy/Heatmap.d.ts +16 -5
- package/dist/components/charts/xy/LineChart.d.ts +21 -5
- package/dist/components/charts/xy/MinimapChart.d.ts +3 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +120 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +9 -6
- package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -6
- package/dist/components/geo/mergeData.d.ts +18 -0
- package/dist/components/geo/referenceGeography.d.ts +10 -0
- package/dist/components/geo/useReferenceAreas.d.ts +13 -0
- package/dist/components/realtime/RingBuffer.d.ts +1 -0
- package/dist/components/realtime/types.d.ts +17 -0
- package/dist/components/semiotic-data.d.ts +1 -0
- package/dist/components/semiotic-geo.d.ts +16 -0
- package/dist/components/semiotic-server.d.ts +1 -1
- package/dist/components/semiotic-xy.d.ts +1 -0
- package/dist/components/semiotic.d.ts +4 -4
- package/dist/components/server/renderToStaticSVG.d.ts +4 -2
- package/dist/components/stream/AccessibleDataTable.d.ts +50 -0
- package/dist/components/stream/CanvasHitTester.d.ts +8 -2
- package/dist/components/stream/DataSourceAdapter.d.ts +33 -4
- package/dist/components/stream/GeoCanvasHitTester.d.ts +19 -0
- package/dist/components/stream/GeoParticlePool.d.ts +46 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +81 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +31 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +16 -4
- package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
- package/dist/components/stream/OrdinalPipelineStore.d.ts +8 -4
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +23 -1
- package/dist/components/stream/PipelineStore.d.ts +57 -5
- package/dist/components/stream/SVGOverlay.d.ts +28 -1
- package/dist/components/stream/SceneGraph.d.ts +7 -3
- package/dist/components/stream/SceneToSVG.d.ts +2 -0
- package/dist/components/stream/StreamGeoFrame.d.ts +4 -0
- package/dist/components/stream/accessorUtils.d.ts +1 -0
- package/dist/components/stream/canvasSetup.d.ts +26 -0
- package/dist/components/stream/geoTypes.d.ts +186 -0
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +0 -7
- package/dist/components/stream/layouts/index.d.ts +2 -1
- package/dist/components/stream/layouts/orbitLayoutPlugin.d.ts +2 -0
- package/dist/components/stream/legendRenderer.d.ts +33 -0
- package/dist/components/stream/networkTypes.d.ts +49 -1
- package/dist/components/stream/ordinalTypes.d.ts +10 -0
- package/dist/components/stream/pipelineTransitionUtils.d.ts +42 -0
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +9 -0
- package/dist/components/stream/renderers/heatmapCanvasRenderer.d.ts +2 -1
- package/dist/components/stream/renderers/lineCanvasRenderer.d.ts +1 -0
- package/dist/components/stream/renderers/renderPulse.d.ts +50 -0
- package/dist/components/stream/types.d.ts +77 -3
- package/dist/components/types/legendTypes.d.ts +27 -3
- package/dist/geo.min.js +1 -0
- package/dist/geo.module.min.js +1 -0
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +1 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +16 -0
- package/dist/semiotic-server.d.ts +1 -1
- package/dist/semiotic-xy.d.ts +1 -0
- package/dist/semiotic.d.ts +4 -4
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +3 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +29 -7
- package/dist/test/canvasMock.d.ts +0 -2
package/dist/ordinal.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-array"),o=require("d3-hierarchy"),i=require("regression"),r=require("d3-shape"),s=require("d3-scale-chromatic");function a(e){return e&&e.__esModule?e:{default:e}}function l(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const c=l(e),u=a(i),d=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,d),bounded:!0,totalSize:e.length});let t=d;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+d,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 g{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 m{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function f(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function y(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function p(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 v(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=i(e.pieceData[0],e.name);r.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return r}function b(e){var t,o,i;const r=e.length,s=e[0],a=e[r-1];return{n:r,min:s,q1:null!==(t=n.quantile(e,.25))&&void 0!==t?t:s,median:null!==(o=n.quantile(e,.5))&&void 0!==o?o:(s+a)/2,q3:null!==(i=n.quantile(e,.75))&&void 0!==i?i:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}const x={bar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,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=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=a(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(d){const n=l(0>t?i:o+t),s=0>t?l(i+t)-l(i):l(o)-l(o+t);u.push(p(e.x,n,e.width,Math.abs(s),m,f,r)),0>t?i+=t:o+=t}else if(h){const n=l(0>t?i+t:o),s=0>t?l(i)-l(i+t):l(o+t)-l(o);u.push(p(n,e.x,Math.abs(s),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:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=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=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;d.length>o;o++){const r=n.get(d[o])||[];for(const n of r){const r=i(n),l=s(n,e.name);if(u){const i=e.x+o*t,s=a(0),u=a(r);c.push(p(i,Math.min(s,u),t,Math.abs(s-u),l,n,d[o]))}else{const i=e.x+o*t,s=a(0),u=a(r);c.push(p(Math.min(s,u),i,Math.abs(u-s),t,l,n,d[o]))}}}}return c},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,m=a.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),u=m&&a[i]||c,p=l(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:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),m=c?s(a):e.middle+h;l.push({type:"point",x:g,y:m,r:d,style:u,datum:o})}}return l},pie:v,donut:v,boxplot:function(e,t){var o,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:m}=l,f=[],y="vertical"===m,p=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(o=n.quantile(t,.25))&&void 0!==o?o:l,m=null!==(i=n.quantile(t,.5))&&void 0!==i?i:(l+c)/2,v=null!==(r=n.quantile(t,.75))&&void 0!==r?r:c,b=v-u,x=u-1.5*b,w=v+1.5*b,k=null!==(s=t.find(e=>e>=x))&&void 0!==s?s:l,A=null!==(a=[...t].reverse().find(e=>w>=e))&&void 0!==a?a:c,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:g(n),i=y?g(n):e.middle;S.push({px:o,py:i,value:n,datum:t})}}if(f.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(k),q1Pos:g(u),medianPos:g(m),q3Pos:g(v),maxPos:g(A),stats:{n:t.length,min:k,q1:u,median:m,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)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var o,i,r;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],m="vertical"===h,f=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/f||1,h=Array(f).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),f-1)]++;const p=Math.max(...h,1),v=e.width/2*.9;let x="";if(m){for(let t=0;f>t;t++){const n=d(s+(t+.5)*l),o=h[t]/p*v;x+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=f-1;t>=0;t--){const n=d(s+(t+.5)*l);x+=` L ${e.middle-h[t]/p*v} ${n}`}x+=" Z"}else{for(let t=0;f>t;t++){const n=d(s+(t+.5)*l),o=h[t]/p*v;x+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=f-1;t>=0;t--)x+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/p*v}`;x+=" Z"}const w=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const l=null!==(o=n.quantile(t,.25))&&void 0!==o?o:s,c=null!==(i=n.quantile(t,.5))&&void 0!==i?i:(s+a)/2,u=null!==(r=n.quantile(t,.75))&&void 0!==r?r:a;k={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:m}}const A=m?{x:e.x,y:Math.min(d(a),d(s)),width:e.width,height:Math.abs(d(a)-d(s))}:{x:Math.min(d(s),d(a)),y:e.x,width:Math.abs(d(a)-d(s)),height:e.width};g.push({type:"violin",pathString:x,translateX:0,translateY:0,bounds:A,iqrLine:k,stats:b(t),style:w,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){const{scales:n,columns:o,config:i,getR:r,resolveSummaryStyle:s}=e,{r:a}=n,l=[],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=s(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,s=a(n+t*o),c=a(n+(t+1)*o);l.push(p(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 l},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,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=>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)/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=a(e.pieceData[0],e.name),y=e.width*g;let p="";if(h){const t=e.x+e.width;p=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)p+=` L ${l(o+(e+.5)*r)} ${t-c[e]/m*y}`;p+=` L ${l(i)} ${t} Z`}else{const t=e.x;p=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);p+=` L ${t+c[e]/m*y} ${n}`}p+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:v,stats:b(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:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(p(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(p(e.x,n,e.width,i-n,u,t,e.name))}}return l}};class w{constructor(e){this.rExtent=new m,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 g(e.windowSize),this.getO=y(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>f(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new m)):(this.getR=f(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=y(e.stackBy),this.getGroup=y(e.groupBy),this.getColor=y(e.colorAccessor),this.getConnector=y(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new g(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:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const i=o.toArray(),r=n.projection||"vertical",s=n.oExtent||this.resolveCategories(i),a=this.computeValueDomain(i,s),l="horizontal"===r,c=null!=n.barPadding?n.barPadding/("vertical"===r?e.width:e.height):.1;let u,d;if("radial"===r){u=t.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=n.innerRadius||0;d=t.scaleLinear().domain(a).range([i,o])}else l?(u=t.scaleBand().domain(s).range([0,e.height]).padding(c),d=t.scaleLinear().domain(a).range([0,e.width])):(u=t.scaleBand().domain(s).range([0,e.width]).padding(c),d=t.scaleLinear().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:r},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((i,r)=>{const s=this.rExtents[r];s.dirty&&s.recalculate(o,i);let[a,c]=s.extent;a===1/0&&(a=0,c=1);const u=c-a,d=u>0?u*(n.extentPadding||.05):1;return a-=d,c+=d,a>0&&(a=0),l?t.scaleLinear().domain([a,c]).range([0,e.width]):t.scaleLinear().domain([a,c]).range([e.height,0])}):[];let h=i;this.rAccessors.length>1&&(h=i.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,s,u,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),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,a=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>a&&(a=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>a&&(a=e),s>e&&(s=e)}else if("clusterbar"===i)for(const t of e){const e=this.getR(t);e>a&&(a=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&&(a=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(s=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(a=this.config.rExtent[1]));const l=a-s,c=l>0?l*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])||(a+=c),"bar"!==i&&"clusterbar"!==i||(s>0&&(s=0),0>a&&(a=0)),[s,a]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const 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=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(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:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=x[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:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=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"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:r(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],i=t[n+1],r="function"==typeof u?u(o.datum):u||{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,a=t-1-e;switch(r.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=r.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(i=r.stepThreshold)&&void 0!==i?i:.5*t)>a?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),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,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,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=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],a=this.config.oAccessor;if(("function"==typeof a?a(i):i[a||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=r-l;if(s>c){const e=1-c/s;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}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 a=null;if("point"===r.type?a="p:"+e:"rect"===r.type&&(a=`r:${r.group||""}:${null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!a)continue;const l=this.prevPositionMap.get(a);l&&("point"===r.type?l.x===r.x&&l.y===r.y||(r._targetX=r.x,r._targetY=r.y,r.x=l.x,r.y=l.y,s=!0):"rect"===r.type&&(l.x===r.x&&l.y===r.y&&l.w===r.w&&l.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=l.x,r.y=l.y,r.w=null!==(o=l.w)&&void 0!==o?o:r.w,r.h=null!==(i=l.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 k(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function A(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 E(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 S(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=k(Math.atan2(i,o)),a=k(e.startAngle),l=k(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function M(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 O(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 L={fill:e=>c.createElement("rect",{style:e,width:20,height:20}),line:e=>c.createElement("line",{style:e,x1:0,y1:0,x2:20,y2:20})};function C(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,L[n])(o(e,t)),i}function j(){return c.createElement("path",{d:"M2,6 L5,9 L10,3",fill:"none",stroke:"currentColor",strokeWidth:1.5,transform:"translate(-14, 5)"})}function P(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function H(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r,title:s="Legend",width:a=100,height:l=20,orientation:u="vertical"}=e,d="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r})=>{let s=30;const a=[];return e.forEach((e,l)=>{s+=5,a.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:0,y1:s,x2:t,y2:s})),s+=10,e.label&&(s+=20,a.push(c.createElement("text",{key:"legend-text-"+l,y:s,className:"legend-group-label"},e.label)),s+=10),a.push(c.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(0,${s})`},((e,t,n,o,i)=>{const{type:r="fill",styleFn:s,items:a}=e,l=[];let u=0;const d=!(!t&&!n);return a.forEach((e,a)=>{const h=C(e,a,r,s),g=P(e,o,i),m=i&&i.size>0&&i.has(e.label);l.push(c.createElement("g",{key:"legend-item-"+a,transform:`translate(0,${u})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,style:{cursor:d?"pointer":"default",opacity:g,transition:"opacity 150ms ease",pointerEvents:"all"}},m&&c.createElement(j,null),h,c.createElement("text",{y:15,x:30},e.label))),u+=25}),l})(e,n,o,i,r))),s+=25*e.items.length+10}),a})({legendGroups:t,width:a,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r}):(({legendGroups:e,title:t,height:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s})=>{let a=0;const l=[],u=!1===t?10:40;return e.forEach((t,d)=>{t.label&&(l.push(c.createElement("text",{key:"legend-text-"+d,transform:`translate(${a},${u}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},t.label)),a+=20);const h=((e,t,n,o,i)=>{const{type:r="fill",styleFn:s,items:a}=e,l=[];let u=0;const d=!(!t&&!n);return a.forEach((e,a)=>{const h=C(e,a,r,s),g=P(e,o,i),m=i&&i.size>0&&i.has(e.label);l.push(c.createElement("g",{key:"legend-item-"+a,transform:`translate(${u},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,style:{cursor:d?"pointer":"default",opacity:g,transition:"opacity 150ms ease",pointerEvents:"all"}},m&&c.createElement(j,null),h,c.createElement("text",{y:15,x:25},e.label))),u+=35,u+=8*e.label.length}),{items:l,offset:u}})(t,o,i,r,s);l.push(c.createElement("g",{key:"legend-group-"+d,className:"legend-item",transform:`translate(${a},${u})`},h.items)),a+=h.offset+5,e[d+1]&&l.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+d,stroke:"gray",x1:a,y1:u-10,x2:a,y2:n+u+10})),a+=15}),c.createElement("g",null,!1!==t&&c.createElement("line",{x1:0,x2:a+10,y1:u-10,y2:u-10,stroke:"gray",className:"title-neatline"}),l)})({legendGroups:t,title:s,height:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r});return c.createElement("g",null,void 0!==s&&c.createElement("text",{className:"legend-title",y:20,x:"horizontal"===u?0:a/2,textAnchor:"horizontal"===u?"start":"middle"},s),d)}function B(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 N(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 _(e){const{x:t=0,y:n=0,dx:o,dy:i,nx:r,ny:s,note:a,connector:l,subject:u,type:d,color:h,className:g,disable:m,events:f={},"data-testid":y}=e,p=new Set(Array.isArray(m)?m:[]);let v=o||0,b=i||0;null!=r&&(v=r-t),null!=s&&(b=s-n);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 c.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":y},f),!p.has("connector")&&function(e,t,n,o,i,r){const s=[];let a=0,l=0;if("callout-circle"!==i&&"label"!==i||!(null==r?void 0:r.radius)){if("callout-rect"===i&&r){const n=r.width||0,o=r.height||0;if(n>0||o>0){const i=n/2,r=o/2,s=e-i,c=t-r;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=i+s*h,l=r+c*h}}}else if("bracket"===i&&r){const e=r.width,t=r.height,n=r.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(r.radius||0)+(r.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-a,2)+Math.pow(t-l,2))>.5&&(s.push(c.createElement("line",{key:"connector-line",x1:a,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,i=16/180*Math.PI,r=Math.atan2(t-l,e-a);s.push(c.createElement("path",{key:"connector-arrow",d:`M${a},${l}L${a+n*Math.cos(r+i)},${l+n*Math.sin(r+i)}L${a+n*Math.cos(r-i)},${l+n*Math.sin(r-i)}Z`,fill:o||"currentColor",stroke:"none"}))}return c.createElement("g",{className:"annotation-connector"},s)}(v,b,l,h,x,u),!p.has("subject")&&function(e,t,n,o,i){var r;const s=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&s.push(c.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&s.push(c.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&s.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,r=i||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;s.push(c.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-r,x2:o,y2:(t.y2||0)-r,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-r;s.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?s.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||s.push(c.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-r,x2:0,y2:(t.y2||0)-r,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(r=null==t?void 0:t.width)&&void 0!==r?r:null==t?void 0:t.height;void 0!==e&&s.push(c.createElement("path",{key:"bracket-path",d:N((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return c.createElement("g",{className:"annotation-subject"},s)}(x,u,h,t,n),!p.has("note")&&function(e,t,n,o){if(!e)return c.createElement("g",{className:"annotation-note"});const{label:i,title:r,orientation:s,align:a,wrap:l=120,noWrap:u}=e;if(!i&&!r)return c.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>t?"end":"start";const m=16,f=r?u?[r]:B(r,l):[],y=i?u?[i]:B(i,l):[],p="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(c.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},f.map((e,t)=>c.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e)))),v=f.length*m),y.length>0&&b.push(c.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},y.map((e,t)=>c.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e))));let x=null;if((r||i)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(l,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+y.length)*m+(y.length>0?m:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,f.length+y.length-1)*m;let k=0;return"topBottom"===d?k=0>n?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+m+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),c.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},c.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(a,v,b,h))}function $(e){var t,n;const{noteData:o}=e,{screenCoordinates:i}=o,r="string"==typeof o.type?o.type:"label",s=o.eventListeners||o.events||{};if(o.coordinates&&i){const e=o.nx||i[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),s=o.ny||i[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),a=i.map((t,n)=>{const i=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:s});return c.createElement(_,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},i,{type:r}))});return c.createElement("g",null,a)}const a=o.note||{title:"none",label:o.label};return c.createElement(_,Object.assign({"data-testid":"semiotic-annotation",key:`${a.label}-${a.title}-${o.i}`,events:s},o,{type:r}))}function W(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 D(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 R(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function z(e){return Math.round(100*e)/100+""}function I(t){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:d,oLabel:h,rLabel:g,oFormat:m,rFormat:f,showGrid:y,title:p,legend:v,legendHoverBehavior:b,legendClickBehavior:x,legendHighlightedCategory:w,legendIsolatedCategories:k,foregroundGraphics:A,annotations:E,svgAnnotationRules:S,annotationFrame:M,xAccessor:O,yAccessor:L,annotationData:C,children:j}=t,P="radial"===(null==l?void 0:l.projection),B="horizontal"===(null==l?void 0:l.projection),N=e.useMemo(()=>d&&l&&!P?l.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2,label:m?m(e):e}}):[],[d,l,m,P]),_=e.useMemo(()=>d&&l&&!P?l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(f||z)(e)})):[],[d,l,f,P]),I=e.useMemo(()=>{if(!E||0===E.length)return null;const e=function(e,t,n){var i,r,s,a,l,d,h,g,m,f,y,p,v,b,x,w,k,A,E,S,M,O,L,C,j,P,H,B,N,_,z,I,T,q,F,G,V,X,Y,Q,Z,U,J,K;switch(e.type){case"label":{let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,i=t.y}else o=W(e,n),i=D(e,n);return null==o||null==i?null:R(o,i,n)?c.createElement($,{key:"ann-"+t,noteData:{x:o,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,i=t.y}else o=W(e,n),i=D(e,n);return null==o||null==i?null:R(o,i,n)?c.createElement($,{key:"ann-"+t,noteData:{x:o,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=W(e,n);if(null==o)return null;const i=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:o+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=D(e,n);if(null==o)return null;const i=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const i=(e.coordinates||[]).map(e=>({x:W(Object.assign(Object.assign({},e),{type:"point"}),n),y:D(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=o.packEnclose(i),s=e.padding||10;return c.createElement("g",{key:"ann-"+t},c.createElement("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:W(Object.assign(Object.assign({},e),{type:"point"}),n),y:D(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=e.padding||10,r=o.map(e=>e.x),s=o.map(e=>e.y),a=Math.min(...r)-i,l=Math.max(...r)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:a,y:u,width:l-a,height:d-u,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:(a+l)/2,y:u-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"highlight":{const o=n.data||[],i="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],r=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return c.createElement("g",{key:"ann-"+t},i.map((t,o)=>{const i=W(t,n),s=D(t,n);return null==i||null==s?null:c.createElement("circle",Object.assign({key:o,cx:i,cy:s,r:e.r||6},r))}))}case"bracket":{const o=W(e,n),i=D(e,n);return c.createElement($,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=i?i:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const o=n.data||[];if(2>o.length)return null;const g=n.xAccessor||"x",m=n.yAccessor||"y",f=o.map(e=>[e[g],e[m]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(r=null===(i=n.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(s=n.scales)||void 0===s?void 0:s.time,p=null!==(l=null===(a=n.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(d=n.scales)||void 0===d?void 0:d.value;if(!y||!p)return null;const v=e.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,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){a.push([t,r[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*m-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(h=e.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?u.default.polynomial(f,{order:e.order||2}):u.default.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${p(t)}`).join(" "),w=e.color||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:y(b[b.length-1][0])+4,y:p(b[b.length-1][1])-4,fill:w,fontSize:11},e.label))}case"band":{const o=null!==(m=null===(g=n.scales)||void 0===g?void 0:g.y)&&void 0!==m?m:null===(f=n.scales)||void 0===f?void 0:f.value,i=null!==(y=null==o?void 0:o(e.y0))&&void 0!==y?y:0,r=null!==(p=null==o?void 0:o(e.y1))&&void 0!==p?p:n.height||0;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:0,y:Math.min(i,r),width:n.width||0,height:Math.abs(r-i),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(i,r)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const i=n.xAccessor||"x",r=null!==(b=null===(v=n.scales)||void 0===v?void 0:v.x)&&void 0!==b?b:null===(x=n.scales)||void 0===x?void 0:x.time,s=null!==(k=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==k?k:null===(A=n.scales)||void 0===A?void 0:A.value;if(!r||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[a]&&null!=e[l]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=d.map(e=>`${r(e[i])},${s(e[a])}`).join(" L"),g=d.slice().reverse().map(e=>`${r(e[i])},${s(e[l])}`).join(" L"),m=e.fill||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:`M${h} L${g} Z`,fill:m,fillOpacity:null!==(E=e.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.label&&d.length>0&&c.createElement("text",{x:r(d[d.length-1][i])+4,y:s(d[d.length-1][a])-4,fill:m,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const i=n.yAccessor||"y",r=null!==(M=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(O=n.scales)||void 0===O?void 0:O.time,s=null!==(C=null===(L=n.scales)||void 0===L?void 0:L.y)&&void 0!==C?C:null===(j=n.scales)||void 0===j?void 0:j.value;if(!r||!s)return null;const a=o.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-l,2),0)/a.length,d=Math.sqrt(u),h=null!==(P=e.threshold)&&void 0!==P?P:2,g=l-h*d,m=!1!==e.showBand,f=e.fill||"#6366f1",y=null!==(H=e.fillOpacity)&&void 0!==H?H:.1,p=e.anomalyColor||"#ef4444",v=null!==(B=e.anomalyRadius)&&void 0!==B?B:6,b=s(l+h*d),x=s(g),w=o.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-l)>h*d});return c.createElement("g",{key:"ann-"+t},m&&c.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),w.map((e,t)=>{const o=W(e,n),i=D(e,n);return null==o||null==i?null:c.createElement("circle",{key:t,cx:o,cy:i,r:v,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5})}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const i=n.xAccessor||"x",r=n.yAccessor||"y",s=null!==(_=null===(N=n.scales)||void 0===N?void 0:N.x)&&void 0!==_?_:null===(z=n.scales)||void 0===z?void 0:z.time,a=null!==(T=null===(I=n.scales)||void 0===I?void 0:I.y)&&void 0!==T?T:null===(q=n.scales)||void 0===q?void 0:q.value;if(!s||!a)return null;const l=o.map(e=>[e[i],e[r]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let d;if("polynomial"===(e.method||"linear")){const t=u.default.polynomial(l,{order:e.order||2}).equation;d=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,i=0;for(const[e,r]of l)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,a=(n-s*t)/e;d=e=>a+s*e}const h=l.length,g=l.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),m=Math.sqrt(g/Math.max(h-2,1)),f=l.reduce((e,t)=>e+t[0],0)/h,y=l.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),p=null!==(F=e.confidence)&&void 0!==F?F:.95,v=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=null!==(G=e.steps)&&void 0!==G?G:5,x=l[h-1][0],w=(x-l[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=m*Math.sqrt(1+1/h+(y>0?Math.pow(e-f,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const E=`M${A.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(x)},${a(d(x))}`,O=e.strokeColor||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:E,fill:e.fill||"#6366f1",fillOpacity:null!==(V=e.fillOpacity)&&void 0!==V?V:.15,stroke:"none"}),c.createElement("polyline",{points:`${M} ${S}`,fill:"none",stroke:O,strokeWidth:null!==(X=e.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(Y=e.strokeDasharray)&&void 0!==Y?Y:"6,3"}),e.label&&A.length>0&&c.createElement("text",{x:s(A[A.length-1].x)+4,y:a(A[A.length-1].yCenter)-4,fill:O,fontSize:11},e.label))}case"widget":{let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,i=t.y}else null!=e.px&&null!=e.py?(o=e.px,i=e.py):(o=W(e,n),i=D(e,n));if(null==o||null==i)return null;if(!R(o,i,n))return null;const r=null!==(Q=e.dx)&&void 0!==Q?Q:0,s=null!==(Z=e.dy)&&void 0!==Z?Z:0,a=null!==(U=e.width)&&void 0!==U?U:32,l=null!==(J=e.height)&&void 0!==J?J:32,u=null!==(K=e.content)&&void 0!==K?K:c.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return c.createElement("foreignObject",{key:"ann-"+t,x:o+r-a/2,y:i+s-l/2,width:a,height:l,style:{overflow:"visible",pointerEvents:"auto"}},c.createElement("div",{style:{width:a,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const o=W(e,n),i=D(e,n);return null==o||null==i?null:c.createElement("text",{key:"ann-text-"+t,x:o+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}default:return null}},t="horizontal"===(null==l?void 0:l.projection),r=(null==l?void 0:l.o)?e=>{var t;return(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2}:null,s={scales:l?{x:t?l.r:r||l.r,y:t&&r||l.r,time:l.r,value:l.r}:null,timeAxis:"x",xAccessor:O,yAccessor:L,width:n,height:i,data:C,frameType:"ordinal"};return E.map((t,n)=>{if(S){const o=S(t,n,s);return null!=o?o:e(t,n,s)}return e(t,n,s)}).filter(Boolean)},[E,S,n,i,M,O,L,C]);return d||p||v||A||I&&I.length>0||y||j?c.createElement("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},c.createElement("g",{transform:`translate(${a.left},${a.top})`},y&&l&&!P&&c.createElement("g",{className:"ordinal-grid"},_.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:B?e.pixel:0,y1:B?0:e.pixel,x2:B?e.pixel:n,y2:B?i:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),d&&l&&!P&&c.createElement("g",{className:"ordinal-axes"},B?c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&c.createElement("text",{x:15-a.left,y:i/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-a.left}, ${i/2})`,style:{userSelect:"none"}},h),c.createElement("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),_.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${i})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),g&&c.createElement("text",{x:n/2,y:i+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},g)):c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${i})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&c.createElement("text",{x:n/2,y:i+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},h),c.createElement("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),_.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),g&&c.createElement("text",{x:15-a.left,y:i/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-a.left}, ${i/2})`,style:{userSelect:"none"}},g))),I,A,j),p&&c.createElement("text",{x:r/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof p?p:null),v&&c.createElement("g",{transform:`translate(${r-a.right+10}, ${a.top})`},"object"==typeof(T=v)&&null!==T&&!c.isValidElement(T)&&"legendGroups"in T?c.createElement(H,{legendGroups:v.legendGroups,title:"",width:100,customHoverBehavior:b,customClickBehavior:x,highlightedCategory:w,isolatedCategories:k}):v)):null;var T}const T="undefined"==typeof window||"undefined"==typeof document,q=(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?F(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 F(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 G=(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 V(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 X=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s)V(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&&(V(e,t),e.globalAlpha=.35*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill()),e.globalAlpha=1},Y=(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()}},Q=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const 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}},Z=e=>[Q,...e],U={bar:Z([q]),clusterbar:Z([q]),point:Z([G]),swarm:Z([G]),pie:[X],donut:[X],boxplot:Z([(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",a=t.style.stroke||"#333",l=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=a,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),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()}},G]),violin:Z([Y]),histogram:Z([q]),ridgeline:Z([Y]),timeline:Z([q])},J={top:50,right:40,bottom:60,left:70},K={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 ee({hover:e}){var t,n,o,i;const r=e.data||{},s=e.stats,a=e.category;if(Array.isArray(r)){const e=a||(null===(t=r[0])||void 0===t?void 0:t.category)||"";if(s)return c.createElement("div",{className:"semiotic-tooltip",style:K},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,"n = ",s.n),c.createElement("div",null,"Min: ",s.min.toLocaleString()),c.createElement("div",null,"Q1: ",s.q1.toLocaleString()),c.createElement("div",null,"Median: ",s.median.toLocaleString()),c.createElement("div",null,"Q3: ",s.q3.toLocaleString()),c.createElement("div",null,"Max: ",s.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=r.length;return c.createElement("div",{className:"semiotic-tooltip",style:K},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,n," items"))}if(null!=r.bin&&null!=r.count){const e=r.range||[];return c.createElement("div",{className:"semiotic-tooltip",style:K},r.category&&c.createElement("div",{style:{fontWeight:"bold"}},r.category+""),c.createElement("div",null,"Count: ",r.count),2===e.length&&c.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const l=r.category||r.name||r.group||r.__rName||"",u=null!==(i=null!==(o=null!==(n=r.value)&&void 0!==n?n:r.__rValue)&&void 0!==o?o:r.pct)&&void 0!==i?i:"";if(!l&&""===u){const e=Object.entries(r).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:K},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return c.createElement("div",{className:"semiotic-tooltip",style:K},l&&c.createElement("div",{style:{fontWeight:"bold"}},l+""),""!==u&&c.createElement("div",null,"number"==typeof u?u.toLocaleString():u+""))}const te=e.forwardRef(function(t,n){var o,i,s;const{chartType:a,runtimeMode:l,data:u,oAccessor:d="category",rAccessor:g="value",colorAccessor:m,stackBy:f,groupBy:y,multiAxis:p,timeAccessor:v,valueAccessor:b,categoryAccessor:x,projection:k="vertical",size:L=[600,400],responsiveWidth:C,responsiveHeight:j,margin:P,barPadding:H,innerRadius:B,normalize:N,startAngle:_,dynamicColumnWidth:$,bins:W,showOutliers:D,showIQR:R,amplitude:z,connectorAccessor:q,connectorStyle:F,rExtent:G,oExtent:V,extentPadding:X=.05,oSort:Y,windowMode:Q="sliding",windowSize:Z=200,pieceStyle:K,summaryStyle:te,colorScheme:ne,barColors:oe,showAxes:ie=!0,oLabel:re,rLabel:se,oFormat:ae,rFormat:le,enableHover:ce=!0,hoverAnnotation:ue,tooltipContent:de,customHoverBehavior:he,annotations:ge,svgAnnotationRules:me,showGrid:fe=!1,legend:ye,legendHoverBehavior:pe,legendClickBehavior:ve,legendHighlightedCategory:be,legendIsolatedCategories:xe,backgroundGraphics:we,foregroundGraphics:ke,title:Ae,className:Ee,background:Se,centerContent:Me,decay:Oe,pulse:Le,transition:Ce,staleness:je}=t,[Pe,He]=function(t,n,o){const i=e.useRef(null),[r,s]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:t[0],o&&r?r.h:t[1]]]}(L,C,j),Be=e.useMemo(()=>Object.assign(Object.assign({},J),P),[P]),Ne=He[0]-Be.left-Be.right,_e=He[1]-Be.top-Be.bottom,$e=e.useRef(null),We=e.useRef(!0),De=e.useRef(0),Re=e.useRef(null),ze=e.useRef(()=>{}),[Ie,Te]=e.useState(null),[qe,Fe]=e.useState(null),[Ge,Ve]=e.useState(0),[Xe,Ye]=e.useState(!1),Qe=ce||ue,Ze="streaming"===l,Ue=e.useMemo(()=>({chartType:a,runtimeMode:Ze?"streaming":"bounded",windowSize:Z,windowMode:Q,extentPadding:X,projection:k,oAccessor:Ze?void 0:d,rAccessor:Ze?void 0:g,colorAccessor:m,stackBy:f,groupBy:y,multiAxis:p,timeAccessor:Ze?v:void 0,valueAccessor:Ze?b||("string"==typeof g||"function"==typeof g?g:void 0):void 0,categoryAccessor:Ze?x||d:void 0,rExtent:G,oExtent:V,barPadding:H,innerRadius:B,normalize:N,startAngle:_,dynamicColumnWidth:$,bins:W,showOutliers:D,showIQR:R,amplitude:z,connectorAccessor:q,connectorStyle:F,oSort:Y,pieceStyle:K,summaryStyle:te,colorScheme:ne,barColors:oe,decay:Oe,pulse:Le,transition:Ce,staleness:je}),[a,Z,Q,X,k,d,g,m,f,y,p,v,b,x,G,V,H,B,N,_,$,W,D,R,z,q,F,Y,K,te,ne,oe,Oe,Le,Ce,je,Ze]),Je=e.useRef(null);Je.current||(Je.current=new w(Ue));const Ke=e.useCallback(()=>{De.current||(De.current=requestAnimationFrame(()=>ze.current()))},[]);e.useEffect(()=>{var e;null===(e=Je.current)||void 0===e||e.updateConfig(Ue),We.current=!0,Ke()},[Ue,Ke]);const et=e.useRef(null);et.current||(et.current=new h(e=>{const t=Je.current;t&&t.ingest(e)&&(We.current=!0,Ke())}));const tt=e.useCallback(e=>{var t;null===(t=et.current)||void 0===t||t.push(e)},[]),nt=e.useCallback(e=>{var t;null===(t=et.current)||void 0===t||t.pushMany(e)},[]),ot=e.useCallback(()=>{var e,t;null===(e=et.current)||void 0===e||e.clear(),null===(t=Je.current)||void 0===t||t.clear(),We.current=!0,Ke()},[Ke]);e.useImperativeHandle(n,()=>({push:tt,pushMany:nt,clear:ot,getData:()=>{var e,t;return null!==(t=null===(e=Je.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Je.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[tt,nt,ot]),e.useEffect(()=>{var e;u&&(null===(e=et.current)||void 0===e||e.setBoundedData(u))},[u]);const it=e.useRef(()=>{}),rt=e.useRef(()=>{});it.current=e=>{if(!Qe)return;const t=$e.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Be.left,i=e.clientY-n.top-Be.top;if(0>o||o>Ne||0>i||i>_e)return void(Re.current&&(Re.current=null,Te(null),he&&he(null),Ke()));const r=Je.current;if(!r||0===r.scene.length)return;const s="radial"===k,a=function(e,t,n,o=30){let i=null;for(const r of e){let e=null;switch(r.type){case"rect":e=A(r,t,n);break;case"point":e=E(r,t,n);break;case"wedge":e=S(r,t,n);break;case"boxplot":e=M(r,t,n);break;case"violin":e=O(r,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(r.scene,s?o-Ne/2:o,s?i-_e/2:i);if(!a)return void(Re.current&&(Re.current=null,Te(null),he&&he(null),Ke()));const l=Object.assign(Object.assign({data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y},a.stats&&{stats:a.stats}),a.category&&{category:a.category});Re.current=l,Te(l),he&&(he(l),We.current=!0),Ke()},rt.current=()=>{Re.current&&(Re.current=null,Te(null),he&&(he(null),We.current=!0),Ke())},e.useCallback(e=>it.current(e),[]);const st=e.useCallback(()=>rt.current(),[]),at=e.useRef(-1),lt=e.useCallback(e=>{const t=Je.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=at.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 at.current=-1,Re.current=null,Te(null),he&&he(null),void Ke();const r=0>o?0:i;at.current=r;const s={data:(a=n[r]).datum,x:a.x,y:a.y,time:a.x,value:a.y};var a;Re.current=s,Te(s),he&&he(s),Ke()},[he,Ke]),ct=e.useCallback(e=>{at.current=-1,it.current(e)},[]);ze.current=()=>{var e,t;De.current=0;const n=$e.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Je.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(r),l=We.current;l&&!s&&(i.computeScene({width:Ne,height:_e}),We.current=!1);const c="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=He[0]*c,n.height=He[1]*c,n.style.width=He[0]+"px",n.style.height=He[1]+"px",o.scale(c,c),o.clearRect(0,0,He[0],He[1]);const u=null!==(e=null==je?void 0:je.threshold)&&void 0!==e?e:5e3,d=je&&i.lastIngestTime>0&&r-i.lastIngestTime>u;d&&(o.globalAlpha=null!==(t=null==je?void 0:je.dimOpacity)&&void 0!==t?t:.5);const h=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=Se||(h&&"transparent"!==h?h:null);g&&(o.fillStyle=g,o.fillRect(0,0,He[0],He[1]));const m="radial"===k;m?(o.save(),o.translate(Be.left+Ne/2,Be.top+_e/2)):o.translate(Be.left,Be.top);const f=U[a]||[],y={width:Ne,height:_e};for(const e of f)e(o,i.scene,i.scales,y);m&&o.restore(),d&&(o.globalAlpha=1),l&&i.scales&&(Fe(i.scales),Ve(e=>e+1)),(null==je?void 0:je.showBadge)&&Ye(!!d),(s||i.hasActivePulses)&&(De.current=requestAnimationFrame(()=>ze.current()))},e.useEffect(()=>(Ke(),()=>{De.current&&(cancelAnimationFrame(De.current),De.current=0)}),[Ke]),e.useEffect(()=>{We.current=!0,Ke()},[a,Ne,_e,ie,Se,Ke]),function(t,n,o,i,r,s){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(e)},[t,r,i])}(je,Je,We,Ke,Xe,Ye);const ut=Qe&&Ie?de?de(Ie):c.createElement(ee,{hover:Ie}):null,dt="radial"===k,ht=Ie?dt?Ie.x+Ne/2:Ie.x:0,gt=Ie?dt?Ie.y+_e/2:Ie.y:0,mt=ut?c.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Be.left+ht,top:Be.top+gt,transform:`translate(${ht>.7*Ne?"calc(-100% - 12px)":"12px"}, ${.3*_e>gt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},ut):null;if(T){const e=Je.current;e&&u&&(e.ingest({inserts:u,bounded:!0}),e.computeScene({width:Ne,height:_e}));const t=null!==(o=null==e?void 0:e.scene)&&void 0!==o?o:[],n=null!==(i=null==e?void 0:e.scales)&&void 0!==i?i:null,s="radial"===k,a=s?Be.left+Ne/2:Be.left,l=s?Be.top+_e/2:Be.top;return c.createElement("div",{className:"stream-ordinal-frame"+(Ee?" "+Ee:""),role:"img","aria-label":"string"==typeof Ae?Ae:"Ordinal chart",style:{position:"relative",width:He[0],height:He[1]}},c.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:He[0],height:He[1],style:{position:"absolute",left:0,top:0}},we&&c.createElement("g",{transform:`translate(${Be.left},${Be.top})`},we),c.createElement("g",{transform:`translate(${a},${l})`},Se&&c.createElement("rect",{x:0,y:0,width:Ne,height:_e,fill:Se}),t.map((e,t)=>function(e,t){var n,o,i,s,a;switch(e.type){case"rect":return c.createElement("rect",{key:"ord-rect-"+t,x:e.x,y:e.y,width:e.w,height:e.h,fill:e.style.fill||"#4e79a7",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"point":return c.createElement("circle",{key:"ord-point-"+t,cx:e.x,cy:e.y,r:e.r,fill:e.style.fill||"#4e79a7",opacity:null!==(n=e.style.opacity)&&void 0!==n?n:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"wedge":{const n=e,o=r.arc().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return c.createElement("path",{key:"ord-wedge-"+t,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=e,r=n.columnWidth/2;return"vertical"===n.projection?c.createElement("g",{key:"ord-boxplot-"+t},c.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:n.x-r,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:n.style.fill||"#4e79a7",fillOpacity:null!==(o=n.style.fillOpacity)&&void 0!==o?o:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.x-r,y1:n.medianPos,x2:n.x+r,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:n.x-.5*r,y1:n.minPos,x2:n.x+.5*r,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.x-.5*r,y1:n.maxPos,x2:n.x+.5*r,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):c.createElement("g",{key:"ord-boxplot-"+t},c.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-r,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:n.style.fill||"#4e79a7",fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.medianPos,y1:n.y-r,x2:n.medianPos,y2:n.y+r,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:n.minPos,y1:n.y-.5*r,x2:n.minPos,y2:n.y+.5*r,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.maxPos,y1:n.y-.5*r,x2:n.maxPos,y2:n.y+.5*r,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=e,o=[c.createElement("path",{key:"ord-violin-path-"+t,d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:n.style.fill||"#4e79a7",fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const e=n.bounds,i=e.x+e.width/2,r=e.y+e.height/2;e.height>e.width?o.push(c.createElement("line",{key:"ord-violin-iqr-"+t,x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:"ord-violin-med-"+t,cx:i,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(c.createElement("line",{key:"ord-violin-iqr-"+t,x1:n.iqrLine.q1Pos,y1:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:"ord-violin-med-"+t,cx:n.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return c.createElement("g",{key:"ord-violin-"+t},o)}case"connector":return c.createElement("line",{key:"ord-conn-"+t,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:null!==(a=e.style.opacity)&&void 0!==a?a:.5});default:return null}}(e,t)).filter(Boolean))),c.createElement(I,{width:Ne,height:_e,totalWidth:He[0],totalHeight:He[1],margin:Be,scales:n,showAxes:ie,oLabel:re,rLabel:se,oFormat:ae,rFormat:le,showGrid:fe,title:Ae,legend:ye,legendHoverBehavior:pe,legendClickBehavior:ve,legendHighlightedCategory:be,legendIsolatedCategories:xe,foregroundGraphics:ke,annotations:ge,svgAnnotationRules:me,annotationFrame:0,xAccessor:"string"==typeof d?d:void 0,yAccessor:"string"==typeof g?g:void 0,annotationData:null==e?void 0:e.getData()}),Me&&"radial"===k&&c.createElement("div",{style:{position:"absolute",left:Be.left+Ne/2,top:Be.top+_e/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Me))}return c.createElement("div",{ref:Pe,className:"stream-ordinal-frame"+(Ee?" "+Ee:""),role:"img","aria-label":"string"==typeof Ae?Ae:"Ordinal chart",tabIndex:0,style:{position:"relative",width:C?"100%":He[0],height:j?"100%":He[1]},onMouseMove:Qe?ct:void 0,onMouseLeave:Qe?st:void 0,onKeyDown:lt},we&&c.createElement("svg",{style:{position:"absolute",top:0,left:0,width:He[0],height:He[1],pointerEvents:"none"}},c.createElement("g",{transform:`translate(${Be.left},${Be.top})`},we)),c.createElement("canvas",{ref:$e,style:{position:"absolute",top:0,left:0,width:He[0],height:He[1]}}),c.createElement(I,{width:Ne,height:_e,totalWidth:He[0],totalHeight:He[1],margin:Be,scales:qe,showAxes:ie,oLabel:re,rLabel:se,oFormat:ae,rFormat:le,showGrid:fe,title:Ae,legend:ye,legendHoverBehavior:pe,legendClickBehavior:ve,legendHighlightedCategory:be,legendIsolatedCategories:xe,foregroundGraphics:ke,annotations:ge,svgAnnotationRules:me,annotationFrame:Ge,xAccessor:"string"==typeof d?d:void 0,yAccessor:"string"==typeof g?g:void 0,annotationData:null===(s=Je.current)||void 0===s?void 0:s.getData()}),Me&&"radial"===k&&c.createElement("div",{style:{position:"absolute",left:Be.left+Ne/2,top:Be.top+_e/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Me),(null==je?void 0:je.showBadge)&&c.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===je.badgePosition?{top:4,left:4}:"bottom-left"===je.badgePosition?{bottom:4,left:4}:"bottom-right"===je.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Xe?"#dc3545":"#28a745",color:"white"})},Xe?"STALE":"LIVE"),mt)});te.displayName="StreamOrdinalFrame";const ne={category10:s.schemeCategory10,tableau10:s.schemeTableau10,set3:s.schemeSet3,blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,oranges:s.interpolateOranges,purples:s.interpolatePurples,viridis:s.interpolateViridis,plasma:s.interpolatePlasma},oe=s.schemeCategory10;function ie(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):oe[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+""))%oe.length]}function re(e,n,o="category10"){const i=Array.from(new Set(e.map(e=>e[n]))),r=i.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(i).range(o).unknown("#999");const s=ne[o]||ne.category10;if(r&&"function"==typeof s)return e=>s(Number(e)/Math.max(...i.map(Number)));{const e=Array.isArray(s)?s:oe;return t.scaleOrdinal().domain(i).range(e).unknown("#999")}}const se=e.createContext(null),ae="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function le(t){const n=e.createContext(null),o=ce(t);return[function({children:o}){const i=e.useMemo(()=>ce(t),[]);return c.createElement(n.Provider,{value:i,children:o})},t=>{var i;const r=null!==(i=e.useContext(n))&&void 0!==i?i:o;return function(t,n){const[o,i]=e.useState(n);return ae(()=>t(()=>i(n)),[t]),o}(r.subscribe,()=>t(r.getState()))}]}function ce(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 ue(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 de(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[he,ge]=le(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=de(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=de(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}})}})),[me,fe]=le(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 ye(t){const n=e.useId(),o=t.clientId||n,{name:i}=t,r=ge(e=>e.selections.get(i)),s=ge(e=>e.setClause),a=ge(e=>e.clearClause),l=e.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:e.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(ue(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:e.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}const pe=e.createContext(!1);function ve(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 be="#007bff";function xe(t,n,o="category10"){const i=e.useContext(se);return e.useMemo(()=>{if(n&&"function"!=typeof n)return i&&Object.keys(i).length>0?e=>i[e]||re(t,n,o)(e):re(t,n,o)},[t,n,o,i])}function we(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const i="function"==typeof(r=o)?r:e=>e[r];var r;return e.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[t,n,o])}function ke({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a}){const l=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}(n,o),c=ye({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:i,isActive:r,selectPoints:s,clear:a}=ye({name:n});return{onHover:e.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),d=fe(e=>e.pushObservation),h=t?{isActive:c.isActive,predicate:c.predicate}:null,g=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),d&&d(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),d&&d(e)}}},[n,u,r,s,a,d]),m=e.useCallback(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(s),d&&d(s)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,s,a]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:m}}function Ae({data:t,colorBy:n,colorScale:o,showLegend:i,userMargin:r,defaults:s={top:50,bottom:60,left:70,right:40}}){const a=e.useContext(pe),l=void 0!==i?i:!a&&!!n,c=e.useMemo(()=>{if(l&&n)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:t,colorBy:n,colorScale:o,getColor:ie})},[l,n,t,o]),u=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),r);return c&&120>e.right&&(e.right=120),e},[s,r,c]);return{legend:c,margin:u}}function Ee(t,n,o){const[i,r]=e.useState(null),[s,a]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&r(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&a(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=i?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===i}:"isolate"===t&&s.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return s.has(o)}}:null},[t,n,i,s]);return{highlightedCategory:"highlight"===t?i:null,isolatedCategories:"isolate"===t?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}const Se={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 Me(e,t,n){var o,i,r,s,a,l;const c=Se[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!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||c.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,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 Oe={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 Le(e,t){return"function"==typeof t?t(e):e[t]}function Ce(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 je(e={}){const{fields:t,title:n,format:o,style:i={},className:r=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=Le(e,n);s=Ce(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,i,r;"string"==typeof t?(n=t,i=t,r=o):(n=t.label,i=t.accessor||t.key||"",r=t.format||o);const s=Le(e,i);a.push({label:n,value:Ce(s,r)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Ce(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Ce(e[t[0]],o))}}const l=Object.assign(Object.assign({},Oe),i);return c.createElement("div",{className:("semiotic-tooltip "+r).trim(),style:l},s&&c.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},s),a.map((e,t)=>c.createElement("div",{key:t,style:{marginTop:0===t&&s?"4px":0}},e.label&&c.createElement("span",null,e.label,": "),e.value)))}}function Pe(e){return!0===e?je():"function"==typeof e?e:!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?je(e):je())}function He(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Be(e,t){return"function"==typeof t?t(e):e[t]}function Ne({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:i=!1}){return r=>{var s;const a=i?(null===(s=r.data)||void 0===s?void 0:s[0])||r.data||r:r.data||r,l=Be(a,e),u=Be(a,t),d=n?Be(a,n):void 0;return c.createElement("div",{className:"semiotic-tooltip",style:Oe},c.createElement("div",{style:{fontWeight:"bold"}},He(l)),c.createElement("div",{style:{marginTop:4}},He(u)),null!=d&&c.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(h=n)?h:"value"),": ",He(d)));var h}}function _e({componentName:e,message:t,width:n,height:o}){return c.createElement("div",{role:"alert",style:{width:n,height:Math.max(o,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"}},c.createElement("div",{style:{textAlign:"center",maxWidth:400}},c.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),c.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t)))}class $e extends c.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:c.createElement(_e,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var We;const De="undefined"!=typeof process&&"production"!==(null===(We=process.env)||void 0===We?void 0:We.NODE_ENV);function Re({componentName:e,width:t,height:n,children:o}){return c.createElement($e,{fallback:o=>c.createElement(_e,{componentName:e,message:o.message,width:t,height:n})},o)}const ze={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"},Ie={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Te(e,t,n,o){return!1===o||e&&Array.isArray(e)&&e.length>0||e&&!Array.isArray(e)?null:c.createElement("div",{style:Object.assign(Object.assign({},ze),{width:t,height:n})},o||"No data available")}function qe(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),r=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(i+r)-r))/2);return c.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>c.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ie),{position:"absolute",top:s+n*(i+r),left:Math.floor(.1*t),width:30+Math.round(50*Math.random())+"%",height:i,opacity:.5+n%2*.2})})))}function Fe(e,t,n,o){if(!De)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 Ge(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 Ve(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=Ge(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 Xe({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=Ve(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Ye(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",valueFormat:u,colorBy:d,colorScheme:h="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,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(k,S,M);if(B)return B;const N=Te(o,S,M,A);if(N)return N;const _=o||[];Fe("BarChart",_,"categoryAccessor",s),Fe("BarChart",_,"valueAccessor",a);const{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:x,chartType:"BarChart",chartId:w}),D=we(_,g,a),R=xe(_,d,h),z=e.useMemo(()=>{if(!d)return[];const e=new Set;for(const t of _){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[_,d]),I=Ee(E,d,z),T=e.useMemo(()=>I.legendSelectionHook?I.legendSelectionHook:$,[I.legendSelectionHook,$]),q=e.useMemo(()=>e=>{const t={};return t.fill=d?ie(e,d,R):be,t},[d,R]),F=e.useMemo(()=>ve(q,T,v),[q,T,v]),{legend:G,margin:V}=Ae({data:D,colorBy:d,colorScale:R,showLegend:C,userMargin:i,defaults:n.marginDefaults}),X=e.useMemo(()=>Ne({categoryAccessor:s,valueAccessor:a,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group"}),[s,a,d]),Y=Xe({componentName:"BarChart",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(Y)return c.createElement(_e,{componentName:"BarChart",message:Y,width:S,height:M});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:D,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",pieceStyle:F,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,barPadding:m,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:u,showGrid:L,oSort:g},G&&{legend:G}),E&&"none"!==E&&{legendHoverBehavior:I.onLegendHover,legendClickBehavior:I.onLegendClick,legendHighlightedCategory:I.highlightedCategory,legendIsolatedCategories:I.isolatedCategories}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(f)||X}),(b||x)&&{customHoverBehavior:W}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"BarChart",width:S,height:M},c.createElement(te,Object.assign({},Q)))}function Qe(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",stackBy:a,valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,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,M=n.width,O=n.height,L=n.enableHover,C=n.showGrid,j=n.showLegend,P=n.title,H=n.categoryLabel,B=n.valueLabel,N=qe(A,M,O);if(N)return N;const _=Te(o,M,O,E);if(_)return _;const $=o||[],W=h||a,{activeSelectionHook:D,customHoverBehavior:R}=ke({selection:b,linkedHover:x,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:w,chartType:"StackedBarChart",chartId:k}),z=xe($,W,g),I=e.useMemo(()=>{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=Ee(S,W,I),q=e.useMemo(()=>T.legendSelectionHook?T.legendSelectionHook:D,[T.legendSelectionHook,D]),F=e.useMemo(()=>e=>W?{fill:ie(e,W,z)}:{fill:be},[W,z]),G=e.useMemo(()=>ve(F,q,b),[F,q,b]),{legend:V,margin:X}=Ae({data:$,colorBy:W,colorScale:z,showLegend:j,userMargin:i,defaults:n.marginDefaults}),Y=e.useMemo(()=>Ne({categoryAccessor:a,valueAccessor:l,groupAccessor:s}),[a,s,l]),Q=Xe({componentName:"StackedBarChart",data:$,accessors:{categoryAccessor:s,valueAccessor:l},requiredProps:{stackBy:a}});if(Q)return c.createElement(_e,{componentName:"StackedBarChart",message:Q,width:M,height:O});const Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:$,oAccessor:s,rAccessor:l,stackBy:a,normalize:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:G,size:[M,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,barPadding:f,enableHover:L,showAxes:n.showAxes,oLabel:H,rLabel:B,rFormat:d,showGrid:C},V&&{legend:V}),S&&"none"!==S&&{legendHoverBehavior:T.onLegendHover,legendClickBehavior:T.onLegendClick,legendHighlightedCategory:T.highlightedCategory,legendIsolatedCategories:T.isolatedCategories}),P&&{title:P}),r&&{className:r}),{tooltipContent:Pe(y)||Y}),(x||w)&&{customHoverBehavior:R}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"StackedBarChart",width:M,height:O},c.createElement(te,Object.assign({},Z)))}function Ze(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",groupBy:a,valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,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,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(k,S,M);if(B)return B;const N=Te(o,S,M,A);if(N)return N;const _=o||[],$=h||a,{activeSelectionHook:W,customHoverBehavior:D}=ke({selection:v,linkedHover:b,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:x,chartType:"GroupedBarChart",chartId:w}),R=xe(_,$,g),z=e.useMemo(()=>{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)},[_,$]),I=Ee(E,$,z),T=e.useMemo(()=>I.legendSelectionHook?I.legendSelectionHook:W,[I.legendSelectionHook,W]),q=e.useMemo(()=>e=>$?{fill:ie(e,$,R)}:{fill:be},[$,R]),F=e.useMemo(()=>ve(q,T,v),[q,T,v]),{legend:G,margin:V}=Ae({data:_,colorBy:$,colorScale:R,showLegend:C,userMargin:i,defaults:n.marginDefaults}),X=e.useMemo(()=>Ne({categoryAccessor:a,valueAccessor:l,groupAccessor:s}),[a,s,l]),Y=Xe({componentName:"GroupedBarChart",data:_,accessors:{categoryAccessor:s,valueAccessor:l},requiredProps:{groupBy:a}});if(Y)return c.createElement(_e,{componentName:"GroupedBarChart",message:Y,width:S,height:M});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:_,oAccessor:s,rAccessor:l,groupBy:a,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:F,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,barPadding:m,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:d,showGrid:L},G&&{legend:G}),E&&"none"!==E&&{legendHoverBehavior:I.onLegendHover,legendClickBehavior:I.onLegendClick,legendHighlightedCategory:I.highlightedCategory,legendIsolatedCategories:I.isolatedCategories}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(f)||X}),(b||x)&&{customHoverBehavior:D}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"GroupedBarChart",width:S,height:M},c.createElement(te,Object.assign({},Q)))}function Ue(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",valueFormat:u,colorBy:d,colorScheme:h="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:M,legendInteraction:O}=t,L=n.width,C=n.height,j=n.enableHover,P=n.showGrid,H=n.showLegend,B=n.title,N=n.categoryLabel,_=n.valueLabel,$=qe(S,L,C);if($)return $;const W=Te(o,L,C,M);if(W)return W;const D=o||[],{activeSelectionHook:R,customHoverBehavior:z}=ke({selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,chartType:"SwarmPlot",chartId:E}),I=xe(D,d,h),T=e.useMemo(()=>{if(!d)return[];const e=new Set;for(const t of D){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[D,d]),q=Ee(O,d,T),F=e.useMemo(()=>q.legendSelectionHook?q.legendSelectionHook:R,[q.legendSelectionHook,R]),G=e.useMemo(()=>{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=e.useMemo(()=>e=>{const t={fillOpacity:y};return t.fill=d?ie(e,d,I):be,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,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,g,m,G):f,t},[d,I,g,m,G,f,y]),X=e.useMemo(()=>ve(V,F,w),[V,F,w]),{legend:Y,margin:Q}=Ae({data:D,colorBy:d,colorScale:I,showLegend:H,userMargin:i,defaults:n.marginDefaults}),Z=e.useMemo(()=>Ne({categoryAccessor:s,valueAccessor:a,groupAccessor:d||void 0}),[s,a,d]),U=Xe({componentName:"SwarmPlot",data:D,accessors:{categoryAccessor:s,valueAccessor:a}});if(U)return c.createElement(_e,{componentName:"SwarmPlot",message:U,width:L,height:C});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:D,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",pieceStyle:X,size:[L,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,barPadding:p,enableHover:j,showAxes:n.showAxes,oLabel:N,rLabel:_,rFormat:u,showGrid:P},Y&&{legend:Y}),O&&"none"!==O&&{legendHoverBehavior:q.onLegendHover,legendClickBehavior:q.onLegendClick,legendHighlightedCategory:q.highlightedCategory,legendIsolatedCategories:q.isolatedCategories}),B&&{title:B}),r&&{className:r}),{tooltipContent:Pe(v)||Z}),(k||A)&&{customHoverBehavior:z}),b&&b.length>0&&{annotations:b}),x);return c.createElement(Re,{componentName:"SwarmPlot",width:L,height:C},c.createElement(te,Object.assign({},J)))}function Je(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",valueFormat:u,colorBy:d,colorScheme:h="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,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(k,S,M);if(B)return B;const N=Te(o,S,M,A);if(N)return N;const _=o||[],{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"BoxPlot",chartId:w}),D=xe(_,d,h),R=e.useMemo(()=>{if(!d)return[];const e=new Set;for(const t of _){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[_,d]),z=Ee(E,d,R),I=e.useMemo(()=>z.legendSelectionHook?z.legendSelectionHook:$,[z.legendSelectionHook,$]),T=e.useMemo(()=>e=>{const t=d?ie(e,d,D):be;return{fill:t,stroke:t,fillOpacity:.8}},[d,D]),q=e.useMemo(()=>ve(T,I,v),[T,I,v]),{legend:F,margin:G}=Ae({data:_,colorBy:d,colorScale:D,showLegend:C,userMargin:i,defaults:n.marginDefaults}),V=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return c.createElement("div",{className:"semiotic-tooltip",style:Oe},c.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(e.category||(e.data||e).category||"")+""),null!=t.median&&c.createElement(c.Fragment,null,null!=t.n&&c.createElement("div",null,"n = ",t.n),c.createElement("div",null,"Median: ",t.median.toLocaleString()),c.createElement("div",null,"Q1: ",t.q1.toLocaleString()),c.createElement("div",null,"Q3: ",t.q3.toLocaleString()),c.createElement("div",null,"Min: ",t.min.toLocaleString()),c.createElement("div",null,"Max: ",t.max.toLocaleString())))},[]),X=Xe({componentName:"BoxPlot",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(X)return c.createElement(_e,{componentName:"BoxPlot",message:X,width:S,height:M});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:_,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:q,showOutliers:g,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,barPadding:m,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:u,showGrid:L},F&&{legend:F}),E&&"none"!==E&&{legendHoverBehavior:z.onLegendHover,legendClickBehavior:z.onLegendClick,legendHighlightedCategory:z.highlightedCategory,legendIsolatedCategories:z.isolatedCategories}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(f)||V}),(b||x)&&{customHoverBehavior:W}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"BoxPlot",width:S,height:M},c.createElement(te,Object.assign({},Y)))}function Ke(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",bins:l=25,relative:u=!1,valueFormat:d,colorBy:h,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,M=n.enableHover,O=n.showGrid,L=n.showLegend,C=n.title,j=n.categoryLabel,P=n.valueLabel,H=qe(k,E,S);if(H)return H;const B=Te(o,E,S,A);if(B)return B;const N=o||[],{activeSelectionHook:_,customHoverBehavior:$}=ke({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"Histogram",chartId:w}),W=xe(N,h,g),D=e.useMemo(()=>e=>{const t=h?ie(e,h,W):be;return{fill:t,stroke:t,fillOpacity:.8}},[h,W]),R=e.useMemo(()=>ve(D,_,v),[D,_,v]),{legend:z,margin:I}=Ae({data:N,colorBy:h,colorScale:W,showLegend:L,userMargin:i,defaults:n.marginDefaults}),T=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,i=t.range;return c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&c.createElement("div",null,"Count: ",o),i&&2===i.length&&c.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),q=Xe({componentName:"Histogram",data:N,accessors:{categoryAccessor:s,valueAccessor:a}});if(q)return c.createElement(_e,{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:s,rAccessor:a,projection:"horizontal",summaryStyle:R,bins:l,normalize:u,size:[E,S],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I,barPadding:m,enableHover:M,showAxes:n.showAxes,oLabel:j,rLabel:P,rFormat:d,showGrid:O},z&&{legend:z}),C&&{title:C}),r&&{className:r}),{tooltipContent:Pe(f)||T}),(b||x)&&{customHoverBehavior:$}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"Histogram",width:E,height:S},c.createElement(te,Object.assign({},F)))}function et(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",bins:u=25,showIQR:d=!0,valueFormat:h,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,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(A,S,M);if(B)return B;const N=Te(o,S,M,E);if(N)return N;const _=o||[],{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"ViolinPlot",chartId:k}),D=xe(_,g,m),R=e.useMemo(()=>e=>{const t=g?ie(e,g,D):be;return{fill:t,stroke:t,fillOpacity:.6}},[g,D]),z=e.useMemo(()=>ve(R,$,b),[R,$,b]),{legend:I,margin:T}=Ae({data:_,colorBy:g,colorScale:D,showLegend:C,userMargin:i,defaults:n.marginDefaults}),q=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;if(o)return c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(e.data)?e.data:[]).map(e=>{const t="function"==typeof a?a(e):e[a];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),r=i.length,s=r>0?i[Math.floor(r/2)]:null;return c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),r>0&&c.createElement("div",null,"n = ",r),null!=s&&c.createElement("div",null,"Median: ",s.toLocaleString()))},[a]),F=Xe({componentName:"ViolinPlot",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(F)return c.createElement(_e,{componentName:"ViolinPlot",message:F,width:S,height:M});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:_,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:z,bins:u,showIQR:d,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,barPadding:f,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:h,showGrid:L},I&&{legend:I}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(y)||q}),(x||w)&&{customHoverBehavior:W}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"ViolinPlot",width:S,height:M},c.createElement(te,Object.assign({},G)))}function tt(t){var n;const o=Me(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:i,margin:r,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:u="horizontal",valueFormat:d,colorBy:h,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:M}=t,O=o.width,L=o.height,C=o.enableHover,j=o.showGrid,P=o.showLegend,H=o.title,B=o.categoryLabel,N=o.valueLabel,_=qe(E,O,L);if(_)return _;const $=Te(i,O,L,S);if($)return $;const W=i||[],{activeSelectionHook:D,customHoverBehavior:R}=ke({selection:x,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,chartType:"DotPlot",chartId:A}),z=we(W,m,l),I=xe(W,h,g),T=e.useMemo(()=>{if(!h)return[];const e=new Set;for(const t of W){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[W,h]),q=Ee(M,h,T),F=e.useMemo(()=>q.legendSelectionHook?q.legendSelectionHook:D,[q.legendSelectionHook,D]),G=e.useMemo(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=h?ie(e,h,I):be,t},[h,I,f]),V=e.useMemo(()=>ve(G,F,x),[G,F,x]),{legend:X,margin:Y}=Ae({data:z,colorBy:h,colorScale:I,showLegend:P,userMargin:r,defaults:o.marginDefaults}),Q=e.useMemo(()=>Ne({categoryAccessor:a,valueAccessor:l}),[a,l]),Z=Xe({componentName:"DotPlot",data:W,accessors:{categoryAccessor:a,valueAccessor:l}});if(Z)return c.createElement(_e,{componentName:"DotPlot",message:Z,width:O,height:L});const U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:z,oAccessor:a,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:V,size:[O,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y,barPadding:y,enableHover:C,showAxes:o.showAxes,oLabel:B,rLabel:N,rFormat:d,showGrid:j,oSort:m},X&&{legend:X}),M&&"none"!==M&&{legendHoverBehavior:q.onLegendHover,legendClickBehavior:q.onLegendClick,legendHighlightedCategory:q.highlightedCategory,legendIsolatedCategories:q.isolatedCategories}),H&&{title:H}),s&&{className:s}),{tooltipContent:Pe(p)||Q}),(w||k)&&{customHoverBehavior:R}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Re,{componentName:"DotPlot",width:O,height:L},c.createElement(te,Object.assign({},U)))}function nt(t){var n,o;const i=Me(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:r,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",colorBy:d,colorScheme:h="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=i.width,S=i.height,M=i.enableHover,O=i.showLegend,L=i.title,C=qe(w,E,S);if(C)return C;const j=Te(r,E,S,k);if(j)return j;const P=r||[],H=d||l,{activeSelectionHook:B,customHoverBehavior:N}=ke({selection:p,linkedHover:v,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:b,chartType:"PieChart",chartId:x}),_=xe(P,H,h),$=e.useMemo(()=>{if(!H)return[];const e=new Set;for(const t of P){const n="function"==typeof H?H(t):t[H];null!=n&&e.add(n+"")}return Array.from(e)},[P,H]),W=Ee(A,H,$),D=e.useMemo(()=>W.legendSelectionHook?W.legendSelectionHook:B,[W.legendSelectionHook,B]),R=e.useMemo(()=>e=>H?{fill:ie(e,H,_)}:{fill:be},[H,_]),z=e.useMemo(()=>ve(R,D,p),[R,D,p]),{legend:I,margin:T}=Ae({data:P,colorBy:H,colorScale:_,showLegend:O,userMargin:s,defaults:i.marginDefaults}),q=e.useMemo(()=>Ne({categoryAccessor:l,valueAccessor:u,groupAccessor:d&&d!==l?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[l,u,d]),F=Xe({componentName:"PieChart",data:P,accessors:{categoryAccessor:l,valueAccessor:u}});if(F)return c.createElement(_e,{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:P,oAccessor:l,rAccessor:u,projection:"radial",pieceStyle:z,startAngle:g,size:[E,S],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,enableHover:M,showAxes:!1},I&&{legend:I}),A&&"none"!==A&&{legendHoverBehavior:W.onLegendHover,legendClickBehavior:W.onLegendClick,legendHighlightedCategory:W.highlightedCategory,legendIsolatedCategories:W.isolatedCategories}),L&&{title:L}),a&&{className:a}),{tooltipContent:Pe(m)||q}),(v||b)&&{customHoverBehavior:N}),f&&f.length>0&&{annotations:f}),y);return c.createElement(Re,{componentName:"PieChart",width:E,height:S},c.createElement(te,Object.assign({},G)))}function ot(t){var n,o;const i=Me(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:r,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",innerRadius:d=60,centerContent:h,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,M=i.width,O=i.height,L=i.enableHover,C=i.showLegend,j=i.title,P=qe(A,M,O);if(P)return P;const H=Te(r,M,O,E);if(H)return H;const B=r||[],N=g||l,{activeSelectionHook:_,customHoverBehavior:$}=ke({selection:b,linkedHover:x,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:w,chartType:"DonutChart",chartId:k}),W=xe(B,N,m),D=e.useMemo(()=>{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]),R=Ee(S,N,D),z=e.useMemo(()=>R.legendSelectionHook?R.legendSelectionHook:_,[R.legendSelectionHook,_]),I=e.useMemo(()=>e=>N?{fill:ie(e,N,W)}:{fill:be},[N,W]),T=e.useMemo(()=>ve(I,z,b),[I,z,b]),{legend:q,margin:F}=Ae({data:B,colorBy:N,colorScale:W,showLegend:C,userMargin:s,defaults:i.marginDefaults}),G=e.useMemo(()=>Ne({categoryAccessor:l,valueAccessor:u,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[l,u,g]),V=Xe({componentName:"DonutChart",data:B,accessors:{categoryAccessor:l,valueAccessor:u}});if(V)return c.createElement(_e,{componentName:"DonutChart",message:V,width:M,height:O});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:B,oAccessor:l,rAccessor:u,projection:"radial",pieceStyle:T,innerRadius:d,startAngle:f,centerContent:h,size:[M,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,enableHover:L,showAxes:!1},q&&{legend:q}),S&&"none"!==S&&{legendHoverBehavior:R.onLegendHover,legendClickBehavior:R.onLegendClick,legendHighlightedCategory:R.highlightedCategory,legendIsolatedCategories:R.isolatedCategories}),j&&{title:j}),a&&{className:a}),{tooltipContent:Pe(y)||G}),(x||w)&&{customHoverBehavior:$}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"DonutChart",width:M,height:O},c.createElement(te,Object.assign({},X)))}function it(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="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}=t,S=n.width,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(A,S,M);if(B)return B;const N=Te(o,S,M,E);if(N)return N;const _=o||[],{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:k}),D=xe(_,g,m),R=e.useMemo(()=>e=>{const t=g?ie(e,g,D):be;return{fill:t,stroke:t,fillOpacity:.5}},[g,D]),z=e.useMemo(()=>ve(R,$,b),[R,$,b]),{legend:I,margin:T}=Ae({data:_,colorBy:g,colorScale:D,showLegend:C,userMargin:i,defaults:n.marginDefaults}),q=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;return o?c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):c.createElement("div",{className:"semiotic-tooltip",style:Oe},c.createElement("div",{style:{fontWeight:"bold"}},n+""))},[]),F=Xe({componentName:"RidgelinePlot",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(F)return c.createElement(_e,{componentName:"RidgelinePlot",message:F,width:S,height:M});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline",data:_,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:z,bins:u,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,barPadding:f,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:h,showGrid:L,oSort:!1,amplitude:d},I&&{legend:I}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(y)||q}),(x||w)&&{customHoverBehavior:W}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"RidgelinePlot",width:S,height:M},c.createElement(te,Object.assign({},G)))}Ye.displayName="BarChart",Qe.displayName="StackedBarChart",Ze.displayName="GroupedBarChart",Ue.displayName="SwarmPlot",Je.displayName="BoxPlot",Ke.displayName="Histogram",et.displayName="ViolinPlot",tt.displayName="DotPlot",nt.displayName="PieChart",ot.displayName="DonutChart",it.displayName="RidgelinePlot",exports.BarChart=Ye,exports.BoxPlot=Je,exports.DonutChart=ot,exports.DotPlot=tt,exports.GroupedBarChart=Ze,exports.Histogram=Ke,exports.PieChart=nt,exports.RidgelinePlot=it,exports.StackedBarChart=Qe,exports.StreamOrdinalFrame=te,exports.SwarmPlot=Ue,exports.ViolinPlot=et;
|
|
1
|
+
"use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-scale-chromatic"),o=require("d3-array"),i=require("d3-hierarchy"),r=require("d3-shape"),a=require("regression");function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const c=l(e),u=s(a);class d{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 h{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 g{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function m(e,t,n){return e+(t-e)*n}function f(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function y(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const p={category10:n.schemeCategory10,tableau10:n.schemeTableau10,set3:n.schemeSet3,blues:n.interpolateBlues,reds:n.interpolateReds,greens:n.interpolateGreens,oranges:n.interpolateOranges,purples:n.interpolatePurples,viridis:n.interpolateViridis,plasma:n.interpolatePlasma},v=n.schemeCategory10,b=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],x=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 w(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")||x.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,n,o="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[n]).filter(e=>null!=e))),r=i.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(i).range(o).unknown("#999");const a=p[o]||p.category10;if(r&&"function"==typeof a){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>a(Number(t)/e)}{const e=Array.isArray(a)?a:v;return t.scaleOrdinal().domain(i).range(e).unknown("#999")}}function S(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 E(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=i(e.pieceData[0],e.name);r.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return r}function A(e){var t,n,i;const r=e.length,a=e[0],s=e[r-1];return{n:r,min:a,q1:null!==(t=o.quantile(e,.25))&&void 0!==t?t:a,median:null!==(n=o.quantile(e,.5))&&void 0!==n?n:(a+s)/2,q3:null!==(i=o.quantile(e,.75))&&void 0!==i?i:s,max:s,mean:e.reduce((e,t)=>e+t,0)/r}}const M={bar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getStack:a,resolvePieceStyle:s}=e,{r:l,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=s(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=l(0>t?i:o+t),a=0>t?l(i+t)-l(i):l(o)-l(o+t);u.push(S(e.x,n,e.width,Math.abs(a),m,f,r)),0>t?i+=t:o+=t}else if(h){const n=l(0>t?i+t:o),a=0>t?l(i)-l(i+t):l(o+t)-l(o);u.push(S(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:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=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,l=new Map;for(const t of e.pieceData){const e=r?r(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let r=0;d.length>r;r++){const h=l.get(d[r])||[];for(const l of h){const h=i(l),g=a(l,d[r]);if(u){const i=e.x+r*t+n/2,a=s(0),u=s(h);c.push(S(i,Math.min(a,u),o,Math.abs(a-u),g,l,d[r]))}else{const i=e.x+r*t+n/2,a=s(0),u=s(h);c.push(S(Math.min(a,u),i,Math.abs(u-a),o,g,l,d[r]))}}}}return c},point:function(e,t){var n,o;const{scales:i,columns:r,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,m=s.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&&s[i]||c,p=l(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:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=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(s),m=c?a(s):e.middle+h;l.push({type:"point",x:g,y:m,r:d,style:u,datum:o})}}return l},pie:E,donut:E,boxplot:function(e,t){var n,i,r,a,s;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:m}=l,f=[],y="vertical"===m,p=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(n=o.quantile(t,.25))&&void 0!==n?n:l,m=null!==(i=o.quantile(t,.5))&&void 0!==i?i:(l+c)/2,v=null!==(r=o.quantile(t,.75))&&void 0!==r?r:c,b=v-u,x=u-1.5*b,w=v+1.5*b,k=null!==(a=t.find(e=>e>=x))&&void 0!==a?a:l,S=null!==(s=[...t].reverse().find(e=>w>=e))&&void 0!==s?s:c,E=h(e.pieceData[0],e.name),A=[];if(p)for(const t of e.pieceData){const n=d(t);if(x>n||n>w){const o=y?e.middle:g(n),i=y?g(n):e.middle;A.push({px:o,py:i,value:n,datum:t})}}if(f.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(k),q1Pos:g(u),medianPos:g(m),q3Pos:g(v),maxPos:g(S),stats:{n:t.length,min:k,q1:u,median:m,q3:v,max:S,mean:t.reduce((e,t)=>e+t,0)/t.length},style:E,datum:e.pieceData,category:e.name,outliers:A}),p)for(const e of A)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var n,i,r;const{scales:a,columns:s,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=a,g=[],m="vertical"===h,f=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const a=t[0],s=t[t.length-1],l=(s-a)/f||1,h=Array(f).fill(0);for(const e of t)h[Math.min(Math.floor((e-a)/l),f-1)]++;const p=Math.max(...h,1),v=e.width/2*.9;let b="";if(m){for(let t=0;f>t;t++){const n=d(a+(t+.5)*l),o=h[t]/p*v;b+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=f-1;t>=0;t--){const n=d(a+(t+.5)*l);b+=` L ${e.middle-h[t]/p*v} ${n}`}b+=" Z"}else{for(let t=0;f>t;t++){const n=d(a+(t+.5)*l),o=h[t]/p*v;b+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=f-1;t>=0;t--)b+=` L ${d(a+(t+.5)*l)} ${e.middle+h[t]/p*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(y&&t.length>=4){const l=null!==(n=o.quantile(t,.25))&&void 0!==n?n:a,c=null!==(i=o.quantile(t,.5))&&void 0!==i?i:(a+s)/2,u=null!==(r=o.quantile(t,.75))&&void 0!==r?r:s;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:m}}const k=m?{x:e.x,y:Math.min(d(s),d(a)),width:e.width,height:Math.abs(d(s)-d(a))}:{x:Math.min(d(a),d(s)),y:e.x,width:Math.abs(d(s)-d(a)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:A(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){const{scales:n,columns:o,config:i,getR:r,resolveSummaryStyle:a}=e,{r:s}=n,l=[],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=s(n+t*o),c=s(n+(t+1)*o);l.push(S(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 l},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:s}=e,{r:l,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=s(e.pieceData[0],e.name),y=e.width*g;let p="";if(h){const t=e.x+e.width;p=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)p+=` L ${l(o+(e+.5)*r)} ${t-c[e]/m*y}`;p+=` L ${l(i)} ${t} Z`}else{const t=e.x;p=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);p+=` L ${t+c[e]/m*y} ${n}`}p+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:v,stats:A(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:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,s]=n,u=r(t,e.name);if(c){const n=a(Math.min(o,s)),i=a(Math.max(o,s));l.push(S(n,e.x,i-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),i=a(Math.min(o,s));l.push(S(e.x,n,e.width,i-n,u,t,e.name))}}return l}};class O{constructor(e){this.rExtent=new g,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 h(e.windowSize),this.getO=y(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>f(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new g)):(this.getR=f(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=y(e.stackBy),this.getGroup=y(e.groupBy),this.getColor=y(e.colorAccessor),this.getConnector=y(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new h(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:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const i=o.toArray(),r=n.projection||"vertical",a=n.oExtent||this.resolveCategories(i),s=this.computeValueDomain(i,a),l="horizontal"===r,c=null!=n.barPadding?n.barPadding/("vertical"===r?e.width:e.height):.1;let u,d;if("radial"===r){u=t.scaleBand().domain(a).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=n.innerRadius||0;d=t.scaleLinear().domain(s).range([i,o])}else l?(u=t.scaleBand().domain(a).range([0,e.height]).padding(c),d=t.scaleLinear().domain(s).range([0,e.width])):(u=t.scaleBand().domain(a).range([0,e.width]).padding(c),d=t.scaleLinear().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:r},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((i,r)=>{const a=this.rExtents[r];a.dirty&&a.recalculate(o,i);let[s,c]=a.extent;s===1/0&&(s=0,c=1);const u=c-s,d=u>0?u*(n.extentPadding||.05):1;return s-=d,c+=d,s>0&&(s=0),l?t.scaleLinear().domain([s,c]).range([0,e.width]):t.scaleLinear().domain([s,c]).range([e.height,0])}):[];let h=i;this.rAccessors.length>1&&(h=i.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,a,u,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),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,s=0;if("bar"===i&&this.getStack&&this.config.normalize)a=0,s=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>s&&(s=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>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===i)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*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])||(s+=c),"bar"!==i&&"clusterbar"!==i||(a>0&&(a=0),0>s&&(s=0)),[a,s]}buildColumns(e,t,n,o,i){var r;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const 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=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(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=M[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:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=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"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.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 l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],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:b,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,s=t-1-e;switch(r.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=r.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(i=r.stepThreshold)&&void 0!==i?i:.5*t)>s?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),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,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,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=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],s=this.config.oAccessor;if(("function"==typeof s?s(i):i[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=r-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;a>i&&(n._pulseIntensity=1-i/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,i,r,a,s,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let g=!1;const m=new Set,f=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,f);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(m.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(m.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(i=c.w)&&void 0!==i?i:s.w,s.h=null!==(r=c.h)&&void 0!==r?r:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)m.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const 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=m(i,e._targetOpacity,r)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=m(o.x,e._targetX,r),e.y=m(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=m(i,e._targetOpacity,r)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=m(n.x,e._targetX,r),e.y=m(n.y,e._targetY,r),void 0!==n.w&&(e.w=m(n.w,e._targetW,r),e.h=m(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 P(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function j(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 L(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 C(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=P(Math.atan2(i,o)),s=P(e.startAngle),l=P(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function B(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 H(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 _={fill:e=>c.createElement("rect",{style:e,width:16,height:16}),line:e=>c.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function D(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,_[n])(o(e,t)),i}function R(){return c.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function N(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function I({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:i,label:r,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+c.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),u=[];for(let e=0;64>=e;e++){const t=e/64;u.push(c.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(i[0]+t*(i[1]-i[0]))}))}return c.createElement("g",{"aria-label":r||"Gradient legend"},c.createElement("defs",null,c.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),r&&c.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},r),c.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),c.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(i[0])),c.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(i[1])))}const u=[];for(let e=0;64>=e;e++){const t=e/64;u.push(c.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(i[1]-t*(i[1]-i[0]))}))}return c.createElement("g",{"aria-label":r||"Gradient legend"},r&&c.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},r),c.createElement("defs",null,c.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),c.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),c.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(i[1])),c.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(i[0])))}function z(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r,legendInteraction:a,title:s="Legend",width:l=100,height:u=20,orientation:d="vertical"}=e,[h,g]=c.useState(0),[m,f]=c.useState(0),y=c.useCallback((e,t)=>{g(e),f(t)},[]),p="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,g)=>{d+=5,h.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:t,y2:d})),d+=8,e.label&&(d+=16,h.push(c.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),d+=8),h.push(c.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((e,t,n,o,i,r,a,s,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,m=[];let f=0;const y=!(!t&&!n),p="isolate"===u||void 0===u&&null!=i;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,i),x=i&&i.size>0&&i.has(e.label);m.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${f})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===r&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?x||!1:void 0,"aria-current":y&&!p&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(u+("ArrowDown"===n.key?1:-1)+g.length)%g.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(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&&c.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&c.createElement(R,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=22}),m})(e,n,o,i,r,a,s,g,l,u))),d+=22*e.items.length+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r,focusedGroupIndex:h,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];e.forEach((e,t)=>{let n=0;e.label&&(n+=16);const m=((e,t,n,o,i,r,a,s,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,m=[];let f=0;const y=!(!t&&!n),p="isolate"===u||void 0===u&&null!=i;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,i),x=i&&i.size>0&&i.has(e.label);m.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===r&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?x||!1:void 0,"aria-current":y&&!p&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+g.length)%g.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(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&&c.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&c.createElement(R,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=26+7*e.label.length}),{items:m,offset:f}})(e,o,i,r,a,s,l,t,u,d);n+=m.offset+5,g.push(Object.assign(Object.assign({label:e.label},m),{offset:n})),h+=n+12});let m=Math.max(0,(n-h)/2);const f=[];return g.forEach((n,o)=>{const i=e[o];i.label&&(f.push(c.createElement("text",{key:"legend-text-"+o,transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),m+=16),f.push(c.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${m},0)`},n.items)),m+=n.offset+5,e[o+1]&&f.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:m,y1:-8,x2:m,y2:t+0+8})),m+=12}),c.createElement("g",null,f)})({legendGroups:t||[],title:s,height:u,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r,focusedGroupIndex:h,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a}),v=!(!n&&!o);return c.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==r))||void 0,"aria-label":"Chart legend"},void 0!==s&&""!==s&&"vertical"===d&&c.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),p)}function W(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 $(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 T(e){const{x:t=0,y:n=0,dx:o,dy:i,nx:r,ny:a,note:s,connector:l,subject:u,type:d,color:h,className:g,disable:m,events:f={},"data-testid":y}=e,p=new Set(Array.isArray(m)?m:[]);let v=o||0,b=i||0;null!=r&&(v=r-t),null!=a&&(b=a-n);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 c.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":y},f),!p.has("connector")&&function(e,t,n,o,i,r){const a=[];let s=0,l=0;if("callout-circle"!==i&&"label"!==i||!(null==r?void 0:r.radius)){if("callout-rect"===i&&r){const n=r.width||0,o=r.height||0;if(n>0||o>0){const i=n/2,r=o/2,a=e-i,c=t-r;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;s=i+a*h,l=r+c*h}}}else if("bracket"===i&&r){const e=r.width,t=r.height,n=r.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(r.radius||0)+(r.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-s,2)+Math.pow(t-l,2))>.5&&(a.push(c.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,i=16/180*Math.PI,r=Math.atan2(t-l,e-s);a.push(c.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(r+i)},${l+n*Math.sin(r+i)}L${s+n*Math.cos(r-i)},${l+n*Math.sin(r-i)}Z`,fill:o||"currentColor",stroke:"none"}))}return c.createElement("g",{className:"annotation-connector"},a)}(v,b,l,h,x,u),!p.has("subject")&&function(e,t,n,o,i){var r;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(c.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(c.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,r=i||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(c.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-r,x2:o,y2:(t.y2||0)-r,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-r;a.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(c.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-r,x2:0,y2:(t.y2||0)-r,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(r=null==t?void 0:t.width)&&void 0!==r?r:null==t?void 0:t.height;void 0!==e&&a.push(c.createElement("path",{key:"bracket-path",d:$((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return c.createElement("g",{className:"annotation-subject"},a)}(x,u,h,t,n),!p.has("note")&&function(e,t,n,o){if(!e)return c.createElement("g",{className:"annotation-note"});const{label:i,title:r,orientation:a,align:s,wrap:l=120,noWrap:u}=e;if(!i&&!r)return c.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=s;h&&"dynamic"!==h||(h="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>t?"end":"start";const m=16,f=r?u?[r]:W(r,l):[],y=i?u?[i]:W(i,l):[],p="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(c.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},f.map((e,t)=>c.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e)))),v=f.length*m),y.length>0&&b.push(c.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},y.map((e,t)=>c.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e))));let x=null;if((r||i)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(l,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+y.length)*m+(y.length>0?m:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,f.length+y.length-1)*m;let k=0;return"topBottom"===d?k=0>n?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+m+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),c.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},c.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(s,v,b,h))}function q(e){var t,n;const{noteData:o}=e,{screenCoordinates:i}=o,r="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&i){const e=o.nx||i[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||i[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=i.map((t,n)=>{const i=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return c.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},i,{type:r}))});return c.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return c.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:r}))}const F={linear:r.curveLinear,monotoneX:r.curveMonotoneX,monotoneY:r.curveMonotoneY,step:r.curveStep,stepAfter:r.curveStepAfter,stepBefore:r.curveStepBefore,basis:r.curveBasis,cardinal:r.curveCardinal,catmullRom:r.curveCatmullRom};function G(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 V(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 X(e,t,n){var o,i,r,a;const s=e.anchor||"fixed";if("latest"===s){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 s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(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=l[e.xAccessor||"x"],h=l[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 l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=G(e,n),c=V(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Y(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Q(t){const{width:n,height:o,totalWidth:i,totalHeight:r,margin:a,scales:s,showAxes:l,showGrid:u,rFormat:d}=t,h="radial"===(null==s?void 0:s.projection),g="horizontal"===(null==s?void 0:s.projection),m=e.useMemo(()=>!s||h?[]:s.r.ticks(5).map(e=>({value:e,pixel:s.r(e),label:(d||K)(e)})),[s,d,h]),f=u&&s&&!h,y=l&&s&&!h;return f||y?c.createElement("svg",{width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},c.createElement("g",{transform:`translate(${a.left},${a.top})`},f&&c.createElement("g",{className:"ordinal-grid"},m.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:g?e.pixel:0,y1:g?0:e.pixel,x2:g?e.pixel:n,y2:g?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),y&&c.createElement(c.Fragment,null,g?c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function K(e){return Math.round(100*e)/100+""}function Z(t){var n,o;const{width:a,height:s,totalWidth:l,totalHeight:d,margin:h,scales:g,showAxes:m,oLabel:f,rLabel:y,oFormat:p,rFormat:v,showGrid:b,title:x,legend:w,legendHoverBehavior:k,legendClickBehavior:S,legendHighlightedCategory:E,legendIsolatedCategories:A,legendPosition:M="right",foregroundGraphics:O,annotations:P,svgAnnotationRules:j,xAccessor:L,yAccessor:C,annotationData:B,underlayRendered:H,children:_}=t,D="radial"===(null==g?void 0:g.projection),R="horizontal"===(null==g?void 0:g.projection),N=e.useMemo(()=>m&&g&&!D?g.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2,label:p?p(e):e}}):[],[m,g,p,D]),W=e.useMemo(()=>m&&g&&!D?g.r.ticks(5).map(e=>({value:e,pixel:g.r(e),label:(v||K)(e)})):[],[m,g,v,D]),$=e.useRef(new Map),T=e.useRef(null!==(n=null==P?void 0:P.length)&&void 0!==n?n:0),Q=null!==(o=null==P?void 0:P.length)&&void 0!==o?o:0;T.current!==Q&&(T.current=Q,$.current=new Map);const Z=e.useMemo(()=>{if(!P||0===P.length)return null;const e=function(e,t,n){var o,a,s,l,d,h,g,m,f,y,p,v,b,x,w,k,S,E,A,M,O,P,j,L,C,B,H,_,D,R,N,I,z,W,$,T,Q,K,Z,U,J,ee,te,ne;switch(e.type){case"label":{const o=X(e,t,n);if(!o)return null;const{x:i,y:r}=o;return Y(i,r,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:i,y:r,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=X(e,t,n);if(!o)return null;const{x:i,y:r}=o;return Y(i,r,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:i,y:r,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=G(e,n);if(null==o)return null;const i=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:o+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=V(e,n);if(null==o)return null;const i=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=i.packEnclose(o),a=e.padding||10;return c.createElement("g",{key:"ann-"+t},c.createElement("circle",{cx:r.x,cy:r.y,r:r.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:r.x,y:r.y-r.r-a-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=e.padding||10,r=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...r)-i,l=Math.max(...r)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:s,y:u,width:l-s,height:d-u,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:(s+l)/2,y:u-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"highlight":{const o=n.data||[],i="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],r=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return c.createElement("g",{key:"ann-"+t},i.map((t,o)=>{const i=G(t,n),a=V(t,n);return null==i||null==a?null:c.createElement("circle",Object.assign({key:"hl-"+o,cx:i,cy:a,r:e.r||6},r))}))}case"bracket":{const o=G(e,n),i=V(e,n);return c.createElement(q,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=i?i:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const i=n.data||[];if(2>i.length)return null;const r=n.xAccessor||"x",m=n.yAccessor||"y",f=i.map(e=>[e[r],e[m]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(a=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==a?a:null===(s=n.scales)||void 0===s?void 0:s.time,p=null!==(d=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==d?d:null===(h=n.scales)||void 0===h?void 0:h.value;if(!y||!p)return null;const v=e.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,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){s.push([t,r[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))s.push([t,h/u]);else{const e=(u*m-d*h)/f;s.push([t,(h-e*d)/u+e*t])}}return s}(f,null!==(g=e.bandwidth)&&void 0!==g?g:.3):("polynomial"===v?u.default.polynomial(f,{order:e.order||2}):u.default.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${p(t)}`).join(" "),w=e.color||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:y(b[b.length-1][0])+4,y:p(b[b.length-1][1])-4,fill:w,fontSize:11},e.label))}case"band":{const o=null!==(f=null===(m=n.scales)||void 0===m?void 0:m.y)&&void 0!==f?f:null===(y=n.scales)||void 0===y?void 0:y.value,i=null!==(p=null==o?void 0:o(e.y0))&&void 0!==p?p:0,r=null!==(v=null==o?void 0:o(e.y1))&&void 0!==v?v:n.height||0;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:0,y:Math.min(i,r),width:n.width||0,height:Math.abs(r-i),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(i,r)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const i=n.xAccessor||"x",a=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=n.scales)||void 0===w?void 0:w.time,s=null!==(S=null===(k=n.scales)||void 0===k?void 0:k.y)&&void 0!==S?S:null===(E=n.scales)||void 0===E?void 0:E.value;if(!a||!s)return null;const l=e.upperAccessor||"upperBounds",u=e.lowerAccessor||"lowerBounds",d=e.filter,h=o.filter(e=>null!=e[l]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[i]-t[i]);if(2>h.length)return null;const g=F[n.curve||"linear"]||r.curveLinear,m=r.area().x(e=>a(e[i])).y0(e=>s(e[u])).y1(e=>s(e[l])).curve(g)(h);if(!m)return null;const f=e.fill||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:m,fill:f,fillOpacity:null!==(A=e.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),e.label&&h.length>0&&c.createElement("text",{x:a(h[h.length-1][i])+4,y:s(h[h.length-1][l])-4,fill:f,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const i=n.yAccessor||"y",r=null!==(O=null===(M=n.scales)||void 0===M?void 0:M.x)&&void 0!==O?O:null===(P=n.scales)||void 0===P?void 0:P.time,a=null!==(L=null===(j=n.scales)||void 0===j?void 0:j.y)&&void 0!==L?L:null===(C=n.scales)||void 0===C?void 0:C.value;if(!r||!a)return null;const s=o.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,u=s.reduce((e,t)=>e+Math.pow(t-l,2),0)/s.length,d=Math.sqrt(u),h=null!==(B=e.threshold)&&void 0!==B?B:2,g=l-h*d,m=!1!==e.showBand,f=e.fill||"#6366f1",y=null!==(H=e.fillOpacity)&&void 0!==H?H:.1,p=e.anomalyColor||"#ef4444",v=null!==(_=e.anomalyRadius)&&void 0!==_?_:6,b=a(l+h*d),x=a(g),w=o.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-l)>h*d});return c.createElement("g",{key:"ann-"+t},m&&c.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),w.map((e,t)=>{const o=G(e,n),i=V(e,n);return null==o||null==i?null:c.createElement("circle",{key:"anomaly-"+t,cx:o,cy:i,r:v,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5})}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const i=n.xAccessor||"x",r=n.yAccessor||"y",a=null!==(R=null===(D=n.scales)||void 0===D?void 0:D.x)&&void 0!==R?R:null===(N=n.scales)||void 0===N?void 0:N.time,s=null!==(z=null===(I=n.scales)||void 0===I?void 0:I.y)&&void 0!==z?z:null===(W=n.scales)||void 0===W?void 0:W.value;if(!a||!s)return null;const l=o.map(e=>[e[i],e[r]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let d;if("polynomial"===(e.method||"linear")){const t=u.default.polynomial(l,{order:e.order||2}).equation;d=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,i=0;for(const[e,r]of l)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,s=(n-a*t)/e;d=e=>s+a*e}const h=l.length,g=l.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),m=Math.sqrt(g/Math.max(h-2,1)),f=l.reduce((e,t)=>e+t[0],0)/h,y=l.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),p=null!==($=e.confidence)&&void 0!==$?$:.95,v=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=null!==(T=e.steps)&&void 0!==T?T:5,x=l[h-1][0],w=(x-l[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const S=[];for(const e of k){const t=d(e),n=m*Math.sqrt(1+1/h+(y>0?Math.pow(e-f,2)/y:0))*v;S.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const E=`M${S.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${S.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,A=S.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),M=`${a(x)},${s(d(x))}`,O=e.strokeColor||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:E,fill:e.fill||"#6366f1",fillOpacity:null!==(Q=e.fillOpacity)&&void 0!==Q?Q:.15,stroke:"none"}),c.createElement("polyline",{points:`${M} ${A}`,fill:"none",stroke:O,strokeWidth:null!==(K=e.strokeWidth)&&void 0!==K?K:2,strokeDasharray:null!==(Z=e.strokeDasharray)&&void 0!==Z?Z:"6,3"}),e.label&&S.length>0&&c.createElement("text",{x:a(S[S.length-1].x)+4,y:s(S[S.length-1].yCenter)-4,fill:O,fontSize:11},e.label))}case"widget":{let o=null,i=null;if(null!=e.px&&null!=e.py)o=e.px,i=e.py;else{const r=X(e,t,n);if(!r)return null;o=r.x,i=r.y}if(null==o||null==i)return null;if(!Y(o,i,n))return null;const r=null!==(U=e.dx)&&void 0!==U?U:0,a=null!==(J=e.dy)&&void 0!==J?J:0,s=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,u=null!==(ne=e.content)&&void 0!==ne?ne:c.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return c.createElement("foreignObject",{key:"ann-"+t,x:o+r-s/2,y:i+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},c.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const o=X(e,t,n);if(!o)return null;const{x:i,y:r}=o;return c.createElement("text",{key:"ann-text-"+t,x:i+(e.dx||0),y:r+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}default:return null}},t="horizontal"===(null==g?void 0:g.projection),n=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,o={scales:g?{x:t?g.r:n||g.r,y:t&&n||g.r,time:g.r,value:g.r}:null,timeAxis:"x",xAccessor:L,yAccessor:C,width:a,height:s,data:B,frameType:"ordinal",stickyPositionCache:$.current};return P.map((t,n)=>{if(j){const i=j(t,n,o);return null!=i?i:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[P,j,a,s,g,L,C,B]);return m||x||w||O||Z&&Z.length>0||b||_?c.createElement("svg",{role:"img",width:l,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},c.createElement("title",null,"string"==typeof x?x:"Ordinal Chart"),c.createElement("desc",null,"string"==typeof x?x+" — ordinal data visualization":"Ordinal data visualization"),c.createElement("g",{transform:`translate(${h.left},${h.top})`},b&&g&&!D&&!H&&c.createElement("g",{className:"ordinal-grid"},W.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:R?e.pixel:0,y1:R?0:e.pixel,x2:R?e.pixel:a,y2:R?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&g&&!D&&c.createElement("g",{className:"ordinal-axes"},R?c.createElement(c.Fragment,null,!H&&c.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),f&&c.createElement("text",{x:15-h.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${s/2})`,style:{userSelect:"none"}},f),!H&&c.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${s})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),y&&c.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):c.createElement(c.Fragment,null,!H&&c.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${s})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),f&&c.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!H&&c.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),y&&c.createElement("text",{x:15-h.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${s/2})`,style:{userSelect:"none"}},y))),Z,O,_),x&&c.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof x?x:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:i,legendPosition:r="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const g="top"===r||"bottom"===r;let m,f;return"left"===r?(m=4,f=i.top):"top"===r?(m=0,f=a?32:8):"bottom"===r?(m=0,f=o-i.bottom+50):(m=n-i.right+10,f=i.top),c.createElement("g",{transform:`translate(${m}, ${f})`},"object"==typeof(y=t)&&null!==y&&"gradient"in y?c.createElement(I,{config:t.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?c.createElement(z,{legendGroups:t.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t);var y}({legend:w,totalWidth:l,totalHeight:d,margin:h,legendPosition:M,title:x,legendHoverBehavior:k,legendClickBehavior:S,legendHighlightedCategory:E,legendIsolatedCategories:A})):null}const U="undefined"==typeof window||"undefined"==typeof document,J={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ee(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 te({scene:e,chartType:t}){var n,o,i,r;const a=[];for(const t of e){if(a.length>=50)break;"point"===t.type?a.push({label:"Point",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+""}}):"rect"===t.type?a.push({label:"Bar",values:{category:(null===(n=t.datum)||void 0===n?void 0:n.category)||"",value:Math.round(100*(null!==(i=null===(o=t.datum)||void 0===o?void 0:o.value)&&void 0!==i?i:0))/100+""}}):"heatcell"===t.type&&a.push({label:"Cell",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+"",value:Math.round(100*(null!==(r=t.value)&&void 0!==r?r:0))/100+""}})}if(0===a.length)return null;const s=new Set;for(const e of a)for(const t of Object.keys(e.values))s.add(t);const l=Array.from(s);return c.createElement("table",{style:J,role:"table","aria-label":"Data table for "+t},c.createElement("thead",null,c.createElement("tr",null,l.map(e=>c.createElement("th",{key:e},e)))),c.createElement("tbody",null,a.map((e,t)=>c.createElement("tr",{key:t},l.map(t=>{var n;return c.createElement("td",{key:t},null!==(n=e.values[t])&&void 0!==n?n:"")}))),e.length>50&&c.createElement("tr",null,c.createElement("td",{colSpan:l.length},"...and ",e.length-50," more items"))))}function ne({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return c.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:J},t)}function oe(t){const n=e.createContext(null),o=ie(t);return[function({children:o}){const i=e.useMemo(()=>ie(t),[]);return c.createElement(n.Provider,{value:i,children:o})},t=>{var i;const r=null!==(i=e.useContext(n))&&void 0!==i?i:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(r.getState()),[r]),l=e.useCallback(()=>a.current(r.getState()),[r]);return e.useSyncExternalStore(r.subscribe,s,l)}]}function ie(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 re={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}},ae={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}},[se,le]=oe(e=>({theme:re,setTheme(t){e(e=>"light"===t?{theme:re}:"dark"===t?{theme:ae}:{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 ce(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ue(e,t,n=.3){ce(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 de(e,t,n=.6){var o,i,r,a,s;if(!ce(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function he(e,t,n,o=.35){ce(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const ge=(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?me(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))),ue(e,t),e.globalAlpha=1};function me(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()),de(e,t),e.globalAlpha=1}}finally{e.restore()}};function ye(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 pe=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"wedge"===e.type);for(const t of a)ye(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&&(ye(e,t),he(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()}},be=(e,t,n,o)=>{var i,r,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(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}},xe=e=>[be,...e],we={bar:xe([ge]),clusterbar:xe([ge]),point:xe([fe]),swarm:xe([fe]),pie:[pe],donut:[pe],boxplot:xe([(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",s=t.style.stroke||"#333",l=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=s,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),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:xe([ve]),histogram:xe([ge]),ridgeline:xe([ve]),timeline:xe([ge])},ke={top:50,right:40,bottom:60,left:70},Se={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 Ee({hover:e}){var t,n,o,i,r,a;const s=e.data||{},l=e.stats,u=e.category;if(Array.isArray(s)){const e=u||(null===(t=s[0])||void 0===t?void 0:t.category)||"";if(l)return c.createElement("div",{className:"semiotic-tooltip",style:Se},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,"n = ",l.n),c.createElement("div",null,"Min: ",l.min.toLocaleString()),c.createElement("div",null,"Q1: ",l.q1.toLocaleString()),c.createElement("div",null,"Median: ",l.median.toLocaleString()),c.createElement("div",null,"Q3: ",l.q3.toLocaleString()),c.createElement("div",null,"Max: ",l.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",l.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=s.length;return c.createElement("div",{className:"semiotic-tooltip",style:Se},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,n," items"))}if(null!=s.bin&&null!=s.count){const e=s.range||[];return c.createElement("div",{className:"semiotic-tooltip",style:Se},s.category&&c.createElement("div",{style:{fontWeight:"bold"}},s.category+""),c.createElement("div",null,"Count: ",s.count),2===e.length&&c.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const d=e.__oAccessor,h=e.__rAccessor,g=e.__chartType;if("swarm"===g||"point"===g){const e=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:Se},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}const m=(d&&null!=s[d]?s[d]:null)||s.category||s.name||s.group||s.__rName||"",f=null!==(a=null!==(r=null!==(i=null!==(o=null!==(n=s.__aggregateValue)&&void 0!==n?n:h&&null!=s[h]?s[h]:null)&&void 0!==o?o:s.value)&&void 0!==i?i:s.__rValue)&&void 0!==r?r:s.pct)&&void 0!==a?a:"";if(!m&&""===f){const e=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:Se},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return c.createElement("div",{className:"semiotic-tooltip",style:Se},m&&c.createElement("div",{style:{fontWeight:"bold"}},m+""),""!==f&&c.createElement("div",null,"number"==typeof f?f.toLocaleString():f+""))}const Ae=e.forwardRef(function(t,n){var o,i,a,s,l,u,h;const{chartType:g,runtimeMode:m,data:f,oAccessor:y="category",rAccessor:p="value",colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:k,valueAccessor:S,categoryAccessor:E,projection:A="vertical",size:M=[600,400],responsiveWidth:P,responsiveHeight:_,margin:D,barPadding:R,innerRadius:N,normalize:I,startAngle:z,dynamicColumnWidth:W,bins:$,showOutliers:T,showIQR:q,amplitude:F,connectorAccessor:G,connectorStyle:V,rExtent:X,oExtent:Y,extentPadding:K=.05,oSort:J,windowMode:oe="sliding",windowSize:ie=200,pieceStyle:re,summaryStyle:ae,colorScheme:se,barColors:ce,showAxes:ue=!0,oLabel:de,rLabel:he,oFormat:ge,rFormat:me,enableHover:fe=!0,hoverAnnotation:ye,tooltipContent:pe,customHoverBehavior:ve,annotations:be,svgAnnotationRules:xe,showGrid:Se=!1,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Oe,legendHighlightedCategory:Pe,legendIsolatedCategories:je,legendPosition:Le,backgroundGraphics:Ce,foregroundGraphics:Be,title:He,className:_e,background:De,centerContent:Re,decay:Ne,pulse:Ie,transition:ze,staleness:We,accessibleTable:$e}=t,[Te,qe]=function(t,n,o){const i=e.useRef(null),[r,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:t[0],o&&r?r.h:t[1]]]}(M,P,_),Fe=e.useMemo(()=>Object.assign(Object.assign({},ke),D),[D]),Ge=qe[0]-Fe.left-Fe.right,Ve=qe[1]-Fe.top-Fe.bottom,Xe="function"==typeof Be?Be({size:qe,margin:Fe}):Be,Ye=e.useRef(null),Qe=e.useRef(!0),Ke=le(e=>e.theme),Ze=e.useRef(0),Ue=e.useRef(null),Je=e.useRef(()=>{}),[et,tt]=e.useState(null),[nt,ot]=e.useState(null),[it,rt]=e.useState(0),[at,st]=e.useState(!1),lt=fe||ye,ct="streaming"===m,ut=e.useMemo(()=>({chartType:g,runtimeMode:ct?"streaming":"bounded",windowSize:ie,windowMode:oe,extentPadding:K,projection:A,oAccessor:ct?void 0:y,rAccessor:ct?void 0:p,colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:ct?k:void 0,valueAccessor:ct?S||("string"==typeof p||"function"==typeof p?p:void 0):void 0,categoryAccessor:ct?E||y:void 0,rExtent:X,oExtent:Y,barPadding:R,innerRadius:N,normalize:I,startAngle:z,dynamicColumnWidth:W,bins:$,showOutliers:T,showIQR:q,amplitude:F,connectorAccessor:G,connectorStyle:V,oSort:J,pieceStyle:re,summaryStyle:ae,colorScheme:se,barColors:ce,decay:Ne,pulse:Ie,transition:ze,staleness:We}),[g,ie,oe,K,A,y,p,v,b,x,w,k,S,E,X,Y,R,N,I,z,W,$,T,q,F,G,V,J,re,ae,se,ce,Ne,Ie,ze,We,ct]),dt=e.useRef(null);dt.current||(dt.current=new O(ut));const ht=e.useCallback(()=>{Ze.current||(Ze.current=requestAnimationFrame(()=>Je.current()))},[]);e.useEffect(()=>{var e;null===(e=dt.current)||void 0===e||e.updateConfig(ut),Qe.current=!0,ht()},[ut,ht]),e.useEffect(()=>{Qe.current=!0,ht()},[Ke,ht]);const gt=e.useRef(null);gt.current||(gt.current=new d(e=>{const t=dt.current;t&&t.ingest(e)&&(Qe.current=!0,ht())}));const mt=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.push(e)},[]),ft=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.pushMany(e)},[]),yt=e.useCallback(()=>{var e,t;null===(e=gt.current)||void 0===e||e.clear(),null===(t=dt.current)||void 0===t||t.clear(),Qe.current=!0,ht()},[ht]);e.useImperativeHandle(n,()=>({push:mt,pushMany:ft,clear:yt,getData:()=>{var e,t,n;return null===(e=gt.current)||void 0===e||e.flush(),null!==(n=null===(t=dt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[mt,ft,yt]),e.useEffect(()=>{var e;f&&(null===(e=gt.current)||void 0===e||e.setBoundedData(f))},[f]);const pt=e.useRef(()=>{}),vt=e.useRef(()=>{});pt.current=e=>{if(!lt)return;const t=Ye.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Fe.left,i=e.clientY-n.top-Fe.top;if(0>o||o>Ge||0>i||i>Ve)return void(Ue.current&&(Ue.current=null,tt(null),ve&&ve(null),ht()));const r=dt.current;if(!r||0===r.scene.length)return;const a="radial"===A,s=function(e,t,n,o=30){let i=null;for(const r of e){let e=null;switch(r.type){case"rect":e=j(r,t,n);break;case"point":e=L(r,t,n);break;case"wedge":e=C(r,t,n);break;case"boxplot":e=B(r,t,n);break;case"violin":e=H(r,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(r.scene,a?o-Ge/2:o,a?i-Ve/2:i);if(!s)return void(Ue.current&&(Ue.current=null,tt(null),ve&&ve(null),ht()));const l=s.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,time:s.x,value:s.y,x:s.x,y:s.y}),s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof y?y:void 0,__rAccessor:"string"==typeof p?p:void 0,__chartType:g});Ue.current=c,tt(c),ve&&(ve(c),Qe.current=!0),ht()},vt.current=()=>{Ue.current&&(Ue.current=null,tt(null),ve&&(ve(null),Qe.current=!0),ht())},e.useCallback(e=>pt.current(e),[]);const bt=e.useCallback(()=>vt.current(),[]),xt=e.useRef(-1),wt=e.useCallback(e=>{const t=dt.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=xt.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 xt.current=-1,Ue.current=null,tt(null),ve&&ve(null),void ht();const r=0>o?0:i;xt.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 y?y:void 0,__rAccessor:"string"==typeof p?p:void 0,__chartType:g});Ue.current=a,tt(a),ve&&ve(a),ht()},[ve,ht]),kt=e.useCallback(e=>{xt.current=-1,pt.current(e)},[]);Je.current=()=>{var e,t;Ze.current=0;const n=Ye.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=dt.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(r),s=Qe.current;s&&!a&&(i.computeScene({width:Ge,height:Ve}),Qe.current=!1),(s||a)&&n.setAttribute("aria-label",ee(i.scene,g+" chart"));const l="undefined"!=typeof window&&window.devicePixelRatio||1,c=qe[0]*l,u=qe[1]*l;n.width===c&&n.height===u||(n.width=c,n.height=u,n.style.width=qe[0]+"px",n.style.height=qe[1]+"px"),o.setTransform(l,0,0,l,0,0),o.clearRect(0,0,qe[0],qe[1]);const d=null!==(e=null==We?void 0:We.threshold)&&void 0!==e?e:5e3,h=We&&i.lastIngestTime>0&&r-i.lastIngestTime>d;h&&(o.globalAlpha=null!==(t=null==We?void 0:We.dimOpacity)&&void 0!==t?t:.5);const m=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",f=De||(m&&"transparent"!==m?m:null);f&&(o.fillStyle=f,o.fillRect(0,0,qe[0],qe[1]));const y="radial"===A;y?(o.save(),o.translate(Fe.left+Ge/2,Fe.top+Ve/2)):o.translate(Fe.left,Fe.top);const p=we[g]||[],v={width:Ge,height:Ve};for(const e of p)e(o,i.scene,i.scales,v);y&&o.restore(),h&&(o.globalAlpha=1),s&&i.scales&&(ot(i.scales),rt(e=>e+1)),(null==We?void 0:We.showBadge)&&st(!!h),(a||i.hasActivePulses)&&(Ze.current=requestAnimationFrame(()=>Je.current()))},e.useEffect(()=>(ht(),()=>{Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=0)}),[ht]),e.useEffect(()=>{Qe.current=!0,ht()},[g,Ge,Ve,ue,De,ht]),function(t,n,o,i,r,a){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const s=n.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-s.lastIngestTime>c;u!==r&&(a(u),o.current=!0,i())},1e3);return()=>clearInterval(e)},[t,r,i])}(We,dt,Qe,ht,at,st);const St=lt&&et?pe?pe(et):c.createElement(Ee,{hover:et}):null,Et="radial"===A,At=et?Et?et.x+Ge/2:et.x:0,Mt=et?Et?et.y+Ve/2:et.y:0,Ot=St?c.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Fe.left+At,top:Fe.top+Mt,transform:`translate(${At>.7*Ge?"calc(-100% - 12px)":"12px"}, ${.3*Ve>Mt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},St):null;if(U){const e=dt.current;e&&f&&(e.ingest({inserts:f,bounded:!0}),e.computeScene({width:Ge,height:Ve}));const t=null!==(o=null==e?void 0:e.scene)&&void 0!==o?o:[],n=null!==(i=null==e?void 0:e.scales)&&void 0!==i?i:null,a="radial"===A,s=a?Fe.left+Ge/2:Fe.left,l=a?Fe.top+Ve/2:Fe.top;return c.createElement("div",{className:"stream-ordinal-frame"+(_e?" "+_e:""),role:"img","aria-label":"string"==typeof He?He:"Ordinal chart",style:{position:"relative",width:qe[0],height:qe[1]}},c.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:qe[0],height:qe[1],style:{position:"absolute",left:0,top:0}},Ce&&c.createElement("g",{transform:`translate(${Fe.left},${Fe.top})`},Ce),c.createElement("g",{transform:`translate(${s},${l})`},De&&c.createElement("rect",{x:0,y:0,width:Ge,height:Ve,fill:De}),t.map((e,t)=>function(e,t){var n,o,i,a,s;const l=e.category||e.group||"",u=n=>`ord-${e.type}-${l}-${t}-${n}`,d=`ord-${e.type}-${l}-${t}`;switch(e.type){case"rect":return c.createElement("rect",{key:d,x:e.x,y:e.y,width:e.w,height:e.h,fill:e.style.fill||"#4e79a7",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"point":return c.createElement("circle",{key:d,cx:e.x,cy:e.y,r:e.r,fill:e.style.fill||"#4e79a7",opacity:null!==(n=e.style.opacity)&&void 0!==n?n:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"wedge":{const t=e,n=r.arc().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle).endAngle(t.endAngle)({})||"";return c.createElement("path",{key:d,d:n,transform:`translate(${t.cx},${t.cy})`,fill:t.style.fill||"#4e79a7",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity})}case"boxplot":{const t=e,n=t.columnWidth/2;return"vertical"===t.projection?c.createElement("g",{key:d},c.createElement("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:t.style.fill||"#4e79a7",fillOpacity:null!==(o=t.style.fillOpacity)&&void 0!==o?o:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})):c.createElement("g",{key:d},c.createElement("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:t.style.fill||"#4e79a7",fillOpacity:null!==(i=t.style.fillOpacity)&&void 0!==i?i:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}))}case"violin":{const t=e,n=[c.createElement("path",{key:u("path"),d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:t.style.fill||"#4e79a7",fillOpacity:null!==(a=t.style.fillOpacity)&&void 0!==a?a:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1})];if(t.iqrLine&&t.bounds){const e=t.bounds,o=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?n.push(c.createElement("line",{key:u("iqr"),x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:u("med"),cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1})):n.push(c.createElement("line",{key:u("iqr"),x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:u("med"),cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1}))}return c.createElement("g",{key:d},n)}case"connector":return c.createElement("line",{key:d,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:null!==(s=e.style.opacity)&&void 0!==s?s:.5});default:return null}}(e,t)).filter(Boolean))),c.createElement(Z,{width:Ge,height:Ve,totalWidth:qe[0],totalHeight:qe[1],margin:Fe,scales:n,showAxes:ue,oLabel:de,rLabel:he,oFormat:ge,rFormat:me,showGrid:Se,title:He,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Oe,legendHighlightedCategory:Pe,legendIsolatedCategories:je,legendPosition:Le,foregroundGraphics:Xe,annotations:be,svgAnnotationRules:xe,annotationFrame:0,xAccessor:"string"==typeof y?y:void 0,yAccessor:"string"==typeof p?p:void 0,annotationData:null==e?void 0:e.getData()}),Re&&"radial"===A&&c.createElement("div",{style:{position:"absolute",left:Fe.left+Ge/2,top:Fe.top+Ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Re))}return c.createElement("div",{ref:Te,className:"stream-ordinal-frame"+(_e?" "+_e:""),role:"img","aria-label":"string"==typeof He?He:"Ordinal chart",tabIndex:0,style:{position:"relative",width:P?"100%":qe[0],height:_?"100%":qe[1],overflow:"visible"},onMouseMove:lt?kt:void 0,onMouseLeave:lt?bt:void 0,onKeyDown:wt},Ce&&c.createElement("svg",{style:{position:"absolute",top:0,left:0,width:qe[0],height:qe[1],pointerEvents:"none"}},c.createElement("g",{transform:`translate(${Fe.left},${Fe.top})`},Ce)),c.createElement(Q,{width:Ge,height:Ve,totalWidth:qe[0],totalHeight:qe[1],margin:Fe,scales:nt,showAxes:ue,showGrid:Se,rFormat:me}),c.createElement("canvas",{ref:Ye,"aria-label":ee(null!==(s=null===(a=dt.current)||void 0===a?void 0:a.scene)&&void 0!==s?s:[],g+" chart"),style:{position:"absolute",top:0,left:0,width:qe[0],height:qe[1]}}),c.createElement(ne,{hoverPoint:et}),$e&&c.createElement(te,{scene:null!==(u=null===(l=dt.current)||void 0===l?void 0:l.scene)&&void 0!==u?u:[],chartType:g+" chart"}),c.createElement(Z,{width:Ge,height:Ve,totalWidth:qe[0],totalHeight:qe[1],margin:Fe,scales:nt,showAxes:ue,oLabel:de,rLabel:he,oFormat:ge,rFormat:me,showGrid:Se,title:He,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Oe,legendHighlightedCategory:Pe,legendIsolatedCategories:je,legendPosition:Le,foregroundGraphics:Xe,annotations:be,svgAnnotationRules:xe,annotationFrame:it,xAccessor:"string"==typeof y?y:void 0,yAccessor:"string"==typeof p?p:void 0,annotationData:null===(h=dt.current)||void 0===h?void 0:h.getData(),underlayRendered:!0}),Re&&"radial"===A&&c.createElement("div",{style:{position:"absolute",left:Fe.left+Ge/2,top:Fe.top+Ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Re),(null==We?void 0:We.showBadge)&&c.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===We.badgePosition?{top:4,left:4}:"bottom-left"===We.badgePosition?{bottom:4,left:4}:"bottom-right"===We.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:at?"#dc3545":"#28a745",color:"white"})},at?"STALE":"LIVE"),Ot)});Ae.displayName="StreamOrdinalFrame";const Me=e.createContext(null);function Oe(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 Pe(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[je,Le]=oe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Pe(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=Pe(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}})}})),[Ce,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 He(t){const n=e.useId(),o=t.clientId||n,{name:i}=t,r=Le(e=>e.selections.get(i)),a=Le(e=>e.setClause),s=Le(e=>e.clearClause),l=e.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:e.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Oe(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(i,{clientId:o,type:"point",fields:t})},[o,i,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(i,{clientId:o,type:"interval",fields:t})},[o,i,a]),clear:e.useCallback(()=>{s(i,o)},[s,i,o]),clientId:o}}const _e=e.createContext(!1);function De({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 Re(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 Ne="#007bff";function Ie(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const i="function"==typeof(r=o)?r:e=>e[r];var r;return e.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[t,n,o])}const ze={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 We(e,t,n){var o,i,r,a,s,l;const c=ze[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!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const $e={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 Te(e,t){return"function"==typeof t?t(e):e[t]}function qe(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 Fe(e={}){const{fields:t,title:n,format:o,style:i={},className:r=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=Te(e,n);a=qe(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,i,r;"string"==typeof t?(n=t,i=t,r=o):(n=t.label,i=t.accessor||t.key||"",r=t.format||o);const a=Te(e,i);s.push({label:n,value:qe(a,r)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=qe(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=qe(e[t[0]],o))}}const l=Object.assign(Object.assign({},$e),i);return c.createElement("div",{className:("semiotic-tooltip "+r).trim(),style:l},a&&c.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>c.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&c.createElement("span",null,e.label,": "),e.value)))}}function Ge(e){if(!0===e)return Fe();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:c.createElement("div",{className:"semiotic-tooltip",style:$e},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Fe(e):Fe())}function Ve(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Xe(e,t){return"function"==typeof t?t(e):e[t]}function Ye({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:i=!1}){return r=>{var a;const s=i?(null===(a=r.data)||void 0===a?void 0:a[0])||r.data||r:r.data||r,l=Xe(s,e),u=Xe(s,t),d=n?Xe(s,n):void 0;return c.createElement("div",{className:"semiotic-tooltip",style:$e},c.createElement("div",{style:{fontWeight:"bold"}},Ve(l)),c.createElement("div",{style:{marginTop:4}},Ve(u)),null!=d&&c.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(h=n)?h:"value"),": ",Ve(d)));var h}}function Qe({componentName:e,message:t,width:n,height:o}){return c.createElement("div",{role:"alert",style:{width:n,height:Math.max(o,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"}},c.createElement("div",{style:{textAlign:"center",maxWidth:400}},c.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),c.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t)))}class Ke extends c.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:c.createElement(Qe,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Ze;const Ue="undefined"!=typeof process&&"production"!==(null===(Ze=process.env)||void 0===Ze?void 0:Ze.NODE_ENV);function Je({componentName:e,width:t,height:n,children:o}){return c.createElement(Ke,{fallback:o=>c.createElement(Qe,{componentName:e,message:o.message,width:t,height:n})},o)}const et={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"},tt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function nt(e,t,n,o){if(!Ue)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 ot(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 it(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=ot(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 rt({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=it(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function at(t){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:a,legendPosition:s,selection:l,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:m,chartId:f,showLegend:y,userMargin:p,marginDefaults:v,loading:b,emptyContent:x,width:S,height:E}=t,{activeSelectionHook:A,customHoverBehavior:M,customClickBehavior:O}=function({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:a,chartId:s}){const l=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}(n,o),c=He({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:i,isActive:r,selectPoints:a,clear:s}=He({name:n});return{onHover:e.useCallback(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&a(t)},[o,a,s,n]),predicate:i,isActive:r}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),d=Be(e=>e.pushObservation),h=t?{isActive:c.isActive,predicate:c.predicate}:null,g=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),d&&d(e)}}},[n,u,r,a,s,d]),m=e.useCallback(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,a,s]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:m}}({selection:l,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:m,chartId:f}),P=function(t,n,o="category10"){const i=e.useContext(Me);return e.useMemo(()=>{if(n){if(0===t.length)return i&&Object.keys(i).length>0?e=>i[e]||"#999":void 0;if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));return i&&Object.keys(i).length>0?e=>i[e]||"#999":k(e.map(e=>({_cat:e})),"_cat",o)}if(i&&Object.keys(i).length>0){const e=k(t,n,o);return t=>i[t]||e(t)}return k(t,n,o)}},[t,n,o,i])}(n,i,r),j=e.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of n){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[n,i]),L=function(t,n,o){const[i,r]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&r(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&s(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=i?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===i}:"isolate"===t&&a.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return a.has(o)}}:null},[t,n,i,a]);return{highlightedCategory:"highlight"===t?i:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,i,j),C=e.useMemo(()=>L.legendSelectionHook?L.legendSelectionHook:A,[L.legendSelectionHook,A]),{legend:B,margin:H,legendPosition:_}=function({data:t,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40}}){const l=e.useContext(_e),c=void 0!==i?i:!l&&!!n,u=e.useMemo(()=>{if(c&&n)return De({data:t,colorBy:n,colorScale:o,getColor:w})},[c,n,t,o]),d=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return u&&("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,a,u,r]);return{legend:u,margin:d,legendPosition:r}}({data:n,colorBy:i,colorScale:P,showLegend:y,legendPosition:s,userMargin:p,defaults:v}),D=e.useMemo(()=>{const e={};return B&&(e.legend=B,e.legendPosition=_),a&&"none"!==a&&(e.legendHoverBehavior=L.onLegendHover,e.legendClickBehavior=L.onLegendClick,e.legendHighlightedCategory=L.highlightedCategory,e.legendIsolatedCategories=L.isolatedCategories),e},[B,_,a,L.onLegendHover,L.onLegendClick,L.highlightedCategory,L.isolatedCategories]),R=function(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),r=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(i+r)-r))/2);return c.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>c.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},tt),{position:"absolute",top:a+n*(i+r),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2})})))}(b,S,E),N=R?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?c.createElement("div",{style:Object.assign(Object.assign({},et),{width:t,height:n})},o||"No data available"):null}(o,S,E,x);return{colorScale:P,allCategories:j,legendState:L,effectiveSelectionHook:C,activeSelectionHook:A,customHoverBehavior:M,customClickBehavior:O,legend:B,margin:H,legendPosition:_,earlyReturn:R||N||null,legendBehaviorProps:D}}const st=e.forwardRef(function(t,n){const o=We(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}),i=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:r,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:m="category10",sort:f=!1,barPadding:y=40,tooltip:p,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:S,chartId:E,loading:A,emptyContent:M,legendInteraction:O,legendPosition:P}=t,j=o.width,L=o.height,C=o.enableHover,B=o.showGrid,H=o.title,_=o.categoryLabel,D=o.valueLabel,R=r||[],N=at({data:R,rawData:r,colorBy:g,colorScheme:m,legendInteraction:O,legendPosition:P,selection:x,linkedHover:k,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:S,chartType:"BarChart",chartId:E,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:A,emptyContent:M,width:j,height:L});if(N.earlyReturn)return N.earlyReturn;nt("BarChart",R,"categoryAccessor",l),nt("BarChart",R,"valueAccessor",u);const I=Ie(R,f,u),z=e.useMemo(()=>e=>{const t={};return t.fill=g?w(e,g,N.colorScale):Ne,t},[g,N.colorScale]),W=e.useMemo(()=>Re(z,N.effectiveSelectionHook,x),[z,N.effectiveSelectionHook,x]),$=e.useMemo(()=>Ye({categoryAccessor:l,valueAccessor:u,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group"}),[l,u,g]),T=rt({componentName:"BarChart",data:r,accessors:{categoryAccessor:l,valueAccessor:u}});if(T)return c.createElement(Qe,{componentName:"BarChart",message:T,width:j,height:L});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=r&&{data:I}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:W,size:[j,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:y,enableHover:C,showAxes:o.showAxes,oLabel:_,rLabel:D,rFormat:h,showGrid:B,oSort:f}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===p?()=>null:Ge(p)||$}),(k||S)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Je,{componentName:"BarChart",width:j,height:L},c.createElement(Ae,Object.assign({ref:i},q)))});function lt({isPushMode:t,colorBy:n,colorScheme:o,showLegend:i,legendPosition:r="right"}){const a=e.useRef(new Set),s=e.useRef([]),[l,c]=e.useState(0),u=e.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=e.useCallback(e=>{if(!t||!n)return;let o=!1;for(const t of e){if(!t||"object"!=typeof t)continue;const e=u(t);null==e||a.current.has(e)||(a.current.add(e),s.current.push(e),o=!0)}o&&c(e=>e+1)},[t,n,u]),h=e.useCallback(e=>t=>{d([t]),e(t)},[d]),g=e.useCallback(e=>t=>{d(t),e(t)},[d]),m=e.useCallback(()=>{a.current=new Set,s.current=[],c(e=>e+1)},[]),f=e.useMemo(()=>{if(!t||!n||!1===i)return;const e=s.current;if(0===e.length)return;const r=Array.isArray(o)?o:b,a=new Map;for(let t=0;e.length>t;t++)a.set(e[t],r[t%r.length]);const l="string"==typeof n?n:"__streamCat";return De({data:e.map(e=>({[l]:e})),colorBy:l,colorScale:e=>a.get(e)||"#999",getColor:w})},[t,n,i,o,l]),y=e.useMemo(()=>{if(f)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[f,r]);return{wrapPush:h,wrapPushMany:g,resetCategories:m,streamingLegend:f,streamingMarginAdjust:y}}st.displayName="BarChart";const ct=e.forwardRef(function(t,n){const o=We(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}),i=e.useRef(null),{data:r,margin:a,className:s,categoryAccessor:l="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:m,colorScheme:f="category10",normalize:y=!1,barPadding:p=40,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:S,onObservation:E,chartId:A,loading:M,emptyContent:O,legendInteraction:P,legendPosition:j}=t,L=o.width,C=o.height,B=o.enableHover,H=o.showGrid,_=o.showLegend,D=o.title,R=o.categoryLabel,N=o.valueLabel,I=r||[],z=m||u,W=lt({isPushMode:void 0===r,colorBy:z,colorScheme:f,showLegend:_,legendPosition:j}),$=e.useCallback(W.wrapPush(e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)}),[W.wrapPush]),T=e.useCallback(W.wrapPushMany(e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)}),[W.wrapPushMany]);e.useImperativeHandle(n,()=>({push:$,pushMany:T,clear:()=>{var e;W.resetCategories(),null===(e=i.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[$,T,W.resetCategories]);const q=at({data:I,rawData:r,colorBy:z,colorScheme:f,legendInteraction:P,legendPosition:j,selection:k,linkedHover:S,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:E,chartType:"StackedBarChart",chartId:A,showLegend:_,userMargin:a,marginDefaults:o.marginDefaults,loading:M,emptyContent:O,width:L,height:C});if(q.earlyReturn)return q.earlyReturn;const F=e.useMemo(()=>e=>z?q.colorScale?{fill:w(e,z,q.colorScale)}:{}:{fill:Ne},[z,q.colorScale]),G=e.useMemo(()=>Re(F,q.effectiveSelectionHook,k),[F,q.effectiveSelectionHook,k]),V=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),X=rt({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{stackBy:u}});if(X)return c.createElement(Qe,{componentName:"StackedBarChart",message:X,width:L,height:C});const Y=e.useMemo(()=>W.streamingLegend?Object.assign(Object.assign({},q.legendBehaviorProps),{legend:W.streamingLegend,legendPosition:j||q.legendPosition}):q.legendBehaviorProps,[q.legendBehaviorProps,q.legendPosition,W.streamingLegend,j]),Q=e.useMemo(()=>{if(W.streamingMarginAdjust){const e=Object.assign({},q.margin);for(const[t,n]of Object.entries(W.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return q.margin},[q.margin,W.streamingMarginAdjust]),K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=r&&{data:I}),{oAccessor:l,rAccessor:d,stackBy:u,normalize:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:G,size:[L,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,barPadding:p,enableHover:B,showAxes:o.showAxes,oLabel:R,rLabel:N,rFormat:g,showGrid:H}),Y),D&&{title:D}),s&&{className:s}),{tooltipContent:!1===v?()=>null:Ge(v)||V}),(S||E)&&{customHoverBehavior:q.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(Je,{componentName:"StackedBarChart",width:L,height:C},c.createElement(Ae,Object.assign({ref:i},K)))});ct.displayName="StackedBarChart";const ut=e.forwardRef(function(t,n){const o=We(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}),i=e.useRef(null),{data:r,margin:a,className:s,categoryAccessor:l="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:m,colorScheme:f="category10",barPadding:y=60,tooltip:p,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:S,chartId:E,loading:A,emptyContent:M,legendInteraction:O,legendPosition:P}=t,j=o.width,L=o.height,C=o.enableHover,B=o.showGrid,H=o.showLegend,_=o.title,D=o.categoryLabel,R=o.valueLabel,N=r||[],I=m||u,z=lt({isPushMode:void 0===r,colorBy:I,colorScheme:f,showLegend:H,legendPosition:P}),W=e.useCallback(z.wrapPush(e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)}),[z.wrapPush]),$=e.useCallback(z.wrapPushMany(e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)}),[z.wrapPushMany]);e.useImperativeHandle(n,()=>({push:W,pushMany:$,clear:()=>{var e;z.resetCategories(),null===(e=i.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[W,$,z.resetCategories]);const T=at({data:N,rawData:r,colorBy:I,colorScheme:f,legendInteraction:O,legendPosition:P,selection:x,linkedHover:k,fallbackFields:I?["string"==typeof I?I:""]:[],unwrapData:!0,onObservation:S,chartType:"GroupedBarChart",chartId:E,showLegend:H,userMargin:a,marginDefaults:o.marginDefaults,loading:A,emptyContent:M,width:j,height:L});if(T.earlyReturn)return T.earlyReturn;const q=e.useMemo(()=>e=>I?T.colorScale?{fill:w(e,I,T.colorScale)}:{}:{fill:Ne},[I,T.colorScale]),F=e.useMemo(()=>Re(q,T.effectiveSelectionHook,x),[q,T.effectiveSelectionHook,x]),G=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),V=rt({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{groupBy:u}});if(V)return c.createElement(Qe,{componentName:"GroupedBarChart",message:V,width:j,height:L});const X=e.useMemo(()=>z.streamingLegend?Object.assign(Object.assign({},T.legendBehaviorProps),{legend:z.streamingLegend,legendPosition:P||T.legendPosition}):T.legendBehaviorProps,[T.legendBehaviorProps,T.legendPosition,z.streamingLegend,P]),Y=e.useMemo(()=>{if(z.streamingMarginAdjust){const e=Object.assign({},T.margin);for(const[t,n]of Object.entries(z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return T.margin},[T.margin,z.streamingMarginAdjust]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=r&&{data:N}),{oAccessor:l,rAccessor:d,groupBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:F,size:[j,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y,barPadding:y,enableHover:C,showAxes:o.showAxes,oLabel:D,rLabel:R,rFormat:g,showGrid:B}),X),_&&{title:_}),s&&{className:s}),{tooltipContent:!1===p?()=>null:Ge(p)||G}),(k||S)&&{customHoverBehavior:T.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Je,{componentName:"GroupedBarChart",width:j,height:L},c.createElement(Ae,Object.assign({ref:i},Q)))});ut.displayName="GroupedBarChart";const dt=e.forwardRef(function(t,n){const o=We(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}),i=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:r,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:m="category10",sizeBy:f,sizeRange:y=[3,8],pointRadius:p=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:k,frameProps:S={},selection:E,linkedHover:A,onObservation:M,chartId:O,loading:P,emptyContent:j,legendInteraction:L,legendPosition:C}=t,B=o.width,H=o.height,_=o.enableHover,D=o.showGrid,R=o.title,N=o.categoryLabel,I=o.valueLabel,z=r||[],W=at({data:z,rawData:r,colorBy:g,colorScheme:m,legendInteraction:L,legendPosition:C,selection:E,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:M,chartType:"SwarmPlot",chartId:O,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:P,emptyContent:j,width:B,height:H});if(W.earlyReturn)return W.earlyReturn;const $=e.useMemo(()=>{if(!f)return;const e=z.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[z,f]),T=e.useMemo(()=>e=>{const t={fillOpacity:v};return t.fill=g?w(e,g,W.colorScale):Ne,t.r=f?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,[s,l]=n;return a===r?(s+l)/2:s+(i-r)/(a-r)*(l-s)}(e,f,y,$):p,t},[g,W.colorScale,f,y,$,p,v]),q=e.useMemo(()=>Re(T,W.effectiveSelectionHook,E),[T,W.effectiveSelectionHook,E]),F=e.useMemo(()=>Ye({categoryAccessor:l,valueAccessor:u,groupAccessor:g||void 0}),[l,u,g]),G=rt({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:l,valueAccessor:u}});if(G)return c.createElement(Qe,{componentName:"SwarmPlot",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:"swarm"},null!=r&&{data:z}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:q,size:[B,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,barPadding:b,enableHover:_,showAxes:o.showAxes,oLabel:N,rLabel:I,rFormat:h,showGrid:D}),W.legendBehaviorProps),R&&{title:R}),s&&{className:s}),{tooltipContent:!1===x?()=>null:Ge(x)||F}),(A||M)&&{customHoverBehavior:W.customHoverBehavior}),k&&k.length>0&&{annotations:k}),S);return c.createElement(Je,{componentName:"SwarmPlot",width:B,height:H},c.createElement(Ae,Object.assign({ref:i},V)))});dt.displayName="SwarmPlot";const ht=e.forwardRef(function(t,n){const o=We(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}),i=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:r,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:m="category10",showOutliers:f=!0,categoryPadding:y=20,tooltip:p,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:S,chartId:E,loading:A,emptyContent:M,legendInteraction:O,legendPosition:P}=t,j=o.width,L=o.height,C=o.enableHover,B=o.showGrid,H=o.title,_=o.categoryLabel,D=o.valueLabel,R=r||[],N=at({data:R,rawData:r,colorBy:g,colorScheme:m,legendInteraction:O,legendPosition:P,selection:x,linkedHover:k,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,chartType:"BoxPlot",chartId:E,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:A,emptyContent:M,width:j,height:L});if(N.earlyReturn)return N.earlyReturn;const I=e.useMemo(()=>e=>{const t=g?w(e,g,N.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.8}},[g,N.colorScale]),z=e.useMemo(()=>Re(I,N.effectiveSelectionHook,x),[I,N.effectiveSelectionHook,x]),W=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return c.createElement("div",{className:"semiotic-tooltip",style:$e},c.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(e.category||(e.data||e).category||"")+""),null!=t.median&&c.createElement(c.Fragment,null,null!=t.n&&c.createElement("div",null,"n = ",t.n),c.createElement("div",null,"Median: ",t.median.toLocaleString()),c.createElement("div",null,"Q1: ",t.q1.toLocaleString()),c.createElement("div",null,"Q3: ",t.q3.toLocaleString()),c.createElement("div",null,"Min: ",t.min.toLocaleString()),c.createElement("div",null,"Max: ",t.max.toLocaleString())))},[]),$=rt({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:l,valueAccessor:u}});if($)return c.createElement(Qe,{componentName:"BoxPlot",message:$,width:j,height:L});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=r&&{data:R}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:z,showOutliers:f,size:[j,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:y,enableHover:C,showAxes:o.showAxes,oLabel:_,rLabel:D,rFormat:h,showGrid:B}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===p?()=>null:Ge(p)||W}),(k||S)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Je,{componentName:"BoxPlot",width:j,height:L},c.createElement(Ae,Object.assign({ref:i},T)))});ht.displayName="BoxPlot";const gt=e.forwardRef(function(t,n){const o=We(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}),i=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:r,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:m,colorScheme:f="category10",categoryPadding:y=20,tooltip:p,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:S,chartId:E,loading:A,emptyContent:M,legendPosition:O}=t,P=o.width,j=o.height,L=o.enableHover,C=o.showGrid,B=o.title,H=o.categoryLabel,_=o.valueLabel,D=r||[],R=at({data:D,rawData:r,colorBy:m,colorScheme:f,legendInteraction:void 0,legendPosition:O,selection:x,linkedHover:k,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,chartType:"Histogram",chartId:E,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:A,emptyContent:M,width:P,height:j});if(R.earlyReturn)return R.earlyReturn;const N=e.useMemo(()=>e=>{const t=m?w(e,m,R.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.8}},[m,R.colorScale]),I=e.useMemo(()=>Re(N,R.activeSelectionHook,x),[N,R.activeSelectionHook,x]),z=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,i=t.range;return c.createElement("div",{className:"semiotic-tooltip",style:$e},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&c.createElement("div",null,"Count: ",o),i&&2===i.length&&c.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),W=rt({componentName:"Histogram",data:r,accessors:{categoryAccessor:l,valueAccessor:u}});if(W)return c.createElement(Qe,{componentName:"Histogram",message:W,width:P,height:j});const $=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=r&&{data:D}),{oAccessor:l,rAccessor:u,projection:"horizontal",summaryStyle:I,bins:d,normalize:h,size:[P,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:R.margin,barPadding:y,enableHover:L,showAxes:o.showAxes,oLabel:H,rLabel:_,rFormat:g,showGrid:C}),R.legendBehaviorProps),B&&{title:B}),s&&{className:s}),{tooltipContent:!1===p?()=>null:Ge(p)||z}),(k||S)&&{customHoverBehavior:R.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Je,{componentName:"Histogram",width:P,height:j},c.createElement(Ae,Object.assign({ref:i},$)))});gt.displayName="Histogram";const mt=e.forwardRef(function(t,n){const o=We(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}),i=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:r,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:m,colorBy:f,colorScheme:y="category10",categoryPadding:p=20,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:S,onObservation:E,chartId:A,loading:M,emptyContent:O,legendPosition:P}=t,j=o.width,L=o.height,C=o.enableHover,B=o.showGrid,H=o.title,_=o.categoryLabel,D=o.valueLabel,R=r||[],N=at({data:R,rawData:r,colorBy:f,colorScheme:y,legendInteraction:void 0,legendPosition:P,selection:k,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:E,chartType:"ViolinPlot",chartId:A,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:M,emptyContent:O,width:j,height:L});if(N.earlyReturn)return N.earlyReturn;const I=e.useMemo(()=>e=>{const t=f?w(e,f,N.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.6}},[f,N.colorScale]),z=e.useMemo(()=>Re(I,N.activeSelectionHook,k),[I,N.activeSelectionHook,k]),W=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;if(o)return c.createElement("div",{className:"semiotic-tooltip",style:$e},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(e.data)?e.data:[]).map(e=>{const t="function"==typeof u?u(e):e[u];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),r=i.length,a=r>0?i[Math.floor(r/2)]:null;return c.createElement("div",{className:"semiotic-tooltip",style:$e},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),r>0&&c.createElement("div",null,"n = ",r),null!=a&&c.createElement("div",null,"Median: ",a.toLocaleString()))},[u]),$=rt({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:l,valueAccessor:u}});if($)return c.createElement(Qe,{componentName:"ViolinPlot",message:$,width:j,height:L});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=r&&{data:R}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:z,bins:h,showIQR:g,size:[j,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:p,enableHover:C,showAxes:o.showAxes,oLabel:_,rLabel:D,rFormat:m,showGrid:B}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===v?()=>null:Ge(v)||W}),(S||E)&&{customHoverBehavior:N.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(Je,{componentName:"ViolinPlot",width:j,height:L},c.createElement(Ae,Object.assign({ref:i},T)))});mt.displayName="ViolinPlot";const ft=e.forwardRef(function(t,n){var o;const i=We(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:s,className:l,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:m,colorScheme:f="category10",sort:y=!0,dotRadius:p=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:k={},selection:S,linkedHover:E,onObservation:A,chartId:M,loading:O,emptyContent:P,legendInteraction:j,legendPosition:L}=t,C=i.width,B=i.height,H=i.enableHover,_=i.showGrid,D=i.title,R=i.categoryLabel,N=i.valueLabel,I=a||[],z=at({data:I,rawData:a,colorBy:m,colorScheme:f,legendInteraction:j,legendPosition:L,selection:S,linkedHover:E,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:A,chartType:"DotPlot",chartId:M,showLegend:i.showLegend,userMargin:s,marginDefaults:i.marginDefaults,loading:O,emptyContent:P,width:C,height:B});if(z.earlyReturn)return z.earlyReturn;const W=Ie(I,y,d),$=e.useMemo(()=>e=>{const t={r:p,fillOpacity:.8};return t.fill=m?w(e,m,z.colorScale):Ne,t},[m,z.colorScale,p]),T=e.useMemo(()=>Re($,z.effectiveSelectionHook,S),[$,z.effectiveSelectionHook,S]),q=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d}),[u,d]),F=rt({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(F)return c.createElement(Qe,{componentName:"DotPlot",message:F,width:C,height:B});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=a&&{data:W}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:T,size:[C,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,barPadding:v,enableHover:H,showAxes:i.showAxes,oLabel:R,rLabel:N,rFormat:g,showGrid:_,oSort:y}),z.legendBehaviorProps),D&&{title:D}),l&&{className:l}),{tooltipContent:!1===b?()=>null:Ge(b)||q}),(E||A)&&{customHoverBehavior:z.customHoverBehavior}),x&&x.length>0&&{annotations:x}),k);return c.createElement(Je,{componentName:"DotPlot",width:C,height:B},c.createElement(Ae,Object.assign({ref:r},G)))});ft.displayName="DotPlot";const yt=e.forwardRef(function(t,n){var o,i;const r=We(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(i=t.height)&&void 0!==i?i:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title}),a=e.useRef(null),{data:s,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:m="category10",startAngle:f=0,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:k,chartId:S,loading:E,emptyContent:A,legendInteraction:M,legendPosition:O}=t,P=r.width,j=r.height,L=r.enableHover,C=r.showLegend,B=r.title,H=s||[],_=g||d,D=lt({isPushMode:void 0===s,colorBy:_,colorScheme:m,showLegend:C,legendPosition:O}),R=e.useCallback(D.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[D.wrapPush]),N=e.useCallback(D.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[D.wrapPushMany]);e.useImperativeHandle(n,()=>({push:R,pushMany:N,clear:()=>{var e;D.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:[]}}),[R,N,D.resetCategories]);const I=at({data:H,rawData:s,colorBy:_,colorScheme:m,legendInteraction:M,legendPosition:O,selection:b,linkedHover:x,fallbackFields:_?["string"==typeof _?_:""]:[],unwrapData:!0,onObservation:k,chartType:"PieChart",chartId:S,showLegend:C,userMargin:l,marginDefaults:r.marginDefaults,loading:E,emptyContent:A,width:P,height:j});if(I.earlyReturn)return I.earlyReturn;const z=e.useMemo(()=>e=>_?I.colorScale?{fill:w(e,_,I.colorScale)}:{}:{fill:Ne},[_,I.colorScale]),W=e.useMemo(()=>Re(z,I.effectiveSelectionHook,b),[z,I.effectiveSelectionHook,b]),$=e.useMemo(()=>Ye({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),T=rt({componentName:"PieChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(T)return c.createElement(Qe,{componentName:"PieChart",message:T,width:P,height:j});const q=e.useMemo(()=>D.streamingLegend?Object.assign(Object.assign({},I.legendBehaviorProps),{legend:D.streamingLegend,legendPosition:O||I.legendPosition}):I.legendBehaviorProps,[I.legendBehaviorProps,I.legendPosition,D.streamingLegend,O]),F=e.useMemo(()=>{if(D.streamingMarginAdjust){const e=Object.assign({},I.margin);for(const[t,n]of Object.entries(D.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return I.margin},[I.margin,D.streamingMarginAdjust]),G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=s&&{data:H}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:W,startAngle:f,size:[P,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,enableHover:L,showAxes:!1}),q),B&&{title:B}),u&&{className:u}),{tooltipContent:!1===y?()=>null:Ge(y)||$}),(x||k)&&{customHoverBehavior:I.customHoverBehavior}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Je,{componentName:"PieChart",width:P,height:j},c.createElement(Ae,Object.assign({ref:a},G)))});yt.displayName="PieChart";const pt=e.forwardRef(function(t,n){var o,i;const r=We(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(i=t.height)&&void 0!==i?i:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover}),a=e.useRef(null),{data:s,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",innerRadius:g=60,centerContent:m,colorBy:f,colorScheme:y="category10",startAngle:p=0,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:S,onObservation:E,chartId:A,loading:M,emptyContent:O,legendInteraction:P,legendPosition:j}=t,L=r.width,C=r.height,B=r.enableHover,H=r.showLegend,_=r.title,D=s||[],R=f||d,N=lt({isPushMode:void 0===s,colorBy:R,colorScheme:y,showLegend:H,legendPosition:j}),I=e.useCallback(N.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[N.wrapPush]),z=e.useCallback(N.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[N.wrapPushMany]);e.useImperativeHandle(n,()=>({push:I,pushMany:z,clear:()=>{var e;N.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:[]}}),[I,z,N.resetCategories]);const W=at({data:D,rawData:s,colorBy:R,colorScheme:y,legendInteraction:P,legendPosition:j,selection:k,linkedHover:S,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:E,chartType:"DonutChart",chartId:A,showLegend:H,userMargin:l,marginDefaults:r.marginDefaults,loading:M,emptyContent:O,width:L,height:C});if(W.earlyReturn)return W.earlyReturn;const $=e.useMemo(()=>e=>R?W.colorScale?{fill:w(e,R,W.colorScale)}:{}:{fill:Ne},[R,W.colorScale]),T=e.useMemo(()=>Re($,W.effectiveSelectionHook,k),[$,W.effectiveSelectionHook,k]),q=e.useMemo(()=>Ye({categoryAccessor:d,valueAccessor:h,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,h,f]),F=rt({componentName:"DonutChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(F)return c.createElement(Qe,{componentName:"DonutChart",message:F,width:L,height:C});const G=e.useMemo(()=>N.streamingLegend?Object.assign(Object.assign({},W.legendBehaviorProps),{legend:N.streamingLegend,legendPosition:j||W.legendPosition}):W.legendBehaviorProps,[W.legendBehaviorProps,W.legendPosition,N.streamingLegend,j]),V=e.useMemo(()=>{if(N.streamingMarginAdjust){const e=Object.assign({},W.margin);for(const[t,n]of Object.entries(N.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return W.margin},[W.margin,N.streamingMarginAdjust]),X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:D}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:T,innerRadius:g,startAngle:p,centerContent:m,size:[L,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,enableHover:B,showAxes:!1}),G),_&&{title:_}),u&&{className:u}),{tooltipContent:!1===v?()=>null:Ge(v)||q}),(S||E)&&{customHoverBehavior:W.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(Je,{componentName:"DonutChart",width:L,height:C},c.createElement(Ae,Object.assign({ref:a},X)))});function vt(t){const n=We(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:a="category",valueAccessor:s="value",orientation:l="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:k,chartId:S,loading:E,emptyContent:A,legendPosition:M}=t,O=n.width,P=n.height,j=n.enableHover,L=n.showGrid,C=n.title,B=n.categoryLabel,H=n.valueLabel,_=o||[],D=at({data:_,rawData:o,colorBy:g,colorScheme:m,legendInteraction:void 0,legendPosition:M,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,chartType:"RidgelinePlot",chartId:S,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:E,emptyContent:A,width:O,height:P});if(D.earlyReturn)return D.earlyReturn;const R=e.useMemo(()=>e=>{const t=g?w(e,g,D.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.5}},[g,D.colorScale]),N=e.useMemo(()=>Re(R,D.activeSelectionHook,b),[R,D.activeSelectionHook,b]),I=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;return o?c.createElement("div",{className:"semiotic-tooltip",style:$e},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):c.createElement("div",{className:"semiotic-tooltip",style:$e},c.createElement("div",{style:{fontWeight:"bold"}},n+""))},[]),z=rt({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:a,valueAccessor:s}});if(z)return c.createElement(Qe,{componentName:"RidgelinePlot",message:z,width:O,height:P});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=o&&{data:_}),{oAccessor:a,rAccessor:s,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:N,bins:u,size:[O,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D.margin,barPadding:f,enableHover:j,showAxes:n.showAxes,oLabel:B,rLabel:H,rFormat:h,showGrid:L,oSort:!1,amplitude:d}),D.legendBehaviorProps),C&&{title:C}),r&&{className:r}),{tooltipContent:!1===y?()=>null:Ge(y)||I}),(x||k)&&{customHoverBehavior:D.customHoverBehavior}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Je,{componentName:"RidgelinePlot",width:O,height:P},c.createElement(Ae,Object.assign({},W)))}pt.displayName="DonutChart",vt.displayName="RidgelinePlot",exports.BarChart=st,exports.BoxPlot=ht,exports.DonutChart=pt,exports.DotPlot=ft,exports.GroupedBarChart=ut,exports.Histogram=gt,exports.PieChart=yt,exports.RidgelinePlot=vt,exports.StackedBarChart=ct,exports.StreamOrdinalFrame=Ae,exports.SwarmPlot=dt,exports.ViolinPlot=mt;
|