semiotic 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
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;
1
+ "use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-scale-chromatic"),o=require("d3-array"),r=require("d3-hierarchy"),i=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 y(e,t,n){return e+(t-e)*n}function p(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function m(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const f={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 A(e,n,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[n]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(r).range(o).unknown("#999");const a=f[o]||f.category10;if(i&&"function"==typeof a){let e=-1/0;for(const t of r){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(r).range(e).unknown("#999")}}function k(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function S(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function O(e){var t,n,r;const i=e.length,a=e[0],s=e[i-1];return{n:i,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!==(r=o.quantile(e,.75))&&void 0!==r?r:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}const j={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[i,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=s(c.pieces[0],a?i:e.name),p=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),a=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(k(e.x,n,e.width,Math.abs(a),y,p,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),a=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(k(n,e.x,Math.abs(a),e.width,y,p,i)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,l=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let i=0;d.length>i;i++){const h=l.get(d[i])||[];for(const l of h){const h=r(l),g=a(l,d[i]);if(u){const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(k(r,Math.min(a,u),o,Math.abs(a-u),g,l,d[i]))}else{const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(k(Math.min(a,u),r,Math.abs(u-a),o,g,l,d[i]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,y=s.length>0,p=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=y&&s[r]||c,f=l(t,e.name),v=f.r||5;let b,x;if(g){const t=m+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:f,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),y=c?a(s):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:S,donut:S,boxplot:function(e,t){var n,r,i,a,s;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:y}=l,p=[],m="vertical"===y,f=!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,y=null!==(r=o.quantile(t,.5))&&void 0!==r?r:(l+c)/2,v=null!==(i=o.quantile(t,.75))&&void 0!==i?i:c,b=v-u,x=u-1.5*b,w=v+1.5*b,A=null!==(a=t.find(e=>e>=x))&&void 0!==a?a:l,k=null!==(s=[...t].reverse().find(e=>w>=e))&&void 0!==s?s:c,S=h(e.pieceData[0],e.name),O=[];if(f)for(const t of e.pieceData){const n=d(t);if(x>n||n>w){const o=m?e.middle:g(n),r=m?g(n):e.middle;O.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:m?e.middle:0,y:m?0:e.middle,projection:m?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(A),q1Pos:g(u),medianPos:g(y),q3Pos:g(v),maxPos:g(k),stats:{n:t.length,min:A,q1:u,median:y,q3:v,max:k,mean:t.reduce((e,t)=>e+t,0)/t.length},style:S,datum:e.pieceData,category:e.name,outliers:O}),f)for(const e of O)p.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:S.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,r,i;const{scales:a,columns:s,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=a,g=[],y="vertical"===h,p=l.bins||20,m=!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)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-a)/l),p-1)]++;const f=Math.max(...h,1),v=e.width/2*.9;let b="";if(y){for(let t=0;p>t;t++){const n=d(a+(t+.5)*l),o=h[t]/f*v;b+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=p-1;t>=0;t--){const n=d(a+(t+.5)*l);b+=` L ${e.middle-h[t]/f*v} ${n}`}b+=" Z"}else{for(let t=0;p>t;t++){const n=d(a+(t+.5)*l),o=h[t]/f*v;b+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=p-1;t>=0;t--)b+=` L ${d(a+(t+.5)*l)} ${e.middle+h[t]/f*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(m&&t.length>=4){const l=null!==(n=o.quantile(t,.25))&&void 0!==n?n:a,c=null!==(r=o.quantile(t,.5))&&void 0!==r?r:(a+s)/2,u=null!==(i=o.quantile(t,.75))&&void 0!==i?i:s;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:y}}const A=y?{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:A,iqrLine:w,stats:O(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,a=s(n+t*o),c=s(n+(t+1)*o);l.push(k(Math.min(a,c),e.x+e.width-i,Math.abs(c-a),i,g,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),p=s(e.pieceData[0],e.name),m=e.width*g;let f="";if(h){const t=e.x+e.width;f=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)f+=` L ${l(o+(e+.5)*i)} ${t-c[e]/y*m}`;f+=` L ${l(r)} ${t} Z`}else{const t=e.x;f=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);f+=` L ${t+c[e]/y*m} ${n}`}f+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:f,translateX:0,translateY:0,bounds:v,stats:O(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(k(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(k(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class E{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=m(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>p(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new g)):(this.getR=p(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=m(e.stackBy),this.getGroup=m(e.groupBy),this.getColor=m(e.colorAccessor),this.getConnector=m(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 r=o.toArray(),i=n.projection||"vertical",a=n.oExtent||this.resolveCategories(r),s=this.computeValueDomain(r,a),l="horizontal"===i,c=null!=n.barPadding?n.barPadding/("vertical"===i?e.width:e.height):.1;let u,d;if("radial"===i){u=t.scaleBand().domain(a).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=n.innerRadius||0;d=t.scaleLinear().domain(s).range([r,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:i},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((r,i)=>{const a=this.rExtents[i];a.dirty&&a.recalculate(o,r);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=r;this.rAccessors.length>1&&(h=r.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,a,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=[];for(const e of t)n.has(e)?o.push(e):this.categories.delete(e);return o}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let a=0,s=0;if("bar"===r&&this.getStack&&this.config.normalize)a=0,s=1;else if("bar"===r&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>s&&(s=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===r){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(a-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(s+=c),"bar"!==r&&"clusterbar"!==r||(a>0&&(a=0),0>s&&(s=0)),[a,s]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=j[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme: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,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;let o=0;for(let n=0;t.length>n;n++){const r=t[n],s=this.config.oAccessor;if(("function"==typeof s?s(r):r[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let g=!1;const y=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,p);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(y.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(y.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)y.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=y(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=y(o.x,e._targetX,i),e.y=y(o.y,e._targetY,i)}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=y(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=y(n.x,e._targetX,i),e.y=y(n.y,e._targetY,i),void 0!==n.w&&(e.w=y(n.w,e._targetW,i),e.h=y(n.h,e._targetH,i))}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function M(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function P(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 C(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function L(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=M(Math.atan2(r,o)),s=M(e.startAngle),l=M(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 r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function H(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}const R={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 r;return r="function"==typeof n?n(e):(0,R[n])(o(e,t)),r}function _(){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 $({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,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(r[0]+t*(r[1]-r[0]))}))}return c.createElement("g",{"aria-label":i||"Gradient legend"},c.createElement("defs",null,c.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),i&&c.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),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(r[0])),c.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[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(r[1]-t*(r[1]-r[0]))}))}return c.createElement("g",{"aria-label":i||"Gradient legend"},i&&c.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),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(r[1])),c.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function z(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:u=20,orientation:d="vertical"}=e,[h,g]=c.useState(0),[y,p]=c.useState(0),m=c.useCallback((e,t)=>{g(e),p(t)},[]),f="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,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,r,i,a,s,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,y=[];let p=0;const m=!(!t&&!n),f="isolate"===u||void 0===u&&null!=r;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?s===i&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&f?x||!1:void 0,"aria-current":m&&!f&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?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:m?t=>{l(s,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},m&&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(_,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),p+=22}),y})(e,n,o,r,i,a,s,g,l,u))),d+=22*e.items.length+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,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 y=((e,t,n,o,r,i,a,s,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,y=[];let p=0;const m=!(!t&&!n),f="isolate"===u||void 0===u&&null!=r;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(${p},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?s===i&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&f?x||!1:void 0,"aria-current":m&&!f&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?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:m?t=>{l(s,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},m&&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(_,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),p+=26+7*e.label.length}),{items:y,offset:p}})(e,o,r,i,a,s,l,t,u,d);n+=y.offset+5,g.push(Object.assign(Object.assign({label:e.label},y),{offset:n})),h+=n+12});let y=Math.max(0,(n-h)/2);const p=[];return g.forEach((n,o)=>{const r=e[o];r.label&&(p.push(c.createElement("text",{key:"legend-text-"+o,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),y+=16),p.push(c.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${y},0)`},n.items)),y+=n.offset+5,e[o+1]&&p.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:y,y1:-8,x2:y,y2:t+0+8})),y+=12}),c.createElement("g",null,p)})({legendGroups:t||[],title:s,height:u,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:a}),v=!(!n&&!o);return c.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||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),f)}function I(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function W(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:r,nx:i,ny:a,note:s,connector:l,subject:u,type:d,color:h,className:g,disable:y,events:p={},"data-testid":m}=e,f=new Set(Array.isArray(y)?y:[]);let v=o||0,b=r||0;null!=i&&(v=i-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":m},p),!f.has("connector")&&function(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;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=r+a*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);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,r=16/180*Math.PI,i=Math.atan2(t-l,e-s);a.push(c.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${s+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"currentColor",stroke:"none"}))}return c.createElement("g",{className:"annotation-connector"},a)}(v,b,l,h,x,u),!f.has("subject")&&function(e,t,n,o,r){var i;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,i=r||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)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;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)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(c.createElement("path",{key:"bracket-path",d:W((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),!f.has("note")&&function(e,t,n,o){if(!e)return c.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:u}=e;if(!r&&!i)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 y=16,p=i?u?[i]:I(i,l):[],m=r?u?[r]:I(r,l):[],f="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];p.length>0&&(b.push(c.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},p.map((e,t)=>c.createElement("tspan",{key:t,x:f,dy:0===t?0:y},e)))),v=p.length*y),m.length>0&&b.push(c.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},m.map((e,t)=>c.createElement("tspan",{key:t,x:f,dy:0===t?0:y},e))));let x=null;if((i||r)&&(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=(p.length+m.length)*y+(m.length>0?y: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,p.length+m.length-1)*y;let A=0;return"topBottom"===d?A=0>n?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+y+(m.length>0&&p.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!==A?`translate(0,${A})`:void 0},b),x)}(s,v,b,h))}function q(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=r.map((t,n)=>{const r=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},r,{type:i}))});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:i}))}const F={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};function G(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function V(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function X(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=G(e,n),c=V(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function 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:r,totalHeight:i,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),y=e.useMemo(()=>!s||h?[]:s.r.ticks(5).map(e=>({value:e,pixel:s.r(e),label:(d||K)(e)})),[s,d,h]),p=u&&s&&!h,m=l&&s&&!h;return p||m?c.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},c.createElement("g",{transform:`translate(${a.left},${a.top})`},p&&c.createElement("g",{className:"ordinal-grid"},y.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}))),m&&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:y,oLabel:p,rLabel:m,oFormat:f,rFormat:v,showGrid:b,title:x,legend:w,legendHoverBehavior:A,legendClickBehavior:k,legendHighlightedCategory:S,legendIsolatedCategories:O,legendPosition:j="right",foregroundGraphics:E,annotations:M,svgAnnotationRules:P,xAccessor:C,yAccessor:L,annotationData:B,underlayRendered:H,children:R}=t,D="radial"===(null==g?void 0:g.projection),_="horizontal"===(null==g?void 0:g.projection),N=e.useMemo(()=>y&&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:f?f(e):e}}):[],[y,g,f,D]),I=e.useMemo(()=>y&&g&&!D?g.r.ticks(5).map(e=>({value:e,pixel:g.r(e),label:(v||K)(e)})):[],[y,g,v,D]),W=e.useRef(new Map),T=e.useRef(null!==(n=null==M?void 0:M.length)&&void 0!==n?n:0),Q=null!==(o=null==M?void 0:M.length)&&void 0!==o?o:0;T.current!==Q&&(T.current=Q,W.current=new Map);const Z=e.useMemo(()=>{if(!M||0===M.length)return null;const e=function(e,t,n){var o,a,s,l,d,h,g,y,p,m,f,v,b,x,w,A,k,S,O,j,E,M,P,C,L,B,H,R,D,_,N,$,z,I,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:r,y:i}=o;return Y(r,i,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=X(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Y(r,i,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=G(e,n);if(null==o)return null;const r=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:o+4,y:12,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=V(e,n);if(null==o)return null;const r=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:r,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 i=r.packEnclose(o),a=e.padding||10;return c.createElement("g",{key:"ann-"+t},c.createElement("circle",{cx:i.x,cy:i.y,r:i.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:i.x,y:i.y-i.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 r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...i)-r,l=Math.max(...i)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;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||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return c.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=G(t,n),a=V(t,n);return null==r||null==a?null:c.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:e.r||6},i))}))}case"bracket":{const o=G(e,n),r=V(e,n);return c.createElement(q,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",y=n.yAccessor||"y",p=r.map(e=>[e[i],e[y]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const m=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,f=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(!m||!f)return null;const v=e.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*y-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(p,null!==(g=e.bandwidth)&&void 0!==g?g:.3):("polynomial"===v?u.default.polynomial(p,{order:e.order||2}):u.default.linear(p)).points;const x=b.map(([e,t])=>`${m(e)},${f(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:m(b[b.length-1][0])+4,y:f(b[b.length-1][1])-4,fill:w,fontSize:11},e.label))}case"band":{const o=null!==(p=null===(y=n.scales)||void 0===y?void 0:y.y)&&void 0!==p?p:null===(m=n.scales)||void 0===m?void 0:m.value,r=null!==(f=null==o?void 0:o(e.y0))&&void 0!==f?f:0,i=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(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=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!==(k=null===(A=n.scales)||void 0===A?void 0:A.y)&&void 0!==k?k:null===(S=n.scales)||void 0===S?void 0:S.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[r]-t[r]);if(2>h.length)return null;const g=F[n.curve||"linear"]||i.curveLinear,y=i.area().x(e=>a(e[r])).y0(e=>s(e[u])).y1(e=>s(e[l])).curve(g)(h);if(!y)return null;const p=e.fill||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:y,fill:p,fillOpacity:null!==(O=e.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),e.label&&h.length>0&&c.createElement("text",{x:a(h[h.length-1][r])+4,y:s(h[h.length-1][l])-4,fill:p,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(E=null===(j=n.scales)||void 0===j?void 0:j.x)&&void 0!==E?E:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==(C=null===(P=n.scales)||void 0===P?void 0:P.y)&&void 0!==C?C:null===(L=n.scales)||void 0===L?void 0:L.value;if(!i||!a)return null;const s=o.map(e=>e[r]).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,y=!1!==e.showBand,p=e.fill||"#6366f1",m=null!==(H=e.fillOpacity)&&void 0!==H?H:.1,f=e.anomalyColor||"#ef4444",v=null!==(R=e.anomalyRadius)&&void 0!==R?R:6,b=a(l+h*d),x=a(g),w=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*d});return c.createElement("g",{key:"ann-"+t},y&&c.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:m}),w.map((e,t)=>{const o=G(e,n),r=V(e,n);return null==o||null==r?null:c.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:v,fill:f,fillOpacity:.7,stroke:f,strokeWidth:1.5})}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(_=null===(D=n.scales)||void 0===D?void 0:D.x)&&void 0!==_?_:null===(N=n.scales)||void 0===N?void 0:N.time,s=null!==(z=null===($=n.scales)||void 0===$?void 0:$.y)&&void 0!==z?z:null===(I=n.scales)||void 0===I?void 0:I.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let 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,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,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),y=Math.sqrt(g/Math.max(h-2,1)),p=l.reduce((e,t)=>e+t[0],0)/h,m=l.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(W=e.confidence)&&void 0!==W?W:.95,v=.99>f?.95>f?.9>f?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),A=[];for(let e=1;b>=e;e++)A.push(x+e*w);const k=[];for(const e of A){const t=d(e),n=y*Math.sqrt(1+1/h+(m>0?Math.pow(e-p,2)/m:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),j=`${a(x)},${s(d(x))}`,E=e.strokeColor||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:null!==(Q=e.fillOpacity)&&void 0!==Q?Q:.15,stroke:"none"}),c.createElement("polyline",{points:`${j} ${O}`,fill:"none",stroke:E,strokeWidth:null!==(K=e.strokeWidth)&&void 0!==K?K:2,strokeDasharray:null!==(Z=e.strokeDasharray)&&void 0!==Z?Z:"6,3"}),e.label&&k.length>0&&c.createElement("text",{x:a(k[k.length-1].x)+4,y:s(k[k.length-1].yCenter)-4,fill:E,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=X(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!Y(o,r,n))return null;const i=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+i-s/2,y:r+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:r,y:i}=o;return c.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}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:C,yAccessor:L,width:a,height:s,data:B,frameType:"ordinal",stickyPositionCache:W.current};return M.map((t,n)=>{if(P){const r=P(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[M,P,a,s,g,C,L,B]);return y||x||w||E||Z&&Z.length>0||b||R?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"},I.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:_?e.pixel:0,y1:_?0:e.pixel,x2:_?e.pixel:a,y2:_?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),y&&g&&!D&&c.createElement("g",{className:"ordinal-axes"},_?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))),p&&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"}},p),!H&&c.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.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))),m&&c.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},m)):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))),p&&c.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p),!H&&c.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.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))),m&&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"}},m))),Z,E,R),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:r,legendPosition:i="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const g="top"===i||"bottom"===i;let y,p;return"left"===i?(y=4,p=r.top):"top"===i?(y=0,p=a?32:8):"bottom"===i?(y=0,p=o-r.bottom+50):(y=n-r.right+10,p=r.top),c.createElement("g",{transform:`translate(${y}, ${p})`},"object"==typeof(m=t)&&null!==m&&"gradient"in m?c.createElement($,{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 m}({legend:w,totalWidth:l,totalHeight:d,margin:h,legendPosition:j,title:x,legendHoverBehavior:A,legendClickBehavior:k,legendHighlightedCategory:S,legendIsolatedCategories:O})):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=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks"},i=["point","line","area","rect","heatcell","circle","candlestick"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function te({scene:e,chartType:t}){var n,o,r,i;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!==(r=null===(o=t.datum)||void 0===o?void 0:o.value)&&void 0!==r?r: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!==(i=t.value)&&void 0!==i?i: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=re(t);return[function({children:o}){const r=e.useMemo(()=>re(t),[]);return c.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(i.getState()),[i]),l=e.useCallback(()=>a.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,s,l)}]}function re(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const ie={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:ie,setTheme(t){e(e=>"light"===t?{theme:ie}:"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,r,i,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!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function 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 r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?ye(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 ye(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}const pe=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),de(e,t),e.globalAlpha=1}}finally{e.restore()}};function me(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 fe=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)me(e,t),e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(me(e,t),he(e,t)),e.globalAlpha=1},ve=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},be=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},xe=e=>[be,...e],we={bar:xe([ge]),clusterbar:xe([ge]),point:xe([pe]),swarm:xe([pe]),pie:[fe],donut:[fe],boxplot:xe([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},pe]),violin:xe([ve]),histogram:xe([ge]),ridgeline:xe([ve]),timeline:xe([ge])},Ae={top:50,right:40,bottom:60,left:70},ke={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 Se({hover:e}){var t,n,o,r,i,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:ke},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:ke},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:ke},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:ke},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}const y=(d&&null!=s[d]?s[d]:null)||s.category||s.name||s.group||s.__rName||"",p=null!==(a=null!==(i=null!==(r=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!==r?r:s.__rValue)&&void 0!==i?i:s.pct)&&void 0!==a?a:"";if(!y&&""===p){const e=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:ke},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:ke},y&&c.createElement("div",{style:{fontWeight:"bold"}},y+""),""!==p&&c.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const Oe=e.forwardRef(function(t,n){var o,r,a,s,l,u,h;const{chartType:g,runtimeMode:y,data:p,oAccessor:m="category",rAccessor:f="value",colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:A,valueAccessor:k,categoryAccessor:S,projection:O="vertical",size:j=[600,400],responsiveWidth:M,responsiveHeight:R,margin:D,barPadding:_,innerRadius:N,normalize:$,startAngle:z,dynamicColumnWidth:I,bins:W,showOutliers:T,showIQR:q,amplitude:F,connectorAccessor:G,connectorStyle:V,rExtent:X,oExtent:Y,extentPadding:K=.05,oSort:J,windowMode:oe="sliding",windowSize:re=200,pieceStyle:ie,summaryStyle:ae,colorScheme:se,barColors:ce,showAxes:ue=!0,oLabel:de,rLabel:he,oFormat:ge,rFormat:ye,enableHover:pe=!0,hoverAnnotation:me,tooltipContent:fe,customHoverBehavior:ve,annotations:be,svgAnnotationRules:xe,showGrid:ke=!1,legend:Oe,legendHoverBehavior:je,legendClickBehavior:Ee,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:Ce,backgroundGraphics:Le,foregroundGraphics:Be,title:He,className:Re,background:De,centerContent:_e,decay:Ne,pulse:$e,transition:ze,staleness:Ie,accessibleTable:We}=t,[Te,qe]=function(t,n,o){const r=e.useRef(null),[i,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(j,M,R),Fe=e.useMemo(()=>Object.assign(Object.assign({},Ae),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),[rt,it]=e.useState(0),[at,st]=e.useState(!1),lt=pe||me,ct="streaming"===y,ut=e.useMemo(()=>({chartType:g,runtimeMode:ct?"streaming":"bounded",windowSize:re,windowMode:oe,extentPadding:K,projection:O,oAccessor:ct?void 0:m,rAccessor:ct?void 0:f,colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:ct?A:void 0,valueAccessor:ct?k||("string"==typeof f||"function"==typeof f?f:void 0):void 0,categoryAccessor:ct?S||m:void 0,rExtent:X,oExtent:Y,barPadding:_,innerRadius:N,normalize:$,startAngle:z,dynamicColumnWidth:I,bins:W,showOutliers:T,showIQR:q,amplitude:F,connectorAccessor:G,connectorStyle:V,oSort:J,pieceStyle:ie,summaryStyle:ae,colorScheme:se,barColors:ce,decay:Ne,pulse:$e,transition:ze,staleness:Ie}),[g,re,oe,K,O,m,f,v,b,x,w,A,k,S,X,Y,_,N,$,z,I,W,T,q,F,G,V,J,ie,ae,se,ce,Ne,$e,ze,Ie,ct]),dt=e.useRef(null);dt.current||(dt.current=new E(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 yt=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.push(e)},[]),pt=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.pushMany(e)},[]),mt=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:yt,pushMany:pt,clear:mt,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}}),[yt,pt,mt]),e.useEffect(()=>{var e;p&&(null===(e=gt.current)||void 0===e||e.setBoundedData(p))},[p]);const ft=e.useRef(()=>{}),vt=e.useRef(()=>{});ft.current=e=>{if(!lt)return;const t=Ye.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Fe.left,r=e.clientY-n.top-Fe.top;if(0>o||o>Ge||0>r||r>Ve)return void(Ue.current&&(Ue.current=null,tt(null),ve&&ve(null),ht()));const i=dt.current;if(!i||0===i.scene.length)return;const a="radial"===O,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=P(i,t,n);break;case"point":e=C(i,t,n);break;case"wedge":e=L(i,t,n);break;case"boxplot":e=B(i,t,n);break;case"violin":e=H(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-Ge/2:o,a?r-Ve/2:r);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 m?m:void 0,__rAccessor:"string"==typeof f?f: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=>ft.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,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return xt.current=-1,Ue.current=null,tt(null),ve&&ve(null),void ht();const i=0>o?0:r;xt.current=i;const a=Object.assign(Object.assign({},function(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}(n[i])),{__oAccessor:"string"==typeof m?m:void 0,__rAccessor:"string"==typeof f?f:void 0,__chartType:g});Ue.current=a,tt(a),ve&&ve(a),ht()},[ve,ht]),At=e.useCallback(e=>{xt.current=-1,ft.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 r=dt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=Qe.current;s&&!a&&(r.computeScene({width:Ge,height:Ve}),Qe.current=!1),(s||a)&&n.setAttribute("aria-label",ee(r.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==Ie?void 0:Ie.threshold)&&void 0!==e?e:5e3,h=Ie&&r.lastIngestTime>0&&i-r.lastIngestTime>d;h&&(o.globalAlpha=null!==(t=null==Ie?void 0:Ie.dimOpacity)&&void 0!==t?t:.5);const y=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",p=De||(y&&"transparent"!==y?y:null);p&&(o.fillStyle=p,o.fillRect(0,0,qe[0],qe[1]));const m="radial"===O;m?(o.save(),o.translate(Fe.left+Ge/2,Fe.top+Ve/2)):o.translate(Fe.left,Fe.top);const f=we[g]||[],v={width:Ge,height:Ve};for(const e of f)e(o,r.scene,r.scales,v);m&&o.restore(),h&&(o.globalAlpha=1),s&&r.scales&&(ot(r.scales),it(e=>e+1)),(null==Ie?void 0:Ie.showBadge)&&st(!!h),(a||r.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,r,i,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!==i&&(a(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(Ie,dt,Qe,ht,at,st);const kt=lt&&et?fe?fe(et):c.createElement(Se,{hover:et}):null,St="radial"===O,Ot=et?St?et.x+Ge/2:et.x:0,jt=et?St?et.y+Ve/2:et.y:0,Et=kt?c.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Fe.left+Ot,top:Fe.top+jt,transform:`translate(${Ot>.7*Ge?"calc(-100% - 12px)":"12px"}, ${.3*Ve>jt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},kt):null;if(U){const e=dt.current;e&&p&&(e.ingest({inserts:p,bounded:!0}),e.computeScene({width:Ge,height:Ve}));const t=null!==(o=null==e?void 0:e.scene)&&void 0!==o?o:[],n=null!==(r=null==e?void 0:e.scales)&&void 0!==r?r:null,a="radial"===O,s=a?Fe.left+Ge/2:Fe.left,l=a?Fe.top+Ve/2:Fe.top;return c.createElement("div",{className:"stream-ordinal-frame"+(Re?" "+Re:""),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}},Le&&c.createElement("g",{transform:`translate(${Fe.left},${Fe.top})`},Le),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,r,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=i.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!==(r=t.style.fillOpacity)&&void 0!==r?r:.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,r=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:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:u("med"),cx:t.iqrLine.medianPos,cy:r,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:ye,showGrid:ke,title:He,legend:Oe,legendHoverBehavior:je,legendClickBehavior:Ee,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:Ce,foregroundGraphics:Xe,annotations:be,svgAnnotationRules:xe,annotationFrame:0,xAccessor:"string"==typeof m?m:void 0,yAccessor:"string"==typeof f?f:void 0,annotationData:null==e?void 0:e.getData()}),_e&&"radial"===O&&c.createElement("div",{style:{position:"absolute",left:Fe.left+Ge/2,top:Fe.top+Ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},_e))}return c.createElement("div",{ref:Te,className:"stream-ordinal-frame"+(Re?" "+Re:""),role:"img","aria-label":"string"==typeof He?He:"Ordinal chart",tabIndex:0,style:{position:"relative",width:M?"100%":qe[0],height:R?"100%":qe[1],overflow:"visible"},onMouseMove:lt?At:void 0,onMouseLeave:lt?bt:void 0,onKeyDown:wt},Le&&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})`},Le)),c.createElement(Q,{width:Ge,height:Ve,totalWidth:qe[0],totalHeight:qe[1],margin:Fe,scales:nt,showAxes:ue,showGrid:ke,rFormat:ye}),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}),We&&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:ye,showGrid:ke,title:He,legend:Oe,legendHoverBehavior:je,legendClickBehavior:Ee,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:Ce,foregroundGraphics:Xe,annotations:be,svgAnnotationRules:xe,annotationFrame:rt,xAccessor:"string"==typeof m?m:void 0,yAccessor:"string"==typeof f?f:void 0,annotationData:null===(h=dt.current)||void 0===h?void 0:h.getData(),underlayRendered:!0}),_e&&"radial"===O&&c.createElement("div",{style:{position:"absolute",left:Fe.left+Ge/2,top:Fe.top+Ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},_e),(null==Ie?void 0:Ie.showBadge)&&c.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ie.badgePosition?{top:4,left:4}:"bottom-left"===Ie.badgePosition?{bottom:4,left:4}:"bottom-right"===Ie.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"),Et)});Oe.displayName="StreamOrdinalFrame";const je=e.createContext(null);function Ee(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Me(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Pe,Ce]=oe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Me(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Me(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Le,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:r}=t,i=Ce(e=>e.selections.get(r)),a=Ce(e=>e.setClause),s=Ce(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Ee(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:e.useCallback(()=>{s(r,o)},[s,r,o]),clientId:o}}const Re=e.createContext(!1);function De({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}}),label:""}]}}function _e(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const Ne="#007bff";function $e(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const r="function"==typeof(i=o)?i:e=>e[i];var i;return e.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[t,n,o])}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 Ie(e,t,n){var o,r,i,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!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const We={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:r={},className:i=""}=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,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=Te(e,r);s.push({label:n,value:qe(a,i)})});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({},We),r);return c.createElement("div",{className:("semiotic-tooltip "+i).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:We},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:r=!1}){return i=>{var a;const s=r?(null===(a=i.data)||void 0===a?void 0:a[0])||i.data||i:i.data||i,l=Xe(s,e),u=Xe(s,t),d=n?Xe(s,n):void 0;return c.createElement("div",{className:"semiotic-tooltip",style:We},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,diagnosticHint:n,width:o,height:r}){return c.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},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),n&&c.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class 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}}function Ze(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ue(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ze(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Je(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function et(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=Ue(e,t,3))&&void 0!==n?n:null)}function tt({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=Je(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=et(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const nt={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},frameProps:{type:"object"}},ot={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},rt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},it=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],at=["vertical","horizontal"],st={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:it},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:it},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:it},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},nt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},nt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},nt),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},nt),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:at},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},nt),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},nt),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},nt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},nt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},nt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function lt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ct=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),ut=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),dt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ht=new Set(["LineChart","AreaChart","StackedAreaChart"]),gt=new Set(["BarChart","StackedBarChart","GroupedBarChart"]);function yt(e,t){const n=[],o=function(e,t){const n=[],o=st[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(st).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!lt(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Ue(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=tt({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=Je(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=et(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return st[e]?(function(e,t,n){const o=st[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=st[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){ct.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){ut.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=st[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!dt.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!ht.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=st[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!gt.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var pt;const mt="undefined"!=typeof process&&"production"!==(null===(pt=process.env)||void 0===pt?void 0:pt.NODE_ENV);function ft({componentName:e,width:t,height:n,chartProps:o,children:r}){return c.createElement(Ke,{fallback:r=>{let i="";if(mt&&o)try{const t=yt(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return c.createElement(Qe,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const vt={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},bt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function xt(e,t,n,o){if(!mt)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function wt(t){const{data:n,rawData:o,colorBy:r,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:y,chartId:p,showLegend:m,userMargin:f,marginDefaults:v,loading:b,emptyContent:x,width:k,height:S}=t,{activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:E}=function({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,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:r,isActive:i,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:r,isActive:i}}({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(i||d){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),d&&d(e)}}},[n,u,i,a,s,d]),y=e.useCallback(e=>{var t,n;if(i||d){const o={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),d&&d(e)}}},[i,d,a,s]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:y}}({selection:l,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:y,chartId:p}),M=function(t,n,o="category10"){const r=e.useContext(je);return e.useMemo(()=>{if(n){if(0===t.length)return r&&Object.keys(r).length>0?e=>r[e]||"#999":void 0;if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));return r&&Object.keys(r).length>0?e=>r[e]||"#999":A(e.map(e=>({_cat:e})),"_cat",o)}if(r&&Object.keys(r).length>0){const e=A(t,n,o);return t=>r[t]||e(t)}return A(t,n,o)}},[t,n,o,r])}(n,r,i),P=e.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of n){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[n,r]),C=function(t,n,o){const[r,i]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(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!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"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,r,a]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,r,P),L=e.useMemo(()=>C.legendSelectionHook?C.legendSelectionHook:O,[C.legendSelectionHook,O]),{legend:B,margin:H,legendPosition:R}=function({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40}}){const l=e.useContext(Re),c=void 0!==r?r:!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"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,u,i]);return{legend:u,margin:d,legendPosition:i}}({data:n,colorBy:r,colorScale:M,showLegend:m,legendPosition:s,userMargin:f,defaults:v}),D=e.useMemo(()=>{const e={};return B&&(e.legend=B,e.legendPosition=R),a&&"none"!==a&&(e.legendHoverBehavior=C.onLegendHover,e.legendClickBehavior=C.onLegendClick,e.legendHighlightedCategory=C.highlightedCategory,e.legendIsolatedCategories=C.isolatedCategories),e},[B,R,a,C.onLegendHover,C.onLegendClick,C.highlightedCategory,C.isolatedCategories]),_=function(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(r+i)-i))/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({},bt),{position:"absolute",top:a+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}(b,k,S),N=_?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({},vt),{width:t,height:n})},o||"No data available"):null}(o,k,S,x);return{colorScale:M,allCategories:P,legendState:C,effectiveSelectionHook:L,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:E,legend:B,margin:H,legendPosition:R,earlyReturn:_||N||null,legendBehaviorProps:D}}const At=e.forwardRef(function(t,n){const o=Ie(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}),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:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",sort:p=!1,barPadding:m=40,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.title,R=o.categoryLabel,D=o.valueLabel,_=i||[],N=wt({data:_,rawData:i,colorBy:g,colorScheme:y,legendInteraction:E,legendPosition:M,selection:x,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,chartType:"BarChart",chartId:S,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:C});if(N.earlyReturn)return N.earlyReturn;xt("BarChart",_,"categoryAccessor",l),xt("BarChart",_,"valueAccessor",u);const $=$e(_,p,u),z=e.useMemo(()=>e=>{const t={};return t.fill=g?w(e,g,N.colorScale):Ne,t},[g,N.colorScale]),I=e.useMemo(()=>_e(z,N.effectiveSelectionHook,x),[z,N.effectiveSelectionHook,x]),W=e.useMemo(()=>Ye({categoryAccessor:l,valueAccessor:u,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group"}),[l,u,g]),T=tt({componentName:"BarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(T)return c.createElement(Qe,{componentName:"BarChart",message:T,width:P,height:C});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:$}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:I,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:m,enableHover:L,showAxes:o.showAxes,oLabel:R,rLabel:D,rFormat:h,showGrid:B,oSort:p}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||W}),(A||k)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"BarChart",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},q)))});function kt({isPushMode:t,colorBy:n,colorScheme:o,showLegend:r,legendPosition:i="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]),y=e.useCallback(()=>{a.current=new Set,s.current=[],c(e=>e+1)},[]),p=e.useMemo(()=>{if(!t||!n||!1===r)return;const e=s.current;if(0===e.length)return;const i=Array.isArray(o)?o:b,a=new Map;for(let t=0;e.length>t;t++)a.set(e[t],i[t%i.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,r,o,l]),m=e.useMemo(()=>{if(p)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[p,i]);return{wrapPush:h,wrapPushMany:g,resetCategories:y,streamingLegend:p,streamingMarginAdjust:m}}At.displayName="BarChart";const St=e.forwardRef(function(t,n){const o=Ie(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}),r=e.useRef(null),{data:i,margin:a,className:s,categoryAccessor:l="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:y,colorScheme:p="category10",normalize:m=!1,barPadding:f=40,tooltip:v,annotations:b,frameProps:x={},selection:A,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendInteraction:M,legendPosition:P}=t,C=o.width,L=o.height,B=o.enableHover,H=o.showGrid,R=o.showLegend,D=o.title,_=o.categoryLabel,N=o.valueLabel,$=i||[],z=y||u,I=kt({isPushMode:void 0===i,colorBy:z,colorScheme:p,showLegend:R,legendPosition:P}),W=e.useCallback(I.wrapPush(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)}),[I.wrapPush]),T=e.useCallback(I.wrapPushMany(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)}),[I.wrapPushMany]);e.useImperativeHandle(n,()=>({push:W,pushMany:T,clear:()=>{var e;I.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[W,T,I.resetCategories]);const q=wt({data:$,rawData:i,colorBy:z,colorScheme:p,legendInteraction:M,legendPosition:P,selection:A,linkedHover:k,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:S,chartType:"StackedBarChart",chartId:O,showLegend:R,userMargin:a,marginDefaults:o.marginDefaults,loading:j,emptyContent:E,width:C,height:L});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(()=>_e(F,q.effectiveSelectionHook,A),[F,q.effectiveSelectionHook,A]),V=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),X=tt({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{stackBy:u}});if(X)return c.createElement(Qe,{componentName:"StackedBarChart",message:X,width:C,height:L});const Y=e.useMemo(()=>I.streamingLegend?Object.assign(Object.assign({},q.legendBehaviorProps),{legend:I.streamingLegend,legendPosition:P||q.legendPosition}):q.legendBehaviorProps,[q.legendBehaviorProps,q.legendPosition,I.streamingLegend,P]),Q=e.useMemo(()=>{if(I.streamingMarginAdjust){const e=Object.assign({},q.margin);for(const[t,n]of Object.entries(I.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return q.margin},[q.margin,I.streamingMarginAdjust]),K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:$}),{oAccessor:l,rAccessor:d,stackBy:u,normalize:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:G,size:[C,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,barPadding:f,enableHover:B,showAxes:o.showAxes,oLabel:_,rLabel:N,rFormat:g,showGrid:H}),Y),D&&{title:D}),s&&{className:s}),{tooltipContent:!1===v?()=>null:Ge(v)||V}),(k||S)&&{customHoverBehavior:q.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(ft,{componentName:"StackedBarChart",width:C,height:L},c.createElement(Oe,Object.assign({ref:r},K)))});St.displayName="StackedBarChart";const Ot=e.forwardRef(function(t,n){const o=Ie(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}),r=e.useRef(null),{data:i,margin:a,className:s,categoryAccessor:l="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:y,colorScheme:p="category10",barPadding:m=60,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.showLegend,R=o.title,D=o.categoryLabel,_=o.valueLabel,N=i||[],$=y||u,z=kt({isPushMode:void 0===i,colorBy:$,colorScheme:p,showLegend:H,legendPosition:M}),I=e.useCallback(z.wrapPush(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)}),[z.wrapPush]),W=e.useCallback(z.wrapPushMany(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)}),[z.wrapPushMany]);e.useImperativeHandle(n,()=>({push:I,pushMany:W,clear:()=>{var e;z.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[I,W,z.resetCategories]);const T=wt({data:N,rawData:i,colorBy:$,colorScheme:p,legendInteraction:E,legendPosition:M,selection:x,linkedHover:A,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:k,chartType:"GroupedBarChart",chartId:S,showLegend:H,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:C});if(T.earlyReturn)return T.earlyReturn;const q=e.useMemo(()=>e=>$?T.colorScale?{fill:w(e,$,T.colorScale)}:{}:{fill:Ne},[$,T.colorScale]),F=e.useMemo(()=>_e(q,T.effectiveSelectionHook,x),[q,T.effectiveSelectionHook,x]),G=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),V=tt({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{groupBy:u}});if(V)return c.createElement(Qe,{componentName:"GroupedBarChart",message:V,width:P,height:C});const X=e.useMemo(()=>z.streamingLegend?Object.assign(Object.assign({},T.legendBehaviorProps),{legend:z.streamingLegend,legendPosition:M||T.legendPosition}):T.legendBehaviorProps,[T.legendBehaviorProps,T.legendPosition,z.streamingLegend,M]),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!=i&&{data:N}),{oAccessor:l,rAccessor:d,groupBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:F,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y,barPadding:m,enableHover:L,showAxes:o.showAxes,oLabel:D,rLabel:_,rFormat:g,showGrid:B}),X),R&&{title:R}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||G}),(A||k)&&{customHoverBehavior:T.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"GroupedBarChart",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},Q)))});Ot.displayName="GroupedBarChart";const jt=e.forwardRef(function(t,n){const o=Ie(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}),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:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",sizeBy:p,sizeRange:m=[3,8],pointRadius:f=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:A,frameProps:k={},selection:S,linkedHover:O,onObservation:j,chartId:E,loading:M,emptyContent:P,legendInteraction:C,legendPosition:L}=t,B=o.width,H=o.height,R=o.enableHover,D=o.showGrid,_=o.title,N=o.categoryLabel,$=o.valueLabel,z=i||[],I=wt({data:z,rawData:i,colorBy:g,colorScheme:y,legendInteraction:C,legendPosition:L,selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:j,chartType:"SwarmPlot",chartId:E,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:M,emptyContent:P,width:B,height:H});if(I.earlyReturn)return I.earlyReturn;const W=e.useMemo(()=>{if(!p)return;const e=z.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[z,p]),T=e.useMemo(()=>e=>{const t={fillOpacity:v};return t.fill=g?w(e,g,I.colorScale):Ne,t.r=p?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}(e,p,m,W):f,t},[g,I.colorScale,p,m,W,f,v]),q=e.useMemo(()=>_e(T,I.effectiveSelectionHook,S),[T,I.effectiveSelectionHook,S]),F=e.useMemo(()=>Ye({categoryAccessor:l,valueAccessor:u,groupAccessor:g||void 0}),[l,u,g]),G=tt({componentName:"SwarmPlot",data:i,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!=i&&{data:z}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:q,size:[B,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I.margin,barPadding:b,enableHover:R,showAxes:o.showAxes,oLabel:N,rLabel:$,rFormat:h,showGrid:D}),I.legendBehaviorProps),_&&{title:_}),s&&{className:s}),{tooltipContent:!1===x?()=>null:Ge(x)||F}),(O||j)&&{customHoverBehavior:I.customHoverBehavior}),A&&A.length>0&&{annotations:A}),k);return c.createElement(ft,{componentName:"SwarmPlot",width:B,height:H},c.createElement(Oe,Object.assign({ref:r},V)))});jt.displayName="SwarmPlot";const Et=e.forwardRef(function(t,n){const o=Ie(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}),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:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",showOutliers:p=!0,categoryPadding:m=20,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.title,R=o.categoryLabel,D=o.valueLabel,_=i||[],N=wt({data:_,rawData:i,colorBy:g,colorScheme:y,legendInteraction:E,legendPosition:M,selection:x,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"BoxPlot",chartId:S,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:C});if(N.earlyReturn)return N.earlyReturn;const $=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(()=>_e($,N.effectiveSelectionHook,x),[$,N.effectiveSelectionHook,x]),I=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return c.createElement("div",{className:"semiotic-tooltip",style:We},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())))},[]),W=tt({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(W)return c.createElement(Qe,{componentName:"BoxPlot",message:W,width:P,height:C});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=i&&{data:_}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:z,showOutliers:p,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:m,enableHover:L,showAxes:o.showAxes,oLabel:R,rLabel:D,rFormat:h,showGrid:B}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||I}),(A||k)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"BoxPlot",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},T)))});Et.displayName="BoxPlot";const Mt=e.forwardRef(function(t,n){const o=Ie(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}),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:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:y,colorScheme:p="category10",categoryPadding:m=20,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendPosition:E}=t,M=o.width,P=o.height,C=o.enableHover,L=o.showGrid,B=o.title,H=o.categoryLabel,R=o.valueLabel,D=i||[],_=wt({data:D,rawData:i,colorBy:y,colorScheme:p,legendInteraction:void 0,legendPosition:E,selection:x,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"Histogram",chartId:S,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:M,height:P});if(_.earlyReturn)return _.earlyReturn;const N=e.useMemo(()=>e=>{const t=y?w(e,y,_.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.8}},[y,_.colorScale]),$=e.useMemo(()=>_e(N,_.activeSelectionHook,x),[N,_.activeSelectionHook,x]),z=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return c.createElement("div",{className:"semiotic-tooltip",style:We},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&c.createElement("div",null,"Count: ",o),r&&2===r.length&&c.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),I=tt({componentName:"Histogram",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(I)return c.createElement(Qe,{componentName:"Histogram",message:I,width:M,height:P});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=i&&{data:D}),{oAccessor:l,rAccessor:u,projection:"horizontal",summaryStyle:$,bins:d,normalize:h,size:[M,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:_.margin,barPadding:m,enableHover:C,showAxes:o.showAxes,oLabel:H,rLabel:R,rFormat:g,showGrid:L}),_.legendBehaviorProps),B&&{title:B}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||z}),(A||k)&&{customHoverBehavior:_.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"Histogram",width:M,height:P},c.createElement(Oe,Object.assign({ref:r},W)))});Mt.displayName="Histogram";const Pt=e.forwardRef(function(t,n){const o=Ie(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}),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:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:y,colorBy:p,colorScheme:m="category10",categoryPadding:f=20,tooltip:v,annotations:b,frameProps:x={},selection:A,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.title,R=o.categoryLabel,D=o.valueLabel,_=i||[],N=wt({data:_,rawData:i,colorBy:p,colorScheme:m,legendInteraction:void 0,legendPosition:M,selection:A,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,chartType:"ViolinPlot",chartId:O,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:j,emptyContent:E,width:P,height:C});if(N.earlyReturn)return N.earlyReturn;const $=e.useMemo(()=>e=>{const t=p?w(e,p,N.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.6}},[p,N.colorScale]),z=e.useMemo(()=>_e($,N.activeSelectionHook,A),[$,N.activeSelectionHook,A]),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;if(o)return c.createElement("div",{className:"semiotic-tooltip",style:We},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 r=(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),i=r.length,a=i>0?r[Math.floor(i/2)]:null;return c.createElement("div",{className:"semiotic-tooltip",style:We},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),i>0&&c.createElement("div",null,"n = ",i),null!=a&&c.createElement("div",null,"Median: ",a.toLocaleString()))},[u]),W=tt({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(W)return c.createElement(Qe,{componentName:"ViolinPlot",message:W,width:P,height:C});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=i&&{data:_}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:z,bins:h,showIQR:g,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:f,enableHover:L,showAxes:o.showAxes,oLabel:R,rLabel:D,rFormat:y,showGrid:B}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===v?()=>null:Ge(v)||I}),(k||S)&&{customHoverBehavior:N.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(ft,{componentName:"ViolinPlot",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},T)))});Pt.displayName="ViolinPlot";const Ct=e.forwardRef(function(t,n){var o;const r=Ie(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}),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:a,margin:s,className:l,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:y,colorScheme:p="category10",sort:m=!0,dotRadius:f=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:A={},selection:k,linkedHover:S,onObservation:O,chartId:j,loading:E,emptyContent:M,legendInteraction:P,legendPosition:C}=t,L=r.width,B=r.height,H=r.enableHover,R=r.showGrid,D=r.title,_=r.categoryLabel,N=r.valueLabel,$=a||[],z=wt({data:$,rawData:a,colorBy:y,colorScheme:p,legendInteraction:P,legendPosition:C,selection:k,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,chartType:"DotPlot",chartId:j,showLegend:r.showLegend,userMargin:s,marginDefaults:r.marginDefaults,loading:E,emptyContent:M,width:L,height:B});if(z.earlyReturn)return z.earlyReturn;const I=$e($,m,d),W=e.useMemo(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=y?w(e,y,z.colorScale):Ne,t},[y,z.colorScale,f]),T=e.useMemo(()=>_e(W,z.effectiveSelectionHook,k),[W,z.effectiveSelectionHook,k]),q=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d}),[u,d]),F=tt({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(F)return c.createElement(Qe,{componentName:"DotPlot",message:F,width:L,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:I}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:T,size:[L,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,barPadding:v,enableHover:H,showAxes:r.showAxes,oLabel:_,rLabel:N,rFormat:g,showGrid:R,oSort:m}),z.legendBehaviorProps),D&&{title:D}),l&&{className:l}),{tooltipContent:!1===b?()=>null:Ge(b)||q}),(S||O)&&{customHoverBehavior:z.customHoverBehavior}),x&&x.length>0&&{annotations:x}),A);return c.createElement(ft,{componentName:"DotPlot",width:L,height:B},c.createElement(Oe,Object.assign({ref:i},G)))});Ct.displayName="DotPlot";const Lt=e.forwardRef(function(t,n){var o,r;const i=Ie(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title}),a=e.useRef(null),{data:s,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:y="category10",startAngle:p=0,tooltip:m,annotations:f,frameProps:v={},selection:b,linkedHover:x,onObservation:A,chartId:k,loading:S,emptyContent:O,legendInteraction:j,legendPosition:E}=t,M=i.width,P=i.height,C=i.enableHover,L=i.showLegend,B=i.title,H=s||[],R=g||d,D=kt({isPushMode:void 0===s,colorBy:R,colorScheme:y,showLegend:L,legendPosition:E}),_=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:_,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:[]}}),[_,N,D.resetCategories]);const $=wt({data:H,rawData:s,colorBy:R,colorScheme:y,legendInteraction:j,legendPosition:E,selection:b,linkedHover:x,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:A,chartType:"PieChart",chartId:k,showLegend:L,userMargin:l,marginDefaults:i.marginDefaults,loading:S,emptyContent:O,width:M,height:P});if($.earlyReturn)return $.earlyReturn;const z=e.useMemo(()=>e=>R?$.colorScale?{fill:w(e,R,$.colorScale)}:{}:{fill:Ne},[R,$.colorScale]),I=e.useMemo(()=>_e(z,$.effectiveSelectionHook,b),[z,$.effectiveSelectionHook,b]),W=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=tt({componentName:"PieChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(T)return c.createElement(Qe,{componentName:"PieChart",message:T,width:M,height:P});const q=e.useMemo(()=>D.streamingLegend?Object.assign(Object.assign({},$.legendBehaviorProps),{legend:D.streamingLegend,legendPosition:E||$.legendPosition}):$.legendBehaviorProps,[$.legendBehaviorProps,$.legendPosition,D.streamingLegend,E]),F=e.useMemo(()=>{if(D.streamingMarginAdjust){const e=Object.assign({},$.margin);for(const[t,n]of Object.entries(D.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return $.margin},[$.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:I,startAngle:p,size:[M,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,enableHover:C,showAxes:!1}),q),B&&{title:B}),u&&{className:u}),{tooltipContent:!1===m?()=>null:Ge(m)||W}),(x||A)&&{customHoverBehavior:$.customHoverBehavior}),f&&f.length>0&&{annotations:f}),v);return c.createElement(ft,{componentName:"PieChart",width:M,height:P},c.createElement(Oe,Object.assign({ref:a},G)))});Lt.displayName="PieChart";const Bt=e.forwardRef(function(t,n){var o,r;const i=Ie(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover}),a=e.useRef(null),{data:s,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",innerRadius:g=60,centerContent:y,colorBy:p,colorScheme:m="category10",startAngle:f=0,tooltip:v,annotations:b,frameProps:x={},selection:A,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendInteraction:M,legendPosition:P}=t,C=i.width,L=i.height,B=i.enableHover,H=i.showLegend,R=i.title,D=s||[],_=p||d,N=kt({isPushMode:void 0===s,colorBy:_,colorScheme:m,showLegend:H,legendPosition:P}),$=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:$,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:[]}}),[$,z,N.resetCategories]);const I=wt({data:D,rawData:s,colorBy:_,colorScheme:m,legendInteraction:M,legendPosition:P,selection:A,linkedHover:k,fallbackFields:_?["string"==typeof _?_:""]:[],unwrapData:!0,onObservation:S,chartType:"DonutChart",chartId:O,showLegend:H,userMargin:l,marginDefaults:i.marginDefaults,loading:j,emptyContent:E,width:C,height:L});if(I.earlyReturn)return I.earlyReturn;const W=e.useMemo(()=>e=>_?I.colorScale?{fill:w(e,_,I.colorScale)}:{}:{fill:Ne},[_,I.colorScale]),T=e.useMemo(()=>_e(W,I.effectiveSelectionHook,A),[W,I.effectiveSelectionHook,A]),q=e.useMemo(()=>Ye({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[d,h,p]),F=tt({componentName:"DonutChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(F)return c.createElement(Qe,{componentName:"DonutChart",message:F,width:C,height:L});const G=e.useMemo(()=>N.streamingLegend?Object.assign(Object.assign({},I.legendBehaviorProps),{legend:N.streamingLegend,legendPosition:P||I.legendPosition}):I.legendBehaviorProps,[I.legendBehaviorProps,I.legendPosition,N.streamingLegend,P]),V=e.useMemo(()=>{if(N.streamingMarginAdjust){const e=Object.assign({},I.margin);for(const[t,n]of Object.entries(N.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return I.margin},[I.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:f,centerContent:y,size:[C,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,enableHover:B,showAxes:!1}),G),R&&{title:R}),u&&{className:u}),{tooltipContent:!1===v?()=>null:Ge(v)||q}),(k||S)&&{customHoverBehavior:I.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(ft,{componentName:"DonutChart",width:C,height:L},c.createElement(Oe,Object.assign({ref:a},X)))});function Ht(t){const n=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:r,className:i,categoryAccessor:a="category",valueAccessor:s="value",orientation:l="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:p=5,tooltip:m,annotations:f,frameProps:v={},selection:b,linkedHover:x,onObservation:A,chartId:k,loading:S,emptyContent:O,legendPosition:j}=t,E=n.width,M=n.height,P=n.enableHover,C=n.showGrid,L=n.title,B=n.categoryLabel,H=n.valueLabel,R=o||[],D=wt({data:R,rawData:o,colorBy:g,colorScheme:y,legendInteraction:void 0,legendPosition:j,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,chartType:"RidgelinePlot",chartId:k,showLegend:n.showLegend,userMargin:r,marginDefaults:n.marginDefaults,loading:S,emptyContent:O,width:E,height:M});if(D.earlyReturn)return D.earlyReturn;const _=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(()=>_e(_,D.activeSelectionHook,b),[_,D.activeSelectionHook,b]),$=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:We},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:We},c.createElement("div",{style:{fontWeight:"bold"}},n+""))},[]),z=tt({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:a,valueAccessor:s}});if(z)return c.createElement(Qe,{componentName:"RidgelinePlot",message:z,width:E,height:M});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=o&&{data:R}),{oAccessor:a,rAccessor:s,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:N,bins:u,size:[E,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D.margin,barPadding:p,enableHover:P,showAxes:n.showAxes,oLabel:B,rLabel:H,rFormat:h,showGrid:C,oSort:!1,amplitude:d}),D.legendBehaviorProps),L&&{title:L}),i&&{className:i}),{tooltipContent:!1===m?()=>null:Ge(m)||$}),(x||A)&&{customHoverBehavior:D.customHoverBehavior}),f&&f.length>0&&{annotations:f}),v);return c.createElement(ft,{componentName:"RidgelinePlot",width:E,height:M},c.createElement(Oe,Object.assign({},I)))}Bt.displayName="DonutChart",Ht.displayName="RidgelinePlot",exports.BarChart=At,exports.BoxPlot=Et,exports.DonutChart=Bt,exports.DotPlot=Ct,exports.GroupedBarChart=Ot,exports.Histogram=Mt,exports.PieChart=Lt,exports.RidgelinePlot=Ht,exports.StackedBarChart=St,exports.StreamOrdinalFrame=Oe,exports.SwarmPlot=jt,exports.ViolinPlot=Pt;