semiotic 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useEffect as i,useMemo as r,useRef as s,createContext as a,useContext as l,useCallback as c,useSyncExternalStore as u,useState as d,forwardRef as h,useImperativeHandle as g,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as f,scaleBand as m}from"d3-scale";import{quadtree as v}from"d3-quadtree";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as w,interpolatePurples as A,interpolateOranges as k,interpolateGreens as O,interpolateReds as j,interpolateBlues as S,schemeSet3 as _,schemeTableau10 as C,interpolateSpectral as M,interpolateRdYlGn as P,interpolateRdYlBu as L,interpolateBrBG as T,interpolatePRGn as B,interpolatePiYG as I,interpolateRdBu as H}from"d3-scale-chromatic";import{quantile as R}from"d3-array";import{packEnclose as $}from"d3-hierarchy";import{area as D,curveCatmullRom as N,curveCardinal as W,curveBasis as F,curveStepBefore as z,curveStepAfter as E,curveStep as q,curveMonotoneY as G,curveMonotoneX as V,curveLinear as X,arc as Y}from"d3-shape";import Q from"regression";import{select as U}from"d3-selection";import{brushX as K,brushY as Z}from"d3-brush";class J{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class ee{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class te{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 ne(e,t,n){return e+(t-e)*n}function oe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ie(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function re(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const se={category10:b,tableau10:C,set3:_,blues:S,reds:j,greens:O,oranges:k,purples:A,viridis:w,plasma:x},ae=b,le=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ce=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 ue(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")||ce.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):ae[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+""))%ae.length]}function de(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const r=se[n]||se.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ae;return y().domain(o).range(e).unknown("#999")}}function he(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function ge(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function pe(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=R(e,.25))&&void 0!==t?t:r,median:null!==(n=R(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=R(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}const ye={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],p="vertical"===h,y="horizontal"===h,f=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;f&&n>0&&(a/=n);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(p){const t=d(0>a?i:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);g.push(he(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(y){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);g.push(he(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(r,Math.min(a,d),o,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(Math.min(a,d),r,Math.abs(d-a),o,g,i,h[s]))}}}}const y=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=r(e.datum);y>0&&(e.roundedTop=y),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(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:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:ge,donut:ge,boxplot:function(e,t){var n,o,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:p}=l,y=[],f="vertical"===p,m=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],p=null!==(n=R(l,.25))&&void 0!==n?n:c,v=null!==(o=R(l,.5))&&void 0!==o?o:(c+u)/2,b=null!==(i=R(l,.75))&&void 0!==i?i:u,x=b-p,w=p-1.5*x,A=b+1.5*x,k=null!==(r=l.find(e=>e>=w))&&void 0!==r?r:c,O=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:u,j=h(t.pieceData[0],t.name),S=[];if(m)for(const e of t.pieceData){const n=d(e);if(w>n||n>A){const o=f?t.middle:g(n),i=f?g(n):t.middle;S.push({px:o,py:i,value:n,datum:e})}}if(y.push({type:"boxplot",x:f?t.middle:0,y:f?0:t.middle,projection:f?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(k),q1Pos:g(p),medianPos:g(v),q3Pos:g(b),maxPos:g(O),stats:{n:l.length,min:k,q1:p,median:v,q3:b,max:O,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:S}),m)for(const t of S)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(r)}`;for(let t=0;p>t;t++){const n=u(r+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(r+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(r)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(r+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(r+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=R(t,.25))&&void 0!==n?n:r,l=null!==(o=R(t,.5))&&void 0!==o?o:(r+s)/2,c=null!==(i=R(t,.75))&&void 0!==i?i:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(r)),width:e.width,height:Math.abs(u(s)-u(r))}:{x:Math.min(u(r),u(s)),y:e.x,width:Math.abs(u(s)-u(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:pe(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,y=Math.max(...r,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/y)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(he(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/p*f}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/p*f} ${n}`}m+=` 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:m,translateX:0,translateY:0,bounds:v,stats:pe(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(he(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(he(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],A=[];let k=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(o);i.total+=r,i.pieces.push(o),n+=r}A.push({col:e,groups:t,stepTotal:n}),w||n>k&&(k=n)}if(w)for(const e of A){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>k&&(k=o)}if(0===k)return p;const O=new Map;for(const e of b){const t=A[0].groups.get(e);O.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const j=A[0].stepTotal,S=w?.95*y:.9*t.width,_=f().domain([0,k]).range([0,S]),C=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let M=new Map;for(let t=0;A.length>t;t++){const n=A[t],o=n.col,u=0===t,d=o.width,h=.55*d,f=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=y,i=y;for(let r=0;b.length>r;r++){const a=b[r],l=n.groups.get(a);if(!l)continue;const c=_(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const w=g(l.pieces[0],a),A=null!==(s=O.get(a))&&void 0!==s?s:l.total,k=A>0?l.total/A*100:0,j=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});m&&(0===r&&(j.__funnelStepLabel=o.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=f,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+c/2,j.__funnelValueLabelY=f,j.__funnelBarW=c),p.push(he(x,f,c,h,w,j,a)),v.set(a,{x:x,y:f,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),s=y-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=n.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],d=l?a:o.name,x=g(c,d),w=j>0?e/j*100:0,A=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:u,category:l?a:o.name});m&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=y,A.__funnelStepLabelY=f,A.__funnelRowWidth=t,A.__funnelValueLabelX=y,A.__funnelValueLabelY=f,A.__funnelBarW=t),p.push(he(s,f,t,h,x,A,d)),v.set(a,{x:s,y:f,w:t,h:h})}if(t>0&&M.size>0){const t=w?b:[b[0]];for(const i of t){const t=M.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:C},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};p.push(u)}}M=v}return p},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(i=m.get(h))&&void 0!==i?i:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),A=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:f,k=o?0:Math.max(0,A-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,_=c(p.pieces[0],y?h:n.name),C=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(he(O,j,u,S,_,C,y?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},_),i=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(he(O,e,u,t,o,i,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:i,getStack:r,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(i(n));if(0===o)continue;const l=r?r(n):e.name,d=s(n,l);if(u){const i=a(t),r=a(t+o);c.push(he(i,e.x,r-i,e.width,d,n,l))}else{const i=a(t+o),r=a(t);c.push(he(e.x,i,e.width,r-i,d,n,l))}t+=o}}return c}};class fe{constructor(e){this.rExtent=new te,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new ee(e.windowSize),this.getO=re(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new te)):(this.getR=ie(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=re(e.stackBy),this.getGroup=re(e.groupBy),this.getColor=re(e.colorAccessor),this.getConnector=re(e.connectorAccessor),this.getDataId=re(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new ee(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=m().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=f().domain(s).range([o,n])}else a?(u=m().domain(r).range([0,e.height]).padding(c),d=f().domain(s).range([0,e.width])):(u=m().domain(r).range([0,e.width]).padding(c),d=f().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?f().domain([l,c]).range([0,e.width]):f().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),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>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=ye[this.config.chartType];let i=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(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:this.config.themeCategorical||le,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,fe.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=v().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let A=!1;const k=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,O);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(k.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),A=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("rect"===c.type)d?(k.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,A=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("wedge"===c.type)if(d)k.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,A=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),A=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!k.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2;this.exitNodes.push({type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(f=t.innerRadius)&&void 0!==f?f:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e})}A=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),A&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(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),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=ne(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=ne(o.x,e._targetX,s),e.y=ne(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=ne(o.r,e._targetR,s))}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=ne(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=ne(n.x,e._targetX,s),e.y=ne(n.y,e._targetY,s),void 0!==n.w&&(e.w=ne(n.w,e._targetW,s),e.h=ne(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ne(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=ne(n.startAngle,e._targetStartAngle,s),e.endAngle=ne(n.endAngle,e._targetEndAngle,s))}}}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&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!oe(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!oe(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(oe(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=re(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!oe(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new te)):(this.getR=ie(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!oe(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?re(this.config.stackBy):void 0),"groupBy"in e&&!oe(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?re(this.config.groupBy):void 0),"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?re(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!oe(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?re(this.config.connectorAccessor):void 0)}}function me(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ve(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function be(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 xe(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>me(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function we(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=ve(Math.atan2(i,o)),a=ve(e.startAngle),l=ve(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Ae(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ke(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Oe(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function je(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})}fe.QUADTREE_THRESHOLD=500;const Se={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function _e(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,Se[n])(o(e,t)),i}function Ce(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Me(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Pe=(n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=n,y=[];let f=0;const m=!(!o&&!i),v="isolate"===d||void 0===d&&null!=s;return p.forEach((n,d)=>{const b=_e(n,d,h,g),x=Me(n,r,s),w=s&&s.size>0&&s.has(n.label);y.push(e("g",{transform:`translate(0,${f})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?w||!1:void 0,"aria-current":m&&!v&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),f+=22}),y};function Le({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&t("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),t("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),t("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let e=0;64>=e;e++){const n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[l&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function Te(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical"}=n,[p,y]=o.useState(0),[f,m]=o.useState(0),v=o.useCallback((e,t)=>{y(e),m(t)},[]),b="vertical"===g?(({legendGroups:e,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,g)=>{d+=5,h.push(t("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,e.label&&(d+=16,h.push(t("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),d+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${d})`,children:Pe(e,o,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*e.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const p=[];n.forEach((n,o)=>{let y=0;n.label&&(y+=16);const f=((n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:p,items:y}=n,f=[];let m=0,v=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=s;y.forEach((n,d)=>{const w=_e(n,d,g,p),A=Me(n,r,s),k=s&&s.size>0&&s.has(n.label),O=26+7*n.label.length;h&&h>0&&m>0&&m+O>h&&(v++,m=0),f.push(e("g",{transform:`translate(${m},${22*v})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&d===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?k||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,k&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=O});let w=0,A=0;for(const e of y){const t=26+7*e.label.length;h&&h>0&&A>0&&A+t>h?(w=Math.max(w,A),A=t):A+=t}w=Math.max(w,A);const k=v+1;return{items:f,offset:w,totalRows:k,totalHeight:22*k}})(n,r,s,a,l,c,u,o,d,h,i);y+=f.offset+5,p.push(Object.assign(Object.assign({label:n.label},f),{offset:y,totalRows:f.totalRows,totalHeight:f.totalHeight})),g+=y+12});let y=g>i?0:Math.max(0,(i-g)/2);const f=[];return p.forEach((e,i)=>{const r=n[i];r.label&&(f.push(t("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),y+=16),f.push(t("g",{className:"legend-item",transform:`translate(${y},0)`,children:e.items},"legend-group-"+i)),y+=e.offset+5,n[i+1]&&f.push(t("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(e.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),t("g",{children:f})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}),x=!(!r&&!s);return e("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&t("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function Be(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ie(e){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=r.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=i-r.bottom+50):(p=o-r.right+10,y=r.top),t("g",{transform:`translate(${p}, ${y})`,children:(f=n,"object"==typeof f&&null!==f&&"gradient"in f?t(Le,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Be(n)?t(Te,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var f}function He(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Re(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function $e(n,o,i,r){if(!n)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===g?p="end":"middle"===g&&(p="middle"):p=0>o?"end":"start";const y=16,f=a?d?[a]:He(a,u):[],m=s?d?[s]:He(s,u):[],v="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(x.push(t("text",{className:"annotation-note-title",fill:w,textAnchor:p,fontWeight:"bold",children:f.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-title")),b=f.length*y),m.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:p,y:b,children:m.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-label"));let A=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const e=Math.min(u,120);let n=0,o=e;"end"===p?(n=-e,o=0):"middle"===p&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+m.length)*y+(m.length>0?y:0);let n=0,o=e;"bottom"===g?(n=-e,o=0):"middle"===g&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,f.length+m.length-1)*y;let O=0;return"topBottom"===h?O=0>i?-(k+2):18:"leftRight"===h&&(O="middle"===g?-(k+y+(m.length>0&&f.length>0?2:0))/2+8:"bottom"===g||0>i?-(k+2):18),e("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),A]})}function De(e,n,o,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-e;a.push(t("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(t("line",{x1:(n.x1||0)-e,y1:i,x2:(n.x2||0)-e,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(t("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==e&&a.push(t("path",{d:Re((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function Ne(e,n,o,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const t=s.width||0,o=s.height||0;if(t>0||o>0){const i=t/2,r=o/2,s=e-i,a=n-r;if(0!==s||0!==a){const e=Math.abs(s),n=Math.abs(a),u=t/2,d=o/2,h=e*d>n*u?u/e:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const o=Math.atan2(n,e);l=Math.cos(o)*t,c=Math.sin(o)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(n-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:a})}function We(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y,{children:[!m.has("connector")&&Ne(v,b,c,h,x,u),!m.has("subject")&&De(x,u,h,n,o),!m.has("note")&&$e(l,v,b,h)]}))}function Fe(e){var n,o;const{noteData:i}=e,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const e=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:e,ny:a});return t(We,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(We,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function ze(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 Ee(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 qe(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){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,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return 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=ze(e,n),c=Ee(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"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ge(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ve={linear:X,monotoneX:V,monotoneY:G,step:q,stepAfter:E,stepBefore:z,basis:F,cardinal:W,catmullRom:N};function Xe(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=o,{rTickValues:p}=o,y="radial"===(null==u?void 0:u.projection),f="horizontal"===(null==u?void 0:u.projection),m=r(()=>!u||y?[]:(p||u.r.ticks(5)).map(e=>({value:e,pixel:u.r(e),label:(g||Ye)(e)})),[u,g,y,p]),v=h&&u&&!y,b=d&&u&&!y;return v||b?t("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${c.left},${c.top})`,children:[v&&t("g",{className:"ordinal-grid",children:m.map((e,n)=>t("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:i,y2:f?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),b&&t(n,{children:e(n,f?{children:[t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Ye(e){return Math.round(100*e)/100+""}function Qe(o){var i,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:p,showCategoryTicks:y,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:A,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:_="right",foregroundGraphics:C,annotations:M,svgAnnotationRules:P,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:I,children:H}=o,R="radial"===(null==g?void 0:g.projection),N="horizontal"===(null==g?void 0:g.projection),W=!1!==y,F=r(()=>p&&W&&g&&!R?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[p,W,g,v,R]),z=o.rTickValues,E=o.tickLabelEdgeAlign,q=r(()=>p&&g&&!R?(z||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||Ye)(e)})):[],[p,g,b,R,z]),G=s(new Map),V=s(null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0),Y=null!==(a=null==M?void 0:M.length)&&void 0!==a?a:0;V.current!==Y&&(V.current=Y,G.current=new Map);const U=r(()=>{if(!M||0===M.length)return null;const n=function(n,o,i){var r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j,S,_,C,M,P,L,T,B,I,H,R,N,W,F,z,E,q,G,V,Y,U,K,Z,J,ee,te,ne;switch(n.type){case"label":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=ze(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ee(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=$(r),a=n.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return e("g",{children:[t("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const e=i.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,o)=>{const r=ze(e,i),a=Ee(e,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const e=ze(n,i),r=Ee(n,i);return t(Fe,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",p=i.yAccessor||"y",y=h.map(e=>[e[g],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!f||!m)return null;const v=n.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=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],p+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(y,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?Q.polynomial(y,{order:n.order||2}):Q.linear(y)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=n.color||"#6366f1";return e("g",{children:[t("polyline",{points:x,fill:"none",stroke:w,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:f(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:w,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(p=i.scales)||void 0===p?void 0:p.value,s=null!==(y=null==r?void 0:r(n.y0))&&void 0!==y?y:0,a=null!==(f=null==r?void 0:r(n.y1))&&void 0!==f?f:i.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(w=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==w?w:null===(A=i.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ve[i.curve||"linear"]||X,p=D().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const y=n.fill||"#6366f1";return e("g",{children:[t("path",{d:p,fill:y,fillOpacity:null!==(k=n.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),n.label&&h.length>0&&t("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(j=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==j?j:null===(S=i.scales)||void 0===S?void 0:S.time,l=null!==(C=null===(_=i.scales)||void 0===_?void 0:_.y)&&void 0!==C?C:null===(M=i.scales)||void 0===M?void 0:M.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-g*h,y=!1!==n.showBand,f=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(T=n.anomalyRadius)&&void 0!==T?T:6,x=l(u+g*h),w=l(p),A=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return e("g",{children:[y&&t("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:f,fillOpacity:m}),A.map((e,n)=>{const o=ze(e,i),r=Ee(e,i);return null==o||null==r?null:t("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:f,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(I=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(H=i.scales)||void 0===H?void 0:H.time,c=null!==(N=null===(R=i.scales)||void 0===R?void 0:R.y)&&void 0!==N?N:null===(W=i.scales)||void 0===W?void 0:W.value;if(!l||!c)return null;const u=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=Q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;d=e=>a+s*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(h-2,1)),y=u.reduce((e,t)=>e+t[0],0)/h,f=u.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(F=n.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=n.steps)&&void 0!==z?z:5,x=u[h-1][0],w=(x-u[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=p*Math.sqrt(1+1/h+(f>0?Math.pow(e-y,2)/f:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${k.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,j=k.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),S=`${l(x)},${c(d(x))}`,_=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(E=n.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),t("polyline",{points:`${S} ${j}`,fill:"none",stroke:_,strokeWidth:null!==(q=n.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&k.length>0&&t("text",{x:l(k[k.length-1].x)+4,y:c(k[k.length-1].yCenter)-4,fill:_,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=qe(n,o,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ge(e,r,i))return null;const s=null!==(V=n.dx)&&void 0!==V?V:0,a=null!==(Y=n.dy)&&void 0!==Y?Y:0,l=null!==(U=n.width)&&void 0!==U?U:32,c=null!==(K=n.height)&&void 0!==K?K:32,u=null!==(Z=n.content)&&void 0!==Z?Z:t("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return e("g",(i.projection?"vertical"===i.projection:c===a)?{children:[t("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:g}),p&&t("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[t("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),p&&t("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o="horizontal"===(null==g?void 0:g.projection),i=(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,r={scales:g?{x:o?g.r:i||g.r,y:o&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:l,height:c,data:B,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:G.current};return M.map((e,t)=>{if(P){const o=P(e,t,r);return null!=o?o:n(e,t,r)}return n(e,t,r)}).filter(Boolean)},[M,P,l,c,g,L,T,B]);return p||w||A||C||U&&U.length>0||x||H?e("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof w?w:"Ordinal Chart"}),t("desc",{children:"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"}),e("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!R&&!I&&t("g",{className:"ordinal-grid",children:q.map((e,n)=>t("line",{x1:N?e.pixel:0,y1:N?0:e.pixel,x2:N?e.pixel:l,y2:N?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),p&&g&&!R&&t("g",{className:"ordinal-axes",children:e(n,N?{children:[!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!I&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&l-1>e?t("line",{x1:e,y1:0,x2:e,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((n,o)=>{const i=E?0===o?"start":o===q.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)}),m&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m})]}:{children:[!I&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,n=0>e||e>c?c:e;return t("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((n,o)=>e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)),m&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:m})]})}),U,C,H]}),w&&t("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),Ie({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:_,title:w,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S})]}):null}function Ue({width:e,height:n,totalWidth:o,totalHeight:r,margin:a,scales:l,onBrush:c}){const u=s(null),d=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const p=s(!1),y=s(null),f="horizontal"===(null==l?void 0:l.projection),m=s(f);return m.current=f,i(()=>{if(!u.current)return;const t=U(u.current).select(".brush-g"),o=f?K():Z();return o.extent([[0,0],[e,n]]),o.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let i;i=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};y.current=r,h.current(r)}),t.call(o),d.current=o,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[e,n,f]),i(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=U(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),t("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Ke(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ze="undefined"==typeof window||"undefined"==typeof document,Je=o.createContext(null),et={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function tt(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",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=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 s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const nt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ot={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},it={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},rt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},st={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},at={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},lt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},ct={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function ut({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(Je),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=o.useRef(null),p=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,y=o.useCallback(()=>{l||d||c(!0)},[l,d]),f=o.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:et}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:y,style:et,role:"region","aria-label":p,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j;const S=[];if(!Array.isArray(e))return S;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":S.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=_.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=_.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(p=_.cy)&&void 0!==p?p:_.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=_.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=_.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(j=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${nt(e.min)} to ${nt(e.max)}, mean ${nt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const A=Array.from(w);return e("div",{ref:g,id:r,tabIndex:-1,onBlur:f,style:ot,role:"region","aria-label":p,children:[t("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:rt,children:"×"}),t("div",{role:"note",style:it,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:st,children:[e("caption",{style:ct,children:["First ",x.length," of ",m.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:at,children:"type"}),A.map(e=>t("th",{style:at,children:e},e))]})}),t("tbody",{children:x.map((n,o)=>e("tr",{children:[t("td",{style:lt,children:n.label}),A.map(e=>{return t("td",{style:lt,children:(o=n.values[e],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":nt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},e);var o})]},o))})]})]})}function dt({summary:e}){return e?t("div",{role:"note",style:et,children:e}):null}function ht({tableId:e}){return t("a",{href:"#"+e,style:et,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,et)},children:"Skip to data table"})}function gt({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:et,children:n})}const pt="var(--semiotic-focus, #005fcc)";function yt({active:e,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!e||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),n=Math.max(a,4);u=t("rect",{x:l-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"})}else u=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:pt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function ft({x:e,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=d?`translate(${d.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,t("div",{ref:u,className:l,style:{position:"absolute",left:s.left+e,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function mt(e){const n=a(null),o=vt(e);return[function({children:o}){const i=r(()=>vt(e),[]);return t(n.Provider,{value:i,children:o})},e=>{var t;const i=null!==(t=l(n))&&void 0!==t?t:o,r=s(e);r.current=e;const a=c(()=>r.current(i.getState()),[i]),d=c(()=>r.current(i.getState()),[i]);return u(i.subscribe,a,d)}]}function vt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function bt(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function xt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:wt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const wt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],At={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ot={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:wt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[jt,St]=mt(e=>({theme:At,setTheme(t){e(e=>{if("light"===t)return{theme:At};if("dark"===t)return{theme:kt};if("high-contrast"===t)return{theme:Ot};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?kt:At;return{theme:xt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:xt(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const _t=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ct=new WeakMap;let Mt=0,Pt=!1,Lt=null,Tt=null,Bt=null;function It(e,t){var n,o;if(!t)return t;const i=_t.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Pt=!0;const e=()=>{Mt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Lt=new MutationObserver(e),Lt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Tt=window.matchMedia("(prefers-color-scheme: dark)"),Bt=e,"function"==typeof Tt.addEventListener?Tt.addEventListener("change",Bt):"function"==typeof Tt.addListener&&Tt.addListener(Bt)}catch(e){}}();let s=Ct.get(r);s&&s.version===Mt||(s={version:Mt,map:new Map},Ct.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function Ht(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Rt(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=s(t);n.current=t;const[a,l]=function(e,t,n){const o=s(null),[r,a]=d(null);return i(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=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 i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-u.left-u.right,g=l[1]-u.top-u.bottom,p=Ht(e.foregroundGraphics,l,u),y=Ht(e.backgroundGraphics,l,u),f=St(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=s(0),w=s(()=>{}),A=c(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=s(()=>{}),O=s(()=>{}),j=s(null),S=s(0),_=c(()=>{S.current=0;const e=j.current;j.current=null,e&&k.current(e)},[]),C=c(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(_))},[_]),M=c(()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),O.current()},[]);i(()=>()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const P=e.themeDirtyRef;return i(()=>{P&&(Mt++,P.current=!0,A())},[f,A,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:l,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:y,currentTheme:f,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:A,hoverHandlerRef:k,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:M}}function $t(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Dt(e,t,n=.3){$t(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 Nt(e,t,n=.6){var o,i,r,s,a;if(!$t(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!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Wt(e,t,n,o=.35){$t(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ft(e,t,n){const o=t.fillGradient;if(!o)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const n=e.createLinearGradient(r,s,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const zt=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Et(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Dt(e,t),e.globalAlpha=1}};function Et(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,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const qt=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){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=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?It(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Nt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Gt(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Vt(e,t){const n=Y().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const Xt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Vt(e,t)):(Gt(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Gt(e,t),Wt(e,t)),e.globalAlpha=1}};const Yt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Qt=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=It(e,n.style.stroke)||("string"==typeof n.style.fill?It(e,n.style.fill):n.style.fill)||It(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function Ut(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Kt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Zt=null;function Jt(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Zt||(Zt=document.createElement("canvas")),Zt.width=e,Zt.height=e,Zt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const en=new Map;function tn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=en.get(n);if(void 0!==o)return o;const i=Jt({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return en.set(n,i),i}function nn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function on(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function rn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const sn=e=>[Qt,...e],an={bar:sn([zt]),clusterbar:sn([zt]),point:sn([qt]),swarm:sn([qt]),pie:[Xt],donut:[Xt],boxplot:sn([(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=It(e,"var(--semiotic-primary, #007bff)"),a=It(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?It(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?It(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),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()}},qt]),violin:sn([Yt]),histogram:sn([zt]),ridgeline:sn([Yt]),timeline:sn([zt]),funnel:[zt,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Ut(i):null!=r?`${Ut(i)} (${Kt(r)})`:Ut(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Ut(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[zt,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||It(e,"var(--semiotic-border, #999)"),o=tn(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=It(e,"var(--semiotic-text, #333)"),s=It(e,"var(--semiotic-text-secondary, #666)");for(const t of i){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,a=!(!0===n.__barFunnelIsFirstStep)&&null!=i,l=a?rn(i):"",c=on(o);e.font="bold 13px sans-serif";const u=a?e.measureText(l).width:0;e.font="11px sans-serif";const d=e.measureText(c).width,h=Math.max(u,d)+12,g=a?32:17,p=n.__barFunnelLabelX,y=p-h/2,f=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),nn(e,y,f,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),nn(e,y,f,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=r,e.fillText(l,p,f+3),e.font="11px sans-serif",e.fillStyle=s,e.fillText(c,p,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=r,e.fillText(c,p,f+3))}e.lineWidth=1}],swimlane:sn([zt])},ln={top:50,right:40,bottom:60,left:70},cn={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 un({hover:n}){var o,i,r,s,a,l;const c=n.data||{},u=n.stats,d=n.category;if(Array.isArray(c)){const n=d||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(u)return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:["n = ",u.n]}),e("div",{children:["Min: ",u.min.toLocaleString()]}),e("div",{children:["Q1: ",u.q1.toLocaleString()]}),e("div",{children:["Median: ",u.median.toLocaleString()]}),e("div",{children:["Q3: ",u.q3.toLocaleString()]}),e("div",{children:["Max: ",u.max.toLocaleString()]}),e("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return e("div",{className:"semiotic-tooltip",style:cn,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===n.length&&e("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,p=n.__chartType;if("swarm"===p||"point"===p){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const y=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",f=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!y&&""===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e("div",{className:"semiotic-tooltip",style:cn,children:[y&&t("div",{style:{fontWeight:"bold"},children:y+""}),""!==f&&t("div",{children:"number"==typeof f?f.toLocaleString():f+""})]})}const dn=h(function(n,a){var l,u,h,p,y,f,m,v,b,x;const{chartType:w,runtimeMode:A,data:k,oAccessor:O="category",rAccessor:j="value",colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:P,valueAccessor:L,categoryAccessor:T,projection:B="vertical",size:I=[600,400],responsiveWidth:H,responsiveHeight:R,margin:$,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,rExtent:re,oExtent:se,extentPadding:ae=.05,oSort:le,windowMode:ce="sliding",windowSize:ue=200,pieceStyle:de,summaryStyle:he,colorScheme:ge,barColors:pe,showAxes:ye=!0,showCategoryTicks:ve,categoryLabel:Se,valueLabel:_e,categoryFormat:Ce,valueFormat:Me,oLabel:Pe,rLabel:Le,oFormat:Te,rFormat:Be,rTickValues:Ie,tickLabelEdgeAlign:He,enableHover:Re=!0,hoverAnnotation:$e,tooltipContent:De,customHoverBehavior:Ne,annotations:We,svgAnnotationRules:Fe,showGrid:ze=!1,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,backgroundGraphics:et,foregroundGraphics:nt,title:ot,className:it,background:rt,centerContent:st,decay:at,pulse:lt,transition:ct,animate:pt,staleness:mt,brush:vt,onBrush:xt,accessibleTable:wt=!0,description:At,summary:kt}=n,Ot=s(!0),jt=Rt({sizeProp:I,responsiveWidth:H,responsiveHeight:R,userMargin:$,marginDefault:ln,foregroundGraphics:nt,backgroundGraphics:et,animate:pt,transitionProp:ct,themeDirtyRef:Ot}),{reducedMotionRef:St,responsiveRef:_t,size:Ct,margin:Mt,adjustedWidth:Pt,adjustedHeight:Lt,resolvedForeground:Tt,resolvedBackground:Bt,currentTheme:It,transition:Ht,introEnabled:$t,tableId:Dt,rafRef:Nt,renderFnRef:Wt,scheduleRender:Ft}=jt,zt=null!=Se?Se:Pe,Et=null!=_e?_e:Le,qt=null!=Ce?Ce:Te,Gt=null!=Me?Me:Be,Vt=s(null),Xt=s(null),[Yt,Qt]=d(null),[Ut,Kt]=d(null),[Zt,Jt]=d(0),[en,tn]=d(!1),nn=Re||$e,on="streaming"===A,rn=r(()=>{var e,t,n;return{chartType:w,runtimeMode:on?"streaming":"bounded",windowSize:ue,windowMode:ce,extentPadding:ae,projection:B,oAccessor:on?void 0:O,rAccessor:on?void 0:j,colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:on?P:void 0,valueAccessor:on?L||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:on?T||O:void 0,rExtent:re,oExtent:se,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,oSort:le,pieceStyle:de,summaryStyle:he,colorScheme:ge,themeCategorical:null===(e=null==It?void 0:It.colors)||void 0===e?void 0:e.categorical,themeSemantic:bt(It),themeSequential:null===(t=null==It?void 0:It.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==It?void 0:It.colors)||void 0===n?void 0:n.diverging,barColors:pe,decay:at,pulse:lt,transition:Ht,introAnimation:$t,staleness:mt}},[w,ue,ce,ae,B,O,j,S,_,C,M,P,L,T,re,se,D,N,W,F,z,E,q,G,V,X,Q,U,K,Z,ee,te,ne,oe,ie,le,de,he,ge,pe,at,lt,null==Ht?void 0:Ht.duration,null==Ht?void 0:Ht.easing,$t,mt,on,It]),sn=s(null);sn.current||(sn.current=new fe(rn)),i(()=>{var e;null===(e=sn.current)||void 0===e||e.updateConfig(rn),Ot.current=!0,Ft()},[rn,Ft]);const cn=s(null);cn.current||(cn.current=new J(e=>{const t=sn.current;t&&t.ingest(e)&&(Ot.current=!0,Ft())}));const dn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.push(e)},[]),hn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.pushMany(e)},[]),gn=c(()=>{var e,t;null===(e=cn.current)||void 0===e||e.clear(),null===(t=sn.current)||void 0===t||t.clear(),Ot.current=!0,Ft()},[Ft]),pn=c(e=>{var t,n;null===(t=cn.current)||void 0===t||t.clearLastData(),null===(n=cn.current)||void 0===n||n.setReplacementData(e)},[]);g(a,()=>({push:dn,pushMany:hn,replace:pn,remove:e=>{var t,n,o,i;null===(t=cn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=sn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=Xt.current)||void 0===i?void 0:i.data;!!Xt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Xt.current=null,Qt(null)),Ot.current=!0,Ft()}return r},update:(e,t)=>{var n,o,i;null===(n=cn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=sn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ot.current=!0,Ft()),r},clear:gn,getData:()=>{var e,t,n;return null===(e=cn.current)||void 0===e||e.flush(),null!==(n=null===(t=sn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=sn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[dn,hn,pn,gn,Ft]),i(()=>{var e;k&&(null===(e=cn.current)||void 0===e||e.setBoundedData(k))},[k]);const{hoverHandlerRef:yn,hoverLeaveRef:fn,onPointerMove:mn,onPointerLeave:vn}=jt;yn.current=e=>{if(!nn)return;const t=Vt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,i=e.clientY-n.top-Mt.top;if(0>o||o>Pt||0>i||i>Lt)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const r=sn.current;if(!r||0===r.scene.length)return;const s="radial"===B,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,a=Math.sqrt(r*r+s*s);me(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":e=be(r,t,n);break;case"point":if(i)break;e=xe(r,t,n,o);break;case"wedge":e=we(r,t,n);break;case"boxplot":e=Ae(r,t,n);break;case"violin":e=ke(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Pt/2:o,s?i-Lt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;Xt.current=l,Qt(l),Ne&&(Ne(l),Ot.current=!0),Ft()},fn.current=()=>{Xt.current&&(Xt.current=null,Qt(null),Ne&&(Ne(null),Ot.current=!0),Ft())};const bn=s(-1),xn=s(null),wn=s(null),An=c(e=>{const t=sn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(wn.current&&wn.current.version===n)o=wn.current.graph;else{const e=function(e){var t,n,o,i;const r=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";r.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)r.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(i=s.group)&&void 0!==i?i:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;r.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return r.sort((e,t)=>e.x-t.x||e.y-t.y),r}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),wn.current={version:n,graph:o}}const i=bn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),bn.current=0;const t=o.flat[0];xn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},je(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});return Xt.current=n,Qt(n),Ne&&Ne(n),void Ft()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Oe(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Oe(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return bn.current=-1,xn.current=null,Xt.current=null,Qt(null),Ne&&Ne(null),void Ft();bn.current=s;const a=o.flat[s];xn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},je(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});Xt.current=l,Qt(l),Ne&&Ne(l),Ft()},[Ne,Ft]),kn=c(e=>{bn.current=-1,xn.current=null,mn(e)},[mn]);Wt.current=()=>{var e,t;Nt.current=0;const n=Vt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=sn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(St.current?r+1e6:r),a=!St.current&&s,l=Ot.current;l&&!s&&(i.computeScene({width:Pt,height:Lt}),Ot.current=!1),(l||a)&&n.setAttribute("aria-label",tt(i.scene,w+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=Ct[0]*c,d=Ct[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Ct[0]+"px",n.style.height=Ct[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Ct[0],Ct[1]);const h=null!==(e=null==mt?void 0:mt.threshold)&&void 0!==e?e:5e3,g=mt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==mt?void 0:mt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==rt&&!et){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=rt||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,Ct[0],Ct[1]))}const p="radial"===B;o.save(),o.beginPath(),o.rect(Mt.left,Mt.top,Pt,Lt),o.clip(),p?(o.save(),o.translate(Mt.left+Pt/2,Mt.top+Lt/2)):o.translate(Mt.left,Mt.top);const y=an[w]||[],f={width:Pt,height:Lt};for(const e of y)e(o,i.scene,i.scales,f);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Kt(i.scales),Jt(e=>e+1)),(null==mt?void 0:mt.showBadge)&&tn(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Wt.current()))},i(()=>(Ft(),()=>{var e;null===(e=cn.current)||void 0===e||e.clear()}),[Ft]),i(()=>{Ot.current=!0,Ft()},[w,Pt,Lt,ye,rt,Ft]),function(e,t,n,o,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(mt,sn,Ot,Ft,en,tn);const On=nn&&Yt?De?De(Yt):t(un,{hover:Yt}):null,jn="radial"===B,Sn=On?t(ft,{x:Yt?jn?Yt.x+Pt/2:Yt.x:0,y:Yt?jn?Yt.y+Lt/2:Yt.y:0,containerWidth:Pt,containerHeight:Lt,margin:Mt,className:"stream-ordinal-tooltip",children:On}):null;if(Ze){const n=sn.current;n&&k&&(n.ingest({inserts:k,bounded:!0}),n.computeScene({width:Pt,height:Lt}));const i=null!==(l=null==n?void 0:n.scene)&&void 0!==l?l:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,s="radial"===B,a=s?Mt.left+Pt/2:Mt.left,c=s?Mt.top+Lt/2:Mt.top;return e("div",{className:"stream-ordinal-frame"+(it?" "+it:""),role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:Ct[0],height:Ct[1]},children:[t(dt,{summary:kt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ct[0],height:Ct[1],style:{position:"absolute",left:0,top:0},children:[Bt&&t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt}),e("g",{transform:`translate(${a},${c})`,children:[rt&&t("rect",{x:0,y:0,width:Pt,height:Lt,fill:rt}),i.map((n,i)=>function(n,i){var r,s,a,l,c;const u=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",d=e=>`ord-${n.type}-${u}-${i}-${e}`,h=`ord-${n.type}-${u}-${i}`;switch(n.type){case"rect":{const i=n,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(e,n){const o=e.fillGradient;if(!o)return null;let i=e.x,r=e.y,s=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,s=e.x,a=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,s=e.x+e.w,a=e.y);const l=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let n=0;e.length>n;n++)l.push(t("stop",{offset:e[n].offset,stopColor:e[n].color},n))}else{const n=Ke(e.style.fill);l.push(t("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return t("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:Ke(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+u-n} A${n},${n} 0 0 0 ${r+n},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r+n},${l+u} A${n},${n} 0 0 1 ${r},${l+u-n} Z`;break;default:d=`M${r},${l+u} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u} Z`}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:d,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const e=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:Ke(e.style.fill),opacity:null!==(r=e.style.opacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}case"wedge":{const e=n,o=Y().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&o.cornerRadius(e.cornerRadius);const i=o({})||"";return t("path",{d:i,transform:`translate(${e.cx},${e.cy})`,fill:Ke(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const o=n,i=o.columnWidth/2;return e("g","vertical"===o.projection?{children:[t("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Ke(o.style.fill),fillOpacity:null!==(s=o.style.fillOpacity)&&void 0!==s?s:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Ke(o.style.fill),fillOpacity:null!==(a=o.style.fillOpacity)&&void 0!==a?a:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=n,o=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:Ke(e.style.fill),fillOpacity:null!==(l=e.style.fillOpacity)&&void 0!==l?l:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},d("path"))];if(e.iqrLine&&e.bounds){const n=e.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med"))):o.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med")))}return t("g",{children:o},h)}case"connector":return t("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(c=n.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=n,o=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:o,fill:Ke(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(n,i)).filter(Boolean)]})]}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:r,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,rTickValues:Ie,tickLabelEdgeAlign:He,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:0,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==n?void 0:n.getData()}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st})]})}return e("div",{ref:_t,className:"stream-ordinal-frame"+(it?" "+it:""),role:"group","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:H?"100%":Ct[0],height:R?"100%":Ct[1],overflow:"visible"},onKeyDown:An,children:[wt&&t(ht,{tableId:Dt}),wt&&t(ut,{scene:null!==(p=null===(h=sn.current)||void 0===h?void 0:h.scene)&&void 0!==p?p:[],chartType:w+" chart",tableId:Dt,chartTitle:"string"==typeof ot?ot:void 0}),t(dt,{summary:kt}),e("div",{role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?kn:void 0,onMouseLeave:nn?vn:void 0,children:[Bt&&t("svg",{style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt})}),t(Xe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showGrid:ze,rFormat:Gt,rTickValues:Ie}),t("canvas",{ref:Vt,"aria-label":tt(null!==(f=null===(y=sn.current)||void 0===y?void 0:y.scene)&&void 0!==f?f:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1]}}),t(gt,{hoverPoint:Yt}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:Zt,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(m=sn.current)||void 0===m?void 0:m.getData(),underlayRendered:!0}),(vt||xt)&&"radial"!==B&&t(Ue,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,onBrush:xt||(()=>{})}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st}),(null==mt?void 0:mt.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===mt.badgePosition?{top:4,left:4}:"bottom-left"===mt.badgePosition?{bottom:4,left:4}:"bottom-right"===mt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:en?"#dc3545":"#28a745",color:"white"}),children:en?"STALE":"LIVE"}),t(yt,{active:bn.current>=0,hoverPoint:Yt,margin:Mt,size:Ct,shape:null===(v=xn.current)||void 0===v?void 0:v.shape,width:null===(b=xn.current)||void 0===b?void 0:b.w,height:null===(x=xn.current)||void 0===x?void 0:x.h}),Sn]})]})});dn.displayName="StreamOrdinalFrame";const hn=a(null);function gn(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 pn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[yn,fn]=mt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=pn(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=pn(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}})}})),[mn,vn]=mt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let bn={positions:new Map};const xn=new Set;function wn(){for(const e of xn)e()}function An(e,t){const n=bn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}function kn(e){const t=p(),n=e.clientId||t,{name:o}=e,i=fn(e=>e.selections.get(o)),s=fn(e=>e.setClause),a=fn(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(gn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:c(()=>{a(o,n)},[a,o,n]),clientId:n}}const On=a(!1);function jn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){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:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):le[r%le.length];return{label:i+"",color:a}}),label:""}]}}function Sn(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:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function _n(){return St(e=>e.theme)}function Cn(){var e;const t=_n(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Mn(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=se[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}function Pn(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}o.createContext(void 0);const Ln={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 Tn(e,t,n){var o,i,r,s,a,l,c;const u=Ln[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Bn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Bn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function In(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}const Hn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Rn(e,t){return"function"==typeof t?t(e):e[t]}function $n(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Dn(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=Rn(n,i);l=$n(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Rn(n,o);c.push({label:t,value:$n(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=$n(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=$n(n[e[0]],r))}}const u=Object.assign(Object.assign({},Hn),s);return e("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&t("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((t,n)=>e("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},n))]})}}function Nn(e){if(!0===e)return Dn();if("function"==typeof e){const n=e;return e=>{const o=n(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==o?null:t("div",{className:"semiotic-tooltip",style:Hn,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Dn(e):Dn())}function Wn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Fn(e,t){if(!t)return Wn(e);try{const n=t(e);return null==n?Wn(e):n}catch(t){return Wn(e)}}function zn(e,t){return"function"==typeof t?t(e):e[t]}function En({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const u=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=zn(u,n),h=zn(u,o),g=i?zn(u,i):void 0;return e("div",{className:"semiotic-tooltip",style:Hn,children:[t("div",{style:{fontWeight:"bold"},children:Wn(d)}),t("div",{style:{marginTop:4},children:Fn(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(p=i,"string"==typeof p?p:"value"),": ",Wn(g)]})]});var p}}function qn({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return t("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400},children:[t("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&t("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Gn extends o.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,n=this.state.error;return"function"==typeof e?e(n):void 0!==e?e:t(qn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Vn(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Xn(e,t,n=3){let o,i=n+1;for(const n of t){const t=Vn(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function Yn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Qn(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=Xn(e,t,3))&&void 0!==n?n:null)}function Un({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=Yn(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=Qn(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Kn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Zn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Jn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},eo=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],to=["vertical","horizontal"],no={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:eo},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({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:eo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:eo},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({},Kn),Zn),{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({},Kn),Zn),{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({},Kn),Zn),{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({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{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({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:to},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Kn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Kn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Kn),{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({},Kn),{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:to},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({},Kn),{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({},Kn),{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({},Kn),{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({},Kn),{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({},Kn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Kn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Kn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function oo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const io=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),ro=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),so=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ao=new Set(["LineChart","AreaChart","StackedAreaChart"]),lo=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function co(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(n)+.7152*r(o)+.0722*r(i)}function uo(e,t){const n=co(e),o=co(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const ho=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function go(e,t){const n=[],o=function(e,t){const n=[],o=no[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(no).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!oo(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=Xn(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const s=Un({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!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(r&&t&&t.length>0){const n=Yn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Qn(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}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 no[e]?(function(e,t,n){const o=no[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,i=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===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — 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=no[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){io.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){ro.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=no[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!so.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[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=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!ao.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". 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,i;const r=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=no[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){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(!lo.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 i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}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 i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}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 i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=uo(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=uo(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of ho)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var po;const yo="undefined"!=typeof process&&"production"!==(null===(po=process.env)||void 0===po?void 0:po.NODE_ENV);function fo({componentName:e,width:n,height:o,chartProps:i,children:r}){return t(Gn,{fallback:r=>{let s="";if(yo&&i)try{const t=go(e,i);t.ok||(s=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return t(qn,{componentName:e,message:r.message,diagnosticHint:s,width:n,height:o})},children:r})}const mo={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"},vo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function bo(e,t,n,o){if(!yo)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 xo(e){const{data:n,rawData:o,colorBy:s,colorScheme:a,legendInteraction:u,legendPosition:h,selection:g,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:A,marginDefaults:k,onClick:O,hoverHighlight:j,loading:S,emptyContent:_,width:C,height:M}=e,P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:L,hoverSelectionHook:T,customHoverBehavior:B,customClickBehavior:I,crosshairSourceId:H}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:s,chartType:a,chartId:l,onClick:u,hoverHighlight:h,colorByField:g}){const y=p(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=kn({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=kn({name:t});return{onHover:c(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||n||[]}),b=vn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=d(null),k=g||n[0],O=r(()=>{if(!h||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,k]),j=c(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=bn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n})},wn())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&An(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(h&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,f,y,s,a,l,b,h,k]),S=c(e=>{var t,n,o,i;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=bn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(bn.positions);return t.delete(e),bn={positions:t},wn(),!1}bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},wn()}(f.name||"hover",Number(n),y)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[u,s,b,a,l,f,y]);return i(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const n=bn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}(e,y),An(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:y}}({selection:g,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:j,colorByField:P}),R=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(y,H),$=function(e,t,n){const o=l(hn),i=Cn();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=de(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return de(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=de(e,t,s);return e=>o[e]||n(e)}return de(e,t,s)}if(o&&Object.keys(o).length>0){const e=de([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(n,s,a),D=r(()=>{if(!s)return[];const e=new Set;for(const t of n){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[n,s]),N=function(e,t,n){const[o,i]=d(null),[s,a]=d(new Set),l=c(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=c(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:u,legendSelectionHook:h}}(u,s,D),W=r(()=>T||(N.legendSelectionHook?N.legendSelectionHook:L),[T,N.legendSelectionHook,L]),F=function(e){const t=St(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(g),{legend:z,margin:E,legendPosition:q}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:c}){const u=l(On),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(!d||!t)return;const o=jn({data:e,colorBy:t,colorScale:n,getColor:ue,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),g=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return h&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,h,i]);return{legend:h,margin:g,legendPosition:i}}({data:n,colorBy:s,colorScale:$,showLegend:w,legendPosition:h,userMargin:A,defaults:k}),G=r(()=>{const e={};return z&&(e.legend=z,e.legendPosition=q),u&&"none"!==u&&(e.legendHoverBehavior=N.onLegendHover,e.legendClickBehavior=N.onLegendClick,e.legendHighlightedCategory=N.highlightedCategory,e.legendIsolatedCategories=N.isolatedCategories),e},[z,q,u,N.onLegendHover,N.onLegendClick,N.highlightedCategory,N.isolatedCategories]),V=function(e,n,o){if(!e)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),a=Math.floor((o-(i*(r+s)-s))/2);return t("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,o)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},vo),{position:"absolute",top:a+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}(S,C,M),X=V?null:function(e,n,o,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},mo),{width:n,height:o}),children:i||"No data available"}):null}(o,C,M,_);return{colorScale:$,allCategories:D,legendState:N,effectiveSelectionHook:W,activeSelectionHook:L,customHoverBehavior:B,customClickBehavior:I,legend:z,margin:E,legendPosition:q,earlyReturn:V||X||null,legendBehaviorProps:G,crosshairProps:R,resolvedSelection:F}}const wo=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,roundedTop:b,gradientFill:x=!1,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=xo({data:Z,rawData:a,colorBy:y,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"BarChart",chartId:P,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:z,height:E});if(J.earlyReturn)return J.earlyReturn;bo("BarChart",Z,"categoryAccessor",u),bo("BarChart",Z,"valueAccessor",d);const ee=Pn(Z,m,d),te=Cn(),ne=r(()=>new Map,[Z]),oe=r(()=>(e,t)=>{const n={};return n.fill=y?ue(e,y,J.colorScale):Mn(H,te,f,void 0,ne),n},[y,J.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return In(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},oe(t,n)),e(t,n)||{}):oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>Sn(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>En({categoryAccessor:u,valueAccessor:d,groupAccessor:y&&y!==u?y:void 0,groupLabel:"string"==typeof y?y:"group",valueFormat:p}),[u,d,y,p]),ae=Un({componentName:"BarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(qn,{componentName:"BarChart",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:v}),null!=b&&{roundedTop:b}),x&&{gradientFill:!0===x?{topOpacity:.8,bottomOpacity:.05}:x}),F&&{dataIdAccessor:F}),{baselinePadding:w,enableHover:q,showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:p}),W&&{oFormat:W}),{showGrid:G,showCategoryTicks:N,oSort:m}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Nn(A)||se}),(S||_||C||M)&&{customHoverBehavior:J.customHoverBehavior}),(_||C||S)&&{customClickBehavior:J.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"BarChart",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});function Ao({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:i="right"}){const a=s(new Set),l=s([]),[u,h]=d(0),g=c(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=c(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||a.current.has(t)||(a.current.add(t),l.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),y=c(e=>t=>{p([t]),e(t)},[p]),f=c(e=>t=>{p(t),e(t)},[p]),m=c(()=>{a.current=new Set,l.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!t||!1===o)return;const i=l.current;if(0===i.length)return;const r=Array.isArray(n)?n:le,s=new Map;for(let e=0;i.length>e;e++)s.set(i[e],r[e%r.length]);const a="string"==typeof t?t:"__streamCat";return jn({data:i.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:ue})},[e,t,o,n,u]),b=r(()=>{if(v)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[v,i]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function ko({ref:e,frameRef:t,isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const u=Ao({isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a}),d=c(u.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[u.wrapPush]),h=c(u.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[u.wrapPushMany]);return g(e,()=>({push:d,pushMany:h,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;u.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[d,h,u.resetCategories]),{effectiveLegendProps:r(()=>u.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:u.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,u.streamingLegend,a]),effectiveMargin:r(()=>{if(u.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(u.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,u.streamingMarginAdjust])}}wo.displayName="BarChart";const Oo=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,categoryFormat:N}=e,W=o.width,F=o.height,z=o.enableHover,E=o.showGrid,q=o.showLegend,G=o.title,V=o.description,X=o.summary,Y=o.accessibleTable,Q=o.categoryLabel,U=o.valueLabel,K=a||[],Z=y||d,J=void 0===a,ee=xo({data:K,rawData:a,colorBy:Z,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:W,height:F});if(ee.earlyReturn)return ee.earlyReturn;const te=Cn(),ne=r(()=>new Map,[K]),oe=r(()=>(e,t)=>Z?ee.colorScale?{fill:ue(e,Z,ee.colorScale)}:{}:{fill:Mn(H,te,f,t,ne)},[Z,ee.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return In(e&&"function"==typeof e?(t,n)=>{const o=oe(t,n),i=e(t,n)||{};return Object.assign(Object.assign({},o),i)}:oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>Sn(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=r(()=>En({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Un({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=ko({ref:n,frameRef:i,isPushMode:J,colorBy:Z,colorScheme:f,showLegend:q,legendPosition:I,setup:ee}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[W,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:p}),N&&{oFormat:N}),{showGrid:E}),le),G&&{title:G}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Nn(A)||se}),(S||_||C||M)&&{customHoverBehavior:ee.customHoverBehavior}),(_||C||S)&&{customClickBehavior:ee.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?t(qn,{componentName:"StackedBarChart",message:ae,width:W,height:F}):t(fo,{componentName:"StackedBarChart",width:W,height:F,children:t(dn,Object.assign({ref:i},de))})});Oo.displayName="StackedBarChart";const jo=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.showLegend,q=o.title,G=o.description,V=o.summary,X=o.accessibleTable,Y=o.categoryLabel,Q=o.valueLabel,U=a||[],K=y||d,Z=void 0===a,J=xo({data:U,rawData:a,colorBy:K,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"GroupedBarChart",chartId:M,showLegend:E,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=Cn(),te=r(()=>new Map,[U]),ne=k.pieceStyle,oe=r(()=>(e,t)=>{const n=K?J.colorScale?{fill:ue(e,K,J.colorScale)}:{}:{fill:Mn(I,ee,f,t,te)};if(ne){const o=ne(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[K,J.colorScale,I,ee,f,te,ne]),ie=r(()=>In(oe,{stroke:H,strokeWidth:R,opacity:$}),[oe,H,R,$]),re=r(()=>Sn(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>En({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Un({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=ko({ref:n,frameRef:i,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:E,legendPosition:B,setup:J}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:U}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Y,rLabel:Q,rFormat:p}),D&&{oFormat:D}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Nn(w)||se}),(j||S||_||C)&&{customHoverBehavior:J.customHoverBehavior}),(S||_||j)&&{customClickBehavior:J.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?t(qn,{componentName:"GroupedBarChart",message:ae,width:N,height:W}):t(fo,{componentName:"GroupedBarChart",width:N,height:W,children:t(dn,Object.assign({ref:i},de))})});function So({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const i=(a="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=kn({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=c(e=>{if(!e)return void l();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,n,o,a,l]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof o?o:"value")}),u=s(l.brushInteraction);u.current=l.brushInteraction;const d=c(e=>{if(i){u.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||n||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}jo.displayName="GroupedBarChart";const _o=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:W,showCategoryTicks:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.showLegend,X=o.title,Y=o.description,Q=o.summary,U=o.accessibleTable,K=o.categoryLabel,Z=o.valueLabel,J=a||[],ee=y||d,te=void 0===a,ne=r(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(J.map(e=>"function"==typeof u?u(e):e[u])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?E:z)-2*n)/(n-1))):1},[m,e.mode,J,u,g,z,E]),oe=xo({data:J,rawData:a,colorBy:ee,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"SwimlaneChart",chartId:M,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:z,height:E}),ie=So({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(oe.earlyReturn)return oe.earlyReturn;const re=Cn(),se=r(()=>new Map,[J]),ae=k.pieceStyle,le=r(()=>(e,t)=>{const n=ee?oe.colorScale?{fill:ue(e,ee,oe.colorScale)}:{}:{fill:Mn(I,re,f,t,se)};if(ae){const o=ae(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[ee,oe.colorScale,I,re,f,se,ae]),ce=r(()=>In(le,{stroke:H,strokeWidth:R,opacity:$}),[le,H,R,$]),de=r(()=>Sn(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),he=r(()=>En({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ge=Un({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:pe,effectiveMargin:ye}=ko({ref:n,frameRef:i,isPushMode:te,colorBy:ee,colorScheme:f,showLegend:V,legendPosition:B,setup:oe}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:J}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:ne,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===F?void 0:K,rLabel:Z,rFormat:p}),N&&{rTickValues:N}),null!=W&&{tickLabelEdgeAlign:W}),D&&{oFormat:D}),void 0!==F&&{showCategoryTicks:F}),{showGrid:G}),pe),X&&{title:X}),Y&&{description:Y}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Nn(v)||he}),(j||S||_||C)&&{customHoverBehavior:oe.customHoverBehavior}),(S||_||j)&&{customClickBehavior:oe.customClickBehavior}),b&&b.length>0&&{annotations:b}),ie.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?t(qn,{componentName:"SwimlaneChart",message:ge,width:z,height:E}):t(fo,{componentName:"SwimlaneChart",width:z,height:E,children:t(dn,Object.assign({ref:i},fe))})});_o.displayName="SwimlaneChart";const Co=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,brush:O,onBrush:j,linkedBrush:S,frameProps:_={},selection:C,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,chartId:B,loading:I,emptyContent:H,legendInteraction:R,legendPosition:$,color:D,stroke:N,strokeWidth:W,opacity:F,showCategoryTicks:z,categoryFormat:E}=e,q=o.width,G=o.height,V=o.enableHover,X=o.showGrid,Y=o.title,Q=o.description,U=o.summary,K=o.accessibleTable,Z=o.categoryLabel,J=o.valueLabel,ee=a||[],te=xo({data:ee,rawData:a,colorBy:y,colorScheme:f,legendInteraction:R,legendPosition:$,selection:C,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:B,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:I,emptyContent:H,width:q,height:G}),ne=So({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:d});if(te.earlyReturn)return te.earlyReturn;const oe=r(()=>{if(!m)return;const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m]),ie=Cn(),re=r(()=>new Map,[ee]),se=_.pieceStyle,ae=r(()=>(e,t)=>{const n={fillOpacity:x};if(n.fill=y?ue(e,y,te.colorScale):Mn(D,ie,f,void 0,re),n.r=m?function(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,m,v,oe):b,se){const o=se(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[y,te.colorScale,m,v,oe,b,x,D,ie,f,re,se]),le=r(()=>In(ae,{stroke:N,strokeWidth:W,opacity:F}),[ae,N,W,F]),ce=r(()=>Sn(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),de=r(()=>En({categoryAccessor:u,valueAccessor:d,groupAccessor:y||void 0,valueFormat:p}),[u,d,y,p]),he=Un({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(he)return t(qn,{componentName:"SwarmPlot",message:he,width:q,height:G});const ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[q,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:w,enableHover:V}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:J,rFormat:p}),E&&{oFormat:E}),{showGrid:X,showCategoryTicks:z}),te.legendBehaviorProps),Y&&{title:Y}),Q&&{description:Q}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Nn(A)||de}),(M||P||L||T)&&{customHoverBehavior:te.customHoverBehavior}),(P||L||M)&&{customClickBehavior:te.customClickBehavior}),k&&k.length>0&&{annotations:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"SwarmPlot",width:q,height:G,children:t(dn,Object.assign({ref:i},ge))})});function Mo(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",s=o.stats||(o.data||o).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Hn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e("div",{children:["n = ",s.n]}),null!=s.min&&e("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e("div",{children:["Q1: ",s.q1.toLocaleString()]}),e("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,s=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return e("div",{className:"semiotic-tooltip",style:Hn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&e("div",{children:["n = ",a]}),null!=l&&e("div",{children:["Median: ",l.toLocaleString()]})]})}return t("div",{className:"semiotic-tooltip",style:Hn,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}Co.displayName="SwarmPlot";const Po=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:B,strokeWidth:I,opacity:H,showCategoryTicks:R,categoryFormat:$}=e,D=o.width,N=o.height,W=o.enableHover,F=o.showGrid,z=o.title,E=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=a||[],Q=xo({data:Y,rawData:a,colorBy:y,colorScheme:f,legendInteraction:P,legendPosition:L,selection:A,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"BoxPlot",chartId:_,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:C,emptyContent:M,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Cn(),K=r(()=>new Map,[Y]),Z=r(()=>e=>{const t=y?ue(e,y,Q.colorScale):Mn(T,U,f,void 0,K);return{fill:t,stroke:t,fillOpacity:.8}},[y,Q.colorScale,T,U,f,K]),J=r(()=>In(Z,{stroke:B,strokeWidth:I,opacity:H}),[Z,B,I,H]),ee=r(()=>Sn(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=r(()=>Mo(),[]),ne=Un({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return t(qn,{componentName:"BoxPlot",message:ne,width:D,height:N});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:Y}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:m,size:[D,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:W}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:p}),$&&{oFormat:$}),{showGrid:F,showCategoryTicks:R}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===b?()=>null:Nn(b)||te}),(k||O||j||S)&&{customHoverBehavior:Q.customHoverBehavior}),(O||j||k)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"BoxPlot",width:D,height:N,children:t(dn,Object.assign({ref:i},oe))})});Po.displayName="BoxPlot";const Lo=h(function(n,o){const i=Tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",bins:p=25,relative:y=!1,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=n,z=i.width,E=i.height,q=i.enableHover,G=i.showGrid,V=i.title,X=i.description,Y=i.summary,Q=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Z=l||[],J=xo({data:Z,rawData:l,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=So({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=r(()=>{if(0===Z.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of Z){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[Z,h]),ne=Cn(),oe=r(()=>new Map,[Z]),ie=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Mn(R,ne,v,void 0,oe);return{fill:t,stroke:t,fillOpacity:.8}},[m,J.colorScale,R,ne,v,oe]),re=r(()=>In(ie,{stroke:$,strokeWidth:D,opacity:N}),[ie,$,D,N]),se=r(()=>Sn(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return e("div",{className:"semiotic-tooltip",style:Hn,children:[i&&t("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&e("div",{children:["Count: ",r]}),s&&2===s.length&&e("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=Un({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return t(qn,{componentName:"Histogram",message:le,width:z,height:E});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:p,normalize:y}),te&&{rExtent:te}),{size:[z,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:Nn(x)||ae}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"Histogram",width:z,height:E,children:t(dn,Object.assign({ref:a},ce))})});Lo.displayName="Histogram";const To=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=xo({data:Z,rawData:a,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=So({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:d});if(J.earlyReturn)return J.earlyReturn;const te=Cn(),ne=r(()=>new Map,[Z]),oe=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Mn(R,te,v,void 0,ne);return{fill:t,stroke:t,fillOpacity:.6}},[m,J.colorScale,R,te,v,ne]),ie=r(()=>In(oe,{stroke:$,strokeWidth:D,opacity:N}),[oe,$,D,N]),re=r(()=>Sn(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Mo({valueAccessor:d}),[d]),ae=Un({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(qn,{componentName:"ViolinPlot",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:p,showIQR:y,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Nn(x)||se}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"ViolinPlot",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});To.displayName="ViolinPlot";const Bo=h(function(e,n){var o;const i=Tn(e.mode,{width:e.width,height:e.height,showGrid:null===(o=e.showGrid)||void 0===o||o,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null);g(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.title,q=i.description,G=i.summary,V=i.accessibleTable,X=i.categoryLabel,Y=i.valueLabel,Q=l||[],U=xo({data:Q,rawData:l,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"DotPlot",chartId:M,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Pn(Q,v,h),Z=Cn(),J=r(()=>new Map,[Q]),ee=k.pieceStyle,te=r(()=>(e,t)=>{const n={r:b,fillOpacity:.8};if(n.fill=f?ue(e,f,U.colorScale):Mn(I,Z,m,void 0,J),ee){const o=ee(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[f,U.colorScale,b,I,Z,m,J,ee]),ne=r(()=>In(te,{stroke:H,strokeWidth:R,opacity:$}),[te,H,R,$]),oe=r(()=>Sn(ne,U.effectiveSelectionHook,U.resolvedSelection),[ne,U.effectiveSelectionHook,U.resolvedSelection]),ie=r(()=>En({categoryAccessor:d,valueAccessor:h,valueFormat:y}),[d,h,y]),re=Un({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return t(qn,{componentName:"DotPlot",message:re,width:N,height:W});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:y}),D&&{oFormat:D}),{showGrid:z,oSort:v}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),u&&{className:u}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Nn(w)||ie}),(j||S||_||C)&&{customHoverBehavior:U.customHoverBehavior}),(S||_||j)&&{customClickBehavior:U.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"DotPlot",width:N,height:W,children:t(dn,Object.assign({ref:a},se))})});Bo.displayName="DotPlot";const Io=h(function(e,n){var o,i;const a=Tn(e.mode,{width:null!==(o=e.width)&&void 0!==o?o:400,height:null!==(i=e.height)&&void 0!==i?i:400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks}),l=s(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=a.width,R=a.height,$=a.enableHover,D=a.showLegend,N=a.title,W=a.description,F=a.summary,z=a.accessibleTable,E=c||[],q=p||h,G=void 0===c,V=xo({data:E,rawData:c,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"PieChart",chartId:S,showLegend:D,userMargin:u,marginDefaults:a.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=Cn(),Y=r(()=>new Map,[E]),Q=r(()=>(e,t)=>q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Mn(L,X,y,t,Y)},[q,V.colorScale,L,X,y,Y]),U=r(()=>{const e=null==x?void 0:x.pieceStyle;return In(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Q(t,n)),e(t,n)||{}):Q,{stroke:T,strokeWidth:B,opacity:I})},[Q,x,T,B,I]),K=r(()=>Sn(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),Z=r(()=>En({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),J=Un({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=ko({ref:n,frameRef:l,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:E}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,startAngle:f}),null!=m&&{cornerRadius:m}),{size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Nn(v)||Z}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(qn,{componentName:"PieChart",message:J,width:H,height:R}):t(fo,{componentName:"PieChart",width:H,height:R,children:t(dn,Object.assign({ref:l},ne))})});Io.displayName="PieChart";const Ho=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=o.width,R=o.height,$=o.enableHover,D=o.showLegend,N=o.title,W=o.description,F=o.summary,z=o.accessibleTable,E=a||[],q=p||u,G=void 0===a,V=xo({data:E,rawData:a,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"DonutChart",chartId:S,showLegend:D,userMargin:l,marginDefaults:o.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(H,R)),Y=Cn(),Q=r(()=>new Map,[E]),U=x.pieceStyle,K=r(()=>(e,t)=>{let n;if(n=q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Mn(L,Y,y,t,Q)},U){const o=U(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[q,V.colorScale,L,Y,y,Q,U]),Z=r(()=>In(K,{stroke:T,strokeWidth:B,opacity:I}),[K,T,B,I]),J=r(()=>Sn(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=r(()=>En({categoryAccessor:u,valueAccessor:d,groupAccessor:p&&p!==u?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[u,d,p]),te=Un({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:ne,effectiveMargin:oe}=ko({ref:n,frameRef:i,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:E}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:f}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ne),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Nn(v)||ee}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?t(qn,{componentName:"DonutChart",message:te,width:H,height:R}):t(fo,{componentName:"DonutChart",width:H,height:R,children:t(dn,Object.assign({ref:i},ie))})});Ho.displayName="DonutChart";const Ro=h(function(n,o){const i=Tn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),a=s(null),l="context"===n.mode,{compactMode:c}=i,{value:u,min:d=0,max:h=100,thresholds:g,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!c,sweep:A=240,fillZones:k=!0,tooltip:O,annotations:j,frameProps:S={},className:_,stroke:C,strokeWidth:M,opacity:P}=n,L=i.width,T=i.height,B=i.title,I=i.description,H=i.summary,R=i.accessibleTable,$=Math.max(d,Math.min(h,u)),D=h-d||1,N=($-d)/D,{gaugeData:W,pieceStyle:F,gaugeAnnotations:z}=r(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:p||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let i=d;for(let n=0;o.length>n;n++){const r=o[n],s=(r.value-i)/D;if(k){const o=(i-d)/D,a=Math.max(0,Math.min(N,(r.value-d)/D)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:r.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:y,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}i=r.value}if(w&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:y},gaugeAnnotations:n}},[u,d,h,g,p,y,N,D,w,k]),E=r(()=>In(F,{stroke:C,strokeWidth:M,opacity:P}),[F,C,M,P]),q=A*Math.PI/180,G=180+(360-A)/2,V=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+G*Math.PI/180,Y=[[Math.cos(X),Math.sin(X)],[Math.cos(X+q),Math.sin(X+q)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>q+.001||Y.push([Math.cos(e),Math.sin(e)]);const Q=Math.min(...Y.map(e=>e[0])),U=Math.max(...Y.map(e=>e[0])),K=Math.min(...Y.map(e=>e[1])),Z=Math.max(...Y.map(e=>e[1])),J=(K+Z)/2,ee=(Q+U)/2,te=Math.max(4,Math.min((L-2*V)/(U-Q),(T-2*V)/(Z-K))-2),ne=Math.max(0,Math.min(te-1.5,te*(1-f))),oe=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b($,d,h):b;const n=x?x($):Math.round($)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),w&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[b,$,d,h,x,w,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x($):Math.round($)+""}:null,[l,b,$,x]),le=r(()=>{if(!m)return null;const e=-Math.PI/2+G*Math.PI/180+N*q,t=ne>20?ne-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,N,G,q,ne,v]),ce=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-ne),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return e("g",{transform:`translate(${r},${s})`,children:[t("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const e=-Math.PI/2+G*Math.PI/180+(n.value-d)/D*q,r=ne-14,s=(i.height||T)/2;return t("text",{x:(i.width||L)/2+Math.cos(e)*r,y:s+Math.sin(e)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label},"gauge-label-"+o)}return"gauge-value"===n.type?t("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*ne,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[L,T,d,D,G,q,ne,te]),ue=r(()=>{const e=[...z,...j||[]];return le&&e.push(le),ae&&e.push(ae),e},[z,j,le,ae]),de=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return e("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[t("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),t("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round($):"Remaining"})]})},[$]);if(0===W.length)return t(qn,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:ne,startAngle:G,sweepAngle:A,centerContent:se,size:[L,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:oe-re/2,right:L-oe-re/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Nn(O)||de,svgAnnotationRules:ce},ue.length>0&&{annotations:ue}),B&&{title:B}),I&&{description:I}),H&&{summary:H}),void 0!==R&&{accessibleTable:R}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),S);return t(fo,{componentName:"GaugeChart",width:L,height:T,children:t(dn,Object.assign({ref:a},he))})});Ro.displayName="GaugeChart";const $o=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.title,q=o.description,G=o.summary,V=o.accessibleTable,X=o.categoryLabel,Y=o.valueLabel,Q=a||[],U=xo({data:Q,rawData:a,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"RidgelinePlot",chartId:C,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:M,emptyContent:P,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Cn(),Z=r(()=>new Map,[Q]),J=r(()=>e=>{const t=m?ue(e,m,U.colorScale):Mn(B,K,v,void 0,Z);return{fill:t,stroke:t,fillOpacity:.5}},[m,U.colorScale,B,K,v,Z]),ee=r(()=>In(J,{stroke:I,strokeWidth:H,opacity:R}),[J,I,H,R]),te=r(()=>Sn(ee,U.effectiveSelectionHook,U.resolvedSelection),[ee,U.effectiveSelectionHook,U.resolvedSelection]),ne=r(()=>Mo(),[]),oe=Un({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return t(qn,{componentName:"RidgelinePlot",message:oe,width:N,height:W});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:Q}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:p,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:b,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:f}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:$,oSort:!1,amplitude:y}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Nn(x)||ne}),(O||j||S||_)&&{customHoverBehavior:U.customHoverBehavior}),(j||S||O)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"RidgelinePlot",width:N,height:W,children:t(dn,Object.assign({ref:i},ie))})});$o.displayName="RidgelinePlot";const Do=h(function(n,o){const i=Tn(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:p,colorBy:y,colorScheme:f,orientation:m="horizontal",connectorOpacity:v=.3,showLabels:b=!0,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,categoryFormat:$}=n,D="vertical"===m,N=i.width,W=i.height,F=i.enableHover,z=i.title,E=i.description,q=i.summary,G=i.accessibleTable,V=l||[],X=y||p,Y=!X,Q=xo({data:V,rawData:l,colorBy:X,colorScheme:f,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"FunnelChart",chartId:C,showLegend:i.showLegend,userMargin:c,marginDefaults:D?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:P,width:N,height:W});if(Q.earlyReturn)return Q.earlyReturn;bo("FunnelChart",V,"stepAccessor",d),bo("FunnelChart",V,"valueAccessor",h);const U=Cn(),K=r(()=>new Map,[V]),Z=r(()=>{if(Y)return B||((null==U?void 0:U[0])?U[0]:Array.isArray(f)&&f[0]?f[0]:"#4e79a7")},[Y,B,U,f]),J=A.pieceStyle,ee=r(()=>(e,t)=>{const n={};if(n.fill=Z||(X?ue(e,X,Q.colorScale):Mn(B,U,f,t,K)),J){const o=J(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Z,X,Q.colorScale,B,U,f,K,J]),te=r(()=>In(ee,{stroke:I,strokeWidth:H,opacity:R}),[ee,I,H,R]),ne=r(()=>Sn(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,p=null==c?void 0:c.__barFunnelIsDropoff,y=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,f=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return e("div",{className:"semiotic-tooltip",style:Hn,children:[u&&t("div",{style:{fontWeight:"bold"},children:u+""}),y&&y!==u&&t("div",{style:{marginTop:2,opacity:.8},children:y+""}),p&&t("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e("div",{style:{marginTop:4},children:[d+"",f]})]})},[]),ie=Un({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(ie)return t(qn,{componentName:"FunnelChart",message:ie,width:N,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:D?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:d,rAccessor:h}),p&&{stackBy:p}),{projection:D?"vertical":"horizontal",barPadding:D?40:0,pieceStyle:ne,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:D,showCategoryTicks:D}),$&&{oFormat:$}),{showGrid:D}),!D&&{connectorOpacity:v}),{showLabels:b}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:!0===x||null==x?oe:Nn(x)||oe}),(O||j||S||_)&&{customHoverBehavior:Q.customHoverBehavior}),(j||S||O)&&{customClickBehavior:Q.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"FunnelChart",width:N,height:W,children:t(dn,Object.assign({ref:a},re))})});Do.displayName="FunnelChart";const No={RdBu:H,PiYG:I,PRGn:B,BrBG:T,RdYlBu:L,RdYlGn:P,Spectral:M},Wo="__likert_neutral_neg",Fo="__likert_neutral_pos";function zo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Eo(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function qo(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Wo,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Fo,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Go(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===Wo?r=n:n.__likertLevel===Fo?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Vo=h(function(e,n){const i=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null),{data:l,margin:u,className:d,categoryAccessor:h="question",valueAccessor:p,levelAccessor:y,countAccessor:f="count",levels:m,orientation:v="horizontal",colorScheme:b,barPadding:x=20,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,valueFormat:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,categoryFormat:H,stroke:R,strokeWidth:$,opacity:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.showLegend,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,Q=i.valueLabel,U="horizontal"===v,K=void 0===l,Z=!y,J=function(){var e;const t=_n();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ee=r(()=>b&&Array.isArray(b)&&b.length>=m.length?b:function(e,t){if(0>=e)return[];if(t){const n=No[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(m.length,J),[b,m.length,J]),te=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],ee[t]||"#888");return e},[m,ee]),{processedData:ne,reAggregate:oe,accumulatorRef:ie}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:u}){const d=!i,h=r(()=>zo(n,"question"),[n]),g=r(()=>d?zo(o,"score"):null,[d,o]),p=r(()=>d?null:zo(i,"level"),[d,i]),y=r(()=>d?null:zo(a,"count"),[d,a]),f=e||[],m=s([]),v=r(()=>{if(0===f.length)return[];let e=Eo(f,t,h,g,p,y);return l&&(e=qo(e,t),e=Go(e,t)),e},[f,t,h,g,p,y,l]),b=c(e=>{var n;let o=Eo(e,t,h,g,p,y);l&&(o=qo(o,t),o=Go(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,p,y,l,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:m,categoryAccessor:h,valueAccessor:p,levelAccessor:y,countAccessor:f,isDiverging:U,frameRef:a}),re="__likertLevelLabel",se=Ao({isPushMode:K,colorBy:re,colorScheme:ee,showLegend:E,legendPosition:I}),ae=c(se.wrapPush(e=>{ie.current.push(e),oe(ie.current)}),[se.wrapPush,oe,ie]),le=c(se.wrapPushMany(e=>{ie.current.push(...e),oe(ie.current)}),[se.wrapPushMany,oe,ie]);g(n,()=>({push:ae,pushMany:le,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ie.current=[],se.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:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ae,le,se.resetCategories,ie]);const ce=xo({data:ne,rawData:l,colorBy:re,colorScheme:ee,legendInteraction:B,legendPosition:I,selection:O,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"LikertChart",chartId:M,showLegend:E,userMargin:u,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:N,height:W});if(ce.earlyReturn)return ce.earlyReturn;const ue=r(()=>{const e=m.length;return e%2!=0&&te.get(m[Math.floor(e/2)])||"#888"},[m,te]),de=k.pieceStyle,he=r(()=>(e,t)=>{var n,o;const i=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),r=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let s;if(r===Wo||r===Fo)s={fill:ue};else{const e=i||r;s=e&&te.has(e)?{fill:te.get(e)}:{fill:"#888"}}if(de){const n=de(e,t);n.stroke&&(s.stroke=n.stroke),null!=n.strokeWidth&&(s.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(s.strokeOpacity=n.strokeOpacity)}return s},[te,ue,de]),ge=r(()=>In(he,{stroke:R,strokeWidth:$,opacity:D}),[he,R,$,D]),pe=r(()=>Sn(ge,ce.effectiveSelectionHook,ce.resolvedSelection),[ge,ce.effectiveSelectionHook,ce.resolvedSelection]),ye=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),fe=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===Wo||n===Fo?ye:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===Wo||n===Fo?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:Hn},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ye]),me=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!f)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Z?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),f&&(e.countAccessor=f)),Un({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:m}})},[l,h,p,y,f,m,Z]),ve=r(()=>[{styleFn:e=>({fill:te.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,te]),be=r(()=>!1!==E?Object.assign(Object.assign({},ce.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:I||ce.legendPosition||"bottom"}):ce.legendBehaviorProps,[ce.legendBehaviorProps,ce.legendPosition,I,E,ve]),xe=r(()=>{const e=Object.assign({},ce.margin);if(K&&!1!==E){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(se.streamingMarginAdjust)for(const[t,n]of Object.entries(se.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[ce.margin,se.streamingMarginAdjust,U,K,E,I]),we=r(()=>P||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,P]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:ne}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:pe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q||(U?void 0:"Percentage"),rFormat:we}),H&&{oFormat:H}),{showGrid:z}),be),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:!0===w?fe:Nn(w)||fe}),(j||S||_||C)&&{customHoverBehavior:ce.customHoverBehavior}),(S||_||j)&&{customClickBehavior:ce.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return me?t(qn,{componentName:"LikertChart",message:me,width:N,height:W}):t(fo,{componentName:"LikertChart",width:N,height:W,children:t(dn,Object.assign({ref:a},Ae))})});Vo.displayName="LikertChart";export{wo as BarChart,Po as BoxPlot,Ho as DonutChart,Bo as DotPlot,Do as FunnelChart,Ro as GaugeChart,jo as GroupedBarChart,Lo as Histogram,Vo as LikertChart,Io as PieChart,$o as RidgelinePlot,Oo as StackedBarChart,dn as StreamOrdinalFrame,Co as SwarmPlot,_o as SwimlaneChart,To as ViolinPlot,Jt as createHatchPattern};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useEffect as i,useMemo as r,useRef as s,createContext as a,useContext as l,useCallback as c,useSyncExternalStore as u,useState as d,forwardRef as h,useImperativeHandle as g,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as f,scaleBand as m}from"d3-scale";import{quadtree as v}from"d3-quadtree";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as w,interpolatePurples as A,interpolateOranges as k,interpolateGreens as O,interpolateReds as j,interpolateBlues as S,schemeSet3 as _,schemeTableau10 as C,interpolateSpectral as M,interpolateRdYlGn as P,interpolateRdYlBu as L,interpolateBrBG as T,interpolatePRGn as B,interpolatePiYG as I,interpolateRdBu as H}from"d3-scale-chromatic";import{quantile as R}from"d3-array";import{packEnclose as $}from"d3-hierarchy";import{area as D,curveCatmullRom as N,curveCardinal as W,curveBasis as F,curveStepBefore as z,curveStepAfter as E,curveStep as q,curveMonotoneY as G,curveMonotoneX as V,curveLinear as X,arc as Y}from"d3-shape";import Q from"regression";import{select as U}from"d3-selection";import{brushX as K,brushY as Z}from"d3-brush";class J{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class ee{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class te{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 ne(e,t,n){return e+(t-e)*n}function oe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ie(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function re(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const se={category10:b,tableau10:C,set3:_,blues:S,reds:j,greens:O,oranges:k,purples:A,viridis:w,plasma:x},ae=b,le=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ce=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 ue(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")||ce.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):ae[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+""))%ae.length]}function de(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const r=se[n]||se.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ae;return y().domain(o).range(e).unknown("#999")}}function he(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function ge(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function pe(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=R(e,.25))&&void 0!==t?t:r,median:null!==(n=R(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=R(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}const ye={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],p="vertical"===h,y="horizontal"===h,f=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;f&&n>0&&(a/=n);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(p){const t=d(0>a?i:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);g.push(he(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(y){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);g.push(he(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(r,Math.min(a,d),o,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(Math.min(a,d),r,Math.abs(d-a),o,g,i,h[s]))}}}}const y=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);y>0&&(e.roundedTop=y),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(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:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:ge,donut:ge,boxplot:function(e,t){var n,o,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:p}=l,y=[],f="vertical"===p,m=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],p=null!==(n=R(l,.25))&&void 0!==n?n:c,v=null!==(o=R(l,.5))&&void 0!==o?o:(c+u)/2,b=null!==(i=R(l,.75))&&void 0!==i?i:u,x=b-p,w=p-1.5*x,A=b+1.5*x,k=null!==(r=l.find(e=>e>=w))&&void 0!==r?r:c,O=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:u,j=h(t.pieceData[0],t.name),S=[];if(m)for(const e of t.pieceData){const n=d(e);if(w>n||n>A){const o=f?t.middle:g(n),i=f?g(n):t.middle;S.push({px:o,py:i,value:n,datum:e})}}if(y.push({type:"boxplot",x:f?t.middle:0,y:f?0:t.middle,projection:f?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(k),q1Pos:g(p),medianPos:g(v),q3Pos:g(b),maxPos:g(O),stats:{n:l.length,min:k,q1:p,median:v,q3:b,max:O,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:S}),m)for(const t of S)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(r)}`;for(let t=0;p>t;t++){const n=u(r+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(r+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(r)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(r+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(r+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=R(t,.25))&&void 0!==n?n:r,l=null!==(o=R(t,.5))&&void 0!==o?o:(r+s)/2,c=null!==(i=R(t,.75))&&void 0!==i?i:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(r)),width:e.width,height:Math.abs(u(s)-u(r))}:{x:Math.min(u(r),u(s)),y:e.x,width:Math.abs(u(s)-u(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:pe(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,y=Math.max(...r,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/y)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(he(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/p*f}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/p*f} ${n}`}m+=` 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:m,translateX:0,translateY:0,bounds:v,stats:pe(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(he(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(he(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],A=[];let k=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(o);i.total+=r,i.pieces.push(o),n+=r}A.push({col:e,groups:t,stepTotal:n}),w||n>k&&(k=n)}if(w)for(const e of A){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>k&&(k=o)}if(0===k)return p;const O=new Map;for(const e of b){const t=A[0].groups.get(e);O.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const j=A[0].stepTotal,S=w?.95*y:.9*t.width,_=f().domain([0,k]).range([0,S]),C=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let M=new Map;for(let t=0;A.length>t;t++){const n=A[t],o=n.col,u=0===t,d=o.width,h=.55*d,f=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=y,i=y;for(let r=0;b.length>r;r++){const a=b[r],l=n.groups.get(a);if(!l)continue;const c=_(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const w=g(l.pieces[0],a),A=null!==(s=O.get(a))&&void 0!==s?s:l.total,k=A>0?l.total/A*100:0,j=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});m&&(0===r&&(j.__funnelStepLabel=o.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=f,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+c/2,j.__funnelValueLabelY=f,j.__funnelBarW=c),p.push(he(x,f,c,h,w,j,a)),v.set(a,{x:x,y:f,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),s=y-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=n.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],d=l?a:o.name,x=g(c,d),w=j>0?e/j*100:0,A=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:u,category:l?a:o.name});m&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=y,A.__funnelStepLabelY=f,A.__funnelRowWidth=t,A.__funnelValueLabelX=y,A.__funnelValueLabelY=f,A.__funnelBarW=t),p.push(he(s,f,t,h,x,A,d)),v.set(a,{x:s,y:f,w:t,h:h})}if(t>0&&M.size>0){const t=w?b:[b[0]];for(const i of t){const t=M.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:C},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};p.push(u)}}M=v}return p},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(i=m.get(h))&&void 0!==i?i:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),A=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:f,k=o?0:Math.max(0,A-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,_=c(p.pieces[0],y?h:n.name),C=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(he(O,j,u,S,_,C,y?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},_),i=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(he(O,e,u,t,o,i,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:i,getStack:r,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(i(n));if(0===o)continue;const l=r?r(n):e.name,d=s(n,l);if(u){const i=a(t),r=a(t+o);c.push(he(i,e.x,r-i,e.width,d,n,l))}else{const i=a(t+o),r=a(t);c.push(he(e.x,i,e.width,r-i,d,n,l))}t+=o}}return c}};class fe{constructor(e){this.rExtent=new te,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new ee(e.windowSize),this.getO=re(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new te)):(this.getR=ie(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=re(e.stackBy),this.getGroup=re(e.groupBy),this.getColor=re(e.colorAccessor),this.getConnector=re(e.connectorAccessor),this.getDataId=re(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new ee(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=m().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=f().domain(s).range([o,n])}else a?(u=m().domain(r).range([0,e.height]).padding(c),d=f().domain(s).range([0,e.width])):(u=m().domain(r).range([0,e.width]).padding(c),d=f().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?f().domain([l,c]).range([0,e.width]):f().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),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>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=ye[this.config.chartType];let i=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(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:this.config.themeCategorical||le,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,fe.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=v().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let A=!1;const k=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,O);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(k.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),A=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("rect"===c.type)d?(k.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,A=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("wedge"===c.type)if(d)k.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,A=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),A=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!k.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(f=t.innerRadius)&&void 0!==f?f:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}A=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),A&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(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),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=ne(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=ne(o.x,e._targetX,s),e.y=ne(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=ne(o.r,e._targetR,s))}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=ne(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=ne(n.x,e._targetX,s),e.y=ne(n.y,e._targetY,s),void 0!==n.w&&(e.w=ne(n.w,e._targetW,s),e.h=ne(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ne(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=ne(n.startAngle,e._targetStartAngle,s),e.endAngle=ne(n.endAngle,e._targetEndAngle,s))}}}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&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!oe(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!oe(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(oe(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=re(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!oe(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new te)):(this.getR=ie(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!oe(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?re(this.config.stackBy):void 0),"groupBy"in e&&!oe(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?re(this.config.groupBy):void 0),"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?re(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!oe(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?re(this.config.connectorAccessor):void 0)}}function me(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ve(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function be(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 xe(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>me(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function we(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=ve(Math.atan2(i,o)),a=ve(e.startAngle),l=ve(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Ae(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ke(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Oe(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function je(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})}fe.QUADTREE_THRESHOLD=500;const Se={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function _e(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,Se[n])(o(e,t)),i}function Ce(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Me(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Pe=(n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=n,y=[];let f=0;const m=!(!o&&!i),v="isolate"===d||void 0===d&&null!=s;return p.forEach((n,d)=>{const b=_e(n,d,h,g),x=Me(n,r,s),w=s&&s.size>0&&s.has(n.label);y.push(e("g",{transform:`translate(0,${f})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?w||!1:void 0,"aria-current":m&&!v&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),f+=22}),y};function Le({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&t("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),t("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),t("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let e=0;64>=e;e++){const n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[l&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function Te(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical"}=n,[p,y]=o.useState(0),[f,m]=o.useState(0),v=o.useCallback((e,t)=>{y(e),m(t)},[]),b="vertical"===g?(({legendGroups:e,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,g)=>{d+=5,h.push(t("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,e.label&&(d+=16,h.push(t("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),d+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${d})`,children:Pe(e,o,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*e.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const p=[];n.forEach((n,o)=>{let y=0;n.label&&(y+=16);const f=((n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:p,items:y}=n,f=[];let m=0,v=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=s;y.forEach((n,d)=>{const w=_e(n,d,g,p),A=Me(n,r,s),k=s&&s.size>0&&s.has(n.label),O=26+7*n.label.length;h&&h>0&&m>0&&m+O>h&&(v++,m=0),f.push(e("g",{transform:`translate(${m},${22*v})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&d===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?k||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,k&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=O});let w=0,A=0;for(const e of y){const t=26+7*e.label.length;h&&h>0&&A>0&&A+t>h?(w=Math.max(w,A),A=t):A+=t}w=Math.max(w,A);const k=v+1;return{items:f,offset:w,totalRows:k,totalHeight:22*k}})(n,r,s,a,l,c,u,o,d,h,i);y+=f.offset+5,p.push(Object.assign(Object.assign({label:n.label},f),{offset:y,totalRows:f.totalRows,totalHeight:f.totalHeight})),g+=y+12});let y=g>i?0:Math.max(0,(i-g)/2);const f=[];return p.forEach((e,i)=>{const r=n[i];r.label&&(f.push(t("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),y+=16),f.push(t("g",{className:"legend-item",transform:`translate(${y},0)`,children:e.items},"legend-group-"+i)),y+=e.offset+5,n[i+1]&&f.push(t("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(e.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),t("g",{children:f})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}),x=!(!r&&!s);return e("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&t("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function Be(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ie(e){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=r.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=i-r.bottom+50):(p=o-r.right+10,y=r.top),t("g",{transform:`translate(${p}, ${y})`,children:(f=n,"object"==typeof f&&null!==f&&"gradient"in f?t(Le,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Be(n)?t(Te,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var f}function He(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Re(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function $e(n,o,i,r){if(!n)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===g?p="end":"middle"===g&&(p="middle"):p=0>o?"end":"start";const y=16,f=a?d?[a]:He(a,u):[],m=s?d?[s]:He(s,u):[],v="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(x.push(t("text",{className:"annotation-note-title",fill:w,textAnchor:p,fontWeight:"bold",children:f.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-title")),b=f.length*y),m.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:p,y:b,children:m.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-label"));let A=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const e=Math.min(u,120);let n=0,o=e;"end"===p?(n=-e,o=0):"middle"===p&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+m.length)*y+(m.length>0?y:0);let n=0,o=e;"bottom"===g?(n=-e,o=0):"middle"===g&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,f.length+m.length-1)*y;let O=0;return"topBottom"===h?O=0>i?-(k+2):18:"leftRight"===h&&(O="middle"===g?-(k+y+(m.length>0&&f.length>0?2:0))/2+8:"bottom"===g||0>i?-(k+2):18),e("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),A]})}function De(e,n,o,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-e;a.push(t("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(t("line",{x1:(n.x1||0)-e,y1:i,x2:(n.x2||0)-e,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(t("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==e&&a.push(t("path",{d:Re((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function Ne(e,n,o,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const t=s.width||0,o=s.height||0;if(t>0||o>0){const i=t/2,r=o/2,s=e-i,a=n-r;if(0!==s||0!==a){const e=Math.abs(s),n=Math.abs(a),u=t/2,d=o/2,h=e*d>n*u?u/e:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const o=Math.atan2(n,e);l=Math.cos(o)*t,c=Math.sin(o)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(n-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:a})}function We(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y,{children:[!m.has("connector")&&Ne(v,b,c,h,x,u),!m.has("subject")&&De(x,u,h,n,o),!m.has("note")&&$e(l,v,b,h)]}))}function Fe(e){var n,o;const{noteData:i}=e,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const e=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:e,ny:a});return t(We,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(We,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function ze(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 Ee(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 qe(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){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,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return 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=ze(e,n),c=Ee(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"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ge(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ve={linear:X,monotoneX:V,monotoneY:G,step:q,stepAfter:E,stepBefore:z,basis:F,cardinal:W,catmullRom:N};function Xe(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=o,{rTickValues:p}=o,y="radial"===(null==u?void 0:u.projection),f="horizontal"===(null==u?void 0:u.projection),m=r(()=>!u||y?[]:(p||u.r.ticks(5)).map(e=>({value:e,pixel:u.r(e),label:(g||Ye)(e)})),[u,g,y,p]),v=h&&u&&!y,b=d&&u&&!y;return v||b?t("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${c.left},${c.top})`,children:[v&&t("g",{className:"ordinal-grid",children:m.map((e,n)=>t("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:i,y2:f?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),b&&t(n,{children:e(n,f?{children:[t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Ye(e){return Math.round(100*e)/100+""}function Qe(o){var i,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:p,showCategoryTicks:y,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:A,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:_="right",foregroundGraphics:C,annotations:M,svgAnnotationRules:P,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:I,children:H}=o,R="radial"===(null==g?void 0:g.projection),N="horizontal"===(null==g?void 0:g.projection),W=!1!==y,F=r(()=>p&&W&&g&&!R?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[p,W,g,v,R]),z=o.rTickValues,E=o.tickLabelEdgeAlign,q=r(()=>p&&g&&!R?(z||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||Ye)(e)})):[],[p,g,b,R,z]),G=s(new Map),V=s(null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0),Y=null!==(a=null==M?void 0:M.length)&&void 0!==a?a:0;V.current!==Y&&(V.current=Y,G.current=new Map);const U=r(()=>{if(!M||0===M.length)return null;const n=function(n,o,i){var r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j,S,_,C,M,P,L,T,B,I,H,R,N,W,F,z,E,q,G,V,Y,U,K,Z,J,ee,te,ne;switch(n.type){case"label":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=ze(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ee(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=$(r),a=n.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return e("g",{children:[t("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const e=i.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,o)=>{const r=ze(e,i),a=Ee(e,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const e=ze(n,i),r=Ee(n,i);return t(Fe,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",p=i.yAccessor||"y",y=h.map(e=>[e[g],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!f||!m)return null;const v=n.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=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],p+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(y,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?Q.polynomial(y,{order:n.order||2}):Q.linear(y)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=n.color||"#6366f1";return e("g",{children:[t("polyline",{points:x,fill:"none",stroke:w,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:f(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:w,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(p=i.scales)||void 0===p?void 0:p.value,s=null!==(y=null==r?void 0:r(n.y0))&&void 0!==y?y:0,a=null!==(f=null==r?void 0:r(n.y1))&&void 0!==f?f:i.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(w=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==w?w:null===(A=i.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ve[i.curve||"linear"]||X,p=D().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const y=n.fill||"#6366f1";return e("g",{children:[t("path",{d:p,fill:y,fillOpacity:null!==(k=n.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),n.label&&h.length>0&&t("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(j=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==j?j:null===(S=i.scales)||void 0===S?void 0:S.time,l=null!==(C=null===(_=i.scales)||void 0===_?void 0:_.y)&&void 0!==C?C:null===(M=i.scales)||void 0===M?void 0:M.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-g*h,y=!1!==n.showBand,f=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(T=n.anomalyRadius)&&void 0!==T?T:6,x=l(u+g*h),w=l(p),A=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return e("g",{children:[y&&t("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:f,fillOpacity:m}),A.map((e,n)=>{const o=ze(e,i),r=Ee(e,i);return null==o||null==r?null:t("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:f,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(I=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(H=i.scales)||void 0===H?void 0:H.time,c=null!==(N=null===(R=i.scales)||void 0===R?void 0:R.y)&&void 0!==N?N:null===(W=i.scales)||void 0===W?void 0:W.value;if(!l||!c)return null;const u=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=Q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;d=e=>a+s*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(h-2,1)),y=u.reduce((e,t)=>e+t[0],0)/h,f=u.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(F=n.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=n.steps)&&void 0!==z?z:5,x=u[h-1][0],w=(x-u[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=p*Math.sqrt(1+1/h+(f>0?Math.pow(e-y,2)/f:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${k.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,j=k.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),S=`${l(x)},${c(d(x))}`,_=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(E=n.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),t("polyline",{points:`${S} ${j}`,fill:"none",stroke:_,strokeWidth:null!==(q=n.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&k.length>0&&t("text",{x:l(k[k.length-1].x)+4,y:c(k[k.length-1].yCenter)-4,fill:_,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=qe(n,o,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ge(e,r,i))return null;const s=null!==(V=n.dx)&&void 0!==V?V:0,a=null!==(Y=n.dy)&&void 0!==Y?Y:0,l=null!==(U=n.width)&&void 0!==U?U:32,c=null!==(K=n.height)&&void 0!==K?K:32,u=null!==(Z=n.content)&&void 0!==Z?Z:t("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return e("g",(i.projection?"vertical"===i.projection:c===a)?{children:[t("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:g}),p&&t("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[t("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),p&&t("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o="horizontal"===(null==g?void 0:g.projection),i=(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,r={scales:g?{x:o?g.r:i||g.r,y:o&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:l,height:c,data:B,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:G.current};return M.map((e,t)=>{if(P){const o=P(e,t,r);return null!=o?o:n(e,t,r)}return n(e,t,r)}).filter(Boolean)},[M,P,l,c,g,L,T,B]);return p||w||A||C||U&&U.length>0||x||H?e("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof w?w:"Ordinal Chart"}),t("desc",{children:"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"}),e("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!R&&!I&&t("g",{className:"ordinal-grid",children:q.map((e,n)=>t("line",{x1:N?e.pixel:0,y1:N?0:e.pixel,x2:N?e.pixel:l,y2:N?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),p&&g&&!R&&t("g",{className:"ordinal-axes",children:e(n,N?{children:[!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!I&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&l-1>e?t("line",{x1:e,y1:0,x2:e,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((n,o)=>{const i=E?0===o?"start":o===q.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)}),m&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m})]}:{children:[!I&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,n=0>e||e>c?c:e;return t("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((n,o)=>e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)),m&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:m})]})}),U,C,H]}),w&&t("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),Ie({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:_,title:w,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S})]}):null}function Ue({width:e,height:n,totalWidth:o,totalHeight:r,margin:a,scales:l,onBrush:c}){const u=s(null),d=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const p=s(!1),y=s(null),f="horizontal"===(null==l?void 0:l.projection),m=s(f);return m.current=f,i(()=>{if(!u.current)return;const t=U(u.current).select(".brush-g"),o=f?K():Z();return o.extent([[0,0],[e,n]]),o.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let i;i=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};y.current=r,h.current(r)}),t.call(o),d.current=o,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[e,n,f]),i(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=U(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),t("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Ke(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ze="undefined"==typeof window||"undefined"==typeof document,Je=o.createContext(null),et={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function tt(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",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=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 s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const nt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ot={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},it={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},rt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},st={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},at={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},lt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},ct={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function ut({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(Je),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=o.useRef(null),p=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,y=o.useCallback(()=>{l||d||c(!0)},[l,d]),f=o.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:et}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:y,style:et,role:"region","aria-label":p,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j;const S=[];if(!Array.isArray(e))return S;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":S.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=_.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=_.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(p=_.cy)&&void 0!==p?p:_.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=_.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=_.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(j=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${nt(e.min)} to ${nt(e.max)}, mean ${nt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const A=Array.from(w);return e("div",{ref:g,id:r,tabIndex:-1,onBlur:f,style:ot,role:"region","aria-label":p,children:[t("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:rt,children:"×"}),t("div",{role:"note",style:it,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:st,children:[e("caption",{style:ct,children:["First ",x.length," of ",m.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:at,children:"type"}),A.map(e=>t("th",{style:at,children:e},e))]})}),t("tbody",{children:x.map((n,o)=>e("tr",{children:[t("td",{style:lt,children:n.label}),A.map(e=>{return t("td",{style:lt,children:(o=n.values[e],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":nt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},e);var o})]},o))})]})]})}function dt({summary:e}){return e?t("div",{role:"note",style:et,children:e}):null}function ht({tableId:e}){return t("a",{href:"#"+e,style:et,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,et)},children:"Skip to data table"})}function gt({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:et,children:n})}const pt="var(--semiotic-focus, #005fcc)";function yt({active:e,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!e||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),n=Math.max(a,4);u=t("rect",{x:l-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"})}else u=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:pt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function ft({x:e,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=d?`translate(${d.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,t("div",{ref:u,className:l,style:{position:"absolute",left:s.left+e,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function mt(e){const n=a(null),o=vt(e);return[function({children:o}){const i=r(()=>vt(e),[]);return t(n.Provider,{value:i,children:o})},e=>{var t;const i=null!==(t=l(n))&&void 0!==t?t:o,r=s(e);r.current=e;const a=c(()=>r.current(i.getState()),[i]),d=c(()=>r.current(i.getState()),[i]);return u(i.subscribe,a,d)}]}function vt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function bt(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function xt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:wt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const wt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],At={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ot={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:wt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[jt,St]=mt(e=>({theme:At,setTheme(t){e(e=>{if("light"===t)return{theme:At};if("dark"===t)return{theme:kt};if("high-contrast"===t)return{theme:Ot};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?kt:At;return{theme:xt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:xt(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const _t=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ct=new WeakMap;let Mt=0,Pt=!1,Lt=null,Tt=null,Bt=null;function It(e,t){var n,o;if(!t)return t;const i=_t.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Pt=!0;const e=()=>{Mt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Lt=new MutationObserver(e),Lt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Tt=window.matchMedia("(prefers-color-scheme: dark)"),Bt=e,"function"==typeof Tt.addEventListener?Tt.addEventListener("change",Bt):"function"==typeof Tt.addListener&&Tt.addListener(Bt)}catch(e){}}();let s=Ct.get(r);s&&s.version===Mt||(s={version:Mt,map:new Map},Ct.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function Ht(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Rt(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=s(t);n.current=t;const[a,l]=function(e,t,n){const o=s(null),[r,a]=d(null);return i(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=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 i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-u.left-u.right,g=l[1]-u.top-u.bottom,p=Ht(e.foregroundGraphics,l,u),y=Ht(e.backgroundGraphics,l,u),f=St(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=s(0),w=s(()=>{}),A=c(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=s(()=>{}),O=s(()=>{}),j=s(null),S=s(0),_=c(()=>{S.current=0;const e=j.current;j.current=null,e&&k.current(e)},[]),C=c(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(_))},[_]),M=c(()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),O.current()},[]);i(()=>()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const P=e.themeDirtyRef;return i(()=>{P&&(Mt++,P.current=!0,A())},[f,A,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:l,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:y,currentTheme:f,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:A,hoverHandlerRef:k,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:M}}function $t(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Dt(e,t,n=.3){$t(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 Nt(e,t,n=.6){var o,i,r,s,a;if(!$t(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!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Wt(e,t,n,o=.35){$t(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ft(e,t,n){const o=t.fillGradient;if(!o)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const n=e.createLinearGradient(r,s,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const zt=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Et(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Dt(e,t),e.globalAlpha=1}};function Et(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,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const qt=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){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=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?It(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Nt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Gt(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Vt(e,t){const n=Y().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const Xt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Vt(e,t)):(Gt(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Gt(e,t),Wt(e,t)),e.globalAlpha=1}};const Yt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Qt=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=It(e,n.style.stroke)||("string"==typeof n.style.fill?It(e,n.style.fill):n.style.fill)||It(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function Ut(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Kt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Zt=null;function Jt(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Zt||(Zt=document.createElement("canvas")),Zt.width=e,Zt.height=e,Zt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const en=new Map;function tn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=en.get(n);if(void 0!==o)return o;const i=Jt({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return en.set(n,i),i}function nn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function on(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function rn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const sn=e=>[Qt,...e],an={bar:sn([zt]),clusterbar:sn([zt]),point:sn([qt]),swarm:sn([qt]),pie:[Xt],donut:[Xt],boxplot:sn([(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=It(e,"var(--semiotic-primary, #007bff)"),a=It(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?It(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?It(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),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()}},qt]),violin:sn([Yt]),histogram:sn([zt]),ridgeline:sn([Yt]),timeline:sn([zt]),funnel:[zt,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Ut(i):null!=r?`${Ut(i)} (${Kt(r)})`:Ut(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Ut(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[zt,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||It(e,"var(--semiotic-border, #999)"),o=tn(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=It(e,"var(--semiotic-text, #333)"),s=It(e,"var(--semiotic-text-secondary, #666)");for(const t of i){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,a=!(!0===n.__barFunnelIsFirstStep)&&null!=i,l=a?rn(i):"",c=on(o);e.font="bold 13px sans-serif";const u=a?e.measureText(l).width:0;e.font="11px sans-serif";const d=e.measureText(c).width,h=Math.max(u,d)+12,g=a?32:17,p=n.__barFunnelLabelX,y=p-h/2,f=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),nn(e,y,f,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),nn(e,y,f,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=r,e.fillText(l,p,f+3),e.font="11px sans-serif",e.fillStyle=s,e.fillText(c,p,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=r,e.fillText(c,p,f+3))}e.lineWidth=1}],swimlane:sn([zt])},ln={top:50,right:40,bottom:60,left:70},cn={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 un({hover:n}){var o,i,r,s,a,l;const c=n.data||{},u=n.stats,d=n.category;if(Array.isArray(c)){const n=d||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(u)return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:["n = ",u.n]}),e("div",{children:["Min: ",u.min.toLocaleString()]}),e("div",{children:["Q1: ",u.q1.toLocaleString()]}),e("div",{children:["Median: ",u.median.toLocaleString()]}),e("div",{children:["Q3: ",u.q3.toLocaleString()]}),e("div",{children:["Max: ",u.max.toLocaleString()]}),e("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return e("div",{className:"semiotic-tooltip",style:cn,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===n.length&&e("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,p=n.__chartType;if("swarm"===p||"point"===p){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const y=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",f=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!y&&""===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e("div",{className:"semiotic-tooltip",style:cn,children:[y&&t("div",{style:{fontWeight:"bold"},children:y+""}),""!==f&&t("div",{children:"number"==typeof f?f.toLocaleString():f+""})]})}const dn=h(function(n,a){var l,u,h,p,y,f,m,v,b,x;const{chartType:w,runtimeMode:A,data:k,oAccessor:O="category",rAccessor:j="value",colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:P,valueAccessor:L,categoryAccessor:T,projection:B="vertical",size:I=[600,400],responsiveWidth:H,responsiveHeight:R,margin:$,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,rExtent:re,oExtent:se,extentPadding:ae=.05,oSort:le,windowMode:ce="sliding",windowSize:ue=200,pieceStyle:de,summaryStyle:he,colorScheme:ge,barColors:pe,showAxes:ye=!0,showCategoryTicks:ve,categoryLabel:Se,valueLabel:_e,categoryFormat:Ce,valueFormat:Me,oLabel:Pe,rLabel:Le,oFormat:Te,rFormat:Be,rTickValues:Ie,tickLabelEdgeAlign:He,enableHover:Re=!0,hoverAnnotation:$e,tooltipContent:De,customHoverBehavior:Ne,annotations:We,svgAnnotationRules:Fe,showGrid:ze=!1,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,backgroundGraphics:et,foregroundGraphics:nt,title:ot,className:it,background:rt,centerContent:st,decay:at,pulse:lt,transition:ct,animate:pt,staleness:mt,brush:vt,onBrush:xt,accessibleTable:wt=!0,description:At,summary:kt}=n,Ot=s(!0),jt=Rt({sizeProp:I,responsiveWidth:H,responsiveHeight:R,userMargin:$,marginDefault:ln,foregroundGraphics:nt,backgroundGraphics:et,animate:pt,transitionProp:ct,themeDirtyRef:Ot}),{reducedMotionRef:St,responsiveRef:_t,size:Ct,margin:Mt,adjustedWidth:Pt,adjustedHeight:Lt,resolvedForeground:Tt,resolvedBackground:Bt,currentTheme:It,transition:Ht,introEnabled:$t,tableId:Dt,rafRef:Nt,renderFnRef:Wt,scheduleRender:Ft}=jt,zt=null!=Se?Se:Pe,Et=null!=_e?_e:Le,qt=null!=Ce?Ce:Te,Gt=null!=Me?Me:Be,Vt=s(null),Xt=s(null),[Yt,Qt]=d(null),[Ut,Kt]=d(null),[Zt,Jt]=d(0),[en,tn]=d(!1),nn=Re||$e,on="streaming"===A,rn=r(()=>{var e,t,n;return{chartType:w,runtimeMode:on?"streaming":"bounded",windowSize:ue,windowMode:ce,extentPadding:ae,projection:B,oAccessor:on?void 0:O,rAccessor:on?void 0:j,colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:on?P:void 0,valueAccessor:on?L||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:on?T||O:void 0,rExtent:re,oExtent:se,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,oSort:le,pieceStyle:de,summaryStyle:he,colorScheme:ge,themeCategorical:null===(e=null==It?void 0:It.colors)||void 0===e?void 0:e.categorical,themeSemantic:bt(It),themeSequential:null===(t=null==It?void 0:It.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==It?void 0:It.colors)||void 0===n?void 0:n.diverging,barColors:pe,decay:at,pulse:lt,transition:Ht,introAnimation:$t,staleness:mt}},[w,ue,ce,ae,B,O,j,S,_,C,M,P,L,T,re,se,D,N,W,F,z,E,q,G,V,X,Q,U,K,Z,ee,te,ne,oe,ie,le,de,he,ge,pe,at,lt,null==Ht?void 0:Ht.duration,null==Ht?void 0:Ht.easing,$t,mt,on,It]),sn=s(null);sn.current||(sn.current=new fe(rn)),i(()=>{var e;null===(e=sn.current)||void 0===e||e.updateConfig(rn),Ot.current=!0,Ft()},[rn,Ft]);const cn=s(null);cn.current||(cn.current=new J(e=>{const t=sn.current;t&&t.ingest(e)&&(Ot.current=!0,Ft())}));const dn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.push(e)},[]),hn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.pushMany(e)},[]),gn=c(()=>{var e,t;null===(e=cn.current)||void 0===e||e.clear(),null===(t=sn.current)||void 0===t||t.clear(),Ot.current=!0,Ft()},[Ft]),pn=c(e=>{var t,n;null===(t=cn.current)||void 0===t||t.clearLastData(),null===(n=cn.current)||void 0===n||n.setReplacementData(e)},[]);g(a,()=>({push:dn,pushMany:hn,replace:pn,remove:e=>{var t,n,o,i;null===(t=cn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=sn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=Xt.current)||void 0===i?void 0:i.data;!!Xt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Xt.current=null,Qt(null)),Ot.current=!0,Ft()}return r},update:(e,t)=>{var n,o,i;null===(n=cn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=sn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ot.current=!0,Ft()),r},clear:gn,getData:()=>{var e,t,n;return null===(e=cn.current)||void 0===e||e.flush(),null!==(n=null===(t=sn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=sn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[dn,hn,pn,gn,Ft]),i(()=>{var e;k&&(null===(e=cn.current)||void 0===e||e.setBoundedData(k))},[k]);const{hoverHandlerRef:yn,hoverLeaveRef:fn,onPointerMove:mn,onPointerLeave:vn}=jt;yn.current=e=>{if(!nn)return;const t=Vt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,i=e.clientY-n.top-Mt.top;if(0>o||o>Pt||0>i||i>Lt)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const r=sn.current;if(!r||0===r.scene.length)return;const s="radial"===B,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,a=Math.sqrt(r*r+s*s);me(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":e=be(r,t,n);break;case"point":if(i)break;e=xe(r,t,n,o);break;case"wedge":e=we(r,t,n);break;case"boxplot":e=Ae(r,t,n);break;case"violin":e=ke(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Pt/2:o,s?i-Lt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;Xt.current=l,Qt(l),Ne&&(Ne(l),Ot.current=!0),Ft()},fn.current=()=>{Xt.current&&(Xt.current=null,Qt(null),Ne&&(Ne(null),Ot.current=!0),Ft())};const bn=s(-1),xn=s(null),wn=s(null),An=c(e=>{const t=sn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(wn.current&&wn.current.version===n)o=wn.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),wn.current={version:n,graph:o}}const i=bn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),bn.current=0;const t=o.flat[0];xn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},je(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});return Xt.current=n,Qt(n),Ne&&Ne(n),void Ft()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Oe(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Oe(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return bn.current=-1,xn.current=null,Xt.current=null,Qt(null),Ne&&Ne(null),void Ft();bn.current=s;const a=o.flat[s];xn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},je(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});Xt.current=l,Qt(l),Ne&&Ne(l),Ft()},[Ne,Ft]),kn=c(e=>{bn.current=-1,xn.current=null,mn(e)},[mn]);Wt.current=()=>{var e,t;Nt.current=0;const n=Vt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=sn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(St.current?r+1e6:r),a=!St.current&&s,l=Ot.current;l&&!s&&(i.computeScene({width:Pt,height:Lt}),Ot.current=!1),(l||a)&&n.setAttribute("aria-label",tt(i.scene,w+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=Ct[0]*c,d=Ct[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Ct[0]+"px",n.style.height=Ct[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Ct[0],Ct[1]);const h=null!==(e=null==mt?void 0:mt.threshold)&&void 0!==e?e:5e3,g=mt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==mt?void 0:mt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==rt&&!et){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=rt||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,Ct[0],Ct[1]))}const p="radial"===B;o.save(),o.beginPath(),o.rect(Mt.left,Mt.top,Pt,Lt),o.clip(),p?(o.save(),o.translate(Mt.left+Pt/2,Mt.top+Lt/2)):o.translate(Mt.left,Mt.top);const y=an[w]||[],f={width:Pt,height:Lt};for(const e of y)e(o,i.scene,i.scales,f);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Kt(i.scales),Jt(e=>e+1)),(null==mt?void 0:mt.showBadge)&&tn(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Wt.current()))},i(()=>(Ft(),()=>{var e;null===(e=cn.current)||void 0===e||e.clear()}),[Ft]),i(()=>{Ot.current=!0,Ft()},[w,Pt,Lt,ye,rt,Ft]),function(e,t,n,o,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(mt,sn,Ot,Ft,en,tn);const On=nn&&Yt?De?De(Yt):t(un,{hover:Yt}):null,jn="radial"===B,Sn=On?t(ft,{x:Yt?jn?Yt.x+Pt/2:Yt.x:0,y:Yt?jn?Yt.y+Lt/2:Yt.y:0,containerWidth:Pt,containerHeight:Lt,margin:Mt,className:"stream-ordinal-tooltip",children:On}):null;if(Ze){const n=sn.current;n&&k&&(n.ingest({inserts:k,bounded:!0}),n.computeScene({width:Pt,height:Lt}));const i=null!==(l=null==n?void 0:n.scene)&&void 0!==l?l:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,s="radial"===B,a=s?Mt.left+Pt/2:Mt.left,c=s?Mt.top+Lt/2:Mt.top;return e("div",{className:"stream-ordinal-frame"+(it?" "+it:""),role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:Ct[0],height:Ct[1]},children:[t(dt,{summary:kt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ct[0],height:Ct[1],style:{position:"absolute",left:0,top:0},children:[Bt&&t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt}),e("g",{transform:`translate(${a},${c})`,children:[rt&&t("rect",{x:0,y:0,width:Pt,height:Lt,fill:rt}),i.map((n,i)=>function(n,i){var r,s,a,l,c;const u=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",d=e=>`ord-${n.type}-${u}-${i}-${e}`,h=`ord-${n.type}-${u}-${i}`;switch(n.type){case"rect":{const i=n,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(e,n){const o=e.fillGradient;if(!o)return null;let i=e.x,r=e.y,s=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,s=e.x,a=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,s=e.x+e.w,a=e.y);const l=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let n=0;e.length>n;n++)l.push(t("stop",{offset:e[n].offset,stopColor:e[n].color},n))}else{const n=Ke(e.style.fill);l.push(t("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return t("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:Ke(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+u-n} A${n},${n} 0 0 0 ${r+n},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r+n},${l+u} A${n},${n} 0 0 1 ${r},${l+u-n} Z`;break;default:d=`M${r},${l+u} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u} Z`}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:d,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const e=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:Ke(e.style.fill),opacity:null!==(r=e.style.opacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}case"wedge":{const e=n,o=Y().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&o.cornerRadius(e.cornerRadius);const i=o({})||"";return t("path",{d:i,transform:`translate(${e.cx},${e.cy})`,fill:Ke(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const o=n,i=o.columnWidth/2;return e("g","vertical"===o.projection?{children:[t("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Ke(o.style.fill),fillOpacity:null!==(s=o.style.fillOpacity)&&void 0!==s?s:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Ke(o.style.fill),fillOpacity:null!==(a=o.style.fillOpacity)&&void 0!==a?a:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=n,o=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:Ke(e.style.fill),fillOpacity:null!==(l=e.style.fillOpacity)&&void 0!==l?l:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},d("path"))];if(e.iqrLine&&e.bounds){const n=e.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med"))):o.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med")))}return t("g",{children:o},h)}case"connector":return t("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(c=n.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=n,o=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:o,fill:Ke(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(n,i)).filter(Boolean)]})]}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:r,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,rTickValues:Ie,tickLabelEdgeAlign:He,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:0,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==n?void 0:n.getData()}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st})]})}return e("div",{ref:_t,className:"stream-ordinal-frame"+(it?" "+it:""),role:"group","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:H?"100%":Ct[0],height:R?"100%":Ct[1],overflow:"visible"},onKeyDown:An,children:[wt&&t(ht,{tableId:Dt}),wt&&t(ut,{scene:null!==(p=null===(h=sn.current)||void 0===h?void 0:h.scene)&&void 0!==p?p:[],chartType:w+" chart",tableId:Dt,chartTitle:"string"==typeof ot?ot:void 0}),t(dt,{summary:kt}),e("div",{role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?kn:void 0,onMouseLeave:nn?vn:void 0,children:[Bt&&t("svg",{style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt})}),t(Xe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showGrid:ze,rFormat:Gt,rTickValues:Ie}),t("canvas",{ref:Vt,"aria-label":tt(null!==(f=null===(y=sn.current)||void 0===y?void 0:y.scene)&&void 0!==f?f:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1]}}),t(gt,{hoverPoint:Yt}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:Zt,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(m=sn.current)||void 0===m?void 0:m.getData(),underlayRendered:!0}),(vt||xt)&&"radial"!==B&&t(Ue,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,onBrush:xt||(()=>{})}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st}),(null==mt?void 0:mt.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===mt.badgePosition?{top:4,left:4}:"bottom-left"===mt.badgePosition?{bottom:4,left:4}:"bottom-right"===mt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:en?"#dc3545":"#28a745",color:"white"}),children:en?"STALE":"LIVE"}),t(yt,{active:bn.current>=0,hoverPoint:Yt,margin:Mt,size:Ct,shape:null===(v=xn.current)||void 0===v?void 0:v.shape,width:null===(b=xn.current)||void 0===b?void 0:b.w,height:null===(x=xn.current)||void 0===x?void 0:x.h}),Sn]})]})});dn.displayName="StreamOrdinalFrame";const hn=a(null);function gn(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 pn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[yn,fn]=mt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=pn(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=pn(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}})}})),[mn,vn]=mt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let bn={positions:new Map};const xn=new Set;function wn(){for(const e of xn)e()}function An(e,t){const n=bn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}function kn(e){const t=p(),n=e.clientId||t,{name:o}=e,i=fn(e=>e.selections.get(o)),s=fn(e=>e.setClause),a=fn(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(gn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:c(()=>{a(o,n)},[a,o,n]),clientId:n}}function On(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const jn=a(!1);function Sn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){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:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):le[r%le.length];return{label:i+"",color:a}}),label:""}]}}function _n(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:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function Cn(){return St(e=>e.theme)}function Mn(){var e;const t=Cn(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Pn(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=se[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}function Ln(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}o.createContext(void 0);const Tn={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 Bn(e,t,n){var o,i,r,s,a,l,c;const u=Tn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:In(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function In(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Hn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}const Rn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function $n(e,t){return"function"==typeof t?t(e):e[t]}function Dn(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Nn(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=$n(n,i);l=Dn(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=$n(n,o);c.push({label:t,value:Dn(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Dn(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Dn(n[e[0]],r))}}const u=Object.assign(Object.assign({},Rn),s);return e("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&t("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((t,n)=>e("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},n))]})}}function Wn(e){if(!0===e)return Nn();if("function"==typeof e){const n=e;return e=>{const o=n(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==o?null:t("div",{className:"semiotic-tooltip",style:Rn,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Nn(e):Nn())}function Fn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function zn(e,t){if(!t)return Fn(e);try{const n=t(e);return null==n?Fn(e):n}catch(t){return Fn(e)}}function En(e,t){return"function"==typeof t?t(e):e[t]}function qn({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const u=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=En(u,n),h=En(u,o),g=i?En(u,i):void 0;return e("div",{className:"semiotic-tooltip",style:Rn,children:[t("div",{style:{fontWeight:"bold"},children:Fn(d)}),t("div",{style:{marginTop:4},children:zn(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(p=i,"string"==typeof p?p:"value"),": ",Fn(g)]})]});var p}}function Gn({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return t("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400},children:[t("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&t("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Vn extends o.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,n=this.state.error;return"function"==typeof e?e(n):void 0!==e?e:t(Gn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Xn(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Yn(e,t,n=3){let o,i=n+1;for(const n of t){const t=Xn(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function Qn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Un(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=Yn(e,t,3))&&void 0!==n?n:null)}function Kn({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=Qn(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=Un(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Zn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Jn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},eo={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},to=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],no=["vertical","horizontal"],oo={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:to},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({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:to},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:to},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({},Zn),Jn),{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({},Zn),Jn),{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({},Zn),Jn),{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({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{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({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:no},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Zn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Zn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Zn),{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({},Zn),{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:no},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({},Zn),{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({},Zn),{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({},Zn),{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({},Zn),{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({},Zn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Zn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Zn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function io(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ro=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),so=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),ao=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),lo=new Set(["LineChart","AreaChart","StackedAreaChart"]),co=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function uo(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(n)+.7152*r(o)+.0722*r(i)}function ho(e,t){const n=uo(e),o=uo(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const go=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function po(e,t){const n=[],o=function(e,t){const n=[],o=oo[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(oo).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!io(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=Yn(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const s=Kn({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!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(r&&t&&t.length>0){const n=Qn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Un(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}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 oo[e]?(function(e,t,n){const o=oo[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,i=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===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — 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=oo[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){ro.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){so.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=oo[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!ao.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[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=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!lo.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". 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,i;const r=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=oo[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){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(!co.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 i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}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 i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}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 i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=ho(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=ho(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of go)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var yo;const fo="undefined"!=typeof process&&"production"!==(null===(yo=process.env)||void 0===yo?void 0:yo.NODE_ENV);function mo({componentName:e,width:n,height:o,chartProps:i,children:r}){return t(Vn,{fallback:r=>{let s="";if(fo&&i)try{const t=po(e,i);t.ok||(s=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return t(Gn,{componentName:e,message:r.message,diagnosticHint:s,width:n,height:o})},children:r})}const vo={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"},bo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function xo(e,t,n,o){if(!fo)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 wo(e){const{data:n,rawData:o,colorBy:s,colorScheme:a,legendInteraction:u,legendPosition:h,selection:g,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:A,marginDefaults:k,onClick:O,hoverHighlight:j,loading:S,emptyContent:_,width:C,height:M}=e,P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:L,hoverSelectionHook:T,customHoverBehavior:B,customClickBehavior:I,crosshairSourceId:H}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:s,chartType:a,chartId:l,onClick:u,hoverHighlight:h,colorByField:g}){const y=p(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=kn({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=kn({name:t});return{onHover:c(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||n||[]}),b=vn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=d(null),k=g||n[0],O=r(()=>{if(!h||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,k]),j=c(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=bn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n})},wn())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&An(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(h&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,f,y,s,a,l,b,h,k]),S=c(e=>{var t,n,o,i;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=bn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(bn.positions);return t.delete(e),bn={positions:t},wn(),!1}bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},wn()}(f.name||"hover",Number(n),y)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[u,s,b,a,l,f,y]);return i(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const n=bn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}(e,y),An(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:y}}({selection:g,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:j,colorByField:P}),R=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(y,H),$=function(e,t,n){const o=l(hn),i=Mn();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=de(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return de(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=de(e,t,s);return e=>o[e]||n(e)}return de(e,t,s)}if(o&&Object.keys(o).length>0){const e=de([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(n,s,a),D=r(()=>{if(!s)return[];const e=new Set;for(const t of n){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[n,s]),N=function(e,t,n){const[o,i]=d(null),[s,a]=d(new Set),l=c(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=c(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:u,legendSelectionHook:h}}(u,s,D),W=r(()=>T||(N.legendSelectionHook?N.legendSelectionHook:L),[T,N.legendSelectionHook,L]),F=function(e){const t=St(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(g),{legend:z,margin:E,legendPosition:q}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:c}){const u=l(jn),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(!d||!t)return;const o=Sn({data:e,colorBy:t,colorScale:n,getColor:ue,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),g=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return h&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,h,i]);return{legend:h,margin:g,legendPosition:i}}({data:n,colorBy:s,colorScale:$,showLegend:w,legendPosition:h,userMargin:A,defaults:k}),G=r(()=>{const e={};return z&&(e.legend=z,e.legendPosition=q),u&&"none"!==u&&(e.legendHoverBehavior=N.onLegendHover,e.legendClickBehavior=N.onLegendClick,e.legendHighlightedCategory=N.highlightedCategory,e.legendIsolatedCategories=N.isolatedCategories),e},[z,q,u,N.onLegendHover,N.onLegendClick,N.highlightedCategory,N.isolatedCategories]),V=function(e,n,o){if(!e)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),a=Math.floor((o-(i*(r+s)-s))/2);return t("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,o)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},bo),{position:"absolute",top:a+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}(S,C,M),X=V?null:function(e,n,o,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},vo),{width:n,height:o}),children:i||"No data available"}):null}(o,C,M,_);return{colorScale:$,allCategories:D,legendState:N,effectiveSelectionHook:W,activeSelectionHook:L,customHoverBehavior:B,customClickBehavior:I,legend:z,margin:E,legendPosition:q,earlyReturn:V||X||null,legendBehaviorProps:G,crosshairProps:R,resolvedSelection:F}}const Ao=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,roundedTop:b,gradientFill:x=!1,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=wo({data:Z,rawData:a,colorBy:y,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"BarChart",chartId:P,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:z,height:E});if(J.earlyReturn)return J.earlyReturn;xo("BarChart",Z,"categoryAccessor",u),xo("BarChart",Z,"valueAccessor",d);const ee=Ln(Z,m,d),te=Mn(),ne=r(()=>new Map,[Z]),oe=r(()=>(e,t)=>{const n={};return n.fill=y?ue(e,y,J.colorScale):Pn(H,te,f,void 0,ne),n},[y,J.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return Hn(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},oe(t,n)),e(t,n)||{}):oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>_n(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>qn({categoryAccessor:u,valueAccessor:d,groupAccessor:y&&y!==u?y:void 0,groupLabel:"string"==typeof y?y:"group",valueFormat:p}),[u,d,y,p]),ae=Kn({componentName:"BarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(Gn,{componentName:"BarChart",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:v}),null!=b&&{roundedTop:b}),x&&{gradientFill:!0===x?{topOpacity:.8,bottomOpacity:.05}:x}),F&&{dataIdAccessor:F}),{baselinePadding:w,enableHover:q,showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:p}),W&&{oFormat:W}),{showGrid:G,showCategoryTicks:N,oSort:m}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Wn(A)||se}),(S||_||C||M)&&{customHoverBehavior:J.customHoverBehavior}),(_||C||S)&&{customClickBehavior:J.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"BarChart",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});function ko({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:i="right"}){const a=s(new Set),l=s([]),[u,h]=d(0),g=c(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=c(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||a.current.has(t)||(a.current.add(t),l.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),y=c(e=>t=>{p([t]),e(t)},[p]),f=c(e=>t=>{p(t),e(t)},[p]),m=c(()=>{a.current=new Set,l.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!t||!1===o)return;const i=l.current;if(0===i.length)return;const r=Array.isArray(n)?n:le,s=new Map;for(let e=0;i.length>e;e++)s.set(i[e],r[e%r.length]);const a="string"==typeof t?t:"__streamCat";return Sn({data:i.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:ue})},[e,t,o,n,u]),b=r(()=>{if(v)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[v,i]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function Oo({ref:e,frameRef:t,isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const u=ko({isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a}),d=c(u.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[u.wrapPush]),h=c(u.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[u.wrapPushMany]);return g(e,()=>({push:d,pushMany:h,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;u.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[d,h,u.resetCategories]),{effectiveLegendProps:r(()=>u.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:u.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,u.streamingLegend,a]),effectiveMargin:r(()=>{if(u.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(u.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,u.streamingMarginAdjust])}}Ao.displayName="BarChart";const jo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,categoryFormat:N}=e,W=o.width,F=o.height,z=o.enableHover,E=o.showGrid,q=o.showLegend,G=o.title,V=o.description,X=o.summary,Y=o.accessibleTable,Q=o.categoryLabel,U=o.valueLabel,K=a||[],Z=y||d,J=void 0===a,ee=wo({data:K,rawData:a,colorBy:Z,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:W,height:F});if(ee.earlyReturn)return ee.earlyReturn;const te=Mn(),ne=r(()=>new Map,[K]),oe=r(()=>(e,t)=>Z?ee.colorScale?{fill:ue(e,Z,ee.colorScale)}:{}:{fill:Pn(H,te,f,t,ne)},[Z,ee.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return Hn(e&&"function"==typeof e?(t,n)=>{const o=oe(t,n),i=e(t,n)||{};return Object.assign(Object.assign({},o),i)}:oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>_n(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=r(()=>qn({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Kn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=Oo({ref:n,frameRef:i,isPushMode:J,colorBy:Z,colorScheme:f,showLegend:q,legendPosition:I,setup:ee}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[W,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:p}),N&&{oFormat:N}),{showGrid:E}),le),G&&{title:G}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Wn(A)||se}),(S||_||C||M)&&{customHoverBehavior:ee.customHoverBehavior}),(_||C||S)&&{customClickBehavior:ee.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?t(Gn,{componentName:"StackedBarChart",message:ae,width:W,height:F}):t(mo,{componentName:"StackedBarChart",width:W,height:F,children:t(dn,Object.assign({ref:i},de))})});jo.displayName="StackedBarChart";const So=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.showLegend,q=o.title,G=o.description,V=o.summary,X=o.accessibleTable,Y=o.categoryLabel,Q=o.valueLabel,U=a||[],K=y||d,Z=void 0===a,J=wo({data:U,rawData:a,colorBy:K,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"GroupedBarChart",chartId:M,showLegend:E,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=Mn(),te=r(()=>new Map,[U]),ne=k.pieceStyle,oe=r(()=>(e,t)=>{const n=K?J.colorScale?{fill:ue(e,K,J.colorScale)}:{}:{fill:Pn(I,ee,f,t,te)};if(ne){const o=ne(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[K,J.colorScale,I,ee,f,te,ne]),ie=r(()=>Hn(oe,{stroke:H,strokeWidth:R,opacity:$}),[oe,H,R,$]),re=r(()=>_n(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>qn({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Kn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=Oo({ref:n,frameRef:i,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:E,legendPosition:B,setup:J}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:U}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Y,rLabel:Q,rFormat:p}),D&&{oFormat:D}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Wn(w)||se}),(j||S||_||C)&&{customHoverBehavior:J.customHoverBehavior}),(S||_||j)&&{customClickBehavior:J.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?t(Gn,{componentName:"GroupedBarChart",message:ae,width:N,height:W}):t(mo,{componentName:"GroupedBarChart",width:N,height:W,children:t(dn,Object.assign({ref:i},de))})});function _o({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const i=(a="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=kn({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=c(e=>{if(!e)return void l();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&On(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&On(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,n,o,a,l]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof o?o:"value")}),u=s(l.brushInteraction);u.current=l.brushInteraction;const d=c(e=>{if(i){u.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||n||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}So.displayName="GroupedBarChart";const Co=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:W,showCategoryTicks:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.showLegend,X=o.title,Y=o.description,Q=o.summary,U=o.accessibleTable,K=o.categoryLabel,Z=o.valueLabel,J=a||[],ee=y||d,te=void 0===a,ne=r(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(J.map(e=>"function"==typeof u?u(e):e[u])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?E:z)-2*n)/(n-1))):1},[m,e.mode,J,u,g,z,E]),oe=wo({data:J,rawData:a,colorBy:ee,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"SwimlaneChart",chartId:M,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:z,height:E}),ie=_o({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(oe.earlyReturn)return oe.earlyReturn;const re=Mn(),se=r(()=>new Map,[J]),ae=k.pieceStyle,le=r(()=>(e,t)=>{const n=ee?oe.colorScale?{fill:ue(e,ee,oe.colorScale)}:{}:{fill:Pn(I,re,f,t,se)};if(ae){const o=ae(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[ee,oe.colorScale,I,re,f,se,ae]),ce=r(()=>Hn(le,{stroke:H,strokeWidth:R,opacity:$}),[le,H,R,$]),de=r(()=>_n(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),he=r(()=>qn({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ge=Kn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:pe,effectiveMargin:ye}=Oo({ref:n,frameRef:i,isPushMode:te,colorBy:ee,colorScheme:f,showLegend:V,legendPosition:B,setup:oe}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:J}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:ne,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===F?void 0:K,rLabel:Z,rFormat:p}),N&&{rTickValues:N}),null!=W&&{tickLabelEdgeAlign:W}),D&&{oFormat:D}),void 0!==F&&{showCategoryTicks:F}),{showGrid:G}),pe),X&&{title:X}),Y&&{description:Y}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Wn(v)||he}),(j||S||_||C)&&{customHoverBehavior:oe.customHoverBehavior}),(S||_||j)&&{customClickBehavior:oe.customClickBehavior}),b&&b.length>0&&{annotations:b}),ie.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?t(Gn,{componentName:"SwimlaneChart",message:ge,width:z,height:E}):t(mo,{componentName:"SwimlaneChart",width:z,height:E,children:t(dn,Object.assign({ref:i},fe))})});Co.displayName="SwimlaneChart";const Mo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,brush:O,onBrush:j,linkedBrush:S,frameProps:_={},selection:C,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,chartId:B,loading:I,emptyContent:H,legendInteraction:R,legendPosition:$,color:D,stroke:N,strokeWidth:W,opacity:F,showCategoryTicks:z,categoryFormat:E}=e,q=o.width,G=o.height,V=o.enableHover,X=o.showGrid,Y=o.title,Q=o.description,U=o.summary,K=o.accessibleTable,Z=o.categoryLabel,J=o.valueLabel,ee=a||[],te=wo({data:ee,rawData:a,colorBy:y,colorScheme:f,legendInteraction:R,legendPosition:$,selection:C,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:B,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:I,emptyContent:H,width:q,height:G}),ne=_o({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:d});if(te.earlyReturn)return te.earlyReturn;const oe=r(()=>{if(!m)return;const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m]),ie=Mn(),re=r(()=>new Map,[ee]),se=_.pieceStyle,ae=r(()=>(e,t)=>{const n={fillOpacity:x};if(n.fill=y?ue(e,y,te.colorScale):Pn(D,ie,f,void 0,re),n.r=m?function(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,m,v,oe):b,se){const o=se(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[y,te.colorScale,m,v,oe,b,x,D,ie,f,re,se]),le=r(()=>Hn(ae,{stroke:N,strokeWidth:W,opacity:F}),[ae,N,W,F]),ce=r(()=>_n(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),de=r(()=>qn({categoryAccessor:u,valueAccessor:d,groupAccessor:y||void 0,valueFormat:p}),[u,d,y,p]),he=Kn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(he)return t(Gn,{componentName:"SwarmPlot",message:he,width:q,height:G});const ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[q,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:w,enableHover:V}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:J,rFormat:p}),E&&{oFormat:E}),{showGrid:X,showCategoryTicks:z}),te.legendBehaviorProps),Y&&{title:Y}),Q&&{description:Q}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Wn(A)||de}),(M||P||L||T)&&{customHoverBehavior:te.customHoverBehavior}),(P||L||M)&&{customClickBehavior:te.customClickBehavior}),k&&k.length>0&&{annotations:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"SwarmPlot",width:q,height:G,children:t(dn,Object.assign({ref:i},ge))})});function Po(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",s=o.stats||(o.data||o).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Rn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e("div",{children:["n = ",s.n]}),null!=s.min&&e("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e("div",{children:["Q1: ",s.q1.toLocaleString()]}),e("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,s=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return e("div",{className:"semiotic-tooltip",style:Rn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&e("div",{children:["n = ",a]}),null!=l&&e("div",{children:["Median: ",l.toLocaleString()]})]})}return t("div",{className:"semiotic-tooltip",style:Rn,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}Mo.displayName="SwarmPlot";const Lo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:B,strokeWidth:I,opacity:H,showCategoryTicks:R,categoryFormat:$}=e,D=o.width,N=o.height,W=o.enableHover,F=o.showGrid,z=o.title,E=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=a||[],Q=wo({data:Y,rawData:a,colorBy:y,colorScheme:f,legendInteraction:P,legendPosition:L,selection:A,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"BoxPlot",chartId:_,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:C,emptyContent:M,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Mn(),K=r(()=>new Map,[Y]),Z=r(()=>e=>{const t=y?ue(e,y,Q.colorScale):Pn(T,U,f,void 0,K);return{fill:t,stroke:t,fillOpacity:.8}},[y,Q.colorScale,T,U,f,K]),J=r(()=>Hn(Z,{stroke:B,strokeWidth:I,opacity:H}),[Z,B,I,H]),ee=r(()=>_n(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=r(()=>Po(),[]),ne=Kn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return t(Gn,{componentName:"BoxPlot",message:ne,width:D,height:N});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:Y}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:m,size:[D,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:W}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:p}),$&&{oFormat:$}),{showGrid:F,showCategoryTicks:R}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===b?()=>null:Wn(b)||te}),(k||O||j||S)&&{customHoverBehavior:Q.customHoverBehavior}),(O||j||k)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"BoxPlot",width:D,height:N,children:t(dn,Object.assign({ref:i},oe))})});Lo.displayName="BoxPlot";const To=h(function(n,o){const i=Bn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",bins:p=25,relative:y=!1,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=n,z=i.width,E=i.height,q=i.enableHover,G=i.showGrid,V=i.title,X=i.description,Y=i.summary,Q=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Z=l||[],J=wo({data:Z,rawData:l,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=_o({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=r(()=>{if(0===Z.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of Z){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[Z,h]),ne=Mn(),oe=r(()=>new Map,[Z]),ie=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Pn(R,ne,v,void 0,oe);return{fill:t,stroke:t,fillOpacity:.8}},[m,J.colorScale,R,ne,v,oe]),re=r(()=>Hn(ie,{stroke:$,strokeWidth:D,opacity:N}),[ie,$,D,N]),se=r(()=>_n(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return e("div",{className:"semiotic-tooltip",style:Rn,children:[i&&t("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&e("div",{children:["Count: ",r]}),s&&2===s.length&&e("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=Kn({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return t(Gn,{componentName:"Histogram",message:le,width:z,height:E});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:p,normalize:y}),te&&{rExtent:te}),{size:[z,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:Wn(x)||ae}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"Histogram",width:z,height:E,children:t(dn,Object.assign({ref:a},ce))})});To.displayName="Histogram";const Bo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=wo({data:Z,rawData:a,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=_o({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:d});if(J.earlyReturn)return J.earlyReturn;const te=Mn(),ne=r(()=>new Map,[Z]),oe=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Pn(R,te,v,void 0,ne);return{fill:t,stroke:t,fillOpacity:.6}},[m,J.colorScale,R,te,v,ne]),ie=r(()=>Hn(oe,{stroke:$,strokeWidth:D,opacity:N}),[oe,$,D,N]),re=r(()=>_n(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Po({valueAccessor:d}),[d]),ae=Kn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(Gn,{componentName:"ViolinPlot",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:p,showIQR:y,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Wn(x)||se}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"ViolinPlot",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});Bo.displayName="ViolinPlot";const Io=h(function(e,n){var o;const i=Bn(e.mode,{width:e.width,height:e.height,showGrid:null===(o=e.showGrid)||void 0===o||o,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null);g(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.title,q=i.description,G=i.summary,V=i.accessibleTable,X=i.categoryLabel,Y=i.valueLabel,Q=l||[],U=wo({data:Q,rawData:l,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"DotPlot",chartId:M,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Ln(Q,v,h),Z=Mn(),J=r(()=>new Map,[Q]),ee=k.pieceStyle,te=r(()=>(e,t)=>{const n={r:b,fillOpacity:.8};if(n.fill=f?ue(e,f,U.colorScale):Pn(I,Z,m,void 0,J),ee){const o=ee(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[f,U.colorScale,b,I,Z,m,J,ee]),ne=r(()=>Hn(te,{stroke:H,strokeWidth:R,opacity:$}),[te,H,R,$]),oe=r(()=>_n(ne,U.effectiveSelectionHook,U.resolvedSelection),[ne,U.effectiveSelectionHook,U.resolvedSelection]),ie=r(()=>qn({categoryAccessor:d,valueAccessor:h,valueFormat:y}),[d,h,y]),re=Kn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return t(Gn,{componentName:"DotPlot",message:re,width:N,height:W});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:y}),D&&{oFormat:D}),{showGrid:z,oSort:v}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),u&&{className:u}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Wn(w)||ie}),(j||S||_||C)&&{customHoverBehavior:U.customHoverBehavior}),(S||_||j)&&{customClickBehavior:U.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"DotPlot",width:N,height:W,children:t(dn,Object.assign({ref:a},se))})});Io.displayName="DotPlot";const Ho=h(function(e,n){var o,i;const a=Bn(e.mode,{width:null!==(o=e.width)&&void 0!==o?o:400,height:null!==(i=e.height)&&void 0!==i?i:400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks}),l=s(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=a.width,R=a.height,$=a.enableHover,D=a.showLegend,N=a.title,W=a.description,F=a.summary,z=a.accessibleTable,E=c||[],q=p||h,G=void 0===c,V=wo({data:E,rawData:c,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"PieChart",chartId:S,showLegend:D,userMargin:u,marginDefaults:a.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=Mn(),Y=r(()=>new Map,[E]),Q=r(()=>(e,t)=>q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Pn(L,X,y,t,Y)},[q,V.colorScale,L,X,y,Y]),U=r(()=>{const e=null==x?void 0:x.pieceStyle;return Hn(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Q(t,n)),e(t,n)||{}):Q,{stroke:T,strokeWidth:B,opacity:I})},[Q,x,T,B,I]),K=r(()=>_n(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),Z=r(()=>qn({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),J=Kn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=Oo({ref:n,frameRef:l,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:E}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,startAngle:f}),null!=m&&{cornerRadius:m}),{size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Wn(v)||Z}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(Gn,{componentName:"PieChart",message:J,width:H,height:R}):t(mo,{componentName:"PieChart",width:H,height:R,children:t(dn,Object.assign({ref:l},ne))})});Ho.displayName="PieChart";const Ro=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=o.width,R=o.height,$=o.enableHover,D=o.showLegend,N=o.title,W=o.description,F=o.summary,z=o.accessibleTable,E=a||[],q=p||u,G=void 0===a,V=wo({data:E,rawData:a,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"DonutChart",chartId:S,showLegend:D,userMargin:l,marginDefaults:o.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(H,R)),Y=Mn(),Q=r(()=>new Map,[E]),U=x.pieceStyle,K=r(()=>(e,t)=>{let n;if(n=q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Pn(L,Y,y,t,Q)},U){const o=U(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[q,V.colorScale,L,Y,y,Q,U]),Z=r(()=>Hn(K,{stroke:T,strokeWidth:B,opacity:I}),[K,T,B,I]),J=r(()=>_n(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=r(()=>qn({categoryAccessor:u,valueAccessor:d,groupAccessor:p&&p!==u?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[u,d,p]),te=Kn({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:ne,effectiveMargin:oe}=Oo({ref:n,frameRef:i,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:E}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:f}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ne),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Wn(v)||ee}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?t(Gn,{componentName:"DonutChart",message:te,width:H,height:R}):t(mo,{componentName:"DonutChart",width:H,height:R,children:t(dn,Object.assign({ref:i},ie))})});Ro.displayName="DonutChart";const $o=h(function(n,o){const i=Bn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),a=s(null),l="context"===n.mode,{compactMode:c}=i,{value:u,min:d=0,max:h=100,thresholds:g,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!c,sweep:A=240,fillZones:k=!0,tooltip:O,annotations:j,frameProps:S={},className:_,stroke:C,strokeWidth:M,opacity:P}=n,L=i.width,T=i.height,B=i.title,I=i.description,H=i.summary,R=i.accessibleTable,$=Math.max(d,Math.min(h,u)),D=h-d||1,N=($-d)/D,{gaugeData:W,pieceStyle:F,gaugeAnnotations:z}=r(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:p||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let i=d;for(let n=0;o.length>n;n++){const r=o[n],s=(r.value-i)/D;if(k){const o=(i-d)/D,a=Math.max(0,Math.min(N,(r.value-d)/D)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:r.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:y,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}i=r.value}if(w&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:y},gaugeAnnotations:n}},[u,d,h,g,p,y,N,D,w,k]),E=r(()=>Hn(F,{stroke:C,strokeWidth:M,opacity:P}),[F,C,M,P]),q=A*Math.PI/180,G=180+(360-A)/2,V=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+G*Math.PI/180,Y=[[Math.cos(X),Math.sin(X)],[Math.cos(X+q),Math.sin(X+q)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>q+.001||Y.push([Math.cos(e),Math.sin(e)]);const Q=Math.min(...Y.map(e=>e[0])),U=Math.max(...Y.map(e=>e[0])),K=Math.min(...Y.map(e=>e[1])),Z=Math.max(...Y.map(e=>e[1])),J=(K+Z)/2,ee=(Q+U)/2,te=Math.max(4,Math.min((L-2*V)/(U-Q),(T-2*V)/(Z-K))-2),ne=Math.max(0,Math.min(te-1.5,te*(1-f))),oe=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b($,d,h):b;const n=x?x($):Math.round($)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),w&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[b,$,d,h,x,w,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x($):Math.round($)+""}:null,[l,b,$,x]),le=r(()=>{if(!m)return null;const e=-Math.PI/2+G*Math.PI/180+N*q,t=ne>20?ne-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,N,G,q,ne,v]),ce=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-ne),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return e("g",{transform:`translate(${r},${s})`,children:[t("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const e=-Math.PI/2+G*Math.PI/180+(n.value-d)/D*q,r=ne-14,s=(i.height||T)/2;return t("text",{x:(i.width||L)/2+Math.cos(e)*r,y:s+Math.sin(e)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label},"gauge-label-"+o)}return"gauge-value"===n.type?t("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*ne,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[L,T,d,D,G,q,ne,te]),ue=r(()=>{const e=[...z,...j||[]];return le&&e.push(le),ae&&e.push(ae),e},[z,j,le,ae]),de=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return e("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[t("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),t("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round($):"Remaining"})]})},[$]);if(0===W.length)return t(Gn,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:ne,startAngle:G,sweepAngle:A,centerContent:se,size:[L,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:oe-re/2,right:L-oe-re/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Wn(O)||de,svgAnnotationRules:ce},ue.length>0&&{annotations:ue}),B&&{title:B}),I&&{description:I}),H&&{summary:H}),void 0!==R&&{accessibleTable:R}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),S);return t(mo,{componentName:"GaugeChart",width:L,height:T,children:t(dn,Object.assign({ref:a},he))})});$o.displayName="GaugeChart";const Do=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.title,q=o.description,G=o.summary,V=o.accessibleTable,X=o.categoryLabel,Y=o.valueLabel,Q=a||[],U=wo({data:Q,rawData:a,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"RidgelinePlot",chartId:C,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:M,emptyContent:P,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Mn(),Z=r(()=>new Map,[Q]),J=r(()=>e=>{const t=m?ue(e,m,U.colorScale):Pn(B,K,v,void 0,Z);return{fill:t,stroke:t,fillOpacity:.5}},[m,U.colorScale,B,K,v,Z]),ee=r(()=>Hn(J,{stroke:I,strokeWidth:H,opacity:R}),[J,I,H,R]),te=r(()=>_n(ee,U.effectiveSelectionHook,U.resolvedSelection),[ee,U.effectiveSelectionHook,U.resolvedSelection]),ne=r(()=>Po(),[]),oe=Kn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return t(Gn,{componentName:"RidgelinePlot",message:oe,width:N,height:W});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:Q}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:p,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:b,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:f}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:$,oSort:!1,amplitude:y}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Wn(x)||ne}),(O||j||S||_)&&{customHoverBehavior:U.customHoverBehavior}),(j||S||O)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"RidgelinePlot",width:N,height:W,children:t(dn,Object.assign({ref:i},ie))})});Do.displayName="RidgelinePlot";const No=h(function(n,o){const i=Bn(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:p,colorBy:y,colorScheme:f,orientation:m="horizontal",connectorOpacity:v=.3,showLabels:b=!0,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,categoryFormat:$}=n,D="vertical"===m,N=i.width,W=i.height,F=i.enableHover,z=i.title,E=i.description,q=i.summary,G=i.accessibleTable,V=l||[],X=y||p,Y=!X,Q=wo({data:V,rawData:l,colorBy:X,colorScheme:f,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"FunnelChart",chartId:C,showLegend:i.showLegend,userMargin:c,marginDefaults:D?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:P,width:N,height:W});if(Q.earlyReturn)return Q.earlyReturn;xo("FunnelChart",V,"stepAccessor",d),xo("FunnelChart",V,"valueAccessor",h);const U=Mn(),K=r(()=>new Map,[V]),Z=r(()=>{if(Y)return B||((null==U?void 0:U[0])?U[0]:Array.isArray(f)&&f[0]?f[0]:"#4e79a7")},[Y,B,U,f]),J=A.pieceStyle,ee=r(()=>(e,t)=>{const n={};if(n.fill=Z||(X?ue(e,X,Q.colorScale):Pn(B,U,f,t,K)),J){const o=J(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Z,X,Q.colorScale,B,U,f,K,J]),te=r(()=>Hn(ee,{stroke:I,strokeWidth:H,opacity:R}),[ee,I,H,R]),ne=r(()=>_n(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,p=null==c?void 0:c.__barFunnelIsDropoff,y=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,f=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return e("div",{className:"semiotic-tooltip",style:Rn,children:[u&&t("div",{style:{fontWeight:"bold"},children:u+""}),y&&y!==u&&t("div",{style:{marginTop:2,opacity:.8},children:y+""}),p&&t("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e("div",{style:{marginTop:4},children:[d+"",f]})]})},[]),ie=Kn({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(ie)return t(Gn,{componentName:"FunnelChart",message:ie,width:N,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:D?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:d,rAccessor:h}),p&&{stackBy:p}),{projection:D?"vertical":"horizontal",barPadding:D?40:0,pieceStyle:ne,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:D,showCategoryTicks:D}),$&&{oFormat:$}),{showGrid:D}),!D&&{connectorOpacity:v}),{showLabels:b}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:!0===x||null==x?oe:Wn(x)||oe}),(O||j||S||_)&&{customHoverBehavior:Q.customHoverBehavior}),(j||S||O)&&{customClickBehavior:Q.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"FunnelChart",width:N,height:W,children:t(dn,Object.assign({ref:a},re))})});No.displayName="FunnelChart";const Wo={RdBu:H,PiYG:I,PRGn:B,BrBG:T,RdYlBu:L,RdYlGn:P,Spectral:M},Fo="__likert_neutral_neg",zo="__likert_neutral_pos";function Eo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function qo(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function Go(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Fo,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:zo,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Vo(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===Fo?r=n:n.__likertLevel===zo?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Xo=h(function(e,n){const i=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null),{data:l,margin:u,className:d,categoryAccessor:h="question",valueAccessor:p,levelAccessor:y,countAccessor:f="count",levels:m,orientation:v="horizontal",colorScheme:b,barPadding:x=20,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,valueFormat:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,categoryFormat:H,stroke:R,strokeWidth:$,opacity:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.showLegend,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,Q=i.valueLabel,U="horizontal"===v,K=void 0===l,Z=!y,J=function(){var e;const t=Cn();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ee=r(()=>b&&Array.isArray(b)&&b.length>=m.length?b:function(e,t){if(0>=e)return[];if(t){const n=Wo[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(m.length,J),[b,m.length,J]),te=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],ee[t]||"#888");return e},[m,ee]),{processedData:ne,reAggregate:oe,accumulatorRef:ie}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:u}){const d=!i,h=r(()=>Eo(n,"question"),[n]),g=r(()=>d?Eo(o,"score"):null,[d,o]),p=r(()=>d?null:Eo(i,"level"),[d,i]),y=r(()=>d?null:Eo(a,"count"),[d,a]),f=e||[],m=s([]),v=r(()=>{if(0===f.length)return[];let e=qo(f,t,h,g,p,y);return l&&(e=Go(e,t),e=Vo(e,t)),e},[f,t,h,g,p,y,l]),b=c(e=>{var n;let o=qo(e,t,h,g,p,y);l&&(o=Go(o,t),o=Vo(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,p,y,l,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:m,categoryAccessor:h,valueAccessor:p,levelAccessor:y,countAccessor:f,isDiverging:U,frameRef:a}),re="__likertLevelLabel",se=ko({isPushMode:K,colorBy:re,colorScheme:ee,showLegend:E,legendPosition:I}),ae=c(se.wrapPush(e=>{ie.current.push(e),oe(ie.current)}),[se.wrapPush,oe,ie]),le=c(se.wrapPushMany(e=>{ie.current.push(...e),oe(ie.current)}),[se.wrapPushMany,oe,ie]);g(n,()=>({push:ae,pushMany:le,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ie.current=[],se.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:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ae,le,se.resetCategories,ie]);const ce=wo({data:ne,rawData:l,colorBy:re,colorScheme:ee,legendInteraction:B,legendPosition:I,selection:O,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"LikertChart",chartId:M,showLegend:E,userMargin:u,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:N,height:W});if(ce.earlyReturn)return ce.earlyReturn;const ue=r(()=>{const e=m.length;return e%2!=0&&te.get(m[Math.floor(e/2)])||"#888"},[m,te]),de=k.pieceStyle,he=r(()=>(e,t)=>{var n,o;const i=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),r=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let s;if(r===Fo||r===zo)s={fill:ue};else{const e=i||r;s=e&&te.has(e)?{fill:te.get(e)}:{fill:"#888"}}if(de){const n=de(e,t);n.stroke&&(s.stroke=n.stroke),null!=n.strokeWidth&&(s.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(s.strokeOpacity=n.strokeOpacity)}return s},[te,ue,de]),ge=r(()=>Hn(he,{stroke:R,strokeWidth:$,opacity:D}),[he,R,$,D]),pe=r(()=>_n(ge,ce.effectiveSelectionHook,ce.resolvedSelection),[ge,ce.effectiveSelectionHook,ce.resolvedSelection]),ye=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),fe=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===Fo||n===zo?ye:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===Fo||n===zo?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:Rn},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ye]),me=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!f)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Z?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),f&&(e.countAccessor=f)),Kn({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:m}})},[l,h,p,y,f,m,Z]),ve=r(()=>[{styleFn:e=>({fill:te.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,te]),be=r(()=>!1!==E?Object.assign(Object.assign({},ce.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:I||ce.legendPosition||"bottom"}):ce.legendBehaviorProps,[ce.legendBehaviorProps,ce.legendPosition,I,E,ve]),xe=r(()=>{const e=Object.assign({},ce.margin);if(K&&!1!==E){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(se.streamingMarginAdjust)for(const[t,n]of Object.entries(se.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[ce.margin,se.streamingMarginAdjust,U,K,E,I]),we=r(()=>P||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,P]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:ne}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:pe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q||(U?void 0:"Percentage"),rFormat:we}),H&&{oFormat:H}),{showGrid:z}),be),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:!0===w?fe:Wn(w)||fe}),(j||S||_||C)&&{customHoverBehavior:ce.customHoverBehavior}),(S||_||j)&&{customClickBehavior:ce.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return me?t(Gn,{componentName:"LikertChart",message:me,width:N,height:W}):t(mo,{componentName:"LikertChart",width:N,height:W,children:t(dn,Object.assign({ref:a},Ae))})});Xo.displayName="LikertChart";export{Ao as BarChart,Lo as BoxPlot,Ro as DonutChart,Io as DotPlot,No as FunnelChart,$o as GaugeChart,So as GroupedBarChart,To as Histogram,Xo as LikertChart,Ho as PieChart,Do as RidgelinePlot,jo as StackedBarChart,dn as StreamOrdinalFrame,Mo as SwarmPlot,Co as SwimlaneChart,Bo as ViolinPlot,Jt as createHatchPattern};