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.
- package/ai/schema.json +1 -1
- package/dist/components/export/selectionSerializer.d.ts +1 -1
- package/dist/components/realtime/types.d.ts +5 -5
- package/dist/components/store/SelectionStore.d.ts +1 -1
- package/dist/components/store/TooltipStore.d.ts +5 -1
- package/dist/components/store/useSelection.d.ts +7 -4
- package/dist/components/stream/NetworkSVGOverlay.d.ts +18 -12
- package/dist/components/stream/geoTypes.d.ts +20 -8
- package/dist/components/stream/keyboardNav.d.ts +18 -6
- package/dist/components/stream/networkTypes.d.ts +42 -21
- package/dist/components/stream/ordinalTypes.d.ts +12 -12
- package/dist/components/stream/types.d.ts +13 -9
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +3 -4
package/dist/ordinal.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-scale"),o=require("d3-quadtree"),r=require("d3-scale-chromatic"),s=require("d3-array"),i=require("d3-hierarchy"),a=require("d3-shape"),l=require("regression"),c=require("d3-selection"),u=require("d3-brush");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const g=h(t),p=d(l);class f{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return 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 y{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 r=0;this._size>r;r++){const s=(o+r)%this._capacity,i=this.buffer[s];if(e(i)){let e;e="object"!=typeof i||null===i?i:Array.isArray(i)?[...i]:Object.assign({},i),n.push(e),this.buffer[s]=t(i)}}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 m{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function v(e,t,n){return e+(t-e)*n}function b(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function x(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function j(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const w={category10:r.schemeCategory10,tableau10:r.schemeTableau10,set3:r.schemeSet3,blues:r.interpolateBlues,reds:r.interpolateReds,greens:r.interpolateGreens,oranges:r.interpolateOranges,purples:r.interpolatePurples,viridis:r.interpolateViridis,plasma:r.interpolatePlasma},k=r.schemeCategory10,A=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],O=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 S(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")||O.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):k[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+""))%k.length]}function M(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),s=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const i=w[o]||w.category10;if(s&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:k;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function _(e,t,n,o,r,s,i){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:s,group:i}}function C(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,s=[],i=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=r(e.pieceData[0],e.name);s.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:i,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return s}function P(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=s.quantile(e,.25))&&void 0!==t?t:i,median:null!==(n=s.quantile(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=s.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}const L={bar:function(e,t){var n,o,r;const{scales:s,columns:i,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=s,g=[],p="vertical"===h,f="horizontal"===h,y=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(i))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(i)){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(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const s of m){const i=t.get(s);if(!i)continue;let a=i.total;y&&n>0&&(a/=n);const l=u(i.pieces[0],c?s:e.name),h=Object.assign(Object.assign({},i.pieces[0]),{__aggregateValue:i.total,__pieceCount:i.pieces.length,category:e.name});if(p){const t=d(0>a?r:o+a),n=0>a?d(r+a)-d(r):d(o)-d(o+a);g.push(_(e.x,t,e.width,Math.abs(n),l,h,s)),0>a?r+=a:o+=a}else if(f){const t=d(0>a?r+a:o),n=0>a?d(r)-d(r+a):d(o+a)-d(o);g.push(_(t,e.x,Math.abs(n),e.width,l,h,s)),0>a?r+=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===(r=t.datum)||void 0===r?void 0:r.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:r,getR:s,getGroup:i,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=i?i(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,r=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let i=0;h.length>i;i++){const c=r.get(h[i])||[];for(const r of c){const c=s(r),g=a(r,h[i]);if(d){const s=e.x+i*t+n/2,a=l(0),d=l(c);u.push(_(s,Math.min(a,d),o,Math.abs(a-d),g,r,h[i]))}else{const s=e.x+i*t+n/2,a=l(0),d=l(c);u.push(_(Math.min(a,d),s,Math.abs(d-a),o,g,r,h[i]))}}}}const f=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=s(e.datum);f>0&&(e.roundedTop=f),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){var n,o;const{scales:r,columns:s,getR:i,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,f=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(s))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,s=null!==(o=t.__rValue)&&void 0!==o?o:i(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*f,n=u(s);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(s)):(b=u(s),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:s}=e,{r:i,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=s(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:i(a),p=c?i(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:C,donut:C,boxplot:function(e,t){var n,o,r,i,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:p,projection:f}=c,y=[],m="vertical"===f,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],f=null!==(n=s.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=s.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(r=s.quantile(c,.75))&&void 0!==r?r:d,j=x-f,w=f-1.5*j,k=x+1.5*j,A=null!==(i=c.find(e=>e>=w))&&void 0!==i?i:u,O=null!==(a=[...c].reverse().find(e=>k>=e))&&void 0!==a?a:d,S=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(w>n||n>k){const o=m?t.middle:p(n),r=m?p(n):t.middle;M.push({px:o,py:r,value:n,datum:e})}}if(y.push({type:"boxplot",x:m?t.middle:0,y:m?0:t.middle,projection:m?"vertical":"horizontal",columnWidth:.6*t.width,minPos:p(A),q1Pos:p(f),medianPos:p(b),q3Pos:p(x),maxPos:p(O),stats:{n:c.length,min:A,q1:f,median:b,q3:x,max:O,mean:c.reduce((e,t)=>e+t,0)/c.length},style:S,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:S.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=i,g=[],p="vertical"===h,f=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],l=(a-i)/f||1,h=Array(f).fill(0);for(const e of t)h[Math.min(Math.floor((e-i)/l),f-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(p){b=`M ${e.middle} ${d(i)}`;for(let t=0;f>t;t++){const n=d(i+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=f-1;t>=0;t--){const n=d(i+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${n}`}b+=" Z"}else{b=`M ${d(i)} ${e.middle}`;for(let t=0;f>t;t++)b+=` L ${d(i+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)b+=` L ${d(i+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let j;if(y&&t.length>=4){const l=null!==(n=s.quantile(t,.25))&&void 0!==n?n:i,c=null!==(o=s.quantile(t,.5))&&void 0!==o?o:(i+a)/2,u=null!==(r=s.quantile(t,.75))&&void 0!==r?r:a;j={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:p}}const w=p?{x:e.x,y:Math.min(d(a),d(i)),width:e.width,height:Math.abs(d(a)-d(i))}:{x:Math.min(d(i),d(a)),y:e.x,width:Math.abs(d(a)-d(i)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:j,stats:P(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var n;const{scales:o,columns:r,config:s,getR:i,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=s.bins||25,d=s.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,s=Array(u).fill(0);for(const e of t)n>e||e>o||s[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,f=Math.max(...s,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===s[t])continue;const o=(d?s[t]/h:s[t]/f)*e.width*.9,i=l(n+t*r),a=l(n+(t+1)*r);c.push(_(Math.min(i,a),e.x+e.width-o,Math.abs(a-i),o,y,{bin:t,count:s[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:s,getR:i,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=s.bins||20,h="horizontal"===c,g=s.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],s=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/s),d-1)]++;const p=Math.max(...c,1),f=a(e.pieceData[0],e.name),y=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)*s)} ${t-c[e]/p*y}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*s);m+=` L ${t+c[e]/p*y} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:P(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:s}=e,{r:i,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=s(t,e.name);if(c){const n=i(Math.min(o,a)),r=i(Math.max(o,a));l.push(_(n,e.x,r-n,e.width,u,t,e.name))}else{const n=i(Math.max(o,a)),r=i(Math.min(o,a));l.push(_(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var o,r,s,i,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:p}=e,f=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return f;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const j=b.length>1&&"_default"!==b[0],w=[];let k=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=g?g(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),s=h(o);r.total+=s,r.pieces.push(o),n+=s}w.push({col:e,groups:t,stepTotal:n}),j||n>k&&(k=n)}if(j)for(const e of w){let t=0,n=0;for(let o=0;b.length>o;o++){const r=e.groups.get(b[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>k&&(k=o)}if(0===k)return f;const A=new Map;for(const e of b){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,S=j?.95*y:.9*t.width,M=n.scaleLinear().domain([0,k]).range([0,S]),C=null!==(r=e.config.connectorOpacity)&&void 0!==r?r:.3;let P=new Map;for(let t=0;w.length>t;t++){const n=w[t],o=n.col,r=0===t,d=o.width,h=.55*d,g=o.x+(d-h)/2,v=new Map;if(j){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=y,s=y;for(let i=0;b.length>i;i++){const l=b[i],c=n.groups.get(l);if(!c)continue;const u=M(c.total),d=i%2==0,x=d?t:s-u;d?t+=u:s-=u;const j=p(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,k=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});m&&(0===i&&(O.__funnelStepLabel=o.name,O.__funnelStepLabelX=y,O.__funnelStepLabelY=g,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+u/2,O.__funnelValueLabelY=g,O.__funnelBarW=u),f.push(_(x,g,u,h,j,O,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=y-t/2,l=b[0],c="_default"!==l,u=null!==(i=null===(s=n.groups.get(l))||void 0===s?void 0:s.pieces[0])&&void 0!==i?i:o.pieceData[0],d=c?l:o.name,x=p(u,d),j=O>0?e/O*100:0,w=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:j,__funnelStep:o.name,__funnelIsFirstStep:r,category:c?l:o.name});m&&(w.__funnelStepLabel=o.name,w.__funnelStepLabelX=y,w.__funnelStepLabelY=g,w.__funnelRowWidth=t,w.__funnelValueLabelX=y,w.__funnelValueLabelY=g,w.__funnelBarW=t),f.push(_(a,g,t,h,x,w,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&P.size>0){const t=j?b:[b[0]];for(const r of t){const t=P.get(r),s=v.get(r);if(!t||!s)continue;const i=(()=>{const e=n.groups.get(r);return p(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[s.x+s.w,s.y],[s.x,s.y]],style:{fill:i.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=n.groups.get(r))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===r?o.name:r};f.push(a)}}P=v}return f},"bar-funnel":function(e,t){var n,o,r,s;const{columns:i,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>i[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 f=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),s=a(o);r.total+=s,r.pieces.push(o),n+=s}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[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=f?g.length:1,x=f?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,i=e>0?y[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 y=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,j=null==i?void 0:i.groups.get(h),w=null!==(s=null==j?void 0:j.total)&&void 0!==s?s:y,k=o?0:Math.max(0,w-y),A=n.x+e*a+l/2,O=v(y),S=v(0)-O,M=c(p.pieces[0],f?h:n.name),C=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:f?h:n.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(y+k)});if(d.push(_(A,O,u,S,M,C,f?h:n.name)),k>0){const e=v(y+k),t=O-e,o=Object.assign({},M),r=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:f?h:n.name});d.push(_(A,e,u,t,o,r,f?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:s,resolvePieceStyle:i}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=s?s(n):e.name,d=i(n,l);if(u){const r=a(t),s=a(t+o);c.push(_(r,e.x,s-r,e.width,d,n,l))}else{const r=a(t+o),s=a(t);c.push(_(e.x,r,e.width,s-r,d,n,l))}t+=o}}return c}};class B{constructor(e){this.rExtent=new m,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 y(e.windowSize),this.getO=j(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new m)):(this.getR=x(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=j(e.stackBy),this.getGroup=j(e.groupBy),this.getColor=j(e.colorAccessor),this.getConnector=j(e.connectorAccessor),this.getDataId=j(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new y(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:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const r=o.toArray(),s=t.projection||"vertical",i=t.oExtent||this.resolveCategories(r),a=this.computeValueDomain(r,i),l="horizontal"===s,c="radial"===s,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1));let d,h;if(c){d=n.scaleBand().domain(i).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=t.innerRadius||0;h=n.scaleLinear().domain(a).range([r,o])}else l?(d=n.scaleBand().domain(i).range([0,e.height]).padding(u),h=n.scaleLinear().domain(a).range([0,e.width])):(d=n.scaleBand().domain(i).range([0,e.width]).padding(u),h=n.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:s},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((r,s)=>{var i;const a=this.rExtents[s];a.dirty&&a.recalculate(o,r);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(i=t.extentPadding)&&void 0!==i?i:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?n.scaleLinear().domain([c,u]).range([0,e.width]):n.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=r;this.rAccessors.length>1&&(g=r.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(g,i,d,s,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),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 r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const s=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return s}if(!1===o)return s;if("function"==typeof o)return s.sort(o);const i=new Map;for(const t of e){const e=this.getO(t);i.set(e,(i.get(e)||0)+Math.abs(this.getR(t)))}return s.sort("asc"===o?(e,t)=>(i.get(e)||0)-(i.get(t)||0):(e,t)=>(i.get(t)||0)-(i.get(e)||0))}computeValueDomain(e,t){var n,o,r,s,i;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),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>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===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var s;const i={},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 s=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*s)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(s=n(e))&&void 0!==s?s:0,g=n.bandwidth()),i[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return i}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=L[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:r,config:s,getConnector:i,getO:a}=e;if(!i||!r)return[];const l=[],{projection:c}=r,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=i(t);if(!n)continue;let o,r;"point"===e.type?(o=e.x,r=e.y):(o=e.x+e.w/2,r=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:r,datum:t,category:a(t)})}const d=r.o.domain(),h=s.connectorStyle;for(const[t,r]of u)if(r.length>=2){r.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let s=0;r.length-1>s;s++){const i=r[s],a=r[s+1],c="function"==typeof h?h(i.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:i.x,y1:i.y,x2:a.x,y2:a.y,style:c,datum:i.datum,group:t})}}return l}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||A,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,r,s;if(1>=n)return 1;const i=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return i+(1-a/(n-1))*(1-i);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return i+Math.pow(.5,a/t)*(1-i)}case"step":return(null!==(s=e.stepThreshold)&&void 0!==s?s:.5*n)>a?1:i;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",r=new Map;for(let s=0;e.length>s;s++){const i=e[s],a=n?t(i):i[o];let l=r.get(a);l||(l=[],r.set(a,l)),l.push(s)}return this._categoryIndexCache={version:this._dataVersion,map:r},r}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,B.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let r=0;for(const e of this.scene)"point"===e.type&&(n[r++]=e);this._pointQuadtree=o.quadtree().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 r=t.length;if(1>=r)return;const s=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const i=this.computeDecayOpacity(e,r),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*i})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const s="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=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 r=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=s-t;if(i>n){const e=1-n/i;e>r&&(r=e)}}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=s-o;i>r&&(n._pulseIntensity=1-r/i,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,r;this.prevPositionMap.clear();const s=new Map,i=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,s);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:i,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:i,y:t.y,w:0,h:t.h,opacity:null!==(r=t.style.opacity)&&void 0!==r?r: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,r;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!==(r=e.category)&&void 0!==r?r:""):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],r=this.getNodeKey(o,t);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(r,{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,r,s,i,a,l,c,u,d,h,g,p,f,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const j=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 w=!1;const k=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);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),w=!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}),w=!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!==(r=d.w)&&void 0!==r?r:c.w,c.h=null!==(s=d.h)&&void 0!==s?s:c.h,w=!0)):(c._targetOpacity=null!==(i=c.style.opacity)&&void 0!==i?i:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!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,w=!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}),w=!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!==(f=t.endAngle)&&void 0!==f?f:0))/2;this.exitNodes.push({type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y: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})}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:j})}advanceTransition(e){var t,n,o,r;if(!this.activeTransition)return!1;const s=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(s,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=v(r,e._targetOpacity,i)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=v(o.x,e._targetX,i),e.y=v(o.y,e._targetY,i)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=v(o.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=v(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=v(n.x,e._targetX,i),e.y=v(n.y,e._targetY,i),void 0!==n.w&&(e.w=v(n.w,e._targetW,i),e.h=v(n.h,e._targetH,i))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:v(o,e._targetOpacity,i)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=v(n.startAngle,e._targetStartAngle,i),e.endAngle=v(n.endAngle,e._targetEndAngle,i))}}}if(s>=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 r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,r}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,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const s=this.buffer.update(e=>n.has(o(e)),t);if(0===s.length)return s;for(const e of s)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,s}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&&!b(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!b(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!b(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(b(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=j(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,r=Array.isArray(n)?n:[n],s=Array.isArray(o)?o:[o];if(r.length!==s.length||r.some((e,t)=>!b(e,s[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new m)):(this.getR=x(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!b(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?j(this.config.stackBy):void 0),"groupBy"in e&&!b(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?j(this.config.groupBy):void 0),"colorAccessor"in e&&!b(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?j(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!b(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?j(this.config.connectorAccessor):void 0)}}function T(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function R(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function I(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 H(e,t,n,o=30){const r=t-e.x,s=n-e.y,i=Math.sqrt(r*r+s*s);return i>T(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function $(e,t,n){const o=t-e.cx,r=n-e.cy,s=Math.sqrt(o*o+r*r);if(e.innerRadius>s||s>e.outerRadius)return null;const i=R(Math.atan2(r,o)),a=R(e.startAngle),l=R(e.endAngle);if(!(a>l?i>=a||l>=i:i>=a&&l>=i))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 D(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,s=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>s))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function N(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:s,height:i}=e.bounds;return o>t||t>o+s||r>n||n>r+i?null:{datum:e.datum,x:o+s/2,y:r+i/2,distance:0,category:e.category,stats:e.stats}}function F(e,t,n){const o=e.byGroup.get(t);let r=0,s=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);s>t&&(s=t,r=e)}return o[r]._flatIndex}function W(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})}B.QUADTREE_THRESHOLD=500;const z={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function E(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,z[n])(o(e,t)),r}function q(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function G(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const V=(t,n,o,r,s,i,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let f=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=s;return g.forEach((t,u)=>{const v=E(t,u,d,h),b=G(t,r,s),x=s&&s.size>0&&s.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${f})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===i&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(q,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),f+=22}),p};function Y({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:s,label:i,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+g.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(s[0]+n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":i||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),i&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(s[1]-n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":i||"Gradient legend",children:[i&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[0])})]})}function X(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,p]=g.useState(0),[f,y]=g.useState(0),m=g.useCallback((e,t)=>{p(e),y(t)},[]),v="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e.jsx("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:V(t,o,r,s,i,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const f=((t,n,o,r,s,i,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,f=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=s;p.forEach((t,u)=>{const x=E(t,u,h,g),j=G(t,r,s),w=s&&s.size>0&&s.has(t.label),k=26+7*t.label.length;d&&d>0&&y>0&&y+k>d&&(m++,y=0),f.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===i&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.jsx(q,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k});let x=0,j=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&j>0&&j+t>d?(x=Math.max(x,j),j=t):j+=t}x=Math.max(x,j);const w=m+1;return{items:f,offset:x,totalRows:w,totalHeight:22*w}})(t,r,s,i,a,l,c,n,u,d,o);p+=f.offset+5,g.push(Object.assign(Object.assign({label:t.label},f),{offset:p,totalRows:f.totalRows,totalHeight:f.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const f=[];return g.forEach((o,r)=>{const s=t[r];s.label&&(f.push(e.jsx("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s.label},"legend-text-"+r)),p+=16),f.push(e.jsx("g",{className:"legend-item",transform:`translate(${p},0)`,children:o.items},"legend-group-"+r)),p+=o.offset+5,t[r+1]&&f.push(e.jsx("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),e.jsx("g",{children:f})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}),b=!(!o&&!r);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),v]})}function Q(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function U(t){const{legend:n,totalWidth:o,totalHeight:r,margin:s,legendPosition:i="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===i||"bottom"===i;let p,f;return"left"===i?(p=4,f=s.top):"top"===i?(p=0,f=a?32:8):"bottom"===i?(p=0,f=r-s.bottom+50):(p=o-s.right+10,f=s.top),e.jsx("g",{transform:`translate(${p}, ${f})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(Y,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Q(n)?e.jsx(X,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function K(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),s=[];let i="";for(const e of r)i&&i.length+1+e.length>o?(s.push(i),i=e):i=i?`${i} ${e}`:e;return i&&s.push(i),s}function Z(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 J(t,n,o,r){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:s,title:i,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!s&&!i)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,f=i?u?[i]:K(i,c):[],y=s?u?[s]:K(s,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:f.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=f.length*p),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=null;if((i||s)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(f.length+y.length)*p+(y.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+y.length-1)*p;let k=0;return"topBottom"===d?k=0>o?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+p+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),j]})}function ee(t,n,o,r,s){var i;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.jsx("rect",{width:t,height:r,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 t=r||0,i=s||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.jsx("line",{x1:r,y1:(n.y1||0)-i,x2:r,y2:(n.y2||0)-i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-i;a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,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(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,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(e.jsx("line",{x1:0,y1:(n.y1||0)-i,x2:0,y2:(n.y2||0)-i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(i=null==n?void 0:n.width)&&void 0!==i?i:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:Z((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function te(t,n,o,r,s,i){const a=[];let l=0,c=0;if("callout-circle"!==s&&"label"!==s||!(null==i?void 0:i.radius)){if("callout-rect"===s&&i){const e=i.width||0,o=i.height||0;if(e>0||o>0){const r=e/2,s=o/2,i=t-r,a=n-s;if(0!==i||0!==a){const t=Math.abs(i),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+i*h,c=s+a*h}}}else if("bracket"===s&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(i.radius||0)+(i.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,s=16/180*Math.PI,i=Math.atan2(n-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+o*Math.cos(i+s)},${c+o*Math.sin(i+s)}L${l+o*Math.cos(i-s)},${c+o*Math.sin(i-s)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:a})}function ne(t){const{x:n=0,y:o=0,dx:r,dy:s,nx:i,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:f={},"data-testid":y}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=s||0;null!=i&&(v=i-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.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f,{children:[!m.has("connector")&&te(v,b,c,h,x,u),!m.has("subject")&&ee(x,u,h,n,o),!m.has("note")&&J(l,v,b,h)]}))}function oe(t){var n,o;const{noteData:r}=t,{screenCoordinates:s}=r,i="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&s){const t=r.nx||s[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||s[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=s.map((n,o)=>{const s=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(ne,Object.assign({"data-testid":"semiotic-annotation"},s,{type:i}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=r.note||{title:"none",label:r.label},c=`${l.label}-${l.title}-${r.i}`;return e.jsx(ne,Object.assign({"data-testid":"semiotic-annotation",events:a},r,{type:i}),c)}function re(e,t){var n,o,r;const s=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return s?null!=e.x?s(e.x):t.xAccessor&&null!=e[t.xAccessor]?s(e[t.xAccessor]):null:null}function se(e,t){var n,o,r;const s=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return s?null!=e.y?s(e.y):t.yAccessor&&null!=e[t.yAccessor]?s(e[t.yAccessor]):null:null}function ie(e,t,n){var o,r,s,i;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const s=n.pointNodes[r];if(s.pointId===e.pointId){const e={x:s.x,y:s.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const s=function(e){var t,n,o,r,s,i;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!==(s=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==s?s:null===(i=e.scales)||void 0===i?void 0:i.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 s&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,s)),s}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=re(e,n),c=se(e,n)),null!=l&&null!=c)return null===(s=n.stickyPositionCache)||void 0===s||s.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function ae(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const le={linear:a.curveLinear,monotoneX:a.curveMonotoneX,monotoneY:a.curveMonotoneY,step:a.curveStep,stepAfter:a.curveStepAfter,stepBefore:a.curveStepBefore,basis:a.curveBasis,cardinal:a.curveCardinal,catmullRom:a.curveCatmullRom};function ce(n){const{width:o,height:r,totalWidth:s,totalHeight:i,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h}=n,g="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),f=t.useMemo(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||ue)(e)})),[l,d,g,h]),y=u&&l&&!g,m=c&&l&&!g;return y||m?e.jsx("svg",{width:s,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[y&&e.jsx("g",{className:"ordinal-grid",children:f.map((t,n)=>e.jsx("line",{x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:o,y2:p?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),m&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,p?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function ue(e){return Math.round(100*e)/100+""}function de(n){var o,r;const{width:s,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,showCategoryTicks:f,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:j,legend:w,legendHoverBehavior:k,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:_,annotations:C,svgAnnotationRules:P,xAccessor:L,yAccessor:B,annotationData:T,underlayRendered:R,children:I}=n,H="radial"===(null==h?void 0:h.projection),$="horizontal"===(null==h?void 0:h.projection),D=!1!==f,N=t.useMemo(()=>g&&D&&h&&!H?h.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=h.o(e))&&void 0!==n?n:0)+h.o.bandwidth()/2,label:v?v(e,t):e}}):[],[g,D,h,v,H]),F=n.rTickValues,W=n.tickLabelEdgeAlign,z=t.useMemo(()=>g&&h&&!H?(F||h.r.ticks(5)).map(e=>({value:e,pixel:h.r(e),label:(b||ue)(e)})):[],[g,h,b,H,F]),E=t.useRef(new Map),q=t.useRef(null!==(o=null==C?void 0:C.length)&&void 0!==o?o:0),G=null!==(r=null==C?void 0:C.length)&&void 0!==r?r:0;q.current!==G&&(q.current=G,E.current=new Map);const V=t.useMemo(()=>{if(!C||0===C.length)return null;const t=function(t,n,o){var r,s,l,c,u,d,h,g,f,y,m,v,b,x,j,w,k,A,O,S,M,_,C,P,L,B,T,R,I,H,$,D,N,F,W,z,E,q,G,V,Y,X,Q,U,K,Z,J,ee;switch(t.type){case"label":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return ae(s,i,o)?e.jsx(oe,{noteData:{x:s,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"callout":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return ae(s,i,o)?e.jsx(oe,{noteData:{x:s,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"x-threshold":{const r=re(t,o);if(null==r)return null;const s=t.color||"#f97316",i=t.labelPosition||"top";let a;return a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:r+4,y:a,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const r=se(t,o);if(null==r)return null;const s=t.color||"#f97316",i=t.labelPosition||"right";let a,l;return"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:r-4,textAnchor:l,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:re(Object.assign(Object.assign({},e),{type:"point"}),o),y:se(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=i.packEnclose(r),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:re(Object.assign(Object.assign({},e),{type:"point"}),o),y:se(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=t.padding||10,i=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...i)-s,c=Math.max(...i)+s,u=Math.min(...a)-s,d=Math.max(...a)+s;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const r=o.data||[],s="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],i={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:s.map((n,r)=>{const s=re(n,o),a=se(n,o);if(null==s||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||i;return e.jsx("circle",Object.assign({cx:s,cy:a,r:l},c),"hl-"+r)})},"ann-"+n)}case"bracket":{const r=re(t,o),s=se(t,o);return e.jsx(oe,{noteData:{x:null!=r?r:0,y:null!=s?s:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const a=o.xAccessor||"x",g=o.yAccessor||"y",f=i.map(e=>[e[a],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(s=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(l=o.scales)||void 0===l?void 0:l.time,m=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!y||!m)return null;const v=t.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),s=o.map(e=>e[1]),i=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(i-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*s[e],g+=t*r[e]*r[e],p+=t*r[e]*s[e])}if(0===u){a.push([t,s[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*p-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?p.default.polynomial(f,{order:t.order||2}):p.default.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),j=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:j,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:j,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const r=null!==(f=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(y=o.scales)||void 0===y?void 0:y.value,s=null!==(m=null==r?void 0:r(t.y0))&&void 0!==m?m:0,i=null!==(v=null==r?void 0:r(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(s,i),width:o.width||0,height:Math.abs(i-s),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(s,i)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const s=o.xAccessor||"x",i=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(j=o.scales)||void 0===j?void 0:j.time,l=null!==(k=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==k?k:null===(A=o.scales)||void 0===A?void 0:A.value;if(!i||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.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=le[o.curve||"linear"]||a.curveLinear,p=a.area().x(e=>i(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const f=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:f,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:i(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const s=o.yAccessor||"y",i=null!==(M=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(_=o.scales)||void 0===_?void 0:_.time,a=null!==(P=null===(C=o.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.value;if(!i||!a)return null;const l=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(B=t.threshold)&&void 0!==B?B:2,g=c-h*d,p=!1!==t.showBand,f=t.fill||"#6366f1",y=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,m=t.anomalyColor||"#ef4444",v=null!==(R=t.anomalyRadius)&&void 0!==R?R:6,b=a(c+h*d),x=a(g),j=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),j.map((t,n)=>{const r=re(t,o),s=se(t,o);return null==r||null==s?null:e.jsx("circle",{cx:r,cy:s,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const s=o.xAccessor||"x",i=o.yAccessor||"y",a=null!==(H=null===(I=o.scales)||void 0===I?void 0:I.x)&&void 0!==H?H:null===($=o.scales)||void 0===$?void 0:$.time,l=null!==(N=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==N?N:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!l)return null;const c=r.map(e=>[e[s],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,s]of c)t+=e,n+=s,o+=e*e,r+=e*s;const s=e*o-t*t;if(1e-12>Math.abs(s))return null;const i=(e*r-t*n)/s,a=(n-i*t)/e;u=e=>a+i*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(W=t.confidence)&&void 0!==W?W:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=t.steps)&&void 0!==z?z:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*j);const k=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-f,2)/y:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&k.length>0&&e.jsx("text",{x:a(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let r=null,s=null;if(null!=t.px&&null!=t.py)r=t.px,s=t.py;else{const e=ie(t,n,o);if(!e)return null;r=e.x,s=e.y}if(null==r||null==s)return null;if(!ae(r,s,o))return null;const i=null!==(V=t.dx)&&void 0!==V?V:0,a=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(X=t.width)&&void 0!==X?X:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(U=t.content)&&void 0!==U?U:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:r+i-l/2,y:s+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return e.jsx("text",{x:s+(t.dx||0),y:i+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const r=t.category;if(null==r)return null;const s=null===(K=o.scales)||void 0===K?void 0:K.o,i=null===(Z=o.scales)||void 0===Z?void 0:Z.x,a=null===(J=o.scales)||void 0===J?void 0:J.y,l=(null==s?void 0:s.bandwidth)?s:(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,g=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:l===i)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+n)}default:return null}},n="horizontal"===(null==h?void 0:h.projection),o=(null==h?void 0:h.o)?e=>{var t;return(null!==(t=h.o(e))&&void 0!==t?t:0)+h.o.bandwidth()/2}:null,r={scales:h?{x:n?h.r:o||h.r,y:n&&o||h.r,time:h.r,value:h.r,o:h.o}:null,timeAxis:"x",xAccessor:L,yAccessor:B,width:s,height:l,data:T,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:E.current};return C.map((e,n)=>{if(P){const o=P(e,n,r);return null!=o?o:t(e,n,r)}return t(e,n,r)}).filter(Boolean)},[C,P,s,l,h,L,B,T]);return g||j||w||_||V&&V.length>0||x||I?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof j?j:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof j?j+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[x&&h&&!H&&!R&&e.jsx("g",{className:"ordinal-grid",children:z.map((t,n)=>e.jsx("line",{x1:$?t.pixel:0,y1:$?0:t.pixel,x2:$?t.pixel:s,y2:$?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),g&&h&&!H&&e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,$?{children:[!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((t,n)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+n)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:y}),!R&&e.jsx("line",{x1:0,y1:l,x2:s,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!R&&(null==h?void 0:h.r)&&(()=>{const t=h.r(0);return t>1&&s-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),z.map((t,n)=>{const o=W?0===n?"start":n===z.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+n)}),m&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m})]}:{children:[!R&&(()=>{const t=(null==h?void 0:h.r)?h.r(0):l,n=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:n,x2:s,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),N.map((t,n)=>e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+n)),y&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,n)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+n)),m&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:m})]})}),V,_,I]}),j&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof j?j:null}),U({legend:w,totalWidth:c,totalHeight:u,margin:d,legendPosition:M,title:j,legendHoverBehavior:k,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S})]}):null}function he({width:n,height:o,totalWidth:r,totalHeight:s,margin:i,scales:a,onBrush:l}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(l);g.current=l;const p=t.useRef(a);p.current=a;const f=t.useRef(!1),y=t.useRef(null),m="horizontal"===(null==a?void 0:a.projection),v=t.useRef(m);return v.current=m,t.useEffect(()=>{if(!d.current)return;const e=c.select(d.current).select(".brush-g"),t=m?u.brushX():u.brushY();return t.extent([[0,0],[n,o]]),t.on("brush end",e=>{if(f.current)return;const t=p.current;if(!t)return;if(!e.selection)return y.current=null,void g.current(null);const[n,o]=e.selection;let r;r=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const s={r:r};y.current=s,g.current(s)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[n,o,m]),t.useEffect(()=>{if(!a||!h.current||!y.current)return;if(!d.current)return;const e=y.current,t=c.select(d.current).select(".brush-g"),n=a.r(e.r[0]),o=a.r(e.r[1]);m?(f.current=!0,t.call(h.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(h.current.move,[o,n]),f.current=!1)},[a,m]),e.jsx("svg",{ref:d,width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${i.left},${i.top})`,style:{pointerEvents:"all"}})})}function ge(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const pe="undefined"==typeof window||"undefined"==typeof document,fe=g.createContext(null),ye={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function me(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},s=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],i=Object.keys(n).sort((e,t)=>{const n=s.indexOf(e),o=s.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of i)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const ve=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},be={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"},xe={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},je={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)"},we={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ke={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)"},Ae={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Oe={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Se({scene:t,chartType:n,tableId:o,chartTitle:r}){var s;const[i,a]=g.useState(!1),l=g.useContext(fe),c=null!==(s=null==l?void 0:l.visible)&&void 0!==s&&s,u=i||c,d=g.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,p=g.useCallback(()=>{i||c||a(!0)},[i,c]),f=g.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:ye}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:p,style:ye,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,r,s,i,a,l,c,u,d,h,g,p,f,y,m,v,b,x,j,w,k,A,O;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.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=M.topPath,t=Array.isArray(M.datum)?M.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!=M.datum&&"object"==typeof M.datum?M.datum:{},s=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",i=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:s,value:null!=i?i:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(i=null===(s=M.datum)||void 0===s?void 0:s.category)&&void 0!==i?i:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.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=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=M.cx)&&void 0!==g?g:M.x,y:null!==(p=M.cy)&&void 0!==p?p:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(f=M.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(v=M.cy)&&void 0!==v?v:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(j=null===(x=null===(b=M.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==j?j:null===(w=M.datum)||void 0===w?void 0:w.name)&&void 0!==k?k:"",value:null!==(O=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],s=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),s+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:s/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ve(e.min)} to ${ve(e.max)}, mean ${ve(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const j=Array.from(x);return e.jsxs("div",{ref:d,id:o,tabIndex:-1,onBlur:f,style:be,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:je,children:"×"}),e.jsx("div",{role:"note",style:xe,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:we,children:[e.jsxs("caption",{style:Oe,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:ke,children:"type"}),j.map(t=>e.jsx("th",{style:ke,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Ae,children:t.label}),j.map(n=>{return e.jsx("td",{style:Ae,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":ve(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function Me({summary:t}){return t?e.jsx("div",{role:"note",style:ye,children:t}):null}function _e({tableId:t}){return e.jsx("a",{href:"#"+t,style:ye,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ye)},children:"Skip to data table"})}function Ce({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:ye,children:n})}const Pe="var(--semiotic-focus, #005fcc)";function Le({active:t,hoverPoint:n,margin:o,size:r,shape:s="circle",width:i,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===s&&null!=i&&null!=a){const t=Math.max(i,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Pe,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===s?{cx:l,cy:c,r:12,fill:"none",stroke:Pe,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Pe,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Be({x:t,y:n,containerWidth:o,containerHeight:r,margin:s,children:i,className:a="stream-frame-tooltip",zIndex:l=1}){const c=g.useRef(null),[u,d]=g.useState(null);g.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:a,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"},children:i})}function Te(n){const o=t.createContext(null),r=Re(n);return[function({children:r}){const s=t.useMemo(()=>Re(n),[]);return e.jsx(o.Provider,{value:s,children:r})},e=>{var n;const s=null!==(n=t.useContext(o))&&void 0!==n?n:r,i=t.useRef(e);i.current=e;const a=t.useCallback(()=>i.current(s.getState()),[s]),l=t.useCallback(()=>i.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,l)}]}function Re(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Ie(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 He(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:$e})})),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 $e=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],De={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}},Ne={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}},Fe={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:$e,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"},[We,ze]=Te(e=>({theme:De,setTheme(t){e(e=>{if("light"===t)return{theme:De};if("dark"===t)return{theme:Ne};if("high-contrast"===t)return{theme:Fe};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ne:De;return{theme:He(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:He(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 Ee=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,qe=new WeakMap;let Ge=0,Ve=!1,Ye=null,Xe=null,Qe=null;function Ue(e,t){var n,o;if(!t)return t;const r=Ee.exec(t);if(!r)return t;const s=e.canvas;if(!s)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Ve)return;if("undefined"==typeof window||"undefined"==typeof document)return;Ve=!0;const e=()=>{Ge++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ye=new MutationObserver(e),Ye.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Xe=window.matchMedia("(prefers-color-scheme: dark)"),Qe=e,"function"==typeof Xe.addEventListener?Xe.addEventListener("change",Qe):"function"==typeof Xe.addListener&&Xe.addListener(Qe)}catch(e){}}();let i=qe.get(s);i&&i.version===Ge||(i={version:Ge,map:new Map},qe.set(s,i));const a=i.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(s).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return i.map.set(t,l),l}function Ke(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ze(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(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=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[r,s]=function(e,n,o){const r=t.useRef(null),[s,i]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&s?s.w:e[0],o&&s?s.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=s[0]-i.left-i.right,l=s[1]-i.top-i.bottom,c=Ke(e.foregroundGraphics,s,i),u=Ke(e.backgroundGraphics,s,i),d=ze(e=>e.theme),{transition:h,introEnabled:p}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="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:!(r||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),f="semiotic-table-"+g.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),w=t.useRef(0),k=t.useCallback(()=>{w.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(k))},[k]),O=t.useCallback(()=>{j.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const S=e.themeDirtyRef;return t.useEffect(()=>{S&&(Ge++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:r,size:s,margin:i,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function Je(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function et(e,t,n=.3){Je(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 tt(e,t,n=.6){var o,r,s,i,a;if(!Je(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(s=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==s?s:0,d=null!==(a=null!==(i=t.cy)&&void 0!==i?i: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 nt(e,t,n,o=.35){Je(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function ot(e,t,n){const o=t.fillGradient;if(!o)return null;const r=t.roundedEdge;let s=t.x,i=t.y,a=t.x,l=t.y+t.h;if("bottom"===r?(i=t.y+t.h,l=t.y):"right"===r?(s=t.x+t.w,i=t.y,a=t.x,l=t.y):"left"===r&&(s=t.x,i=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(s,i,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(s,i,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 r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const s=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return s?[+s[1],+s[2],+s[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 rt=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)st(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||Ue(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?ot(e,t,n):null;e.fillStyle=o||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:i,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(s,i),e.lineTo(s+a-r,i),e.arcTo(s+a,i,s+a,i+r,r),e.lineTo(s+a,i+l-r),e.arcTo(s+a,i+l,s+a-r,i+l,r),e.lineTo(s,i+l);break;case"left":e.moveTo(s+a,i),e.lineTo(s+r,i),e.arcTo(s,i,s,i+r,r),e.lineTo(s,i+l-r),e.arcTo(s,i+l,s+r,i+l,r),e.lineTo(s+a,i+l);break;case"bottom":e.moveTo(s,i),e.lineTo(s+a,i),e.lineTo(s+a,i+l-r),e.arcTo(s+a,i+l,s+a-r,i+l,r),e.lineTo(s+r,i+l),e.arcTo(s,i+l,s,i+l-r,r);break;default:e.moveTo(s,i+l),e.lineTo(s,i+r),e.arcTo(s,i,s+r,i,r),e.lineTo(s+a-r,i),e.arcTo(s+a,i,s+a,i+r,r),e.lineTo(s+a,i+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||Ue(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?ot(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=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}et(e,t),e.globalAlpha=1}};function st(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const s=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),s){const s=r+o,i=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=s)e.drawImage(n,i,o,r,r)}else{const s=r+o,i=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=s)e.drawImage(n,o,i,r,r)}e.restore()}const it=(e,t,n,o)=>{var r;const s=t.filter(e=>"point"===e.type);if(0!==s.length){e.save();try{for(const t of s){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Ue(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),tt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function at(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 lt(e,t){const n=a.arc().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 ct=(e,t,n,o)=>{var r,s;const i=t.filter(e=>"wedge"===e.type);for(const t of i){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:1,o=null!==(s=t.style.opacity)&&void 0!==s?s:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),lt(e,t)):(at(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(at(e,t),nt(e,t)),e.globalAlpha=1}};const ut=(e,t,n,o)=>{var r,s;const i=t.filter(e=>"violin"===e.type);for(const t of i){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.6,e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(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()}},dt=(e,t,n,o)=>{var r,s,i;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!==(s=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==s?s:.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=Ue(e,n.style.stroke)||("string"==typeof n.style.fill?Ue(e,n.style.fill):n.style.fill)||Ue(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(i=n.style.opacity)&&void 0!==i?i:.5,e.stroke(),e.globalAlpha=1}};function ht(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 gt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let pt=null;function ft(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:s=6,angle:i=45}=e,a=Math.max(8,Math.ceil(2*s));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(pt||(pt=document.createElement("canvas")),pt.width=e,pt.height=e,pt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=i*Math.PI/180;if(45===i||-45===i){const e=i>0?1:-1;for(let t=-a;2*a>=t;t+=s)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+=s)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const yt=new Map;function mt(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=yt.get(n);if(void 0!==o)return o;const r=ft({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return yt.set(n,r),r}function vt(e,t,n,o,r,s){e.moveTo(t+s,n),e.lineTo(t+o-s,n),e.quadraticCurveTo(t+o,n,t+o,n+s),e.lineTo(t+o,n+r-s),e.quadraticCurveTo(t+o,n+r,t+o-s,n+r),e.lineTo(t+s,n+r),e.quadraticCurveTo(t,n+r,t,n+r-s),e.lineTo(t,n+s),e.quadraticCurveTo(t,n,t+s,n),e.closePath()}function bt(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 xt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const jt=e=>[dt,...e],wt={bar:jt([rt]),clusterbar:jt([rt]),point:jt([it]),swarm:jt([it]),pie:[ct],donut:[ct],boxplot:jt([(e,t,n,o)=>{var r,s;const i=t.filter(e=>"boxplot"===e.type);for(const t of i){const n=t.columnWidth/2,o="vertical"===t.projection,i=Ue(e,"var(--semiotic-primary, #007bff)"),a=Ue(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?Ue(e,l)||l:null!=l?l:i,u=t.style.stroke,d="string"==typeof u?Ue(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.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),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},it]),violin:jt([ut]),histogram:jt([rt]),ridgeline:jt([ut]),timeline:jt([rt]),funnel:[rt,(e,t,n,o)=>{var r,s,i,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!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s: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===(i=t.style)||void 0===i?void 0:i.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,s,i,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!==(s=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==s?s:0))continue;const i=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,i,a),e.fillStyle="#fff",e.fillText(o,i,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(i=n.__funnelBarW)&&void 0!==i?i:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const s=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?ht(r):null!=s?`${ht(r)} (${gt(s)})`:ht(r),e.measureText(c).width+16>o){if(l||null==s)continue;if(c=ht(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[rt,(e,t,n,o)=>{var r,s;const i=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 i){const n=("string"==typeof t.style.fill?t.style.fill:null)||Ue(e,"var(--semiotic-border, #999)"),o=mt(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(s=t.style.opacity)&&void 0!==s?s:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===r.length)return;const s=Ue(e,"var(--semiotic-text, #333)"),i=Ue(e,"var(--semiotic-text-secondary, #666)");for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,a=!(!0===n.__barFunnelIsFirstStep)&&null!=r,l=a?xt(r):"",c=bt(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,f=p-h/2,y=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(),vt(e,f,y,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),vt(e,f,y,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=s,e.fillText(l,p,y+3),e.font="11px sans-serif",e.fillStyle=i,e.fillText(c,p,y+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=s,e.fillText(c,p,y+3))}e.lineWidth=1}],swimlane:jt([rt])},kt={top:50,right:40,bottom:60,left:70},At={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 Ot({hover:t}){var n,o,r,s,i,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:At,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const p=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",f=null!==(a=null!==(i=null!==(s=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==s?s:l.__rValue)&&void 0!==i?i:l.pct)&&void 0!==a?a:"";if(!p&&""===f){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:At,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[p&&e.jsx("div",{style:{fontWeight:"bold"},children:p+""}),""!==f&&e.jsx("div",{children:"number"==typeof f?f.toLocaleString():f+""})]})}const St=t.forwardRef(function(n,o){var r,s,i,l,c,u,d,h,p,y;const{chartType:m,runtimeMode:v,data:b,oAccessor:x="category",rAccessor:j="value",colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:S,valueAccessor:M,categoryAccessor:_,projection:C="vertical",size:P=[600,400],responsiveWidth:L,responsiveHeight:R,margin:z,barPadding:E,roundedTop:q,gradientFill:G,baselinePadding:V,innerRadius:Y,cornerRadius:X,normalize:Q,startAngle:U,sweepAngle:K,dynamicColumnWidth:Z,bins:J,showOutliers:ee,showIQR:te,amplitude:ne,connectorOpacity:oe,showLabels:re,connectorAccessor:se,connectorStyle:ie,dataIdAccessor:ae,rExtent:le,oExtent:ue,extentPadding:fe=.05,oSort:ye,windowMode:ve="sliding",windowSize:be=200,pieceStyle:xe,summaryStyle:je,colorScheme:we,barColors:ke,showAxes:Ae=!0,showCategoryTicks:Oe,categoryLabel:Pe,valueLabel:Te,categoryFormat:Re,valueFormat:He,oLabel:$e,rLabel:De,oFormat:Ne,rFormat:Fe,rTickValues:We,tickLabelEdgeAlign:ze,enableHover:Ee=!0,hoverAnnotation:qe,tooltipContent:Ge,customHoverBehavior:Ve,annotations:Ye,svgAnnotationRules:Xe,showGrid:Qe=!1,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,backgroundGraphics:ot,foregroundGraphics:rt,title:st,className:it,background:at,centerContent:lt,decay:ct,pulse:ut,transition:dt,animate:ht,staleness:gt,brush:pt,onBrush:ft,accessibleTable:yt=!0,description:mt,summary:vt}=n,bt=t.useRef(!0),xt=Ze({sizeProp:P,responsiveWidth:L,responsiveHeight:R,userMargin:z,marginDefault:kt,foregroundGraphics:rt,backgroundGraphics:ot,animate:ht,transitionProp:dt,themeDirtyRef:bt}),{reducedMotionRef:jt,responsiveRef:At,size:St,margin:Mt,adjustedWidth:_t,adjustedHeight:Ct,resolvedForeground:Pt,resolvedBackground:Lt,currentTheme:Bt,transition:Tt,introEnabled:Rt,tableId:It,rafRef:Ht,renderFnRef:$t,scheduleRender:Dt}=xt,Nt=null!=Pe?Pe:$e,Ft=null!=Te?Te:De,Wt=null!=Re?Re:Ne,zt=null!=He?He:Fe,Et=t.useRef(null),qt=t.useRef(null),[Gt,Vt]=t.useState(null),[Yt,Xt]=t.useState(null),[Qt,Ut]=t.useState(0),[Kt,Zt]=t.useState(!1),Jt=Ee||qe,en="streaming"===v,tn=t.useMemo(()=>{var e,t,n;return{chartType:m,runtimeMode:en?"streaming":"bounded",windowSize:be,windowMode:ve,extentPadding:fe,projection:C,oAccessor:en?void 0:x,rAccessor:en?void 0:j,colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:en?S:void 0,valueAccessor:en?M||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:en?_||x:void 0,rExtent:le,oExtent:ue,barPadding:E,roundedTop:q,gradientFill:G,baselinePadding:V,innerRadius:Y,cornerRadius:X,normalize:Q,startAngle:U,sweepAngle:K,dynamicColumnWidth:Z,bins:J,showOutliers:ee,showIQR:te,amplitude:ne,connectorOpacity:oe,showLabels:re,connectorAccessor:se,connectorStyle:ie,dataIdAccessor:ae,oSort:ye,pieceStyle:xe,summaryStyle:je,colorScheme:we,themeCategorical:null===(e=null==Bt?void 0:Bt.colors)||void 0===e?void 0:e.categorical,themeSemantic:Ie(Bt),themeSequential:null===(t=null==Bt?void 0:Bt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Bt?void 0:Bt.colors)||void 0===n?void 0:n.diverging,barColors:ke,decay:ct,pulse:ut,transition:Tt,introAnimation:Rt,staleness:gt}},[m,be,ve,fe,C,x,j,w,k,A,O,S,M,_,le,ue,E,q,G,V,Y,X,Q,U,K,Z,J,ee,te,ne,oe,re,se,ie,ae,ye,xe,je,we,ke,ct,ut,null==Tt?void 0:Tt.duration,null==Tt?void 0:Tt.easing,Rt,gt,en,Bt]),nn=t.useRef(null);nn.current||(nn.current=new B(tn)),t.useEffect(()=>{var e;null===(e=nn.current)||void 0===e||e.updateConfig(tn),bt.current=!0,Dt()},[tn,Dt]);const on=t.useRef(null);on.current||(on.current=new f(e=>{const t=nn.current;t&&t.ingest(e)&&(bt.current=!0,Dt())}));const rn=t.useCallback(e=>{var t;null===(t=on.current)||void 0===t||t.push(e)},[]),sn=t.useCallback(e=>{var t;null===(t=on.current)||void 0===t||t.pushMany(e)},[]),an=t.useCallback(()=>{var e,t;null===(e=on.current)||void 0===e||e.clear(),null===(t=nn.current)||void 0===t||t.clear(),bt.current=!0,Dt()},[Dt]),ln=t.useCallback(e=>{var t,n;null===(t=on.current)||void 0===t||t.clearLastData(),null===(n=on.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:rn,pushMany:sn,replace:ln,remove:e=>{var t,n,o,r;null===(t=on.current)||void 0===t||t.flush();const s=null!==(o=null===(n=nn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(s.length>0){const e=null===(r=qt.current)||void 0===r?void 0:r.data;!!qt.current&&s.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(qt.current=null,Vt(null)),bt.current=!0,Dt()}return s},update:(e,t)=>{var n,o,r;null===(n=on.current)||void 0===n||n.flush();const s=null!==(r=null===(o=nn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return s.length>0&&(bt.current=!0,Dt()),s},clear:an,getData:()=>{var e,t,n;return null===(e=on.current)||void 0===e||e.flush(),null!==(n=null===(t=nn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[rn,sn,ln,an,Dt]),t.useEffect(()=>{var e;b&&(null===(e=on.current)||void 0===e||e.setBoundedData(b))},[b]);const{hoverHandlerRef:cn,hoverLeaveRef:un,onPointerMove:dn,onPointerLeave:hn}=xt;cn.current=e=>{if(!Jt)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,r=e.clientY-n.top-Mt.top;if(0>o||o>_t||0>r||r>Ct)return void(qt.current&&(qt.current=null,Vt(null),Ve&&Ve(null),Dt()));const s=nn.current;if(!s||0===s.scene.length)return;const i="radial"===C,a=function(e,t,n,o=30,r,s=0){let i=null;if(r){const e=function(e,t,n,o,r){const s=Math.max(o,r+5,12),i=t-s,a=t+s,l=n-s,c=n+s;let u=null,d=1/0;return e.visit((e,r,s,h,g)=>{if(r>a||i>h||s>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,s=e.x-t,i=e.y-n,a=Math.sqrt(s*s+i*i);T(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,s);e&&(i={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const s of e){let e=null;switch(s.type){case"rect":e=I(s,t,n);break;case"point":if(r)break;e=H(s,t,n,o);break;case"wedge":e=$(s,t,n);break;case"boxplot":e=D(s,t,n);break;case"violin":e=N(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(s.scene,i?o-_t/2:o,i?r-Ct/2:r,30,s.pointQuadtree,s.maxPointRadius);if(!a)return void(qt.current&&(qt.current=null,Vt(null),Ve&&Ve(null),Dt()));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 x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m}),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;qt.current=l,Vt(l),Ve&&(Ve(l),bt.current=!0),Dt()},un.current=()=>{qt.current&&(qt.current=null,Vt(null),Ve&&(Ve(null),bt.current=!0),Dt())};const gn=t.useRef(-1),pn=t.useRef(null),fn=t.useRef(null),yn=t.useCallback(e=>{const t=nn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(fn.current&&fn.current.version===n)o=fn.current.graph;else{const e=function(e){var t,n,o,r;const s=[];for(const i of e)if("rect"===i.type&&null!=i.x){const e=null!==(n=null===(t=i.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";s.push({x:i.x+i.w/2,y:i.y+i.h/2,datum:i.datum,shape:"rect",w:i.w,h:i.h,group:null!==(o=i.group)&&void 0!==o?o:e})}else if("point"===i.type)s.push({x:i.x,y:i.y,datum:i.datum,shape:"circle",group:null!==(r=i.group)&&void 0!==r?r:"_default"});else if("wedge"===i.type&&null!=i.cx){const e=((i.startAngle||0)+(i.endAngle||0))/2,t=((i.innerRadius||0)+(i.outerRadius||50))/2;s.push({x:i.cx+Math.cos(e)*t,y:i.cy+Math.sin(e)*t,datum:i.datum,shape:"wedge",group:"_default"})}return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),s=Array.from(o.values()).flat();s.sort((e,t)=>e.x-t.x||e.y-t.y);const i=new Map;for(let e=0;s.length>e;e++){s[e]._flatIndex=e;const t=null===(n=s[e].datum)||void 0===n?void 0:n.id;null!=t&&i.set(t+"",e)}return{flat:s,groups:r,byGroup:o,idToIdx:i}}(e),fn.current={version:n,graph:o}}const r=gn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),gn.current=0;const t=o.flat[0];pn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},W(t)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});return qt.current=n,Vt(n),Ve&&Ve(n),void Dt()}const s=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),s=e.flat[r];return{flatIndex:r,group:null!==(n=s.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=s._groupIndex)&&void 0!==o?o:0}}(o,r),i=function(e,t,n){const{group:o,indexInGroup:r}=t,s=n.byGroup.get(o);switch(e){case"ArrowRight":return s.length-1>r?s[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?s[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?F(n,n.groups[e+1],s[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?F(n,n.groups[e-1],s[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,s,o);if(null===i)return;if(e.preventDefault(),0>i)return gn.current=-1,pn.current=null,qt.current=null,Vt(null),Ve&&Ve(null),void Dt();gn.current=i;const a=o.flat[i];pn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},W(a)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});qt.current=l,Vt(l),Ve&&Ve(l),Dt()},[Ve,Dt]),mn=t.useCallback(e=>{gn.current=-1,pn.current=null,dn(e)},[dn]);$t.current=()=>{var e,t;Ht.current=0;const n=Et.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=nn.current;if(!r)return;const s="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(jt.current?s+1e6:s),a=!jt.current&&i,l=bt.current;l&&!i&&(r.computeScene({width:_t,height:Ct}),bt.current=!1),(l||a)&&n.setAttribute("aria-label",me(r.scene,m+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=St[0]*c,d=St[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=St[0]+"px",n.style.height=St[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,St[0],St[1]);const h=null!==(e=null==gt?void 0:gt.threshold)&&void 0!==e?e:5e3,g=gt&&r.lastIngestTime>0&&s-r.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==gt?void 0:gt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==at&&!ot){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=at||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,St[0],St[1]))}const p="radial"===C;o.save(),o.beginPath(),o.rect(Mt.left,Mt.top,_t,Ct),o.clip(),p?(o.save(),o.translate(Mt.left+_t/2,Mt.top+Ct/2)):o.translate(Mt.left,Mt.top);const f=wt[m]||[],y={width:_t,height:Ct};for(const e of f)e(o,r.scene,r.scales,y);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(Xt(r.scales),Ut(e=>e+1)),(null==gt?void 0:gt.showBadge)&&Zt(!!g),(a||null!=r.activeTransition||r.hasActivePulses)&&(Ht.current=requestAnimationFrame(()=>$t.current()))},t.useEffect(()=>(Dt(),()=>{var e;null===(e=on.current)||void 0===e||e.clear()}),[Dt]),t.useEffect(()=>{bt.current=!0,Dt()},[m,_t,Ct,Ae,at,Dt]),function(e,n,o,r,s,i){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==s&&(i(u),o.current=!0,r())},1e3);return()=>clearInterval(t)},[e,s,r])}(gt,nn,bt,Dt,Kt,Zt);const vn=Jt&&Gt?Ge?Ge(Gt):e.jsx(Ot,{hover:Gt}):null,bn="radial"===C,xn=vn?e.jsx(Be,{x:Gt?bn?Gt.x+_t/2:Gt.x:0,y:Gt?bn?Gt.y+Ct/2:Gt.y:0,containerWidth:_t,containerHeight:Ct,margin:Mt,className:"stream-ordinal-tooltip",children:vn}):null;if(pe){const t=nn.current;t&&b&&(t.ingest({inserts:b,bounded:!0}),t.computeScene({width:_t,height:Ct}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[],o=null!==(s=null==t?void 0:t.scales)&&void 0!==s?s:null,i="radial"===C,l=i?Mt.left+_t/2:Mt.left,c=i?Mt.top+Ct/2:Mt.top;return e.jsxs("div",{className:"stream-ordinal-frame"+(it?" "+it:""),role:"img","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:St[0],height:St[1]},children:[e.jsx(Me,{summary:vt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:St[0],height:St[1],style:{position:"absolute",left:0,top:0},children:[Lt&&e.jsx("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Lt}),e.jsxs("g",{transform:`translate(${l},${c})`,children:[at&&e.jsx("rect",{x:0,y:0,width:_t,height:Ct,fill:at}),n.map((t,n)=>function(t,n){var o,r,s,i,l;const c=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",u=e=>`ord-${t.type}-${c}-${n}-${e}`,d=`ord-${t.type}-${c}-${n}`;switch(t.type){case"rect":{const n=t,o=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(d)+"-grad",r=function(t,n){const o=t.fillGradient;if(!o)return null;let r=t.x,s=t.y,i=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(s=t.y+t.h,a=t.y):"right"===t.roundedEdge?(r=t.x+t.w,s=t.y,i=t.x,a=t.y):"left"===t.roundedEdge&&(r=t.x,s=t.y,i=t.x+t.w,a=t.y);const l=[];if("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;for(let n=0;t.length>n;n++)l.push(e.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=ge(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:r,y1:s,x2:i,y2:a,children:l})}(n,o),s=r?`url(#${o})`:ge(n.style.fill);if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:i,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${i} L${o+a-t},${i} A${t},${t} 0 0 1 ${o+a},${i+t} L${o+a},${i+l-t} A${t},${t} 0 0 1 ${o+a-t},${i+l} L${o},${i+l} Z`;break;case"left":c=`M${o+a},${i} L${o+t},${i} A${t},${t} 0 0 0 ${o},${i+t} L${o},${i+l-t} A${t},${t} 0 0 0 ${o+t},${i+l} L${o+a},${i+l} Z`;break;case"bottom":c=`M${o},${i} L${o+a},${i} L${o+a},${i+l-t} A${t},${t} 0 0 1 ${o+a-t},${i+l} L${o+t},${i+l} A${t},${t} 0 0 1 ${o},${i+l-t} Z`;break;default:c=`M${o},${i+l} L${o},${i+t} A${t},${t} 0 0 1 ${o+t},${i} L${o+a-t},${i} A${t},${t} 0 0 1 ${o+a},${i+t} L${o+a},${i+l} Z`}return e.jsxs(g.Fragment,{children:[r&&e.jsx("defs",{children:r}),e.jsx("path",{d:c,fill:s,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},d)}return e.jsxs(g.Fragment,{children:[r&&e.jsx("defs",{children:r}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:s,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},d)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:ge(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},d)}case"wedge":{const n=t,o=a.arc().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.jsx("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:ge(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},d)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:ge(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:ge(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},d)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:ge(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},u("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,s=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},u("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:s,x2:n.iqrLine.q3Pos,y2:s,stroke:n.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:s,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},u("med")))}return e.jsx("g",{children:o},d)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(l=t.style.opacity)&&void 0!==l?l:.5},d);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:ge(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},d)}default:return null}}(t,n)).filter(Boolean)]})]}),e.jsx(de,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:o,showAxes:Ae,showCategoryTicks:Oe,oLabel:Nt,rLabel:Ft,oFormat:Wt,rFormat:zt,rTickValues:We,tickLabelEdgeAlign:ze,showGrid:Qe,title:st,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,foregroundGraphics:Pt,annotations:Ye,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:"string"==typeof x?x:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==t?void 0:t.getData()}),lt&&"radial"===C&&e.jsx("div",{style:{position:"absolute",left:Mt.left+_t/2,top:Mt.top+Ct/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:lt})]})}return e.jsxs("div",{ref:At,className:"stream-ordinal-frame"+(it?" "+it:""),role:"group","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:L?"100%":St[0],height:R?"100%":St[1],overflow:"visible"},onKeyDown:yn,children:[yt&&e.jsx(_e,{tableId:It}),yt&&e.jsx(Se,{scene:null!==(l=null===(i=nn.current)||void 0===i?void 0:i.scene)&&void 0!==l?l:[],chartType:m+" chart",tableId:It,chartTitle:"string"==typeof st?st:void 0}),e.jsx(Me,{summary:vt}),e.jsxs("div",{role:"img","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?mn:void 0,onMouseLeave:Jt?hn:void 0,children:[Lt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:St[0],height:St[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Lt})}),e.jsx(ce,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,showAxes:Ae,showGrid:Qe,rFormat:zt,rTickValues:We}),e.jsx("canvas",{ref:Et,"aria-label":me(null!==(u=null===(c=nn.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],m+" chart"),style:{position:"absolute",top:0,left:0,width:St[0],height:St[1]}}),e.jsx(Ce,{hoverPoint:Gt}),e.jsx(de,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,showAxes:Ae,showCategoryTicks:Oe,oLabel:Nt,rLabel:Ft,oFormat:Wt,rFormat:zt,showGrid:Qe,title:st,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,foregroundGraphics:Pt,annotations:Ye,svgAnnotationRules:Xe,annotationFrame:Qt,xAccessor:"string"==typeof x?x:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(d=nn.current)||void 0===d?void 0:d.getData(),underlayRendered:!0}),(pt||ft)&&"radial"!==C&&e.jsx(he,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,onBrush:ft||(()=>{})}),lt&&"radial"===C&&e.jsx("div",{style:{position:"absolute",left:Mt.left+_t/2,top:Mt.top+Ct/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:lt}),(null==gt?void 0:gt.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===gt.badgePosition?{top:4,left:4}:"bottom-left"===gt.badgePosition?{bottom:4,left:4}:"bottom-right"===gt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Kt?"#dc3545":"#28a745",color:"white"}),children:Kt?"STALE":"LIVE"}),e.jsx(Le,{active:gn.current>=0,hoverPoint:Gt,margin:Mt,size:St,shape:null===(h=pn.current)||void 0===h?void 0:h.shape,width:null===(p=pn.current)||void 0===p?void 0:p.w,height:null===(y=pn.current)||void 0===y?void 0:y.h}),xn]})]})});St.displayName="StreamOrdinalFrame";const Mt=t.createContext(null);function _t(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Ct(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Pt,Lt]=Te(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Ct(o,t),s=new Map(r.clauses);return s.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:s})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),s=new Map(o.clauses);return s.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:s})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Ct(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Bt,Tt]=Te(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 Rt={positions:new Map};const It=new Set;function Ht(){for(const e of It)e()}function $t(e,t){const n=Rt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Rt.positions);o.delete(e),Rt={positions:o},Ht()}function Dt(e){const n=t.useId(),o=e.clientId||n,{name:r}=e,s=Lt(e=>e.selections.get(r)),i=Lt(e=>e.setClause),a=Lt(e=>e.clearClause),l=t.useMemo(()=>!!s&&s.clauses.size>0,[s]);return{predicate:t.useMemo(()=>s&&0!==s.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(_t(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(s,o):()=>!0,[s,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};i(r,{clientId:o,type:"point",fields:t})},[o,r,i]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};i(r,{clientId:o,type:"interval",fields:t})},[o,r,i]),clear:t.useCallback(()=>{a(r,o)},[a,r,o]),clientId:o}}const Nt=t.createContext(!1);function Ft({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:s,categories:i}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==s&&(n.strokeWidth=s),n},type:"fill",items:(i&&i.length>0?i:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,s)=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):A[s%A.length];return{label:r+"",color:a}}),label:""}]}}function Wt(e,t,n){return t?o=>{var r;const s=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function zt(){return ze(e=>e.theme)}function Et(){var e;const t=zt(),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 qt(e,t,n,o,r){if(e)return e;let s;if(Array.isArray(n))s=n;else if(t&&t.length>0)s=t;else if("string"==typeof n){const e=w[n];Array.isArray(e)&&(s=e)}return s&&0!==s.length?null!=o?(r.has(o)||r.set(o,r.size),s[r.get(o)%s.length]):s[0]:"#007bff"}function Gt(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],r="function"==typeof(s=o)?s:e=>e[s];var s;return t.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,n,o])}g.createContext(void 0);const Vt={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Yt(e,t,n){var o,r,s,i,a,l,c;const u=Vt[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!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(s=t.showAxes)&&void 0!==s?s:u.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i: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:Xt(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Xt(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 Qt(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 Ut={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 Kt(e,t){return"function"==typeof t?t(e):e[t]}function Zt(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 Jt(t={}){const{fields:n,title:o,format:r,style:s={},className:i=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Kt(t,o);a=Zt(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,s;"string"==typeof e?(n=e,o=e,s=r):(n=e.label,o=e.accessor||e.key||"",s=e.format||r);const i=Kt(t,o);l.push({label:n,value:Zt(i,s)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Zt(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Zt(t[e[0]],r))}}const c=Object.assign(Object.assign({},Ut),s);return e.jsxs("div",{className:("semiotic-tooltip "+i).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function en(t){if(!0===t)return Jt();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.jsx("div",{className:"semiotic-tooltip",style:Ut,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Jt(t):Jt())}function tn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function nn(e,t){if(!t)return tn(e);try{const n=t(e);return null==n?tn(e):n}catch(t){return tn(e)}}function on(e,t){return"function"==typeof t?t(e):e[t]}function rn({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:s=!1,valueFormat:i}){return a=>{var l;const c=s?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=on(c,t),d=on(c,n),h=o?on(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:Ut,children:[e.jsx("div",{style:{fontWeight:"bold"},children:tn(u)}),e.jsx("div",{style:{marginTop:4},children:nn(d,i)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[r||(g=o,"string"==typeof g?g:"value"),": ",tn(h)]})]});var g}}function sn({componentName:t,message:n,diagnosticHint:o,width:r,height:s}){return e.jsx("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.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("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:o})]})})}class an extends g.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(sn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function ln(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let s=1;n>=s;s++){let n=r[0];r[0]=s;for(let i=1;o>=i;i++){const o=r[i];r[i]=e[s-1]===t[i-1]?n:1+Math.min(n,r[i],r[i-1]),n=o}}return r[o]}function cn(e,t,n=3){let o,r=n+1;for(const n of t){const t=ln(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function un(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function dn(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=cn(e,t,3))&&void 0!==n?n:null)}function hn({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=un(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,s]of Object.entries(n))if(s&&"string"==typeof s&&!(s in o)){const n=dn(s,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${s}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const gn={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"}},pn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},fn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},yn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],mn=["vertical","horizontal"],vn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gn),pn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yn},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({},gn),pn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gn),pn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yn},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({},gn),pn),{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({},gn),pn),{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({},gn),pn),{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({},gn),pn),{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({},gn),pn),{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({},gn),pn),{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({},gn),pn),{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({},gn),fn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},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({},gn),fn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},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({},gn),fn),{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:mn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gn),fn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},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({},gn),fn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},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({},gn),fn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gn),fn),{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({},gn),fn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},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({},gn),fn),{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({},gn),fn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},gn),{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({},gn),{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({},gn),{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({},gn),fn),{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({},gn),fn),{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({},gn),{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({},gn),{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:mn},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({},gn),{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({},gn),{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({},gn),{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({},gn),{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({},gn),{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({},gn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},gn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},gn),{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({},gn),{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({},gn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},gn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function bn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const xn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),jn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),wn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),kn=new Set(["LineChart","AreaChart","StackedAreaChart"]),An=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function On(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],s=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*s(n)+.7152*s(o)+.0722*s(r)}function Sn(e,t){const n=On(e),o=On(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Mn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function _n(e,t){const n=[],o=function(e,t){const n=[],o=vn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(vn).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!bn(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),s=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!s.has(o)){const t=cn(o,r),s=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(s)}if("array"===o.dataShape){const r=t.data,s={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(s[e]=n)}const i=hn({componentName:e,data:r,accessors:Object.keys(s).length>0?s:void 0});i&&n.push(i)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:s}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(s&&t&&t.length>0){const n=un(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(s))if(r&&"string"==typeof r&&!(r in n)){const n=dn(r,t),s=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${s}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return vn[e]?(function(e,t,n){const o=vn[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=vn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=r[0];if(!s||"object"!=typeof s)return;const i=Object.keys(s);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in s||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${i.join(", ")}.`,fix:`Change ${e} to one of: ${i.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){xn.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){jn.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=vn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=r[0];if(!s||"object"!=typeof s)return;const i=t.xAccessor;"string"==typeof i&&s[i]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${i}" 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(!wn.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!kn.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const s=null!==(o=t.width)&&void 0!==o?o:600,i=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);s>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${s}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),i>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${i}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=vn[e];if(!r||"array"!==r.dataShape)return;const s=t.data;if(!s||!Array.isArray(s)||0===s.length)return;const i=[];t.xAccessor&&"string"==typeof t.xAccessor&&i.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&i.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&i.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(s.length,5);for(const e of i){let t=!0;for(let n=0;a>n;n++){const r=null===(o=s[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!An.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const s=r.right;"number"==typeof s&&100>s&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${s}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const s=r[o];"string"==typeof s&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${s}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const s=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Sn(e,r);null!==t&&3>t&&s.push(`${e} (${t.toFixed(1)}:1)`)}s.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${s.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${s.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const s=[];for(let e=0;r.length-1>e;e++){const t=Sn(r[e],r[e+1]);null!==t&&1.5>t&&s.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}s.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${s.length} adjacent color pair(s) in colorScheme have very similar luminance: ${s.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,s="string"==typeof t.summary&&t.summary.trim().length>0;o||r||s||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 Mn)"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 Cn;const Pn="undefined"!=typeof process&&"production"!==(null===(Cn=process.env)||void 0===Cn?void 0:Cn.NODE_ENV);function Ln({componentName:t,width:n,height:o,chartProps:r,children:s}){return e.jsx(an,{fallback:s=>{let i="";if(Pn&&r)try{const e=_n(t,r);e.ok||(i=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.jsx(sn,{componentName:t,message:s.message,diagnosticHint:i,width:n,height:o})},children:s})}const Bn={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"},Tn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Rn(e,t,n,o){if(!Pn)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const s=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${s}`)}function In(n){const{data:o,rawData:r,colorBy:s,colorScheme:i,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:p,chartId:f,showLegend:y,userMargin:m,marginDefaults:v,onClick:b,hoverHighlight:x,loading:j,emptyContent:w,width:k,height:A}=n,O="string"==typeof n.colorBy?n.colorBy:void 0,{activeSelectionHook:_,hoverSelectionHook:C,customHoverBehavior:P,customClickBehavior:L,crosshairSourceId:B}=function({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:s,chartType:i,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),g=Dt({name:(null==e?void 0:e.name)||"__unused__"}),p=function(e){const n=e.name||"hover",{fields:o}=e,{predicate:r,isActive:s,selectPoints:i,clear:a}=Dt({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&i(t)},[o,i,a,n]),predicate:r,isActive:s}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),f=Tt(e=>e.pushObservation),y=e?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),j=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Rt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Rt={positions:new Map(Rt.positions).set(e,{xValue:t,sourceId:n})},Ht())}(h.name||"hover",Number(e),d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&$t(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(s||f){const n={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(i),f&&f(i)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});s&&s(e),f&&f(e)}}},[n,p,h,d,s,i,a,f,c,b]),w=t.useCallback(e=>{var t,n,o,r;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[h.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Rt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Rt.positions);return t.delete(e),Rt={positions:t},Ht(),!1}Rt={positions:new Map(Rt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ht()}(h.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||f){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});s&&s(i),f&&f(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),f&&f(e)}}},[l,s,f,i,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const n=Rt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Rt.positions);o.delete(e),Rt={positions:o},Ht()}(e,d),$t(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:j,customClickBehavior:w,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:p,chartId:f,onClick:b,hoverHighlight:x,colorByField:O}),T=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}}(u,B),R=function(e,n,o){const r=t.useContext(Mt),s=Et();return t.useMemo(()=>{var t;if(!n)return;const i=null!==(t=null!=o?o:s&&s.length>0?s:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const e=M(t.map(e=>({_cat:e})),"_cat",i);return t=>r[t]||e(t)}return M(t.map(e=>({_cat:e})),"_cat",i)}if(r&&Object.keys(r).length>0){const t=M(e,n,i);return e=>r[e]||t(e)}return M(e,n,i)}if(r&&Object.keys(r).length>0){const e=M([{_:"a"}],"_",i);return t=>r[t]||e(t)}},[e,n,o,r,s])}(o,s,i),I=t.useMemo(()=>{if(!s)return[];const e=new Set;for(const t of o){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[o,s]),H=function(e,n,o){const[r,s]=t.useState(null),[i,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&s(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return i.has(o)}}:null},[e,n,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,s,I),$=t.useMemo(()=>C||(H.legendSelectionHook?H.legendSelectionHook:_),[C,H.legendSelectionHook,_]),D=function(e){const n=ze(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}(c),{legend:N,margin:F,legendPosition:W}=function({data:e,colorBy:n,colorScale:o,showLegend:r,legendPosition:s="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Nt),u=void 0!==r?r:!c&&!!n,d=t.useMemo(()=>{if(!u||!n)return;const t=Ft({data:e,colorBy:n,colorScale:o,getColor:S,categories:l});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[u,n,e,o,l]),h=t.useMemo(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:null!=i?i:{},t=Object.assign(Object.assign({},a),e);return d&&("right"===s&&110>t.right?t.right=110:"left"===s&&110>t.left?t.left=110:"top"===s&&50>t.top?t.top=50:"bottom"===s&&80>t.bottom&&(t.bottom=80)),t},[a,i,d,s]);return{legend:d,margin:h,legendPosition:s}}({data:o,colorBy:s,colorScale:R,showLegend:y,legendPosition:l,userMargin:m,defaults:v}),z=t.useMemo(()=>{const e={};return N&&(e.legend=N,e.legendPosition=W),a&&"none"!==a&&(e.legendHoverBehavior=H.onLegendHover,e.legendClickBehavior=H.onLegendClick,e.legendHighlightedCategory=H.highlightedCategory,e.legendIsolatedCategories=H.isolatedCategories),e},[N,W,a,H.onLegendHover,H.onLegendClick,H.highlightedCategory,H.isolatedCategories]),E=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),i=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+i)-i))/2);return e.jsx("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:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Tn),{position:"absolute",top:a+o*(s+i),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(j,k,A),q=E?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Bn),{width:n,height:o}),children:r||"No data available"}):null}(r,k,A,w);return{colorScale:R,allCategories:I,legendState:H,effectiveSelectionHook:$,activeSelectionHook:_,customHoverBehavior:P,customClickBehavior:L,legend:N,margin:F,legendPosition:W,earlyReturn:E||q||null,legendBehaviorProps:z,crosshairProps:T,resolvedSelection:D}}const Hn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,sort:f=!1,barPadding:y=40,roundedTop:m,gradientFill:v=!1,baselinePadding:b=!1,tooltip:x,annotations:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,showCategoryTicks:D,categoryFormat:N,dataIdAccessor:F}=n,W=r.width,z=r.height,E=r.enableHover,q=r.showGrid,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=In({data:K,rawData:i,colorBy:g,colorScheme:p,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"BarChart",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:W,height:z});if(Z.earlyReturn)return Z.earlyReturn;Rn("BarChart",K,"categoryAccessor",c),Rn("BarChart",K,"valueAccessor",u);const J=Gt(K,f,u),ee=Et(),te=t.useMemo(()=>new Map,[K]),ne=t.useMemo(()=>(e,t)=>{const n={};return n.fill=g?S(e,g,Z.colorScale):qt(R,ee,p,void 0,te),n},[g,Z.colorScale,R,ee,p,te]),oe=t.useMemo(()=>{const e=null==w?void 0:w.pieceStyle;return Qt(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},ne(t,n)),e(t,n)||{}):ne,{stroke:I,strokeWidth:H,opacity:$})},[ne,w,I,H,$]),re=t.useMemo(()=>Wt(oe,Z.effectiveSelectionHook,Z.resolvedSelection),[oe,Z.effectiveSelectionHook,Z.resolvedSelection]),se=t.useMemo(()=>rn({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ie=hn({componentName:"BarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(sn,{componentName:"BarChart",message:ie,width:W,height:z});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:re,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:y}),null!=m&&{roundedTop:m}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),F&&{dataIdAccessor:F}),{baselinePadding:b,enableHover:E,showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:h}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:D,oSort:f}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:en(x)||se}),(A||O||M||_)&&{customHoverBehavior:Z.customHoverBehavior}),(O||M||A)&&{customClickBehavior:Z.customClickBehavior}),j&&j.length>0&&{annotations:j}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"BarChart",width:W,height:z,children:e.jsx(St,Object.assign({ref:s},ae))})});function $n({isPushMode:e,colorBy:n,colorScheme:o,showLegend:r,legendPosition:s="right"}){const i=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=t.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=t.useCallback(t=>{if(!e||!n)return;let o=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=u(e);null==t||i.current.has(t)||(i.current.add(t),a.current.push(t),o=!0)}o&&c(e=>e+1)},[e,n,u]),h=t.useCallback(e=>t=>{d([t]),e(t)},[d]),g=t.useCallback(e=>t=>{d(t),e(t)},[d]),p=t.useCallback(()=>{i.current=new Set,a.current=[],c(e=>e+1)},[]),f=t.useMemo(()=>{if(!e||!n||!1===r)return;const t=a.current;if(0===t.length)return;const s=Array.isArray(o)?o:A,i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],s[e%s.length]);const l="string"==typeof n?n:"__streamCat";return Ft({data:t.map(e=>({[l]:e})),colorBy:l,colorScale:e=>i.get(e)||"#999",getColor:S})},[e,n,r,o,l]),y=t.useMemo(()=>{if(f)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[f,s]);return{wrapPush:h,wrapPushMany:g,resetCategories:p,streamingLegend:f,streamingMarginAdjust:y}}function Dn({ref:e,frameRef:n,isPushMode:o,colorBy:r,colorScheme:s,showLegend:i,legendPosition:a,setup:l}){const c=$n({isPushMode:o,colorBy:r,colorScheme:s,showLegend:i,legendPosition:a}),u=t.useCallback(c.wrapPush(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)}),[c.wrapPush]),d=t.useCallback(c.wrapPushMany(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)}),[c.wrapPushMany]);return t.useImperativeHandle(e,()=>({push:u,pushMany:d,remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,r;return null!==(r=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[]},clear:()=>{var e;c.resetCategories(),null===(e=n.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[u,d,c.resetCategories]),{effectiveLegendProps:t.useMemo(()=>c.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:c.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,c.streamingLegend,a]),effectiveMargin:t.useMemo(()=>{if(c.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(c.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,c.streamingMarginAdjust])}}Hn.displayName="BarChart";const Nn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:f,normalize:y=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:j,annotations:w,frameProps:k={},selection:A,linkedHover:O,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:B,legendInteraction:T,legendPosition:R,color:I,stroke:H,strokeWidth:$,opacity:D,categoryFormat:N}=n,F=r.width,W=r.height,z=r.enableHover,E=r.showGrid,q=r.showLegend,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=p||u,J=void 0===i,ee=In({data:K,rawData:i,colorBy:Z,colorScheme:f,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:r.marginDefaults,loading:L,emptyContent:B,width:F,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=Et(),ne=t.useMemo(()=>new Map,[K]),oe=t.useMemo(()=>(e,t)=>Z?ee.colorScale?{fill:S(e,Z,ee.colorScale)}:{}:{fill:qt(I,te,f,t,ne)},[Z,ee.colorScale,I,te,f,ne]),re=t.useMemo(()=>{const e=null==k?void 0:k.pieceStyle;return Qt(e&&"function"==typeof e?(t,n)=>{const o=oe(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:oe,{stroke:H,strokeWidth:$,opacity:D})},[oe,k,H,$,D]),se=t.useMemo(()=>Wt(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ie=t.useMemo(()=>rn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=hn({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Dn({ref:o,frameRef:s,isPushMode:J,colorBy:Z,colorScheme:f,showLegend:q,legendPosition:R,setup:ee}),ue=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!=i&&{data:K}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[F,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:g}),N&&{oFormat:N}),{showGrid:E}),le),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===j?()=>null:en(j)||ie}),(O||M||_||C)&&{customHoverBehavior:ee.customHoverBehavior}),(M||_||O)&&{customClickBehavior:ee.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(sn,{componentName:"StackedBarChart",message:ae,width:F,height:W}):e.jsx(Ln,{componentName:"StackedBarChart",width:F,height:W,children:e.jsx(St,Object.assign({ref:s},ue))})});Nn.displayName="StackedBarChart";const Fn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:f,sort:y=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,categoryFormat:D}=n,N=r.width,F=r.height,W=r.enableHover,z=r.showGrid,E=r.showLegend,q=r.title,G=r.description,V=r.summary,Y=r.accessibleTable,X=r.categoryLabel,Q=r.valueLabel,U=i||[],K=p||u,Z=void 0===i,J=In({data:U,rawData:i,colorBy:K,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"GroupedBarChart",chartId:C,showLegend:E,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:N,height:F});if(J.earlyReturn)return J.earlyReturn;const ee=Et(),te=t.useMemo(()=>new Map,[U]),ne=w.pieceStyle,oe=t.useMemo(()=>(e,t)=>{const n=K?J.colorScale?{fill:S(e,K,J.colorScale)}:{}:{fill:qt(R,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,R,ee,f,te,ne]),re=t.useMemo(()=>Qt(oe,{stroke:I,strokeWidth:H,opacity:$}),[oe,I,H,$]),se=t.useMemo(()=>Wt(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ie=t.useMemo(()=>rn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=hn({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Dn({ref:o,frameRef:s,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:E,legendPosition:T,setup:J}),ue=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!=i&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[N,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:X,rLabel:Q,rFormat:g}),D&&{oFormat:D}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==Y&&{accessibleTable:Y}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:en(x)||ie}),(A||O||M||_)&&{customHoverBehavior:J.customHoverBehavior}),(O||M||A)&&{customClickBehavior:J.customClickBehavior}),j&&j.length>0&&{annotations:j}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(sn,{componentName:"GroupedBarChart",message:ae,width:N,height:F}):e.jsx(Ln,{componentName:"GroupedBarChart",width:N,height:F,children:e.jsx(St,Object.assign({ref:s},ue))})});function Wn({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const s=(i="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const a=function(e){const{name:n,xField:o,yField:r}=e,{predicate:s,isActive:i,selectInterval:a,clear:l}=Dt({name:n}),c=o&&r?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,r,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:s,isActive:i,clear:l}}({name:(null==s?void 0:s.name)||"__unused_ordinal_brush__",xField:(null==s?void 0:s.xField)||("string"==typeof r?r:"value")}),l=t.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=t.useCallback(e=>{if(s){l.current.end(e?e.r:null)}null==n||n(e)},[n,s]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Fn.displayName="GroupedBarChart";const zn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:f,barPadding:y,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:F,showCategoryTicks:W}=n,z=r.width,E=r.height,q=r.enableHover,G=r.showGrid,V=r.showLegend,Y=r.title,X=r.description,Q=r.summary,U=r.accessibleTable,K=r.categoryLabel,Z=r.valueLabel,J=i||[],ee=p||u,te=void 0===i,ne=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==n.mode)return 40;const e=new Set(J.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?E:z)-2*t)/(t-1))):1},[y,n.mode,J,c,h,z,E]),oe=In({data:J,rawData:i,colorBy:ee,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"SwimlaneChart",chartId:C,showLegend:V,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:z,height:E}),re=Wn({brushProp:b,onBrushProp:x,linkedBrush:j,valueAccessor:d});if(oe.earlyReturn)return oe.earlyReturn;const se=Et(),ie=t.useMemo(()=>new Map,[J]),ae=w.pieceStyle,le=t.useMemo(()=>(e,t)=>{const n=ee?oe.colorScale?{fill:S(e,ee,oe.colorScale)}:{}:{fill:qt(R,se,f,t,ie)};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,R,se,f,ie,ae]),ce=t.useMemo(()=>Qt(le,{stroke:I,strokeWidth:H,opacity:$}),[le,I,H,$]),ue=t.useMemo(()=>Wt(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),de=t.useMemo(()=>rn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),he=hn({componentName:"SwimlaneChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ge,effectiveMargin:pe}=Dn({ref:o,frameRef:s,isPushMode:te,colorBy:ee,colorScheme:f,showLegend:V,legendPosition:T,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!=i&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ue,size:[z,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,barPadding:ne,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:!1===W?void 0:K,rLabel:Z,rFormat:g}),N&&{rTickValues:N}),null!=F&&{tickLabelEdgeAlign:F}),D&&{oFormat:D}),void 0!==W&&{showCategoryTicks:W}),{showGrid:G}),ge),Y&&{title:Y}),X&&{description:X}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:en(m)||de}),(A||O||M||_)&&{customHoverBehavior:oe.customHoverBehavior}),(O||M||A)&&{customClickBehavior:oe.customClickBehavior}),v&&v.length>0&&{annotations:v}),re.brushStreamProps),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return he?e.jsx(sn,{componentName:"SwimlaneChart",message:he,width:z,height:E}):e.jsx(Ln,{componentName:"SwimlaneChart",width:z,height:E,children:e.jsx(St,Object.assign({ref:s},fe))})});zn.displayName="SwimlaneChart";const En=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,sizeBy:f,sizeRange:y=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:j,brush:w,onBrush:k,linkedBrush:A,frameProps:O={},selection:M,linkedHover:_,onObservation:C,onClick:P,hoverHighlight:L,chartId:B,loading:T,emptyContent:R,legendInteraction:I,legendPosition:H,color:$,stroke:D,strokeWidth:N,opacity:F,showCategoryTicks:W,categoryFormat:z}=n,E=r.width,q=r.height,G=r.enableHover,V=r.showGrid,Y=r.title,X=r.description,Q=r.summary,U=r.accessibleTable,K=r.categoryLabel,Z=r.valueLabel,J=i||[],ee=In({data:J,rawData:i,colorBy:g,colorScheme:p,legendInteraction:I,legendPosition:H,selection:M,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:L,chartType:"SwarmPlot",chartId:B,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:T,emptyContent:R,width:E,height:q}),te=Wn({brushProp:w,onBrushProp:k,linkedBrush:A,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const ne=t.useMemo(()=>{if(!f)return;const e=J.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[J,f]),oe=Et(),re=t.useMemo(()=>new Map,[J]),se=O.pieceStyle,ie=t.useMemo(()=>(e,t)=>{const n={fillOpacity:v};if(n.fill=g?S(e,g,ee.colorScale):qt($,oe,p,void 0,re),n.r=f?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[s,i]=o,[a,l]=n;return i===s?(a+l)/2:a+(r-s)/(i-s)*(l-a)}(e,f,y,ne):m,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},[g,ee.colorScale,f,y,ne,m,v,$,oe,p,re,se]),ae=t.useMemo(()=>Qt(ie,{stroke:D,strokeWidth:N,opacity:F}),[ie,D,N,F]),le=t.useMemo(()=>Wt(ae,ee.effectiveSelectionHook,ee.resolvedSelection),[ae,ee.effectiveSelectionHook,ee.resolvedSelection]),ce=t.useMemo(()=>rn({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),ue=hn({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(sn,{componentName:"SwarmPlot",message:ue,width:E,height:q});const 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({chartType:"swarm"},null!=i&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[E,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:b,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:K,rLabel:Z,rFormat:h}),z&&{oFormat:z}),{showGrid:V,showCategoryTicks:W}),ee.legendBehaviorProps),Y&&{title:Y}),X&&{description:X}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:en(x)||ce}),(_||C||P||L)&&{customHoverBehavior:ee.customHoverBehavior}),(C||P||_)&&{customClickBehavior:ee.customClickBehavior}),j&&j.length>0&&{annotations:j}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"SwarmPlot",width:E,height:q,children:e.jsx(St,Object.assign({ref:s},de))})});function qn(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return e.jsxs("div",{className:"semiotic-tooltip",style:Ut,children:[r&&e.jsx("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e.jsxs("div",{children:["n = ",s.n]}),null!=s.min&&e.jsxs("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e.jsxs("div",{children:["Q1: ",s.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e.jsxs("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e.jsxs("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=s.length,a=i>0?i%2!=0?s[Math.floor(i/2)]:(s[i/2-1]+s[i/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:Ut,children:[r&&e.jsx("div",{style:{fontWeight:"bold"},children:r+""}),i>0&&e.jsxs("div",{children:["n = ",i]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:Ut,children:e.jsx("div",{style:{fontWeight:"bold"},children:r+""})})}}En.displayName="SwarmPlot";const Gn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,showOutliers:f=!0,categoryPadding:y=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R,showCategoryTicks:I,categoryFormat:H}=n,$=r.width,D=r.height,N=r.enableHover,F=r.showGrid,W=r.title,z=r.description,E=r.summary,q=r.accessibleTable,G=r.categoryLabel,V=r.valueLabel,Y=i||[],X=In({data:Y,rawData:i,colorBy:g,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"BoxPlot",chartId:O,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:M,emptyContent:_,width:$,height:D});if(X.earlyReturn)return X.earlyReturn;const Q=Et(),U=t.useMemo(()=>new Map,[Y]),K=t.useMemo(()=>e=>{const t=g?S(e,g,X.colorScale):qt(L,Q,p,void 0,U);return{fill:t,stroke:t,fillOpacity:.8}},[g,X.colorScale,L,Q,p,U]),Z=t.useMemo(()=>Qt(K,{stroke:B,strokeWidth:T,opacity:R}),[K,B,T,R]),J=t.useMemo(()=>Wt(Z,X.effectiveSelectionHook,X.resolvedSelection),[Z,X.effectiveSelectionHook,X.resolvedSelection]),ee=t.useMemo(()=>qn(),[]),te=hn({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(te)return e.jsx(sn,{componentName:"BoxPlot",message:te,width:$,height:D});const 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:"boxplot"},null!=i&&{data:Y}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[$,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:X.margin,barPadding:y,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:G,rLabel:V,rFormat:h}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:I}),X.legendBehaviorProps),W&&{title:W}),z&&{description:z}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:en(m)||ee}),(j||w||k||A)&&{customHoverBehavior:X.customHoverBehavior}),(w||k||j)&&{customClickBehavior:X.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"BoxPlot",width:$,height:D,children:e.jsx(St,Object.assign({ref:s},ne))})});Gn.displayName="BoxPlot";const Vn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:p,colorScheme:f,categoryPadding:y=20,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,showCategoryTicks:D,categoryFormat:N}=n,F=r.width,W=r.height,z=r.enableHover,E=r.showGrid,q=r.title,G=r.description,V=r.summary,Y=r.accessibleTable,X=r.categoryLabel,Q=r.valueLabel,U=i||[],K=In({data:U,rawData:i,colorBy:p,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"Histogram",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:F,height:W}),Z=Wn({brushProp:b,onBrushProp:x,linkedBrush:j,valueAccessor:u});if(K.earlyReturn)return K.earlyReturn;const J=t.useMemo(()=>{if(0===U.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of U){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[U,u]),ee=Et(),te=t.useMemo(()=>new Map,[U]),ne=t.useMemo(()=>e=>{const t=p?S(e,p,K.colorScale):qt(R,ee,f,void 0,te);return{fill:t,stroke:t,fillOpacity:.8}},[p,K.colorScale,R,ee,f,te]),oe=t.useMemo(()=>Qt(ne,{stroke:I,strokeWidth:H,opacity:$}),[ne,I,H,$]),re=t.useMemo(()=>Wt(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,s=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:Ut,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),null!=r&&e.jsxs("div",{children:["Count: ",r]}),s&&2===s.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),ie=hn({componentName:"Histogram",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(sn,{componentName:"Histogram",message:ie,width:F,height:W});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=i&&{data:U}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),J&&{rExtent:J}),{size:[F,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:y,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:X,rLabel:Q,rFormat:g}),N&&{oFormat:N}),{showGrid:E,showCategoryTicks:D}),K.legendBehaviorProps),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==Y&&{accessibleTable:Y}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:en(m)||se}),(A||O||M||_)&&{customHoverBehavior:K.customHoverBehavior}),(O||M||A)&&{customClickBehavior:K.customClickBehavior}),v&&v.length>0&&{annotations:v}),Z.brushStreamProps),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"Histogram",width:F,height:W,children:e.jsx(St,Object.assign({ref:s},ae))})});Vn.displayName="Histogram";const Yn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:m=20,tooltip:v,annotations:b,brush:x,onBrush:j,linkedBrush:w,frameProps:k={},selection:A,linkedHover:O,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:B,legendInteraction:T,legendPosition:R,color:I,stroke:H,strokeWidth:$,opacity:D,showCategoryTicks:N,categoryFormat:F}=n,W=r.width,z=r.height,E=r.enableHover,q=r.showGrid,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=In({data:K,rawData:i,colorBy:f,colorScheme:y,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"ViolinPlot",chartId:P,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:L,emptyContent:B,width:W,height:z}),J=Wn({brushProp:x,onBrushProp:j,linkedBrush:w,valueAccessor:u});if(Z.earlyReturn)return Z.earlyReturn;const ee=Et(),te=t.useMemo(()=>new Map,[K]),ne=t.useMemo(()=>e=>{const t=f?S(e,f,Z.colorScale):qt(I,ee,y,void 0,te);return{fill:t,stroke:t,fillOpacity:.6}},[f,Z.colorScale,I,ee,y,te]),oe=t.useMemo(()=>Qt(ne,{stroke:H,strokeWidth:$,opacity:D}),[ne,H,$,D]),re=t.useMemo(()=>Wt(oe,Z.effectiveSelectionHook,Z.resolvedSelection),[oe,Z.effectiveSelectionHook,Z.resolvedSelection]),se=t.useMemo(()=>qn({valueAccessor:u}),[u]),ie=hn({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(sn,{componentName:"ViolinPlot",message:ie,width:W,height:z});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=i&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:p}),F&&{oFormat:F}),{showGrid:q,showCategoryTicks:N}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:en(v)||se}),(O||M||_||C)&&{customHoverBehavior:Z.customHoverBehavior}),(M||_||O)&&{customClickBehavior:Z.customClickBehavior}),b&&b.length>0&&{annotations:b}),J.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"ViolinPlot",width:W,height:z,children:e.jsx(St,Object.assign({ref:s},ae))})});Yn.displayName="ViolinPlot";const Xn=t.forwardRef(function(n,o){var r;const s=Yt(n.mode,{width:n.width,height:n.height,showGrid:null===(r=n.showGrid)||void 0===r||r,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),i=t.useRef(null);t.useImperativeHandle(o,()=>({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",valueFormat:g,colorBy:p,colorScheme:f,sort:y="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:j={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:M,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:B,color:T,stroke:R,strokeWidth:I,opacity:H,categoryFormat:$}=n,D=s.width,N=s.height,F=s.enableHover,W=s.showGrid,z=s.title,E=s.description,q=s.summary,G=s.accessibleTable,V=s.categoryLabel,Y=s.valueLabel,X=a||[],Q=In({data:X,rawData:a,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:B,selection:w,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:M,chartType:"DotPlot",chartId:_,showLegend:s.showLegend,userMargin:l,marginDefaults:s.marginDefaults,loading:C,emptyContent:P,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Gt(X,y,d),K=Et(),Z=t.useMemo(()=>new Map,[X]),J=j.pieceStyle,ee=t.useMemo(()=>(e,t)=>{const n={r:m,fillOpacity:.8};if(n.fill=p?S(e,p,Q.colorScale):qt(T,K,f,void 0,Z),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},[p,Q.colorScale,m,T,K,f,Z,J]),te=t.useMemo(()=>Qt(ee,{stroke:R,strokeWidth:I,opacity:H}),[ee,R,I,H]),ne=t.useMemo(()=>Wt(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=t.useMemo(()=>rn({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),re=hn({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(sn,{componentName:"DotPlot",message:re,width:D,height:N});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!=a&&{data:U}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:s.showAxes,oLabel:V,rLabel:Y,rFormat:g}),$&&{oFormat:$}),{showGrid:W,oSort:y}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:en(b)||oe}),(k||A||O||M)&&{customHoverBehavior:Q.customHoverBehavior}),(A||O||k)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"DotPlot",width:D,height:N,children:e.jsx(St,Object.assign({ref:i},se))})});Xn.displayName="DotPlot";const Qn=t.forwardRef(function(n,o){var r,s;const i=Yt(n.mode,{width:null!==(r=n.width)&&void 0!==r?r:400,height:null!==(s=n.height)&&void 0!==s?s:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:p,startAngle:f=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R}=n,I=i.width,H=i.height,$=i.enableHover,D=i.showLegend,N=i.title,F=i.description,W=i.summary,z=i.accessibleTable,E=l||[],q=g||d,G=void 0===l,V=In({data:E,rawData:l,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"PieChart",chartId:O,showLegend:D,userMargin:c,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const Y=Et(),X=t.useMemo(()=>new Map,[E]),Q=t.useMemo(()=>(e,t)=>q?V.colorScale?{fill:S(e,q,V.colorScale)}:{}:{fill:qt(L,Y,p,t,X)},[q,V.colorScale,L,Y,p,X]),U=t.useMemo(()=>{const e=null==b?void 0:b.pieceStyle;return Qt(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Q(t,n)),e(t,n)||{}):Q,{stroke:B,strokeWidth:T,opacity:R})},[Q,b,B,T,R]),K=t.useMemo(()=>Wt(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),Z=t.useMemo(()=>rn({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),J=hn({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:ee,effectiveMargin:te}=Dn({ref:o,frameRef:a,isPushMode:G,colorBy:q,colorScheme:p,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!=l&&{data:E}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:K,startAngle:f}),null!=y&&{cornerRadius:y}),{size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),ee),N&&{title:N}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:en(m)||Z}),(j||w||k||A)&&{customHoverBehavior:V.customHoverBehavior}),(w||k||j)&&{customClickBehavior:V.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return J?e.jsx(sn,{componentName:"PieChart",message:J,width:I,height:H}):e.jsx(Ln,{componentName:"PieChart",width:I,height:H,children:e.jsx(St,Object.assign({ref:a},ne))})});Qn.displayName="PieChart";const Un=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks},{width:400,height:400}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:p,startAngle:f=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R}=n,I=r.width,H=r.height,$=r.enableHover,D=r.showLegend,N=r.title,F=r.description,W=r.summary,z=r.accessibleTable,E=i||[],q=g||c,G=void 0===i,V=In({data:E,rawData:i,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"DonutChart",chartId:O,showLegend:D,userMargin:a,marginDefaults:r.marginDefaults,loading:M,emptyContent:_,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const Y=null!=d?d:Math.max(2,.15*Math.min(I,H)),X=Et(),Q=t.useMemo(()=>new Map,[E]),U=b.pieceStyle,K=t.useMemo(()=>(e,t)=>{let n;if(n=q?V.colorScale?{fill:S(e,q,V.colorScale)}:{}:{fill:qt(L,X,p,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,X,p,Q,U]),Z=t.useMemo(()=>Qt(K,{stroke:B,strokeWidth:T,opacity:R}),[K,B,T,R]),J=t.useMemo(()=>Wt(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=t.useMemo(()=>rn({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),te=hn({componentName:"DonutChart",data:i,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:ne,effectiveMargin:oe}=Dn({ref:o,frameRef:s,isPushMode:G,colorBy:q,colorScheme:p,showLegend:D,legendPosition:P,setup:V}),re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=i&&{data:E}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:Y,startAngle:f}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:oe,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),ne),N&&{title:N}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:en(m)||ee}),(j||w||k||A)&&{customHoverBehavior:V.customHoverBehavior}),(w||k||j)&&{customClickBehavior:V.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return te?e.jsx(sn,{componentName:"DonutChart",message:te,width:I,height:H}):e.jsx(Ln,{componentName:"DonutChart",width:I,height:H,children:e.jsx(St,Object.assign({ref:s},re))})});Un.displayName="DonutChart";const Kn=t.forwardRef(function(n,o){const r=Yt(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}),s=t.useRef(null),i="context"===n.mode,{compactMode:a}=r,{value:l,min:c=0,max:u=100,thresholds:d,color:h,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,showNeedle:f=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:m,valueFormat:v,showScaleLabels:b=!a,sweep:x=240,fillZones:j=!0,tooltip:w,annotations:k,frameProps:A={},className:O,stroke:S,strokeWidth:M,opacity:_}=n,C=r.width,P=r.height,L=r.title,B=r.description,T=r.summary,R=r.accessibleTable,I=Math.max(c,Math.min(u,l)),H=u-c||1,$=(I-c)/H,{gaugeData:D,pieceStyle:N,gaugeAnnotations:F}=t.useMemo(()=>{const e=[],t=new Map,n=[];let o=d&&d.length>0?[...d].sort((e,t)=>e.value-t.value):[{value:u,color:h||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(c,Math.min(u,e.value))})),u>o[o.length-1].value&&o.push({value:u,color:o[o.length-1].color});let r=c;for(let n=0;o.length>n;n++){const s=o[n],i=(s.value-r)/H;if(j){const o=(r-c)/H,a=Math.max(0,Math.min($,(s.value-c)/H)-o),l=i-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:s.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:s.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:s.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:g,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:i,_zone:s.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:s.color})}r=s.value}if(b&&d&&d.length>0)for(const e of d)e.value>c&&u>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:g},gaugeAnnotations:n}},[l,c,u,d,h,g,$,H,b,j]),W=t.useMemo(()=>Qt(N,{stroke:S,strokeWidth:M,opacity:_}),[N,S,M,_]),z=x*Math.PI/180,E=180+(360-x)/2,q=Math.min(10,Math.max(1,Math.min(C,P)/12)),G=-Math.PI/2+E*Math.PI/180,V=[[Math.cos(G),Math.sin(G)],[Math.cos(G+z),Math.sin(G+z)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-G)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>z+.001||V.push([Math.cos(e),Math.sin(e)]);const Y=Math.min(...V.map(e=>e[0])),X=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),U=Math.max(...V.map(e=>e[1])),K=(Q+U)/2,Z=(Y+X)/2,J=Math.max(4,Math.min((C-2*q)/(X-Y),(P-2*q)/(U-Q))-2),ee=Math.max(0,Math.min(J-1.5,J*(1-p))),te=C/2-Z*J,ne=P/2-K*J,oe=2*(J+4),re=t.useMemo(()=>{if(a&&null==m)return null;if(null!=m)return"function"==typeof m?m(I,c,u):m;const t=v?v(I):Math.round(I)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),b&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[m,I,c,u,v,b,J,a]),se=t.useMemo(()=>i&&null==m?{type:"gauge-value",text:v?v(I):Math.round(I)+""}:null,[i,m,I,v]),ie=t.useMemo(()=>{if(!f)return null;const e=-Math.PI/2+E*Math.PI/180+$*z,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[f,$,E,z,ee,y]),ae=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const r=(o.width||C)/2,s=(o.height||P)/2,i=Math.max(1,J-ee),a=Math.max(1,Math.min(2.5,.4*i)),l=Math.max(1,Math.min(5,.6*i));return e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+n)}if("gauge-label"===t.type){const r=-Math.PI/2+E*Math.PI/180+(t.value-c)/H*z,s=ee-14,i=(o.height||P)/2;return e.jsx("text",{x:(o.width||C)/2+Math.cos(r)*s,y:i+Math.sin(r)*s,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||C)/2,y:(o.height||P)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[C,P,c,H,E,z,ee,J]),le=t.useMemo(()=>{const e=[...F,...k||[]];return ie&&e.push(ie),se&&e.push(se),e},[F,k,ie,se]),ce=t.useMemo(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.jsxs("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:[e.jsx("div",{style:{fontWeight:600},children:(null==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(I):"Remaining"})]})},[I]);if(0===D.length)return e.jsx(sn,{componentName:"GaugeChart",message:"No data to display",width:C,height:P});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:D,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:ee,startAngle:E,sweepAngle:x,centerContent:re,size:[C,P],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:P-ne-oe/2,left:te-oe/2,right:C-te-oe/2},enableHover:r.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===w?()=>null:en(w)||ce,svgAnnotationRules:ae},le.length>0&&{annotations:le}),L&&{title:L}),B&&{description:B}),T&&{summary:T}),void 0!==R&&{accessibleTable:R}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),A);return e.jsx(Ln,{componentName:"GaugeChart",width:C,height:P,children:e.jsx(St,Object.assign({ref:s},ue))})});Kn.displayName="GaugeChart";const Zn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:m=5,tooltip:v,annotations:b,frameProps:x={},selection:j,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:B,stroke:T,strokeWidth:R,opacity:I,showCategoryTicks:H,categoryFormat:$}=n,D=r.width,N=r.height,F=r.enableHover,W=r.showGrid,z=r.title,E=r.description,q=r.summary,G=r.accessibleTable,V=r.categoryLabel,Y=r.valueLabel,X=i||[],Q=In({data:X,rawData:i,colorBy:f,colorScheme:y,legendInteraction:P,legendPosition:L,selection:j,linkedHover:w,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"RidgelinePlot",chartId:M,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:_,emptyContent:C,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Et(),K=t.useMemo(()=>new Map,[X]),Z=t.useMemo(()=>e=>{const t=f?S(e,f,Q.colorScale):qt(B,U,y,void 0,K);return{fill:t,stroke:t,fillOpacity:.5}},[f,Q.colorScale,B,U,y,K]),J=t.useMemo(()=>Qt(Z,{stroke:T,strokeWidth:R,opacity:I}),[Z,T,R,I]),ee=t.useMemo(()=>Wt(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=t.useMemo(()=>qn(),[]),ne=hn({componentName:"RidgelinePlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(sn,{componentName:"RidgelinePlot",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:"ridgeline"},null!=i&&{data:X}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,bins:h,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:V,rLabel:Y,rFormat:p}),$&&{oFormat:$}),{showGrid:W,showCategoryTicks:H,oSort:!1,amplitude:g}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:en(v)||te}),(w||k||A||O)&&{customHoverBehavior:Q.customHoverBehavior}),(k||A||w)&&{customClickBehavior:Q.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"RidgelinePlot",width:D,height:N,children:e.jsx(St,Object.assign({ref:s},oe))})});Zn.displayName="RidgelinePlot";const Jn=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:p="horizontal",connectorOpacity:f=.3,showLabels:y=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R,categoryFormat:I}=n,H="vertical"===p,$=r.width,D=r.height,N=r.enableHover,F=r.title,W=r.description,z=r.summary,E=r.accessibleTable,q=i||[],G=h||d,V=!G,Y=In({data:q,rawData:i,colorBy:G,colorScheme:g,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"FunnelChart",chartId:O,showLegend:r.showLegend,userMargin:a,marginDefaults:H?{top:F?60:40,right:20,bottom:60,left:60}:{top:F?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:_,width:$,height:D});if(Y.earlyReturn)return Y.earlyReturn;Rn("FunnelChart",q,"stepAccessor",c),Rn("FunnelChart",q,"valueAccessor",u);const X=Et(),Q=t.useMemo(()=>new Map,[q]),U=t.useMemo(()=>{if(V)return L||((null==X?void 0:X[0])?X[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[V,L,X,g]),K=b.pieceStyle,Z=t.useMemo(()=>(e,t)=>{const n={};if(n.fill=U||(G?S(e,G,Y.colorScale):qt(L,X,g,t,Q)),K){const o=K(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[U,G,Y.colorScale,L,X,g,Q,K]),J=t.useMemo(()=>Qt(Z,{stroke:B,strokeWidth:T,opacity:R}),[Z,B,T,R]),ee=t.useMemo(()=>Wt(J,Y.effectiveSelectionHook,Y.resolvedSelection),[J,Y.effectiveSelectionHook,Y.resolvedSelection]),te=t.useMemo(()=>t=>{var n,o,r,s,i,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(s=null==l?void 0:l.__funnelPercent)&&void 0!==s?s:null==l?void 0:l.__barFunnelPercent,h=null!==(i=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==i?i:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,p=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,f=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:Ut,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),p&&p!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:p+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",f]})]})},[]),ne=hn({componentName:"FunnelChart",data:i,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(sn,{componentName:"FunnelChart",message:ne,width:$,height:D});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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:H?"bar-funnel":"funnel"},null!=i&&{data:q}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:ee,size:[$,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Y.margin,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),I&&{oFormat:I}),{showGrid:H}),!H&&{connectorOpacity:f}),{showLabels:y}),Y.legendBehaviorProps),F&&{title:F}),W&&{description:W}),z&&{summary:z}),void 0!==E&&{accessibleTable:E}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?te:en(m)||te}),(j||w||k||A)&&{customHoverBehavior:Y.customHoverBehavior}),(w||k||j)&&{customClickBehavior:Y.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ln,{componentName:"FunnelChart",width:$,height:D,children:e.jsx(St,Object.assign({ref:s},oe))})});Jn.displayName="FunnelChart";const eo={RdBu:r.interpolateRdBu,PiYG:r.interpolatePiYG,PRGn:r.interpolatePRGn,BrBG:r.interpolateBrBG,RdYlBu:r.interpolateRdYlBu,RdYlGn:r.interpolateRdYlGn,Spectral:r.interpolateSpectral},to="__likert_neutral_neg",no="__likert_neutral_pos";function oo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ro(e,t,n,o,r,s){const i=new Map,a=new Set(t);for(const l of e){const e=n(l);i.has(e)||i.set(e,new Map);const c=i.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&s){const e=r(l),t=s(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 i){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const s=t[r],i=n.get(s)||0;l.push({__likertCategory:e,__likertLevel:s,__likertLevelLabel:s,__likertCount:i,__likertPct:i/o*100,__likertLevelIndex:r})}}return l}function so(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),s=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;s.push(Object.assign(Object.assign({},t),{__likertLevel:to,__likertPct:-e})),s.push(Object.assign(Object.assign({},t),{__likertLevel:no,__likertPct:e}))}else s.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return s}function io(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),s=new Map;for(const t of e){const e=s.get(t.__likertCategory)||[];e.push(t),s.set(t.__likertCategory,e)}const i=[];for(const[,e]of s){const t=new Map;let s,a;for(const n of e)n.__likertLevel===to?s=n:n.__likertLevel===no?a=n:t.set(n.__likertLevelIndex,n);o&&s&&i.push(s);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&i.push(n)}o&&a&&i.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&i.push(n)}}return i}const ao=t.forwardRef(function(n,o){const r=Yt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:h="count",levels:p,orientation:f="horizontal",colorScheme:y,barPadding:m=20,tooltip:v,annotations:b,frameProps:x={},selection:j,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:S,valueFormat:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,categoryFormat:B,stroke:T,strokeWidth:R,opacity:I}=n,H=r.width,$=r.height,D=r.enableHover,N=r.showGrid,F=r.showLegend,W=r.title,z=r.description,E=r.summary,q=r.accessibleTable,G=r.categoryLabel,V=r.valueLabel,Y="horizontal"===f,X=void 0===i,Q=!d,U=function(){var e;const t=zt();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),K=t.useMemo(()=>y&&Array.isArray(y)&&y.length>=p.length?y:function(e,t){if(0>=e)return[];if(t){const n=eo[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"],r="#a8a8a8";if(1===e)return[r];const s=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);s&&a.push(r);for(let e=0;i>e;e++)a.push(o[Math.min(Math.floor(e*o.length/i),o.length-1)]);return a}(p.length,U),[y,p.length,U]),Z=t.useMemo(()=>{const e=new Map;for(let t=0;p.length>t;t++)e.set(p[t],K[t]||"#888");return e},[p,K]),{processedData:J,reAggregate:ee,accumulatorRef:te}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:r,levelAccessor:s,countAccessor:i,isDiverging:a,frameRef:l}){const c=!s,u=t.useMemo(()=>oo(o,"question"),[o]),d=t.useMemo(()=>c?oo(r,"score"):null,[c,r]),h=t.useMemo(()=>c?null:oo(s,"level"),[c,s]),g=t.useMemo(()=>c?null:oo(i,"count"),[c,i]),p=e||[],f=t.useRef([]),y=t.useMemo(()=>{if(0===p.length)return[];let e=ro(p,n,u,d,h,g);return a&&(e=so(e,n),e=io(e,n)),e},[p,n,u,d,h,g,a]),m=t.useCallback(e=>{var t;let o=ro(e,n,u,d,h,g);a&&(o=so(o,n),o=io(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,g,a,l]);return{processedData:y,reAggregate:m,accumulatorRef:f}}({data:i,levels:p,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:h,isDiverging:Y,frameRef:s}),ne="__likertLevelLabel",oe=$n({isPushMode:X,colorBy:ne,colorScheme:K,showLegend:F,legendPosition:L}),re=t.useCallback(oe.wrapPush(e=>{te.current.push(e),ee(te.current)}),[oe.wrapPush,ee,te]),se=t.useCallback(oe.wrapPushMany(e=>{te.current.push(...e),ee(te.current)}),[oe.wrapPushMany,ee,te]);t.useImperativeHandle(o,()=>({push:re,pushMany:se,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;te.current=[],oe.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[re,se,oe.resetCategories,te]);const ie=In({data:J,rawData:i,colorBy:ne,colorScheme:K,legendInteraction:P,legendPosition:L,selection:j,linkedHover:w,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"LikertChart",chartId:S,showLegend:F,userMargin:a,marginDefaults:r.marginDefaults,loading:_,emptyContent:C,width:H,height:$});if(ie.earlyReturn)return ie.earlyReturn;const ae=t.useMemo(()=>{const e=p.length;return e%2!=0&&Z.get(p[Math.floor(e/2)])||"#888"},[p,Z]),le=x.pieceStyle,ce=t.useMemo(()=>(e,t)=>{var n,o;const r=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),s=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let i;if(s===to||s===no)i={fill:ae};else{const e=r||s;i=e&&Z.has(e)?{fill:Z.get(e)}:{fill:"#888"}}if(le){const n=le(e,t);n.stroke&&(i.stroke=n.stroke),null!=n.strokeWidth&&(i.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(i.strokeOpacity=n.strokeOpacity)}return i},[Z,ae,le]),ue=t.useMemo(()=>Qt(ce,{stroke:T,strokeWidth:R,opacity:I}),[ce,T,R,I]),de=t.useMemo(()=>Wt(ue,ie.effectiveSelectionHook,ie.resolvedSelection),[ue,ie.effectiveSelectionHook,ie.resolvedSelection]),he=t.useMemo(()=>{const e=p.length;return e%2!=0?p[Math.floor(e/2)]:""},[p]),ge=t.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===to||n===no?he:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),i=n===to||n===no?2*s:s,a=t.__likertCount||0;return g.createElement("div",{className:"semiotic-tooltip",style:Ut},g.createElement("div",{style:{fontWeight:"bold"}},r),g.createElement("div",{style:{marginTop:4}},`${o}: ${i.toFixed(1)}% (n=${a})`))},[he]),pe=t.useMemo(()=>{if(!p||2>p.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==i&&0===i.length)return null;const e={categoryAccessor:c};return Q?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),h&&(e.countAccessor=h)),hn({componentName:"LikertChart",data:i,accessors:e,requiredProps:{levels:p}})},[i,c,u,d,h,p,Q]),fe=t.useMemo(()=>[{styleFn:e=>({fill:Z.get(e.label)||"#888"}),items:p.map(e=>({label:e})),label:""}],[p,Z]),ye=t.useMemo(()=>!1!==F?Object.assign(Object.assign({},ie.legendBehaviorProps),{legend:{legendGroups:fe},legendPosition:L||ie.legendPosition||"bottom"}):ie.legendBehaviorProps,[ie.legendBehaviorProps,ie.legendPosition,L,F,fe]),me=t.useMemo(()=>{const e=Object.assign({},ie.margin);if(X&&!1!==F){const t=L||"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(oe.streamingMarginAdjust)for(const[t,n]of Object.entries(oe.streamingMarginAdjust))n>e[t]&&(e[t]=n);return Y&&100>e.left&&(e.left=100),e},[ie.margin,oe.streamingMarginAdjust,Y,X,F,L]),ve=t.useMemo(()=>M||(Y?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Y,M]),be=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!=i&&{data:J}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Y?"horizontal":"vertical",pieceStyle:de,size:[H,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:me,barPadding:m,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:G,rLabel:V||(Y?void 0:"Percentage"),rFormat:ve}),B&&{oFormat:B}),{showGrid:N}),ye),W&&{title:W}),z&&{description:z}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:!0===v?ge:en(v)||ge}),(w||k||A||O)&&{customHoverBehavior:ie.customHoverBehavior}),(k||A||w)&&{customClickBehavior:ie.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return pe?e.jsx(sn,{componentName:"LikertChart",message:pe,width:H,height:$}):e.jsx(Ln,{componentName:"LikertChart",width:H,height:$,children:e.jsx(St,Object.assign({ref:s},be))})});ao.displayName="LikertChart",exports.BarChart=Hn,exports.BoxPlot=Gn,exports.DonutChart=Un,exports.DotPlot=Xn,exports.FunnelChart=Jn,exports.GaugeChart=Kn,exports.GroupedBarChart=Fn,exports.Histogram=Vn,exports.LikertChart=ao,exports.PieChart=Qn,exports.RidgelinePlot=Zn,exports.StackedBarChart=Nn,exports.StreamOrdinalFrame=St,exports.SwarmPlot=En,exports.SwimlaneChart=zn,exports.ViolinPlot=Yn,exports.createHatchPattern=ft;
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-scale"),o=require("d3-quadtree"),r=require("d3-scale-chromatic"),s=require("d3-array"),i=require("d3-hierarchy"),a=require("d3-shape"),l=require("regression"),c=require("d3-selection"),u=require("d3-brush");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const g=h(t),p=d(l);class f{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return 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 y{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 r=0;this._size>r;r++){const s=(o+r)%this._capacity,i=this.buffer[s];if(e(i)){let e;e="object"!=typeof i||null===i?i:Array.isArray(i)?[...i]:Object.assign({},i),n.push(e),this.buffer[s]=t(i)}}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 m{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function v(e,t,n){return e+(t-e)*n}function b(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function x(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function j(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const w={category10:r.schemeCategory10,tableau10:r.schemeTableau10,set3:r.schemeSet3,blues:r.interpolateBlues,reds:r.interpolateReds,greens:r.interpolateGreens,oranges:r.interpolateOranges,purples:r.interpolatePurples,viridis:r.interpolateViridis,plasma:r.interpolatePlasma},k=r.schemeCategory10,A=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],O=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 S(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")||O.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):k[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+""))%k.length]}function M(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),s=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const i=w[o]||w.category10;if(s&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:k;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function _(e,t,n,o,r,s,i){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:s,group:i}}function C(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,s=[],i=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=r(e.pieceData[0],e.name);s.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:i,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return s}function P(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=s.quantile(e,.25))&&void 0!==t?t:i,median:null!==(n=s.quantile(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=s.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}const L={bar:function(e,t){var n,o,r;const{scales:s,columns:i,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=s,g=[],p="vertical"===h,f="horizontal"===h,y=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(i))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(i)){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(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const s of m){const i=t.get(s);if(!i)continue;let a=i.total;y&&n>0&&(a/=n);const l=u(i.pieces[0],c?s:e.name),h=Object.assign(Object.assign({},i.pieces[0]),{__aggregateValue:i.total,__pieceCount:i.pieces.length,category:e.name});if(p){const t=d(0>a?r:o+a),n=0>a?d(r+a)-d(r):d(o)-d(o+a);g.push(_(e.x,t,e.width,Math.abs(n),l,h,s)),0>a?r+=a:o+=a}else if(f){const t=d(0>a?r+a:o),n=0>a?d(r)-d(r+a):d(o+a)-d(o);g.push(_(t,e.x,Math.abs(n),e.width,l,h,s)),0>a?r+=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===(r=t.datum)||void 0===r?void 0:r.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:r,getR:s,getGroup:i,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=i?i(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,r=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let i=0;h.length>i;i++){const c=r.get(h[i])||[];for(const r of c){const c=s(r),g=a(r,h[i]);if(d){const s=e.x+i*t+n/2,a=l(0),d=l(c);u.push(_(s,Math.min(a,d),o,Math.abs(a-d),g,r,h[i]))}else{const s=e.x+i*t+n/2,a=l(0),d=l(c);u.push(_(Math.min(a,d),s,Math.abs(d-a),o,g,r,h[i]))}}}}const f=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=s(e.datum);f>0&&(e.roundedTop=f),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){var n,o;const{scales:r,columns:s,getR:i,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,f=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(s))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,s=null!==(o=t.__rValue)&&void 0!==o?o:i(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*f,n=u(s);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(s)):(b=u(s),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:s}=e,{r:i,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=s(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:i(a),p=c?i(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:C,donut:C,boxplot:function(e,t){var n,o,r,i,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:p,projection:f}=c,y=[],m="vertical"===f,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],f=null!==(n=s.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=s.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(r=s.quantile(c,.75))&&void 0!==r?r:d,j=x-f,w=f-1.5*j,k=x+1.5*j,A=null!==(i=c.find(e=>e>=w))&&void 0!==i?i:u,O=null!==(a=[...c].reverse().find(e=>k>=e))&&void 0!==a?a:d,S=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(w>n||n>k){const o=m?t.middle:p(n),r=m?p(n):t.middle;M.push({px:o,py:r,value:n,datum:e})}}if(y.push({type:"boxplot",x:m?t.middle:0,y:m?0:t.middle,projection:m?"vertical":"horizontal",columnWidth:.6*t.width,minPos:p(A),q1Pos:p(f),medianPos:p(b),q3Pos:p(x),maxPos:p(O),stats:{n:c.length,min:A,q1:f,median:b,q3:x,max:O,mean:c.reduce((e,t)=>e+t,0)/c.length},style:S,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:S.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=i,g=[],p="vertical"===h,f=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],l=(a-i)/f||1,h=Array(f).fill(0);for(const e of t)h[Math.min(Math.floor((e-i)/l),f-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(p){b=`M ${e.middle} ${d(i)}`;for(let t=0;f>t;t++){const n=d(i+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=f-1;t>=0;t--){const n=d(i+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${n}`}b+=" Z"}else{b=`M ${d(i)} ${e.middle}`;for(let t=0;f>t;t++)b+=` L ${d(i+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)b+=` L ${d(i+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let j;if(y&&t.length>=4){const l=null!==(n=s.quantile(t,.25))&&void 0!==n?n:i,c=null!==(o=s.quantile(t,.5))&&void 0!==o?o:(i+a)/2,u=null!==(r=s.quantile(t,.75))&&void 0!==r?r:a;j={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:p}}const w=p?{x:e.x,y:Math.min(d(a),d(i)),width:e.width,height:Math.abs(d(a)-d(i))}:{x:Math.min(d(i),d(a)),y:e.x,width:Math.abs(d(a)-d(i)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:j,stats:P(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var n;const{scales:o,columns:r,config:s,getR:i,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=s.bins||25,d=s.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,s=Array(u).fill(0);for(const e of t)n>e||e>o||s[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,f=Math.max(...s,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===s[t])continue;const o=(d?s[t]/h:s[t]/f)*e.width*.9,i=l(n+t*r),a=l(n+(t+1)*r);c.push(_(Math.min(i,a),e.x+e.width-o,Math.abs(a-i),o,y,{bin:t,count:s[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:s,getR:i,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=s.bins||20,h="horizontal"===c,g=s.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],s=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/s),d-1)]++;const p=Math.max(...c,1),f=a(e.pieceData[0],e.name),y=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)*s)} ${t-c[e]/p*y}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*s);m+=` L ${t+c[e]/p*y} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:P(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:s}=e,{r:i,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=s(t,e.name);if(c){const n=i(Math.min(o,a)),r=i(Math.max(o,a));l.push(_(n,e.x,r-n,e.width,u,t,e.name))}else{const n=i(Math.max(o,a)),r=i(Math.min(o,a));l.push(_(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var o,r,s,i,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:p}=e,f=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return f;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const j=b.length>1&&"_default"!==b[0],w=[];let k=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=g?g(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),s=h(o);r.total+=s,r.pieces.push(o),n+=s}w.push({col:e,groups:t,stepTotal:n}),j||n>k&&(k=n)}if(j)for(const e of w){let t=0,n=0;for(let o=0;b.length>o;o++){const r=e.groups.get(b[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>k&&(k=o)}if(0===k)return f;const A=new Map;for(const e of b){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,S=j?.95*y:.9*t.width,M=n.scaleLinear().domain([0,k]).range([0,S]),C=null!==(r=e.config.connectorOpacity)&&void 0!==r?r:.3;let P=new Map;for(let t=0;w.length>t;t++){const n=w[t],o=n.col,r=0===t,d=o.width,h=.55*d,g=o.x+(d-h)/2,v=new Map;if(j){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=y,s=y;for(let i=0;b.length>i;i++){const l=b[i],c=n.groups.get(l);if(!c)continue;const u=M(c.total),d=i%2==0,x=d?t:s-u;d?t+=u:s-=u;const j=p(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,k=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});m&&(0===i&&(O.__funnelStepLabel=o.name,O.__funnelStepLabelX=y,O.__funnelStepLabelY=g,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+u/2,O.__funnelValueLabelY=g,O.__funnelBarW=u),f.push(_(x,g,u,h,j,O,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=y-t/2,l=b[0],c="_default"!==l,u=null!==(i=null===(s=n.groups.get(l))||void 0===s?void 0:s.pieces[0])&&void 0!==i?i:o.pieceData[0],d=c?l:o.name,x=p(u,d),j=O>0?e/O*100:0,w=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:j,__funnelStep:o.name,__funnelIsFirstStep:r,category:c?l:o.name});m&&(w.__funnelStepLabel=o.name,w.__funnelStepLabelX=y,w.__funnelStepLabelY=g,w.__funnelRowWidth=t,w.__funnelValueLabelX=y,w.__funnelValueLabelY=g,w.__funnelBarW=t),f.push(_(a,g,t,h,x,w,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&P.size>0){const t=j?b:[b[0]];for(const r of t){const t=P.get(r),s=v.get(r);if(!t||!s)continue;const i=(()=>{const e=n.groups.get(r);return p(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[s.x+s.w,s.y],[s.x,s.y]],style:{fill:i.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=n.groups.get(r))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===r?o.name:r};f.push(a)}}P=v}return f},"bar-funnel":function(e,t){var n,o,r,s;const{columns:i,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>i[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 f=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),s=a(o);r.total+=s,r.pieces.push(o),n+=s}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[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=f?g.length:1,x=f?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,i=e>0?y[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 y=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,j=null==i?void 0:i.groups.get(h),w=null!==(s=null==j?void 0:j.total)&&void 0!==s?s:y,k=o?0:Math.max(0,w-y),A=n.x+e*a+l/2,O=v(y),S=v(0)-O,M=c(p.pieces[0],f?h:n.name),C=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:f?h:n.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(y+k)});if(d.push(_(A,O,u,S,M,C,f?h:n.name)),k>0){const e=v(y+k),t=O-e,o=Object.assign({},M),r=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:f?h:n.name});d.push(_(A,e,u,t,o,r,f?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:s,resolvePieceStyle:i}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=s?s(n):e.name,d=i(n,l);if(u){const r=a(t),s=a(t+o);c.push(_(r,e.x,s-r,e.width,d,n,l))}else{const r=a(t+o),s=a(t);c.push(_(e.x,r,e.width,s-r,d,n,l))}t+=o}}return c}};class B{constructor(e){this.rExtent=new m,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 y(e.windowSize),this.getO=j(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new m)):(this.getR=x(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=j(e.stackBy),this.getGroup=j(e.groupBy),this.getColor=j(e.colorAccessor),this.getConnector=j(e.connectorAccessor),this.getDataId=j(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new y(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:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const r=o.toArray(),s=t.projection||"vertical",i=t.oExtent||this.resolveCategories(r),a=this.computeValueDomain(r,i),l="horizontal"===s,c="radial"===s,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1));let d,h;if(c){d=n.scaleBand().domain(i).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=t.innerRadius||0;h=n.scaleLinear().domain(a).range([r,o])}else l?(d=n.scaleBand().domain(i).range([0,e.height]).padding(u),h=n.scaleLinear().domain(a).range([0,e.width])):(d=n.scaleBand().domain(i).range([0,e.width]).padding(u),h=n.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:s},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((r,s)=>{var i;const a=this.rExtents[s];a.dirty&&a.recalculate(o,r);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(i=t.extentPadding)&&void 0!==i?i:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?n.scaleLinear().domain([c,u]).range([0,e.width]):n.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=r;this.rAccessors.length>1&&(g=r.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(g,i,d,s,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),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 r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const s=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return s}if(!1===o)return s;if("function"==typeof o)return s.sort(o);const i=new Map;for(const t of e){const e=this.getO(t);i.set(e,(i.get(e)||0)+Math.abs(this.getR(t)))}return s.sort("asc"===o?(e,t)=>(i.get(e)||0)-(i.get(t)||0):(e,t)=>(i.get(t)||0)-(i.get(e)||0))}computeValueDomain(e,t){var n,o,r,s,i;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),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>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===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var s;const i={},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 s=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*s)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(s=n(e))&&void 0!==s?s:0,g=n.bandwidth()),i[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return i}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=L[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:r,config:s,getConnector:i,getO:a}=e;if(!i||!r)return[];const l=[],{projection:c}=r,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=i(t);if(!n)continue;let o,r;"point"===e.type?(o=e.x,r=e.y):(o=e.x+e.w/2,r=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:r,datum:t,category:a(t)})}const d=r.o.domain(),h=s.connectorStyle;for(const[t,r]of u)if(r.length>=2){r.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let s=0;r.length-1>s;s++){const i=r[s],a=r[s+1],c="function"==typeof h?h(i.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:i.x,y1:i.y,x2:a.x,y2:a.y,style:c,datum:i.datum,group:t})}}return l}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||A,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,r,s;if(1>=n)return 1;const i=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return i+(1-a/(n-1))*(1-i);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return i+Math.pow(.5,a/t)*(1-i)}case"step":return(null!==(s=e.stepThreshold)&&void 0!==s?s:.5*n)>a?1:i;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",r=new Map;for(let s=0;e.length>s;s++){const i=e[s],a=n?t(i):i[o];let l=r.get(a);l||(l=[],r.set(a,l)),l.push(s)}return this._categoryIndexCache={version:this._dataVersion,map:r},r}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,B.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let r=0;for(const e of this.scene)"point"===e.type&&(n[r++]=e);this._pointQuadtree=o.quadtree().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 r=t.length;if(1>=r)return;const s=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const i=this.computeDecayOpacity(e,r),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*i})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const s="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=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 r=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=s-t;if(i>n){const e=1-n/i;e>r&&(r=e)}}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=s-o;i>r&&(n._pulseIntensity=1-r/i,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,r;this.prevPositionMap.clear();const s=new Map,i=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,s);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:i,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:i,y:t.y,w:0,h:t.h,opacity:null!==(r=t.style.opacity)&&void 0!==r?r: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,r;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!==(r=e.category)&&void 0!==r?r:""):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],r=this.getNodeKey(o,t);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(r,{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,r,s,i,a,l,c,u,d,h,g,p,f,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const j=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 w=!1;const k=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);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),w=!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}),w=!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!==(r=d.w)&&void 0!==r?r:c.w,c.h=null!==(s=d.h)&&void 0!==s?s:c.h,w=!0)):(c._targetOpacity=null!==(i=c.style.opacity)&&void 0!==i?i:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!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,w=!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}),w=!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!==(f=t.endAngle)&&void 0!==f?f:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y: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)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:j})}advanceTransition(e){var t,n,o,r;if(!this.activeTransition)return!1;const s=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(s,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=v(r,e._targetOpacity,i)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=v(o.x,e._targetX,i),e.y=v(o.y,e._targetY,i)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=v(o.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=v(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=v(n.x,e._targetX,i),e.y=v(n.y,e._targetY,i),void 0!==n.w&&(e.w=v(n.w,e._targetW,i),e.h=v(n.h,e._targetH,i))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:v(o,e._targetOpacity,i)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=v(n.startAngle,e._targetStartAngle,i),e.endAngle=v(n.endAngle,e._targetEndAngle,i))}}}if(s>=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 r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,r}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,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const s=this.buffer.update(e=>n.has(o(e)),t);if(0===s.length)return s;for(const e of s)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,s}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&&!b(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!b(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!b(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(b(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=j(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,r=Array.isArray(n)?n:[n],s=Array.isArray(o)?o:[o];if(r.length!==s.length||r.some((e,t)=>!b(e,s[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new m)):(this.getR=x(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!b(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?j(this.config.stackBy):void 0),"groupBy"in e&&!b(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?j(this.config.groupBy):void 0),"colorAccessor"in e&&!b(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?j(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!b(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?j(this.config.connectorAccessor):void 0)}}function T(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function R(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function I(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 H(e,t,n,o=30){const r=t-e.x,s=n-e.y,i=Math.sqrt(r*r+s*s);return i>T(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function $(e,t,n){const o=t-e.cx,r=n-e.cy,s=Math.sqrt(o*o+r*r);if(e.innerRadius>s||s>e.outerRadius)return null;const i=R(Math.atan2(r,o)),a=R(e.startAngle),l=R(e.endAngle);if(!(a>l?i>=a||l>=i:i>=a&&l>=i))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 D(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,s=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>s))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function N(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:s,height:i}=e.bounds;return o>t||t>o+s||r>n||n>r+i?null:{datum:e.datum,x:o+s/2,y:r+i/2,distance:0,category:e.category,stats:e.stats}}function F(e,t,n){const o=e.byGroup.get(t);let r=0,s=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);s>t&&(s=t,r=e)}return o[r]._flatIndex}function W(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})}B.QUADTREE_THRESHOLD=500;const z={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function E(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,z[n])(o(e,t)),r}function q(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function G(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const V=(t,n,o,r,s,i,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let f=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=s;return g.forEach((t,u)=>{const v=E(t,u,d,h),b=G(t,r,s),x=s&&s.size>0&&s.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${f})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===i&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(q,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),f+=22}),p};function Y({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:s,label:i,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+g.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(s[0]+n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":i||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),i&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(s[1]-n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":i||"Gradient legend",children:[i&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(s[0])})]})}function X(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,p]=g.useState(0),[f,y]=g.useState(0),m=g.useCallback((e,t)=>{p(e),y(t)},[]),v="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e.jsx("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:V(t,o,r,s,i,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const f=((t,n,o,r,s,i,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,f=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=s;p.forEach((t,u)=>{const x=E(t,u,h,g),j=G(t,r,s),w=s&&s.size>0&&s.has(t.label),k=26+7*t.label.length;d&&d>0&&y>0&&y+k>d&&(m++,y=0),f.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===i&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.jsx(q,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k});let x=0,j=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&j>0&&j+t>d?(x=Math.max(x,j),j=t):j+=t}x=Math.max(x,j);const w=m+1;return{items:f,offset:x,totalRows:w,totalHeight:22*w}})(t,r,s,i,a,l,c,n,u,d,o);p+=f.offset+5,g.push(Object.assign(Object.assign({label:t.label},f),{offset:p,totalRows:f.totalRows,totalHeight:f.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const f=[];return g.forEach((o,r)=>{const s=t[r];s.label&&(f.push(e.jsx("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s.label},"legend-text-"+r)),p+=16),f.push(e.jsx("g",{className:"legend-item",transform:`translate(${p},0)`,children:o.items},"legend-group-"+r)),p+=o.offset+5,t[r+1]&&f.push(e.jsx("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),e.jsx("g",{children:f})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}),b=!(!o&&!r);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),v]})}function Q(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function U(t){const{legend:n,totalWidth:o,totalHeight:r,margin:s,legendPosition:i="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===i||"bottom"===i;let p,f;return"left"===i?(p=4,f=s.top):"top"===i?(p=0,f=a?32:8):"bottom"===i?(p=0,f=r-s.bottom+50):(p=o-s.right+10,f=s.top),e.jsx("g",{transform:`translate(${p}, ${f})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(Y,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Q(n)?e.jsx(X,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function K(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),s=[];let i="";for(const e of r)i&&i.length+1+e.length>o?(s.push(i),i=e):i=i?`${i} ${e}`:e;return i&&s.push(i),s}function Z(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 J(t,n,o,r){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:s,title:i,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!s&&!i)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,f=i?u?[i]:K(i,c):[],y=s?u?[s]:K(s,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:f.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=f.length*p),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=null;if((i||s)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(f.length+y.length)*p+(y.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+y.length-1)*p;let k=0;return"topBottom"===d?k=0>o?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+p+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),j]})}function ee(t,n,o,r,s){var i;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.jsx("rect",{width:t,height:r,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 t=r||0,i=s||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.jsx("line",{x1:r,y1:(n.y1||0)-i,x2:r,y2:(n.y2||0)-i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-i;a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,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(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,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(e.jsx("line",{x1:0,y1:(n.y1||0)-i,x2:0,y2:(n.y2||0)-i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(i=null==n?void 0:n.width)&&void 0!==i?i:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:Z((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function te(t,n,o,r,s,i){const a=[];let l=0,c=0;if("callout-circle"!==s&&"label"!==s||!(null==i?void 0:i.radius)){if("callout-rect"===s&&i){const e=i.width||0,o=i.height||0;if(e>0||o>0){const r=e/2,s=o/2,i=t-r,a=n-s;if(0!==i||0!==a){const t=Math.abs(i),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+i*h,c=s+a*h}}}else if("bracket"===s&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(i.radius||0)+(i.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,s=16/180*Math.PI,i=Math.atan2(n-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+o*Math.cos(i+s)},${c+o*Math.sin(i+s)}L${l+o*Math.cos(i-s)},${c+o*Math.sin(i-s)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:a})}function ne(t){const{x:n=0,y:o=0,dx:r,dy:s,nx:i,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:f={},"data-testid":y}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=s||0;null!=i&&(v=i-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.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f,{children:[!m.has("connector")&&te(v,b,c,h,x,u),!m.has("subject")&&ee(x,u,h,n,o),!m.has("note")&&J(l,v,b,h)]}))}function oe(t){var n,o;const{noteData:r}=t,{screenCoordinates:s}=r,i="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&s){const t=r.nx||s[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||s[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=s.map((n,o)=>{const s=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(ne,Object.assign({"data-testid":"semiotic-annotation"},s,{type:i}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=r.note||{title:"none",label:r.label},c=`${l.label}-${l.title}-${r.i}`;return e.jsx(ne,Object.assign({"data-testid":"semiotic-annotation",events:a},r,{type:i}),c)}function re(e,t){var n,o,r;const s=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return s?null!=e.x?s(e.x):t.xAccessor&&null!=e[t.xAccessor]?s(e[t.xAccessor]):null:null}function se(e,t){var n,o,r;const s=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return s?null!=e.y?s(e.y):t.yAccessor&&null!=e[t.yAccessor]?s(e[t.yAccessor]):null:null}function ie(e,t,n){var o,r,s,i;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const s=n.pointNodes[r];if(s.pointId===e.pointId){const e={x:s.x,y:s.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const s=function(e){var t,n,o,r,s,i;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!==(s=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==s?s:null===(i=e.scales)||void 0===i?void 0:i.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 s&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,s)),s}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=re(e,n),c=se(e,n)),null!=l&&null!=c)return null===(s=n.stickyPositionCache)||void 0===s||s.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function ae(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const le={linear:a.curveLinear,monotoneX:a.curveMonotoneX,monotoneY:a.curveMonotoneY,step:a.curveStep,stepAfter:a.curveStepAfter,stepBefore:a.curveStepBefore,basis:a.curveBasis,cardinal:a.curveCardinal,catmullRom:a.curveCatmullRom};function ce(n){const{width:o,height:r,totalWidth:s,totalHeight:i,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h}=n,g="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),f=t.useMemo(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||ue)(e)})),[l,d,g,h]),y=u&&l&&!g,m=c&&l&&!g;return y||m?e.jsx("svg",{width:s,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[y&&e.jsx("g",{className:"ordinal-grid",children:f.map((t,n)=>e.jsx("line",{x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:o,y2:p?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),m&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,p?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function ue(e){return Math.round(100*e)/100+""}function de(n){var o,r;const{width:s,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,showCategoryTicks:f,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:j,legend:w,legendHoverBehavior:k,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:_,annotations:C,svgAnnotationRules:P,xAccessor:L,yAccessor:B,annotationData:T,underlayRendered:R,children:I}=n,H="radial"===(null==h?void 0:h.projection),$="horizontal"===(null==h?void 0:h.projection),D=!1!==f,N=t.useMemo(()=>g&&D&&h&&!H?h.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=h.o(e))&&void 0!==n?n:0)+h.o.bandwidth()/2,label:v?v(e,t):e}}):[],[g,D,h,v,H]),F=n.rTickValues,W=n.tickLabelEdgeAlign,z=t.useMemo(()=>g&&h&&!H?(F||h.r.ticks(5)).map(e=>({value:e,pixel:h.r(e),label:(b||ue)(e)})):[],[g,h,b,H,F]),E=t.useRef(new Map),q=t.useRef(null!==(o=null==C?void 0:C.length)&&void 0!==o?o:0),G=null!==(r=null==C?void 0:C.length)&&void 0!==r?r:0;q.current!==G&&(q.current=G,E.current=new Map);const V=t.useMemo(()=>{if(!C||0===C.length)return null;const t=function(t,n,o){var r,s,l,c,u,d,h,g,f,y,m,v,b,x,j,w,k,A,O,S,M,_,C,P,L,B,T,R,I,H,$,D,N,F,W,z,E,q,G,V,Y,X,Q,U,K,Z,J,ee;switch(t.type){case"label":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return ae(s,i,o)?e.jsx(oe,{noteData:{x:s,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"callout":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return ae(s,i,o)?e.jsx(oe,{noteData:{x:s,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"x-threshold":{const r=re(t,o);if(null==r)return null;const s=t.color||"#f97316",i=t.labelPosition||"top";let a;return a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:r+4,y:a,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const r=se(t,o);if(null==r)return null;const s=t.color||"#f97316",i=t.labelPosition||"right";let a,l;return"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:r-4,textAnchor:l,fill:s,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:re(Object.assign(Object.assign({},e),{type:"point"}),o),y:se(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=i.packEnclose(r),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:re(Object.assign(Object.assign({},e),{type:"point"}),o),y:se(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=t.padding||10,i=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...i)-s,c=Math.max(...i)+s,u=Math.min(...a)-s,d=Math.max(...a)+s;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const r=o.data||[],s="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],i={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:s.map((n,r)=>{const s=re(n,o),a=se(n,o);if(null==s||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||i;return e.jsx("circle",Object.assign({cx:s,cy:a,r:l},c),"hl-"+r)})},"ann-"+n)}case"bracket":{const r=re(t,o),s=se(t,o);return e.jsx(oe,{noteData:{x:null!=r?r:0,y:null!=s?s:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const a=o.xAccessor||"x",g=o.yAccessor||"y",f=i.map(e=>[e[a],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(s=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(l=o.scales)||void 0===l?void 0:l.time,m=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!y||!m)return null;const v=t.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),s=o.map(e=>e[1]),i=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(i-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*s[e],g+=t*r[e]*r[e],p+=t*r[e]*s[e])}if(0===u){a.push([t,s[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*p-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?p.default.polynomial(f,{order:t.order||2}):p.default.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),j=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:j,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:j,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const r=null!==(f=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(y=o.scales)||void 0===y?void 0:y.value,s=null!==(m=null==r?void 0:r(t.y0))&&void 0!==m?m:0,i=null!==(v=null==r?void 0:r(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(s,i),width:o.width||0,height:Math.abs(i-s),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(s,i)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const s=o.xAccessor||"x",i=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(j=o.scales)||void 0===j?void 0:j.time,l=null!==(k=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==k?k:null===(A=o.scales)||void 0===A?void 0:A.value;if(!i||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.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=le[o.curve||"linear"]||a.curveLinear,p=a.area().x(e=>i(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const f=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:f,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:i(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const s=o.yAccessor||"y",i=null!==(M=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(_=o.scales)||void 0===_?void 0:_.time,a=null!==(P=null===(C=o.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.value;if(!i||!a)return null;const l=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(B=t.threshold)&&void 0!==B?B:2,g=c-h*d,p=!1!==t.showBand,f=t.fill||"#6366f1",y=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,m=t.anomalyColor||"#ef4444",v=null!==(R=t.anomalyRadius)&&void 0!==R?R:6,b=a(c+h*d),x=a(g),j=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),j.map((t,n)=>{const r=re(t,o),s=se(t,o);return null==r||null==s?null:e.jsx("circle",{cx:r,cy:s,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const s=o.xAccessor||"x",i=o.yAccessor||"y",a=null!==(H=null===(I=o.scales)||void 0===I?void 0:I.x)&&void 0!==H?H:null===($=o.scales)||void 0===$?void 0:$.time,l=null!==(N=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==N?N:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!l)return null;const c=r.map(e=>[e[s],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,s]of c)t+=e,n+=s,o+=e*e,r+=e*s;const s=e*o-t*t;if(1e-12>Math.abs(s))return null;const i=(e*r-t*n)/s,a=(n-i*t)/e;u=e=>a+i*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(W=t.confidence)&&void 0!==W?W:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=t.steps)&&void 0!==z?z:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*j);const k=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-f,2)/y:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&k.length>0&&e.jsx("text",{x:a(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let r=null,s=null;if(null!=t.px&&null!=t.py)r=t.px,s=t.py;else{const e=ie(t,n,o);if(!e)return null;r=e.x,s=e.y}if(null==r||null==s)return null;if(!ae(r,s,o))return null;const i=null!==(V=t.dx)&&void 0!==V?V:0,a=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(X=t.width)&&void 0!==X?X:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(U=t.content)&&void 0!==U?U:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:r+i-l/2,y:s+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const r=ie(t,n,o);if(!r)return null;const{x:s,y:i}=r;return e.jsx("text",{x:s+(t.dx||0),y:i+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const r=t.category;if(null==r)return null;const s=null===(K=o.scales)||void 0===K?void 0:K.o,i=null===(Z=o.scales)||void 0===Z?void 0:Z.x,a=null===(J=o.scales)||void 0===J?void 0:J.y,l=(null==s?void 0:s.bandwidth)?s:(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,g=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:l===i)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+n)}default:return null}},n="horizontal"===(null==h?void 0:h.projection),o=(null==h?void 0:h.o)?e=>{var t;return(null!==(t=h.o(e))&&void 0!==t?t:0)+h.o.bandwidth()/2}:null,r={scales:h?{x:n?h.r:o||h.r,y:n&&o||h.r,time:h.r,value:h.r,o:h.o}:null,timeAxis:"x",xAccessor:L,yAccessor:B,width:s,height:l,data:T,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:E.current};return C.map((e,n)=>{if(P){const o=P(e,n,r);return null!=o?o:t(e,n,r)}return t(e,n,r)}).filter(Boolean)},[C,P,s,l,h,L,B,T]);return g||j||w||_||V&&V.length>0||x||I?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof j?j:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof j?j+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[x&&h&&!H&&!R&&e.jsx("g",{className:"ordinal-grid",children:z.map((t,n)=>e.jsx("line",{x1:$?t.pixel:0,y1:$?0:t.pixel,x2:$?t.pixel:s,y2:$?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),g&&h&&!H&&e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,$?{children:[!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((t,n)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+n)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:y}),!R&&e.jsx("line",{x1:0,y1:l,x2:s,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!R&&(null==h?void 0:h.r)&&(()=>{const t=h.r(0);return t>1&&s-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),z.map((t,n)=>{const o=W?0===n?"start":n===z.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+n)}),m&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m})]}:{children:[!R&&(()=>{const t=(null==h?void 0:h.r)?h.r(0):l,n=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:n,x2:s,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),N.map((t,n)=>e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+n)),y&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,n)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+n)),m&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:m})]})}),V,_,I]}),j&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof j?j:null}),U({legend:w,totalWidth:c,totalHeight:u,margin:d,legendPosition:M,title:j,legendHoverBehavior:k,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S})]}):null}function he({width:n,height:o,totalWidth:r,totalHeight:s,margin:i,scales:a,onBrush:l}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(l);g.current=l;const p=t.useRef(a);p.current=a;const f=t.useRef(!1),y=t.useRef(null),m="horizontal"===(null==a?void 0:a.projection),v=t.useRef(m);return v.current=m,t.useEffect(()=>{if(!d.current)return;const e=c.select(d.current).select(".brush-g"),t=m?u.brushX():u.brushY();return t.extent([[0,0],[n,o]]),t.on("brush end",e=>{if(f.current)return;const t=p.current;if(!t)return;if(!e.selection)return y.current=null,void g.current(null);const[n,o]=e.selection;let r;r=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const s={r:r};y.current=s,g.current(s)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[n,o,m]),t.useEffect(()=>{if(!a||!h.current||!y.current)return;if(!d.current)return;const e=y.current,t=c.select(d.current).select(".brush-g"),n=a.r(e.r[0]),o=a.r(e.r[1]);m?(f.current=!0,t.call(h.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(h.current.move,[o,n]),f.current=!1)},[a,m]),e.jsx("svg",{ref:d,width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${i.left},${i.top})`,style:{pointerEvents:"all"}})})}function ge(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const pe="undefined"==typeof window||"undefined"==typeof document,fe=g.createContext(null),ye={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function me(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},s=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],i=Object.keys(n).sort((e,t)=>{const n=s.indexOf(e),o=s.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of i)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const ve=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},be={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"},xe={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},je={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)"},we={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ke={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)"},Ae={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Oe={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Se({scene:t,chartType:n,tableId:o,chartTitle:r}){var s;const[i,a]=g.useState(!1),l=g.useContext(fe),c=null!==(s=null==l?void 0:l.visible)&&void 0!==s&&s,u=i||c,d=g.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,p=g.useCallback(()=>{i||c||a(!0)},[i,c]),f=g.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:ye}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:p,style:ye,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,r,s,i,a,l,c,u,d,h,g,p,f,y,m,v,b,x,j,w,k,A,O;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.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=M.topPath,t=Array.isArray(M.datum)?M.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!=M.datum&&"object"==typeof M.datum?M.datum:{},s=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",i=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:s,value:null!=i?i:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(i=null===(s=M.datum)||void 0===s?void 0:s.category)&&void 0!==i?i:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.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=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=M.cx)&&void 0!==g?g:M.x,y:null!==(p=M.cy)&&void 0!==p?p:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(f=M.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(v=M.cy)&&void 0!==v?v:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(j=null===(x=null===(b=M.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==j?j:null===(w=M.datum)||void 0===w?void 0:w.name)&&void 0!==k?k:"",value:null!==(O=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],s=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),s+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:s/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ve(e.min)} to ${ve(e.max)}, mean ${ve(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const j=Array.from(x);return e.jsxs("div",{ref:d,id:o,tabIndex:-1,onBlur:f,style:be,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:je,children:"×"}),e.jsx("div",{role:"note",style:xe,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:we,children:[e.jsxs("caption",{style:Oe,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:ke,children:"type"}),j.map(t=>e.jsx("th",{style:ke,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Ae,children:t.label}),j.map(n=>{return e.jsx("td",{style:Ae,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":ve(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function Me({summary:t}){return t?e.jsx("div",{role:"note",style:ye,children:t}):null}function _e({tableId:t}){return e.jsx("a",{href:"#"+t,style:ye,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ye)},children:"Skip to data table"})}function Ce({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:ye,children:n})}const Pe="var(--semiotic-focus, #005fcc)";function Le({active:t,hoverPoint:n,margin:o,size:r,shape:s="circle",width:i,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===s&&null!=i&&null!=a){const t=Math.max(i,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Pe,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===s?{cx:l,cy:c,r:12,fill:"none",stroke:Pe,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Pe,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Be({x:t,y:n,containerWidth:o,containerHeight:r,margin:s,children:i,className:a="stream-frame-tooltip",zIndex:l=1}){const c=g.useRef(null),[u,d]=g.useState(null);g.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:a,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"},children:i})}function Te(n){const o=t.createContext(null),r=Re(n);return[function({children:r}){const s=t.useMemo(()=>Re(n),[]);return e.jsx(o.Provider,{value:s,children:r})},e=>{var n;const s=null!==(n=t.useContext(o))&&void 0!==n?n:r,i=t.useRef(e);i.current=e;const a=t.useCallback(()=>i.current(s.getState()),[s]),l=t.useCallback(()=>i.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,l)}]}function Re(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Ie(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 He(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:$e})})),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 $e=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],De={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}},Ne={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}},Fe={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:$e,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"},[We,ze]=Te(e=>({theme:De,setTheme(t){e(e=>{if("light"===t)return{theme:De};if("dark"===t)return{theme:Ne};if("high-contrast"===t)return{theme:Fe};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ne:De;return{theme:He(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:He(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 Ee=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,qe=new WeakMap;let Ge=0,Ve=!1,Ye=null,Xe=null,Qe=null;function Ue(e,t){var n,o;if(!t)return t;const r=Ee.exec(t);if(!r)return t;const s=e.canvas;if(!s)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Ve)return;if("undefined"==typeof window||"undefined"==typeof document)return;Ve=!0;const e=()=>{Ge++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ye=new MutationObserver(e),Ye.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Xe=window.matchMedia("(prefers-color-scheme: dark)"),Qe=e,"function"==typeof Xe.addEventListener?Xe.addEventListener("change",Qe):"function"==typeof Xe.addListener&&Xe.addListener(Qe)}catch(e){}}();let i=qe.get(s);i&&i.version===Ge||(i={version:Ge,map:new Map},qe.set(s,i));const a=i.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(s).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return i.map.set(t,l),l}function Ke(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ze(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(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=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[r,s]=function(e,n,o){const r=t.useRef(null),[s,i]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&s?s.w:e[0],o&&s?s.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=s[0]-i.left-i.right,l=s[1]-i.top-i.bottom,c=Ke(e.foregroundGraphics,s,i),u=Ke(e.backgroundGraphics,s,i),d=ze(e=>e.theme),{transition:h,introEnabled:p}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="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:!(r||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),f="semiotic-table-"+g.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),w=t.useRef(0),k=t.useCallback(()=>{w.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(k))},[k]),O=t.useCallback(()=>{j.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const S=e.themeDirtyRef;return t.useEffect(()=>{S&&(Ge++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:r,size:s,margin:i,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function Je(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function et(e,t,n=.3){Je(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 tt(e,t,n=.6){var o,r,s,i,a;if(!Je(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(s=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==s?s:0,d=null!==(a=null!==(i=t.cy)&&void 0!==i?i: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 nt(e,t,n,o=.35){Je(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function ot(e,t,n){const o=t.fillGradient;if(!o)return null;const r=t.roundedEdge;let s=t.x,i=t.y,a=t.x,l=t.y+t.h;if("bottom"===r?(i=t.y+t.h,l=t.y):"right"===r?(s=t.x+t.w,i=t.y,a=t.x,l=t.y):"left"===r&&(s=t.x,i=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(s,i,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(s,i,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 r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const s=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return s?[+s[1],+s[2],+s[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 rt=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)st(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||Ue(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?ot(e,t,n):null;e.fillStyle=o||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:i,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(s,i),e.lineTo(s+a-r,i),e.arcTo(s+a,i,s+a,i+r,r),e.lineTo(s+a,i+l-r),e.arcTo(s+a,i+l,s+a-r,i+l,r),e.lineTo(s,i+l);break;case"left":e.moveTo(s+a,i),e.lineTo(s+r,i),e.arcTo(s,i,s,i+r,r),e.lineTo(s,i+l-r),e.arcTo(s,i+l,s+r,i+l,r),e.lineTo(s+a,i+l);break;case"bottom":e.moveTo(s,i),e.lineTo(s+a,i),e.lineTo(s+a,i+l-r),e.arcTo(s+a,i+l,s+a-r,i+l,r),e.lineTo(s+r,i+l),e.arcTo(s,i+l,s,i+l-r,r);break;default:e.moveTo(s,i+l),e.lineTo(s,i+r),e.arcTo(s,i,s+r,i,r),e.lineTo(s+a-r,i),e.arcTo(s+a,i,s+a,i+r,r),e.lineTo(s+a,i+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||Ue(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?ot(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=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}et(e,t),e.globalAlpha=1}};function st(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const s=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),s){const s=r+o,i=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=s)e.drawImage(n,i,o,r,r)}else{const s=r+o,i=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=s)e.drawImage(n,o,i,r,r)}e.restore()}const it=(e,t,n,o)=>{var r;const s=t.filter(e=>"point"===e.type);if(0!==s.length){e.save();try{for(const t of s){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Ue(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),tt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function at(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 lt(e,t){const n=a.arc().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 ct=(e,t,n,o)=>{var r,s;const i=t.filter(e=>"wedge"===e.type);for(const t of i){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:1,o=null!==(s=t.style.opacity)&&void 0!==s?s:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),lt(e,t)):(at(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(at(e,t),nt(e,t)),e.globalAlpha=1}};const ut=(e,t,n,o)=>{var r,s;const i=t.filter(e=>"violin"===e.type);for(const t of i){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.6,e.fillStyle=("string"==typeof t.style.fill?Ue(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ue(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()}},dt=(e,t,n,o)=>{var r,s,i;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!==(s=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==s?s:.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=Ue(e,n.style.stroke)||("string"==typeof n.style.fill?Ue(e,n.style.fill):n.style.fill)||Ue(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(i=n.style.opacity)&&void 0!==i?i:.5,e.stroke(),e.globalAlpha=1}};function ht(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 gt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let pt=null;function ft(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:s=6,angle:i=45}=e,a=Math.max(8,Math.ceil(2*s));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(pt||(pt=document.createElement("canvas")),pt.width=e,pt.height=e,pt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=i*Math.PI/180;if(45===i||-45===i){const e=i>0?1:-1;for(let t=-a;2*a>=t;t+=s)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+=s)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const yt=new Map;function mt(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=yt.get(n);if(void 0!==o)return o;const r=ft({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return yt.set(n,r),r}function vt(e,t,n,o,r,s){e.moveTo(t+s,n),e.lineTo(t+o-s,n),e.quadraticCurveTo(t+o,n,t+o,n+s),e.lineTo(t+o,n+r-s),e.quadraticCurveTo(t+o,n+r,t+o-s,n+r),e.lineTo(t+s,n+r),e.quadraticCurveTo(t,n+r,t,n+r-s),e.lineTo(t,n+s),e.quadraticCurveTo(t,n,t+s,n),e.closePath()}function bt(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 xt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const jt=e=>[dt,...e],wt={bar:jt([rt]),clusterbar:jt([rt]),point:jt([it]),swarm:jt([it]),pie:[ct],donut:[ct],boxplot:jt([(e,t,n,o)=>{var r,s;const i=t.filter(e=>"boxplot"===e.type);for(const t of i){const n=t.columnWidth/2,o="vertical"===t.projection,i=Ue(e,"var(--semiotic-primary, #007bff)"),a=Ue(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?Ue(e,l)||l:null!=l?l:i,u=t.style.stroke,d="string"==typeof u?Ue(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.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),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},it]),violin:jt([ut]),histogram:jt([rt]),ridgeline:jt([ut]),timeline:jt([rt]),funnel:[rt,(e,t,n,o)=>{var r,s,i,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!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s: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===(i=t.style)||void 0===i?void 0:i.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,s,i,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!==(s=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==s?s:0))continue;const i=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,i,a),e.fillStyle="#fff",e.fillText(o,i,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!==(i=n.__funnelBarW)&&void 0!==i?i:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const s=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?ht(r):null!=s?`${ht(r)} (${gt(s)})`:ht(r),e.measureText(c).width+16>o){if(l||null==s)continue;if(c=ht(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[rt,(e,t,n,o)=>{var r,s;const i=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 i){const n=("string"==typeof t.style.fill?t.style.fill:null)||Ue(e,"var(--semiotic-border, #999)"),o=mt(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(s=t.style.opacity)&&void 0!==s?s:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===r.length)return;const s=Ue(e,"var(--semiotic-text, #333)"),i=Ue(e,"var(--semiotic-text-secondary, #666)");for(const t of r){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,a=!(!0===n.__barFunnelIsFirstStep)&&null!=r,l=a?xt(r):"",c=bt(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,f=p-h/2,y=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(),vt(e,f,y,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),vt(e,f,y,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=s,e.fillText(l,p,y+3),e.font="11px sans-serif",e.fillStyle=i,e.fillText(c,p,y+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=s,e.fillText(c,p,y+3))}e.lineWidth=1}],swimlane:jt([rt])},kt={top:50,right:40,bottom:60,left:70},At={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 Ot({hover:t}){var n,o,r,s,i,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:At,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const p=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",f=null!==(a=null!==(i=null!==(s=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==s?s:l.__rValue)&&void 0!==i?i:l.pct)&&void 0!==a?a:"";if(!p&&""===f){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:At,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:At,children:[p&&e.jsx("div",{style:{fontWeight:"bold"},children:p+""}),""!==f&&e.jsx("div",{children:"number"==typeof f?f.toLocaleString():f+""})]})}const St=t.forwardRef(function(n,o){var r,s,i,l,c,u,d,h,p,y;const{chartType:m,runtimeMode:v,data:b,oAccessor:x="category",rAccessor:j="value",colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:S,valueAccessor:M,categoryAccessor:_,projection:C="vertical",size:P=[600,400],responsiveWidth:L,responsiveHeight:R,margin:z,barPadding:E,roundedTop:q,gradientFill:G,baselinePadding:V,innerRadius:Y,cornerRadius:X,normalize:Q,startAngle:U,sweepAngle:K,dynamicColumnWidth:Z,bins:J,showOutliers:ee,showIQR:te,amplitude:ne,connectorOpacity:oe,showLabels:re,connectorAccessor:se,connectorStyle:ie,dataIdAccessor:ae,rExtent:le,oExtent:ue,extentPadding:fe=.05,oSort:ye,windowMode:ve="sliding",windowSize:be=200,pieceStyle:xe,summaryStyle:je,colorScheme:we,barColors:ke,showAxes:Ae=!0,showCategoryTicks:Oe,categoryLabel:Pe,valueLabel:Te,categoryFormat:Re,valueFormat:He,oLabel:$e,rLabel:De,oFormat:Ne,rFormat:Fe,rTickValues:We,tickLabelEdgeAlign:ze,enableHover:Ee=!0,hoverAnnotation:qe,tooltipContent:Ge,customHoverBehavior:Ve,annotations:Ye,svgAnnotationRules:Xe,showGrid:Qe=!1,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,backgroundGraphics:ot,foregroundGraphics:rt,title:st,className:it,background:at,centerContent:lt,decay:ct,pulse:ut,transition:dt,animate:ht,staleness:gt,brush:pt,onBrush:ft,accessibleTable:yt=!0,description:mt,summary:vt}=n,bt=t.useRef(!0),xt=Ze({sizeProp:P,responsiveWidth:L,responsiveHeight:R,userMargin:z,marginDefault:kt,foregroundGraphics:rt,backgroundGraphics:ot,animate:ht,transitionProp:dt,themeDirtyRef:bt}),{reducedMotionRef:jt,responsiveRef:At,size:St,margin:Mt,adjustedWidth:_t,adjustedHeight:Ct,resolvedForeground:Pt,resolvedBackground:Lt,currentTheme:Bt,transition:Tt,introEnabled:Rt,tableId:It,rafRef:Ht,renderFnRef:$t,scheduleRender:Dt}=xt,Nt=null!=Pe?Pe:$e,Ft=null!=Te?Te:De,Wt=null!=Re?Re:Ne,zt=null!=He?He:Fe,Et=t.useRef(null),qt=t.useRef(null),[Gt,Vt]=t.useState(null),[Yt,Xt]=t.useState(null),[Qt,Ut]=t.useState(0),[Kt,Zt]=t.useState(!1),Jt=Ee||qe,en="streaming"===v,tn=t.useMemo(()=>{var e,t,n;return{chartType:m,runtimeMode:en?"streaming":"bounded",windowSize:be,windowMode:ve,extentPadding:fe,projection:C,oAccessor:en?void 0:x,rAccessor:en?void 0:j,colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:en?S:void 0,valueAccessor:en?M||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:en?_||x:void 0,rExtent:le,oExtent:ue,barPadding:E,roundedTop:q,gradientFill:G,baselinePadding:V,innerRadius:Y,cornerRadius:X,normalize:Q,startAngle:U,sweepAngle:K,dynamicColumnWidth:Z,bins:J,showOutliers:ee,showIQR:te,amplitude:ne,connectorOpacity:oe,showLabels:re,connectorAccessor:se,connectorStyle:ie,dataIdAccessor:ae,oSort:ye,pieceStyle:xe,summaryStyle:je,colorScheme:we,themeCategorical:null===(e=null==Bt?void 0:Bt.colors)||void 0===e?void 0:e.categorical,themeSemantic:Ie(Bt),themeSequential:null===(t=null==Bt?void 0:Bt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Bt?void 0:Bt.colors)||void 0===n?void 0:n.diverging,barColors:ke,decay:ct,pulse:ut,transition:Tt,introAnimation:Rt,staleness:gt}},[m,be,ve,fe,C,x,j,w,k,A,O,S,M,_,le,ue,E,q,G,V,Y,X,Q,U,K,Z,J,ee,te,ne,oe,re,se,ie,ae,ye,xe,je,we,ke,ct,ut,null==Tt?void 0:Tt.duration,null==Tt?void 0:Tt.easing,Rt,gt,en,Bt]),nn=t.useRef(null);nn.current||(nn.current=new B(tn)),t.useEffect(()=>{var e;null===(e=nn.current)||void 0===e||e.updateConfig(tn),bt.current=!0,Dt()},[tn,Dt]);const on=t.useRef(null);on.current||(on.current=new f(e=>{const t=nn.current;t&&t.ingest(e)&&(bt.current=!0,Dt())}));const rn=t.useCallback(e=>{var t;null===(t=on.current)||void 0===t||t.push(e)},[]),sn=t.useCallback(e=>{var t;null===(t=on.current)||void 0===t||t.pushMany(e)},[]),an=t.useCallback(()=>{var e,t;null===(e=on.current)||void 0===e||e.clear(),null===(t=nn.current)||void 0===t||t.clear(),bt.current=!0,Dt()},[Dt]),ln=t.useCallback(e=>{var t,n;null===(t=on.current)||void 0===t||t.clearLastData(),null===(n=on.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:rn,pushMany:sn,replace:ln,remove:e=>{var t,n,o,r;null===(t=on.current)||void 0===t||t.flush();const s=null!==(o=null===(n=nn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(s.length>0){const e=null===(r=qt.current)||void 0===r?void 0:r.data;!!qt.current&&s.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(qt.current=null,Vt(null)),bt.current=!0,Dt()}return s},update:(e,t)=>{var n,o,r;null===(n=on.current)||void 0===n||n.flush();const s=null!==(r=null===(o=nn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return s.length>0&&(bt.current=!0,Dt()),s},clear:an,getData:()=>{var e,t,n;return null===(e=on.current)||void 0===e||e.flush(),null!==(n=null===(t=nn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[rn,sn,ln,an,Dt]),t.useEffect(()=>{var e;b&&(null===(e=on.current)||void 0===e||e.setBoundedData(b))},[b]);const{hoverHandlerRef:cn,hoverLeaveRef:un,onPointerMove:dn,onPointerLeave:hn}=xt;cn.current=e=>{if(!Jt)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,r=e.clientY-n.top-Mt.top;if(0>o||o>_t||0>r||r>Ct)return void(qt.current&&(qt.current=null,Vt(null),Ve&&Ve(null),Dt()));const s=nn.current;if(!s||0===s.scene.length)return;const i="radial"===C,a=function(e,t,n,o=30,r,s=0){let i=null;if(r){const e=function(e,t,n,o,r){const s=Math.max(o,r+5,12),i=t-s,a=t+s,l=n-s,c=n+s;let u=null,d=1/0;return e.visit((e,r,s,h,g)=>{if(r>a||i>h||s>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,s=e.x-t,i=e.y-n,a=Math.sqrt(s*s+i*i);T(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,s);e&&(i={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const s of e){let e=null;switch(s.type){case"rect":e=I(s,t,n);break;case"point":if(r)break;e=H(s,t,n,o);break;case"wedge":e=$(s,t,n);break;case"boxplot":e=D(s,t,n);break;case"violin":e=N(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(s.scene,i?o-_t/2:o,i?r-Ct/2:r,30,s.pointQuadtree,s.maxPointRadius);if(!a)return void(qt.current&&(qt.current=null,Vt(null),Ve&&Ve(null),Dt()));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 x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m}),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;qt.current=l,Vt(l),Ve&&(Ve(l),bt.current=!0),Dt()},un.current=()=>{qt.current&&(qt.current=null,Vt(null),Ve&&(Ve(null),bt.current=!0),Dt())};const gn=t.useRef(-1),pn=t.useRef(null),fn=t.useRef(null),yn=t.useCallback(e=>{const t=nn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(fn.current&&fn.current.version===n)o=fn.current.graph;else{const e=function(e){var t,n,o;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:"_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 r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),s=Array.from(o.values()).flat();s.sort((e,t)=>e.x-t.x||e.y-t.y);const i=new Map;for(let e=0;s.length>e;e++){s[e]._flatIndex=e;const t=null===(n=s[e].datum)||void 0===n?void 0:n.id;null!=t&&i.set(t+"",e)}return{flat:s,groups:r,byGroup:o,idToIdx:i}}(e),fn.current={version:n,graph:o}}const r=gn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),gn.current=0;const t=o.flat[0];pn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},W(t)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});return qt.current=n,Vt(n),Ve&&Ve(n),void Dt()}const s=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),s=e.flat[r];return{flatIndex:r,group:null!==(n=s.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=s._groupIndex)&&void 0!==o?o:0}}(o,r),i=function(e,t,n){const{group:o,indexInGroup:r}=t,s=n.byGroup.get(o);switch(e){case"ArrowRight":return s.length-1>r?s[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?s[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?F(n,n.groups[e+1],s[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?F(n,n.groups[e-1],s[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,s,o);if(null===i)return;if(e.preventDefault(),0>i)return gn.current=-1,pn.current=null,qt.current=null,Vt(null),Ve&&Ve(null),void Dt();gn.current=i;const a=o.flat[i];pn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},W(a)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});qt.current=l,Vt(l),Ve&&Ve(l),Dt()},[Ve,Dt]),mn=t.useCallback(e=>{gn.current=-1,pn.current=null,dn(e)},[dn]);$t.current=()=>{var e,t;Ht.current=0;const n=Et.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=nn.current;if(!r)return;const s="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(jt.current?s+1e6:s),a=!jt.current&&i,l=bt.current;l&&!i&&(r.computeScene({width:_t,height:Ct}),bt.current=!1),(l||a)&&n.setAttribute("aria-label",me(r.scene,m+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=St[0]*c,d=St[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=St[0]+"px",n.style.height=St[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,St[0],St[1]);const h=null!==(e=null==gt?void 0:gt.threshold)&&void 0!==e?e:5e3,g=gt&&r.lastIngestTime>0&&s-r.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==gt?void 0:gt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==at&&!ot){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=at||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,St[0],St[1]))}const p="radial"===C;o.save(),o.beginPath(),o.rect(Mt.left,Mt.top,_t,Ct),o.clip(),p?(o.save(),o.translate(Mt.left+_t/2,Mt.top+Ct/2)):o.translate(Mt.left,Mt.top);const f=wt[m]||[],y={width:_t,height:Ct};for(const e of f)e(o,r.scene,r.scales,y);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(Xt(r.scales),Ut(e=>e+1)),(null==gt?void 0:gt.showBadge)&&Zt(!!g),(a||null!=r.activeTransition||r.hasActivePulses)&&(Ht.current=requestAnimationFrame(()=>$t.current()))},t.useEffect(()=>(Dt(),()=>{var e;null===(e=on.current)||void 0===e||e.clear()}),[Dt]),t.useEffect(()=>{bt.current=!0,Dt()},[m,_t,Ct,Ae,at,Dt]),function(e,n,o,r,s,i){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==s&&(i(u),o.current=!0,r())},1e3);return()=>clearInterval(t)},[e,s,r])}(gt,nn,bt,Dt,Kt,Zt);const vn=Jt&&Gt?Ge?Ge(Gt):e.jsx(Ot,{hover:Gt}):null,bn="radial"===C,xn=vn?e.jsx(Be,{x:Gt?bn?Gt.x+_t/2:Gt.x:0,y:Gt?bn?Gt.y+Ct/2:Gt.y:0,containerWidth:_t,containerHeight:Ct,margin:Mt,className:"stream-ordinal-tooltip",children:vn}):null;if(pe){const t=nn.current;t&&b&&(t.ingest({inserts:b,bounded:!0}),t.computeScene({width:_t,height:Ct}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[],o=null!==(s=null==t?void 0:t.scales)&&void 0!==s?s:null,i="radial"===C,l=i?Mt.left+_t/2:Mt.left,c=i?Mt.top+Ct/2:Mt.top;return e.jsxs("div",{className:"stream-ordinal-frame"+(it?" "+it:""),role:"img","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:St[0],height:St[1]},children:[e.jsx(Me,{summary:vt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:St[0],height:St[1],style:{position:"absolute",left:0,top:0},children:[Lt&&e.jsx("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Lt}),e.jsxs("g",{transform:`translate(${l},${c})`,children:[at&&e.jsx("rect",{x:0,y:0,width:_t,height:Ct,fill:at}),n.map((t,n)=>function(t,n){var o,r,s,i,l;const c=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",u=e=>`ord-${t.type}-${c}-${n}-${e}`,d=`ord-${t.type}-${c}-${n}`;switch(t.type){case"rect":{const n=t,o=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(d)+"-grad",r=function(t,n){const o=t.fillGradient;if(!o)return null;let r=t.x,s=t.y,i=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(s=t.y+t.h,a=t.y):"right"===t.roundedEdge?(r=t.x+t.w,s=t.y,i=t.x,a=t.y):"left"===t.roundedEdge&&(r=t.x,s=t.y,i=t.x+t.w,a=t.y);const l=[];if("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;for(let n=0;t.length>n;n++)l.push(e.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=ge(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:r,y1:s,x2:i,y2:a,children:l})}(n,o),s=r?`url(#${o})`:ge(n.style.fill);if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:i,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${i} L${o+a-t},${i} A${t},${t} 0 0 1 ${o+a},${i+t} L${o+a},${i+l-t} A${t},${t} 0 0 1 ${o+a-t},${i+l} L${o},${i+l} Z`;break;case"left":c=`M${o+a},${i} L${o+t},${i} A${t},${t} 0 0 0 ${o},${i+t} L${o},${i+l-t} A${t},${t} 0 0 0 ${o+t},${i+l} L${o+a},${i+l} Z`;break;case"bottom":c=`M${o},${i} L${o+a},${i} L${o+a},${i+l-t} A${t},${t} 0 0 1 ${o+a-t},${i+l} L${o+t},${i+l} A${t},${t} 0 0 1 ${o},${i+l-t} Z`;break;default:c=`M${o},${i+l} L${o},${i+t} A${t},${t} 0 0 1 ${o+t},${i} L${o+a-t},${i} A${t},${t} 0 0 1 ${o+a},${i+t} L${o+a},${i+l} Z`}return e.jsxs(g.Fragment,{children:[r&&e.jsx("defs",{children:r}),e.jsx("path",{d:c,fill:s,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},d)}return e.jsxs(g.Fragment,{children:[r&&e.jsx("defs",{children:r}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:s,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},d)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:ge(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},d)}case"wedge":{const n=t,o=a.arc().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.jsx("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:ge(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},d)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:ge(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:ge(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},d)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:ge(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},u("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,s=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},u("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:s,x2:n.iqrLine.q3Pos,y2:s,stroke:n.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:s,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},u("med")))}return e.jsx("g",{children:o},d)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(l=t.style.opacity)&&void 0!==l?l:.5},d);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:ge(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},d)}default:return null}}(t,n)).filter(Boolean)]})]}),e.jsx(de,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:o,showAxes:Ae,showCategoryTicks:Oe,oLabel:Nt,rLabel:Ft,oFormat:Wt,rFormat:zt,rTickValues:We,tickLabelEdgeAlign:ze,showGrid:Qe,title:st,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,foregroundGraphics:Pt,annotations:Ye,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:"string"==typeof x?x:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==t?void 0:t.getData()}),lt&&"radial"===C&&e.jsx("div",{style:{position:"absolute",left:Mt.left+_t/2,top:Mt.top+Ct/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:lt})]})}return e.jsxs("div",{ref:At,className:"stream-ordinal-frame"+(it?" "+it:""),role:"group","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:L?"100%":St[0],height:R?"100%":St[1],overflow:"visible"},onKeyDown:yn,children:[yt&&e.jsx(_e,{tableId:It}),yt&&e.jsx(Se,{scene:null!==(l=null===(i=nn.current)||void 0===i?void 0:i.scene)&&void 0!==l?l:[],chartType:m+" chart",tableId:It,chartTitle:"string"==typeof st?st:void 0}),e.jsx(Me,{summary:vt}),e.jsxs("div",{role:"img","aria-label":mt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?mn:void 0,onMouseLeave:Jt?hn:void 0,children:[Lt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:St[0],height:St[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Lt})}),e.jsx(ce,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,showAxes:Ae,showGrid:Qe,rFormat:zt,rTickValues:We}),e.jsx("canvas",{ref:Et,"aria-label":me(null!==(u=null===(c=nn.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],m+" chart"),style:{position:"absolute",top:0,left:0,width:St[0],height:St[1]}}),e.jsx(Ce,{hoverPoint:Gt}),e.jsx(de,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,showAxes:Ae,showCategoryTicks:Oe,oLabel:Nt,rLabel:Ft,oFormat:Wt,rFormat:zt,showGrid:Qe,title:st,legend:Ue,legendHoverBehavior:Ke,legendClickBehavior:Je,legendHighlightedCategory:et,legendIsolatedCategories:tt,legendPosition:nt,foregroundGraphics:Pt,annotations:Ye,svgAnnotationRules:Xe,annotationFrame:Qt,xAccessor:"string"==typeof x?x:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(d=nn.current)||void 0===d?void 0:d.getData(),underlayRendered:!0}),(pt||ft)&&"radial"!==C&&e.jsx(he,{width:_t,height:Ct,totalWidth:St[0],totalHeight:St[1],margin:Mt,scales:Yt,onBrush:ft||(()=>{})}),lt&&"radial"===C&&e.jsx("div",{style:{position:"absolute",left:Mt.left+_t/2,top:Mt.top+Ct/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:lt}),(null==gt?void 0:gt.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===gt.badgePosition?{top:4,left:4}:"bottom-left"===gt.badgePosition?{bottom:4,left:4}:"bottom-right"===gt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Kt?"#dc3545":"#28a745",color:"white"}),children:Kt?"STALE":"LIVE"}),e.jsx(Le,{active:gn.current>=0,hoverPoint:Gt,margin:Mt,size:St,shape:null===(h=pn.current)||void 0===h?void 0:h.shape,width:null===(p=pn.current)||void 0===p?void 0:p.w,height:null===(y=pn.current)||void 0===y?void 0:y.h}),xn]})]})});St.displayName="StreamOrdinalFrame";const Mt=t.createContext(null);function _t(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Ct(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Pt,Lt]=Te(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Ct(o,t),s=new Map(r.clauses);return s.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:s})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),s=new Map(o.clauses);return s.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:s})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Ct(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Bt,Tt]=Te(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 Rt={positions:new Map};const It=new Set;function Ht(){for(const e of It)e()}function $t(e,t){const n=Rt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Rt.positions);o.delete(e),Rt={positions:o},Ht()}function Dt(e){const n=t.useId(),o=e.clientId||n,{name:r}=e,s=Lt(e=>e.selections.get(r)),i=Lt(e=>e.setClause),a=Lt(e=>e.clearClause),l=t.useMemo(()=>!!s&&s.clauses.size>0,[s]);return{predicate:t.useMemo(()=>s&&0!==s.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(_t(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(s,o):()=>!0,[s,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};i(r,{clientId:o,type:"point",fields:t})},[o,r,i]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};i(r,{clientId:o,type:"interval",fields:t})},[o,r,i]),clear:t.useCallback(()=>{a(r,o)},[a,r,o]),clientId:o}}function Nt(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const Ft=t.createContext(!1);function Wt({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:s,categories:i}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==s&&(n.strokeWidth=s),n},type:"fill",items:(i&&i.length>0?i:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,s)=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):A[s%A.length];return{label:r+"",color:a}}),label:""}]}}function zt(e,t,n){return t?o=>{var r;const s=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function Et(){return ze(e=>e.theme)}function qt(){var e;const t=Et(),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 Gt(e,t,n,o,r){if(e)return e;let s;if(Array.isArray(n))s=n;else if(t&&t.length>0)s=t;else if("string"==typeof n){const e=w[n];Array.isArray(e)&&(s=e)}return s&&0!==s.length?null!=o?(r.has(o)||r.set(o,r.size),s[r.get(o)%s.length]):s[0]:"#007bff"}function Vt(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],r="function"==typeof(s=o)?s:e=>e[s];var s;return t.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,n,o])}g.createContext(void 0);const Yt={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 Xt(e,t,n){var o,r,s,i,a,l,c;const u=Yt[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!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(s=t.showAxes)&&void 0!==s?s:u.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i: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:Qt(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Qt(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 Ut(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 Kt={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 Zt(e,t){return"function"==typeof t?t(e):e[t]}function Jt(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 en(t={}){const{fields:n,title:o,format:r,style:s={},className:i=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Zt(t,o);a=Jt(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,s;"string"==typeof e?(n=e,o=e,s=r):(n=e.label,o=e.accessor||e.key||"",s=e.format||r);const i=Zt(t,o);l.push({label:n,value:Jt(i,s)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Jt(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Jt(t[e[0]],r))}}const c=Object.assign(Object.assign({},Kt),s);return e.jsxs("div",{className:("semiotic-tooltip "+i).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function tn(t){if(!0===t)return en();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.jsx("div",{className:"semiotic-tooltip",style:Kt,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?en(t):en())}function nn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function on(e,t){if(!t)return nn(e);try{const n=t(e);return null==n?nn(e):n}catch(t){return nn(e)}}function rn(e,t){return"function"==typeof t?t(e):e[t]}function sn({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:s=!1,valueFormat:i}){return a=>{var l;const c=s?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=rn(c,t),d=rn(c,n),h=o?rn(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[e.jsx("div",{style:{fontWeight:"bold"},children:nn(u)}),e.jsx("div",{style:{marginTop:4},children:on(d,i)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[r||(g=o,"string"==typeof g?g:"value"),": ",nn(h)]})]});var g}}function an({componentName:t,message:n,diagnosticHint:o,width:r,height:s}){return e.jsx("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.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("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:o})]})})}class ln extends g.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(an,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function cn(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let s=1;n>=s;s++){let n=r[0];r[0]=s;for(let i=1;o>=i;i++){const o=r[i];r[i]=e[s-1]===t[i-1]?n:1+Math.min(n,r[i],r[i-1]),n=o}}return r[o]}function un(e,t,n=3){let o,r=n+1;for(const n of t){const t=cn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function dn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function hn(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=un(e,t,3))&&void 0!==n?n:null)}function gn({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=dn(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,s]of Object.entries(n))if(s&&"string"==typeof s&&!(s in o)){const n=hn(s,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${s}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const pn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},fn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},yn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},mn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],vn=["vertical","horizontal"],bn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:mn},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({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:mn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:mn},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({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{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({},pn),fn),{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({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{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:vn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),yn),{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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},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({},pn),yn),{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({},pn),yn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:vn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},pn),{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({},pn),{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({},pn),{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({},pn),yn),{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({},pn),yn),{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({},pn),{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({},pn),{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:vn},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({},pn),{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({},pn),{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({},pn),{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({},pn),{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({},pn),{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({},pn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},pn),{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({},pn),{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({},pn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function xn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const jn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),wn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),kn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),An=new Set(["LineChart","AreaChart","StackedAreaChart"]),On=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Sn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],s=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*s(n)+.7152*s(o)+.0722*s(r)}function Mn(e,t){const n=Sn(e),o=Sn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const _n=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Cn(e,t){const n=[],o=function(e,t){const n=[],o=bn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(bn).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!xn(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),s=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!s.has(o)){const t=un(o,r),s=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(s)}if("array"===o.dataShape){const r=t.data,s={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(s[e]=n)}const i=gn({componentName:e,data:r,accessors:Object.keys(s).length>0?s:void 0});i&&n.push(i)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:s}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(s&&t&&t.length>0){const n=dn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(s))if(r&&"string"==typeof r&&!(r in n)){const n=hn(r,t),s=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${s}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return bn[e]?(function(e,t,n){const o=bn[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=bn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=r[0];if(!s||"object"!=typeof s)return;const i=Object.keys(s);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in s||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${i.join(", ")}.`,fix:`Change ${e} to one of: ${i.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){jn.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){wn.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=bn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=r[0];if(!s||"object"!=typeof s)return;const i=t.xAccessor;"string"==typeof i&&s[i]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${i}" 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(!kn.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!An.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const s=null!==(o=t.width)&&void 0!==o?o:600,i=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);s>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${s}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),i>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${i}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=bn[e];if(!r||"array"!==r.dataShape)return;const s=t.data;if(!s||!Array.isArray(s)||0===s.length)return;const i=[];t.xAccessor&&"string"==typeof t.xAccessor&&i.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&i.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&i.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(s.length,5);for(const e of i){let t=!0;for(let n=0;a>n;n++){const r=null===(o=s[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!On.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const s=r.right;"number"==typeof s&&100>s&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${s}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const s=r[o];"string"==typeof s&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${s}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const s=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Mn(e,r);null!==t&&3>t&&s.push(`${e} (${t.toFixed(1)}:1)`)}s.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${s.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${s.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const s=[];for(let e=0;r.length-1>e;e++){const t=Mn(r[e],r[e+1]);null!==t&&1.5>t&&s.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}s.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${s.length} adjacent color pair(s) in colorScheme have very similar luminance: ${s.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,s="string"==typeof t.summary&&t.summary.trim().length>0;o||r||s||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 _n)"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 Pn;const Ln="undefined"!=typeof process&&"production"!==(null===(Pn=process.env)||void 0===Pn?void 0:Pn.NODE_ENV);function Bn({componentName:t,width:n,height:o,chartProps:r,children:s}){return e.jsx(ln,{fallback:s=>{let i="";if(Ln&&r)try{const e=Cn(t,r);e.ok||(i=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.jsx(an,{componentName:t,message:s.message,diagnosticHint:i,width:n,height:o})},children:s})}const Tn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Rn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function In(e,t,n,o){if(!Ln)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const s=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${s}`)}function Hn(n){const{data:o,rawData:r,colorBy:s,colorScheme:i,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:p,chartId:f,showLegend:y,userMargin:m,marginDefaults:v,onClick:b,hoverHighlight:x,loading:j,emptyContent:w,width:k,height:A}=n,O="string"==typeof n.colorBy?n.colorBy:void 0,{activeSelectionHook:_,hoverSelectionHook:C,customHoverBehavior:P,customClickBehavior:L,crosshairSourceId:B}=function({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:s,chartType:i,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),g=Dt({name:(null==e?void 0:e.name)||"__unused__"}),p=function(e){const n=e.name||"hover",{fields:o}=e,{predicate:r,isActive:s,selectPoints:i,clear:a}=Dt({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&i(t)},[o,i,a,n]),predicate:r,isActive:s}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),f=Tt(e=>e.pushObservation),y=e?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),j=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Rt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Rt={positions:new Map(Rt.positions).set(e,{xValue:t,sourceId:n})},Ht())}(h.name||"hover",Number(e),d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&$t(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(s||f){const n={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(i),f&&f(i)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});s&&s(e),f&&f(e)}}},[n,p,h,d,s,i,a,f,c,b]),w=t.useCallback(e=>{var t,n,o,r;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[h.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Rt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Rt.positions);return t.delete(e),Rt={positions:t},Ht(),!1}Rt={positions:new Map(Rt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ht()}(h.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||f){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});s&&s(i),f&&f(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),f&&f(e)}}},[l,s,f,i,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const n=Rt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Rt.positions);o.delete(e),Rt={positions:o},Ht()}(e,d),$t(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:j,customClickBehavior:w,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:p,chartId:f,onClick:b,hoverHighlight:x,colorByField:O}),T=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}}(u,B),R=function(e,n,o){const r=t.useContext(Mt),s=qt();return t.useMemo(()=>{var t;if(!n)return;const i=null!==(t=null!=o?o:s&&s.length>0?s:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const e=M(t.map(e=>({_cat:e})),"_cat",i);return t=>r[t]||e(t)}return M(t.map(e=>({_cat:e})),"_cat",i)}if(r&&Object.keys(r).length>0){const t=M(e,n,i);return e=>r[e]||t(e)}return M(e,n,i)}if(r&&Object.keys(r).length>0){const e=M([{_:"a"}],"_",i);return t=>r[t]||e(t)}},[e,n,o,r,s])}(o,s,i),I=t.useMemo(()=>{if(!s)return[];const e=new Set;for(const t of o){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[o,s]),H=function(e,n,o){const[r,s]=t.useState(null),[i,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&s(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return i.has(o)}}:null},[e,n,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,s,I),$=t.useMemo(()=>C||(H.legendSelectionHook?H.legendSelectionHook:_),[C,H.legendSelectionHook,_]),D=function(e){const n=ze(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}(c),{legend:N,margin:F,legendPosition:W}=function({data:e,colorBy:n,colorScale:o,showLegend:r,legendPosition:s="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Ft),u=void 0!==r?r:!c&&!!n,d=t.useMemo(()=>{if(!u||!n)return;const t=Wt({data:e,colorBy:n,colorScale:o,getColor:S,categories:l});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[u,n,e,o,l]),h=t.useMemo(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:null!=i?i:{},t=Object.assign(Object.assign({},a),e);return d&&("right"===s&&110>t.right?t.right=110:"left"===s&&110>t.left?t.left=110:"top"===s&&50>t.top?t.top=50:"bottom"===s&&80>t.bottom&&(t.bottom=80)),t},[a,i,d,s]);return{legend:d,margin:h,legendPosition:s}}({data:o,colorBy:s,colorScale:R,showLegend:y,legendPosition:l,userMargin:m,defaults:v}),z=t.useMemo(()=>{const e={};return N&&(e.legend=N,e.legendPosition=W),a&&"none"!==a&&(e.legendHoverBehavior=H.onLegendHover,e.legendClickBehavior=H.onLegendClick,e.legendHighlightedCategory=H.highlightedCategory,e.legendIsolatedCategories=H.isolatedCategories),e},[N,W,a,H.onLegendHover,H.onLegendClick,H.highlightedCategory,H.isolatedCategories]),E=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),i=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+i)-i))/2);return e.jsx("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:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Rn),{position:"absolute",top:a+o*(s+i),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(j,k,A),q=E?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Tn),{width:n,height:o}),children:r||"No data available"}):null}(r,k,A,w);return{colorScale:R,allCategories:I,legendState:H,effectiveSelectionHook:$,activeSelectionHook:_,customHoverBehavior:P,customClickBehavior:L,legend:N,margin:F,legendPosition:W,earlyReturn:E||q||null,legendBehaviorProps:z,crosshairProps:T,resolvedSelection:D}}const $n=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,sort:f=!1,barPadding:y=40,roundedTop:m,gradientFill:v=!1,baselinePadding:b=!1,tooltip:x,annotations:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,showCategoryTicks:D,categoryFormat:N,dataIdAccessor:F}=n,W=r.width,z=r.height,E=r.enableHover,q=r.showGrid,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=Hn({data:K,rawData:i,colorBy:g,colorScheme:p,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"BarChart",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:W,height:z});if(Z.earlyReturn)return Z.earlyReturn;In("BarChart",K,"categoryAccessor",c),In("BarChart",K,"valueAccessor",u);const J=Vt(K,f,u),ee=qt(),te=t.useMemo(()=>new Map,[K]),ne=t.useMemo(()=>(e,t)=>{const n={};return n.fill=g?S(e,g,Z.colorScale):Gt(R,ee,p,void 0,te),n},[g,Z.colorScale,R,ee,p,te]),oe=t.useMemo(()=>{const e=null==w?void 0:w.pieceStyle;return Ut(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},ne(t,n)),e(t,n)||{}):ne,{stroke:I,strokeWidth:H,opacity:$})},[ne,w,I,H,$]),re=t.useMemo(()=>zt(oe,Z.effectiveSelectionHook,Z.resolvedSelection),[oe,Z.effectiveSelectionHook,Z.resolvedSelection]),se=t.useMemo(()=>sn({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ie=gn({componentName:"BarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(an,{componentName:"BarChart",message:ie,width:W,height:z});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:re,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:y}),null!=m&&{roundedTop:m}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),F&&{dataIdAccessor:F}),{baselinePadding:b,enableHover:E,showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:h}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:D,oSort:f}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:tn(x)||se}),(A||O||M||_)&&{customHoverBehavior:Z.customHoverBehavior}),(O||M||A)&&{customClickBehavior:Z.customClickBehavior}),j&&j.length>0&&{annotations:j}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"BarChart",width:W,height:z,children:e.jsx(St,Object.assign({ref:s},ae))})});function Dn({isPushMode:e,colorBy:n,colorScheme:o,showLegend:r,legendPosition:s="right"}){const i=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=t.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=t.useCallback(t=>{if(!e||!n)return;let o=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=u(e);null==t||i.current.has(t)||(i.current.add(t),a.current.push(t),o=!0)}o&&c(e=>e+1)},[e,n,u]),h=t.useCallback(e=>t=>{d([t]),e(t)},[d]),g=t.useCallback(e=>t=>{d(t),e(t)},[d]),p=t.useCallback(()=>{i.current=new Set,a.current=[],c(e=>e+1)},[]),f=t.useMemo(()=>{if(!e||!n||!1===r)return;const t=a.current;if(0===t.length)return;const s=Array.isArray(o)?o:A,i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],s[e%s.length]);const l="string"==typeof n?n:"__streamCat";return Wt({data:t.map(e=>({[l]:e})),colorBy:l,colorScale:e=>i.get(e)||"#999",getColor:S})},[e,n,r,o,l]),y=t.useMemo(()=>{if(f)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[f,s]);return{wrapPush:h,wrapPushMany:g,resetCategories:p,streamingLegend:f,streamingMarginAdjust:y}}function Nn({ref:e,frameRef:n,isPushMode:o,colorBy:r,colorScheme:s,showLegend:i,legendPosition:a,setup:l}){const c=Dn({isPushMode:o,colorBy:r,colorScheme:s,showLegend:i,legendPosition:a}),u=t.useCallback(c.wrapPush(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)}),[c.wrapPush]),d=t.useCallback(c.wrapPushMany(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)}),[c.wrapPushMany]);return t.useImperativeHandle(e,()=>({push:u,pushMany:d,remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,r;return null!==(r=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[]},clear:()=>{var e;c.resetCategories(),null===(e=n.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[u,d,c.resetCategories]),{effectiveLegendProps:t.useMemo(()=>c.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:c.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,c.streamingLegend,a]),effectiveMargin:t.useMemo(()=>{if(c.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(c.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,c.streamingMarginAdjust])}}$n.displayName="BarChart";const Fn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:f,normalize:y=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:j,annotations:w,frameProps:k={},selection:A,linkedHover:O,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:B,legendInteraction:T,legendPosition:R,color:I,stroke:H,strokeWidth:$,opacity:D,categoryFormat:N}=n,F=r.width,W=r.height,z=r.enableHover,E=r.showGrid,q=r.showLegend,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=p||u,J=void 0===i,ee=Hn({data:K,rawData:i,colorBy:Z,colorScheme:f,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:r.marginDefaults,loading:L,emptyContent:B,width:F,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=qt(),ne=t.useMemo(()=>new Map,[K]),oe=t.useMemo(()=>(e,t)=>Z?ee.colorScale?{fill:S(e,Z,ee.colorScale)}:{}:{fill:Gt(I,te,f,t,ne)},[Z,ee.colorScale,I,te,f,ne]),re=t.useMemo(()=>{const e=null==k?void 0:k.pieceStyle;return Ut(e&&"function"==typeof e?(t,n)=>{const o=oe(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:oe,{stroke:H,strokeWidth:$,opacity:D})},[oe,k,H,$,D]),se=t.useMemo(()=>zt(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ie=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=gn({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Nn({ref:o,frameRef:s,isPushMode:J,colorBy:Z,colorScheme:f,showLegend:q,legendPosition:R,setup:ee}),ue=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!=i&&{data:K}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[F,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:g}),N&&{oFormat:N}),{showGrid:E}),le),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===j?()=>null:tn(j)||ie}),(O||M||_||C)&&{customHoverBehavior:ee.customHoverBehavior}),(M||_||O)&&{customClickBehavior:ee.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(an,{componentName:"StackedBarChart",message:ae,width:F,height:W}):e.jsx(Bn,{componentName:"StackedBarChart",width:F,height:W,children:e.jsx(St,Object.assign({ref:s},ue))})});Fn.displayName="StackedBarChart";const Wn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:f,sort:y=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,categoryFormat:D}=n,N=r.width,F=r.height,W=r.enableHover,z=r.showGrid,E=r.showLegend,q=r.title,G=r.description,V=r.summary,Y=r.accessibleTable,X=r.categoryLabel,Q=r.valueLabel,U=i||[],K=p||u,Z=void 0===i,J=Hn({data:U,rawData:i,colorBy:K,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"GroupedBarChart",chartId:C,showLegend:E,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:N,height:F});if(J.earlyReturn)return J.earlyReturn;const ee=qt(),te=t.useMemo(()=>new Map,[U]),ne=w.pieceStyle,oe=t.useMemo(()=>(e,t)=>{const n=K?J.colorScale?{fill:S(e,K,J.colorScale)}:{}:{fill:Gt(R,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,R,ee,f,te,ne]),re=t.useMemo(()=>Ut(oe,{stroke:I,strokeWidth:H,opacity:$}),[oe,I,H,$]),se=t.useMemo(()=>zt(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ie=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=gn({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Nn({ref:o,frameRef:s,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:E,legendPosition:T,setup:J}),ue=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!=i&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[N,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:X,rLabel:Q,rFormat:g}),D&&{oFormat:D}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==Y&&{accessibleTable:Y}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:tn(x)||ie}),(A||O||M||_)&&{customHoverBehavior:J.customHoverBehavior}),(O||M||A)&&{customClickBehavior:J.customClickBehavior}),j&&j.length>0&&{annotations:j}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(an,{componentName:"GroupedBarChart",message:ae,width:N,height:F}):e.jsx(Bn,{componentName:"GroupedBarChart",width:N,height:F,children:e.jsx(St,Object.assign({ref:s},ue))})});function zn({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const s=(i="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const a=function(e){const{name:n,xField:o,yField:r}=e,{predicate:s,isActive:i,selectInterval:a,clear:l}=Dt({name:n}),c=o&&r?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Nt(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Nt(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,r,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:s,isActive:i,clear:l}}({name:(null==s?void 0:s.name)||"__unused_ordinal_brush__",xField:(null==s?void 0:s.xField)||("string"==typeof r?r:"value")}),l=t.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=t.useCallback(e=>{if(s){l.current.end(e?e.r:null)}null==n||n(e)},[n,s]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Wn.displayName="GroupedBarChart";const En=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:f,barPadding:y,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:F,showCategoryTicks:W}=n,z=r.width,E=r.height,q=r.enableHover,G=r.showGrid,V=r.showLegend,Y=r.title,X=r.description,Q=r.summary,U=r.accessibleTable,K=r.categoryLabel,Z=r.valueLabel,J=i||[],ee=p||u,te=void 0===i,ne=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==n.mode)return 40;const e=new Set(J.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?E:z)-2*t)/(t-1))):1},[y,n.mode,J,c,h,z,E]),oe=Hn({data:J,rawData:i,colorBy:ee,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"SwimlaneChart",chartId:C,showLegend:V,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:z,height:E}),re=zn({brushProp:b,onBrushProp:x,linkedBrush:j,valueAccessor:d});if(oe.earlyReturn)return oe.earlyReturn;const se=qt(),ie=t.useMemo(()=>new Map,[J]),ae=w.pieceStyle,le=t.useMemo(()=>(e,t)=>{const n=ee?oe.colorScale?{fill:S(e,ee,oe.colorScale)}:{}:{fill:Gt(R,se,f,t,ie)};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,R,se,f,ie,ae]),ce=t.useMemo(()=>Ut(le,{stroke:I,strokeWidth:H,opacity:$}),[le,I,H,$]),ue=t.useMemo(()=>zt(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),de=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),he=gn({componentName:"SwimlaneChart",data:i,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ge,effectiveMargin:pe}=Nn({ref:o,frameRef:s,isPushMode:te,colorBy:ee,colorScheme:f,showLegend:V,legendPosition:T,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!=i&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ue,size:[z,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,barPadding:ne,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:!1===W?void 0:K,rLabel:Z,rFormat:g}),N&&{rTickValues:N}),null!=F&&{tickLabelEdgeAlign:F}),D&&{oFormat:D}),void 0!==W&&{showCategoryTicks:W}),{showGrid:G}),ge),Y&&{title:Y}),X&&{description:X}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||de}),(A||O||M||_)&&{customHoverBehavior:oe.customHoverBehavior}),(O||M||A)&&{customClickBehavior:oe.customClickBehavior}),v&&v.length>0&&{annotations:v}),re.brushStreamProps),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return he?e.jsx(an,{componentName:"SwimlaneChart",message:he,width:z,height:E}):e.jsx(Bn,{componentName:"SwimlaneChart",width:z,height:E,children:e.jsx(St,Object.assign({ref:s},fe))})});En.displayName="SwimlaneChart";const qn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,sizeBy:f,sizeRange:y=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:j,brush:w,onBrush:k,linkedBrush:A,frameProps:O={},selection:M,linkedHover:_,onObservation:C,onClick:P,hoverHighlight:L,chartId:B,loading:T,emptyContent:R,legendInteraction:I,legendPosition:H,color:$,stroke:D,strokeWidth:N,opacity:F,showCategoryTicks:W,categoryFormat:z}=n,E=r.width,q=r.height,G=r.enableHover,V=r.showGrid,Y=r.title,X=r.description,Q=r.summary,U=r.accessibleTable,K=r.categoryLabel,Z=r.valueLabel,J=i||[],ee=Hn({data:J,rawData:i,colorBy:g,colorScheme:p,legendInteraction:I,legendPosition:H,selection:M,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:L,chartType:"SwarmPlot",chartId:B,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:T,emptyContent:R,width:E,height:q}),te=zn({brushProp:w,onBrushProp:k,linkedBrush:A,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const ne=t.useMemo(()=>{if(!f)return;const e=J.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[J,f]),oe=qt(),re=t.useMemo(()=>new Map,[J]),se=O.pieceStyle,ie=t.useMemo(()=>(e,t)=>{const n={fillOpacity:v};if(n.fill=g?S(e,g,ee.colorScale):Gt($,oe,p,void 0,re),n.r=f?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[s,i]=o,[a,l]=n;return i===s?(a+l)/2:a+(r-s)/(i-s)*(l-a)}(e,f,y,ne):m,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},[g,ee.colorScale,f,y,ne,m,v,$,oe,p,re,se]),ae=t.useMemo(()=>Ut(ie,{stroke:D,strokeWidth:N,opacity:F}),[ie,D,N,F]),le=t.useMemo(()=>zt(ae,ee.effectiveSelectionHook,ee.resolvedSelection),[ae,ee.effectiveSelectionHook,ee.resolvedSelection]),ce=t.useMemo(()=>sn({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),ue=gn({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(an,{componentName:"SwarmPlot",message:ue,width:E,height:q});const 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({chartType:"swarm"},null!=i&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[E,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:b,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:K,rLabel:Z,rFormat:h}),z&&{oFormat:z}),{showGrid:V,showCategoryTicks:W}),ee.legendBehaviorProps),Y&&{title:Y}),X&&{description:X}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:tn(x)||ce}),(_||C||P||L)&&{customHoverBehavior:ee.customHoverBehavior}),(C||P||_)&&{customClickBehavior:ee.customClickBehavior}),j&&j.length>0&&{annotations:j}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"SwarmPlot",width:E,height:q,children:e.jsx(St,Object.assign({ref:s},de))})});function Gn(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[r&&e.jsx("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e.jsxs("div",{children:["n = ",s.n]}),null!=s.min&&e.jsxs("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e.jsxs("div",{children:["Q1: ",s.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e.jsxs("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e.jsxs("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=s.length,a=i>0?i%2!=0?s[Math.floor(i/2)]:(s[i/2-1]+s[i/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[r&&e.jsx("div",{style:{fontWeight:"bold"},children:r+""}),i>0&&e.jsxs("div",{children:["n = ",i]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:Kt,children:e.jsx("div",{style:{fontWeight:"bold"},children:r+""})})}}qn.displayName="SwarmPlot";const Vn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:p,showOutliers:f=!0,categoryPadding:y=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R,showCategoryTicks:I,categoryFormat:H}=n,$=r.width,D=r.height,N=r.enableHover,F=r.showGrid,W=r.title,z=r.description,E=r.summary,q=r.accessibleTable,G=r.categoryLabel,V=r.valueLabel,Y=i||[],X=Hn({data:Y,rawData:i,colorBy:g,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"BoxPlot",chartId:O,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:M,emptyContent:_,width:$,height:D});if(X.earlyReturn)return X.earlyReturn;const Q=qt(),U=t.useMemo(()=>new Map,[Y]),K=t.useMemo(()=>e=>{const t=g?S(e,g,X.colorScale):Gt(L,Q,p,void 0,U);return{fill:t,stroke:t,fillOpacity:.8}},[g,X.colorScale,L,Q,p,U]),Z=t.useMemo(()=>Ut(K,{stroke:B,strokeWidth:T,opacity:R}),[K,B,T,R]),J=t.useMemo(()=>zt(Z,X.effectiveSelectionHook,X.resolvedSelection),[Z,X.effectiveSelectionHook,X.resolvedSelection]),ee=t.useMemo(()=>Gn(),[]),te=gn({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(te)return e.jsx(an,{componentName:"BoxPlot",message:te,width:$,height:D});const 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:"boxplot"},null!=i&&{data:Y}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[$,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:X.margin,barPadding:y,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:G,rLabel:V,rFormat:h}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:I}),X.legendBehaviorProps),W&&{title:W}),z&&{description:z}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||ee}),(j||w||k||A)&&{customHoverBehavior:X.customHoverBehavior}),(w||k||j)&&{customClickBehavior:X.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"BoxPlot",width:$,height:D,children:e.jsx(St,Object.assign({ref:s},ne))})});Vn.displayName="BoxPlot";const Yn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:p,colorScheme:f,categoryPadding:y=20,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:j,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:B,legendPosition:T,color:R,stroke:I,strokeWidth:H,opacity:$,showCategoryTicks:D,categoryFormat:N}=n,F=r.width,W=r.height,z=r.enableHover,E=r.showGrid,q=r.title,G=r.description,V=r.summary,Y=r.accessibleTable,X=r.categoryLabel,Q=r.valueLabel,U=i||[],K=Hn({data:U,rawData:i,colorBy:p,colorScheme:f,legendInteraction:B,legendPosition:T,selection:k,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:_,chartType:"Histogram",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:F,height:W}),Z=zn({brushProp:b,onBrushProp:x,linkedBrush:j,valueAccessor:u});if(K.earlyReturn)return K.earlyReturn;const J=t.useMemo(()=>{if(0===U.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of U){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[U,u]),ee=qt(),te=t.useMemo(()=>new Map,[U]),ne=t.useMemo(()=>e=>{const t=p?S(e,p,K.colorScale):Gt(R,ee,f,void 0,te);return{fill:t,stroke:t,fillOpacity:.8}},[p,K.colorScale,R,ee,f,te]),oe=t.useMemo(()=>Ut(ne,{stroke:I,strokeWidth:H,opacity:$}),[ne,I,H,$]),re=t.useMemo(()=>zt(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,s=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),null!=r&&e.jsxs("div",{children:["Count: ",r]}),s&&2===s.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),ie=gn({componentName:"Histogram",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(an,{componentName:"Histogram",message:ie,width:F,height:W});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=i&&{data:U}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),J&&{rExtent:J}),{size:[F,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:y,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:X,rLabel:Q,rFormat:g}),N&&{oFormat:N}),{showGrid:E,showCategoryTicks:D}),K.legendBehaviorProps),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==Y&&{accessibleTable:Y}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||se}),(A||O||M||_)&&{customHoverBehavior:K.customHoverBehavior}),(O||M||A)&&{customClickBehavior:K.customClickBehavior}),v&&v.length>0&&{annotations:v}),Z.brushStreamProps),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"Histogram",width:F,height:W,children:e.jsx(St,Object.assign({ref:s},ae))})});Yn.displayName="Histogram";const Xn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:m=20,tooltip:v,annotations:b,brush:x,onBrush:j,linkedBrush:w,frameProps:k={},selection:A,linkedHover:O,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:B,legendInteraction:T,legendPosition:R,color:I,stroke:H,strokeWidth:$,opacity:D,showCategoryTicks:N,categoryFormat:F}=n,W=r.width,z=r.height,E=r.enableHover,q=r.showGrid,G=r.title,V=r.description,Y=r.summary,X=r.accessibleTable,Q=r.categoryLabel,U=r.valueLabel,K=i||[],Z=Hn({data:K,rawData:i,colorBy:f,colorScheme:y,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"ViolinPlot",chartId:P,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:L,emptyContent:B,width:W,height:z}),J=zn({brushProp:x,onBrushProp:j,linkedBrush:w,valueAccessor:u});if(Z.earlyReturn)return Z.earlyReturn;const ee=qt(),te=t.useMemo(()=>new Map,[K]),ne=t.useMemo(()=>e=>{const t=f?S(e,f,Z.colorScale):Gt(I,ee,y,void 0,te);return{fill:t,stroke:t,fillOpacity:.6}},[f,Z.colorScale,I,ee,y,te]),oe=t.useMemo(()=>Ut(ne,{stroke:H,strokeWidth:$,opacity:D}),[ne,H,$,D]),re=t.useMemo(()=>zt(oe,Z.effectiveSelectionHook,Z.resolvedSelection),[oe,Z.effectiveSelectionHook,Z.resolvedSelection]),se=t.useMemo(()=>Gn({valueAccessor:u}),[u]),ie=gn({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(an,{componentName:"ViolinPlot",message:ie,width:W,height:z});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=i&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:U,rFormat:p}),F&&{oFormat:F}),{showGrid:q,showCategoryTicks:N}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),Y&&{summary:Y}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:tn(v)||se}),(O||M||_||C)&&{customHoverBehavior:Z.customHoverBehavior}),(M||_||O)&&{customClickBehavior:Z.customClickBehavior}),b&&b.length>0&&{annotations:b}),J.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"ViolinPlot",width:W,height:z,children:e.jsx(St,Object.assign({ref:s},ae))})});Xn.displayName="ViolinPlot";const Qn=t.forwardRef(function(n,o){var r;const s=Xt(n.mode,{width:n.width,height:n.height,showGrid:null===(r=n.showGrid)||void 0===r||r,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),i=t.useRef(null);t.useImperativeHandle(o,()=>({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",valueFormat:g,colorBy:p,colorScheme:f,sort:y="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:j={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:M,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:B,color:T,stroke:R,strokeWidth:I,opacity:H,categoryFormat:$}=n,D=s.width,N=s.height,F=s.enableHover,W=s.showGrid,z=s.title,E=s.description,q=s.summary,G=s.accessibleTable,V=s.categoryLabel,Y=s.valueLabel,X=a||[],Q=Hn({data:X,rawData:a,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:B,selection:w,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:M,chartType:"DotPlot",chartId:_,showLegend:s.showLegend,userMargin:l,marginDefaults:s.marginDefaults,loading:C,emptyContent:P,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Vt(X,y,d),K=qt(),Z=t.useMemo(()=>new Map,[X]),J=j.pieceStyle,ee=t.useMemo(()=>(e,t)=>{const n={r:m,fillOpacity:.8};if(n.fill=p?S(e,p,Q.colorScale):Gt(T,K,f,void 0,Z),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},[p,Q.colorScale,m,T,K,f,Z,J]),te=t.useMemo(()=>Ut(ee,{stroke:R,strokeWidth:I,opacity:H}),[ee,R,I,H]),ne=t.useMemo(()=>zt(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=t.useMemo(()=>sn({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),re=gn({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(an,{componentName:"DotPlot",message:re,width:D,height:N});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!=a&&{data:U}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:s.showAxes,oLabel:V,rLabel:Y,rFormat:g}),$&&{oFormat:$}),{showGrid:W,oSort:y}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:tn(b)||oe}),(k||A||O||M)&&{customHoverBehavior:Q.customHoverBehavior}),(A||O||k)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"DotPlot",width:D,height:N,children:e.jsx(St,Object.assign({ref:i},se))})});Qn.displayName="DotPlot";const Un=t.forwardRef(function(n,o){var r,s;const i=Xt(n.mode,{width:null!==(r=n.width)&&void 0!==r?r:400,height:null!==(s=n.height)&&void 0!==s?s:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:p,startAngle:f=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R}=n,I=i.width,H=i.height,$=i.enableHover,D=i.showLegend,N=i.title,F=i.description,W=i.summary,z=i.accessibleTable,E=l||[],q=g||d,G=void 0===l,V=Hn({data:E,rawData:l,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"PieChart",chartId:O,showLegend:D,userMargin:c,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const Y=qt(),X=t.useMemo(()=>new Map,[E]),Q=t.useMemo(()=>(e,t)=>q?V.colorScale?{fill:S(e,q,V.colorScale)}:{}:{fill:Gt(L,Y,p,t,X)},[q,V.colorScale,L,Y,p,X]),U=t.useMemo(()=>{const e=null==b?void 0:b.pieceStyle;return Ut(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Q(t,n)),e(t,n)||{}):Q,{stroke:B,strokeWidth:T,opacity:R})},[Q,b,B,T,R]),K=t.useMemo(()=>zt(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),Z=t.useMemo(()=>sn({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),J=gn({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:ee,effectiveMargin:te}=Nn({ref:o,frameRef:a,isPushMode:G,colorBy:q,colorScheme:p,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!=l&&{data:E}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:K,startAngle:f}),null!=y&&{cornerRadius:y}),{size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),ee),N&&{title:N}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||Z}),(j||w||k||A)&&{customHoverBehavior:V.customHoverBehavior}),(w||k||j)&&{customClickBehavior:V.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return J?e.jsx(an,{componentName:"PieChart",message:J,width:I,height:H}):e.jsx(Bn,{componentName:"PieChart",width:I,height:H,children:e.jsx(St,Object.assign({ref:a},ne))})});Un.displayName="PieChart";const Kn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks},{width:400,height:400}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:p,startAngle:f=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R}=n,I=r.width,H=r.height,$=r.enableHover,D=r.showLegend,N=r.title,F=r.description,W=r.summary,z=r.accessibleTable,E=i||[],q=g||c,G=void 0===i,V=Hn({data:E,rawData:i,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"DonutChart",chartId:O,showLegend:D,userMargin:a,marginDefaults:r.marginDefaults,loading:M,emptyContent:_,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const Y=null!=d?d:Math.max(2,.15*Math.min(I,H)),X=qt(),Q=t.useMemo(()=>new Map,[E]),U=b.pieceStyle,K=t.useMemo(()=>(e,t)=>{let n;if(n=q?V.colorScale?{fill:S(e,q,V.colorScale)}:{}:{fill:Gt(L,X,p,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,X,p,Q,U]),Z=t.useMemo(()=>Ut(K,{stroke:B,strokeWidth:T,opacity:R}),[K,B,T,R]),J=t.useMemo(()=>zt(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=t.useMemo(()=>sn({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),te=gn({componentName:"DonutChart",data:i,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:ne,effectiveMargin:oe}=Nn({ref:o,frameRef:s,isPushMode:G,colorBy:q,colorScheme:p,showLegend:D,legendPosition:P,setup:V}),re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=i&&{data:E}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:Y,startAngle:f}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:oe,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),ne),N&&{title:N}),F&&{description:F}),W&&{summary:W}),void 0!==z&&{accessibleTable:z}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:tn(m)||ee}),(j||w||k||A)&&{customHoverBehavior:V.customHoverBehavior}),(w||k||j)&&{customClickBehavior:V.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return te?e.jsx(an,{componentName:"DonutChart",message:te,width:I,height:H}):e.jsx(Bn,{componentName:"DonutChart",width:I,height:H,children:e.jsx(St,Object.assign({ref:s},re))})});Kn.displayName="DonutChart";const Zn=t.forwardRef(function(n,o){const r=Xt(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}),s=t.useRef(null),i="context"===n.mode,{compactMode:a}=r,{value:l,min:c=0,max:u=100,thresholds:d,color:h,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,showNeedle:f=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:m,valueFormat:v,showScaleLabels:b=!a,sweep:x=240,fillZones:j=!0,tooltip:w,annotations:k,frameProps:A={},className:O,stroke:S,strokeWidth:M,opacity:_}=n,C=r.width,P=r.height,L=r.title,B=r.description,T=r.summary,R=r.accessibleTable,I=Math.max(c,Math.min(u,l)),H=u-c||1,$=(I-c)/H,{gaugeData:D,pieceStyle:N,gaugeAnnotations:F}=t.useMemo(()=>{const e=[],t=new Map,n=[];let o=d&&d.length>0?[...d].sort((e,t)=>e.value-t.value):[{value:u,color:h||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(c,Math.min(u,e.value))})),u>o[o.length-1].value&&o.push({value:u,color:o[o.length-1].color});let r=c;for(let n=0;o.length>n;n++){const s=o[n],i=(s.value-r)/H;if(j){const o=(r-c)/H,a=Math.max(0,Math.min($,(s.value-c)/H)-o),l=i-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:s.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:s.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:s.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:g,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:i,_zone:s.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:s.color})}r=s.value}if(b&&d&&d.length>0)for(const e of d)e.value>c&&u>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:g},gaugeAnnotations:n}},[l,c,u,d,h,g,$,H,b,j]),W=t.useMemo(()=>Ut(N,{stroke:S,strokeWidth:M,opacity:_}),[N,S,M,_]),z=x*Math.PI/180,E=180+(360-x)/2,q=Math.min(10,Math.max(1,Math.min(C,P)/12)),G=-Math.PI/2+E*Math.PI/180,V=[[Math.cos(G),Math.sin(G)],[Math.cos(G+z),Math.sin(G+z)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-G)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>z+.001||V.push([Math.cos(e),Math.sin(e)]);const Y=Math.min(...V.map(e=>e[0])),X=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),U=Math.max(...V.map(e=>e[1])),K=(Q+U)/2,Z=(Y+X)/2,J=Math.max(4,Math.min((C-2*q)/(X-Y),(P-2*q)/(U-Q))-2),ee=Math.max(0,Math.min(J-1.5,J*(1-p))),te=C/2-Z*J,ne=P/2-K*J,oe=2*(J+4),re=t.useMemo(()=>{if(a&&null==m)return null;if(null!=m)return"function"==typeof m?m(I,c,u):m;const t=v?v(I):Math.round(I)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),b&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[m,I,c,u,v,b,J,a]),se=t.useMemo(()=>i&&null==m?{type:"gauge-value",text:v?v(I):Math.round(I)+""}:null,[i,m,I,v]),ie=t.useMemo(()=>{if(!f)return null;const e=-Math.PI/2+E*Math.PI/180+$*z,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[f,$,E,z,ee,y]),ae=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const r=(o.width||C)/2,s=(o.height||P)/2,i=Math.max(1,J-ee),a=Math.max(1,Math.min(2.5,.4*i)),l=Math.max(1,Math.min(5,.6*i));return e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+n)}if("gauge-label"===t.type){const r=-Math.PI/2+E*Math.PI/180+(t.value-c)/H*z,s=ee-14,i=(o.height||P)/2;return e.jsx("text",{x:(o.width||C)/2+Math.cos(r)*s,y:i+Math.sin(r)*s,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||C)/2,y:(o.height||P)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[C,P,c,H,E,z,ee,J]),le=t.useMemo(()=>{const e=[...F,...k||[]];return ie&&e.push(ie),se&&e.push(se),e},[F,k,ie,se]),ce=t.useMemo(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.jsxs("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:[e.jsx("div",{style:{fontWeight:600},children:(null==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(I):"Remaining"})]})},[I]);if(0===D.length)return e.jsx(an,{componentName:"GaugeChart",message:"No data to display",width:C,height:P});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:D,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:ee,startAngle:E,sweepAngle:x,centerContent:re,size:[C,P],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:P-ne-oe/2,left:te-oe/2,right:C-te-oe/2},enableHover:r.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===w?()=>null:tn(w)||ce,svgAnnotationRules:ae},le.length>0&&{annotations:le}),L&&{title:L}),B&&{description:B}),T&&{summary:T}),void 0!==R&&{accessibleTable:R}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),A);return e.jsx(Bn,{componentName:"GaugeChart",width:C,height:P,children:e.jsx(St,Object.assign({ref:s},ue))})});Zn.displayName="GaugeChart";const Jn=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:m=5,tooltip:v,annotations:b,frameProps:x={},selection:j,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:B,stroke:T,strokeWidth:R,opacity:I,showCategoryTicks:H,categoryFormat:$}=n,D=r.width,N=r.height,F=r.enableHover,W=r.showGrid,z=r.title,E=r.description,q=r.summary,G=r.accessibleTable,V=r.categoryLabel,Y=r.valueLabel,X=i||[],Q=Hn({data:X,rawData:i,colorBy:f,colorScheme:y,legendInteraction:P,legendPosition:L,selection:j,linkedHover:w,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"RidgelinePlot",chartId:M,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:_,emptyContent:C,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=qt(),K=t.useMemo(()=>new Map,[X]),Z=t.useMemo(()=>e=>{const t=f?S(e,f,Q.colorScale):Gt(B,U,y,void 0,K);return{fill:t,stroke:t,fillOpacity:.5}},[f,Q.colorScale,B,U,y,K]),J=t.useMemo(()=>Ut(Z,{stroke:T,strokeWidth:R,opacity:I}),[Z,T,R,I]),ee=t.useMemo(()=>zt(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=t.useMemo(()=>Gn(),[]),ne=gn({componentName:"RidgelinePlot",data:i,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(an,{componentName:"RidgelinePlot",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:"ridgeline"},null!=i&&{data:X}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,bins:h,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:V,rLabel:Y,rFormat:p}),$&&{oFormat:$}),{showGrid:W,showCategoryTicks:H,oSort:!1,amplitude:g}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:tn(v)||te}),(w||k||A||O)&&{customHoverBehavior:Q.customHoverBehavior}),(k||A||w)&&{customClickBehavior:Q.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"RidgelinePlot",width:D,height:N,children:e.jsx(St,Object.assign({ref:s},oe))})});Jn.displayName="RidgelinePlot";const eo=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:i,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:p="horizontal",connectorOpacity:f=.3,showLabels:y=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:j,onObservation:w,onClick:k,hoverHighlight:A,chartId:O,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:B,strokeWidth:T,opacity:R,categoryFormat:I}=n,H="vertical"===p,$=r.width,D=r.height,N=r.enableHover,F=r.title,W=r.description,z=r.summary,E=r.accessibleTable,q=i||[],G=h||d,V=!G,Y=Hn({data:q,rawData:i,colorBy:G,colorScheme:g,legendInteraction:C,legendPosition:P,selection:x,linkedHover:j,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"FunnelChart",chartId:O,showLegend:r.showLegend,userMargin:a,marginDefaults:H?{top:F?60:40,right:20,bottom:60,left:60}:{top:F?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:_,width:$,height:D});if(Y.earlyReturn)return Y.earlyReturn;In("FunnelChart",q,"stepAccessor",c),In("FunnelChart",q,"valueAccessor",u);const X=qt(),Q=t.useMemo(()=>new Map,[q]),U=t.useMemo(()=>{if(V)return L||((null==X?void 0:X[0])?X[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[V,L,X,g]),K=b.pieceStyle,Z=t.useMemo(()=>(e,t)=>{const n={};if(n.fill=U||(G?S(e,G,Y.colorScale):Gt(L,X,g,t,Q)),K){const o=K(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[U,G,Y.colorScale,L,X,g,Q,K]),J=t.useMemo(()=>Ut(Z,{stroke:B,strokeWidth:T,opacity:R}),[Z,B,T,R]),ee=t.useMemo(()=>zt(J,Y.effectiveSelectionHook,Y.resolvedSelection),[J,Y.effectiveSelectionHook,Y.resolvedSelection]),te=t.useMemo(()=>t=>{var n,o,r,s,i,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(s=null==l?void 0:l.__funnelPercent)&&void 0!==s?s:null==l?void 0:l.__barFunnelPercent,h=null!==(i=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==i?i:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,p=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,f=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:Kt,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),p&&p!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:p+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",f]})]})},[]),ne=gn({componentName:"FunnelChart",data:i,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(an,{componentName:"FunnelChart",message:ne,width:$,height:D});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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:H?"bar-funnel":"funnel"},null!=i&&{data:q}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:ee,size:[$,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Y.margin,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),I&&{oFormat:I}),{showGrid:H}),!H&&{connectorOpacity:f}),{showLabels:y}),Y.legendBehaviorProps),F&&{title:F}),W&&{description:W}),z&&{summary:z}),void 0!==E&&{accessibleTable:E}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?te:tn(m)||te}),(j||w||k||A)&&{customHoverBehavior:Y.customHoverBehavior}),(w||k||j)&&{customClickBehavior:Y.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Bn,{componentName:"FunnelChart",width:$,height:D,children:e.jsx(St,Object.assign({ref:s},oe))})});eo.displayName="FunnelChart";const to={RdBu:r.interpolateRdBu,PiYG:r.interpolatePiYG,PRGn:r.interpolatePRGn,BrBG:r.interpolateBrBG,RdYlBu:r.interpolateRdYlBu,RdYlGn:r.interpolateRdYlGn,Spectral:r.interpolateSpectral},no="__likert_neutral_neg",oo="__likert_neutral_pos";function ro(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function so(e,t,n,o,r,s){const i=new Map,a=new Set(t);for(const l of e){const e=n(l);i.has(e)||i.set(e,new Map);const c=i.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&s){const e=r(l),t=s(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 i){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const s=t[r],i=n.get(s)||0;l.push({__likertCategory:e,__likertLevel:s,__likertLevelLabel:s,__likertCount:i,__likertPct:i/o*100,__likertLevelIndex:r})}}return l}function io(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),s=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;s.push(Object.assign(Object.assign({},t),{__likertLevel:no,__likertPct:-e})),s.push(Object.assign(Object.assign({},t),{__likertLevel:oo,__likertPct:e}))}else s.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return s}function ao(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),s=new Map;for(const t of e){const e=s.get(t.__likertCategory)||[];e.push(t),s.set(t.__likertCategory,e)}const i=[];for(const[,e]of s){const t=new Map;let s,a;for(const n of e)n.__likertLevel===no?s=n:n.__likertLevel===oo?a=n:t.set(n.__likertLevelIndex,n);o&&s&&i.push(s);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&i.push(n)}o&&a&&i.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&i.push(n)}}return i}const lo=t.forwardRef(function(n,o){const r=Xt(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null),{data:i,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:h="count",levels:p,orientation:f="horizontal",colorScheme:y,barPadding:m=20,tooltip:v,annotations:b,frameProps:x={},selection:j,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:S,valueFormat:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,categoryFormat:B,stroke:T,strokeWidth:R,opacity:I}=n,H=r.width,$=r.height,D=r.enableHover,N=r.showGrid,F=r.showLegend,W=r.title,z=r.description,E=r.summary,q=r.accessibleTable,G=r.categoryLabel,V=r.valueLabel,Y="horizontal"===f,X=void 0===i,Q=!d,U=function(){var e;const t=Et();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),K=t.useMemo(()=>y&&Array.isArray(y)&&y.length>=p.length?y:function(e,t){if(0>=e)return[];if(t){const n=to[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"],r="#a8a8a8";if(1===e)return[r];const s=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);s&&a.push(r);for(let e=0;i>e;e++)a.push(o[Math.min(Math.floor(e*o.length/i),o.length-1)]);return a}(p.length,U),[y,p.length,U]),Z=t.useMemo(()=>{const e=new Map;for(let t=0;p.length>t;t++)e.set(p[t],K[t]||"#888");return e},[p,K]),{processedData:J,reAggregate:ee,accumulatorRef:te}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:r,levelAccessor:s,countAccessor:i,isDiverging:a,frameRef:l}){const c=!s,u=t.useMemo(()=>ro(o,"question"),[o]),d=t.useMemo(()=>c?ro(r,"score"):null,[c,r]),h=t.useMemo(()=>c?null:ro(s,"level"),[c,s]),g=t.useMemo(()=>c?null:ro(i,"count"),[c,i]),p=e||[],f=t.useRef([]),y=t.useMemo(()=>{if(0===p.length)return[];let e=so(p,n,u,d,h,g);return a&&(e=io(e,n),e=ao(e,n)),e},[p,n,u,d,h,g,a]),m=t.useCallback(e=>{var t;let o=so(e,n,u,d,h,g);a&&(o=io(o,n),o=ao(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,g,a,l]);return{processedData:y,reAggregate:m,accumulatorRef:f}}({data:i,levels:p,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:h,isDiverging:Y,frameRef:s}),ne="__likertLevelLabel",oe=Dn({isPushMode:X,colorBy:ne,colorScheme:K,showLegend:F,legendPosition:L}),re=t.useCallback(oe.wrapPush(e=>{te.current.push(e),ee(te.current)}),[oe.wrapPush,ee,te]),se=t.useCallback(oe.wrapPushMany(e=>{te.current.push(...e),ee(te.current)}),[oe.wrapPushMany,ee,te]);t.useImperativeHandle(o,()=>({push:re,pushMany:se,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;te.current=[],oe.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[re,se,oe.resetCategories,te]);const ie=Hn({data:J,rawData:i,colorBy:ne,colorScheme:K,legendInteraction:P,legendPosition:L,selection:j,linkedHover:w,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"LikertChart",chartId:S,showLegend:F,userMargin:a,marginDefaults:r.marginDefaults,loading:_,emptyContent:C,width:H,height:$});if(ie.earlyReturn)return ie.earlyReturn;const ae=t.useMemo(()=>{const e=p.length;return e%2!=0&&Z.get(p[Math.floor(e/2)])||"#888"},[p,Z]),le=x.pieceStyle,ce=t.useMemo(()=>(e,t)=>{var n,o;const r=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),s=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let i;if(s===no||s===oo)i={fill:ae};else{const e=r||s;i=e&&Z.has(e)?{fill:Z.get(e)}:{fill:"#888"}}if(le){const n=le(e,t);n.stroke&&(i.stroke=n.stroke),null!=n.strokeWidth&&(i.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(i.strokeOpacity=n.strokeOpacity)}return i},[Z,ae,le]),ue=t.useMemo(()=>Ut(ce,{stroke:T,strokeWidth:R,opacity:I}),[ce,T,R,I]),de=t.useMemo(()=>zt(ue,ie.effectiveSelectionHook,ie.resolvedSelection),[ue,ie.effectiveSelectionHook,ie.resolvedSelection]),he=t.useMemo(()=>{const e=p.length;return e%2!=0?p[Math.floor(e/2)]:""},[p]),ge=t.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===no||n===oo?he:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),i=n===no||n===oo?2*s:s,a=t.__likertCount||0;return g.createElement("div",{className:"semiotic-tooltip",style:Kt},g.createElement("div",{style:{fontWeight:"bold"}},r),g.createElement("div",{style:{marginTop:4}},`${o}: ${i.toFixed(1)}% (n=${a})`))},[he]),pe=t.useMemo(()=>{if(!p||2>p.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==i&&0===i.length)return null;const e={categoryAccessor:c};return Q?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),h&&(e.countAccessor=h)),gn({componentName:"LikertChart",data:i,accessors:e,requiredProps:{levels:p}})},[i,c,u,d,h,p,Q]),fe=t.useMemo(()=>[{styleFn:e=>({fill:Z.get(e.label)||"#888"}),items:p.map(e=>({label:e})),label:""}],[p,Z]),ye=t.useMemo(()=>!1!==F?Object.assign(Object.assign({},ie.legendBehaviorProps),{legend:{legendGroups:fe},legendPosition:L||ie.legendPosition||"bottom"}):ie.legendBehaviorProps,[ie.legendBehaviorProps,ie.legendPosition,L,F,fe]),me=t.useMemo(()=>{const e=Object.assign({},ie.margin);if(X&&!1!==F){const t=L||"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(oe.streamingMarginAdjust)for(const[t,n]of Object.entries(oe.streamingMarginAdjust))n>e[t]&&(e[t]=n);return Y&&100>e.left&&(e.left=100),e},[ie.margin,oe.streamingMarginAdjust,Y,X,F,L]),ve=t.useMemo(()=>M||(Y?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Y,M]),be=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!=i&&{data:J}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Y?"horizontal":"vertical",pieceStyle:de,size:[H,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:me,barPadding:m,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:G,rLabel:V||(Y?void 0:"Percentage"),rFormat:ve}),B&&{oFormat:B}),{showGrid:N}),ye),W&&{title:W}),z&&{description:z}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:!0===v?ge:tn(v)||ge}),(w||k||A||O)&&{customHoverBehavior:ie.customHoverBehavior}),(k||A||w)&&{customClickBehavior:ie.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return pe?e.jsx(an,{componentName:"LikertChart",message:pe,width:H,height:$}):e.jsx(Bn,{componentName:"LikertChart",width:H,height:$,children:e.jsx(St,Object.assign({ref:s},be))})});lo.displayName="LikertChart",exports.BarChart=$n,exports.BoxPlot=Vn,exports.DonutChart=Kn,exports.DotPlot=Qn,exports.FunnelChart=eo,exports.GaugeChart=Zn,exports.GroupedBarChart=Wn,exports.Histogram=Yn,exports.LikertChart=lo,exports.PieChart=Un,exports.RidgelinePlot=Jn,exports.StackedBarChart=Fn,exports.StreamOrdinalFrame=St,exports.SwarmPlot=qn,exports.SwimlaneChart=En,exports.ViolinPlot=Xn,exports.createHatchPattern=ft;
|