semiotic 3.4.2 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +114 -9
- package/README.md +45 -4
- package/ai/behaviorContracts.cjs +311 -0
- package/ai/chartSuggestions.cjs +291 -0
- package/ai/cli.js +255 -30
- package/ai/componentMetadata.cjs +107 -0
- package/ai/dist/mcp-server.js +907 -227
- package/ai/schema.json +3954 -2537
- package/ai/system-prompt.md +23 -4
- package/dist/components/LinkedCharts.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
- package/dist/components/charts/geo/FlowMap.d.ts +55 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
- package/dist/components/charts/network/CirclePack.d.ts +36 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
- package/dist/components/charts/network/Treemap.d.ts +36 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +113 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +97 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +44 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +29 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +38 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +62 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +34 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
- package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +67 -0
- package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
- package/dist/components/charts/shared/colorUtils.d.ts +9 -10
- package/dist/components/charts/shared/numberFormat.d.ts +58 -0
- package/dist/components/charts/shared/sparseArray.d.ts +27 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
- package/dist/components/charts/shared/timeFormat.d.ts +60 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
- package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +2 -1
- package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
- package/dist/components/charts/xy/AreaChart.d.ts +44 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +37 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +28 -0
- package/dist/components/charts/xy/Heatmap.d.ts +4 -0
- package/dist/components/charts/xy/LineChart.d.ts +12 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +58 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +38 -2
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +61 -1
- package/dist/components/realtime/types.d.ts +2 -4
- package/dist/components/recipes/bullet.d.ts +86 -0
- package/dist/components/recipes/calendar.d.ts +43 -0
- package/dist/components/recipes/dagre.d.ts +56 -0
- package/dist/components/recipes/flextree.d.ts +55 -0
- package/dist/components/recipes/marimekko.d.ts +55 -0
- package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
- package/dist/components/recipes/recipeUtils.d.ts +27 -0
- package/dist/components/recipes/waffle.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-recipes.d.ts +24 -0
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +2 -2
- package/dist/components/server/renderToStaticSVG.d.ts +8 -2
- package/dist/components/server/serverChartConfigs.d.ts +47 -1
- package/dist/components/server/staticAnnotations.d.ts +6 -0
- package/dist/components/store/ObservationStore.d.ts +1 -3
- package/dist/components/store/SelectionStore.d.ts +1 -3
- package/dist/components/store/ThemeStore.d.ts +4 -4
- package/dist/components/store/TooltipStore.d.ts +1 -3
- package/dist/components/store/createStore.d.ts +4 -2
- package/dist/components/stream/CanvasHitTester.d.ts +10 -8
- package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
- package/dist/components/stream/PipelineStore.d.ts +51 -0
- package/dist/components/stream/SVGOverlay.d.ts +12 -0
- package/dist/components/stream/SceneGraph.d.ts +15 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/categoryDomain.d.ts +4 -0
- package/dist/components/stream/composeOverlays.d.ts +15 -0
- package/dist/components/stream/customLayout.d.ts +76 -0
- package/dist/components/stream/customLayoutPalette.d.ts +29 -0
- package/dist/components/stream/geoTypes.d.ts +13 -0
- package/dist/components/stream/hoverUtils.d.ts +4 -10
- package/dist/components/stream/networkCustomLayout.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +45 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
- package/dist/components/stream/ordinalTypes.d.ts +35 -1
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
- package/dist/components/stream/sampleCurvePath.d.ts +9 -0
- package/dist/components/stream/types.d.ts +44 -1
- package/dist/components/stream/useHydration.d.ts +89 -0
- package/dist/components/stream/useStableShallow.d.ts +1 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
- package/dist/geo.min.js +2 -1
- package/dist/geo.module.min.js +2 -1
- package/dist/network.min.js +2 -1
- package/dist/network.module.min.js +2 -1
- package/dist/ordinal.min.js +2 -1
- package/dist/ordinal.module.min.js +2 -1
- package/dist/realtime.min.js +2 -1
- package/dist/realtime.module.min.js +2 -1
- package/dist/semiotic-ai.d.ts +69 -65
- package/dist/semiotic-ai.min.js +2 -1
- package/dist/semiotic-ai.module.min.js +2 -1
- package/dist/semiotic-data.d.ts +4 -4
- package/dist/semiotic-geo.d.ts +15 -15
- package/dist/semiotic-network.d.ts +19 -16
- package/dist/semiotic-ordinal.d.ts +31 -28
- package/dist/semiotic-realtime.d.ts +17 -17
- package/dist/semiotic-recipes.d.ts +24 -0
- package/dist/semiotic-recipes.min.js +1 -0
- package/dist/semiotic-recipes.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +6 -6
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
- package/dist/semiotic-themes.d.ts +3 -3
- package/dist/semiotic-themes.min.js +2 -1
- package/dist/semiotic-themes.module.min.js +2 -1
- package/dist/semiotic-utils.d.ts +23 -23
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-xy.d.ts +27 -24
- package/dist/semiotic.d.ts +63 -63
- package/dist/semiotic.min.js +2 -1
- package/dist/semiotic.module.min.js +2 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +34 -5
- package/dist/xy.min.js +2 -1
- package/dist/xy.module.min.js +2 -1
- package/package.json +38 -17
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useEffect as i,useMemo as r,useRef as s,createContext as a,useContext as l,useCallback as c,useSyncExternalStore as u,useState as d,forwardRef as h,useImperativeHandle as g,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as f,scaleBand as m}from"d3-scale";import{quadtree as v}from"d3-quadtree";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as w,interpolatePurples as A,interpolateOranges as k,interpolateGreens as O,interpolateReds as j,interpolateBlues as S,schemeSet3 as _,schemeTableau10 as C,interpolateSpectral as M,interpolateRdYlGn as P,interpolateRdYlBu as L,interpolateBrBG as T,interpolatePRGn as B,interpolatePiYG as I,interpolateRdBu as H}from"d3-scale-chromatic";import{quantile as R}from"d3-array";import{packEnclose as $}from"d3-hierarchy";import{area as D,curveCatmullRom as N,curveCardinal as W,curveBasis as F,curveStepBefore as z,curveStepAfter as E,curveStep as q,curveMonotoneY as G,curveMonotoneX as V,curveLinear as X,arc as Y}from"d3-shape";import Q from"regression";import{select as U}from"d3-selection";import{brushX as K,brushY as Z}from"d3-brush";class J{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class ee{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class te{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function ne(e,t,n){return e+(t-e)*n}function oe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ie(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function re(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const se={category10:b,tableau10:C,set3:_,blues:S,reds:j,greens:O,oranges:k,purples:A,viridis:w,plasma:x},ae=b,le=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ce=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function ue(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ce.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):ae[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%ae.length]}function de(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const r=se[n]||se.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ae;return y().domain(o).range(e).unknown("#999")}}function he(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function ge(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function pe(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=R(e,.25))&&void 0!==t?t:r,median:null!==(n=R(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=R(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}const ye={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],p="vertical"===h,y="horizontal"===h,f=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;f&&n>0&&(a/=n);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(p){const t=d(0>a?i:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);g.push(he(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(y){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);g.push(he(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(r,Math.min(a,d),o,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(Math.min(a,d),r,Math.abs(d-a),o,g,i,h[s]))}}}}const y=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);y>0&&(e.roundedTop=y),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:ge,donut:ge,boxplot:function(e,t){var n,o,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:p}=l,y=[],f="vertical"===p,m=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],p=null!==(n=R(l,.25))&&void 0!==n?n:c,v=null!==(o=R(l,.5))&&void 0!==o?o:(c+u)/2,b=null!==(i=R(l,.75))&&void 0!==i?i:u,x=b-p,w=p-1.5*x,A=b+1.5*x,k=null!==(r=l.find(e=>e>=w))&&void 0!==r?r:c,O=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:u,j=h(t.pieceData[0],t.name),S=[];if(m)for(const e of t.pieceData){const n=d(e);if(w>n||n>A){const o=f?t.middle:g(n),i=f?g(n):t.middle;S.push({px:o,py:i,value:n,datum:e})}}if(y.push({type:"boxplot",x:f?t.middle:0,y:f?0:t.middle,projection:f?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(k),q1Pos:g(p),medianPos:g(v),q3Pos:g(b),maxPos:g(O),stats:{n:l.length,min:k,q1:p,median:v,q3:b,max:O,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:S}),m)for(const t of S)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(r)}`;for(let t=0;p>t;t++){const n=u(r+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(r+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(r)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(r+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(r+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=R(t,.25))&&void 0!==n?n:r,l=null!==(o=R(t,.5))&&void 0!==o?o:(r+s)/2,c=null!==(i=R(t,.75))&&void 0!==i?i:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(r)),width:e.width,height:Math.abs(u(s)-u(r))}:{x:Math.min(u(r),u(s)),y:e.x,width:Math.abs(u(s)-u(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:pe(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,y=Math.max(...r,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/y)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(he(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/p*f}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/p*f} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:pe(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(he(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(he(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],A=[];let k=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(o);i.total+=r,i.pieces.push(o),n+=r}A.push({col:e,groups:t,stepTotal:n}),w||n>k&&(k=n)}if(w)for(const e of A){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>k&&(k=o)}if(0===k)return p;const O=new Map;for(const e of b){const t=A[0].groups.get(e);O.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const j=A[0].stepTotal,S=w?.95*y:.9*t.width,_=f().domain([0,k]).range([0,S]),C=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let M=new Map;for(let t=0;A.length>t;t++){const n=A[t],o=n.col,u=0===t,d=o.width,h=.55*d,f=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=y,i=y;for(let r=0;b.length>r;r++){const a=b[r],l=n.groups.get(a);if(!l)continue;const c=_(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const w=g(l.pieces[0],a),A=null!==(s=O.get(a))&&void 0!==s?s:l.total,k=A>0?l.total/A*100:0,j=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});m&&(0===r&&(j.__funnelStepLabel=o.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=f,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+c/2,j.__funnelValueLabelY=f,j.__funnelBarW=c),p.push(he(x,f,c,h,w,j,a)),v.set(a,{x:x,y:f,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),s=y-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=n.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],d=l?a:o.name,x=g(c,d),w=j>0?e/j*100:0,A=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:u,category:l?a:o.name});m&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=y,A.__funnelStepLabelY=f,A.__funnelRowWidth=t,A.__funnelValueLabelX=y,A.__funnelValueLabelY=f,A.__funnelBarW=t),p.push(he(s,f,t,h,x,A,d)),v.set(a,{x:s,y:f,w:t,h:h})}if(t>0&&M.size>0){const t=w?b:[b[0]];for(const i of t){const t=M.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:C},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};p.push(u)}}M=v}return p},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(i=m.get(h))&&void 0!==i?i:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),A=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:f,k=o?0:Math.max(0,A-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,_=c(p.pieces[0],y?h:n.name),C=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(he(O,j,u,S,_,C,y?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},_),i=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(he(O,e,u,t,o,i,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:i,getStack:r,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(i(n));if(0===o)continue;const l=r?r(n):e.name,d=s(n,l);if(u){const i=a(t),r=a(t+o);c.push(he(i,e.x,r-i,e.width,d,n,l))}else{const i=a(t+o),r=a(t);c.push(he(e.x,i,e.width,r-i,d,n,l))}t+=o}}return c}};class fe{constructor(e){this.rExtent=new te,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new ee(e.windowSize),this.getO=re(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new te)):(this.getR=ie(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=re(e.stackBy),this.getGroup=re(e.groupBy),this.getColor=re(e.colorAccessor),this.getConnector=re(e.connectorAccessor),this.getDataId=re(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new ee(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=m().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=f().domain(s).range([o,n])}else a?(u=m().domain(r).range([0,e.height]).padding(c),d=f().domain(s).range([0,e.width])):(u=m().domain(r).range([0,e.width]).padding(c),d=f().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?f().domain([l,c]).range([0,e.width]):f().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=ye[this.config.chartType];let i=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(n,i);i=[...e,...i]}return i}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||le,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,fe.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=v().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let A=!1;const k=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,O);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(k.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),A=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("rect"===c.type)d?(k.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,A=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("wedge"===c.type)if(d)k.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,A=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),A=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!k.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(f=t.innerRadius)&&void 0!==f?f:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}A=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),A&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=ne(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=ne(o.x,e._targetX,s),e.y=ne(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=ne(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=ne(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=ne(n.x,e._targetX,s),e.y=ne(n.y,e._targetY,s),void 0!==n.w&&(e.w=ne(n.w,e._targetW,s),e.h=ne(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ne(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=ne(n.startAngle,e._targetStartAngle,s),e.endAngle=ne(n.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!oe(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!oe(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(oe(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=re(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!oe(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new te)):(this.getR=ie(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!oe(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?re(this.config.stackBy):void 0),"groupBy"in e&&!oe(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?re(this.config.groupBy):void 0),"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?re(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!oe(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?re(this.config.connectorAccessor):void 0)}}function me(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ve(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function be(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function xe(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>me(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function we(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=ve(Math.atan2(i,o)),a=ve(e.startAngle),l=ve(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Ae(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ke(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Oe(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function je(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}fe.QUADTREE_THRESHOLD=500;const Se={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function _e(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,Se[n])(o(e,t)),i}function Ce(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Me(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Pe=(n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=n,y=[];let f=0;const m=!(!o&&!i),v="isolate"===d||void 0===d&&null!=s;return p.forEach((n,d)=>{const b=_e(n,d,h,g),x=Me(n,r,s),w=s&&s.size>0&&s.has(n.label);y.push(e("g",{transform:`translate(0,${f})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?w||!1:void 0,"aria-current":m&&!v&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),f+=22}),y};function Le({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&t("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),t("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),t("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let e=0;64>=e;e++){const n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[l&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function Te(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical"}=n,[p,y]=o.useState(0),[f,m]=o.useState(0),v=o.useCallback((e,t)=>{y(e),m(t)},[]),b="vertical"===g?(({legendGroups:e,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,g)=>{d+=5,h.push(t("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,e.label&&(d+=16,h.push(t("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),d+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${d})`,children:Pe(e,o,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*e.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const p=[];n.forEach((n,o)=>{let y=0;n.label&&(y+=16);const f=((n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:p,items:y}=n,f=[];let m=0,v=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=s;y.forEach((n,d)=>{const w=_e(n,d,g,p),A=Me(n,r,s),k=s&&s.size>0&&s.has(n.label),O=26+7*n.label.length;h&&h>0&&m>0&&m+O>h&&(v++,m=0),f.push(e("g",{transform:`translate(${m},${22*v})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&d===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?k||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,k&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=O});let w=0,A=0;for(const e of y){const t=26+7*e.label.length;h&&h>0&&A>0&&A+t>h?(w=Math.max(w,A),A=t):A+=t}w=Math.max(w,A);const k=v+1;return{items:f,offset:w,totalRows:k,totalHeight:22*k}})(n,r,s,a,l,c,u,o,d,h,i);y+=f.offset+5,p.push(Object.assign(Object.assign({label:n.label},f),{offset:y,totalRows:f.totalRows,totalHeight:f.totalHeight})),g+=y+12});let y=g>i?0:Math.max(0,(i-g)/2);const f=[];return p.forEach((e,i)=>{const r=n[i];r.label&&(f.push(t("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),y+=16),f.push(t("g",{className:"legend-item",transform:`translate(${y},0)`,children:e.items},"legend-group-"+i)),y+=e.offset+5,n[i+1]&&f.push(t("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(e.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),t("g",{children:f})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}),x=!(!r&&!s);return e("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&t("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function Be(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ie(e){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=r.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=i-r.bottom+50):(p=o-r.right+10,y=r.top),t("g",{transform:`translate(${p}, ${y})`,children:(f=n,"object"==typeof f&&null!==f&&"gradient"in f?t(Le,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Be(n)?t(Te,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var f}function He(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Re(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function $e(n,o,i,r){if(!n)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===g?p="end":"middle"===g&&(p="middle"):p=0>o?"end":"start";const y=16,f=a?d?[a]:He(a,u):[],m=s?d?[s]:He(s,u):[],v="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(x.push(t("text",{className:"annotation-note-title",fill:w,textAnchor:p,fontWeight:"bold",children:f.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-title")),b=f.length*y),m.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:p,y:b,children:m.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-label"));let A=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const e=Math.min(u,120);let n=0,o=e;"end"===p?(n=-e,o=0):"middle"===p&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+m.length)*y+(m.length>0?y:0);let n=0,o=e;"bottom"===g?(n=-e,o=0):"middle"===g&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,f.length+m.length-1)*y;let O=0;return"topBottom"===h?O=0>i?-(k+2):18:"leftRight"===h&&(O="middle"===g?-(k+y+(m.length>0&&f.length>0?2:0))/2+8:"bottom"===g||0>i?-(k+2):18),e("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),A]})}function De(e,n,o,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-e;a.push(t("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(t("line",{x1:(n.x1||0)-e,y1:i,x2:(n.x2||0)-e,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(t("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==e&&a.push(t("path",{d:Re((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function Ne(e,n,o,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const t=s.width||0,o=s.height||0;if(t>0||o>0){const i=t/2,r=o/2,s=e-i,a=n-r;if(0!==s||0!==a){const e=Math.abs(s),n=Math.abs(a),u=t/2,d=o/2,h=e*d>n*u?u/e:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const o=Math.atan2(n,e);l=Math.cos(o)*t,c=Math.sin(o)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(n-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:a})}function We(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y,{children:[!m.has("connector")&&Ne(v,b,c,h,x,u),!m.has("subject")&&De(x,u,h,n,o),!m.has("note")&&$e(l,v,b,h)]}))}function Fe(e){var n,o;const{noteData:i}=e,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const e=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:e,ny:a});return t(We,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(We,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function ze(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ee(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function qe(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=ze(e,n),c=Ee(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ge(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ve={linear:X,monotoneX:V,monotoneY:G,step:q,stepAfter:E,stepBefore:z,basis:F,cardinal:W,catmullRom:N};function Xe(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=o,{rTickValues:p}=o,y="radial"===(null==u?void 0:u.projection),f="horizontal"===(null==u?void 0:u.projection),m=r(()=>!u||y?[]:(p||u.r.ticks(5)).map(e=>({value:e,pixel:u.r(e),label:(g||Ye)(e)})),[u,g,y,p]),v=h&&u&&!y,b=d&&u&&!y;return v||b?t("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${c.left},${c.top})`,children:[v&&t("g",{className:"ordinal-grid",children:m.map((e,n)=>t("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:i,y2:f?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),b&&t(n,{children:e(n,f?{children:[t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Ye(e){return Math.round(100*e)/100+""}function Qe(o){var i,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:p,showCategoryTicks:y,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:A,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:_="right",foregroundGraphics:C,annotations:M,svgAnnotationRules:P,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:I,children:H}=o,R="radial"===(null==g?void 0:g.projection),N="horizontal"===(null==g?void 0:g.projection),W=!1!==y,F=r(()=>p&&W&&g&&!R?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[p,W,g,v,R]),z=o.rTickValues,E=o.tickLabelEdgeAlign,q=r(()=>p&&g&&!R?(z||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||Ye)(e)})):[],[p,g,b,R,z]),G=s(new Map),V=s(null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0),Y=null!==(a=null==M?void 0:M.length)&&void 0!==a?a:0;V.current!==Y&&(V.current=Y,G.current=new Map);const U=r(()=>{if(!M||0===M.length)return null;const n=function(n,o,i){var r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j,S,_,C,M,P,L,T,B,I,H,R,N,W,F,z,E,q,G,V,Y,U,K,Z,J,ee,te,ne;switch(n.type){case"label":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=ze(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ee(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=$(r),a=n.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return e("g",{children:[t("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const e=i.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,o)=>{const r=ze(e,i),a=Ee(e,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const e=ze(n,i),r=Ee(n,i);return t(Fe,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",p=i.yAccessor||"y",y=h.map(e=>[e[g],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!f||!m)return null;const v=n.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(y,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?Q.polynomial(y,{order:n.order||2}):Q.linear(y)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=n.color||"#6366f1";return e("g",{children:[t("polyline",{points:x,fill:"none",stroke:w,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:f(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:w,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(p=i.scales)||void 0===p?void 0:p.value,s=null!==(y=null==r?void 0:r(n.y0))&&void 0!==y?y:0,a=null!==(f=null==r?void 0:r(n.y1))&&void 0!==f?f:i.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(w=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==w?w:null===(A=i.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ve[i.curve||"linear"]||X,p=D().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const y=n.fill||"#6366f1";return e("g",{children:[t("path",{d:p,fill:y,fillOpacity:null!==(k=n.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),n.label&&h.length>0&&t("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(j=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==j?j:null===(S=i.scales)||void 0===S?void 0:S.time,l=null!==(C=null===(_=i.scales)||void 0===_?void 0:_.y)&&void 0!==C?C:null===(M=i.scales)||void 0===M?void 0:M.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-g*h,y=!1!==n.showBand,f=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(T=n.anomalyRadius)&&void 0!==T?T:6,x=l(u+g*h),w=l(p),A=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return e("g",{children:[y&&t("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:f,fillOpacity:m}),A.map((e,n)=>{const o=ze(e,i),r=Ee(e,i);return null==o||null==r?null:t("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:f,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(I=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(H=i.scales)||void 0===H?void 0:H.time,c=null!==(N=null===(R=i.scales)||void 0===R?void 0:R.y)&&void 0!==N?N:null===(W=i.scales)||void 0===W?void 0:W.value;if(!l||!c)return null;const u=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=Q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;d=e=>a+s*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(h-2,1)),y=u.reduce((e,t)=>e+t[0],0)/h,f=u.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(F=n.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=n.steps)&&void 0!==z?z:5,x=u[h-1][0],w=(x-u[0][0])/Math.max(h-1,1),A=[];for(let e=1;b>=e;e++)A.push(x+e*w);const k=[];for(const e of A){const t=d(e),n=p*Math.sqrt(1+1/h+(f>0?Math.pow(e-y,2)/f:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${k.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,j=k.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),S=`${l(x)},${c(d(x))}`,_=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(E=n.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),t("polyline",{points:`${S} ${j}`,fill:"none",stroke:_,strokeWidth:null!==(q=n.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&k.length>0&&t("text",{x:l(k[k.length-1].x)+4,y:c(k[k.length-1].yCenter)-4,fill:_,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=qe(n,o,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ge(e,r,i))return null;const s=null!==(V=n.dx)&&void 0!==V?V:0,a=null!==(Y=n.dy)&&void 0!==Y?Y:0,l=null!==(U=n.width)&&void 0!==U?U:32,c=null!==(K=n.height)&&void 0!==K?K:32,u=null!==(Z=n.content)&&void 0!==Z?Z:t("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return e("g",(i.projection?"vertical"===i.projection:c===a)?{children:[t("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:g}),p&&t("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[t("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),p&&t("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o="horizontal"===(null==g?void 0:g.projection),i=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,r={scales:g?{x:o?g.r:i||g.r,y:o&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:l,height:c,data:B,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:G.current};return M.map((e,t)=>{if(P){const o=P(e,t,r);return null!=o?o:n(e,t,r)}return n(e,t,r)}).filter(Boolean)},[M,P,l,c,g,L,T,B]);return p||w||A||C||U&&U.length>0||x||H?e("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof w?w:"Ordinal Chart"}),t("desc",{children:"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"}),e("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!R&&!I&&t("g",{className:"ordinal-grid",children:q.map((e,n)=>t("line",{x1:N?e.pixel:0,y1:N?0:e.pixel,x2:N?e.pixel:l,y2:N?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),p&&g&&!R&&t("g",{className:"ordinal-axes",children:e(n,N?{children:[!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!I&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&l-1>e?t("line",{x1:e,y1:0,x2:e,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((n,o)=>{const i=E?0===o?"start":o===q.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)}),m&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m})]}:{children:[!I&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,n=0>e||e>c?c:e;return t("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((n,o)=>e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)),m&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:m})]})}),U,C,H]}),w&&t("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),Ie({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:_,title:w,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S})]}):null}function Ue({width:e,height:n,totalWidth:o,totalHeight:r,margin:a,scales:l,onBrush:c}){const u=s(null),d=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const p=s(!1),y=s(null),f="horizontal"===(null==l?void 0:l.projection),m=s(f);return m.current=f,i(()=>{if(!u.current)return;const t=U(u.current).select(".brush-g"),o=f?K():Z();return o.extent([[0,0],[e,n]]),o.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let i;i=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};y.current=r,h.current(r)}),t.call(o),d.current=o,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[e,n,f]),i(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=U(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),t("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Ke(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ze="undefined"==typeof window||"undefined"==typeof document,Je=o.createContext(null),et={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function tt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const nt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ot={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},it={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},rt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},st={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},at={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},lt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},ct={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function ut({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(Je),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=o.useRef(null),p=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,y=o.useCallback(()=>{l||d||c(!0)},[l,d]),f=o.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:et}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:y,style:et,role:"region","aria-label":p,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j;const S=[];if(!Array.isArray(e))return S;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":S.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=_.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=_.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(p=_.cy)&&void 0!==p?p:_.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=_.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=_.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(j=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${nt(e.min)} to ${nt(e.max)}, mean ${nt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const A=Array.from(w);return e("div",{ref:g,id:r,tabIndex:-1,onBlur:f,style:ot,role:"region","aria-label":p,children:[t("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:rt,children:"×"}),t("div",{role:"note",style:it,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:st,children:[e("caption",{style:ct,children:["First ",x.length," of ",m.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:at,children:"type"}),A.map(e=>t("th",{style:at,children:e},e))]})}),t("tbody",{children:x.map((n,o)=>e("tr",{children:[t("td",{style:lt,children:n.label}),A.map(e=>{return t("td",{style:lt,children:(o=n.values[e],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":nt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},e);var o})]},o))})]})]})}function dt({summary:e}){return e?t("div",{role:"note",style:et,children:e}):null}function ht({tableId:e}){return t("a",{href:"#"+e,style:et,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,et)},children:"Skip to data table"})}function gt({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:et,children:n})}const pt="var(--semiotic-focus, #005fcc)";function yt({active:e,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!e||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),n=Math.max(a,4);u=t("rect",{x:l-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"})}else u=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:pt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function ft({x:e,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=d?`translate(${d.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,t("div",{ref:u,className:l,style:{position:"absolute",left:s.left+e,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function mt(e){const n=a(null),o=vt(e);return[function({children:o}){const i=r(()=>vt(e),[]);return t(n.Provider,{value:i,children:o})},e=>{var t;const i=null!==(t=l(n))&&void 0!==t?t:o,r=s(e);r.current=e;const a=c(()=>r.current(i.getState()),[i]),d=c(()=>r.current(i.getState()),[i]);return u(i.subscribe,a,d)}]}function vt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function bt(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function xt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:wt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const wt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],At={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ot={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:wt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[jt,St]=mt(e=>({theme:At,setTheme(t){e(e=>{if("light"===t)return{theme:At};if("dark"===t)return{theme:kt};if("high-contrast"===t)return{theme:Ot};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?kt:At;return{theme:xt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:xt(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const _t=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ct=new WeakMap;let Mt=0,Pt=!1,Lt=null,Tt=null,Bt=null;function It(e,t){var n,o;if(!t)return t;const i=_t.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Pt=!0;const e=()=>{Mt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Lt=new MutationObserver(e),Lt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Tt=window.matchMedia("(prefers-color-scheme: dark)"),Bt=e,"function"==typeof Tt.addEventListener?Tt.addEventListener("change",Bt):"function"==typeof Tt.addListener&&Tt.addListener(Bt)}catch(e){}}();let s=Ct.get(r);s&&s.version===Mt||(s={version:Mt,map:new Map},Ct.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function Ht(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Rt(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=s(t);n.current=t;const[a,l]=function(e,t,n){const o=s(null),[r,a]=d(null);return i(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-u.left-u.right,g=l[1]-u.top-u.bottom,p=Ht(e.foregroundGraphics,l,u),y=Ht(e.backgroundGraphics,l,u),f=St(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=s(0),w=s(()=>{}),A=c(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=s(()=>{}),O=s(()=>{}),j=s(null),S=s(0),_=c(()=>{S.current=0;const e=j.current;j.current=null,e&&k.current(e)},[]),C=c(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(_))},[_]),M=c(()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),O.current()},[]);i(()=>()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const P=e.themeDirtyRef;return i(()=>{P&&(Mt++,P.current=!0,A())},[f,A,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:l,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:y,currentTheme:f,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:A,hoverHandlerRef:k,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:M}}function $t(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Dt(e,t,n=.3){$t(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Nt(e,t,n=.6){var o,i,r,s,a;if(!$t(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Wt(e,t,n,o=.35){$t(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ft(e,t,n){const o=t.fillGradient;if(!o)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const n=e.createLinearGradient(r,s,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const zt=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Et(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Dt(e,t),e.globalAlpha=1}};function Et(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const qt=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?It(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Nt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Gt(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Vt(e,t){const n=Y().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const Xt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Vt(e,t)):(Gt(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Gt(e,t),Wt(e,t)),e.globalAlpha=1}};const Yt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Qt=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=It(e,n.style.stroke)||("string"==typeof n.style.fill?It(e,n.style.fill):n.style.fill)||It(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function Ut(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Kt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Zt=null;function Jt(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Zt||(Zt=document.createElement("canvas")),Zt.width=e,Zt.height=e,Zt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const en=new Map;function tn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=en.get(n);if(void 0!==o)return o;const i=Jt({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return en.set(n,i),i}function nn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function on(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function rn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const sn=e=>[Qt,...e],an={bar:sn([zt]),clusterbar:sn([zt]),point:sn([qt]),swarm:sn([qt]),pie:[Xt],donut:[Xt],boxplot:sn([(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=It(e,"var(--semiotic-primary, #007bff)"),a=It(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?It(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?It(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},qt]),violin:sn([Yt]),histogram:sn([zt]),ridgeline:sn([Yt]),timeline:sn([zt]),funnel:[zt,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Ut(i):null!=r?`${Ut(i)} (${Kt(r)})`:Ut(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Ut(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[zt,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||It(e,"var(--semiotic-border, #999)"),o=tn(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=It(e,"var(--semiotic-text, #333)"),s=It(e,"var(--semiotic-text-secondary, #666)");for(const t of i){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,a=!(!0===n.__barFunnelIsFirstStep)&&null!=i,l=a?rn(i):"",c=on(o);e.font="bold 13px sans-serif";const u=a?e.measureText(l).width:0;e.font="11px sans-serif";const d=e.measureText(c).width,h=Math.max(u,d)+12,g=a?32:17,p=n.__barFunnelLabelX,y=p-h/2,f=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),nn(e,y,f,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),nn(e,y,f,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=r,e.fillText(l,p,f+3),e.font="11px sans-serif",e.fillStyle=s,e.fillText(c,p,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=r,e.fillText(c,p,f+3))}e.lineWidth=1}],swimlane:sn([zt])},ln={top:50,right:40,bottom:60,left:70},cn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function un({hover:n}){var o,i,r,s,a,l;const c=n.data||{},u=n.stats,d=n.category;if(Array.isArray(c)){const n=d||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(u)return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:["n = ",u.n]}),e("div",{children:["Min: ",u.min.toLocaleString()]}),e("div",{children:["Q1: ",u.q1.toLocaleString()]}),e("div",{children:["Median: ",u.median.toLocaleString()]}),e("div",{children:["Q3: ",u.q3.toLocaleString()]}),e("div",{children:["Max: ",u.max.toLocaleString()]}),e("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return e("div",{className:"semiotic-tooltip",style:cn,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===n.length&&e("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,p=n.__chartType;if("swarm"===p||"point"===p){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const y=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",f=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!y&&""===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e("div",{className:"semiotic-tooltip",style:cn,children:[y&&t("div",{style:{fontWeight:"bold"},children:y+""}),""!==f&&t("div",{children:"number"==typeof f?f.toLocaleString():f+""})]})}const dn=h(function(n,a){var l,u,h,p,y,f,m,v,b,x;const{chartType:w,runtimeMode:A,data:k,oAccessor:O="category",rAccessor:j="value",colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:P,valueAccessor:L,categoryAccessor:T,projection:B="vertical",size:I=[600,400],responsiveWidth:H,responsiveHeight:R,margin:$,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,rExtent:re,oExtent:se,extentPadding:ae=.05,oSort:le,windowMode:ce="sliding",windowSize:ue=200,pieceStyle:de,summaryStyle:he,colorScheme:ge,barColors:pe,showAxes:ye=!0,showCategoryTicks:ve,categoryLabel:Se,valueLabel:_e,categoryFormat:Ce,valueFormat:Me,oLabel:Pe,rLabel:Le,oFormat:Te,rFormat:Be,rTickValues:Ie,tickLabelEdgeAlign:He,enableHover:Re=!0,hoverAnnotation:$e,tooltipContent:De,customHoverBehavior:Ne,annotations:We,svgAnnotationRules:Fe,showGrid:ze=!1,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,backgroundGraphics:et,foregroundGraphics:nt,title:ot,className:it,background:rt,centerContent:st,decay:at,pulse:lt,transition:ct,animate:pt,staleness:mt,brush:vt,onBrush:xt,accessibleTable:wt=!0,description:At,summary:kt}=n,Ot=s(!0),jt=Rt({sizeProp:I,responsiveWidth:H,responsiveHeight:R,userMargin:$,marginDefault:ln,foregroundGraphics:nt,backgroundGraphics:et,animate:pt,transitionProp:ct,themeDirtyRef:Ot}),{reducedMotionRef:St,responsiveRef:_t,size:Ct,margin:Mt,adjustedWidth:Pt,adjustedHeight:Lt,resolvedForeground:Tt,resolvedBackground:Bt,currentTheme:It,transition:Ht,introEnabled:$t,tableId:Dt,rafRef:Nt,renderFnRef:Wt,scheduleRender:Ft}=jt,zt=null!=Se?Se:Pe,Et=null!=_e?_e:Le,qt=null!=Ce?Ce:Te,Gt=null!=Me?Me:Be,Vt=s(null),Xt=s(null),[Yt,Qt]=d(null),[Ut,Kt]=d(null),[Zt,Jt]=d(0),[en,tn]=d(!1),nn=Re||$e,on="streaming"===A,rn=r(()=>{var e,t,n;return{chartType:w,runtimeMode:on?"streaming":"bounded",windowSize:ue,windowMode:ce,extentPadding:ae,projection:B,oAccessor:on?void 0:O,rAccessor:on?void 0:j,colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:on?P:void 0,valueAccessor:on?L||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:on?T||O:void 0,rExtent:re,oExtent:se,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,oSort:le,pieceStyle:de,summaryStyle:he,colorScheme:ge,themeCategorical:null===(e=null==It?void 0:It.colors)||void 0===e?void 0:e.categorical,themeSemantic:bt(It),themeSequential:null===(t=null==It?void 0:It.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==It?void 0:It.colors)||void 0===n?void 0:n.diverging,barColors:pe,decay:at,pulse:lt,transition:Ht,introAnimation:$t,staleness:mt}},[w,ue,ce,ae,B,O,j,S,_,C,M,P,L,T,re,se,D,N,W,F,z,E,q,G,V,X,Q,U,K,Z,ee,te,ne,oe,ie,le,de,he,ge,pe,at,lt,null==Ht?void 0:Ht.duration,null==Ht?void 0:Ht.easing,$t,mt,on,It]),sn=s(null);sn.current||(sn.current=new fe(rn)),i(()=>{var e;null===(e=sn.current)||void 0===e||e.updateConfig(rn),Ot.current=!0,Ft()},[rn,Ft]);const cn=s(null);cn.current||(cn.current=new J(e=>{const t=sn.current;t&&t.ingest(e)&&(Ot.current=!0,Ft())}));const dn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.push(e)},[]),hn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.pushMany(e)},[]),gn=c(()=>{var e,t;null===(e=cn.current)||void 0===e||e.clear(),null===(t=sn.current)||void 0===t||t.clear(),Ot.current=!0,Ft()},[Ft]),pn=c(e=>{var t,n;null===(t=cn.current)||void 0===t||t.clearLastData(),null===(n=cn.current)||void 0===n||n.setReplacementData(e)},[]);g(a,()=>({push:dn,pushMany:hn,replace:pn,remove:e=>{var t,n,o,i;null===(t=cn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=sn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=Xt.current)||void 0===i?void 0:i.data;!!Xt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Xt.current=null,Qt(null)),Ot.current=!0,Ft()}return r},update:(e,t)=>{var n,o,i;null===(n=cn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=sn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ot.current=!0,Ft()),r},clear:gn,getData:()=>{var e,t,n;return null===(e=cn.current)||void 0===e||e.flush(),null!==(n=null===(t=sn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=sn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[dn,hn,pn,gn,Ft]),i(()=>{var e;k&&(null===(e=cn.current)||void 0===e||e.setBoundedData(k))},[k]);const{hoverHandlerRef:yn,hoverLeaveRef:fn,onPointerMove:mn,onPointerLeave:vn}=jt;yn.current=e=>{if(!nn)return;const t=Vt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,i=e.clientY-n.top-Mt.top;if(0>o||o>Pt||0>i||i>Lt)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const r=sn.current;if(!r||0===r.scene.length)return;const s="radial"===B,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,a=Math.sqrt(r*r+s*s);me(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":e=be(r,t,n);break;case"point":if(i)break;e=xe(r,t,n,o);break;case"wedge":e=we(r,t,n);break;case"boxplot":e=Ae(r,t,n);break;case"violin":e=ke(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Pt/2:o,s?i-Lt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;Xt.current=l,Qt(l),Ne&&(Ne(l),Ot.current=!0),Ft()},fn.current=()=>{Xt.current&&(Xt.current=null,Qt(null),Ne&&(Ne(null),Ot.current=!0),Ft())};const bn=s(-1),xn=s(null),wn=s(null),An=c(e=>{const t=sn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(wn.current&&wn.current.version===n)o=wn.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),wn.current={version:n,graph:o}}const i=bn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),bn.current=0;const t=o.flat[0];xn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},je(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});return Xt.current=n,Qt(n),Ne&&Ne(n),void Ft()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Oe(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Oe(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return bn.current=-1,xn.current=null,Xt.current=null,Qt(null),Ne&&Ne(null),void Ft();bn.current=s;const a=o.flat[s];xn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},je(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});Xt.current=l,Qt(l),Ne&&Ne(l),Ft()},[Ne,Ft]),kn=c(e=>{bn.current=-1,xn.current=null,mn(e)},[mn]);Wt.current=()=>{var e,t;Nt.current=0;const n=Vt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=sn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(St.current?r+1e6:r),a=!St.current&&s,l=Ot.current;l&&!s&&(i.computeScene({width:Pt,height:Lt}),Ot.current=!1),(l||a)&&n.setAttribute("aria-label",tt(i.scene,w+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=Ct[0]*c,d=Ct[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Ct[0]+"px",n.style.height=Ct[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Ct[0],Ct[1]);const h=null!==(e=null==mt?void 0:mt.threshold)&&void 0!==e?e:5e3,g=mt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==mt?void 0:mt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==rt&&!et){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=rt||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,Ct[0],Ct[1]))}const p="radial"===B;o.save(),o.beginPath(),o.rect(Mt.left,Mt.top,Pt,Lt),o.clip(),p?(o.save(),o.translate(Mt.left+Pt/2,Mt.top+Lt/2)):o.translate(Mt.left,Mt.top);const y=an[w]||[],f={width:Pt,height:Lt};for(const e of y)e(o,i.scene,i.scales,f);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Kt(i.scales),Jt(e=>e+1)),(null==mt?void 0:mt.showBadge)&&tn(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Wt.current()))},i(()=>(Ft(),()=>{var e;null===(e=cn.current)||void 0===e||e.clear()}),[Ft]),i(()=>{Ot.current=!0,Ft()},[w,Pt,Lt,ye,rt,Ft]),function(e,t,n,o,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(mt,sn,Ot,Ft,en,tn);const On=nn&&Yt?De?De(Yt):t(un,{hover:Yt}):null,jn="radial"===B,Sn=On?t(ft,{x:Yt?jn?Yt.x+Pt/2:Yt.x:0,y:Yt?jn?Yt.y+Lt/2:Yt.y:0,containerWidth:Pt,containerHeight:Lt,margin:Mt,className:"stream-ordinal-tooltip",children:On}):null;if(Ze){const n=sn.current;n&&k&&(n.ingest({inserts:k,bounded:!0}),n.computeScene({width:Pt,height:Lt}));const i=null!==(l=null==n?void 0:n.scene)&&void 0!==l?l:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,s="radial"===B,a=s?Mt.left+Pt/2:Mt.left,c=s?Mt.top+Lt/2:Mt.top;return e("div",{className:"stream-ordinal-frame"+(it?" "+it:""),role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:Ct[0],height:Ct[1]},children:[t(dt,{summary:kt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ct[0],height:Ct[1],style:{position:"absolute",left:0,top:0},children:[Bt&&t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt}),e("g",{transform:`translate(${a},${c})`,children:[rt&&t("rect",{x:0,y:0,width:Pt,height:Lt,fill:rt}),i.map((n,i)=>function(n,i){var r,s,a,l,c;const u=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",d=e=>`ord-${n.type}-${u}-${i}-${e}`,h=`ord-${n.type}-${u}-${i}`;switch(n.type){case"rect":{const i=n,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(e,n){const o=e.fillGradient;if(!o)return null;let i=e.x,r=e.y,s=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,s=e.x,a=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,s=e.x+e.w,a=e.y);const l=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let n=0;e.length>n;n++)l.push(t("stop",{offset:e[n].offset,stopColor:e[n].color},n))}else{const n=Ke(e.style.fill);l.push(t("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return t("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:Ke(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+u-n} A${n},${n} 0 0 0 ${r+n},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r+n},${l+u} A${n},${n} 0 0 1 ${r},${l+u-n} Z`;break;default:d=`M${r},${l+u} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u} Z`}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:d,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const e=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:Ke(e.style.fill),opacity:null!==(r=e.style.opacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}case"wedge":{const e=n,o=Y().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&o.cornerRadius(e.cornerRadius);const i=o({})||"";return t("path",{d:i,transform:`translate(${e.cx},${e.cy})`,fill:Ke(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const o=n,i=o.columnWidth/2;return e("g","vertical"===o.projection?{children:[t("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Ke(o.style.fill),fillOpacity:null!==(s=o.style.fillOpacity)&&void 0!==s?s:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Ke(o.style.fill),fillOpacity:null!==(a=o.style.fillOpacity)&&void 0!==a?a:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=n,o=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:Ke(e.style.fill),fillOpacity:null!==(l=e.style.fillOpacity)&&void 0!==l?l:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},d("path"))];if(e.iqrLine&&e.bounds){const n=e.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med"))):o.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med")))}return t("g",{children:o},h)}case"connector":return t("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(c=n.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=n,o=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:o,fill:Ke(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(n,i)).filter(Boolean)]})]}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:r,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,rTickValues:Ie,tickLabelEdgeAlign:He,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:0,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==n?void 0:n.getData()}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st})]})}return e("div",{ref:_t,className:"stream-ordinal-frame"+(it?" "+it:""),role:"group","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:H?"100%":Ct[0],height:R?"100%":Ct[1],overflow:"visible"},onKeyDown:An,children:[wt&&t(ht,{tableId:Dt}),wt&&t(ut,{scene:null!==(p=null===(h=sn.current)||void 0===h?void 0:h.scene)&&void 0!==p?p:[],chartType:w+" chart",tableId:Dt,chartTitle:"string"==typeof ot?ot:void 0}),t(dt,{summary:kt}),e("div",{role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?kn:void 0,onMouseLeave:nn?vn:void 0,children:[Bt&&t("svg",{style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt})}),t(Xe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showGrid:ze,rFormat:Gt,rTickValues:Ie}),t("canvas",{ref:Vt,"aria-label":tt(null!==(f=null===(y=sn.current)||void 0===y?void 0:y.scene)&&void 0!==f?f:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1]}}),t(gt,{hoverPoint:Yt}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:Zt,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(m=sn.current)||void 0===m?void 0:m.getData(),underlayRendered:!0}),(vt||xt)&&"radial"!==B&&t(Ue,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,onBrush:xt||(()=>{})}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st}),(null==mt?void 0:mt.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===mt.badgePosition?{top:4,left:4}:"bottom-left"===mt.badgePosition?{bottom:4,left:4}:"bottom-right"===mt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:en?"#dc3545":"#28a745",color:"white"}),children:en?"STALE":"LIVE"}),t(yt,{active:bn.current>=0,hoverPoint:Yt,margin:Mt,size:Ct,shape:null===(v=xn.current)||void 0===v?void 0:v.shape,width:null===(b=xn.current)||void 0===b?void 0:b.w,height:null===(x=xn.current)||void 0===x?void 0:x.h}),Sn]})]})});dn.displayName="StreamOrdinalFrame";const hn=a(null);function gn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function pn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[yn,fn]=mt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=pn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=pn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[mn,vn]=mt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let bn={positions:new Map};const xn=new Set;function wn(){for(const e of xn)e()}function An(e,t){const n=bn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}function kn(e){const t=p(),n=e.clientId||t,{name:o}=e,i=fn(e=>e.selections.get(o)),s=fn(e=>e.setClause),a=fn(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(gn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:c(()=>{a(o,n)},[a,o,n]),clientId:n}}function On(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const jn=a(!1);function Sn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):le[r%le.length];return{label:i+"",color:a}}),label:""}]}}function _n(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function Cn(){return St(e=>e.theme)}function Mn(){var e;const t=Cn(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Pn(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=se[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}function Ln(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}o.createContext(void 0);const Tn={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Bn(e,t,n){var o,i,r,s,a,l,c;const u=Tn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:In(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function In(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Hn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}const Rn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function $n(e,t){return"function"==typeof t?t(e):e[t]}function Dn(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Nn(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=$n(n,i);l=Dn(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=$n(n,o);c.push({label:t,value:Dn(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Dn(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Dn(n[e[0]],r))}}const u=Object.assign(Object.assign({},Rn),s);return e("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&t("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((t,n)=>e("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},n))]})}}function Wn(e){if(!0===e)return Nn();if("function"==typeof e){const n=e;return e=>{const o=n(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==o?null:t("div",{className:"semiotic-tooltip",style:Rn,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Nn(e):Nn())}function Fn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function zn(e,t){if(!t)return Fn(e);try{const n=t(e);return null==n?Fn(e):n}catch(t){return Fn(e)}}function En(e,t){return"function"==typeof t?t(e):e[t]}function qn({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const u=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=En(u,n),h=En(u,o),g=i?En(u,i):void 0;return e("div",{className:"semiotic-tooltip",style:Rn,children:[t("div",{style:{fontWeight:"bold"},children:Fn(d)}),t("div",{style:{marginTop:4},children:zn(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(p=i,"string"==typeof p?p:"value"),": ",Fn(g)]})]});var p}}function Gn({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return t("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400},children:[t("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&t("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Vn extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,n=this.state.error;return"function"==typeof e?e(n):void 0!==e?e:t(Gn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Xn(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Yn(e,t,n=3){let o,i=n+1;for(const n of t){const t=Xn(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function Qn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Un(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Yn(e,t,3))&&void 0!==n?n:null)}function Kn({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=Qn(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Un(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Zn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Jn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},eo={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},to=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],no=["vertical","horizontal"],oo={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:to},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:to},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:to},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),Jn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:no},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:no},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Zn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Zn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Zn),eo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Zn),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Zn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:no},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Zn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Zn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Zn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Zn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function io(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ro=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),so=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),ao=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),lo=new Set(["LineChart","AreaChart","StackedAreaChart"]),co=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function uo(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(n)+.7152*r(o)+.0722*r(i)}function ho(e,t){const n=uo(e),o=uo(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const go=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function po(e,t){const n=[],o=function(e,t){const n=[],o=oo[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(oo).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!io(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=Yn(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const s=Kn({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const n=Qn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Un(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return oo[e]?(function(e,t,n){const o=oo[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,i=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=oo[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){ro.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){so.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=oo[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!ao.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!lo.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,i;const r=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=oo[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!co.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=ho(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=ho(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of go)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var yo;const fo="undefined"!=typeof process&&"production"!==(null===(yo=process.env)||void 0===yo?void 0:yo.NODE_ENV);function mo({componentName:e,width:n,height:o,chartProps:i,children:r}){return t(Vn,{fallback:r=>{let s="";if(fo&&i)try{const t=po(e,i);t.ok||(s=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return t(Gn,{componentName:e,message:r.message,diagnosticHint:s,width:n,height:o})},children:r})}const vo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},bo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function xo(e,t,n,o){if(!fo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function wo(e){const{data:n,rawData:o,colorBy:s,colorScheme:a,legendInteraction:u,legendPosition:h,selection:g,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:A,marginDefaults:k,onClick:O,hoverHighlight:j,loading:S,emptyContent:_,width:C,height:M}=e,P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:L,hoverSelectionHook:T,customHoverBehavior:B,customClickBehavior:I,crosshairSourceId:H}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:s,chartType:a,chartId:l,onClick:u,hoverHighlight:h,colorByField:g}){const y=p(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=kn({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=kn({name:t});return{onHover:c(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||n||[]}),b=vn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=d(null),k=g||n[0],O=r(()=>{if(!h||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,k]),j=c(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=bn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n})},wn())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&An(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(h&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,f,y,s,a,l,b,h,k]),S=c(e=>{var t,n,o,i;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=bn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(bn.positions);return t.delete(e),bn={positions:t},wn(),!1}bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},wn()}(f.name||"hover",Number(n),y)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[u,s,b,a,l,f,y]);return i(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const n=bn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}(e,y),An(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:y}}({selection:g,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:j,colorByField:P}),R=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(y,H),$=function(e,t,n){const o=l(hn),i=Mn();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=de(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return de(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=de(e,t,s);return e=>o[e]||n(e)}return de(e,t,s)}if(o&&Object.keys(o).length>0){const e=de([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(n,s,a),D=r(()=>{if(!s)return[];const e=new Set;for(const t of n){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[n,s]),N=function(e,t,n){const[o,i]=d(null),[s,a]=d(new Set),l=c(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=c(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:u,legendSelectionHook:h}}(u,s,D),W=r(()=>T||(N.legendSelectionHook?N.legendSelectionHook:L),[T,N.legendSelectionHook,L]),F=function(e){const t=St(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(g),{legend:z,margin:E,legendPosition:q}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:c}){const u=l(jn),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(!d||!t)return;const o=Sn({data:e,colorBy:t,colorScale:n,getColor:ue,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),g=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return h&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,h,i]);return{legend:h,margin:g,legendPosition:i}}({data:n,colorBy:s,colorScale:$,showLegend:w,legendPosition:h,userMargin:A,defaults:k}),G=r(()=>{const e={};return z&&(e.legend=z,e.legendPosition=q),u&&"none"!==u&&(e.legendHoverBehavior=N.onLegendHover,e.legendClickBehavior=N.onLegendClick,e.legendHighlightedCategory=N.highlightedCategory,e.legendIsolatedCategories=N.isolatedCategories),e},[z,q,u,N.onLegendHover,N.onLegendClick,N.highlightedCategory,N.isolatedCategories]),V=function(e,n,o){if(!e)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),a=Math.floor((o-(i*(r+s)-s))/2);return t("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,o)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},bo),{position:"absolute",top:a+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}(S,C,M),X=V?null:function(e,n,o,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},vo),{width:n,height:o}),children:i||"No data available"}):null}(o,C,M,_);return{colorScale:$,allCategories:D,legendState:N,effectiveSelectionHook:W,activeSelectionHook:L,customHoverBehavior:B,customClickBehavior:I,legend:z,margin:E,legendPosition:q,earlyReturn:V||X||null,legendBehaviorProps:G,crosshairProps:R,resolvedSelection:F}}const Ao=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,roundedTop:b,gradientFill:x=!1,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=wo({data:Z,rawData:a,colorBy:y,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"BarChart",chartId:P,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:z,height:E});if(J.earlyReturn)return J.earlyReturn;xo("BarChart",Z,"categoryAccessor",u),xo("BarChart",Z,"valueAccessor",d);const ee=Ln(Z,m,d),te=Mn(),ne=r(()=>new Map,[Z]),oe=r(()=>(e,t)=>{const n={};return n.fill=y?ue(e,y,J.colorScale):Pn(H,te,f,void 0,ne),n},[y,J.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return Hn(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},oe(t,n)),e(t,n)||{}):oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>_n(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>qn({categoryAccessor:u,valueAccessor:d,groupAccessor:y&&y!==u?y:void 0,groupLabel:"string"==typeof y?y:"group",valueFormat:p}),[u,d,y,p]),ae=Kn({componentName:"BarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(Gn,{componentName:"BarChart",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:v}),null!=b&&{roundedTop:b}),x&&{gradientFill:!0===x?{topOpacity:.8,bottomOpacity:.05}:x}),F&&{dataIdAccessor:F}),{baselinePadding:w,enableHover:q,showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:p}),W&&{oFormat:W}),{showGrid:G,showCategoryTicks:N,oSort:m}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Wn(A)||se}),(S||_||C||M)&&{customHoverBehavior:J.customHoverBehavior}),(_||C||S)&&{customClickBehavior:J.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"BarChart",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});function ko({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:i="right"}){const a=s(new Set),l=s([]),[u,h]=d(0),g=c(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=c(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||a.current.has(t)||(a.current.add(t),l.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),y=c(e=>t=>{p([t]),e(t)},[p]),f=c(e=>t=>{p(t),e(t)},[p]),m=c(()=>{a.current=new Set,l.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!t||!1===o)return;const i=l.current;if(0===i.length)return;const r=Array.isArray(n)?n:le,s=new Map;for(let e=0;i.length>e;e++)s.set(i[e],r[e%r.length]);const a="string"==typeof t?t:"__streamCat";return Sn({data:i.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:ue})},[e,t,o,n,u]),b=r(()=>{if(v)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[v,i]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function Oo({ref:e,frameRef:t,isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const u=ko({isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a}),d=c(u.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[u.wrapPush]),h=c(u.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[u.wrapPushMany]);return g(e,()=>({push:d,pushMany:h,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;u.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[d,h,u.resetCategories]),{effectiveLegendProps:r(()=>u.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:u.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,u.streamingLegend,a]),effectiveMargin:r(()=>{if(u.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(u.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,u.streamingMarginAdjust])}}Ao.displayName="BarChart";const jo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,categoryFormat:N}=e,W=o.width,F=o.height,z=o.enableHover,E=o.showGrid,q=o.showLegend,G=o.title,V=o.description,X=o.summary,Y=o.accessibleTable,Q=o.categoryLabel,U=o.valueLabel,K=a||[],Z=y||d,J=void 0===a,ee=wo({data:K,rawData:a,colorBy:Z,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:W,height:F});if(ee.earlyReturn)return ee.earlyReturn;const te=Mn(),ne=r(()=>new Map,[K]),oe=r(()=>(e,t)=>Z?ee.colorScale?{fill:ue(e,Z,ee.colorScale)}:{}:{fill:Pn(H,te,f,t,ne)},[Z,ee.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return Hn(e&&"function"==typeof e?(t,n)=>{const o=oe(t,n),i=e(t,n)||{};return Object.assign(Object.assign({},o),i)}:oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>_n(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=r(()=>qn({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Kn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=Oo({ref:n,frameRef:i,isPushMode:J,colorBy:Z,colorScheme:f,showLegend:q,legendPosition:I,setup:ee}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[W,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:p}),N&&{oFormat:N}),{showGrid:E}),le),G&&{title:G}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Wn(A)||se}),(S||_||C||M)&&{customHoverBehavior:ee.customHoverBehavior}),(_||C||S)&&{customClickBehavior:ee.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?t(Gn,{componentName:"StackedBarChart",message:ae,width:W,height:F}):t(mo,{componentName:"StackedBarChart",width:W,height:F,children:t(dn,Object.assign({ref:i},de))})});jo.displayName="StackedBarChart";const So=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.showLegend,q=o.title,G=o.description,V=o.summary,X=o.accessibleTable,Y=o.categoryLabel,Q=o.valueLabel,U=a||[],K=y||d,Z=void 0===a,J=wo({data:U,rawData:a,colorBy:K,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"GroupedBarChart",chartId:M,showLegend:E,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=Mn(),te=r(()=>new Map,[U]),ne=k.pieceStyle,oe=r(()=>(e,t)=>{const n=K?J.colorScale?{fill:ue(e,K,J.colorScale)}:{}:{fill:Pn(I,ee,f,t,te)};if(ne){const o=ne(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[K,J.colorScale,I,ee,f,te,ne]),ie=r(()=>Hn(oe,{stroke:H,strokeWidth:R,opacity:$}),[oe,H,R,$]),re=r(()=>_n(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>qn({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Kn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=Oo({ref:n,frameRef:i,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:E,legendPosition:B,setup:J}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:U}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Y,rLabel:Q,rFormat:p}),D&&{oFormat:D}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Wn(w)||se}),(j||S||_||C)&&{customHoverBehavior:J.customHoverBehavior}),(S||_||j)&&{customClickBehavior:J.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?t(Gn,{componentName:"GroupedBarChart",message:ae,width:N,height:W}):t(mo,{componentName:"GroupedBarChart",width:N,height:W,children:t(dn,Object.assign({ref:i},de))})});function _o({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const i=(a="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=kn({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=c(e=>{if(!e)return void l();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&On(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&On(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,n,o,a,l]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof o?o:"value")}),u=s(l.brushInteraction);u.current=l.brushInteraction;const d=c(e=>{if(i){u.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||n||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}So.displayName="GroupedBarChart";const Co=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:W,showCategoryTicks:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.showLegend,X=o.title,Y=o.description,Q=o.summary,U=o.accessibleTable,K=o.categoryLabel,Z=o.valueLabel,J=a||[],ee=y||d,te=void 0===a,ne=r(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(J.map(e=>"function"==typeof u?u(e):e[u])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?E:z)-2*n)/(n-1))):1},[m,e.mode,J,u,g,z,E]),oe=wo({data:J,rawData:a,colorBy:ee,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"SwimlaneChart",chartId:M,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:z,height:E}),ie=_o({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(oe.earlyReturn)return oe.earlyReturn;const re=Mn(),se=r(()=>new Map,[J]),ae=k.pieceStyle,le=r(()=>(e,t)=>{const n=ee?oe.colorScale?{fill:ue(e,ee,oe.colorScale)}:{}:{fill:Pn(I,re,f,t,se)};if(ae){const o=ae(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[ee,oe.colorScale,I,re,f,se,ae]),ce=r(()=>Hn(le,{stroke:H,strokeWidth:R,opacity:$}),[le,H,R,$]),de=r(()=>_n(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),he=r(()=>qn({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ge=Kn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:pe,effectiveMargin:ye}=Oo({ref:n,frameRef:i,isPushMode:te,colorBy:ee,colorScheme:f,showLegend:V,legendPosition:B,setup:oe}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:J}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:ne,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===F?void 0:K,rLabel:Z,rFormat:p}),N&&{rTickValues:N}),null!=W&&{tickLabelEdgeAlign:W}),D&&{oFormat:D}),void 0!==F&&{showCategoryTicks:F}),{showGrid:G}),pe),X&&{title:X}),Y&&{description:Y}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Wn(v)||he}),(j||S||_||C)&&{customHoverBehavior:oe.customHoverBehavior}),(S||_||j)&&{customClickBehavior:oe.customClickBehavior}),b&&b.length>0&&{annotations:b}),ie.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?t(Gn,{componentName:"SwimlaneChart",message:ge,width:z,height:E}):t(mo,{componentName:"SwimlaneChart",width:z,height:E,children:t(dn,Object.assign({ref:i},fe))})});Co.displayName="SwimlaneChart";const Mo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,brush:O,onBrush:j,linkedBrush:S,frameProps:_={},selection:C,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,chartId:B,loading:I,emptyContent:H,legendInteraction:R,legendPosition:$,color:D,stroke:N,strokeWidth:W,opacity:F,showCategoryTicks:z,categoryFormat:E}=e,q=o.width,G=o.height,V=o.enableHover,X=o.showGrid,Y=o.title,Q=o.description,U=o.summary,K=o.accessibleTable,Z=o.categoryLabel,J=o.valueLabel,ee=a||[],te=wo({data:ee,rawData:a,colorBy:y,colorScheme:f,legendInteraction:R,legendPosition:$,selection:C,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:B,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:I,emptyContent:H,width:q,height:G}),ne=_o({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:d});if(te.earlyReturn)return te.earlyReturn;const oe=r(()=>{if(!m)return;const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m]),ie=Mn(),re=r(()=>new Map,[ee]),se=_.pieceStyle,ae=r(()=>(e,t)=>{const n={fillOpacity:x};if(n.fill=y?ue(e,y,te.colorScale):Pn(D,ie,f,void 0,re),n.r=m?function(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,m,v,oe):b,se){const o=se(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[y,te.colorScale,m,v,oe,b,x,D,ie,f,re,se]),le=r(()=>Hn(ae,{stroke:N,strokeWidth:W,opacity:F}),[ae,N,W,F]),ce=r(()=>_n(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),de=r(()=>qn({categoryAccessor:u,valueAccessor:d,groupAccessor:y||void 0,valueFormat:p}),[u,d,y,p]),he=Kn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(he)return t(Gn,{componentName:"SwarmPlot",message:he,width:q,height:G});const ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[q,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:w,enableHover:V}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:J,rFormat:p}),E&&{oFormat:E}),{showGrid:X,showCategoryTicks:z}),te.legendBehaviorProps),Y&&{title:Y}),Q&&{description:Q}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Wn(A)||de}),(M||P||L||T)&&{customHoverBehavior:te.customHoverBehavior}),(P||L||M)&&{customClickBehavior:te.customClickBehavior}),k&&k.length>0&&{annotations:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"SwarmPlot",width:q,height:G,children:t(dn,Object.assign({ref:i},ge))})});function Po(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",s=o.stats||(o.data||o).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Rn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e("div",{children:["n = ",s.n]}),null!=s.min&&e("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e("div",{children:["Q1: ",s.q1.toLocaleString()]}),e("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,s=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return e("div",{className:"semiotic-tooltip",style:Rn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&e("div",{children:["n = ",a]}),null!=l&&e("div",{children:["Median: ",l.toLocaleString()]})]})}return t("div",{className:"semiotic-tooltip",style:Rn,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}Mo.displayName="SwarmPlot";const Lo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:B,strokeWidth:I,opacity:H,showCategoryTicks:R,categoryFormat:$}=e,D=o.width,N=o.height,W=o.enableHover,F=o.showGrid,z=o.title,E=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=a||[],Q=wo({data:Y,rawData:a,colorBy:y,colorScheme:f,legendInteraction:P,legendPosition:L,selection:A,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"BoxPlot",chartId:_,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:C,emptyContent:M,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Mn(),K=r(()=>new Map,[Y]),Z=r(()=>e=>{const t=y?ue(e,y,Q.colorScale):Pn(T,U,f,void 0,K);return{fill:t,stroke:t,fillOpacity:.8}},[y,Q.colorScale,T,U,f,K]),J=r(()=>Hn(Z,{stroke:B,strokeWidth:I,opacity:H}),[Z,B,I,H]),ee=r(()=>_n(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=r(()=>Po(),[]),ne=Kn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return t(Gn,{componentName:"BoxPlot",message:ne,width:D,height:N});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:Y}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:m,size:[D,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:W}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:p}),$&&{oFormat:$}),{showGrid:F,showCategoryTicks:R}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===b?()=>null:Wn(b)||te}),(k||O||j||S)&&{customHoverBehavior:Q.customHoverBehavior}),(O||j||k)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"BoxPlot",width:D,height:N,children:t(dn,Object.assign({ref:i},oe))})});Lo.displayName="BoxPlot";const To=h(function(n,o){const i=Bn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",bins:p=25,relative:y=!1,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=n,z=i.width,E=i.height,q=i.enableHover,G=i.showGrid,V=i.title,X=i.description,Y=i.summary,Q=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Z=l||[],J=wo({data:Z,rawData:l,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=_o({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=r(()=>{if(0===Z.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of Z){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[Z,h]),ne=Mn(),oe=r(()=>new Map,[Z]),ie=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Pn(R,ne,v,void 0,oe);return{fill:t,stroke:t,fillOpacity:.8}},[m,J.colorScale,R,ne,v,oe]),re=r(()=>Hn(ie,{stroke:$,strokeWidth:D,opacity:N}),[ie,$,D,N]),se=r(()=>_n(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return e("div",{className:"semiotic-tooltip",style:Rn,children:[i&&t("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&e("div",{children:["Count: ",r]}),s&&2===s.length&&e("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=Kn({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return t(Gn,{componentName:"Histogram",message:le,width:z,height:E});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:p,normalize:y}),te&&{rExtent:te}),{size:[z,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:Wn(x)||ae}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"Histogram",width:z,height:E,children:t(dn,Object.assign({ref:a},ce))})});To.displayName="Histogram";const Bo=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=wo({data:Z,rawData:a,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=_o({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:d});if(J.earlyReturn)return J.earlyReturn;const te=Mn(),ne=r(()=>new Map,[Z]),oe=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Pn(R,te,v,void 0,ne);return{fill:t,stroke:t,fillOpacity:.6}},[m,J.colorScale,R,te,v,ne]),ie=r(()=>Hn(oe,{stroke:$,strokeWidth:D,opacity:N}),[oe,$,D,N]),re=r(()=>_n(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Po({valueAccessor:d}),[d]),ae=Kn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(Gn,{componentName:"ViolinPlot",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:p,showIQR:y,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Wn(x)||se}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"ViolinPlot",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});Bo.displayName="ViolinPlot";const Io=h(function(e,n){var o;const i=Bn(e.mode,{width:e.width,height:e.height,showGrid:null===(o=e.showGrid)||void 0===o||o,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null);g(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.title,q=i.description,G=i.summary,V=i.accessibleTable,X=i.categoryLabel,Y=i.valueLabel,Q=l||[],U=wo({data:Q,rawData:l,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"DotPlot",chartId:M,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Ln(Q,v,h),Z=Mn(),J=r(()=>new Map,[Q]),ee=k.pieceStyle,te=r(()=>(e,t)=>{const n={r:b,fillOpacity:.8};if(n.fill=f?ue(e,f,U.colorScale):Pn(I,Z,m,void 0,J),ee){const o=ee(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[f,U.colorScale,b,I,Z,m,J,ee]),ne=r(()=>Hn(te,{stroke:H,strokeWidth:R,opacity:$}),[te,H,R,$]),oe=r(()=>_n(ne,U.effectiveSelectionHook,U.resolvedSelection),[ne,U.effectiveSelectionHook,U.resolvedSelection]),ie=r(()=>qn({categoryAccessor:d,valueAccessor:h,valueFormat:y}),[d,h,y]),re=Kn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return t(Gn,{componentName:"DotPlot",message:re,width:N,height:W});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:y}),D&&{oFormat:D}),{showGrid:z,oSort:v}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),u&&{className:u}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Wn(w)||ie}),(j||S||_||C)&&{customHoverBehavior:U.customHoverBehavior}),(S||_||j)&&{customClickBehavior:U.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"DotPlot",width:N,height:W,children:t(dn,Object.assign({ref:a},se))})});Io.displayName="DotPlot";const Ho=h(function(e,n){var o,i;const a=Bn(e.mode,{width:null!==(o=e.width)&&void 0!==o?o:400,height:null!==(i=e.height)&&void 0!==i?i:400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks}),l=s(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=a.width,R=a.height,$=a.enableHover,D=a.showLegend,N=a.title,W=a.description,F=a.summary,z=a.accessibleTable,E=c||[],q=p||h,G=void 0===c,V=wo({data:E,rawData:c,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"PieChart",chartId:S,showLegend:D,userMargin:u,marginDefaults:a.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=Mn(),Y=r(()=>new Map,[E]),Q=r(()=>(e,t)=>q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Pn(L,X,y,t,Y)},[q,V.colorScale,L,X,y,Y]),U=r(()=>{const e=null==x?void 0:x.pieceStyle;return Hn(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Q(t,n)),e(t,n)||{}):Q,{stroke:T,strokeWidth:B,opacity:I})},[Q,x,T,B,I]),K=r(()=>_n(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),Z=r(()=>qn({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),J=Kn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=Oo({ref:n,frameRef:l,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:E}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,startAngle:f}),null!=m&&{cornerRadius:m}),{size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Wn(v)||Z}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(Gn,{componentName:"PieChart",message:J,width:H,height:R}):t(mo,{componentName:"PieChart",width:H,height:R,children:t(dn,Object.assign({ref:l},ne))})});Ho.displayName="PieChart";const Ro=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=o.width,R=o.height,$=o.enableHover,D=o.showLegend,N=o.title,W=o.description,F=o.summary,z=o.accessibleTable,E=a||[],q=p||u,G=void 0===a,V=wo({data:E,rawData:a,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"DonutChart",chartId:S,showLegend:D,userMargin:l,marginDefaults:o.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(H,R)),Y=Mn(),Q=r(()=>new Map,[E]),U=x.pieceStyle,K=r(()=>(e,t)=>{let n;if(n=q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Pn(L,Y,y,t,Q)},U){const o=U(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[q,V.colorScale,L,Y,y,Q,U]),Z=r(()=>Hn(K,{stroke:T,strokeWidth:B,opacity:I}),[K,T,B,I]),J=r(()=>_n(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=r(()=>qn({categoryAccessor:u,valueAccessor:d,groupAccessor:p&&p!==u?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[u,d,p]),te=Kn({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:ne,effectiveMargin:oe}=Oo({ref:n,frameRef:i,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:E}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:f}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ne),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Wn(v)||ee}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?t(Gn,{componentName:"DonutChart",message:te,width:H,height:R}):t(mo,{componentName:"DonutChart",width:H,height:R,children:t(dn,Object.assign({ref:i},ie))})});Ro.displayName="DonutChart";const $o=h(function(n,o){const i=Bn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),a=s(null),l="context"===n.mode,{compactMode:c}=i,{value:u,min:d=0,max:h=100,thresholds:g,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!c,sweep:A=240,fillZones:k=!0,tooltip:O,annotations:j,frameProps:S={},className:_,stroke:C,strokeWidth:M,opacity:P}=n,L=i.width,T=i.height,B=i.title,I=i.description,H=i.summary,R=i.accessibleTable,$=Math.max(d,Math.min(h,u)),D=h-d||1,N=($-d)/D,{gaugeData:W,pieceStyle:F,gaugeAnnotations:z}=r(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:p||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let i=d;for(let n=0;o.length>n;n++){const r=o[n],s=(r.value-i)/D;if(k){const o=(i-d)/D,a=Math.max(0,Math.min(N,(r.value-d)/D)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:r.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:y,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}i=r.value}if(w&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:y},gaugeAnnotations:n}},[u,d,h,g,p,y,N,D,w,k]),E=r(()=>Hn(F,{stroke:C,strokeWidth:M,opacity:P}),[F,C,M,P]),q=A*Math.PI/180,G=180+(360-A)/2,V=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+G*Math.PI/180,Y=[[Math.cos(X),Math.sin(X)],[Math.cos(X+q),Math.sin(X+q)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>q+.001||Y.push([Math.cos(e),Math.sin(e)]);const Q=Math.min(...Y.map(e=>e[0])),U=Math.max(...Y.map(e=>e[0])),K=Math.min(...Y.map(e=>e[1])),Z=Math.max(...Y.map(e=>e[1])),J=(K+Z)/2,ee=(Q+U)/2,te=Math.max(4,Math.min((L-2*V)/(U-Q),(T-2*V)/(Z-K))-2),ne=Math.max(0,Math.min(te-1.5,te*(1-f))),oe=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b($,d,h):b;const n=x?x($):Math.round($)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),w&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[b,$,d,h,x,w,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x($):Math.round($)+""}:null,[l,b,$,x]),le=r(()=>{if(!m)return null;const e=-Math.PI/2+G*Math.PI/180+N*q,t=ne>20?ne-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,N,G,q,ne,v]),ce=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-ne),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return e("g",{transform:`translate(${r},${s})`,children:[t("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const e=-Math.PI/2+G*Math.PI/180+(n.value-d)/D*q,r=ne-14,s=(i.height||T)/2;return t("text",{x:(i.width||L)/2+Math.cos(e)*r,y:s+Math.sin(e)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label},"gauge-label-"+o)}return"gauge-value"===n.type?t("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*ne,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[L,T,d,D,G,q,ne,te]),ue=r(()=>{const e=[...z,...j||[]];return le&&e.push(le),ae&&e.push(ae),e},[z,j,le,ae]),de=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return e("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[t("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),t("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round($):"Remaining"})]})},[$]);if(0===W.length)return t(Gn,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:ne,startAngle:G,sweepAngle:A,centerContent:se,size:[L,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:oe-re/2,right:L-oe-re/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Wn(O)||de,svgAnnotationRules:ce},ue.length>0&&{annotations:ue}),B&&{title:B}),I&&{description:I}),H&&{summary:H}),void 0!==R&&{accessibleTable:R}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),S);return t(mo,{componentName:"GaugeChart",width:L,height:T,children:t(dn,Object.assign({ref:a},he))})});$o.displayName="GaugeChart";const Do=h(function(e,n){const o=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.title,q=o.description,G=o.summary,V=o.accessibleTable,X=o.categoryLabel,Y=o.valueLabel,Q=a||[],U=wo({data:Q,rawData:a,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"RidgelinePlot",chartId:C,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:M,emptyContent:P,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Mn(),Z=r(()=>new Map,[Q]),J=r(()=>e=>{const t=m?ue(e,m,U.colorScale):Pn(B,K,v,void 0,Z);return{fill:t,stroke:t,fillOpacity:.5}},[m,U.colorScale,B,K,v,Z]),ee=r(()=>Hn(J,{stroke:I,strokeWidth:H,opacity:R}),[J,I,H,R]),te=r(()=>_n(ee,U.effectiveSelectionHook,U.resolvedSelection),[ee,U.effectiveSelectionHook,U.resolvedSelection]),ne=r(()=>Po(),[]),oe=Kn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return t(Gn,{componentName:"RidgelinePlot",message:oe,width:N,height:W});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:Q}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:p,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:b,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:f}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:$,oSort:!1,amplitude:y}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Wn(x)||ne}),(O||j||S||_)&&{customHoverBehavior:U.customHoverBehavior}),(j||S||O)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"RidgelinePlot",width:N,height:W,children:t(dn,Object.assign({ref:i},ie))})});Do.displayName="RidgelinePlot";const No=h(function(n,o){const i=Bn(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:p,colorBy:y,colorScheme:f,orientation:m="horizontal",connectorOpacity:v=.3,showLabels:b=!0,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,categoryFormat:$}=n,D="vertical"===m,N=i.width,W=i.height,F=i.enableHover,z=i.title,E=i.description,q=i.summary,G=i.accessibleTable,V=l||[],X=y||p,Y=!X,Q=wo({data:V,rawData:l,colorBy:X,colorScheme:f,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"FunnelChart",chartId:C,showLegend:i.showLegend,userMargin:c,marginDefaults:D?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:P,width:N,height:W});if(Q.earlyReturn)return Q.earlyReturn;xo("FunnelChart",V,"stepAccessor",d),xo("FunnelChart",V,"valueAccessor",h);const U=Mn(),K=r(()=>new Map,[V]),Z=r(()=>{if(Y)return B||((null==U?void 0:U[0])?U[0]:Array.isArray(f)&&f[0]?f[0]:"#4e79a7")},[Y,B,U,f]),J=A.pieceStyle,ee=r(()=>(e,t)=>{const n={};if(n.fill=Z||(X?ue(e,X,Q.colorScale):Pn(B,U,f,t,K)),J){const o=J(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Z,X,Q.colorScale,B,U,f,K,J]),te=r(()=>Hn(ee,{stroke:I,strokeWidth:H,opacity:R}),[ee,I,H,R]),ne=r(()=>_n(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,p=null==c?void 0:c.__barFunnelIsDropoff,y=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,f=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return e("div",{className:"semiotic-tooltip",style:Rn,children:[u&&t("div",{style:{fontWeight:"bold"},children:u+""}),y&&y!==u&&t("div",{style:{marginTop:2,opacity:.8},children:y+""}),p&&t("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e("div",{style:{marginTop:4},children:[d+"",f]})]})},[]),ie=Kn({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(ie)return t(Gn,{componentName:"FunnelChart",message:ie,width:N,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:D?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:d,rAccessor:h}),p&&{stackBy:p}),{projection:D?"vertical":"horizontal",barPadding:D?40:0,pieceStyle:ne,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:D,showCategoryTicks:D}),$&&{oFormat:$}),{showGrid:D}),!D&&{connectorOpacity:v}),{showLabels:b}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:!0===x||null==x?oe:Wn(x)||oe}),(O||j||S||_)&&{customHoverBehavior:Q.customHoverBehavior}),(j||S||O)&&{customClickBehavior:Q.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(mo,{componentName:"FunnelChart",width:N,height:W,children:t(dn,Object.assign({ref:a},re))})});No.displayName="FunnelChart";const Wo={RdBu:H,PiYG:I,PRGn:B,BrBG:T,RdYlBu:L,RdYlGn:P,Spectral:M},Fo="__likert_neutral_neg",zo="__likert_neutral_pos";function Eo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function qo(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function Go(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Fo,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:zo,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Vo(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===Fo?r=n:n.__likertLevel===zo?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Xo=h(function(e,n){const i=Bn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null),{data:l,margin:u,className:d,categoryAccessor:h="question",valueAccessor:p,levelAccessor:y,countAccessor:f="count",levels:m,orientation:v="horizontal",colorScheme:b,barPadding:x=20,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,valueFormat:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,categoryFormat:H,stroke:R,strokeWidth:$,opacity:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.showLegend,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,Q=i.valueLabel,U="horizontal"===v,K=void 0===l,Z=!y,J=function(){var e;const t=Cn();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ee=r(()=>b&&Array.isArray(b)&&b.length>=m.length?b:function(e,t){if(0>=e)return[];if(t){const n=Wo[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(m.length,J),[b,m.length,J]),te=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],ee[t]||"#888");return e},[m,ee]),{processedData:ne,reAggregate:oe,accumulatorRef:ie}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:u}){const d=!i,h=r(()=>Eo(n,"question"),[n]),g=r(()=>d?Eo(o,"score"):null,[d,o]),p=r(()=>d?null:Eo(i,"level"),[d,i]),y=r(()=>d?null:Eo(a,"count"),[d,a]),f=e||[],m=s([]),v=r(()=>{if(0===f.length)return[];let e=qo(f,t,h,g,p,y);return l&&(e=Go(e,t),e=Vo(e,t)),e},[f,t,h,g,p,y,l]),b=c(e=>{var n;let o=qo(e,t,h,g,p,y);l&&(o=Go(o,t),o=Vo(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,p,y,l,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:m,categoryAccessor:h,valueAccessor:p,levelAccessor:y,countAccessor:f,isDiverging:U,frameRef:a}),re="__likertLevelLabel",se=ko({isPushMode:K,colorBy:re,colorScheme:ee,showLegend:E,legendPosition:I}),ae=c(se.wrapPush(e=>{ie.current.push(e),oe(ie.current)}),[se.wrapPush,oe,ie]),le=c(se.wrapPushMany(e=>{ie.current.push(...e),oe(ie.current)}),[se.wrapPushMany,oe,ie]);g(n,()=>({push:ae,pushMany:le,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ie.current=[],se.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ae,le,se.resetCategories,ie]);const ce=wo({data:ne,rawData:l,colorBy:re,colorScheme:ee,legendInteraction:B,legendPosition:I,selection:O,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"LikertChart",chartId:M,showLegend:E,userMargin:u,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:N,height:W});if(ce.earlyReturn)return ce.earlyReturn;const ue=r(()=>{const e=m.length;return e%2!=0&&te.get(m[Math.floor(e/2)])||"#888"},[m,te]),de=k.pieceStyle,he=r(()=>(e,t)=>{var n,o;const i=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),r=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let s;if(r===Fo||r===zo)s={fill:ue};else{const e=i||r;s=e&&te.has(e)?{fill:te.get(e)}:{fill:"#888"}}if(de){const n=de(e,t);n.stroke&&(s.stroke=n.stroke),null!=n.strokeWidth&&(s.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(s.strokeOpacity=n.strokeOpacity)}return s},[te,ue,de]),ge=r(()=>Hn(he,{stroke:R,strokeWidth:$,opacity:D}),[he,R,$,D]),pe=r(()=>_n(ge,ce.effectiveSelectionHook,ce.resolvedSelection),[ge,ce.effectiveSelectionHook,ce.resolvedSelection]),ye=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),fe=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===Fo||n===zo?ye:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===Fo||n===zo?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:Rn},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ye]),me=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!f)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Z?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),f&&(e.countAccessor=f)),Kn({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:m}})},[l,h,p,y,f,m,Z]),ve=r(()=>[{styleFn:e=>({fill:te.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,te]),be=r(()=>!1!==E?Object.assign(Object.assign({},ce.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:I||ce.legendPosition||"bottom"}):ce.legendBehaviorProps,[ce.legendBehaviorProps,ce.legendPosition,I,E,ve]),xe=r(()=>{const e=Object.assign({},ce.margin);if(K&&!1!==E){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(se.streamingMarginAdjust)for(const[t,n]of Object.entries(se.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[ce.margin,se.streamingMarginAdjust,U,K,E,I]),we=r(()=>P||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,P]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:ne}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:pe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q||(U?void 0:"Percentage"),rFormat:we}),H&&{oFormat:H}),{showGrid:z}),be),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:!0===w?fe:Wn(w)||fe}),(j||S||_||C)&&{customHoverBehavior:ce.customHoverBehavior}),(S||_||j)&&{customClickBehavior:ce.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return me?t(Gn,{componentName:"LikertChart",message:me,width:N,height:W}):t(mo,{componentName:"LikertChart",width:N,height:W,children:t(dn,Object.assign({ref:a},Ae))})});Xo.displayName="LikertChart";export{Ao as BarChart,Lo as BoxPlot,Ro as DonutChart,Io as DotPlot,No as FunnelChart,$o as GaugeChart,So as GroupedBarChart,To as Histogram,Xo as LikertChart,Ho as PieChart,Do as RidgelinePlot,jo as StackedBarChart,dn as StreamOrdinalFrame,Mo as SwarmPlot,Co as SwimlaneChart,Bo as ViolinPlot,Jt as createHatchPattern};
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useEffect as i,useMemo as r,useRef as s,useState as a,useSyncExternalStore as l,useLayoutEffect as c,useContext as d,useCallback as u,createContext as h,forwardRef as g,useImperativeHandle as f,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as v,scaleBand as m}from"d3-scale";import{quadtree as b}from"d3-quadtree";import{quantile as x}from"d3-array";import{packEnclose as w}from"d3-hierarchy";import{area as k,curveCatmullRom as A,curveCardinal as O,curveBasis as S,curveStepBefore as j,curveStepAfter as _,curveStep as M,curveMonotoneY as C,curveMonotoneX as P,curveLinear as L,arc as T}from"d3-shape";import H from"regression";import{select as B}from"d3-selection";import{brushX as I,brushY as R}from"d3-brush";const F=Object.freeze([]);function W(e){if(!e)return F;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class D{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n: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(e=W(e),this.lastBoundedData===e)return;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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=W(e),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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}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){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class ${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 o of e){const e=this.push(o);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 o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.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 o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}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 z{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(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 o of e){const e=t?t(o):o;Number.isFinite(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 N(e,t,o){return e+(t-e)*o}function E(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function G(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function V(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function X(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Y(e){const t=e.map(V),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return X(e,o,n)}if(e>=1){const[e,n,i]=t[o];return X(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,d,u]=t[i+1];return X(Math.round(s+(c-s)*r),Math.round(a+(d-a)*r),Math.round(l+(u-l)*r))}}const Q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],K=Y(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Z=Y(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),U=Y(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),J=Y(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ee=Y(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);Y(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const te=Y(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oe=Y(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);Y(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Y(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Y(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Y(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const ne=Y(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ie=Y(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),re=Y(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),se=Y(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ae=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),le=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ce=Y(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),de={category10:Q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:K,reds:Z,greens:U,oranges:J,purples:ee,viridis:te,plasma:oe},ue=Q,he=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ge=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 fe(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ge.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):ue[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%ue.length]}function pe(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return y().domain(n).range(o).unknown("#999");const r=de[o]||de.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ue;return y().domain(n).range(e).unknown("#999")}}function ye(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function ve(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,d=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:d,datum:e.pieceData,category:e.name}))}return r}function me(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=x(e,.25))&&void 0!==t?t:r,median:null!==(o=x(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=x(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function be(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}const xe={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:d}=e,{r:u,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,v=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),v.push(t))}}else v.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of v){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=d(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=u(0>a?i:n+a),o=0>a?u(i+a)-u(i):u(n)-u(n+a);g.push(ye(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=u(0>a?i+a:n),o=0>a?u(i)-u(i+a):u(n+a)-u(n);g.push(ye(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const m="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!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=m?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 o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(m?(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:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,d=[],u="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(u){const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(ye(r,Math.min(a,u),n,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(ye(Math.min(a,u),r,Math.abs(u-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of d){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=u?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return d},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:d}=i,u=[],h="vertical"===d,g="radial"===d,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),d=f&&a[i]||c,v=l(t,e.name),m=v.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=d(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:m,style:v,datum:t})}return u},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),d=r(n,e.name),u=d.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:u,style:d,datum:n})}}return l},pie:ve,donut:ve,boxplot:function(e,t){var o,n,i,r,s,a;const{scales:l,columns:c,config:d,getR:u,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,v=!1!==d.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],d=l[l.length-1],f=null!==(o=x(l,.25))&&void 0!==o?o:c,m=null!==(n=x(l,.5))&&void 0!==n?n:(c+d)/2,b=null!==(i=x(l,.75))&&void 0!==i?i:d,w=b-f,k=f-1.5*w,A=b+1.5*w,O=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:d,j=h(t.pieceData[0],t.name),_=[];if(v)for(const e of t.pieceData){const o=u(e);if(k>o||o>A){const n=y?t.middle:g(o),i=y?g(o):t.middle;_.push({px:n,py:i,value:o,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(O),q1Pos:g(f),medianPos:g(m),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:O,q1:f,median:m,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:_}),v)for(const t of _)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:d,projection:u}=r,h=[],g="vertical"===u,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,u=Array(f).fill(0);for(const e of t)u[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...u,1),v=e.width/2*.9;let m="";if(g){m=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const o=d(r+(t+.5)*a);m+=` L ${e.middle+u[t]/y*v} ${o}`}m+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const o=d(r+(t+.5)*a);m+=` L ${e.middle-u[t]/y*v} ${o}`}m+=" Z"}else{m=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)m+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*v}`;m+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)m+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*v}`;m+=" Z"}const b=c(e.pieceData[0],e.name);let w;if(p&&t.length>=4){const a=null!==(o=x(t,.25))&&void 0!==o?o:r,l=null!==(n=x(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=x(t,.75))&&void 0!==i?i:s;w={q1Pos:d(a),medianPos:d(l),q3Pos:d(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};h.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:me(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],d=r.bins||25,u=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/d||1,r=Array(d).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),d-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;d>t;t++){if(0===r[t])continue;const n=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(ye(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,d=[],u=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/u||1,c=Array(u).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let v="";if(h){const t=e.x+e.width;v=`M ${l(n)} ${t}`;for(let e=0;u>e;e++)v+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;v+=` L ${l(i)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(n)}`;for(let e=0;u>e;e++){const o=l(n+(e+.5)*r);v+=` L ${t+c[e]/f*y} ${o}`}v+=` L ${t} ${l(i)} Z`}const m=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};d.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:m,stats:me(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,d=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(ye(o,e.x,i-o,e.width,d,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(ye(e.x,o,e.width,i-o,d,t,e.name))}}return l},funnel:function(e,t){var o,n,i,r,s,a,l,c;const{columns:d,getR:u,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===m.length)return f;const b=[],x=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let A=0;for(const e of m){const t=new Map;let o=0;for(const n of e.pieceData){const e=h?h(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=u(n);i.total+=r,i.pieces.push(n),o+=r}k.push({col:e,groups:t,stepTotal:o}),w||o>A&&(A=o)}if(w)for(const e of k){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return f;const O=new Map;for(const e of b){const t=k[0].groups.get(e);O.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=k[0].stepTotal,j=w?.95*p:.9*t.width,_=v().domain([0,A]).range([0,j]),M=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let C=new Map;for(let t=0;k.length>t;t++){const o=k[t],n=o.col,d=0===t,u=n.width,h=.55*u,v=n.x+(u-h)/2,m=new Map;if(w){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=_(n.total))}let t=p,i=p;for(let r=0;b.length>r;r++){const a=b[r],l=o.groups.get(a);if(!l)continue;const c=_(l.total),u=r%2==0,x=u?t:i-c;u?t+=c:i-=c;const w=g(l.pieces[0],a),k=null!==(s=O.get(a))&&void 0!==s?s:l.total,A=k>0?l.total/k*100:0,S=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(S.__funnelStepLabel=n.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=v,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+c/2,S.__funnelValueLabelY=v,S.__funnelBarW=c),f.push(ye(x,v,c,h,w,S,a)),m.set(a,{x:x,y:v,w:c,h:h})}}else{const e=o.stepTotal,t=_(e),s=p-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=o.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:n.pieceData[0],u=l?a:n.name,x=g(c,u),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:d,category:l?a:n.name});y&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=v,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=v,k.__funnelBarW=t),f.push(ye(s,v,t,h,x,k,u)),m.set(a,{x:s,y:v,w:t,h:h})}if(t>0&&C.size>0){const t=w?b:[b[0]];for(const i of t){const t=C.get(i),r=m.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return g(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),d={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:M},datum:null!==(c=null===(l=o.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===i?n.name:i};f.push(d)}}C=m}return f},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:d}=e,u=[],h=d.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return u;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const v=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);v.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const m=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,d=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=v.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:y,A=n?0:Math.max(0,k-y),O=o.x+e*a+l/2,S=m(y),j=m(0)-S,_=c(f.pieces[0],p?h:o.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:O+d/2,__barFunnelLabelY:m(y+A)});if(u.push(ye(O,S,d,j,_,M,p?h:o.name)),A>0){const e=m(y+A),t=S-e,n=Object.assign({},_),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});u.push(ye(O,e,d,t,n,i,p?h:o.name))}}}return u},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,d=[],u="horizontal"===c,h=e.config.gradientFill,g=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=u?ye(s,o.x,a,o.width,n,null,"__track__"):ye(o.x,s,o.width,a,n,null,"__track__");d.push(i)}}for(const e of Object.values(i)){let t=0;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(u){const r=l(t),s=l(t+n);f=ye(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=ye(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=n}}return d}};class we{constructor(e){this.rExtent=new z,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.customLayoutOverlays=null,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 $(e.windowSize),this.getO=q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new z)):(this.getR=G(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(e.connectorAccessor),this.getDataId=q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new $(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 o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),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 o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[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 n=o.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(n),s=this.computeValueDomain(n,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let d,u;if(l){d=m().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;u=v().domain(s).range([n,o])}else a?(d=m().domain(r).range([0,e.height]).padding(c),u=v().domain(s).range([0,e.width])):(d=m().domain(r).range([0,e.width]).padding(c),u=v().domain(s).range([e.height,0]));this.scales={o:d,r:u,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(o,n);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const d=null!==(r=t.extentPadding)&&void 0!==r?r:.05,u=c-l,h=u>0?u*d:1;return l-=h,c+=h,l>0&&(l=0),a?v().domain([l,c]).range([0,e.width]):v().domain([l,c]).range([e.height,0])}):[];let h=n;this.rAccessors.length>1&&(h=n.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,r,d,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),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,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,d=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,d=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>d&&(d=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>d&&(d=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&&(d=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(d=this.config.rExtent[1]));const u="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(u&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>d&&(d=0)),"bar-funnel"!==a){const e=d-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||u&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||u&&!this.config.baselinePadding&&0===d||"swimlane"===a||(d+=t)}return[c,d]}buildColumns(e,t,o,n,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==n){d=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of d)d.set(t,o/e*r)}let u=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;d?(c=h,g=d.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:u},u+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=xe[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,d=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),d.has(o)||d.set(o,[]),d.get(o).push({x:n,y:i,datum:t,category:a(t)})}const u=i.o.domain(),h=r.connectorStyle;for(const[t,i]of d)if(i.length>=2){i.sort((e,t)=>u.indexOf(e.category)-u.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=function(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=de[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(r.colorScheme,r.themeCategorical,he),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:be(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}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 o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||he,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}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 o=this.config.decay;return o&&t>1?function(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);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,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,we.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=b().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let d=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;d||(d=this.getCategoryIndexMap(t));const n=d.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._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(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const A=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],d=this.getNodeKey(c,O);if(!d)continue;c._transitionKey=d;const u=this.prevPositionMap.get(d);if("point"===c.type)u?(A.add(d),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(u.x!==c.x||u.y!==c.y||void 0!==u.r&&u.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=u.x,c.y=u.y,void 0!==u.r&&(c.r=u.r),k=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,u.x===c.x&&u.y===c.y&&u.w===c.w&&u.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=u.x,c.y=u.y,c.w=null!==(i=u.w)&&void 0!==i?i:c.w,c.h=null!==(r=u.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(u)A.add(d),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,u.startAngle===c.startAngle&&u.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=u.startAngle,c.endAngle=u.endAngle,k=!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(d,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),k=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.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!==(d=t.opacity)&&void 0!==d?d: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!==(u=t.w)&&void 0!==u?u: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 o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(v=t.outerRadius)&&void 0!==v?v:100,startAngle:null!==(m=t.startAngle)&&void 0!==m?m: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:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=N(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=N(n.x,e._targetX,s),e.y=N(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=N(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=N(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=N(o.x,e._targetX,s),e.y=N(o.y,e._targetY,s),void 0!==o.w&&(e.w=N(o.w,e._targetW,s),e.h=N(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:N(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=N(o.startAngle,e._targetStartAngle,s),e.endAngle=N(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}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]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!E(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!E(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!E(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(E(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!E(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new z)):(this.getR=G(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!E(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!E(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!E(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!E(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function ke(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:n.createElement(n.Fragment,null,...t)}function Ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Oe(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Se(e,t,o){const n=function(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function je(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Ae(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _e(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Oe(Math.atan2(i,n)),a=Oe(e.startAngle),l=Oe(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,d=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*d,y:e.cy+Math.sin(c)*d,distance:0,category:e.category}}function Me(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Ce(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Pe(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function Le(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}we.QUADTREE_THRESHOLD=500;const Te={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function He(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,Te[o])(n(e,t)),i}function Be(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ie(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Re=(o,n,i,r,s,a,l,c,d,u)=>{const{type:h="fill",styleFn:g,items:f}=o,p=[];let y=0;const v=!(!n&&!i),m="isolate"===u||void 0===u&&null!=s;return f.forEach((o,u)=>{const b=He(o,u,h,g),x=Ie(o,r,s),w=s&&s.size>0&&s.has(o.label);p.push(e("g",{transform:`translate(0,${y})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?w||!1:void 0,"aria-current":v&&!m&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const o=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{d(c,u),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t(Be,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+u)),y+=22}),p};function Fe({config:o,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=o,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+n.useId();if("horizontal"===i){const o=12,n=Math.min(r,200),i=Math.max(0,(r-n)/2),c=[];for(let e=0;64>=e;e++){const o=e/64;c.push(t("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&t("text",{x:i+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:n,height:o,fill:`url(#${u})`,rx:2}),t("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),t("text",{x:i+n,y:o+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])})]})}const h=[];for(let e=0;64>=e;e++){const o=e/64;h.push(t("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[l&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("defs",{children:t("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${u})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])})]})}function We(o){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:d="Legend",width:u=100,height:h=20,orientation:g="vertical"}=o,[f,p]=n.useState(0),[y,v]=n.useState(0),m=n.useCallback((e,t)=>{p(e),v(t)},[]),b="vertical"===g?(({legendGroups:e,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d})=>{let u=24;const h=[];return e.forEach((e,g)=>{u+=5,h.push(t("line",{stroke:"gray",x1:0,y1:u,x2:o,y2:u},"legend-top-line legend-symbol-"+g)),u+=8,e.label&&(u+=16,h.push(t("text",{y:u,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),u+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${u})`,children:Re(e,n,i,r,s,a,l,g,c,d)},"legend-group-"+g)),u+=22*e.items.length+8}),h})({legendGroups:i||[],width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:o,height:n,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h})=>{let g=0;const f=[];o.forEach((o,n)=>{let p=0;o.label&&(p+=16);const y=((o,n,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=o,y=[];let v=0,m=0;const b=!(!n&&!i),x="isolate"===u||void 0===u&&null!=s;p.forEach((o,u)=>{const w=He(o,u,g,f),k=Ie(o,r,s),A=s&&s.size>0&&s.has(o.label),O=26+7*o.label.length;h&&h>0&&v>0&&v+O>h&&(m++,v=0),y.push(e("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&u===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?A||!1:void 0,"aria-current":b&&!x&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const o=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{d(c,u),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*o.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,A&&t(Be,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+u)),v+=O});let w=0,k=0;for(const e of p){const t=26+7*e.label.length;h&&h>0&&k>0&&k+t>h?(w=Math.max(w,k),k=t):k+=t}w=Math.max(w,k);const A=m+1;return{items:y,offset:w,totalRows:A,totalHeight:22*A}})(o,r,s,a,l,c,d,n,u,h,i);p+=y.offset+5,f.push(Object.assign(Object.assign({label:o.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=p+12});let p=g>i?0:Math.max(0,(i-g)/2);const y=[];return f.forEach((e,i)=>{const r=o[i];r.label&&(y.push(t("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:r.label},"legend-text-"+i)),p+=16),y.push(t("g",{className:"legend-item",transform:`translate(${p},0)`,children:e.items},"legend-group-"+i)),p+=e.offset+5,o[i+1]&&y.push(t("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(e.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),t("g",{children:y})})({legendGroups:i||[],title:d,height:h,width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}),x=!(!r&&!s);return e("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==d&&""!==d&&"vertical"===g&&t("text",{className:"legend-title",y:16,x:u/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:d}),b]})}function De(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function $e(e){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:d,legendIsolatedCategories:u,legendInteraction:h}=e;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),t("g",{transform:`translate(${f}, ${p})`,children:(y=o,"object"==typeof y&&null!==y&&"gradient"in y?t(Fe,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):De(o)?t(We,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:d,isolatedCategories:u,legendInteraction:h}):o)});var y}function ze(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Ne(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Ee(o,n,i,r){if(!o)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=o;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>n?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>n?"end":"start";const p=16,y=a?u?[a]:ze(a,d):[],v=s?u?[s]:ze(s,d):[],m="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(t("text",{className:"annotation-note-title",fill:w,textAnchor:f,fontWeight:"bold",children:y.map((e,o)=>t("tspan",{x:m,dy:0===o?0:p,children:e},o))},"annotation-note-title")),b=y.length*p),v.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:b,children:v.map((e,o)=>t("tspan",{x:m,dy:0===o?0:p,children:e},o))},"annotation-note-label"));let k=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const e=Math.min(d,120);let o=0,n=e;"end"===f?(o=-e,n=0):"middle"===f&&(o=-e/2,n=e/2),k=t("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+v.length)*p+(v.length>0?p:0);let o=0,n=e;"bottom"===g?(o=-e,n=0):"middle"===g&&(o=-e/2,n=e/2),k=t("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+v.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+p+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),e("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function Ge(e,o,n,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-e;a.push(t("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(t("line",{x1:(o.x1||0)-e,y1:i,x2:(o.x2||0)-e,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(t("line",{x1:(o.x1||0)-e,y1:0,x2:(o.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(t("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==e&&a.push(t("path",{d:Ne((null==o?void 0:o.type)||"curly",e,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function qe(e,o,n,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const t=s.width||0,n=s.height||0;if(t>0||n>0){const i=t/2,r=n/2,s=e-i,a=o-r;if(0!==s||0!==a){const e=Math.abs(s),o=Math.abs(a),d=t/2,u=n/2,h=e*u>o*d?d/e:u/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==o)){const n=Math.atan2(o,e);l=Math.cos(n)*t,c=Math.sin(n)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(o-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:a})}function Ve(t){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:d,type:u,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,v=new Set(Array.isArray(f)?f:[]);let m=i||0,b=r||0;null!=s&&(m=s-o),null!=a&&(b=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&d&&0===m&&0===b)if(void 0!==d.width){m=d.width/2;const e=d.depth||30;b=e+(0>e?-5:5)}else if(void 0!==d.height){const e=d.depth||30;m=e+(0>e?-5:5),b=d.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!v.has("connector")&&qe(m,b,c,h,x,d),!v.has("subject")&&Ge(x,d,h,o,n),!v.has("note")&&Ee(l,m,b,h)]}))}function Xe(e){var o,n;const{noteData:i}=e,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const e=i.nx||r[0][0]+(null!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:e,ny:a});return t(Ve,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(Ve,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ye(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Qe(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Ke(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,d=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!d)return null;const u=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==u||null==h?null:{x:c(u),y:d(h)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ye(e,o),c=Qe(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ze(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Ue={linear:L,monotoneX:P,monotoneY:C,step:M,stepAfter:_,stepBefore:j,basis:S,cardinal:O,catmullRom:A};function Je(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=n,{rTickValues:f}=n,p="radial"===(null==d?void 0:d.projection),y="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||p?[]:(f||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(g||et)(e)})),[d,g,p,f]),m=h&&d&&!p,b=u&&d&&!p;return m||b?t("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${c.left},${c.top})`,children:[m&&t("g",{className:"ordinal-grid",children:v.map((e,o)=>t("line",{x1:y?e.pixel:0,y1:y?0:e.pixel,x2:y?e.pixel:i,y2:y?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),b&&t(o,{children:e(o,y?{children:[t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function et(e){return Math.round(100*e)/100+""}function tt(n){var i,a;const{width:l,height:c,totalWidth:d,totalHeight:u,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:v,oFormat:m,rFormat:b,showGrid:x,title:A,legend:O,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M,legendPosition:C="right",foregroundGraphics:P,annotations:T,svgAnnotationRules:B,xAccessor:I,yAccessor:R,annotationData:F,underlayRendered:W,children:D}=n,$="radial"===(null==g?void 0:g.projection),z="horizontal"===(null==g?void 0:g.projection),N=!1!==p,E=r(()=>f&&N&&g&&!$?g.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=g.o(e))&&void 0!==o?o:0)+g.o.bandwidth()/2,label:m?m(e,t):e}}):[],[f,N,g,m,$]),G=n.rTickValues,q=n.tickLabelEdgeAlign,V=r(()=>f&&g&&!$?(G||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||et)(e)})):[],[f,g,b,$,G]),X=s(new Map),Y=s(null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0),Q=null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0;Y.current!==Q&&(Y.current=Q,X.current=new Map);const K=r(()=>{if(!T||0===T.length)return null;const o=function(o,n,i){var r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,A,O,S,j,_,M,C,P,T,B,I,R,F,W,D,$,z,N,E,G,q,V,X,Y,Q,K,Z,U,J,ee,te,oe;switch(o.type){case"label":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return Ze(r,s,i)?t(Xe,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"label",connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"callout":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return Ze(r,s,i)?t(Xe,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"callout-circle",subject:{radius:o.radius||12},connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"x-threshold":{const r=Ye(null!=o.value?Object.assign(Object.assign({},o),{x:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=Qe(null!=o.value?Object.assign(Object.assign({},o),{y:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"enclose":{const r=(o.coordinates||[]).map(e=>({x:Ye(Object.assign(Object.assign({},e),{type:"point"}),i),y:Qe(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=w(r),a=o.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"rect-enclose":{const r=(o.coordinates||[]).map(e=>({x:Ye(Object.assign(Object.assign({},e),{type:"point"}),i),y:Qe(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=o.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,d=Math.max(...a)+s,u=Math.min(...l)-s,h=Math.max(...l)+s;return e("g",{children:[t("rect",{x:c,y:u,width:d-c,height:h-u,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&t("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"highlight":{const e=i.data||[],r="function"==typeof o.filter?e.filter(o.filter):o.field&&null!=o.value?e.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,n)=>{const r=Ye(e,i),a=Qe(e,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(e):o.r||6,c="function"==typeof o.style?o.style(e):o.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const e=Ye(o,i),r=Qe(o,i);return t(Xe,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:o.dx||0,dy:o.dy||0,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"bracket",subject:{type:o.bracketType||"curly",width:o.width,height:o.height,depth:o.depth||30},color:o.color}},"ann-"+n)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,v=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(d=i.scales)||void 0===d?void 0:d.value;if(!y||!v)return null;const m=o.method||"linear";let b;b="loess"===m?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===d){a.push([t,r[e]]);continue}const p=d*g-u*u;if(1e-12>Math.abs(p))a.push([t,h/d]);else{const e=(d*f-u*h)/p;a.push([t,(h-e*u)/d+e*t])}}return a}(p,null!==(u=o.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?H.polynomial(p,{order:o.order||2}):H.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),w=o.color||"#6366f1";return e("g",{children:[t("polyline",{points:x,fill:"none",stroke:w,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&t("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:w,fontSize:11,children:o.label})]},"ann-"+n)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(o.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(o.y1))&&void 0!==y?y:i.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:o.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:o.fillOpacity||.1}),o.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:o.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:o.label})]},"ann-"+n)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(A=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==A?A:null===(O=i.scales)||void 0===O?void 0:O.value;if(!a||!l)return null;const c=o.upperAccessor||"upperBounds",d=o.lowerAccessor||"lowerBounds",u=o.filter,h=r.filter(e=>null!=e[c]&&null!=e[d]&&!(u&&!u(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ue[i.curve||"linear"]||L,f=k().x(e=>a(e[s])).y0(e=>l(e[d])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=o.fill||"#6366f1";return e("g",{children:[t("path",{d:f,fill:p,fillOpacity:null!==(S=o.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),o.label&&h.length>0&&t("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:o.label})]},"ann-"+n)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(_=null===(j=i.scales)||void 0===j?void 0:j.x)&&void 0!==_?_:null===(M=i.scales)||void 0===M?void 0:M.time,l=null!==(P=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(T=i.scales)||void 0===T?void 0:T.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const d=c.reduce((e,t)=>e+t,0)/c.length,u=c.reduce((e,t)=>e+Math.pow(t-d,2),0)/c.length,h=Math.sqrt(u),g=null!==(B=o.threshold)&&void 0!==B?B:2,f=d-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",v=null!==(I=o.fillOpacity)&&void 0!==I?I:.1,m=o.anomalyColor||"#ef4444",b=null!==(R=o.anomalyRadius)&&void 0!==R?R:6,x=l(d+g*h),w=l(f),k=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-d)>g*h});return e("g",{children:[p&&t("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:y,fillOpacity:v}),k.map((e,o)=>{const n=Ye(e,i),r=Qe(e,i);return null==n||null==r?null:t("circle",{cx:n,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),o.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:o.label})]},"ann-"+n)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(W=null===(F=i.scales)||void 0===F?void 0:F.x)&&void 0!==W?W:null===(D=i.scales)||void 0===D?void 0:D.time,c=null!==(z=null===($=i.scales)||void 0===$?void 0:$.y)&&void 0!==z?z:null===(N=i.scales)||void 0===N?void 0:N.value;if(!l||!c)return null;const d=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>d.length)return null;let u;if("polynomial"===(o.method||"linear")){const e=H.polynomial(d,{order:o.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=d.length;let t=0,o=0,n=0,i=0;for(const[e,r]of d)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;u=e=>a+s*e}const h=d.length,g=d.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=d.reduce((e,t)=>e+t[0],0)/h,y=d.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),v=null!==(E=o.confidence)&&void 0!==E?E:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(G=o.steps)&&void 0!==G?G:5,x=d[h-1][0],w=(x-d[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=u(e),o=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const O=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(u(x))}`,_=o.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:o.fill||"#6366f1",fillOpacity:null!==(q=o.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),t("polyline",{points:`${j} ${S}`,fill:"none",stroke:_,strokeWidth:null!==(V=o.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(X=o.strokeDasharray)&&void 0!==X?X:"6,3"}),o.label&&A.length>0&&t("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:_,fontSize:11,children:o.label})]},"ann-"+n)}case"widget":{let e=null,r=null;if(null!=o.px&&null!=o.py)e=o.px,r=o.py;else{const t=Ke(o,n,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ze(e,r,i))return null;const s=null!==(Y=o.dx)&&void 0!==Y?Y:0,a=null!==(Q=o.dy)&&void 0!==Q?Q:0,l=null!==(K=o.width)&&void 0!==K?K:32,c=null!==(Z=o.height)&&void 0!==Z?Z:32,d=null!==(U=o.content)&&void 0!==U?U:t("span",{style:{fontSize:18,cursor:"default"},title:o.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+n)}case"text":{const e=Ke(o,n,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(o.dx||0),y:s+(o.dy||0),fill:o.color||"var(--semiotic-text, #333)",fontSize:o.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:o.label},"ann-text-"+n)}case"category-highlight":{const r=o.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const d=c(r);if(null==d)return null;const u=c.bandwidth(),h=o.color||"var(--semiotic-primary, #4589ff)",g=null!==(oe=o.opacity)&&void 0!==oe?oe:.15,f=o.label;return e("g",(i.projection?"vertical"===i.projection:c===a)?{children:[t("rect",{x:d,y:0,width:u,height:i.height||0,fill:h,fillOpacity:g}),f&&t("text",{x:d+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[t("rect",{x:0,y:d,width:i.width||0,height:u,fill:h,fillOpacity:g}),f&&t("text",{x:12,y:d+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n="horizontal"===(null==g?void 0:g.projection),i=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,r={scales:g?{x:n?g.r:i||g.r,y:n&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:I,yAccessor:R,width:l,height:c,data:F,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:X.current};return T.map((e,t)=>{if(B){const n=B(e,t,r);return null!=n?n:o(e,t,r)}return o(e,t,r)}).filter(Boolean)},[T,B,l,c,g,I,R,F]);return f||A||O||P||K&&K.length>0||x||D?e("svg",{role:"img",width:d,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof A?A:"Ordinal Chart"}),t("desc",{children:"string"==typeof A?A+" — ordinal data visualization":"Ordinal data visualization"}),e("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!$&&!W&&t("g",{className:"ordinal-grid",children:V.map((e,o)=>t("line",{x1:z?e.pixel:0,y1:z?0:e.pixel,x2:z?e.pixel:l,y2:z?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!$&&t("g",{className:"ordinal-axes",children:e(o,z?{children:[!W&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((o,n)=>e("g",{transform:`translate(0,${o.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:y}),!W&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!W&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&l-1>e?t("line",{x1:e,y1:0,x2:e,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),V.map((o,n)=>{const i=q?0===n?"start":n===V.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${o.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)}),v&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:v})]}:{children:[!W&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,o=0>e||e>c?c:e;return t("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),E.map((o,n)=>e("g",{transform:`translate(${o.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?t("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!W&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),V.map((o,n)=>e("g",{transform:`translate(0,${o.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)),v&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:v})]})}),K,P,D]}),A&&t("text",{x:d/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof A?A:null}),$e({legend:O,totalWidth:d,totalHeight:u,margin:h,legendPosition:C,title:A,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M})]}):null}function ot({width:e,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const d=s(null),u=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const f=s(!1),p=s(null),y="horizontal"===(null==l?void 0:l.projection),v=s(y);return v.current=y,i(()=>{if(!d.current)return;const t=B(d.current).select(".brush-g"),n=y?I():R();return n.extent([[0,0],[e,o]]),n.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};p.current=r,h.current(r)}),t.call(n),u.current=n,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),u.current=null}},[e,o,y]),i(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=B(d.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);y?(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1):(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1)},[l,y]),t("svg",{ref:d,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}const nt={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function it(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const rt="undefined"==typeof window||"undefined"==typeof document,st="undefined"!=typeof window?c:i,at=()=>()=>{},lt=()=>!1,ct=()=>!0;function dt(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function ut(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function ht(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const gt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ft=new WeakMap;let pt=0,yt=!1,vt=null,mt=null,bt=null;function xt(e,t){var o,n;if(!t)return t;const i=gt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(yt)return;if("undefined"==typeof window||"undefined"==typeof document)return;yt=!0;const e=()=>{pt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(vt=new MutationObserver(e),vt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{mt=window.matchMedia("(prefers-color-scheme: dark)"),bt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",bt):"function"==typeof mt.addListener&&mt.addListener(bt)}catch(e){}}();let s=ft.get(r);s&&s.version===pt||(s={version:pt,map:new Map},ft.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}const wt=n.createContext(null),kt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function At(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}const Ot=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},St={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"},jt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},_t={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)"},Mt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ct={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)"},Pt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Lt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Tt({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),d=n.useContext(wt),u=null!==(a=null==d?void 0:d.visible)&&void 0!==a&&a,h=l||u,g=n.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=n.useCallback(()=>{l||u||c(!0)},[l,u]),y=n.useCallback(e=>{var t;u||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[u]);if(!o||0===o.length)return r?t("span",{id:r,tabIndex:-1,style:kt}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:p,style:kt,role:"region","aria-label":f,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",o.length," elements)"]})});const v=function(e){var t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,w,k,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":j.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;j.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=_.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(d=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==d?d:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(u=_.datum)||void 0===u?void 0:u.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(f=_.cy)&&void 0!==f?f:_.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(p=_.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(v=_.cx)&&void 0!==v?v:_.x,y:null!==(m=_.cy)&&void 0!==m?m:_.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(k=_.datum)||void 0===k?void 0:k.name)&&void 0!==A?A:"",value:null!==(S=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(o),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(v),b=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Ot(e.min)} to ${Ot(e.max)}, mean ${Ot(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(v.length,m),x=v.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return e("div",{ref:g,id:r,tabIndex:-1,onBlur:y,style:St,role:"region","aria-label":f,children:[t("button",{type:"button",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:_t,children:"×"}),t("div",{role:"note",style:jt,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:Mt,children:[e("caption",{style:Lt,children:["First ",x.length," of ",v.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:Ct,children:"type"}),k.map(e=>t("th",{style:Ct,children:e},e))]})}),t("tbody",{children:x.map((o,n)=>e("tr",{children:[t("td",{style:Pt,children:o.label}),k.map(e=>{return t("td",{style:Pt,children:(n=o.values[e],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ot(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},e);var n})]},n))})]})]})}function Ht({summary:e}){return e?t("div",{role:"note",style:kt,children:e}):null}function Bt({tableId:e}){return t("a",{href:"#"+e,style:kt,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.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,kt)},children:"Skip to data table"})}function It({hoverPoint:e}){let o="";if(e){const t=e.data||e;o="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:kt,children:o})}const Rt="var(--semiotic-focus, #005fcc)";function Ft({active:e,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!e||!o)return null;const l=o.x+n.left,c=o.y+n.top;let d;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),o=Math.max(a,4);d=t("rect",{x:l-e/2-3,y:c-o/2-3,width:e+6,height:o+6,rx:3,fill:"none",stroke:Rt,strokeWidth:2,strokeDasharray:"4,2"})}else d=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Rt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Rt,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}function Wt({x:e,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=n.useRef(null),[u,h]=n.useState(null);n.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=u?`translate(${u.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-o?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`,t("div",{ref:d,className:l,style:{position:"absolute",left:s.left+e,top:s.top+o,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function Dt(e){let o=null;const n=()=>(o||(o=h(null)),o),i=$t(e);return[function({children:o,initialState:i}){const a=s(i),l=r(()=>$t(e,a.current),[]),c=n();return t(c.Provider,{value:l,children:o})},e=>{var t;const o=n(),r=null!==(t=d(o))&&void 0!==t?t:i,a=s(e);a.current=e;const c=u(()=>a.current(r.getState()),[r]),h=u(()=>a.current(r.getState()),[r]);return l(r.subscribe,c,h)}]}function $t(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function zt(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 Nt(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:Et})})),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 Et=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Gt={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}},qt={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}},Vt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Et,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"};function Xt(e,t){if("light"===t)return Gt;if("dark"===t)return qt;if("high-contrast"===t)return Vt;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?qt:Gt;return Nt(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 Nt(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||{})}))}const[Yt,Qt]=Dt(e=>({theme:Gt,setTheme(t){e(e=>({theme:Xt(e.theme,t)}))}}));const Kt="undefined"==typeof window?i:c;function Zt(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Ut(e){const t=function(){const[e,t]=a(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),o=s(t);o.current=t;const[l,c]=function(e,t,o){const n=s(null),[r,l]=a(null);return i(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;l(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return i.observe(e),()=>i.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),d=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-d.left-d.right,g=c[1]-d.top-d.bottom,f=Zt(e.foregroundGraphics,c,d),p=Zt(e.backgroundGraphics,c,d),y=Qt(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=s(0),w=s(()=>{}),k=u(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=s(()=>{}),O=s(()=>{}),S=s(null),j=s(0),_=u(()=>{j.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),M=u(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(_))},[_]),C=u(()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),O.current()},[]);i(()=>()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const P=e.themeDirtyRef;return Kt(()=>{P&&(pt++,P.current=!0,k())},[y,k,P]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:l,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:M,onPointerLeave:C}}function Jt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function eo(e,t,o=.3){Jt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function to(e,t,o=.6){var n,i,r,s,a;if(!Jt(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,d=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,u=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(d,u,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function oo(e,t,o,n=.35){Jt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function no(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function io(e,t,o){return null==t?o:"string"!=typeof t?t:xt(e,t)||o}function ro(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),d=Math.max(0,Math.min(1,l)),u=e.createLinearGradient(n,i,r,s),[h,g,f]=no(e,o);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function so(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const ao=(e,t,o,n)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)lo(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=io(e,t.style.fill,xt(e,"var(--semiotic-primary, #007bff)")),n=so(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=io(e,t.style.fill,xt(e,"var(--semiotic-primary, #007bff)")),n=so(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}eo(e,t),e.globalAlpha=1}};function lo(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}const co=(e,t,o,n)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=io(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=io(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),to(e,t),e.globalAlpha=1}}finally{e.restore()}}};function uo(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 ho(e,t){const o=T().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}const go=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?xt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),ho(e,t)):(uo(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(uo(e,t),oo(e,t)),e.globalAlpha=1}},fo=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=xt(e,"var(--semiotic-primary, #007bff)"),a=xt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?xt(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?xt(e,d)||d:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=u,e.lineWidth=h,e.beginPath(),n?(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(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},po=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?xt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},yo=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=xt(e,o.style.stroke)||("string"==typeof o.style.fill?xt(e,o.style.fill):o.style.fill)||xt(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},vo=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=xt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function mo(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 bo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let xo=null;function wo(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(xo||(xo=document.createElement("canvas")),xo.width=e,xo.height=e,xo)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(d);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const ko=new Map;function Ao(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=ko.get(o);if(void 0!==n)return n;const i=wo({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return ko.set(o,i),i}function Oo(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function So(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 jo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const _o=e=>[yo,...e],Mo={bar:_o([ao]),clusterbar:_o([ao]),point:_o([co]),swarm:_o([co]),pie:[go],donut:[go],boxplot:_o([fo,co]),violin:_o([po]),histogram:_o([ao]),ridgeline:_o([po]),timeline:_o([ao]),funnel:[ao,vo,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?mo(i):null!=r?`${mo(i)} (${bo(r)})`:mo(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=mo(i),e.measureText(c).width+16>n)continue}const d=o.__funnelValueLabelX,u=(null!==(a=o.__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,d,u),e.fillStyle="#fff",e.fillText(c,d,u)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[ao,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||xt(e,"var(--semiotic-border, #999)"),n=Ao(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=no(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,xt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,d=r?jo(i):"",u=So(n);e.font="bold 13px sans-serif";const h=r?e.measureText(d).width:0;e.font="11px sans-serif";const g=e.measureText(u).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,v=y-f/2,m=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Oo(e,v,m,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Oo(e,v,m,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(d,y,m+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,m+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,m+3))}e.lineWidth=1}],swimlane:_o([ao]),custom:_o([ao,co,go,fo,po,vo])},Co={top:50,right:40,bottom:60,left:70},Po={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 Lo({hover:o}){var n,i,r,s,a,l;const c=o.data||{},d=o.stats,u=o.category;if(Array.isArray(c)){const o=u||(null===(n=c[0])||void 0===n?void 0:n.category)||"";if(d)return e("div",{className:"semiotic-tooltip",style:Po,children:[o&&t("div",{style:{fontWeight:"bold"},children:o+""}),e("div",{children:["n = ",d.n]}),e("div",{children:["Min: ",d.min.toLocaleString()]}),e("div",{children:["Q1: ",d.q1.toLocaleString()]}),e("div",{children:["Median: ",d.median.toLocaleString()]}),e("div",{children:["Q3: ",d.q3.toLocaleString()]}),e("div",{children:["Max: ",d.max.toLocaleString()]}),e("div",{style:{opacity:.8},children:["Mean: ",d.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return e("div",{className:"semiotic-tooltip",style:Po,children:[o&&t("div",{style:{fontWeight:"bold"},children:o+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return e("div",{className:"semiotic-tooltip",style:Po,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===o.length&&e("div",{style:{opacity:.8},children:[Number(o[0]).toFixed(1)," – ",Number(o[1]).toFixed(1)]})]})}const h=o.__oAccessor,g=o.__rAccessor,f=o.__chartType;if("swarm"===f||"point"===f){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Po,children:o.map(([t,o])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Po,children:o.map(([t,o])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e("div",{className:"semiotic-tooltip",style:Po,children:[p&&t("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&t("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}const To=g(function(o,c){var d,h,g,p,y,v,m,b,x,w,k;const{chartType:A,runtimeMode:O,data:S,oAccessor:j="category",rAccessor:_="value",colorAccessor:M,stackBy:C,groupBy:P,multiAxis:L,timeAccessor:H,valueAccessor:B,categoryAccessor:I,projection:R="vertical",size:F=[600,400],responsiveWidth:$,responsiveHeight:z,margin:N,barPadding:E,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:K,startAngle:Z,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:oe,amplitude:ne,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,rExtent:ce,oExtent:de,extentPadding:ue=.05,oSort:he,windowMode:ge="sliding",windowSize:fe=200,pieceStyle:pe,summaryStyle:ye,colorScheme:ve,barColors:me,showAxes:be=!0,showCategoryTicks:xe,categoryLabel:Oe,valueLabel:Te,categoryFormat:He,valueFormat:Be,oLabel:Ie,rLabel:Re,oFormat:Fe,rFormat:We,rTickValues:De,tickLabelEdgeAlign:$e,enableHover:ze=!0,hoverAnnotation:Ne,tooltipContent:Ee,customHoverBehavior:Ge,annotations:qe,svgAnnotationRules:Ve,showGrid:Xe=!1,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,legendCategoryAccessor:gt,onCategoriesChange:ft,backgroundGraphics:pt,foregroundGraphics:yt,title:vt,className:mt,background:bt,centerContent:wt,decay:kt,pulse:Ot,transition:St,animate:jt,staleness:_t,brush:Mt,onBrush:Ct,accessibleTable:Pt=!0,description:Lt,summary:Rt,customLayout:Dt,layoutConfig:$t}=o,Nt=s(!0),Et=Ut({sizeProp:F,responsiveWidth:$,responsiveHeight:z,userMargin:N,marginDefault:Co,foregroundGraphics:yt,backgroundGraphics:pt,animate:jt,transitionProp:St,themeDirtyRef:Nt}),{reducedMotionRef:Gt,responsiveRef:qt,size:Vt,margin:Xt,adjustedWidth:Yt,adjustedHeight:Qt,resolvedForeground:Kt,resolvedBackground:Zt,currentTheme:Jt,transition:eo,introEnabled:to,tableId:oo,rafRef:no,renderFnRef:io,scheduleRender:ro}=Et,so=function(){const[e,t]=a(!1);return st(()=>{t(!0)},[]),e}(),ao=function(){const e=l(at,lt,ct);return s(e).current}(),lo=r(()=>W(S),[S]),co=null!=Oe?Oe:Ie,uo=null!=Te?Te:Re,ho=null!=He?He:Fe,go=null!=Be?Be:We,fo=s(null),po=s(null),yo=s([]),vo=s(gt),mo=s(ft);vo.current=gt,mo.current=ft;const[bo,xo]=a(null),[wo,ko]=a(null),[Ao,Oo]=a(0),[So,jo]=a(!1),[_o,Po]=a(null),To=u(()=>{var e,t;Po(null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),Ho=ze||Ne,Bo="streaming"===O,Io=r(()=>{var e,t,o;return{chartType:A,runtimeMode:Bo?"streaming":"bounded",windowSize:fe,windowMode:ge,extentPadding:ue,projection:R,oAccessor:Bo?void 0:j,rAccessor:Bo?void 0:_,colorAccessor:M,stackBy:C,groupBy:P,multiAxis:L,timeAccessor:Bo?H:void 0,valueAccessor:Bo?B||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:Bo?I||j:void 0,rExtent:ce,oExtent:de,barPadding:E,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:K,startAngle:Z,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:oe,amplitude:ne,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,oSort:he,pieceStyle:pe,summaryStyle:ye,colorScheme:ve,themeCategorical:null===(e=null==Jt?void 0:Jt.colors)||void 0===e?void 0:e.categorical,themeSemantic:zt(Jt),themeSequential:null===(t=null==Jt?void 0:Jt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Jt?void 0:Jt.colors)||void 0===o?void 0:o.diverging,barColors:me,decay:kt,pulse:Ot,transition:eo,introAnimation:to,staleness:_t,customLayout:Dt,layoutConfig:$t,layoutMargin:Xt}},[A,fe,ge,ue,R,j,_,M,C,P,L,H,B,I,ce,de,E,G,q,V,X,Y,Q,K,Z,U,J,ee,te,oe,ne,ie,re,se,ae,le,he,pe,ye,ve,me,kt,Ot,null==eo?void 0:eo.duration,null==eo?void 0:eo.easing,to,_t,Bo,Jt,Dt,$t,Xt]),Ro=function(e){const t=s(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ut(e,t);if(!ht(e)||!ht(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!ut(o,i))return!1}else{if(!ht(o)||!ht(i))return!1;if(!dt(o,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Io),Fo=s(null);Fo.current||(Fo.current=new we(Ro));const Wo=u(()=>{var e,t;const o=vo.current,n=mo.current;if(!n||!o)return;const i=function(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}(null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i,yo.current)||(yo.current=i,n(i))},[]);i(()=>{var e;null===(e=Fo.current)||void 0===e||e.updateConfig(Ro),Nt.current=!0,ro()},[Ro,ro]);const Do=s(null);Do.current||(Do.current=new D(e=>{const t=Fo.current;t&&t.ingest(e)&&(Nt.current=!0,ro())}));const $o=u(e=>{var t;null===(t=Do.current)||void 0===t||t.push(e)},[]),zo=u(e=>{var t;null===(t=Do.current)||void 0===t||t.pushMany(e)},[]),No=u(()=>{var e,t;null===(e=Do.current)||void 0===e||e.clear(),null===(t=Fo.current)||void 0===t||t.clear(),Nt.current=!0,ro()},[ro]),Eo=u(e=>{var t,o;null===(t=Do.current)||void 0===t||t.clearLastData(),null===(o=Do.current)||void 0===o||o.setReplacementData(e)},[]);f(c,()=>({push:$o,pushMany:zo,replace:Eo,remove:e=>{var t,o,n,i;null===(t=Do.current)||void 0===t||t.flush();const r=null!==(n=null===(o=Fo.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=po.current)||void 0===i?void 0:i.data;!!po.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(po.current=null,xo(null)),Nt.current=!0,ro()}return r},update:(e,t)=>{var o,n,i;null===(o=Do.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Fo.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Nt.current=!0,ro()),r},clear:No,getData:()=>{var e,t,o;return null===(e=Do.current)||void 0===e||e.flush(),null!==(o=null===(t=Fo.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Fo.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[$o,zo,Eo,No,ro]),i(()=>{var e;S&&(null===(e=Do.current)||void 0===e||e.setBoundedData(lo))},[S,lo]);const{hoverHandlerRef:Go,hoverLeaveRef:qo,onPointerMove:Vo,onPointerLeave:Xo}=Et;Go.current=e=>{if(!Ho)return;const t=fo.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Xt.left,i=e.clientY-o.top-Xt.top;if(0>n||n>Yt||0>i||i>Qt)return void(po.current&&(po.current=null,xo(null),Ge&&Ge(null),ro()));const r=Fo.current;if(!r||0===r.scene.length)return;const s="radial"===R,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=function(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+r;let d=null,u=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);Ae(e.r,n)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}(i,t,o,n,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=Se(r,t,o);break;case"point":if(i)break;e=je(r,t,o,n);break;case"wedge":e=_e(r,t,o);break;case"boxplot":e=Me(r,t,o);break;case"violin":e=Ce(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-Yt/2:n,s?i-Qt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(po.current&&(po.current=null,xo(null),Ge&&Ge(null),ro()));const l=(c=a.datum||{},d=a.x,u=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A}),Object.assign({data:c,x:d,y:u,__semioticHoverData:!0},h));var c,d,u,h;po.current=l,xo(l),Ge&&(Ge(l),Nt.current=!0),ro()},qo.current=()=>{po.current&&(po.current=null,xo(null),Ge&&(Ge(null),Nt.current=!0),ro())};const Yo=s(-1),Qo=s(null),Ko=s(null),Zo=u(e=>{const t=Fo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Ko.current&&Ko.current.version===o)n=Ko.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=function(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}(e),Ko.current={version:o,graph:n}}const i=Yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Yo.current=0;const t=n.flat[0];Qo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Le(t)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});return po.current=o,xo(o),Ge&&Ge(o),void ro()}const r=function(e,t){var o,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}(n,i),s=function(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?Pe(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Pe(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Yo.current=-1,Qo.current=null,po.current=null,xo(null),Ge&&Ge(null),void ro();Yo.current=s;const a=n.flat[s];Qo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Le(a)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});po.current=l,xo(l),Ge&&Ge(l),ro()},[Ge,ro]),Uo=u(e=>{Yo.current=-1,Qo.current=null,Vo(e)},[Vo]);io.current=()=>{var e,t;no.current=0;const o=fo.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=Fo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Gt.current?r+1e6:r),a=!Gt.current&&s,l=Nt.current;l&&!s&&(i.computeScene({width:Yt,height:Qt}),Wo(),To(),Nt.current=!1),(l||a)&&o.setAttribute("aria-label",At(i.scene,A+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,d=Vt[0]*c,u=Vt[1]*c;o.width===d&&o.height===u||(o.width=d,o.height=u,o.style.width=Vt[0]+"px",o.style.height=Vt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,Vt[0],Vt[1]);const h=null!==(e=null==_t?void 0:_t.threshold)&&void 0!==e?e:5e3,g=_t&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==_t?void 0:_t.dimOpacity)&&void 0!==t?t:.5),"transparent"!==bt&&!pt){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=bt||(e&&"transparent"!==e?e:null),i=t?xt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,Vt[0],Vt[1]))}const f="radial"===R;n.save(),n.beginPath(),n.rect(Xt.left,Xt.top,Yt,Qt),n.clip(),f?(n.save(),n.translate(Xt.left+Yt/2,Xt.top+Qt/2)):n.translate(Xt.left,Xt.top);const p=Dt?Mo.custom:Mo[A]||[],y={width:Yt,height:Qt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(ko(i.scales),Oo(e=>e+1)),(null==_t?void 0:_t.showBadge)&&jo(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(no.current=requestAnimationFrame(()=>io.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:a,cleanup:l}=e;st(()=>{var e,i;t&&o&&(null===(i=null===(e=n.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,o]);const c=s(l);c.current=l,i(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:so,wasHydratingFromSSR:ao,storeRef:Fo,dirtyRef:Nt,renderFnRef:io,cleanup:()=>{var e;return null===(e=Do.current)||void 0===e?void 0:e.clear()}}),i(()=>{Nt.current=!0,ro()},[A,Yt,Qt,be,bt,ro]),function(e,t,o,n,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,d=l-a.lastIngestTime>c;d!==r&&(s(d),o.current=!0,n())},1e3);return()=>clearInterval(i)},[e,r,n])}(_t,Fo,Nt,ro,So,jo);const Jo=Ho&&bo?Ee?Ee(bo):t(Lo,{hover:bo}):null,en="radial"===R,tn=Jo?t(Wt,{x:bo?en?bo.x+Yt/2:bo.x:0,y:bo?en?bo.y+Qt/2:bo.y:0,containerWidth:Yt,containerHeight:Qt,margin:Xt,className:"stream-ordinal-tooltip",children:Jo}):null;if(rt||!so&&ao){const o=Fo.current;o&&S&&(o.ingest({inserts:lo,bounded:!0}),o.computeScene({width:Yt,height:Qt}));const i=null!==(d=null==o?void 0:o.scene)&&void 0!==d?d:[],r=null!==(h=null==o?void 0:o.scales)&&void 0!==h?h:null,s="radial"===R,a=s?Xt.left+Yt/2:Xt.left,l=s?Xt.top+Qt/2:Xt.top;return e("div",{ref:qt,className:"stream-ordinal-frame"+(mt?" "+mt:""),role:"img","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),style:{position:"relative",width:$?"100%":Vt[0],height:z?"100%":Vt[1]},children:[t(Ht,{summary:Rt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vt[0],height:Vt[1],style:{position:"absolute",left:0,top:0},children:[Zt&&t("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Zt}),e("g",{transform:`translate(${a},${l})`,children:[bt&&t("rect",{x:0,y:0,width:Yt,height:Qt,fill:bt}),i.map((o,i)=>function(o,i){var r,s,a,l,c;const d=("category"in o?o.category:void 0)||("group"in o?o.group:void 0)||"",u=e=>`ord-${o.type}-${d}-${i}-${e}`,h=`ord-${o.type}-${d}-${i}`;switch(o.type){case"rect":{const i=o,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(e,o){const n=e.fillGradient;if(!n)return null;let i=e.x,r=e.y,s=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,s=e.x,a=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,s=e.x+e.w,a=e.y);const l=[];if("colorStops"in n){const e=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let o=0;e.length>o;o++)l.push(t("stop",{offset:e[o].offset,stopColor:e[o].color},o))}else{const o=it(e.style.fill);l.push(t("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return t("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:it(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const o=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+o},${l} A${o},${o} 0 0 0 ${r},${l+o} L${r},${l+d-o} A${o},${o} 0 0 0 ${r+o},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r+o},${l+d} A${o},${o} 0 0 1 ${r},${l+d-o} Z`;break;default:u=`M${r},${l+d} L${r},${l+o} A${o},${o} 0 0 1 ${r+o},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d} Z`}return e(n.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:u,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return e(n.Fragment,{children:[s&&t("defs",{children:s}),t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const e=o;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:it(e.style.fill),opacity:null!==(r=e.style.opacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}case"wedge":{const e=o,n=T().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&n.cornerRadius(e.cornerRadius);const i=n(nt)||"";return t("path",{d:i,transform:`translate(${e.cx},${e.cy})`,fill:it(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const n=o,i=n.columnWidth/2;return e("g","vertical"===n.projection?{children:[t("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),t("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:it(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),t("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.x-.5*i,y1:n.maxPos,x2:n.x+.5*i,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:it(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),t("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),t("line",{x1:n.maxPos,y1:n.y-.5*i,x2:n.maxPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=o,n=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:it(e.style.fill),fillOpacity:null!==(l=e.style.fillOpacity)&&void 0!==l?l:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},u("path"))];if(e.iqrLine&&e.bounds){const o=e.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},u("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},u("med"))):n.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},u("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},u("med")))}return t("g",{children:n},h)}case"connector":return t("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:null!==(c=o.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=o,n=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:n,fill:it(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(o,i)).filter(Boolean)]})]}),t(tt,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:r,showAxes:be,showCategoryTicks:xe,oLabel:co,rLabel:uo,oFormat:ho,rFormat:go,rTickValues:De,tickLabelEdgeAlign:$e,showGrid:Xe,title:vt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,foregroundGraphics:ke(Kt,null===(g=Fo.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:qe,svgAnnotationRules:Ve,annotationFrame:0,xAccessor:"string"==typeof j?j:void 0,yAccessor:"string"==typeof _?_:void 0,annotationData:null==o?void 0:o.getData()}),wt&&"radial"===R&&t("div",{style:{position:"absolute",left:Xt.left+Yt/2,top:Xt.top+Qt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:wt})]})}return e("div",{ref:qt,className:"stream-ordinal-frame"+(mt?" "+mt:""),role:"group","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:$?"100%":Vt[0],height:z?"100%":Vt[1],overflow:"visible"},onKeyDown:Zo,children:[Pt&&t(Bt,{tableId:oo}),Pt&&t(Tt,{scene:null!==(y=null===(p=Fo.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],chartType:A+" chart",tableId:oo,chartTitle:"string"==typeof vt?vt:void 0}),t(Ht,{summary:Rt}),e("div",{role:"img","aria-label":Lt||("string"==typeof vt?vt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ho?Uo:void 0,onMouseLeave:Ho?Xo:void 0,children:[Zt&&t("svg",{style:{position:"absolute",top:0,left:0,width:Vt[0],height:Vt[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Zt})}),t(Je,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,showAxes:be,showGrid:Xe,rFormat:go,rTickValues:De}),t("canvas",{ref:fo,"aria-label":At(null!==(m=null===(v=Fo.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],A+" chart"),style:{position:"absolute",top:0,left:0,width:Vt[0],height:Vt[1]}}),t(It,{hoverPoint:bo}),t(tt,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,showAxes:be,showCategoryTicks:xe,oLabel:co,rLabel:uo,oFormat:ho,rFormat:go,showGrid:Xe,title:vt,legend:Ye,legendHoverBehavior:Qe,legendClickBehavior:Ke,legendHighlightedCategory:Ze,legendIsolatedCategories:Ue,legendPosition:et,foregroundGraphics:ke(Kt,_o),annotations:qe,svgAnnotationRules:Ve,annotationFrame:Ao,xAccessor:"string"==typeof j?j:void 0,yAccessor:"string"==typeof _?_:void 0,annotationData:null===(b=Fo.current)||void 0===b?void 0:b.getData(),underlayRendered:!0}),(Mt||Ct)&&"radial"!==R&&t(ot,{width:Yt,height:Qt,totalWidth:Vt[0],totalHeight:Vt[1],margin:Xt,scales:wo,onBrush:Ct||(()=>{})}),wt&&"radial"===R&&t("div",{style:{position:"absolute",left:Xt.left+Yt/2,top:Xt.top+Qt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:wt}),(null==_t?void 0:_t.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===_t.badgePosition?{top:4,left:4}:"bottom-left"===_t.badgePosition?{bottom:4,left:4}:"bottom-right"===_t.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:So?"#dc3545":"#28a745",color:"white"}),children:So?"STALE":"LIVE"}),t(Ft,{active:Yo.current>=0,hoverPoint:bo,margin:Xt,size:Vt,shape:null===(x=Qo.current)||void 0===x?void 0:x.shape,width:null===(w=Qo.current)||void 0===w?void 0:w.w,height:null===(k=Qo.current)||void 0===k?void 0:k.h}),tn]})]})});To.displayName="StreamOrdinalFrame";const Ho={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 Bo(e,t){return"function"==typeof t?t(e):e[t]}function Io(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 Ro(o={}){const{fields:n,title:i,format:r,style:s={},className:a=""}=o;return o=>{if(!o||"object"!=typeof o)return null;let l;const c=[];if(i){const e=Bo(o,i);l=Io(e,r)}if(n&&n.length>0)n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=Bo(o,n);c.push({label:t,value:Io(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=Io(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=Io(o[e[0]],r))}}const d=Object.assign(Object.assign({},Ho),s);return e("div",{className:("semiotic-tooltip "+a).trim(),style:d,children:[l&&t("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((t,o)=>e("div",{style:{marginTop:0===o&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},o))]})}}function Fo(e){if(!0!==e){if("function"==typeof e){const o=e;return e=>{var n;const i=!0===(null==e?void 0:e.__semioticHoverData)||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?null!==(n=e.data)&&void 0!==n?n:{}:e,r=o(i);return null==r?null:t("div",{className:"semiotic-tooltip",style:Ho,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Ro(e):Ro())}}function Wo(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s}=e,a={};return t&&(a.title=t),o&&(a.description=o),n&&(a.summary=n),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),a}function Do(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function $o(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Fo(t)||o}}const zo=h(null);function No(){return d(zo)}function Eo(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function Go(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}const[qo,Vo]=Dt(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Go(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Go(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Xo,Yo]=Dt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let Qo={positions:new Map};const Ko=new Set;function Zo(){for(const e of Ko)e()}function Uo(e,t){const o=Qo.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(Qo.positions);n.delete(e),Qo={positions:n},Zo()}function Jo(e){const t=p(),o=e.clientId||t,{name:n}=e,i=Vo(e=>e.selections.get(n)),s=Vo(e=>e.setClause),a=Vo(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Eo(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:u(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(n,{clientId:o,type:"point",fields:t})},[o,n,s]),selectInterval:u(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(n,{clientId:o,type:"interval",fields:t})},[o,n,s]),clear:u(()=>{a(n,o)},[a,n,o]),clientId:o}}function en(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const tn=h(!1),on=h(null),nn="undefined"==typeof window?i:c;function rn(e){const t=d(on),o=p(),n=function(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}(e),i=s([]);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i.current,n)||(i.current=n);const r=i.current;nn(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),nn(()=>{t&&t.registerCategories(o,r)},[t,o,r])}function sn({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?n(s,t,o):o?o(i):he[r%he.length];return{label:i+"",color:a}}),label:""}]}}function an(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}function ln(){return Qt(e=>e.theme)}function cn(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function dn(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function un(){var e;const t=ln(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function hn(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=de[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:"#007bff"}function gn(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}n.createContext(void 0);const fn={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 pn(e,t,o){var n,i,r,s,a,l,c;const d=fn[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?d.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?d.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:d.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:d.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||d.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:d.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:d.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:yn(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function yn(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function vn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function mn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function bn(e,t){if(!t)return mn(e);try{const o=t(e);return null==o?mn(e):o}catch(t){return mn(e)}}function xn(e,t){return"function"==typeof t?t(e):e[t]}function wn({categoryAccessor:o,valueAccessor:n,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const d=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,u=xn(d,o),h=xn(d,n),g=i?xn(d,i):void 0;return e("div",{className:"semiotic-tooltip",style:Ho,children:[t("div",{style:{fontWeight:"bold"},children:mn(u)}),t("div",{style:{marginTop:4},children:bn(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(f=i,"string"==typeof f?f:"value"),": ",mn(g)]})]});var f}}function kn({componentName:o,message:n,diagnosticHint:i,width:r,height:s}){return t("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400},children:[t("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:o}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&t("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class An extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,o=this.state.error;return"function"==typeof e?e(o):void 0!==e?e:t(kn,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var On;const Sn="undefined"!=typeof process&&"production"!==(null===(On=process.env)||void 0===On?void 0:On.NODE_ENV);function jn({componentName:e,width:o,height:n,children:i}){return t(An,{fallback:i=>t(kn,{componentName:e,message:i.message,width:o,height:n}),children:i})}const _n={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"},Mn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Cn(e,t,o,n){if(!Sn)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function Pn(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function Ln(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=Pn(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function Tn({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)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(o){const n=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=Ln(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function Hn(e){const{data:o,rawData:n,colorBy:s,colorScheme:l,legendInteraction:c,legendPosition:h,selection:g,linkedHover:f,fallbackFields:y,unwrapData:v=!1,onObservation:m,chartType:b,chartId:x,showLegend:w,userMargin:k,marginDefaults:A,onClick:O,hoverHighlight:S,loading:j,emptyContent:_,width:M,height:C}=e,P=void 0===n,L=r(()=>W(o),[o]),[T,H]=a([]),B=u(e=>{H(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:R,hoverSelectionHook:F,customHoverBehavior:D,customClickBehavior:$,crosshairSourceId:z}=function({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:s,chartType:l,chartId:c,onClick:d,hoverHighlight:h,colorByField:g}){const f=p(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,o),v=Jo({name:(null==e?void 0:e.name)||"__unused__"}),m=function(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Jo({name:t});return{onHover:u(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,s,t]),predicate:n,isActive:i}}({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=Yo(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[w,k]=a(null),A=g||o[0],O=r(()=>{if(!h||null==w||!A)return null;const e=w,t=A;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[h,w,A]),S=u(e=>{var o,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const o=cn(e,t,y.xField);null!=o&&function(e,t,o){const n=Qo.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(Qo={positions:new Map(Qo.positions).set(e,{xValue:t,sourceId:o})},Zo())}(y.name||"hover",o,f)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Uo(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[A];k(null!=o?o+"":null)}else k(null);if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const i=dn(e),r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,m,y,f,s,l,c,b,h,A]),j=u(e=>{var t,o,n,i;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=cn(e,t,y.xField);null!=o&&function(e,t,o){const n=Qo.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(Qo.positions);return t.delete(e),Qo={positions:t},Zo(),!1}Qo={positions:new Map(Qo.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Zo()}(y.name||"hover",o,f)}if(e&&d){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),d(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const o=dn(e),r=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[d,s,b,l,c,y,f]);return i(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{!function(e,t){const o=Qo.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(Qo.positions);n.delete(e),Qo={positions:n},Zo()}(e,f),Uo(e,f)}},[null==y?void 0:y.mode,null==y?void 0:y.name,f]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:j,crosshairSourceId:f}}({selection:g,linkedHover:f,fallbackFields:y,unwrapData:v,onObservation:m,chartType:b,chartId:x,onClick:O,hoverHighlight:S,colorByField:I}),N=function(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}(f,z),E=function(e,t,o){const n=No(),i=un();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=pe(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return pe(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=pe(e,t,s);return e=>n[e]||o(e)}return pe(e,t,s)}if(n&&Object.keys(n).length>0){const e=pe([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}(L,s,l),G=r(()=>{if(!s)return[];const e=new Set;for(const t of L){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[L,s]),q=r(()=>P&&T.length>0?T:G,[P,T,G]),V=function(e,t,o){const[n,i]=a(null),[s,l]=a(new Set),c=u(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=u(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return s.has(n)}}:null},[e,t,n,s]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(c,s,q),X=r(()=>F||(V.legendSelectionHook?V.legendSelectionHook:R),[F,V.legendSelectionHook,R]),Y=function(e){const t=Qt(e=>e.theme.colors.selectionOpacity);return r(()=>{var o,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}(g),Q=un(),K=No(),Z=r(()=>{if(E)return E;if(!s||0===q.length)return;const e=Array.isArray(l)&&l.length>0||"string"==typeof l&&l.length>0?l:Q&&Q.length>0?Q:he,t="__streamCat",o=pe(q.map(e=>({[t]:e})),t,e);return e=>(null==K?void 0:K[e])||o(e)||"#999"},[E,s,q,l,Q,K]),{legend:U,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=d(tn),u=null!==d(on),h=void 0!==n?n:!c&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==l)return l;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[l,t,e,g]);rn(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const n=sn({data:e,colorBy:t,colorScale:o,getColor:fe,categories:f});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[h,t,e,o,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return p&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,p,i]);return{legend:p,margin:y,legendPosition:i}}({data:L,colorBy:s,colorScale:Z,showLegend:w,legendPosition:h,userMargin:k,defaults:A,categories:q}),te=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=ee),c&&"none"!==c&&(e.legendHoverBehavior=V.onLegendHover,e.legendClickBehavior=V.onLegendClick,e.legendHighlightedCategory=V.highlightedCategory,e.legendIsolatedCategories=V.isolatedCategories),P&&s&&(e.legendCategoryAccessor=s,e.onCategoriesChange=B),e},[U,ee,c,V.onLegendHover,V.onLegendClick,V.highlightedCategory,V.isolatedCategories,P,s,B]),oe=Array.isArray(n)?W(n):n,ne=function(e,o,n){if(!e)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return t("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,n)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mn),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}(j,M,C),ie=ne?null:function(e,o,n,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},_n),{width:o,height:n}),children:i||"No data available"}):null}(oe,M,C,_);return{data:L,colorScale:E,allCategories:q,legendState:V,effectiveSelectionHook:X,activeSelectionHook:R,customHoverBehavior:D,customClickBehavior:$,legend:U,margin:J,legendPosition:ee,earlyReturn:ne||ie||null,legendBehaviorProps:te,crosshairProps:N,resolvedSelection:Y}}function Bn({ref:e,frameRef:t,setup:o}){return f(e,()=>({push:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.push(e)},pushMany:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.pushMany(e)},remove:e=>{var o,n;return null!==(n=null===(o=t.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[]},update:(e,o)=>{var n,i;return null!==(i=null===(n=t.current)||void 0===n?void 0:n.update(e,o))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==o?o:[]},getScales:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==o?o:null}}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}const In=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:v=40,roundedTop:m,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:D,showCategoryTicks:$,categoryFormat:z,dataIdAccessor:N}=e,{width:E,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=n,ee=r(()=>W(a),[a]),te=Hn({data:ee,rawData:a,colorBy:f,colorScheme:p,legendInteraction:H,legendPosition:B,selection:S,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"BarChart",chartId:P,showLegend:X,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:E,height:G}),{effectiveLegendProps:oe,effectiveMargin:ne}=Bn({ref:o,frameRef:i,setup:te});if(te.earlyReturn)return te.earlyReturn;Cn("BarChart",ee,"categoryAccessor",d),Cn("BarChart",ee,"valueAccessor",u);const ie=gn(ee,y,u),re=un(),se=r(()=>new Map,[ee]),ae=r(()=>(e,t)=>{const o={};return o.fill=f?fe(e,f,te.colorScale):hn(I,re,p,void 0,se),o},[f,te.colorScale,I,re,p,se]),le=r(()=>{const e=null==O?void 0:O.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},ae(t,o)),e(t,o)||{}):ae,{stroke:R,strokeWidth:F,opacity:D})},[ae,O,R,F,D]),ce=r(()=>an(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),de=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),ue=Tn({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return t(kn,{componentName:"BarChart",message:ue,width:E,height:G});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ie}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[E,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne,barPadding:v}),null!=m&&{roundedTop:m}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),N&&{dataIdAccessor:N}),{baselinePadding:x,enableHover:q,showAxes:n.showAxes,oLabel:U,rLabel:J,rFormat:g}),z&&{oFormat:z}),{showGrid:V,showCategoryTicks:$,oSort:y}),oe),Wo({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:de})),Do({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"BarChart",width:E,height:G,children:t(To,Object.assign({ref:i},he))})});In.displayName="BarChart";const Rn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",stackBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:v=!1,sort:m=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:H,legendInteraction:B,legendPosition:I,color:R,stroke:F,strokeWidth:D,opacity:$,categoryFormat:z}=e,{width:N,height:E,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=n,J=r(()=>W(a),[a]),ee=p||u,te=Hn({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:B,legendPosition:I,selection:j,linkedHover:_,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:H,width:N,height:E});if(te.earlyReturn)return te.earlyReturn;const oe=un(),ne=r(()=>new Map,[J]),ie=r(()=>(e,t)=>ee?te.colorScale?{fill:fe(e,ee,te.colorScale)}:{}:{fill:hn(R,oe,y,t,ne)},[ee,te.colorScale,R,oe,y,ne]),re=r(()=>{const e=null==S?void 0:S.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>{const n=ie(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:ie,{stroke:F,strokeWidth:D,opacity:$})},[ie,S,F,D,$]),se=r(()=>an(re,te.effectiveSelectionHook,te.resolvedSelection),[re,te.effectiveSelectionHook,te.resolvedSelection]),ae=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),le=Tn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:ce,effectiveMargin:de}=Bn({ref:o,frameRef:i,setup:te}),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({chartType:"bar"},null!=a&&{data:J}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:v,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[N,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Z,rLabel:U,rFormat:f}),z&&{oFormat:z}),{showGrid:q}),ce),Wo({title:X,description:Y,summary:Q,accessibleTable:K,className:c,animate:e.animate})),$o({tooltip:k,defaultTooltipContent:ae})),Do({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return le?t(kn,{componentName:"StackedBarChart",message:le,width:N,height:E}):t(jn,{componentName:"StackedBarChart",width:N,height:E,children:t(To,Object.assign({ref:i},ue))})});Rn.displayName="StackedBarChart";const Fn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",groupBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:v=!1,barPadding:m=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:I,stroke:R,strokeWidth:F,opacity:D,categoryFormat:$}=e,{width:z,height:N,enableHover:E,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=n,U=r(()=>W(a),[a]),J=p||u,ee=Hn({data:U,rawData:a,colorBy:J,colorScheme:y,legendInteraction:H,legendPosition:B,selection:S,linkedHover:j,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"GroupedBarChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:z,height:N});if(ee.earlyReturn)return ee.earlyReturn;const te=un(),oe=r(()=>new Map,[U]),ne=O.pieceStyle,ie=r(()=>(e,t)=>{const o=J?ee.colorScale?{fill:fe(e,J,ee.colorScale)}:{}:{fill:hn(I,te,y,t,oe)};if(ne){const n=ne(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[J,ee.colorScale,I,te,y,oe,ne]),re=r(()=>vn(ie,{stroke:R,strokeWidth:F,opacity:D}),[ie,R,F,D]),se=r(()=>an(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ae=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),le=Tn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:ce,effectiveMargin:de}=Bn({ref:o,frameRef:i,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({chartType:"clusterbar"},null!=a&&{data:U}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[z,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de,barPadding:m}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:E}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Z,rFormat:f}),$&&{oFormat:$}),{showGrid:G}),ce),Wo({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:ae})),Do({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return le?t(kn,{componentName:"GroupedBarChart",message:le,width:z,height:N}):t(jn,{componentName:"GroupedBarChart",width:z,height:N,children:t(To,Object.assign({ref:i},ue))})});function Wn({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const i=(a="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=Jo({name:t}),c=o&&n?"xyBrush":o?"xBrush":"yBrush",d=u(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])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&en(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&en(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,n,a,l]);return{brushInteraction:r(()=>({brush:c,during:d,end:d}),[c,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof n?n:"value")}),c=s(l.brushInteraction);c.current=l.brushInteraction;const d=u(e=>{if(i){c.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||o||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}Fn.displayName="GroupedBarChart";const Dn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",subcategoryAccessor:u,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:v,tooltip:m,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:D,rTickValues:$,tickLabelEdgeAlign:z,showCategoryTicks:N,gradientFill:E,trackFill:G,valueExtent:q}=e,{width:V,height:X,enableHover:Y,showGrid:Q,showLegend:K,title:Z,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=n,ne=r(()=>W(a),[a]),ie=p||u,re=r(()=>{if(null!=v)return v;if("sparkline"!==e.mode)return 40;const t=new Set(ne.map(e=>"function"==typeof d?d(e):e[d])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?X:V)-2*o)/(o-1))):1},[v,e.mode,ne,d,g,V,X]),se=Hn({data:ne,rawData:a,colorBy:ie,colorScheme:y,legendInteraction:T,legendPosition:H,selection:O,linkedHover:S,fallbackFields:ie?["string"==typeof ie?ie:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"SwimlaneChart",chartId:C,showLegend:K,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:L,width:V,height:X}),ae=Wn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h});if(se.earlyReturn)return se.earlyReturn;const le=un(),ce=r(()=>new Map,[ne]),de=A.pieceStyle,ue=r(()=>(e,t)=>{const o=ie?se.colorScale?{fill:fe(e,ie,se.colorScale)}:{}:{fill:hn(B,le,y,t,ce)};if(de){const n=de(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ie,se.colorScale,B,le,y,ce,de]),he=r(()=>vn(ue,{stroke:I,strokeWidth:R,opacity:F}),[ue,I,R,F]),ge=r(()=>an(he,se.effectiveSelectionHook,se.resolvedSelection),[he,se.effectiveSelectionHook,se.resolvedSelection]),pe=r(()=>wn({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ye=Tn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ve,effectiveMargin:me}=Bn({ref:o,frameRef:i,setup:se}),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(Object.assign({chartType:"swimlane"},null!=a&&{data:ne}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ge,size:[V,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:me,barPadding:re,enableHover:Y}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===N?void 0:te,rLabel:oe,rFormat:f}),$&&{rTickValues:$}),null!=z&&{tickLabelEdgeAlign:z}),D&&{oFormat:D}),void 0!==N&&{showCategoryTicks:N}),{showGrid:Q}),ve),Wo({title:Z,description:U,summary:J,accessibleTable:ee,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:pe})),Do({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),b&&b.length>0&&{annotations:b}),E&&{gradientFill:!0===E?{topOpacity:.8,bottomOpacity:.05}:E}),null!=G&&{trackFill:G}),q&&{rExtent:q}),ae.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ye?t(kn,{componentName:"SwimlaneChart",message:ye,width:V,height:X}):t(jn,{componentName:"SwimlaneChart",width:V,height:X,children:t(To,Object.assign({ref:i},be))})});function $n(e,t){const{variant:o,frameRef:n,overrides:i,deps:r}=t;f(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.push(t(e));return s},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(o,n);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}Dn.displayName="SwimlaneChart";const zn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:v=[3,8],pointRadius:m=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:A,brush:O,onBrush:S,linkedBrush:j,frameProps:_={},selection:M,linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,chartId:H,loading:B,emptyContent:I,legendInteraction:R,legendPosition:F,color:D,stroke:$,strokeWidth:z,opacity:N,showCategoryTicks:E,categoryFormat:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,oe=r(()=>W(a),[a]),ne=Hn({data:oe,rawData:a,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:F,selection:M,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:H,showLegend:Q,userMargin:l,marginDefaults:n.marginDefaults,loading:B,emptyContent:I,width:q,height:V}),ie=Wn({brushProp:O,onBrushProp:S,linkedBrush:j,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const re=r(()=>{if(!y)return;const e=oe.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[oe,y]),se=un(),ae=r(()=>new Map,[oe]),le=_.pieceStyle,ce=r(()=>(e,t)=>{const o={fillOpacity:b};if(o.fill=f?fe(e,f,ne.colorScale):hn(D,se,p,void 0,ae),o.r=y?function(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,y,v,re):m,le){const n=le(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[f,ne.colorScale,y,v,re,m,b,D,se,p,ae,le]),de=r(()=>vn(ce,{stroke:$,strokeWidth:z,opacity:N}),[ce,$,z,N]),ue=r(()=>an(de,ne.effectiveSelectionHook,ne.resolvedSelection),[de,ne.effectiveSelectionHook,ne.resolvedSelection]),he=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),ge=Tn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ge)return t(kn,{componentName:"SwarmPlot",message:ge,width:q,height:V});const pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:oe}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ue,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:x,enableHover:X}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:ee,rLabel:te,rFormat:g}),G&&{oFormat:G}),{showGrid:Y,showCategoryTicks:E}),ne.legendBehaviorProps),Wo({title:K,description:Z,summary:U,accessibleTable:J,className:c,animate:e.animate})),$o({tooltip:w,defaultTooltipContent:he})),Do({linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),ie.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"SwarmPlot",width:q,height:V,children:t(To,Object.assign({ref:i},pe))})});function Nn(o){return n=>{var i;const r=n.category||n.data&&(null===(i=n.data[0])||void 0===i?void 0:i.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Ho,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e("div",{children:["n = ",s.n]}),null!=s.min&&e("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e("div",{children:["Q1: ",s.q1.toLocaleString()]}),e("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==o?void 0:o.valueAccessor){const i=o.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return e("div",{className:"semiotic-tooltip",style:Ho,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&e("div",{children:["n = ",a]}),null!=l&&e("div",{children:["Median: ",l.toLocaleString()]})]})}return t("div",{className:"semiotic-tooltip",style:Ho,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}zn.displayName="SwarmPlot";const En=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:v=20,tooltip:m,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:I,showCategoryTicks:R,categoryFormat:F}=e,{width:D,height:$,enableHover:z,showGrid:N,showLegend:E,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=n,K=r(()=>W(a),[a]),Z=Hn({data:K,rawData:a,colorBy:f,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"BoxPlot",chartId:_,showLegend:E,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:C,width:D,height:$});if(Z.earlyReturn)return Z.earlyReturn;const U=un(),J=r(()=>new Map,[K]),ee=r(()=>e=>{const t=f?fe(e,f,Z.colorScale):hn(T,U,p,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[f,Z.colorScale,T,U,p,J]),te=r(()=>vn(ee,{stroke:H,strokeWidth:B,opacity:I}),[ee,H,B,I]),oe=r(()=>an(te,Z.effectiveSelectionHook,Z.resolvedSelection),[te,Z.effectiveSelectionHook,Z.resolvedSelection]),ne=r(()=>Nn(),[]),ie=Tn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ie)return t(kn,{componentName:"BoxPlot",message:ie,width:D,height:$});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:oe,showOutliers:y,size:[D,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:v,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Y,rLabel:Q,rFormat:g}),F&&{oFormat:F}),{showGrid:N,showCategoryTicks:R}),Z.legendBehaviorProps),Wo({title:G,description:q,summary:V,accessibleTable:X,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:ne})),Do({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"BoxPlot",width:D,height:$,children:t(To,Object.assign({ref:i},re))})});En.displayName="BoxPlot";const Gn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=s(null);$n(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:H,legendInteraction:B,legendPosition:I,color:R,stroke:F,strokeWidth:D,opacity:$,showCategoryTicks:z,categoryFormat:N}=o,{width:E,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=i,ee=r(()=>W(l),[l]),te=Hn({data:ee,rawData:l,colorBy:y,colorScheme:v,legendInteraction:B,legendPosition:I,selection:j,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:X,userMargin:c,marginDefaults:i.marginDefaults,loading:T,emptyContent:H,width:E,height:G}),oe=Wn({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:h});if(te.earlyReturn)return te.earlyReturn;const ne=r(()=>{if(0===ee.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of ee){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[ee,h]),ie=un(),re=r(()=>new Map,[ee]),se=r(()=>e=>{const t=y?fe(e,y,te.colorScale):hn(R,ie,v,void 0,re);return{fill:t,stroke:t,fillOpacity:.8}},[y,te.colorScale,R,ie,v,re]),ae=r(()=>vn(se,{stroke:F,strokeWidth:D,opacity:$}),[se,F,D,$]),le=r(()=>an(ae,te.effectiveSelectionHook,te.resolvedSelection),[ae,te.effectiveSelectionHook,te.resolvedSelection]),ce=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return e("div",{className:"semiotic-tooltip",style:Ho,children:[i&&t("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&e("div",{children:["Count: ",r]}),s&&2===s.length&&e("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),de=Tn({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(de)return t(kn,{componentName:"Histogram",message:de,width:E,height:G});const 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({chartType:"histogram"},null!=l&&{data:ee}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:le,bins:g,normalize:f}),w?{rExtent:w}:ne&&{rExtent:ne}),{size:[E,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te.margin,barPadding:m,enableHover:q}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:p}),N&&{oFormat:N}),{showGrid:V,showCategoryTicks:z}),te.legendBehaviorProps),Wo({title:Y,description:Q,summary:K,accessibleTable:Z,className:d,animate:o.animate})),$o({tooltip:b,defaultTooltipContent:ce})),Do({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"Histogram",width:E,height:G,children:t(To,Object.assign({ref:a},ue))})});Gn.displayName="Histogram";const qn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:H,legendInteraction:B,legendPosition:I,color:R,stroke:F,strokeWidth:D,opacity:$,showCategoryTicks:z,categoryFormat:N}=e,{width:E,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=n,ee=r(()=>W(a),[a]),te=Hn({data:ee,rawData:a,colorBy:y,colorScheme:v,legendInteraction:B,legendPosition:I,selection:j,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:H,width:E,height:G}),oe=Wn({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const ne=un(),ie=r(()=>new Map,[ee]),re=r(()=>e=>{const t=y?fe(e,y,te.colorScale):hn(R,ne,v,void 0,ie);return{fill:t,stroke:t,fillOpacity:.6}},[y,te.colorScale,R,ne,v,ie]),se=r(()=>vn(re,{stroke:F,strokeWidth:D,opacity:$}),[re,F,D,$]),ae=r(()=>an(se,te.effectiveSelectionHook,te.resolvedSelection),[se,te.effectiveSelectionHook,te.resolvedSelection]),le=r(()=>Nn({valueAccessor:u}),[u]),ce=Tn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ce)return t(kn,{componentName:"ViolinPlot",message:ce,width:E,height:G});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({chartType:"violin"},null!=a&&{data:ee}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ae,bins:g,showIQR:f,size:[E,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:m,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:U,rLabel:J,rFormat:p}),N&&{oFormat:N}),{showGrid:V,showCategoryTicks:z}),te.legendBehaviorProps),Wo({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate})),$o({tooltip:b,defaultTooltipContent:le})),Do({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"ViolinPlot",width:E,height:G,children:t(To,Object.assign({ref:i},de))})});qn.displayName="ViolinPlot";const Vn=g(function(e,o){var n;const i=pn(e.mode,{width:e.width,height:e.height,showGrid:null===(n=e.showGrid)||void 0===n||n,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null);$n(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:v="auto",dotRadius:m=5,categoryPadding:b=10,tooltip:x,annotations:w,valueExtent:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:I,strokeWidth:R,opacity:F,categoryFormat:D}=e,{width:$,height:z,enableHover:N,showGrid:E,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=i,Z=r(()=>W(l),[l]),U=Hn({data:Z,rawData:l,colorBy:p,colorScheme:y,legendInteraction:T,legendPosition:H,selection:O,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"DotPlot",chartId:C,showLegend:G,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:$,height:z});if(U.earlyReturn)return U.earlyReturn;const J=gn(Z,v,h),ee=un(),te=r(()=>new Map,[Z]),oe=A.pieceStyle,ne=r(()=>(e,t)=>{const o={r:m,fillOpacity:.8};if(o.fill=p?fe(e,p,U.colorScale):hn(B,ee,y,void 0,te),oe){const n=oe(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[p,U.colorScale,m,B,ee,y,te,oe]),ie=r(()=>vn(ne,{stroke:I,strokeWidth:R,opacity:F}),[ne,I,R,F]),re=r(()=>an(ie,U.effectiveSelectionHook,U.resolvedSelection),[ie,U.effectiveSelectionHook,U.resolvedSelection]),se=r(()=>wn({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),ae=Tn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ae)return t(kn,{componentName:"DotPlot",message:ae,width:$,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:J}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[$,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:b,enableHover:N}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:f}),D&&{oFormat:D}),{showGrid:E,oSort:v}),U.legendBehaviorProps),Wo({title:q,description:V,summary:X,accessibleTable:Y,className:d,animate:e.animate})),$o({tooltip:x,defaultTooltipContent:se})),Do({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),w&&w.length>0&&{annotations:w}),k&&{rExtent:k}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"DotPlot",width:$,height:z,children:t(To,Object.assign({ref:a},le))})});Vn.displayName="DotPlot";const Xn=g(function(e,o){var n,i;const a=pn(e.mode,{width:null!==(n=e.width)&&void 0!==n?n:400,height:null!==(i=e.height)&&void 0!==i?i:400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks}),l=s(null),{data:c,margin:d,className:u,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,emptyContent:M,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:H,opacity:B}=e,{width:I,height:R,enableHover:F,showLegend:D,title:$,description:z,summary:N,accessibleTable:E}=a,G=r(()=>W(c),[c]),q=f||h,V=Hn({data:G,rawData:c,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"PieChart",chartId:j,showLegend:D,userMargin:d,marginDefaults:a.marginDefaults,loading:_,emptyContent:M,width:I,height:R});if(V.earlyReturn)return V.earlyReturn;const X=un(),Y=r(()=>new Map,[G]),Q=r(()=>(e,t)=>q?V.colorScale?{fill:fe(e,q,V.colorScale)}:{}:{fill:hn(L,X,p,t,Y)},[q,V.colorScale,L,X,p,Y]),K=r(()=>{const e=null==x?void 0:x.pieceStyle;return vn(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},Q(t,o)),e(t,o)||{}):Q,{stroke:T,strokeWidth:H,opacity:B})},[Q,x,T,H,B]),Z=r(()=>an(K,V.effectiveSelectionHook,V.resolvedSelection),[K,V.effectiveSelectionHook,V.resolvedSelection]),U=r(()=>wn({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),J=Tn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=Bn({ref:o,frameRef:l,setup:V}),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({chartType:"pie"},null!=c&&{data:G}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Z,startAngle:y}),null!=v&&{cornerRadius:v}),{size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),Wo({title:$,description:z,summary:N,accessibleTable:E,className:u,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:U})),Do({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(kn,{componentName:"PieChart",message:J,width:I,height:R}):t(jn,{componentName:"PieChart",width:I,height:R,children:t(To,Object.assign({ref:l},oe))})});Xn.displayName="PieChart";const Yn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:v,tooltip:m,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,emptyContent:M,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:H,opacity:B}=e,{width:I,height:R,enableHover:F,showLegend:D,title:$,description:z,summary:N,accessibleTable:E}=n,G=r(()=>W(a),[a]),q=f||d,V=Hn({data:G,rawData:a,colorBy:q,colorScheme:p,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"DonutChart",chartId:j,showLegend:D,userMargin:l,marginDefaults:n.marginDefaults,loading:_,emptyContent:M,width:I,height:R});if(V.earlyReturn)return V.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(I,R)),Y=un(),Q=r(()=>new Map,[G]),K=x.pieceStyle,Z=r(()=>(e,t)=>{let o;if(o=q?V.colorScale?{fill:fe(e,q,V.colorScale)}:{}:{fill:hn(L,Y,p,t,Q)},K){const n=K(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[q,V.colorScale,L,Y,p,Q,K]),U=r(()=>vn(Z,{stroke:T,strokeWidth:H,opacity:B}),[Z,T,H,B]),J=r(()=>an(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),ee=r(()=>wn({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),te=Tn({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:oe,effectiveMargin:ne}=Bn({ref:o,frameRef:i,setup:V}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:G}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:y}),null!=v&&{cornerRadius:v}),{centerContent:g,size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),oe),Wo({title:$,description:z,summary:N,accessibleTable:E,className:c,animate:e.animate})),$o({tooltip:m,defaultTooltipContent:ee})),Do({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?t(kn,{componentName:"DonutChart",message:te,width:I,height:R}):t(jn,{componentName:"DonutChart",width:I,height:R,children:t(To,Object.assign({ref:i},ie))})});Yn.displayName="DonutChart";const Qn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),a=s(null),l="context"===o.mode,{compactMode:c}=i,{value:d,min:u=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:v=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!c,sweep:k=240,fillZones:A=!0,tooltip:O,annotations:S,frameProps:j={},className:_,stroke:M,strokeWidth:C,opacity:P}=o,{width:L,height:T,title:H,description:B,summary:I,accessibleTable:R}=i,F=Math.max(u,Math.min(h,d)),W=h-u||1,D=(F-u)/W,{gaugeData:$,pieceStyle:z,gaugeAnnotations:N}=r(()=>{const e=[],t=new Map,o=[];let n=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(u,Math.min(h,e.value))})),h>n[n.length-1].value&&n.push({value:h,color:n[n.length-1].color});let i=u;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/W;if(A){const n=(i-u)/W,a=Math.max(0,Math.min(D,(r.value-u)/W)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:p,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(w&&g&&g.length>0)for(const e of g)e.value>u&&h>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:p},gaugeAnnotations:o}},[d,u,h,g,f,p,D,W,w,A]),E=r(()=>vn(z,{stroke:M,strokeWidth:C,opacity:P}),[z,M,C,P]),G=k*Math.PI/180,q=180+(360-k)/2,V=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+q*Math.PI/180,Y=[[Math.cos(X),Math.sin(X)],[Math.cos(X+G),Math.sin(X+G)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>G+.001||Y.push([Math.cos(e),Math.sin(e)]);const Q=Math.min(...Y.map(e=>e[0])),K=Math.max(...Y.map(e=>e[0])),Z=Math.min(...Y.map(e=>e[1])),U=Math.max(...Y.map(e=>e[1])),J=(Z+U)/2,ee=(Q+K)/2,te=Math.max(4,Math.min((L-2*V)/(K-Q),(T-2*V)/(U-Z))-2),oe=Math.max(0,Math.min(te-1.5,te*(1-y))),ne=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b(F,u,h):b;const o=x?x(F):Math.round(F)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),w&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[b,F,u,h,x,w,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x(F):Math.round(F)+""}:null,[l,b,F,x]),le=r(()=>{if(!v)return null;const e=-Math.PI/2+q*Math.PI/180+D*G,t=oe>20?oe-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[v,D,q,G,oe,m]),ce=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-oe),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return e("g",{transform:`translate(${r},${s})`,children:[t("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const e=-Math.PI/2+q*Math.PI/180+(o.value-u)/W*G,r=oe-14,s=(i.height||T)/2;return t("text",{x:(i.width||L)/2+Math.cos(e)*r,y:s+Math.sin(e)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label},"gauge-label-"+n)}return"gauge-value"===o.type?t("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*oe,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[L,T,u,W,q,G,oe,te]),de=r(()=>{const e=[...N,...S||[]];return le&&e.push(le),ae&&e.push(ae),e},[N,S,le,ae]),ue=r(()=>o=>{var n;const i=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n[0])||(null==o?void 0:o.data)||o,r=null==i?void 0:i._isFill;return e("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[t("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),t("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(F):"Remaining"})]})},[F]);if(0===$.length)return t(kn,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:$,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:oe,startAngle:q,sweepAngle:k,centerContent:se,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:ne-re/2,right:L-ne-re/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Fo(O)||ue,svgAnnotationRules:ce},de.length>0&&{annotations:de}),H&&{title:H}),B&&{description:B}),I&&{summary:I}),void 0!==R&&{accessibleTable:R}),_&&{className:_}),null!=o.animate&&{animate:o.animate}),j);return t(jn,{componentName:"GaugeChart",width:L,height:T,children:t(To,Object.assign({ref:a},he))})});Qn.displayName="GaugeChart";const Kn=g(function(e,o){const n=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);$n(o,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:v,categoryPadding:m=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,chartId:M,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:H,stroke:B,strokeWidth:I,opacity:R,showCategoryTicks:F,categoryFormat:D}=e,{width:$,height:z,enableHover:N,showGrid:E,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=n,Z=r(()=>W(a),[a]),U=Hn({data:Z,rawData:a,colorBy:y,colorScheme:v,legendInteraction:L,legendPosition:T,selection:A,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:j,hoverHighlight:_,chartType:"RidgelinePlot",chartId:M,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:C,emptyContent:P,width:$,height:z});if(U.earlyReturn)return U.earlyReturn;const J=un(),ee=r(()=>new Map,[Z]),te=r(()=>e=>{const t=y?fe(e,y,U.colorScale):hn(H,J,v,void 0,ee);return{fill:t,stroke:t,fillOpacity:.5}},[y,U.colorScale,H,J,v,ee]),oe=r(()=>vn(te,{stroke:B,strokeWidth:I,opacity:R}),[te,B,I,R]),ne=r(()=>an(oe,U.effectiveSelectionHook,U.resolvedSelection),[oe,U.effectiveSelectionHook,U.resolvedSelection]),ie=r(()=>Nn(),[]),re=Tn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(re)return t(kn,{componentName:"RidgelinePlot",message:re,width:$,height:z});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({chartType:"ridgeline"},null!=a&&{data:Z}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ne,bins:g,size:[$,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:m,enableHover:N}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Q,rLabel:K,rFormat:p}),D&&{oFormat:D}),{showGrid:E,showCategoryTicks:F,oSort:!1,amplitude:f}),U.legendBehaviorProps),Wo({title:q,description:V,summary:X,accessibleTable:Y,className:c,animate:e.animate})),$o({tooltip:b,defaultTooltipContent:ie})),Do({linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"RidgelinePlot",width:$,height:z,children:t(To,Object.assign({ref:i},se))})});Kn.displayName="RidgelinePlot";const Zn=g(function(o,n){const i=pn(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=s(null);$n(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,stepAccessor:u="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:v=.3,showLabels:m=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:I,categoryFormat:R}=o,F="vertical"===y,{width:D,height:$,enableHover:z,showLegend:N,title:E,description:G,summary:q,accessibleTable:V}=i,X=F?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},Y=r(()=>W(l),[l]),Q=f||g,K=!Q,Z=Hn({data:Y,rawData:l,colorBy:Q,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"FunnelChart",chartId:_,showLegend:N,userMargin:c,marginDefaults:X,loading:M,emptyContent:C,width:D,height:$});if(Z.earlyReturn)return Z.earlyReturn;Cn("FunnelChart",Y,"stepAccessor",u),Cn("FunnelChart",Y,"valueAccessor",h);const U=un(),J=r(()=>new Map,[Y]),ee=r(()=>{if(K)return T||((null==U?void 0:U[0])?U[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,T,U,p]),te=w.pieceStyle,oe=r(()=>(e,t)=>{const o={};if(o.fill=ee||(Q?fe(e,Q,Z.colorScale):hn(T,U,p,t,J)),te){const n=te(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ee,Q,Z.colorScale,T,U,p,J,te]),ne=r(()=>vn(oe,{stroke:H,strokeWidth:B,opacity:I}),[oe,H,B,I]),ie=r(()=>an(ne,Z.effectiveSelectionHook,Z.resolvedSelection),[ne,Z.effectiveSelectionHook,Z.resolvedSelection]),re=r(()=>o=>{var n,i,r,s,a,l;const c=(null==o?void 0:o.data)||o,d=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",u=null!==(r=null!==(i=null!==(n=null==c?void 0:c.__funnelValue)&&void 0!==n?n:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return e("div",{className:"semiotic-tooltip",style:Ho,children:[d&&t("div",{style:{fontWeight:"bold"},children:d+""}),p&&p!==d&&t("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&t("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e("div",{style:{marginTop:4},children:[u+"",y]})]})},[]),se=Tn({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(se)return t(kn,{componentName:"FunnelChart",message:se,width:D,height:$});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(Object.assign({chartType:F?"bar-funnel":"funnel"},null!=l&&{data:Y}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:F?"vertical":"horizontal",barPadding:F?40:0,pieceStyle:ie,size:[D,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:F,showCategoryTicks:F}),R&&{oFormat:R}),{showGrid:F}),!F&&{connectorOpacity:v}),{showLabels:m}),Z.legendBehaviorProps),E&&{title:E}),G&&{description:G}),q&&{summary:q}),void 0!==V&&{accessibleTable:V}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?re:Fo(b)||re}),(A||O||S||j)&&{customHoverBehavior:Z.customHoverBehavior}),(O||S||A)&&{customClickBehavior:Z.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(jn,{componentName:"FunnelChart",width:D,height:$,children:t(To,Object.assign({ref:a},ae))})});Zn.displayName="FunnelChart";const Un={RdBu:ne,PiYG:ie,PRGn:re,BrBG:se,RdYlBu:ae,RdYlGn:le,Spectral:ce},Jn="__likert_neutral_neg",ei="__likert_neutral_pos";function ti(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function oi(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(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 o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function ni(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Jn,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:ei,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function ii(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Jn?r=o:o.__likertLevel===ei?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const ri=g(function(e,o){const i=pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),l=s(null),{data:c,margin:d,className:h,categoryAccessor:g="question",valueAccessor:p,levelAccessor:y,countAccessor:v="count",levels:m,orientation:b="horizontal",colorScheme:x,barPadding:w=20,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,valueFormat:T,loading:H,emptyContent:B,legendInteraction:I,legendPosition:R,categoryFormat:F,stroke:W,strokeWidth:D,opacity:$}=e,{width:z,height:N,enableHover:E,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,U="horizontal"===b,J=void 0===c,ee=!y,te=function(){var e;const t=ln();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=m.length?x:function(e,t){if(0>=e)return[];if(t){const o=Un[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(m.length,te),[x,m.length,te]),ne=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],oe[t]||"#888");return e},[m,oe]),{processedData:ie,reAggregate:re,accumulatorRef:se}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:c}){const d=!i,h=r(()=>ti(o,"question"),[o]),g=r(()=>d?ti(n,"score"):null,[d,n]),f=r(()=>d?null:ti(i,"level"),[d,i]),p=r(()=>d?null:ti(a,"count"),[d,a]),y=e||[],v=s([]),m=r(()=>{if(0===y.length)return[];let e=oi(y,t,h,g,f,p);return l&&(e=ni(e,t),e=ii(e,t)),e},[y,t,h,g,f,p,l]),b=u(e=>{var o;let n=oi(e,t,h,g,f,p);l&&(n=ni(n,t),n=ii(n,t)),null===(o=c.current)||void 0===o||o.replace(n)},[t,h,g,f,p,l,c]);return{processedData:m,reAggregate:b,accumulatorRef:v}}({data:c,levels:m,categoryAccessor:g,valueAccessor:p,levelAccessor:y,countAccessor:v,isDiverging:U,frameRef:l}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:i="right"}){const l=s(new Set),c=s([]),[d,h]=a(0),g=No(),f=un(),p=u(e=>{const o=e[t];return null!=o?o+"":null},[t]),y=u(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||l.current.has(t)||(l.current.add(t),c.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,p]),v=u(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),i=c.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(l.current=new Set(n),c.current=n,h(e=>e+1))},[e,t]),m=u(e=>t=>{y([t]),e(t)},[y]),b=u(e=>t=>{y(t),e(t)},[y]),x=u(()=>{l.current=new Set,c.current=[],h(e=>e+1)},[]);rn(e&&t?c.current:[]);const w=r(()=>{if(!e||!t||!1===n)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:f&&f.length>0?f:he,s=t,a=i.map(e=>({[s]:e})),l=pe(a,s,r);return sn({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:fe})},[e,t,n,o,g,f,d]),k=r(()=>{if(w)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[w,i]);return{wrapPush:m,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:v}:{},streamingLegend:w,streamingMarginAdjust:k}}({isPushMode:J,colorBy:ae,colorScheme:oe,showLegend:q,legendPosition:R}),ce=u(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),de=u(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);f(o,()=>({push:ce,pushMany:de,remove:e=>{var t,o;return null!==(o=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=l.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;se.current=[],le.resetCategories(),null===(e=l.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ce,de,le.resetCategories,se]);const ue=Hn({data:ie,rawData:c,colorBy:ae,colorScheme:oe,legendInteraction:I,legendPosition:R,selection:j,linkedHover:_,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:q,userMargin:d,marginDefaults:i.marginDefaults,loading:H,emptyContent:B,width:z,height:N});if(ue.earlyReturn)return ue.earlyReturn;const ge=r(()=>{const e=m.length;return e%2!=0&&ne.get(m[Math.floor(e/2)])||"#888"},[m,ne]),ye=S.pieceStyle,ve=r(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Jn||r===ei)s={fill:ge};else{const e=i||r;s=e&&ne.has(e)?{fill:ne.get(e)}:{fill:"#888"}}if(ye){const o=ye(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[ne,ge,ye]),me=r(()=>vn(ve,{stroke:W,strokeWidth:D,opacity:$}),[ve,W,D,$]),be=r(()=>an(me,ue.effectiveSelectionHook,ue.resolvedSelection),[me,ue.effectiveSelectionHook,ue.resolvedSelection]),xe=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),we=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Jn||o===ei?xe:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===Jn||o===ei?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:Ho},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[xe]),ke=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!v)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return ee?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),v&&(e.countAccessor=v)),Tn({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:m}})},[c,g,p,y,v,m,ee]),Ae=r(()=>[{styleFn:e=>({fill:ne.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,ne]),Oe=r(()=>!1!==q?Object.assign(Object.assign({},ue.legendBehaviorProps),{legend:{legendGroups:Ae},legendPosition:R||ue.legendPosition||"bottom"}):ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,R,q,Ae]),Se=r(()=>{const e=Object.assign({},ue.margin);if(J&&!1!==q){const t=R||"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(le.streamingMarginAdjust)for(const[t,o]of Object.entries(le.streamingMarginAdjust))o>e[t]&&(e[t]=o);return U&&100>e.left&&(e.left=100),e},[ue.margin,le.streamingMarginAdjust,U,J,q,R]),je=r(()=>T||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,T]),_e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=c&&{data:ie}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:be,size:[z,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Se,barPadding:w,enableHover:E}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z||(U?void 0:"Percentage"),rFormat:je}),F&&{oFormat:F}),{showGrid:G}),Oe),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),h&&{className:h}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===k?()=>null:!0===k?we:Fo(k)||we}),(_||M||C||P)&&{customHoverBehavior:ue.customHoverBehavior}),(M||C||_)&&{customClickBehavior:ue.customClickBehavior}),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ke?t(kn,{componentName:"LikertChart",message:ke,width:z,height:N}):t(jn,{componentName:"LikertChart",width:z,height:N,children:t(To,Object.assign({ref:l},_e))})});ri.displayName="LikertChart";const si=g(function(e,o){const{data:n,layout:i,layoutConfig:a,categoryAccessor:l="category",valueAccessor:c="value",oExtent:d,rExtent:u,projection:h="vertical",margin:g,className:f,colorScheme:p,showAxes:y=!1,annotations:v,onObservation:m,onClick:b,selection:x,linkedHover:w,chartId:k,loading:A,emptyContent:O,frameProps:S={}}=e,{frameRef:j,resolved:_,safeData:M,setup:C,earlyReturn:P}=function(e){var t;const o=function(e){const t=s(null);return $n(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:pn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:i}=o,a=Hn({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:n.width,height:n.height});return Object.assign(Object.assign({},o),{safeData:a.data,setup:a,earlyReturn:a.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorScheme:p,selection:x,linkedHover:w,onObservation:m,onClick:b,chartId:k,loading:A,emptyContent:O,margin:g,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode});if(P)return P;const{width:L,height:T,enableHover:H,showGrid:B,title:I,description:R,summary:F,accessibleTable:W}=_,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:M}),{customLayout:i,layoutConfig:a,oAccessor:l,rAccessor:c,oExtent:d,rExtent:u,projection:h,colorScheme:p,size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:C.margin,enableHover:H,showAxes:y,showGrid:B,annotations:v}),Wo({title:I,description:R,summary:F,accessibleTable:W,className:f,animate:e.animate})),Do({linkedHover:w,onObservation:m,onClick:b,hoverHighlight:!1,customHoverBehavior:C.customHoverBehavior,customClickBehavior:C.customClickBehavior})),S);return t(jn,{componentName:"OrdinalCustomChart",width:L,height:T,children:t(To,Object.assign({ref:j},D))})});si.displayName="OrdinalCustomChart";export{In as BarChart,En as BoxPlot,Yn as DonutChart,Vn as DotPlot,Zn as FunnelChart,Qn as GaugeChart,Fn as GroupedBarChart,Gn as Histogram,ri as LikertChart,si as OrdinalCustomChart,Xn as PieChart,Kn as RidgelinePlot,Rn as StackedBarChart,To as StreamOrdinalFrame,zn as SwarmPlot,Dn as SwimlaneChart,qn as ViolinPlot,wo as createHatchPattern};
|