semiotic 3.5.2 → 3.5.4
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 +9 -8
- package/README.md +15 -15
- package/ai/componentMetadata.cjs +9 -2
- package/ai/dist/mcp-server.js +4 -1
- package/ai/examples.md +27 -0
- package/ai/schema.json +300 -41
- package/ai/system-prompt.md +1 -1
- package/dist/components/ThemeProvider.d.ts +2 -2
- package/dist/components/charts/index.d.ts +3 -3
- package/dist/components/charts/network/ProcessSankey.d.ts +22 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +5 -1
- package/dist/components/charts/network/Treemap.d.ts +8 -0
- package/dist/components/charts/network/processSankey/algorithm.d.ts +57 -0
- package/dist/components/charts/network/processSankey/buildScenes.d.ts +6 -0
- package/dist/components/charts/network/processSankey/streamingLayout.d.ts +13 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +10 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +24 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
- package/dist/components/charts/shared/gaugeGradient.d.ts +62 -0
- package/dist/components/charts/shared/hooks.d.ts +2 -2
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -2
- package/dist/components/charts/shared/tooltipUtils.d.ts +11 -0
- package/dist/components/charts/shared/types.d.ts +17 -2
- package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +4 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +4 -2
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +2 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +2 -0
- package/dist/components/charts/shared/withChartWrapper.d.ts +10 -3
- package/dist/components/charts/xy/AreaChart.d.ts +27 -2
- package/dist/components/charts/xy/LineChart.d.ts +26 -2
- package/dist/components/charts/xy/Scatterplot.d.ts +5 -1
- package/dist/components/semiotic-ai.d.ts +1 -1
- package/dist/components/semiotic-realtime.d.ts +3 -3
- package/dist/components/semiotic-server.d.ts +1 -0
- package/dist/components/semiotic-xy.d.ts +1 -1
- package/dist/components/semiotic.d.ts +6 -5
- package/dist/components/server/renderToStaticSVG.d.ts +4 -1
- package/dist/components/server/serverChartConfigs.d.ts +1 -0
- package/dist/components/server/staticAnnotations.d.ts +1 -1
- package/dist/components/server/staticLegend.d.ts +35 -0
- package/dist/components/server/themeResolver.d.ts +7 -1
- package/dist/components/store/ThemeStore.d.ts +9 -1
- package/dist/components/stream/AccessibleDataTable.d.ts +2 -2
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -1
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
- package/dist/components/stream/PipelineStore.d.ts +20 -13
- package/dist/components/stream/SVGOverlay.d.ts +4 -30
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/accessorUtils.d.ts +2 -1
- package/dist/components/stream/geoTypes.d.ts +2 -1
- package/dist/components/stream/hoverUtils.d.ts +1 -0
- package/dist/components/stream/layouts/hierarchyLayoutPlugin.d.ts +1 -1
- package/dist/components/stream/legendRenderer.d.ts +2 -1
- package/dist/components/stream/networkTypes.d.ts +13 -1
- package/dist/components/stream/ordinalTypes.d.ts +31 -3
- package/dist/components/stream/renderers/wedgePathBuilder.d.ts +87 -0
- package/dist/components/stream/types.d.ts +110 -16
- package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +20 -0
- package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/lineScene.d.ts +4 -3
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/ribbonScene.d.ts +107 -0
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +9 -12
- package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -2
- package/dist/components/types/legendTypes.d.ts +15 -0
- package/dist/components/types/marginType.d.ts +17 -3
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +3 -3
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +1 -1
- package/dist/semiotic.d.ts +6 -5
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +25 -25
- package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +0 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as a,useCallback as l,useSyncExternalStore as c,createContext as d,useState as u,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as v,brushY as m,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleSequential as S,scaleBand as O}from"d3-scale";import{quadtree as _}from"d3-quadtree";import{curveNatural as C,curveBasis as j,curveStepAfter as M,curveStepBefore as P,curveStep as L,curveCatmullRom as T,curveCardinal as B,curveMonotoneY as N,curveMonotoneX as E,line as D,area as I,curveLinear as H,arc as R,pie as W}from"d3-shape";import{bin as F,quantile as z,min as $,groups as Y,max as G,sum as q,mean as X,group as V}from"d3-array";import{packEnclose as U,hierarchy as K,partition as Q,pack as Z,treemap as J,treemapBinary as ee,cluster as te,tree as oe}from"d3-hierarchy";import ne from"regression";import{interpolateNumber as ie}from"d3-interpolate";import{forceLink as re,forceSimulation as se,forceManyBody as ae,forceCenter as le,forceX as ce,forceY as de}from"d3-force";import{ribbon as ue,chord as he}from"d3-chord";const ge=Object.freeze([]);function fe(e){if(!e)return ge;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}function pe(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n+1>>1;t[i]>e?n=i-1:o=i}return t[o]}function ye(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n>>1;e>t[i]?o=i+1:n=i}return t[o]}function ve({width:t,height:o,totalWidth:n,totalHeight:a,margin:l,dimension:c,scales:d,onBrush:u,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(u);A.current=u;const S=i(d);S.current=d;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),_=i(O);_.current=O;const C=i(!1),j=i(null);return s(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),n="x"===c?v():"y"===c?m():b();return n.extent([[0,0],[t,o]]),n.on("brush end",i=>{if(C.current)return;const r=S.current;if(!r)return;if(!i.selection)return j.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(0)]}else if("y"===c){const[e,o]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(e)]}else{const[[e,t],[o,n]]=i.selection;s=[r.x.invert(e),r.x.invert(o)],a=[r.y.invert(n),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=_.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[pe(e[0],t),ye(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const o=r.x(s[0]),a=r.x(s[1]);if(C.current=!0,"x"===c)e.call(n.move,[o,a]);else if("xy"===c){const t=i.selection;e.call(n.move,[[o,t[0][1]],[a,t[1][1]]])}C.current=!1}const l={x:s,y:a};j.current=l,A.current(l)}),e.call(n),w.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),w.current=null}},[t,o,c,g,h,p]),s(()=>{if(!(x&&d&&w.current&&j.current))return;if(!k.current)return;if("y"===c)return;const e=j.current,t=d.x.domain()[0],o=y(k.current).select(".brush-g");if(t>=e.x[1])return C.current=!0,o.call(w.current.move,null),C.current=!1,j.current=null,void A.current(null);let n=e.x[0],i=!1;if(t>e.x[0]){if(n=t,"bin"===g){const e=_.current;e&&e.length>0?n=ye(t,e):h&&h>0&&(n=Math.ceil(t/h)*h)}if(n>=e.x[1])return C.current=!0,o.call(w.current.move,null),C.current=!1,j.current=null,void A.current(null);i=!0}const r=d.x(n),s=d.x(e.x[1]);if(C.current=!0,"x"===c)o.call(w.current.move,[r,s]);else{const t=d.y(e.y[1]),n=d.y(e.y[0]);o.call(w.current.move,[[r,t],[s,n]])}if(C.current=!1,i){const t={x:[n,e.x[1]],y:e.y};j.current=t,A.current(t)}},[d,x,c,g,h]),e("svg",{ref:k,width:n,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class me{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=fe(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=fe(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}}function be(t){let o=null;const n=()=>(o||(o=d(null)),o),s=xe(t);return[function({children:o,initialState:s}){const a=i(s),l=r(()=>xe(t,a.current),[]),c=n();return e(c.Provider,{value:l,children:o})},e=>{var t;const o=n(),r=null!==(t=a(o))&&void 0!==t?t:s,d=i(e);d.current=e;const u=l(()=>d.current(r.getState()),[r]),h=l(()=>d.current(r.getState()),[r]);return c(r.subscribe,u,h)}]}function xe(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 ke(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 we(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:Ae})})),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 Ae=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Se={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}},Oe={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}},_e={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ae,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 Ce(e,t){if("light"===t)return Se;if("dark"===t)return Oe;if("high-contrast"===t)return _e;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?Oe:Se;return we(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 we(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[je,Me]=be(e=>({theme:Se,setTheme(t){e(e=>({theme:Ce(e.theme,t)}))}}));class Pe{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 Le{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 Te(e,t,o,n,i){const r=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=r.get(l);if(c||(c={start:l,end:l+n,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function Be(e,t,o,n,i,r){const s=[];for(const i of e){const e=o(i),r=n(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function Ne(e,t,o,n,i,r,s,a){const l=[];for(const r of e){const e=o(r),s=n(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),d=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(d)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),d=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],d[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:d,style:r,datum:e,group:s}}function Ee(e,t,o,n){var i,r,s;const a=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const i of t)e+=o(i,n)||0;a.set(n,-e/2)}else if("wiggle"===n){e.length>0&&a.set(e[0],0);for(let n=1;e.length>n;n++){const r=e[n-1],s=e[n];let l=0,c=0,d=0;for(const e of t){const t=o(e,s)||0;l+=(2*d+t)*(t-(o(e,r)||0)),c+=t,d+=t}const u=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,u-(c>0?l/(2*c):0))}if(e.length>0){let n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(null!==(r=a.get(i))&&void 0!==r?r:0)+e/2}const i=n/e.length;for(const t of e)a.set(t,(null!==(s=a.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)a.set(t,0);return a}function De(e,t,o,n,i,r,s){const a=o(e),l=n(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function Ie(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 He(e,t,o,n,i,r,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function Re(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function We(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function Fe(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function ze(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function $e(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Ge(e){const t=e.map($e),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return Ye(e,o,n)}if(e>=1){const[e,n,i]=t[o];return Ye(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 Ye(Math.round(s+(c-s)*r),Math.round(a+(d-a)*r),Math.round(l+(u-l)*r))}}const qe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe=Ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ve=Ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ue=Ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Ke=Ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Qe=Ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ze=Ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Je=Ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),et=Ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),tt=Ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ot=Ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),nt=Ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),it=Ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),rt=Ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),st=Ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),at=Ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),lt=Ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ct=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),dt=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ut=Ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ht={category10:qe,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:Xe,reds:Ve,greens:Ue,oranges:Ke,purples:Qe,viridis:Je,plasma:et},gt=qe,ft=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],yt=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 vt(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")||yt.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):gt[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))%gt.length]}function mt(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 x().domain(n).range(o).unknown("#999");const r=ht[o]||ht.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:gt;return x().domain(n).range(e).unknown("#999")}}function bt(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;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function xt(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}}function kt(e,t,o){var n;const i=null!==(n=e.duration)&&void 0!==n?n:500,r=o-t;return i>r?1-r/i:0}function wt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function At(e,t){return Math.min((e-t.startTime)/t.duration,1)}function St(e,t,o){return e+(t-e)*o}function Ot(){return"undefined"!=typeof performance?performance.now():Date.now()}function _t(e,t,o){var n,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(n=t.datum)||void 0===n?void 0:n.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ct(e,t,o){if(!e.getBounds||!e.scales)return null;const n=[],i=[];for(const o of t){const t=e.getX(o),r=e.getY(o);if(null==t||null==r||Number.isNaN(t)||Number.isNaN(r))continue;const s=e.getBounds(o),a=e.scales.x(t);if(s&&0!==s)n.push([a,e.scales.y(r+s)]),i.push([a,e.scales.y(r-s)]);else{const t=e.scales.y(r);n.push([a,t]),i.push([a,t])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:i,style:e.resolveBoundsStyle(o,t[0]),datum:t,group:o,interactive:!1}}function jt(e,t,o,n){var i;if(!e.config.pointStyle)return;const r=null!=n?n:e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const s of n.data){let n=e.config.pointStyle(s);!n.fill&&t&&(n=Object.assign(Object.assign({},n),{fill:t}));const a=null!==(i=n.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=De(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const Mt={blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it},Pt=new Map;class Lt{constructor(e){if(this.xExtent=new Le,this.yExtent=new Le,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new Pe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=We(e.timeAccessor||e.xAccessor,"time"),this.getY=We(e.valueAccessor||e.yAccessor,"value")):(this.getX=We(e.xAccessor,"x"),this.getY=We(e.yAccessor,"y")),this.getGroup=ze(e.groupAccessor),this.getCategory=ze(e.categoryAccessor),this.getSize=e.sizeAccessor?We(e.sizeAccessor,"size"):void 0,this.getColor=ze(e.colorAccessor),this.getBounds=e.boundsAccessor?We(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?We(e.y0Accessor,"y0"):void 0,this.getPointId=ze(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?We(e.openAccessor,"open"):void 0,this.getHigh=We(e.highAccessor,"high"),this.getLow=We(e.lowAccessor,"low"),this.getClose=o?We(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new Pe(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?We(this.config.timeAccessor||this.config.xAccessor,"time"):We(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],i=n instanceof Date,r="string"==typeof n&&n.length>=10&&!isNaN(new Date(n).getTime())&&isNaN(Number(n));if(this.xIsDate=i||r,r){const e="string"==typeof o?o:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(o(e)instanceof Date?o(e):new Date(o(e)))}}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.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o)))}else for(const o of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):(this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e))))}return!0}computeScene(e){var t,o,n,i,r,s,a,l,c,d,u,h,g,f;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),m=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(o=p.xExtent[0])&&void 0!==o?o:m[0],null!==(n=p.xExtent[1])&&void 0!==n?n:m[1]]:m,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const O=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],_="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!O&&y.size>0)if(p.normalize)S=[0,_?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(a=p.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(v),o=new Map,n=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let a=0;for(const o of e.data){const e=this.getX(o),s=this.getY(o);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),n.add(e),a+=s;const l=(r.get(e)||0)+s;r.set(e,l),l>i&&(i=l)}o.set(e.key,t),s.set(e.key,a)}const a=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===a){const e=[...t].map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}),o=[],n=[];let i=0,r=0;for(const t of e)r>i?(o.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(n.push(t),r+=null!==(d=s.get(t))&&void 0!==d?d:0);f=[...n.reverse(),...o]}else f="asc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(e))&&void 0!==o?o:0)-(null!==(n=s.get(t))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):"desc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(n).sort((e,t)=>e-t),t=Ee(e,f,(e,t)=>{var n;return(null===(n=o.get(e))||void 0===n?void 0:n.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const o of e){const e=null!==(u=t.get(o))&&void 0!==u?u:0,n=null!==(h=r.get(o))&&void 0!==h?h:0;i>e&&(i=e),e+n>s&&(s=e+n)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const a=s-i,l=_?0:a>0?a*p.extentPadding:1;S=[i-l,s+l]}else S=[0,i+(_?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!O&&y.size>0){const[,e]=function(e,t,o,n,i){const r=Te(e,t,o,n,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,_?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!O&&y.size>0){const[e,t]=function(e,t){let o=0,n=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,o>i&&(o=i),i>n&&(n=i))}return[o,n]}(y,this.getY),o=t-e,n=_?0:o>0?o*p.extentPadding:1;S=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!O&&S[0]!==1/0){if(this.getBounds)for(const e of v){const t=this.getY(e),o=this.getBounds(e);null!=t&&!Number.isNaN(t)&&o&&(t+o>S[1]&&(S[1]=t+o),S[0]>t-o&&(S[0]=t-o))}const e=S[1]-S[0],t=_?0:e>0?e*p.extentPadding:1,o=null===(g=p.yExtent)||void 0===g?void 0:g[0],n=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=o?S[0]:S[0]-t,null!=n?S[1]:S[1]+t],"log"!==p.yScaleType||S[0]>0||0>=b[0]||_||(S[0]=null!=o?S[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!O){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(S=[null!=e?e:S[0],null!=t?t:S[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const C="streaming"===p.runtimeMode,j=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(C)if("x"==("up"===(M=p.arrowOfTime)||"down"===M?"y":"x")){const t="right"===p.arrowOfTime?[j,e.width-j]:[e.width-j,j];this.scales={x:k().domain(x).range(t),y:k().domain(S).range([e.height-j,j])}}else{const t="down"===p.arrowOfTime?[j,e.height-j]:[e.height-j,j];this.scales={x:k().domain(S).range([j,e.width-j]),y:k().domain(x).range(t)}}else{const t=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)};this.scales={x:t(p.xScaleType,x,[j,e.width-j]),y:t(p.yScaleType,S,[e.height-j,j])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),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.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,o=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxPointRadius=o,Lt.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._quadtree=_().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,n,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var o,n,i,r,s,a,l;const{config:c,scales:d}=this;if(!d)return[];if(c.customLayout){const l=null!==(o=c.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},u={data:t,scales:d,dimensions:{width:e.width,height:e.height,margin:l,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(n=c.themeSemantic)&&void 0!==n?n:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ft},resolveColor:(e,t)=>{var o,n;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(n=null===(o=c.themeSemantic)||void 0===o?void 0:o.primary)&&void 0!==n?n:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(u)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(a=h.nodes)&&void 0!==a?a:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const u={scales:d,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var o;const n=e.groupData(t),i=[],r=null===(o=e.config.annotations)||void 0===o?void 0:o.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of n){const o=Ct(e,t.data,t.key);o&&i.push(o)}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=Be(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(n.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),i.push(n)}return jt(e,n,i),i}(u,t);case"area":return function(e,t){const o=e.groupData(t),n=[],i=e.scales.y.domain()[0],r=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=Ne(t.data,e.scales,e.getX,e.getY,i,o,t.key,r);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),n.push(s)}return jt(e,o,n),n}(u,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set,r=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o)if(i.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),i=Ne(t.data,e.scales,e.getX,e.getY,r,o,t.key,s);e.config.gradientFill&&(i.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=Be(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return jt(e,o,n),n}(u,t);case"stackedarea":return function(e,t){var o,n,i,r;const s=e.groupData(t),a=null!==(o=e.config.stackOrder)&&void 0!==o?o:"key",l=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===a)l();else if("asc"===a||"desc"===a||"insideOut"===a){const t=new Map;for(const o of s){let n=0;for(const t of o.data){const o=e.getX(t),i=e.getY(t);Number.isFinite(o)&&Number.isFinite(i)&&(n+=i)}t.set(o.key,n)}const o=(e,t)=>t>e?-1:e>t?1:0;if("asc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(n.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else if("desc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else{const e=[...s].sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)}),r=[],a=[];let l=0,c=0;for(const o of e)c>l?(r.push(o),l+=null!==(n=t.get(o.key))&&void 0!==n?n:0):(a.push(o),c+=null!==(i=t.get(o.key))&&void 0!==i?i:0);s.length=0,s.push(...a.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,d=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:u,stackedTops:h}=function(e,t,o,n,i,r,s,a="zero"){var l,c;const d=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&d.add(t)}const u=Array.from(d).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=o(i),r=n(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of u){let o=0;for(const n of e)o+=(null===(l=h.get(n.key))||void 0===l?void 0:l.get(t))||0;g.set(t,o||1)}}const f=Ee(u,e.map(e=>e.key),(e,t)=>{var o;return(null===(o=h.get(e))||void 0===o?void 0:o.get(t))||0},a),p=[],y=new Map,v=new Map;for(const e of u)v.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const o of e){const e=h.get(o.key),n=[],a=[],l=new Map;for(const o of u){let i=e.get(o)||0;const s=v.get(o);r&&(i/=g.get(o));const c=s+i,d=t.x(o);a.push([d,t.y(s)]),n.push([d,t.y(c)]),v.set(o,c),l.set(o,c)}y.set(o.key,l);const c={type:"area",topPath:n,bottomPath:a,style:i(o.key,o.data[0]),datum:o.data,group:o.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,c,d),g=u;if(e.config.pointStyle){const t=new WeakMap;for(const o of s){const n=h.get(o.key);if(n)for(const i of o.data){const o=e.getX(i),r=e.getY(i);null==o||Number.isNaN(o)||null==r||Number.isNaN(r)||!n.has(o)||t.set(i,n.get(o))}}const o=o=>{var n;return null!==(n=t.get(o))&&void 0!==n?n:e.getY(o)};jt(e,s,g,o)}return g}(u,t);case"scatter":case"bubble":return function(e,t){var o;const n=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);s=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7";for(const o of t){let t=e.config.pointStyle?e.config.pointStyle(o):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(o);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(o);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const c=e.getPointId?e.getPointId(o)+"":void 0,d=De(o,e.scales,e.getX,e.getY,r,t,c);d&&n.push(d)}return n}(u,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){var n,i,r;const s=Math.max(1,Math.floor(null!==(n=e.config.heatmapXBins)&&void 0!==n?n:20)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=We(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[d,u]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(u-d||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const v=new Int32Array(y),m=new Float64Array(y);for(let o=0;t.length>o;o++){const n=t[o],i=e.getX(n),r=e.getY(n);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-d)/f),s-1),u=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>u)continue;const g=u*s+l;v[g]++;const y=c(n);m[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===v[e])continue;let t;switch(l){case"sum":t=m[e];break;case"mean":t=m[e]/v[e];break;default:t=v[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=o.width/s,A=o.height/a,S=e.config.showValues,O=e.config.heatmapValueFormat,_=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===v[n])continue;let i;switch(l){case"sum":i=m[n];break;case"mean":i=m[n]/v[n];break;default:i=v[n]}const r=(i-b)/k;_.push(He(o*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:v[n],sum:m[n],xCenter:d+(o+.5)*f,yCenter:h+(e+.5)*p,agg:l},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return _}(e,t,o);if(0===t.length)return[];const n=We(e.config.valueAccessor,"value"),i=Fe(e.config.xAccessor,"x"),r=Fe(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],n=i(o),d=r(o);l[e]=n,c[e]=d,s.has(n)||s.set(n,s.size),a.has(d)||a.set(d,a.size)}const d=s.size,u=a.size;if(0===d||0===u)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}const y=new Float64Array(t.length),v=new Float64Array(t.length),m=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const u=n(o),h=r*d+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,v[f]=u,m[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=v[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Mt?e:"blues";let o=Pt.get(t);if(o)return o;o=Array(256);const n=Mt[t]||Xe;for(let e=0;256>e;e++)o[e]=n(e/255);return Pt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=o.width/d,_=o.height/u,C=e.config.showValues,j=e.config.heatmapValueFormat,M=[];for(let e=0;x>e;e++){const t=v[e];if(!isFinite(t))continue;const o=y[e],n=o%d;M.push(He(n*O,(u-1-(o-n)/d)*_,O,_,A[Math.min((t-k)*S+.5|0,255)],m[e],C?{value:t,showValues:!0,valueFormat:j}:void 0))}return M}(u,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Te(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const o of e.categories.keys())t.add(o);const o=e.config.barColors?Object.keys(e.config.barColors):[],n=new Set(o),s=Array.from(t).filter(e=>!n.has(e)).sort(),a=o.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.x.domain(),d=e.config.barStyle,u=null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==d?void 0:d.gap,g="number"!=typeof h||0>h?1:h,f={};(null==d?void 0:d.stroke)&&(f.stroke=d.stroke),"number"==typeof(null==d?void 0:d.strokeWidth)&&(f.strokeWidth=d.strokeWidth),"number"==typeof(null==d?void 0:d.opacity)&&(f.opacity=d.opacity);for(const t of i.values()){const o=Math.max(t.start,l),i=Math.min(t.end,c);if(o>=i)continue;const h=a.x(o),p=a.x(i),y=Math.abs(p-h),v=y>g+1?g:0,m=Math.min(h,p)+v/2,b=Math.max(y-v,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r),h=(null===(n=e.config.barColors)||void 0===n?void 0:n[i])||(null==d?void 0:d.fill)||u||"#4e79a7";s.push(Ie(m,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(Ie(m,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==d?void 0:d.fill)||u||"#007bff"},f),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(u,t);return this._barCategoryCache=null!==(l=u.barCategoryCache)&&void 0!==l?l:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var o,n,i,r,s,a;const l=[],c=e.config.swarmStyle||{},d=null!==(o=c.radius)&&void 0!==o?o:3,u=null!==(r=null!==(n=c.fill)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,g=c.stroke,f=c.strokeWidth;for(const o of t){const t=e.getX(o),n=e.getY(o);if(null==n||Number.isNaN(n))continue;const i=e.scales.x(t),r=e.scales.y(n);let s=u;if(e.getCategory){const t=e.getCategory(o);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:d,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(u,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const d=[],u=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===g.length)return d;const f=null!==(r=null!==(n=null==h?void 0:h.positiveColor)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(l=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,v=null==h?void 0:h.stroke,m=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const n=g[t],i=e.getX(n),r=e.getY(n),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=u.x(i),c=0!==a?u.x(i+a):l+o.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=u.y(x),S=u.y(s),O=Math.min(A,S),_=Math.abs(A-S),C={fill:0>r?p:f,stroke:v,strokeWidth:m};null!=b&&(C.opacity=b),d.push(Ie(k,O,w,_,C,Object.assign(Object.assign({},n),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return d}(u,t,e);case"candlestick":return function(e,t){var o,n;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(o=e.config.candlestickRangeMode)&&void 0!==o&&o;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",d=i?a:s.wickColor||"#333",u=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(n=s.bodyWidth)&&void 0!==n?n:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let o=1;h.length>o;o++){const n=Math.abs(e.scales.x(h[o])-e.scales.x(h[o-1]));n>0&&t>n&&(t=n)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const n=e.getHigh(o),s=e.getLow(o);if(null==n||Number.isNaN(n)||null==s||Number.isNaN(s))continue;const a=i?n:e.getOpen(o),h=i?s:e.getClose(o);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(n),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:d,wickWidth:u,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(u,t);default:return[]}}resolveBoundsStyle(e,t){var o;const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||(null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?xt(o,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,o){var n,i;const r=o.length;if(1>=r)return;const s=new Map;for(let e=0;o.length>e;e++)s.set(o[e],e);for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const n=Array(t.length);let i=!1;for(let o=0;t.length>o;o++){const a=s.get(t[o]);null!=a?(n[o]=xt(e,a,r),1>n[o]&&(i=!0)):n[o]=1}i&&(o._decayOpacities=n);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],n=o.topPath?o.topPath.length:t.length;if(2>n)continue;if(t.length===n){const i=Array(n);let a=!1;for(let o=0;t.length>o;o++){const n=s.get(t[o]);null!=n?(i[o]=xt(e,n,r),1>i[o]&&(a=!0)):i[o]=1}a&&(o._decayOpacities=i)}else{let i=1;for(const o of t){const t=s.get(o);if(null!=t){const o=xt(e,t,r);i>o&&(i=o)}}if(1>i){const e=Array(n);e.fill(i),o._decayOpacities=e}}continue}const t=s.get(o.datum);if(null==t)continue;const a=xt(e,t,r);if("heatcell"===o.type)o.style={opacity:a};else if("candlestick"===o.type)o._decayOpacity=a;else{const e=null!==(i=null===(n=o.style)||void 0===n?void 0:n.opacity)&&void 0!==i?i:1;o.style=Object.assign(Object.assign({},o.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,o,n){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;o.length>e;e++)c.set(o[e],e);for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let i=0;for(const o of t){const t=c.get(o);if(null==t)continue;const r=n.get(t);if(null==r)continue;const a=kt(e,r,s);a>i&&(i=a)}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const t=c.get(o.datum);if(null==t)continue;const i=n.get(t);if(null==i)continue;const r=kt(e,i,s);r>0&&(o._pulseIntensity=r,o._pulseColor=a,o._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var o;if(!t||0===t.size)return!1;const n="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(o=e.duration)&&void 0!==o?o:500,r=t.peek();return null!=r&&i>n-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,o,n){var i,r,s,a;o.clear(),n.clear();for(let l=0;t.length>l;l++){const c=t[l],d=_t(e,c,l);d&&("point"===c.type?o.set(d,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(d,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.set(d,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?o.set(d,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?n.set(d,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&n.set(d,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=c.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,o;this.prevPositionMap.clear(),this.prevPathMap.clear();const n=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=_t(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:n,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,o,n,i){var r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,k,w,A,S,O,_,C,j,M,P,L,T,B,N,E,D,I,H,R,W,F,z,$,Y,G;if(0===n.size&&0===i.size)return o;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;o.scene.length>t;t++){const r=o.scene[t],P=_t(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];X=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];X=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;continue}const L=n.get(P);if("point"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(d=r.style.opacity)&&void 0!==d?d:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(u=L.r)&&void 0!==u?u:r.r,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("rect"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(g=r.style.opacity)&&void 0!==g?g:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("heatcell"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(m=null===(v=r.style)||void 0===v?void 0:v.opacity)&&void 0!==m?m:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,X=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){V.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(_=L.highY)&&void 0!==_?_:r.highY,r.lowY=null!==(C=L.lowY)&&void 0!==C?C:r.lowY,X=!0)}else r._targetOpacity=null!==(M=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==M?M:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}for(const[e,t]of n)if(!V.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(N=t.w)&&void 0!==N?N:0,h:null!==(E=t.h)&&void 0!==E?E:0,style:{opacity:null!==(D=t.opacity)&&void 0!==D?D:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(I=t.w)&&void 0!==I?I:0,h:null!==(H=t.h)&&void 0!==H?H:0,fill:"#999",datum:null,style:{opacity:null!==(R=t.opacity)&&void 0!==R?R:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(W=t.openY)&&void 0!==W?W:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(F=t.closeY)&&void 0!==F?F:n,highY:null!==(z=t.highY)&&void 0!==z?z:n,lowY:null!==($=t.lowY)&&void 0!==$?$:n,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(i)}X=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),X&&(o.activeTransition={startTime:Ot(),duration:q}),o}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},o=function(e,t,o,n){var i,r,s,a,l,c;if(!o.activeTransition)return!1;const d=At(e,o.activeTransition),u=wt(d,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,r=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style.opacity=St(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),e.y=St(o.y,e._targetY,u),void 0!==e._targetR&&void 0!==o.r&&(e.r=St(o.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(r=o.opacity)&&void 0!==r?r:1:0;e.style.opacity=St(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),e.y=St(o.y,e._targetY,u),void 0!==o.w&&(e.w=St(o.w,e._targetW,u)),void 0!==o.h&&(e.h=St(o.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(s=o.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),e.y=St(o.y,e._targetY,u),void 0!==o.w&&(e.w=St(o.w,e._targetW,u)),void 0!==o.h&&(e.h=St(o.h,e._targetH,u))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(a=o.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),void 0!==o.openY&&(e.openY=St(o.openY,e._targetOpenY,u)),void 0!==o.closeY&&(e.closeY=St(o.closeY,e._targetCloseY,u)),void 0!==o.highY&&(e.highY=St(o.highY,e._targetHighY,u)),void 0!==o.lowY&&(e.lowY=St(o.lowY,e._targetLowY,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=St(t[n][0],o[n][0],u),e.path[n][1]=St(t[n][1],o[n][1],u)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,i=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=St(t[o][0],n[o][0],u),e.topPath[o][1]=St(t[o][1],n[o][1],u);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=St(o[t][0],i[t][0],u),e.bottomPath[t][1]=St(o[t][1],i[t][1],u)}}if(d>=1){for(const e of o.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;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 if("heatcell"===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 if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const o of e){const e=this.getGroup(o);t.has(e)||t.set(e,[]),t.get(e).push(o)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const o of e){const e=this.getColor(o);e&&t.add(e)}const o=Array.from(t).sort(),n=o.join("\0");if(this._colorMapCache&&this._colorMapCache.key===n)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,r=new Map;for(let e=0;o.length>e;e++)r.set(o[e],i[e%i.length]);return this._colorMapCache={key:n,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var o;const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}const i=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var o,n;if(this.config.areaStyle){const o=this.config.areaStyle(t||{});if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const i=this.config.lineStyle;if("function"==typeof i){const o=i(t||{},e);if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const r=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(n=i.fillOpacity)&&void 0!==n?n:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const o=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||ft;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Lt.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,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.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,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.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,o,n,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,a=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!Re(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),d=l||!Re(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||d)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=We(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=We(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=We(this.config.xAccessor,"x"),this.getY=We(this.config.yAccessor,"y")),s=!0,a=!0)}if("groupAccessor"in e&&!Re(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ze(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!Re(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ze(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!Re(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?We(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!Re(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ze(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!Re(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?We(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),"boundsAccessor"in e&&!Re(e.boundsAccessor,r.boundsAccessor)&&(this.getBounds=this.config.boundsAccessor?We(this.config.boundsAccessor,"bounds"):void 0,s=!0,a=!0),"pointIdAccessor"in e&&!Re(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ze(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!Re(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!Re(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!Re(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!Re(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?We(this.config.openAccessor,"open"):void 0,this.getHigh=We(this.config.highAccessor,"high"),this.getLow=We(this.config.lowAccessor,"low"),this.getClose=t?We(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,a=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const o of t)if(e[o]!==r[o]){s=!0;break}}s&&(a&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Tt(...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 Bt(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}}function Nt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Et(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Dt(e,t){const o=Et(e);if(!o)return!1;const n=Et(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function It(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Ht(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);Nt(e.r,n)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}Lt.GROUP_COLOR_MAP_CAP=1e3,Lt.QUADTREE_THRESHOLD=500;const Rt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Wt=new WeakMap;let Ft=0,zt=!1,$t=null,Yt=null,Gt=null;function qt(e,t){var o,n;if(!t)return t;const i=Rt.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(zt)return;if("undefined"==typeof window||"undefined"==typeof document)return;zt=!0;const e=()=>{Ft++};if("undefined"!=typeof MutationObserver&&document.documentElement&&($t=new MutationObserver(e),$t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Yt=window.matchMedia("(prefers-color-scheme: dark)"),Gt=e,"function"==typeof Yt.addEventListener?Yt.addEventListener("change",Gt):"function"==typeof Yt.addListener&&Yt.addListener(Gt)}catch(e){}}();let s=Wt.get(r);s&&s.version===Ft||(s={version:Ft,map:new Map},Wt.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}function Xt(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 Vt(e){switch(e){case"monotoneX":return E;case"monotoneY":return N;case"cardinal":return B;case"catmullRom":return T;case"step":return L;case"stepBefore":return P;case"stepAfter":return M;case"basis":return j;case"natural":return C;default:return null}}function Ut(e,t,o){return null==t?o:"string"!=typeof t?t:qt(e,t)||o}function Kt(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]=Xt(e,o);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function Qt(e,t,o,n,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(o,n,i,r);for(const e of s)a.addColorStop(e.offset,e.color);return a}const Zt=new WeakMap;function Jt(e,t){const o=Vt(t);if(!o)return e;const n=Zt.get(e);if(n)return n;const i=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let i=null;const r={moveTo(e,t){i=[e,t],n.push([e,t])},lineTo(e,t){i=[e,t],n.push([e,t])},bezierCurveTo(e,t,r,s,a,l){if(!i)return i=[a,l],void n.push([a,l]);const[c,d]=i;for(let i=1;o>=i;i++){const u=i/o,h=1-u;n.push([h*h*h*c+3*h*h*u*e+3*h*u*u*r+u*u*u*a,h*h*h*d+3*h*h*u*t+3*h*u*u*s+u*u*u*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,r){i=[o,r],n.push([o,r])}};return D().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),n}(e,o);return Zt.set(e,i),i}function eo(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Ht(i,t,o,n,r);e&&(s={node:e.node,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"point":if(i)break;e=oo(r,t,o,n);break;case"line":e=no(r,t,o,n);break;case"rect":if(null==r.datum)break;e=ro(r,t,o);break;case"heatcell":e=so(r,t,o);break;case"area":if(!1===r.interactive)break;e=lo(r,t,o);break;case"candlestick":e=ao(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function to(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=co(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let i=n,r=n;n>0&&e[n][0]>=t?(i=n-1,r=n):e.length-1>n&&(i=n,r=n+1);const[s,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function oo(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Nt(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function no(e,t,o,n=30){var i,r,s,a;if(0===e.path.length)return null;const l=co(e.path,t);if(0>l)return null;const[c,d]=e.path[l];let u;if(e.path.length>1){let n=1/0;const i=Math.max(0,l-1),r=Math.min(e.path.length-2,l);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=io(t,o,i,r,a,l);n>c&&(n=c)}u=n}else{const e=t-c,n=o-d;u=Math.sqrt(e*e+n*n)}const h=null!==(a=null!==(r=null===(i=e.style)||void 0===i?void 0:i.strokeWidth)&&void 0!==r?r:null===(s=e.style)||void 0===s?void 0:s.lineWidth)&&void 0!==a?a:1;return u>Math.max(5,h/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:d,distance:u}}function io(e,t,o,n,i,r){const s=i-o,a=r-n,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-o,2)+Math.pow(t-n,2));let c=((e-o)*s+(t-n)*a)/l;c=Math.max(0,Math.min(1,c));const d=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-d,2))}function ro(e,t,o){const n=Bt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function so(e,t,o){const n=Bt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function ao(e,t,o){const n=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(r*r+s*s)}}return null}function lo(e,t,o){if(0===e.topPath.length)return null;const n=co(e.topPath,t);if(0>n)return null;const[i,r]=e.topPath[n],s=t-i,a=o-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:r,distance:l}}function co(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const i=o+n>>1;t>e[i][0]?o=i+1:n=i}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function uo(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}}function ho(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}}function go(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?fo(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?fo(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}}function fo(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 po(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function yo(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function vo(e,t,o,n,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,d=l-a.lastIngestTime>c;d!==i&&(r(d),o.current=!0,n())},1e3);return()=>clearInterval(s)},[e,i,n])}const mo={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function bo(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,mo[o])(n(e,t)),i}function xo(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ko(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const wo=(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=bo(o,u,h,g),x=ko(o,r,s),k=s&&s.size>0&&s.has(o.label);p.push(t("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?k||!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&&e("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,k&&e(xo,{}),e("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 Ao({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 t=0;64>=t;t++){const o=t/64;c.push(e("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:n,height:o,fill:`url(#${u})`,rx:2}),e("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),e("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 t=0;64>=t;t++){const o=t/64;h.push(e("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${u})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])})]})}function So(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:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d})=>{let u=24;const h=[];return t.forEach((t,g)=>{u+=5,h.push(e("line",{stroke:"gray",x1:0,y1:u,x2:o,y2:u},"legend-top-line legend-symbol-"+g)),u+=8,t.label&&(u+=16,h.push(e("text",{y:u,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),u+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${u})`,children:wo(t,n,i,r,s,a,l,g,c,d)},"legend-group-"+g)),u+=22*t.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 k=bo(o,u,g,f),w=ko(o,r,s),A=s&&s.size>0&&s.has(o.label),S=26+7*o.label.length;h&&h>0&&v>0&&v+S>h&&(m++,v=0),y.push(t("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:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("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"}),k,A&&e(xo,{}),e("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+=S});let k=0,w=0;for(const e of p){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const A=m+1;return{items:y,offset:k,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((t,i)=>{const r=o[i];r.label&&(y.push(e("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(e("g",{className:"legend-item",transform:`translate(${p},0)`,children:t.items},"legend-group-"+i)),p+=t.offset+5,o[i+1]&&y.push(e("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(t.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),e("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 t("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&&e("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 Oo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function _o(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Co(t){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:d,legendIsolatedCategories:u,legendInteraction:h}=t;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),e("g",{transform:`translate(${f}, ${p})`,children:_o(o)?e(Ao,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):Oo(o)?e(So,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:d,isolatedCategories:u,legendInteraction:h}):o})}function jo(e){return"string"==typeof e?{type:e}:e}function Mo({orient:o,config:n,values:i,scale:s,size:a,length:l}){const c=function(e){var t,o,n,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(o=e.fill)&&void 0!==o?o:"#4e79a7",fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(n),d="top"===o||"bottom"===o,u=r(()=>{if(0===i.length)return null;const n=s.domain(),r=a-8;if("boxplot"===c.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],i=t[Math.floor(.5*o)],r=t[Math.floor(.75*o)],s=r-n;return{q1:n,median:i,q3:r,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],r+1.5*s)}}(i);if(!n)return null;const{q1:a,median:l,q3:u,whiskerLow:h,whiskerHigh:g}=n,f=Math.min(.5*r,20),p=(r-f)/2+4;if(d){const n=s(a),i=s(u),r=s(l),d=s(h),y=s(g),v="top"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:d,y1:m+v*(p+f/2),x2:y,y2:m+v*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:d,y1:m+v*p,x2:d,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:m+v*p,x2:y,y2:m+v*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(n,i),y:"top"===o?m-p-f:m+p,width:Math.abs(i-n),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===o?m-p-f:m+p,x2:r,y2:"top"===o?m-p:m+p+f,stroke:c.fill,strokeWidth:2})]})}{const n=s(a),i=s(u),r=s(l),d=s(h),y=s(g),v="left"===o?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:m+v*(p+f/2),y1:d,x2:m+v*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:d,x2:m+v*(p+f),y2:d,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*p,y1:y,x2:m+v*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===o?m-p-f:m+p,y:Math.min(n,i),width:f,height:Math.abs(i-n),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===o?m-p-f:m+p,y1:r,x2:"left"===o?m-p:m+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const u=F().domain(n).thresholds(c.bins)(i);if(0===u.length)return null;const h=Math.max(...u.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+o,children:u.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(d){const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===o?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===o?-4-i:4,y:Math.min(r,r+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}})});if("violin"===c.type){const t=r/2+4,n=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),a=s((e.x0+e.x1)/2);n.push(d?`${a},${"top"===o?-(t-i):t-i}`:`${"left"===o?-(t-i):t-i},${a}`)}for(let e=u.length-1;e>=0;e--){const i=u[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(r/2),l=s((i.x0+i.x1)/2);n.push(d?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+o,children:e("polygon",{points:n.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(d){const e=0,n=null!=u[0].x0?s(u[0].x0):0;t.push(`M${n},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===o?-n-4:n+4}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,n=null!=u[0].x0?s(u[0].x0):0;t.push(`M${e},${n}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===o?-n-4:n+4},${i}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+o,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,a,l,o,d,4]);return u?e("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:u}):null}function Po(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 Lo(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 To(o,n,i,r){if(!o)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=o;if(!s&&!a)return e("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]:Po(a,d):[],v=s?u?[s]:Po(s,d):[],m="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:f,fontWeight:"bold",children:y.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-title")),b=y.length*p),v.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:v.map((t,o)=>e("tspan",{x:m,dy:0===o?0:p,children:t},o))},"annotation-note-label"));let w=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const t=Math.min(d,120);let o=0,n=t;"end"===f?(o=-t,n=0):"middle"===f&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+v.length)*p+(v.length>0?p:0);let o=0,n=t;"bottom"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),w=e("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 S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function Bo(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,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 t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e("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(e("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,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(e("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,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(e("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 t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e("path",{d:Lo((null==o?void 0:o.type)||"curly",t,(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 e("g",{className:"annotation-subject",children:a})}function No(t,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 e=s.width||0,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),d=e/2,u=n/2,h=t*u>o*d?d/t: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 e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);l=Math.cos(n)*e,c=Math.sin(n)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(o-c,2))>.5&&(a.push(e("line",{x1:l,y1:c,x2:t,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,t-l);a.push(e("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 e("g",{className:"annotation-connector",children:a})}function Eo(e){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}=e,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 t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!v.has("connector")&&No(m,b,c,h,x,d),!v.has("subject")&&Bo(x,d,h,o,n),!v.has("note")&&To(l,m,b,h)]}))}function Do(t){var o,n;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=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:t,ny:a});return e(Eo,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Eo,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Io(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 Ho(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 Ro(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=Io(e,o),c=Ho(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 Wo(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Fo={linear:H,monotoneX:E,monotoneY:N,step:L,stepAfter:M,stepBefore:P,basis:j,cardinal:B,catmullRom:T};function zo(o){return function(o,n,i){var r,s,a,l,c,d,u,h,g,f,p,y,v,m,b,x,k,w,A,S,O,_,C,j,M,P,L,T,B,N,E,D,R,W,F,z,$,Y,G,q,X,V,K,Q,Z,J,ee,te;switch(o.type){case"label":{const t=Ro(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Wo(r,s,i)?e(Do,{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 t=Ro(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Wo(r,s,i)?e(Do,{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=Io(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,t("g",{children:[e("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&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=Ho(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"),t("g",{children:[e("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&&e("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:Io(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ho(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=U(r),a=o.padding||10;return t("g",{children:[e("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&&e("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:Io(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ho(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 t("g",{children:[e("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&&e("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 t=i.data||[],r="function"==typeof o.filter?t.filter(o.filter):o.field&&null!=o.value?t.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,n)=>{const r=Io(t,i),a=Ho(t,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(t):o.r||6,c="function"==typeof o.style?o.style(t):o.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Io(o,i),r=Ho(o,i);return e(Do,{noteData:{x:null!=t?t: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="ordinal"===i.frameType,y="horizontal"===i.projection,v=p?g:null,m=p?f:null;let b;const x=[],k=new Map;if(p&&v&&m){for(const e of h){const t=e[v];if(null==t)continue;const o=t+"";k.has(o)||(k.set(o,x.length),x.push(o))}b=h.map(e=>{const t=e[v],o=e[m];if(null==t||null==o)return null;const n=k.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=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,A=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(!w||!A)return null;const S=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(x.length-1,o+1),i=t-o,r=e(x[o]);return r+(e(x[n])-r)*i},O=w,_=A;let C;if(p)if(y){const e=S(_);C=(t,o)=>[O(o),e(t)]}else{const e=S(O);C=(t,o)=>[e(t),_(o)]}else C=(e,t)=>[O(e),_(t)];const j=o.method||"linear";let M;M="loess"===j?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}(b,null!==(u=o.bandwidth)&&void 0!==u?u:.3):("polynomial"===j?ne.polynomial(b,{order:o.order||2}):ne.linear(b)).points;const P=M.map(([e,t])=>{const[o,n]=C(e,t);return`${o},${n}`}).join(" "),L=o.color||"#6366f1",T=M[M.length-1],[B,N]=C(T[0],T[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:B+4,y:N-4,fill:L,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 t("g",{children:[e("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&&e("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!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.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=Fo[i.curve||"linear"]||H,f=I().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 t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(A=o.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),o.label&&h.length>0&&e("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!==(O=null===(S=i.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(_=i.scales)||void 0===_?void 0:_.time,l=null!==(j=null===(C=i.scales)||void 0===C?void 0:C.y)&&void 0!==j?j: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 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!==(P=o.threshold)&&void 0!==P?P:2,f=d-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",v=null!==(L=o.fillOpacity)&&void 0!==L?L:.1,m=o.anomalyColor||"#ef4444",b=null!==(T=o.anomalyRadius)&&void 0!==T?T:6,x=l(d+g*h),k=l(f),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-d)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:v}),w.map((t,o)=>{const n=Io(t,i),r=Ho(t,i);return null==n||null==r?null:e("circle",{cx:n,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-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!==(N=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==N?N:null===(E=i.scales)||void 0===E?void 0:E.time,c=null!==(R=null===(D=i.scales)||void 0===D?void 0:D.y)&&void 0!==R?R:null===(W=i.scales)||void 0===W?void 0:W.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=ne.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!==(F=o.confidence)&&void 0!==F?F:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(z=o.steps)&&void 0!==z?z:5,x=d[h-1][0],k=(x-d[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){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 S=`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`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),_=`${l(x)},${c(u(x))}`,C=o.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:o.fill||"#6366f1",fillOpacity:null!==($=o.fillOpacity)&&void 0!==$?$:.15,stroke:"none"}),e("polyline",{points:`${_} ${O}`,fill:"none",stroke:C,strokeWidth:null!==(Y=o.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=o.strokeDasharray)&&void 0!==G?G:"6,3"}),o.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:C,fontSize:11,children:o.label})]},"ann-"+n)}case"widget":{let t=null,r=null;if(null!=o.px&&null!=o.py)t=o.px,r=o.py;else{const e=Ro(o,n,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!Wo(t,r,i))return null;const s=null!==(q=o.dx)&&void 0!==q?q:0,a=null!==(X=o.dy)&&void 0!==X?X:0,l=null!==(V=o.width)&&void 0!==V?V:32,c=null!==(K=o.height)&&void 0!==K?K:32,d=null!==(Q=o.content)&&void 0!==Q?Q:e("span",{style:{fontSize:18,cursor:"default"},title:o.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+n)}case"text":{const t=Ro(o,n,i);if(!t)return null;const{x:r,y:s}=t;return e("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===(Z=i.scales)||void 0===Z?void 0:Z.o,a=null===(J=i.scales)||void 0===J?void 0:J.x,l=null===(ee=i.scales)||void 0===ee?void 0:ee.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!==(te=o.opacity)&&void 0!==te?te:.15,f=o.label;return t("g",(i.projection?"vertical"===i.projection:c===a)?{children:[e("rect",{x:d,y:0,width:u,height:i.height||0,fill:h,fillOpacity:g}),f&&e("text",{x:d+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e("rect",{x:0,y:d,width:i.width||0,height:u,fill:h,fillOpacity:g}),f&&e("text",{x:12,y:d+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}}}let $o={positions:new Map};const Yo=new Set;function Go(){for(const e of Yo)e()}function qo(e,t){const o=$o.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map($o.positions);n.delete(e),$o={positions:n},Go()}function Xo(e,t){const o=$o.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map($o.positions);n.delete(e),$o={positions:n},Go()}function Vo(){return $o}function Uo(e){return Yo.add(e),()=>Yo.delete(e)}const Ko={positions:new Map};function Qo(){return()=>{}}function Zo(){return Ko}function Jo(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],i=o[o.length-1],r=n instanceof Date,s=n instanceof Date?n.getTime():n,a=i instanceof Date?i.getTime():i;if(2>t||s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=r?new Date(o):o}return c}(e,t):e.ticks(t)}function en(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function tn(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+n;for(let e=0;r>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*i}`,s+=`L${Math.min(o,t)},${n}`}return s}{const n="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${n+4*i},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}}function on(o){const{width:n,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:d,axes:u,showGrid:h,xFormat:g,yFormat:f,axisExtent:p}=o,y=r(()=>{var e,t;if(!c)return[];const o=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==o?void 0:o.tickFormat)||g||nn,r=Math.max(2,Math.floor(n/70)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5,a=null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Jo(c.x,"exact"===p?Math.max(2,s):Math.min(s,r),p),l=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,l)})),h=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return rn(d,Math.max(55,h+8))},[c,u,g,n,p]),v=r(()=>{var e,t;if(!c)return[];const o=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||f||nn,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;return rn((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Jo(c.y,"exact"===p?Math.max(2,s):Math.min(s,r),p)).map(e=>({value:e,pixel:c.y(e),label:n(e)})),22)},[c,u,f,i,p]),m=h&&c,b=d&&c;if(!m&&!b)return null;const x=null==u?void 0:u.find(e=>"bottom"===e.orient),k=null==u?void 0:u.find(e=>"left"===e.orient),w=b&&(!x||!1!==x.baseline),A=b&&(!k||!1!==k.baseline),S=(null==x?void 0:x.jaggedBase)||!1,O=(null==k?void 0:k.jaggedBase)||!1,_="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[m&&(()=>{var o,r;const s=en(null===(o=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),a=en(null===(r=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+o)),v.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+o))]})})(),w&&!S&&e("line",{x1:0,y1:i,x2:n,y2:i,stroke:_,strokeWidth:1}),S&&e("path",{d:tn("bottom",n,i),fill:"none",stroke:_,strokeWidth:1}),A&&!O&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:_,strokeWidth:1}),O&&e("path",{d:tn("left",n,i),fill:"none",stroke:_,strokeWidth:1})]})})}function nn(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function rn(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function sn(n){var a,l;const{width:d,height:u,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:v,xLabel:m,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:A,showGrid:S,title:O,legend:_,legendHoverBehavior:C,legendClickBehavior:j,legendHighlightedCategory:M,legendIsolatedCategories:P,legendPosition:L="right",foregroundGraphics:T,marginalGraphics:B,xValues:N,yValues:E,annotations:D,svgAnnotationRules:I,xAccessor:H,yAccessor:R,annotationData:W,pointNodes:F,curve:z,underlayRendered:$,canvasObscuresUnderlay:Y=!0,linkedCrosshairName:G,linkedCrosshairSourceId:q,children:X}=n,V=r(()=>{var e,t;if(!y||!p)return[];const o=null==v?void 0:v.find(e=>"bottom"===e.orient),n=(null==o?void 0:o.tickFormat)||k||nn,i=Math.max(2,Math.floor(d/70)),r=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5,s=null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Jo(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),a=s.map(e=>e.valueOf()),l=s.map((e,t)=>({value:e,pixel:p.x(e),label:n(e,t,a)})),c=l.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),u=(null==o?void 0:o.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=rn(l,u);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==o?void 0:o.includeMax)&&h.length>0&&"exact"!==A&&!(null==o?void 0:o.tickValues)){const e=p.x.domain()[1],t=p.x(e),o=h[h.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,h.length,a);u>t-o&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,v,k,d,A]),U=r(()=>{var e,t;if(!y||!p)return[];const o=null==v?void 0:v.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||w||nn,i=Math.max(2,Math.floor(u/30)),r=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;let s=rn((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Jo(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:n(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==o?void 0:o.includeMax)&&s.length>0&&"exact"!==A&&!(null==o?void 0:o.tickValues)){const e=p.y.domain()[1],t=p.y(e),o=s[s.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[y,p,v,w,u,A]),K=r(()=>{var e,t;if(!y||!p)return[];const o=null==v?void 0:v.find(e=>"right"===e.orient);if(!o)return[];const n=o.tickFormat||w||nn,i=Math.max(2,Math.floor(u/30)),r=null!==(e=o.ticks)&&void 0!==e?e:5;return rn((null!==(t=o.tickValues)&&void 0!==t?t:Jo(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:n(e)})),22)},[y,p,v,w,u,A]),Q=i(new Map),Z=i(null!==(a=null==D?void 0:D.length)&&void 0!==a?a:0),J=null!==(l=null==D?void 0:D.length)&&void 0!==l?l:0;Z.current!==J&&(Z.current=J,Q.current=new Map);const ee=r(()=>{if(!D||0===D.length)return null;const e=zo(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:H,yAccessor:R,width:d,height:u,data:W,frameType:"xy",pointNodes:F,curve:z,stickyPositionCache:Q.current};return D.map((o,n)=>{if(I){const i=I(o,n,t);return null!=i?i:e(o,n,t)}return e(o,n,t)}).filter(Boolean)},[D,I,d,u,H,R,W,p,F,z]),te=function(e){var t;const o=c(e?Uo:Qo,e?Vo:Zo,e?Vo:Zo);return e&&null!==(t=o.positions.get(e))&&void 0!==t?t:null}(G);return s(()=>{if(!(null==te?void 0:te.locked)||!G)return;const e=e=>{"Escape"===e.key&&Xo(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==te?void 0:te.locked,G]),y||O||_||T||B||ee&&ee.length>0||S||X||te?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[S&&p&&(!$||Y)&&(()=>{var o,n;const i=en(null===(o=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),r=en(null===(n=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return t("g",{className:"stream-grid",children:[V.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+o)),U.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:d,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),y&&p&&(()=>{const n=null==v?void 0:v.find(e=>"left"===e.orient),i=null==v?void 0:v.find(e=>"bottom"===e.orient),r=!n||!1!==n.baseline,s=!i||!1!==i.baseline,a=(null==n?void 0:n.jaggedBase)||!1,l=(null==i?void 0:i.jaggedBase)||!1,c=null==i?void 0:i.landmarkTicks,h=null==n?void 0:n.landmarkTicks,g="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&V.length>1&&(()=>{const e=d/Math.max(V.length-1,1),t=V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!$||Y)&&s&&!l&&e("line",{x1:0,y1:u,x2:d,y2:u,stroke:g,strokeWidth:1}),(!$||Y)&&l&&e("path",{d:tn("bottom",d,u),fill:"none",stroke:g,strokeWidth:1}),V.map((o,n)=>{const i=!!c&&("function"==typeof c?c(o.value,n):Dt(o.value,n>0?V[n-1].value:void 0));return t("g",{transform:`translate(${o.pixel},${u})`,children:[e("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:o.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:o.label})})]},"xtick-"+n)}),m&&e("text",{x:d/2,y:u+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:m}),(!$||Y)&&r&&!a&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:g,strokeWidth:1}),(!$||Y)&&a&&e("path",{d:tn("left",d,u),fill:"none",stroke:g,strokeWidth:1}),U.map((o,n)=>{const i=!!h&&("function"==typeof h?h(o.value,n):Dt(o.value,n>0?U[n-1].value:void 0));return t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:p,style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:o.label})})]},"ytick-"+n)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-f.left}, ${u/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n||0===K.length)return null;const i=n.landmarkTicks,r=n.label||x;return t(o,{children:[!1!==n.baseline&&e("line",{x1:d,y1:0,x2:d,y2:u,stroke:g,strokeWidth:1}),K.map((o,n)=>{const r=!!i&&("function"==typeof i?i(o.value,n):Dt(o.value,n>0?K[n-1].value:void 0));return t("g",{transform:`translate(${d},${o.pixel})`,children:[e("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:p,style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:o.label})})]},"ytick-r-"+n)}),r&&e("text",{x:d+f.right-15,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${d+f.right-15}, ${u/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),ee,B&&p&&N&&E&&t(o,{children:[B.top&&e("g",{transform:"translate(0, 0)",children:e(Mo,{orient:"top",config:jo(B.top),values:N,scale:p.x,size:f.top,length:d})}),B.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(Mo,{orient:"bottom",config:jo(B.bottom),values:N,scale:p.x,size:f.bottom,length:d})}),B.left&&e("g",{transform:"translate(0, 0)",children:e(Mo,{orient:"left",config:jo(B.left),values:E,scale:p.y,size:f.left,length:u})}),B.right&&e("g",{transform:`translate(${d}, 0)`,children:e(Mo,{orient:"right",config:jo(B.right),values:E,scale:p.y,size:f.right,length:u})})]}),T,te&&te.sourceId!==q&&(null==p?void 0:p.x)&&(()=>{const t=p.x(te.xValue);if(null==t||0>t||t>d)return null;const o=te.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),X]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof O?O:null}),Co({legend:_,totalWidth:h,totalHeight:g,margin:f,legendPosition:L,title:O,legendHoverBehavior:C,legendClickBehavior:j,legendHighlightedCategory:M,legendIsolatedCategories:P})]}):null}function an(e){var t,o,n,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(o=e.tr)&&void 0!==o?o:0)>0||(null!==(n=e.br)&&void 0!==n?n:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function ln(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(null!=e?e:0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}const cn={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function dn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const un="undefined"==typeof window||"undefined"==typeof document,hn="undefined"!=typeof window?h:s;function gn(){const[e,t]=u(!1);return hn(()=>{t(!0)},[]),e}const fn=()=>()=>{},pn=()=>!1,yn=()=>!0;function vn(){const e=c(fn,pn,yn);return i(e).current}function mn(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:a,cleanup:l}=e;hn(()=>{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=i(l);c.current=l,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function bn(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return kn(e,t);if(!wn(e)||!wn(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(!kn(o,i))return!1}else{if(!wn(o)||!wn(i))return!1;if(!xn(o,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function xn(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 kn(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 wn(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 An=n.createContext(null);function Sn({children:t}){const[o,i]=n.useState(!1),r=n.useMemo(()=>({visible:o,setVisible:i}),[o]);return e(An.Provider,{value:r,children:t})}function On(){return n.useContext(An)}const _n={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Cn(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(", ")}`}function jn(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}const Mn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Pn={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"},Ln={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Tn={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)"},Bn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Nn={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)"},En={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Dn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function In({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),d=On(),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?e("span",{id:r,tabIndex:-1,style:_n}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:p,style:_n,role:"region","aria-label":f,children:t("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,k,w,A,S,O;const _=[];if(!Array.isArray(e))return _;for(const C of e)if(C&&"object"==typeof C)try{switch(C.type){case"point":_.push({label:"Point",values:{x:C.x,y:C.y}});break;case"line":{const e=C.path,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&_.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=C.topPath,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&_.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=C.datum&&"object"==typeof C.datum?C.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:C.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;_.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":_.push({label:"Cell",values:{x:C.x,y:C.y,value:C.value}});break;case"wedge":_.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=C.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=C.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(d=null===(c=C.datum)||void 0===c?void 0:c.value)&&void 0!==d?d:""}});break;case"circle":_.push({label:"Node",values:{id:null!==(h=null===(u=C.datum)||void 0===u?void 0:u.id)&&void 0!==h?h:"",x:null!==(g=C.cx)&&void 0!==g?g:C.x,y:null!==(f=C.cy)&&void 0!==f?f:C.y}});break;case"arc":_.push({label:"Arc",values:{id:null!==(y=null===(p=C.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(v=C.cx)&&void 0!==v?v:C.x,y:null!==(m=C.cy)&&void 0!==m?m:C.y}});break;case"candlestick":_.push({label:"Candlestick",values:{x:C.x,open:C.open,high:C.high,low:C.low,close:C.close}});break;case"geoarea":_.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=C.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=C.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=C.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return _}(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}: ${Mn(e.min)} to ${Mn(e.max)}, mean ${Mn(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),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:g,id:r,tabIndex:-1,onBlur:y,style:Pn,role:"region","aria-label":f,children:[e("button",{type:"button",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Tn,children:"×"}),e("div",{role:"note",style:Ln,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Bn,children:[t("caption",{style:Dn,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Nn,children:"type"}),w.map(t=>e("th",{style:Nn,children:t},t))]})}),e("tbody",{children:x.map((o,n)=>t("tr",{children:[e("td",{style:En,children:o.label}),w.map(t=>{return e("td",{style:En,children:(n=o.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Mn(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},n))})]})]})}function Hn({nodes:o,edges:i,chartType:r,tableId:s,chartTitle:a}){var l,c,d,u,h,g,f,p,y,v,m,b,x,k;const[w,A]=n.useState(!1),S=On(),O=null!==(l=null==S?void 0:S.visible)&&void 0!==l&&l,_=w||O,C=a?"Data summary for "+a:s?`Data summary for ${r} ${s}`:"Data summary for "+r,j=n.useRef(null),M=n.useCallback(()=>{w||O||A(!0)},[w,O]),P=n.useCallback(e=>{var t;O||(null===(t=j.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[O]);if(!o||0===o.length)return s?e("span",{id:s,tabIndex:-1,style:_n}):null;if(!_)return e("div",{id:s,tabIndex:-1,onFocus:M,style:_n,role:"region","aria-label":C,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",o.length," nodes, ",i.length," edges)"]})});const L=Array.isArray(o)?o:[],T=Array.isArray(i)?i:[],B=new Map,N=new Map,E=new Map,D=new Map;for(const e of T){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,o="object"==typeof t.source?null===(d=t.source)||void 0===d?void 0:d.id:t.source,n="object"==typeof t.target?null===(u=t.target)||void 0===u?void 0:u.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";N.set(e,(null!==(h=N.get(e))&&void 0!==h?h:0)+1),D.set(e,(null!==(g=D.get(e))&&void 0!==g?g:0)+i)}if(null!=n&&""!==n){const e=n+"";B.set(e,(null!==(f=B.get(e))&&void 0!==f?f:0)+1),E.set(e,(null!==(p=E.get(e))&&void 0!==p?p:0)+i)}}const I=[];for(let e=0;L.length>e;e++){const t=L[e];if(!t||"object"!=typeof t)continue;const o=null!==(v=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==v?v:t.id,n=null!=o?o+"":"node-"+e,i=null!==(m=B.get(n))&&void 0!==m?m:0,r=null!==(b=N.get(n))&&void 0!==b?b:0,s=null!==(x=E.get(n))&&void 0!==x?x:0,a=null!==(k=D.get(n))&&void 0!==k?k:0;I.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}I.sort((e,t)=>t.degree-e.degree);let H=0,R=0;if(I.length>0){let e=0;for(const t of I)e+=t.degree,t.degree>R&&(R=t.degree);H=e/I.length}const W=T.some(e=>{var t;const o=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==o?void 0:o.value)&&Number.isFinite(o.value)}),F=[`${I.length} nodes, ${T.length} edges.`];I.length>0&&F.push(`Mean degree: ${Mn(H)}, max degree: ${R}.`);const z=I.slice(0,5);return t("div",{ref:j,id:s,tabIndex:-1,onBlur:P,style:Pn,role:"region","aria-label":C,children:[e("button",{type:"button",onClick:()=>{O&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Tn,children:"×"}),e("div",{role:"note",style:Ln,children:F.join(" ")}),t("table",{role:"table","aria-label":"Node degree summary for "+r,style:Bn,children:[t("caption",{style:Dn,children:["Top ",z.length," of ",I.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:Nn,children:"id"}),e("th",{style:Nn,children:"degree"}),e("th",{style:Nn,children:"in"}),e("th",{style:Nn,children:"out"}),W&&e("th",{style:Nn,children:"w. degree"}),W&&e("th",{style:Nn,children:"w. in"}),W&&e("th",{style:Nn,children:"w. out"})]})}),e("tbody",{children:z.map((o,n)=>t("tr",{children:[e("td",{style:En,children:o.id}),e("td",{style:En,children:o.degree}),e("td",{style:En,children:o.inDeg}),e("td",{style:En,children:o.outDeg}),W&&e("td",{style:En,children:Mn(o.wDegree)}),W&&e("td",{style:En,children:Mn(o.wInDeg)}),W&&e("td",{style:En,children:Mn(o.wOutDeg)})]},n))})]})]})}function Rn({summary:t}){return t?e("div",{role:"note",style:_n,children:t}):null}function Wn({tableId:t}){return e("a",{href:"#"+t,style:_n,onClick:e=>{e.preventDefault();const o=document.getElementById(t);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,_n)},children:"Skip to data table"})}function Fn({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:_n,children:o})}const zn="var(--semiotic-focus, #005fcc)";function $n({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let d;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);d=e("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:zn,strokeWidth:2,strokeDasharray:"4,2"})}else d=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:zn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:zn,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}const Yn={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 Gn(e,t){return"function"==typeof t?t(e):e[t]}function qn(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 Xn(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=Gn(o,i);l=qn(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=Gn(o,n);c.push({label:t,value:qn(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=qn(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=qn(o[e[0]],r))}}const d=Object.assign(Object.assign({},Yn),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:d,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,o)=>t("div",{style:{marginTop:0===o&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},o))]})}}function Vn(o={}){const{fields:n=[],title:i,format:r,style:s={},className:a="",showLabels:l=!0,separator:c=": "}=o;return o=>{if(!o||"object"!=typeof o)return null;const d=[];if(i){const e=Gn(o,i);d.push({value:qn(e,r)})}n&&Array.isArray(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=qn(Gn(o,n),i);d.push({label:l?t:void 0,value:s})}):Object.keys(o).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{d.push({label:l?e:void 0,value:qn(o[e],r)})});const u=Object.assign(Object.assign({},Yn),s);return Array.isArray(d)&&0!==d.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u,children:d.map((e,o)=>t("div",{style:{marginBottom:d.length-1>o?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},o))}):null}}function Un(){return o=>{var n,i,r,s,a,l,c;const d=o.allSeries;if(!d||0===d.length){const t=null!==(i=null===(n=o.data)||void 0===n?void 0:n.value)&&void 0!==i?i:null===(r=o.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:Yn,children:e("div",{children:qn(t)})})}const u=null!==(l=null!==(s=o.xValue)&&void 0!==s?s:null===(a=o.data)||void 0===a?void 0:a.time)&&void 0!==l?l:null===(c=o.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:Yn,children:[null!=u&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:qn(u)}),d.map((o,n)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:o.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:o.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:qn(o.value)})]},n))]})}}function Kn(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(n=t.data)&&void 0!==n?n:{}:t,r=o(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:Yn,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Xn(t):Xn())}}function Qn({x:t,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=Number.isFinite(t)&&Number.isFinite(o),u=n.useRef(null),[h,g]=n.useState(null);n.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let f;f=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!n.isValidElement(e))return!1;const t=e.props;if("string"==typeof t.className&&t.className.trim().length>0)return!0;const o=t.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(a),y=p?null:Yn;return d?e("div",{ref:u,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+o,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:a}):null}function Zn(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function Jn(e,t,o){const n=i(null),[r,a]=u(null);return s(()=>{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;a(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]]]}const ei="undefined"==typeof window?s:h;function ti(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function oi(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Zn(e,e=>t(e.matches))},[]),e}(),o=i(t);o.current=t;const[a,c]=Jn(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=ti(e.foregroundGraphics,c,d),p=ti(e.backgroundGraphics,c,d),y=Me(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=i(0),k=i(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),_=i(0),C=l(()=>{_.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),j=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===_.current&&(_.current=requestAnimationFrame(C))},[C]),M=l(()=>{O.current=null,0!==_.current&&(cancelAnimationFrame(_.current),_.current=0),S.current()},[]);s(()=>()=>{O.current=null,0!==_.current&&(cancelAnimationFrame(_.current),_.current=0)},[]);const P=e.themeDirtyRef;return ei(()=>{P&&(Ft++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:a,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:j,onPointerLeave:M}}function ni(e,t,o,n){const i=e.getContext("2d");if(!i)return null;const r=t[0]*n,s=t[1]*n,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(n,0,0,n,0,0),i.translate(o.left,o.top),i}function ii(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function ri(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function si(e,t,o,n,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=r;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let r=i;l>n&&(r*=n/l),l>a-n&&(r*=(a-n)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}const ai=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,n.width*l,n.height),e.clip());const c=a.style.stroke||"#007bff",d=qt(e,c)||c,u=a.style.strokeWidth||2,h=a.colorThresholds,g=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=u,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;si(e,a.path,d,u,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=Vt(a.curve),p=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!p){e.strokeStyle=d;const m=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let b=0;a.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*m,e.beginPath(),e.moveTo(a.path[b][0],a.path[b][1]),e.lineTo(a.path[b+1][0],a.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function _(){S&&(e.stroke(),S=!1)}for(let C=0;a.path.length>C;C++){const[j,M]=a.path[C],P=g[C],L=ri(P,h,d);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(j,M);else{const T=[];for(const B of h){const N=B.value;(w>N||N>P)&&(N>w||P>N)||w===N||P===N||T.push({t:(N-w)/(P-w)})}T.sort((e,t)=>e.t-t.t);for(const E of T){const I=x+(j-x)*E.t,H=k+(M-k)*E.t,R=ri(w+(P-w)*Math.min(E.t+1e-4,1),h,d);e.lineTo(I,H),_(),O(R,I,H)}e.lineTo(j,M)}x=j,k=M,w=P,A=L}else O(L,j,M),x=j,k=M,w=P,A=L}_()}else{e.beginPath();const W=a.strokeGradient&&a.path.length>=2?Qt(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=W||d,f)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[F,z]=a.path[0];e.moveTo(F,z);for(let $=1;a.path.length>$;$++)e.lineTo(a.path[$][0],a.path[$][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=Ut(e,a.style.fill,a.style.fill),f&&!p)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[G,q]=a.path[0];e.moveTo(G,q);for(let X=1;a.path.length>X;X++)e.lineTo(a.path[X][0],a.path[X][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function li(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ci(e,t,o=.3){li(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 di(e,t,o=.6){var n,i,r,s,a;if(!li(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 ui(e,t,o,n=.35){li(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function hi(e,t){const o=Vt(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=I().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}const gi=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,n.width*a,n.height),e.clip());const l=Ut(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1])*o,e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1]),e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.stroke()}e.globalAlpha=1;continue}const d=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(hi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const i=Kt(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,o,0,n);e.fillStyle=i||l,e.globalAlpha=d}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*d,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(hi(e,t),ui(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const o=t.strokeGradient&&t.topPath.length>=2?Qt(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Vt(t.curve);if(e.beginPath(),n)D().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==a&&1>a&&e.restore(),o&&e.restore(),e.globalAlpha=1}},fi=(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=Ut(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Ut(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),di(e,t),e.globalAlpha=1}}finally{e.restore()}}};function pi(e,t){const{x:o,y:n,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=ln(t);e.beginPath(),e.moveTo(o+s,n),e.lineTo(o+i-a,n),a>0&&e.arcTo(o+i,n,o+i,n+a,a),e.lineTo(o+i,n+r-l),l>0&&e.arcTo(o+i,n+r,o+i-l,n+r,l),e.lineTo(o+c,n+r),c>0&&e.arcTo(o,n+r,o,n+r-c,c),e.lineTo(o,n+s),s>0&&e.arcTo(o,n,o+s,n,s),e.closePath()}function yi(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 vi=(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)mi(e,t);else if(t.cornerRadii&&an(t.cornerRadii)){const o=Ut(e,t.style.fill,qt(e,"var(--semiotic-primary, #007bff)")),n=yi(t),i=t.fillGradient&&"string"==typeof o?Kt(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,pi(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=Ut(e,t.style.fill,qt(e,"var(--semiotic-primary, #007bff)")),n=yi(t),i=t.fillGradient&&"string"==typeof o?Kt(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=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Ut(e,t.style.fill,qt(e,"var(--semiotic-primary, #007bff)")),n=yi(t),i=t.fillGradient&&"string"==typeof o?Kt(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=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}ci(e,t),e.globalAlpha=1}};function mi(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()}function bi(e,t,o,n){return Object.assign({data:e,x:t,y:o,__semioticHoverData:!0},n)}function xi(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>128?"#000":"#fff"}function ki(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const wi=(e,t,o,n)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const o=t.style;if(null!=(null==o?void 0:o.opacity)&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=qt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),ci(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):ki(t.value),n=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=xi(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}},Ai=(e,t,o,n)=>{var i,r,s;for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const a=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==a&&(e.globalAlpha=a);const l=qt(e,t.wickColor)||t.wickColor,c=60>n.height,d=c?Math.max(t.wickWidth,2):t.wickWidth,u=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=d,e.stroke()};if(c||u(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=qt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}c&&u(),e.restore()}};function Si(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}function Oi(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}function _i(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}function Ci(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let i=!1;const r=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),r=t.fn&&t.key&&!(t.key in o);if(!n&&!r)return o;i=!0;const s=Object.assign({},o);return n&&(s[e.key]=e.fn(o)),r&&(s[t.key]=t.fn(o)),s});return i?r:n}}const ji=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Mi(e){const t=e[1]-e[0],o=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:o>t?e=>{const t=new Date(e);return`${ji[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${ji[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Pi={line:[gi,ai,fi],area:[gi,fi],stackedarea:[gi,fi],scatter:[fi],bubble:[fi],heatmap:[wi],bar:[vi],swarm:[fi],waterfall:[(e,t,o,n)=>{var i,r,s;vi(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=qt(e,c)||c,e.lineWidth=null!==(i=null==l?void 0:l._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const n=a[t],i=a[t+1];if(!(null===(r=n.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=i.datum)||void 0===s?void 0:s.baseline))continue;const l=o.y(n.datum.cumEnd),c=n.x+n.w,d=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(d,l),e.stroke()}e.restore()}}],candlestick:[Ai],mixed:[gi,ai,fi],custom:[gi,vi,wi,ai,fi,Ai]},Li={top:20,right:20,bottom:30,left:40},Ti={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function Bi(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],i=o[3];return`#${e}${e}${n}${n}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}const Ni={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Ei({hover:o}){var n,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",a=null!==(n=o.data)&&void 0!==n?n:{},l=null!==(i=a.y)&&void 0!==i?i:a.value,c=null!==(r=a.x)&&void 0!==r?r:a.time;return t("div",{className:"semiotic-tooltip",style:Ni,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(l)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}const Di=g(function(o,a){var c,d,h,g,y,v,m,b,x,k,w,A,S;const{chartType:O,runtimeMode:_,data:C,chunkThreshold:j,chunkSize:M,xAccessor:P,yAccessor:L,colorAccessor:T,sizeAccessor:B,groupAccessor:N,lineDataAccessor:E,curve:D,normalize:I,baseline:H,stackOrder:R,binSize:W,valueAccessor:F,arrowOfTime:z="right",windowMode:$="sliding",windowSize:Y=200,timeAccessor:G,xExtent:q,yExtent:X,extentPadding:V=.1,scalePadding:U,sizeRange:K,size:Q=[500,300],responsiveWidth:Z,responsiveHeight:J,margin:ee,className:te,background:oe,lineStyle:ne,pointStyle:ie,areaStyle:re,barStyle:se,waterfallStyle:ae,swarmStyle:le,barColors:ce,colorScheme:de,boundsAccessor:ue,boundsStyle:he,y0Accessor:ge,gradientFill:pe,lineGradient:ye,areaGroups:be,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:Oe,showAxes:_e=!0,axes:Ce,xLabel:je,yLabel:Me,yLabelRight:Pe,xFormat:Le,yFormat:Te,axisExtent:Be,tickFormatTime:Ne,tickFormatValue:Ee,hoverAnnotation:De,tooltipContent:Ie,customHoverBehavior:He,customClickBehavior:Re,enableHover:We,hoverRadius:Fe=30,tooltipMode:ze,annotations:$e,svgAnnotationRules:Ye,showGrid:Ge,legend:qe,legendHoverBehavior:Xe,legendClickBehavior:Ve,legendHighlightedCategory:Ue,legendIsolatedCategories:Ke,legendPosition:Qe,legendCategoryAccessor:Ze,onCategoriesChange:Je,backgroundGraphics:et,foregroundGraphics:tt,canvasPreRenderers:ot,svgPreRenderers:nt,title:it,categoryAccessor:rt,brush:st,onBrush:at,decay:lt,pulse:ct,transition:dt,animate:ut,staleness:ht,heatmapAggregation:gt,heatmapXBins:ft,heatmapYBins:pt,showValues:yt,heatmapValueFormat:vt,marginalGraphics:mt,pointIdAccessor:bt,xScaleType:xt,yScaleType:kt,accessibleTable:wt=!0,description:At,summary:St,linkedCrosshairName:Ot,linkedCrosshairSourceId:_t,customLayout:Ct,layoutConfig:jt}=o,Mt=f().replace(/:/g,""),Pt=i(!1),Bt=oi({sizeProp:Q,responsiveWidth:Z,responsiveHeight:J,userMargin:ee,marginDefault:Li,animate:ut,transitionProp:dt,themeDirtyRef:Pt}),Nt=gn(),Et=vn(),{reducedMotionRef:Dt,responsiveRef:It,size:Ht,currentTheme:Rt,transition:Wt,introEnabled:Ft,tableId:zt,rafRef:$t,renderFnRef:Yt,scheduleRender:Gt}=Bt;let Xt=Bt.margin;if(mt){const e=60,t=Object.assign({},Bt.margin);mt.top&&e>t.top&&(t.top=e),mt.bottom&&e>t.bottom&&(t.bottom=e),mt.left&&e>t.left&&(t.left=e),mt.right&&e>t.right&&(t.right=e),Xt=t}const Vt="function"==typeof tt?tt({size:Ht,margin:Xt}):tt,Ut="function"==typeof et?et({size:Ht,margin:Xt}):et,Kt=Ht[0]-Xt.left-Xt.right,Qt=Ht[1]-Xt.top-Xt.bottom,Zt=r(()=>fe(C),[C]),oo=null!=De?De:We,no=i(null),io=i(null),[ro,so]=u(0),[ao,lo]=u(null),fo=i(null),po=i(null),[mo,bo]=u(null),xo=i(Ti.primary),ko=i([]),wo=i(Ze),Ao=i(Je);wo.current=Ze,Ao.current=Je;const[So,Oo]=u(!1),[_o,Co]=u([]),[jo,Mo]=u([]),Po="streaming"===_||["bar","swarm","waterfall"].includes(O),Lo=r(()=>{var e,t,o;return{chartType:O,runtimeMode:Po?"streaming":"bounded",windowSize:Y,windowMode:$,arrowOfTime:Po?z:"right",extentPadding:V,scalePadding:U,axisExtent:Be,xAccessor:P,yAccessor:L,timeAccessor:Po?G:void 0,valueAccessor:F,colorAccessor:T,sizeAccessor:B,groupAccessor:N||(E?"_lineGroup":void 0),categoryAccessor:rt,lineDataAccessor:E,xScaleType:xt,yScaleType:kt,xExtent:q,yExtent:X,sizeRange:K,binSize:W,normalize:I,baseline:H,stackOrder:R,boundsAccessor:ue,boundsStyle:he,y0Accessor:ge,gradientFill:!0===pe?{topOpacity:.8,bottomOpacity:.05}:!1===pe?void 0:pe,areaGroups:be?new Set(be):void 0,lineGradient:ye,openAccessor:xe,highAccessor:we,lowAccessor:Ae,closeAccessor:Se,candlestickStyle:Oe,lineStyle:ne,pointStyle:ie,areaStyle:re,swarmStyle:le,waterfallStyle:ae,colorScheme:de,barColors:ce,barStyle:se,annotations:$e,decay:lt,pulse:ct,transition:Wt,introAnimation:Ft,staleness:ht,heatmapAggregation:gt,heatmapXBins:ft,heatmapYBins:pt,showValues:yt,heatmapValueFormat:vt,pointIdAccessor:bt,curve:D,themeCategorical:null===(e=null==Rt?void 0:Rt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Rt),themeSequential:null===(t=null==Rt?void 0:Rt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Rt?void 0:Rt.colors)||void 0===o?void 0:o.diverging,customLayout:Ct,layoutConfig:jt,layoutMargin:Xt}},[O,Y,$,z,V,U,Be,P,L,G,F,xt,kt,T,B,N,rt,E,q,X,K,W,I,H,R,ue,he,ge,pe,ye,be,xe,we,Ae,Se,Oe,ne,ie,re,le,ae,se,de,ce,$e,lt,ct,null==Wt?void 0:Wt.duration,null==Wt?void 0:Wt.easing,Ft,ht,gt,ft,pt,yt,vt,Po,bt,D,Rt,Ct,jt,Xt]),To=bn(Lo),Bo=i(null);Bo.current||(Bo.current=new Lt(To));const No=l(()=>{var e,t;const o=wo.current,n=Ao.current;if(!n||!o)return;const i=Si(null!==(t=null===(e=Bo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Oi(i,ko.current)||(ko.current=i,n(i))},[]);s(()=>{var e;null===(e=Bo.current)||void 0===e||e.updateConfig(To),Pt.current=!0,Gt()},[To,Gt]);const Eo=i(null);Eo.current||(Eo.current=new me(e=>{const t=Bo.current;t&&t.ingest(e)&&(Pt.current=!0,Gt())},{chunkThreshold:j,chunkSize:M})),s(()=>{var e;null===(e=Eo.current)||void 0===e||e.updateChunkOptions({chunkThreshold:j,chunkSize:M})},[j,M]);const Do=l(e=>{var t;null===(t=Eo.current)||void 0===t||t.push(e)},[]),Io=l(e=>{var t;null===(t=Eo.current)||void 0===t||t.pushMany(e)},[]),Ho=l(()=>{var e,t;null===(e=Eo.current)||void 0===e||e.clear(),null===(t=Bo.current)||void 0===t||t.clear(),Pt.current=!0,Gt()},[Gt]);p(a,()=>({push:Do,pushMany:Io,remove:e=>{var t,o,n;null===(t=Eo.current)||void 0===t||t.flush();const i=null!==(n=null===(o=Bo.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];return i.length>0&&(fo.current&&i.some(e=>{var t;return e===(null===(t=fo.current)||void 0===t?void 0:t.data)})&&(fo.current=null,bo(null)),Pt.current=!0,Gt()),i},update:(e,t)=>{var o,n,i;null===(o=Eo.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Bo.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Pt.current=!0,Gt()),r},clear:Ho,getData:()=>{var e,t,o;return null===(e=Eo.current)||void 0===e||e.flush(),null!==(o=null===(t=Bo.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Bo.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Bo.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Do,Io,Ho,Gt]),s(()=>{var e,t;if(C){if(E&&Zt.length>0&&"object"==typeof Zt[0]&&null!==Zt[0]){const t="string"==typeof E?E:"coordinates";if(Array.isArray(Zt[0][t])){const o=[];for(const e of Zt){const n=e[t];if(Array.isArray(n)){const t=e.label||e.id||e.key;if(null!=t)for(const e of n)o.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of n)o.push(e)}}return void(null===(e=Eo.current)||void 0===e||e.setBoundedData(o))}}null===(t=Eo.current)||void 0===t||t.setBoundedData(Zt)}},[C,Zt,E]);const{hoverHandlerRef:Ro,hoverLeaveRef:Wo,onPointerMove:Fo,onPointerLeave:zo}=Bt;Ro.current=e=>{var t,o,n;if(!oo)return;const i=no.current;if(!i)return;const r=i.getBoundingClientRect(),s=e.clientX-r.left-Xt.left,a=e.clientY-r.top-Xt.top;if(0>s||s>Kt||0>a||a>Qt)return void(fo.current&&(fo.current=null,po.current=null,bo(null),He&&(He(null),Pt.current=!0),Gt()));const l=Bo.current;if(!l||0===l.scene.length)return;const c=eo(l.scene,s,a,Fe,l.quadtree,l.maxPointRadius),d="multi"===ze,u=()=>{fo.current&&(fo.current=null,po.current=null,bo(null),He&&He(null),Gt())};if(!c&&!d)return void u();const h=d||!c?s:c.x,g=d||!c?a:c.y;let f=bi(null!==(t=null==c?void 0:c.datum)&&void 0!==t?t:{},h,g);if(d&&l.scene.length>0&&l.scales){const e=function(e,t,o=30){const n=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=to(Jt(e.path,e.curve),t,o);if(null===r)continue;const s=co(e.path,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=Jt(e.topPath,e.curve),s=Jt(e.bottomPath,e.curve),a=to(r,t,o);if(null===a)continue;const l=to(s,t,o),c=co(e.topPath,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:null!=l?l:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return n}(l.scene,h,Math.max(Fe,Kt));if(e.length>0){const t=l.scales.y.invert,o=l.scales.x.invert,n=xo.current,i=o?o(h):h;if(c)f.xValue=i,f.xPx=h;else{const e={xValue:i};"string"==typeof P&&(e[P]=i),f=bi(e,h,g,{xValue:i,xPx:h})}f.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===O&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:e.datum}})}}c||(null===(o=f.allSeries)||void 0===o?void 0:o.length)?(fo.current=f,po.current=null!==(n=null==c?void 0:c.node)&&void 0!==n?n:null,bo(f),He&&(He(f),Pt.current=!0),Gt()):u()},Wo.current=()=>{fo.current&&(fo.current=null,po.current=null,bo(null),He&&(He(null),Pt.current=!0),Gt())};const $o=i(()=>{});$o.current=e=>{if(!Re)return;const t=no.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>Kt||0>i||i>Qt)return void Re(null);const r=Bo.current;if(!r||0===r.scene.length)return void Re(null);const s=eo(r.scene,n,i,Fe,r.quadtree,r.maxPointRadius);Re(s?bi(s.datum||{},s.x,s.y):null)};const Yo=l(e=>$o.current(e),[]),Go=i(-1),qo=i(null),Xo=i(null),Vo=l(e=>{const t=Bo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Xo.current&&Xo.current.version===o)n=Xo.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,o=Array.isArray(e.datum)?e.datum:[],n=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&o.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:o[t],shape:"circle",group:n});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":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:"_default"});break;case"heatcell":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:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=uo(e),Xo.current={version:o,graph:n}}const i=Go.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Go.current=0;const t=n.flat[0];qo.current={shape:t.shape,w:t.w,h:t.h};const o=yo(t);return fo.current=o,bo(o),He&&He(o),void Gt()}const r=ho(n,i),s=go(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Go.current=-1,qo.current=null,fo.current=null,po.current=null,bo(null),He&&He(null),void Gt();Go.current=s;const a=n.flat[s];qo.current={shape:a.shape,w:a.w,h:a.h};const l=yo(a);fo.current=l,bo(l),He&&He(l),Gt()},[He,Gt]),Uo=l(e=>{Go.current=-1,qo.current=null,Fo(e)},[Fo]);Yt.current=()=>{var e,t;$t.current=0;const o=no.current,n=io.current;if(!o||!n)return;const i=Bo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Dt.current?r+1e6:r),a=!Dt.current&&s,l=Pt.current||s;l&&!a&&(i.computeScene({width:Kt,height:Qt}),No());const c=ii(),d=function(e){if(!e)return Ti;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||o||r?{axisStroke:l||Ti.axisStroke,tickText:s||Ti.tickText,crosshair:s?Bi(s,"66"):Ti.crosshair,hoverFill:c?Bi(c,"4D"):Ti.hoverFill,hoverStroke:s?Bi(s,"99"):Ti.hoverStroke,pointRing:c||Ti.pointRing,primary:r||Ti.primary}:Ti}(o);xo.current=d.primary;const u=null!==(e=null==ht?void 0:ht.threshold)&&void 0!==e?e:5e3,h=ht&&i.lastIngestTime>0&&r-i.lastIngestTime>u;if(l){const e=ni(o,Ht,Xt,c);if(e){if(e.clearRect(-Xt.left,-Xt.top,Ht[0],Ht[1]),h&&(e.globalAlpha=null!==(t=null==ht?void 0:ht.dimOpacity)&&void 0!==t?t:.5),"transparent"!==oe&&!et){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=oe||(t&&"transparent"!==t?t:null),i=n?qt(e,n):null;i&&(e.fillStyle=i,e.fillRect(-Xt.left,-Xt.top,Ht[0],Ht[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Kt,Qt),e.clip()),ot&&i.scales)for(const t of ot)e.save(),t(e,i.scene,i.scales,{width:Kt,height:Qt}),e.restore();const n=Ct?Pi.custom:Pi[O];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:Kt,height:Qt});e.restore(),h&&(e.globalAlpha=1)}}{const e=ni(n,Ht,Xt,c);if(e&&(e.clearRect(-Xt.left,-Xt.top,Ht[0],Ht[1]),oo&&fo.current&&i.scales&&function(e,t,o,n,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,d=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const u="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?d:t.x,0),e.lineTo(c?d:t.x,n),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of l)null!=t.valuePx&&(e.beginPath(),e.arc(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const o=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,fo.current,Kt,Qt,"object"==typeof oo?oo:{},po.current,d),po.current&&Array.isArray(De))){const t=De.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s=o.group;if(void 0!==s)for(const o of t){if("line"!==o.type)continue;if(o.group!==s)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,po.current,t,d)}}l&&o&&o.setAttribute("aria-label",Cn(i.scene,O+" chart"));const g=Pt.current;if(Pt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!ao||e(ao.x.domain()[0])!==e(i.scales.x.domain()[0])||e(ao.x.domain()[1])!==e(i.scales.x.domain()[1])||e(ao.y.domain()[0])!==e(i.scales.y.domain()[0])||e(ao.y.domain()[1])!==e(i.scales.y.domain()[1])||ao.x.range()[0]!==i.scales.x.range()[0]||ao.x.range()[1]!==i.scales.x.range()[1]||ao.y.range()[0]!==i.scales.y.range()[0]||ao.y.range()[1]!==i.scales.y.range()[1])&&lo(i.scales),mt){const e=i.getData(),t="function"==typeof P?P:e=>e[P||"x"],o="function"==typeof L?L:e=>e[L||"y"];Co(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Mo(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&$e&&$e.length>0&&so(e=>e+1),(null==ht?void 0:ht.showBadge)&&Oo(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&($t.current=requestAnimationFrame(()=>Yt.current()))},mn({hydrated:Nt,wasHydratingFromSSR:Et,storeRef:Bo,dirtyRef:Pt,renderFnRef:Yt,cleanup:()=>{var e;return null===(e=Eo.current)||void 0===e?void 0:e.clear()}}),s(()=>{Pt.current=!0,Gt()},[O,Kt,Qt,_e,oe,ne,ot,Gt]),vo(ht,Bo,Pt,Gt,So,Oo);const Ko=r(()=>{if(Le||Ne)return;const e=Bo.current;return(null==e?void 0:e.xIsDate)&&ao?Mi(ao.x.domain()):void 0},[Le,Ne,ao]),Qo=Le||Ne||Ko,Zo=oo&&mo?Ie?Ie(mo):e(Ei,{hover:mo}):null,Jo=Zo?e(Qn,{x:mo.x,y:mo.y,containerWidth:Kt,containerHeight:Qt,margin:Xt,className:"stream-frame-tooltip",children:Zo}):null,en=qo.current,tn=e($n,{active:Go.current>=0,hoverPoint:mo,margin:Xt,size:Ht,shape:null==en?void 0:en.shape,width:null==en?void 0:en.w,height:null==en?void 0:en.h}),nn=_i(P,G,"__semiotic_resolvedX","__semiotic_resolvedTime"),rn=_i(L,F,"__semiotic_resolvedY","__semiotic_resolvedValue"),an=nn.key,ln=rn.key,cn=Ci(nn,rn,$e&&$e.length>0||!1);if(un||!Nt&&Et){const o=Bo.current;o&&C&&(o.ingest({inserts:Zt,bounded:!0}),o.computeScene({width:Kt,height:Qt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(d=null==o?void 0:o.scales)&&void 0!==d?d:null,s=Qo||(()=>{if((null==o?void 0:o.xIsDate)&&r)return Mi(r.x.domain())})();return t("div",{ref:It,className:"stream-xy-frame"+(te?" "+te:""),role:"img","aria-label":At||("string"==typeof it?it:"XY chart"),style:{position:"relative",width:Z?"100%":Ht[0],height:J?"100%":Ht[1]},children:[e(Rn,{summary:St}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Ut}),t("g",{transform:`translate(${Xt.left},${Xt.top})`,children:[oe&&e("rect",{x:0,y:0,width:Kt,height:Qt,fill:oe}),nt&&r&&nt.map((t,o)=>e(n.Fragment,{children:t(i,r,{width:Kt,height:Qt})},"svgpre-"+o)),i.map((o,n)=>function(o,n,i){var r,s,a,l,c;switch(o.type){case"line":{const t=o;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+n)}case"area":{const c=o;if(0===c.topPath.length)return null;const d=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const o=`${i?i+"-":""}area-clip-${n}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:o,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:d,fill:dn(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${o})`})]},"area-"+n)}return e("path",{d:d,fill:dn(c.style.fill),fillOpacity:null!==(l=null!==(a=c.style.fillOpacity)&&void 0!==a?a:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+n)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:dn(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+n)}case"rect":{const t=o;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:dn(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+n)}case"heatcell":{const i=o;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const o=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,a]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),l=.299*r+.587*s+.114*a>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:o})]},"heatcell-"+n)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+n)}case"candlestick":{const i=o,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),a=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:a,stroke:a,strokeWidth:1})]},"candle-"+n)}default:return null}}(o,n,Mt)).filter(Boolean)]})]}),e(sn,{width:Kt,height:Qt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Xt,scales:r,showAxes:_e,axes:Ce,xLabel:je,yLabel:Me,yLabelRight:Pe,xFormat:s,yFormat:Te||Ee,axisExtent:Be,showGrid:Ge,title:it,legend:qe,legendHoverBehavior:Xe,legendClickBehavior:Ve,legendHighlightedCategory:Ue,legendIsolatedCategories:Ke,legendPosition:Qe,foregroundGraphics:Tt(Vt,null===(h=Bo.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:mt,xValues:[],yValues:[],annotations:$e,svgAnnotationRules:Ye,annotationFrame:0,xAccessor:an,yAccessor:ln,annotationData:cn(null==o?void 0:o.getData()),pointNodes:null==o?void 0:o.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,linkedCrosshairName:Ot,linkedCrosshairSourceId:_t})]})}return t("div",{ref:It,className:"stream-xy-frame"+(te?" "+te:""),role:"group","aria-label":At||("string"==typeof it?it:"XY chart"),tabIndex:0,style:{position:"relative",width:Z?"100%":Ht[0],height:J?"100%":Ht[1],overflow:"visible"},onKeyDown:Vo,children:[wt&&e(Wn,{tableId:zt}),wt&&e(In,{scene:null!==(y=null===(g=Bo.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:zt,chartTitle:"string"==typeof it?it:void 0}),e(Rn,{summary:St}),t("div",{role:"img","aria-label":At||("string"==typeof it?it:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:oo?Uo:void 0,onMouseLeave:oo?zo:void 0,onClick:Re?Yo:void 0,children:[Ut&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ht[0],height:Ht[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Xt.left},${Xt.top})`,children:Ut})}),e(on,{width:Kt,height:Qt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Xt,scales:ao,showAxes:_e,axes:Ce,showGrid:Ge,xFormat:Qo,yFormat:Te||Ee,axisExtent:Be}),e("canvas",{ref:no,"aria-label":Cn(null!==(m=null===(v=Bo.current)||void 0===v?void 0:v.scene)&&void 0!==m?m:[],O+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:io,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Fn,{hoverPoint:mo}),e(sn,{width:Kt,height:Qt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Xt,scales:ao,showAxes:_e,axes:Ce,xLabel:je,yLabel:Me,yLabelRight:Pe,xFormat:Qo,yFormat:Te||Ee,axisExtent:Be,showGrid:Ge,title:it,legend:qe,legendHoverBehavior:Xe,legendClickBehavior:Ve,legendHighlightedCategory:Ue,legendIsolatedCategories:Ke,legendPosition:Qe,foregroundGraphics:Tt(Vt,null===(b=Bo.current)||void 0===b?void 0:b.customLayoutOverlays),marginalGraphics:mt,xValues:_o,yValues:jo,annotations:$e,svgAnnotationRules:Ye,annotationFrame:ro,xAccessor:an,yAccessor:ln,annotationData:cn(null===(x=Bo.current)||void 0===x?void 0:x.getData()),pointNodes:null===(k=Bo.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==oe&&!et,linkedCrosshairName:Ot,linkedCrosshairSourceId:_t}),(st||at)&&e(ve,{width:Kt,height:Qt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Xt,dimension:null!==(w=null==st?void 0:st.dimension)&&void 0!==w?w:"xy",scales:ao,onBrush:null!=at?at:()=>{},binSize:W,snap:null==st?void 0:st.snap,binBoundaries:null!==(A=null==st?void 0:st.binBoundaries)&&void 0!==A?A:"bar"===O?null===(S=Bo.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==st?void 0:st.snapDuring,streaming:"streaming"===_}),(null==ht?void 0:ht.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ht.badgePosition?{top:4,left:4}:"bottom-left"===ht.badgePosition?{bottom:4,left:4}:"bottom-right"===ht.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"}),tn,Jo]})]})});Di.displayName="StreamXYFrame";const Ii=d(null);function Hi({colors:t,categories:o,colorScheme:n="category10",children:i}){const s=r(()=>{if(t)return t;if(o){const e=Array.isArray(n)?n:ht[n]||gt,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,n]);return e(Ii.Provider,{value:s,children:i})}function Ri(){return a(Ii)}function Wi(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 Fi(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Wi(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function zi(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}Hi.displayName="CategoryColorProvider";const[$i,Yi]=be(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=zi(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=zi(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}})}})),[Gi,qi]=be(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}))}}));function Xi(e){const t=f(),o=e.clientId||t,{name:n}=e,i=Yi(e=>e.selections.get(n)),s=Yi(e=>e.setClause),a=Yi(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?Fi(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(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:l(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:l(()=>{a(n,o)},[a,n,o]),clientId:o}}function Vi(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Xi({name:t});return{onHover:l(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}}function Ui(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Ki(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:c}=Xi({name:t}),d=o&&n?"xyBrush":o?"xBrush":"yBrush",u=l(e=>{if(!e)return void c();const t={};"xyBrush"===d&&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"===d&&Ui(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===d&&Ui(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[d,o,n,a,c]);return{brushInteraction:r(()=>({brush:d,during:u,end:u}),[d,u]),predicate:i,isActive:s,clear:c}}function Qi(e,t,o){const n=Yi(e=>e.selections.get(t));return r(()=>{if(!n||0===n.clauses.size)return e;const t=Fi(n,o);return e.filter(t)},[e,n,o])}function Zi(e={}){const{limit:t=50,types:o,chartId:n}=e,i=qi(e=>e.version),s=qi(e=>e.observations),a=qi(e=>e.clearObservations),l=r(()=>{let e=s;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[s,o,n,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const Ji=d(!1),er=d(null),tr="undefined"==typeof window?s:h;function or(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function nr(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}function ir(e){const t=a(er),o=f(),n=or(e),r=i([]);nr(r.current,n)||(r.current=n);const s=r.current;tr(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),tr(()=>{t&&t.registerCategories(o,s)},[t,o,s])}function rr({selections:e}){const t=Yi(e=>e.setResolution);return s(()=>{for(const[o,n]of Object.entries(e))n.resolution&&t(o,n.resolution)},[e,t]),null}function sr({categoryColors:t,interaction:o,selectionName:n,field:a}){const c=Object.entries(t),d=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=Vi({name:n,fields:[a]}),f=Xi({name:n,clientId:"__linked-legend-isolate__"}),[p,y]=u(new Set),[v,m]=u(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,s(()=>{"isolate"===o&&(p.size>0?b.current({[a]:Array.from(p)}):x.current())},[o,p,a]);const k=l(e=>{"highlight"===o&&(e?(m(e.label),g.onHover({[a]:e.label})):(m(null),g.onHover(null)))},[o,a,g]),w=l(e=>{"isolate"===o&&y(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===d.length?new Set:o})},[o,d.length]),[A,[S]]=Jn([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const i of e){const e=26+7*i.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e(So,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===o?k:void 0,customClickBehavior:"isolate"===o?w:void 0,highlightedCategory:v,isolatedCategories:p})})})}function ar({children:o,selections:n,showLegend:s,legendPosition:a="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:d="category"}){const h=Ri(),[g,f]=u({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const o=or(t);f(t=>{var n;return nr(null!==(n=t[e])&&void 0!==n?n:[],o)?t:Object.assign(Object.assign({},t),{[e]:o})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const o=Object.assign({},t);return delete o[e],o})}}),[]),v=r(()=>{const e=[];for(const t of Object.values(g))for(const o of t)e.push(o);return or(e)},[g]),m=r(()=>{var e;const t=null!=h?h:{},o=p.current;let n=Object.keys(t).length+Object.keys(o).length;for(const e of v)t[e]||o[e]||(o[e]=gt[n%gt.length],n++);const i=Object.assign({},t);for(const n of v)i[n]=null!==(e=t[n])&&void 0!==e?e:o[n];return i},[h,v]),b=void 0===s||s,x=b&&Object.keys(m).length>0;return e($i,{children:t(Gi,{children:[n&&e(rr,{selections:n}),e(er.Provider,{value:y,children:e(Hi,{colors:m,children:t(Ji.Provider,{value:x,children:[b&&"top"===a&&e(sr,{categoryColors:m,interaction:l,selectionName:c,field:d}),o,b&&"bottom"===a&&e(sr,{categoryColors:m,interaction:l,selectionName:c,field:d})]})})})]})})}function lr({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){const a=(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):ft[r%ft.length];return{label:i+"",color:a}});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:a,label:""}]}}function cr(e){return e?"string"==typeof e?{name:e}:e:null}function dr(e,t,o){return t?(n,...i)=>{var r;const s=Object.assign({},e(n,...i));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(s,o.selectedStyle);else{const e=null!==(r=null==o?void 0:o.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(s,o.unselectedStyle)}return s}:e}const ur={light:Se,dark:Oe,"high-contrast":_e,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function hr(e){return ur[e]}const gr=n.createContext(void 0),fr="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function pr(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return hr(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function yr({theme:e}){const t=Me(e=>e.setTheme),o=Me(e=>e.theme),i=n.useRef(o);i.current=o;const r=n.useRef(null);n.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=i.current===_e?Se:i.current,t("high-contrast")),Zn(o,e=>{var o,n;e.matches?(r.current=i.current===_e?null!==(o=r.current)&&void 0!==o?o:Se:i.current,t("high-contrast")):(function(e,t){e(t===Se?"light":t===Oe?"dark":t===_e?"high-contrast":t)}(t,null!==(n=r.current)&&void 0!==n?n:Se),r.current=null)})},[e,t]);const s=n.useRef(!1);return fr(()=>{s.current?void 0!==e&&t(pr(e)):s.current=!0},[e,t]),null}function vr({children:t}){var o,i,r,s,a;const l=Me(e=>e.theme),c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(o=l.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),d=n.useContext(gr),u={};return d&&(u["data-semiotic-theme"]=d),e("div",Object.assign({style:c},u,{children:t}))}function mr({theme:o,children:i}){const r="string"==typeof o&&hr(o)?o:void 0,s=n.useMemo(()=>function(e){return void 0!==e?Ce(Se,pr(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?_e:Se}(o),[o]);return e(je,{initialState:{theme:s},children:t(gr.Provider,{value:r,children:[e(yr,{theme:o}),e(vr,{children:i})]})})}function br(){return Me(e=>e.theme)}const xr="#007bff";function kr(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 wr(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 Ar(){var e;const t=br(),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 Sr(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=ht[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]:xr}function Or(e,t,o){const n=Ri(),i=Ar();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=mt(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return mt(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=mt(e,t,s);return e=>n[e]||o(e)}return mt(e,t,s)}if(n&&Object.keys(n).length>0){const e=mt([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}function _r(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(o);return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}function Cr({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:i,chartType:a,chartId:c,onClick:d,hoverHighlight:h,colorByField:g}){const p=f(),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=Xi({name:(null==e?void 0:e.name)||"__unused__"}),m=Vi({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=qi(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=u(null),A=g||o[0],S=r(()=>{if(!h||null==k||!A)return null;const e=k,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,k,A]),O=l(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=kr(e,t,y.xField);null!=o&&function(e,t,o){const n=$o.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||($o={positions:new Map($o.positions).set(e,{xValue:t,sourceId:o})},Go())}(y.name||"hover",o,p)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&qo(y.name||"hover",p),"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];w(null!=o?o+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const r=wr(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,m,y,p,i,a,c,b,h,A]),_=l(e=>{var t,o,n,r;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=kr(e,t,y.xField);null!=o&&function(e,t,o){const n=$o.positions.get(e);if(null==n?void 0:n.locked){const t=new Map($o.positions);return t.delete(e),$o={positions:t},Go(),!1}$o={positions:new Map($o.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Go()}(y.name||"hover",o,p)}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(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const o=wr(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[d,i,b,a,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Xo(e,p),qo(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:_,crosshairSourceId:p}}function jr(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}}function Mr({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const d=a(Ji),u=null!==a(er),h=void 0!==n?n:!d&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==c)return c;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)},[c,t,e,g]);ir(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const n=lr({data:e,colorBy:t,colorScale:o,getColor:vt,categories:f}),i=n.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?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({},l),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},[l,s,p,i]);return{legend:p,margin:y,legendPosition:i}}function Pr(e,t,o){const[n,i]=u(null),[s,a]=u(new Set),c=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),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}}const Lr={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 Tr(e,t,o){var n,i,r,s,a,l,c;const d=Lr[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:Br(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function Br(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 Nr(e){return"string"==typeof e?e:"value"}function Er(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Dr(e,t){if(!t)return Er(e);try{const o=t(e);return null==o?Er(e):o}catch(t){return Er(e)}}function Ir(e,t){return"function"==typeof t?t(e):e[t]}function Hr(o){const n=o.find(e=>"title"===e.role),i=o.filter(e=>"title"!==e.role);return o=>{const r=o.data;if(!r)return null;const s=n?Dr(Ir(r,n.accessor),n.format):null;return t("div",{className:"semiotic-tooltip",style:Yn,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((o,n)=>{const i=Dr(Ir(r,o.accessor),o.format);return t("div",{style:n>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[o.label,": "]}),e("span",{children:i})]},n)})]})}}function Rr({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=Ir(d,o),h=Ir(d,n),g=i?Ir(d,i):void 0;return t("div",{className:"semiotic-tooltip",style:Yn,children:[e("div",{style:{fontWeight:"bold"},children:Er(u)}),e("div",{style:{marginTop:4},children:Dr(h,a)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||Nr(i),": ",Er(g)]})]})}}function Wr({componentName:o,message:n,diagnosticHint:i,width:r,height:s}){return e("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:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:o}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&e("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 Fr 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:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e(Wr,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var zr;const $r="undefined"!=typeof process&&"production"!==(null===(zr=process.env)||void 0===zr?void 0:zr.NODE_ENV);function Yr({componentName:t,width:o,height:n,children:i}){return e(Fr,{fallback:i=>e(Wr,{componentName:t,message:i.message,width:o,height:n}),children:i})}const Gr={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"},qr={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xr(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Gr),{width:o,height:n}),children:i||"No data available"}):null}function Vr(t,o,n){if(!t)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 e("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},(t,n)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},qr),{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))})}function Ur(e,t,o,n){if(!$r)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 Kr(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 Qr(e,t,o=3){let n,i=o+1;for(const o of t){const t=Kr(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}function Zr(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Jr(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=Qr(e,t,3))&&void 0!==o?o:null)}function es({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=Zr(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=Jr(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function ts({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} 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}function os({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==o)return null;if(i&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!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 o=Zr(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in o)){const o=Jr(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function ns(e){const t=Me(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])}function is(e){const{data:t,rawData:o,colorBy:n,colorScheme:i,legendInteraction:s,legendPosition:a,selection:c,linkedHover:d,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:v,userMargin:m,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,emptyContent:A,width:S,height:O}=e,_=void 0===o,C=r(()=>fe(t),[t]),[j,M]=u([]),P=l(e=>{M(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:B,customHoverBehavior:N,customClickBehavior:E,crosshairSourceId:D}=Cr({selection:c,linkedHover:d,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:L}),I=jr(d,D),H=Or(C,n,i),R=r(()=>{if(!n)return[];const e=new Set;for(const t of C){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[C,n]),W=r(()=>_&&j.length>0?j:R,[_,j,R]),F=Pr(s,n,W),z=r(()=>B||(F.legendSelectionHook?F.legendSelectionHook:T),[B,F.legendSelectionHook,T]),$=ns(c),Y=Ar(),G=Ri(),q=r(()=>{if(H)return H;if(!n||0===W.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:Y&&Y.length>0?Y:ft,t="__streamCat",o=mt(W.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||o(e)||"#999"},[H,n,W,i,Y,G]),{legend:X,margin:V,legendPosition:U}=Mr({data:C,colorBy:n,colorScale:q,showLegend:v,legendPosition:a,userMargin:m,defaults:b,categories:W}),K=r(()=>{const e={};return X&&(e.legend=X,e.legendPosition=U),s&&"none"!==s&&(e.legendHoverBehavior=F.onLegendHover,e.legendClickBehavior=F.onLegendClick,e.legendHighlightedCategory=F.highlightedCategory,e.legendIsolatedCategories=F.isolatedCategories),_&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=P),e},[X,U,s,F.onLegendHover,F.onLegendClick,F.highlightedCategory,F.isolatedCategories,_,n,P]),Q=Array.isArray(o)?fe(o):o,Z=Vr(w,S,O),J=Z?null:Xr(Q,S,O,A);return{data:C,colorScale:H,allCategories:W,legendState:F,effectiveSelectionHook:z,activeSelectionHook:T,customHoverBehavior:N,customClickBehavior:E,legend:X,margin:V,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:K,crosshairProps:I,resolvedSelection:$}}function rs(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 ss(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:i,resolveStroke:s,fillArea:a,areaOpacity:l=.3,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g}=e,f=r(()=>(e,r)=>{const c={strokeWidth:t},d=!0===a||Array.isArray(a)&&null!=r&&a.includes(r);let u;return s?u=s(e,r):o?n&&(u=vt(e,o,n)):u=i||xr,void 0!==u&&(c.stroke=u,d&&(c.fill=u,c.fillOpacity=l)),c},[t,o,n,i,s,a,l]),p=r(()=>rs(f,{stroke:c,strokeWidth:d,opacity:u}),[f,c,d,u]);return r(()=>dr(p,null!=h?h:null,g),[p,h,g])}function as(e,t){const{variant:o,frameRef:n,overrides:i,deps:r}=t;p(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:[]}}}if("geo-points"===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.removePoint(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i,r;const s=null!==(i=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(o(t));return s},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:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removeLine(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.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.pushLine(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.getLines())&&void 0!==t?t:[]}}}(o,n);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function ls(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof o?e:new o(function(t){t(e)})}(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const cs="__forecastSegment";let ds=null;function us(){return ls(this,void 0,void 0,function*(){return ds||(ds=yield import("./semiotic-ai-statisticalOverlays-C2PPlmXv.js")),ds})}const hs="__semiotic_resolvedX",gs="__semiotic_resolvedY";function fs(e){const{data:t,xAccessor:o,yAccessor:n,forecast:a,anomaly:l,groupBy:c}=e,d="string"==typeof o?o:hs,h="string"==typeof n?n:gs,g=r(()=>{if(!a&&!l)return t;const e="function"==typeof o,i="function"==typeof n;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[hs]=o(t)),i&&(r[gs]=n(t)),r}):t},[t,a,l,o,n]),[f,p]=u(null),[y,v]=u([]),m=i(a),b=i(l);return s(()=>{if(!a&&!l)return void((m.current||b.current)&&(p(null),v([]),m.current=a,b.current=l));let e=!1;const t=a!==m.current||l!==b.current;if(m.current=a,b.current=l,t&&(p(null),v([])),a){const t=c&&"string"==typeof c&&"object"==typeof a?Object.assign(Object.assign({},a),{_groupBy:c}):a;(function(...e){return ls(this,void 0,void 0,function*(){return(yield us()).buildForecast(...e)})})(g,d,h,t,l).then(t=>{e||(p(t),v(t.annotations))}).catch(()=>{e||(p(null),v([]))})}else l&&function(...e){return ls(this,void 0,void 0,function*(){return(yield us()).buildAnomalyAnnotations(...e)})}(l).then(t=>{e||(p(null),v(t))}).catch(()=>{e||v([])});return()=>{e=!0}},[g,a,l,d,h,c]),{effectiveData:f?f.processedData:t,statisticalAnnotations:y,hasForecast:!!f,xAccessorKey:d,yAccessorKey:h}}const ps=g(function(t,o){var n,a;const c=i(null);as(o,{variant:"xy",frameRef:c});const d=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,axisExtent:v,xAccessor:m="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:_=3,fillArea:C=!1,areaOpacity:j=.3,lineWidth:M=2,lineGradient:P,tooltip:L,pointIdAccessor:T,annotations:B,directLabel:N,gapStrategy:E="break",anomaly:D,forecast:I,xExtent:H,yExtent:R,frameProps:W={},selection:F,linkedHover:z,onObservation:$,onClick:Y,hoverHighlight:G,hoverRadius:q,chartId:X,loading:V,emptyContent:U,legendInteraction:K,legendPosition:Q,xScaleType:Z,yScaleType:J,color:ee,stroke:te,strokeWidth:oe,opacity:ne}=t,{width:ie,height:re,enableHover:se,showGrid:ae,showLegend:le,title:ce,description:de,summary:ue,accessibleTable:he,xLabel:ge,yLabel:pe}=d,ye=r(()=>fe(h),[h]);Ur("LineChart",ye,"xAccessor",m),Ur("LineChart",ye,"yAccessor",b);const{effectiveData:ve,statisticalAnnotations:me}=fs({data:ye,xAccessor:m,yAccessor:b,forecast:I,anomaly:D,groupBy:x}),be="__compoundGroup",xe=!(!I||!x),ke=xe?be:I?cs:x,we=r(()=>{if(!xe)return ve;const e="function"==typeof x?x:e=>e[x];return ve.map(t=>{const o=Object.assign({},t);return o[be]=`${e(t)}__${t[cs]||"observed"}`,o})},[ve,xe,x]),Ae=xe?we:ve,Se=r(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=ve;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[I,ve,b]),Oe=l(e=>{const t="function"==typeof m?m(e):e[m],o="function"==typeof b?b(e):e[b];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[m,b]),_e=void 0!==(null===(n=Ae[0])||void 0===n?void 0:n[k]),Ce=r(()=>{if(_e)return Ae;if(ke){const e=Ae.reduce((e,t)=>{const o="function"==typeof ke?ke(t):t[ke];if(!e[o]){const n={[k]:[]};"string"==typeof ke&&(n[ke]=o),xe&&(n[cs]=t[cs],"string"==typeof x&&(n[x]=t[x])),e[o]=n}return e[o][k].push(t),e},{});return Object.values(e)}return[{[k]:Ae}]},[Ae,ke,k,_e]),{gapProcessedLineData:je,hasGaps:Me}=r(()=>{if("interpolate"===E){let e=!1;const t=[];for(const o of Ce){const n=(o[k]||[]).filter(t=>!Oe(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[k]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===E){let e=!1;const t=[];for(const o of Ce){const n=o[k]||[];let i=[],r=0;const s=ke&&"string"==typeof ke?o[ke]:void 0;for(const a of n)if(Oe(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[k]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===E){let e=!1;const t="string"==typeof b?b:"y",o=[];for(const n of Ce){const i=n[k]||[],r=[];for(const o of i)Oe(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Ce,hasGaps:!1}},[Ce,E,k,Oe,ke,b]),Pe="object"==typeof N?N:{},Le=Pe.position||"end",Te=Pe.fontSize||11,Be=r(()=>{var e;if(!N||!w)return[];const t="function"==typeof w?w:e=>e[w],o=new Set;for(const n of je){const i=n[k]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Le?i[i.length-1]:i[0]))&&void 0!==e?e:t(n);if(null==r)continue;const s=r+"";""!==s&&o.add(s)}return Array.from(o)},[N,w,je,k,Le]),Ne=r(()=>{if(!N)return d.marginDefaults;const e=Be.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0),t=e+10,o="end"===Le?"right":"left";return Object.assign(Object.assign({},d.marginDefaults),{[o]:Math.max(d.marginDefaults[o]||0,t)})},[N,Be,Te,Le,d.marginDefaults]),Ee=is({data:ve,rawData:h,colorBy:w,colorScheme:A,legendInteraction:K,legendPosition:Q,selection:F,linkedHover:z,fallbackFields:w?["string"==typeof w?w:""]:[],unwrapData:!1,onObservation:$,onClick:Y,hoverHighlight:G,chartType:"LineChart",chartId:X,showLegend:(!N||void 0!==le)&&le,userMargin:g,marginDefaults:Ne,loading:V,emptyContent:U,width:ie,height:re}),De=Ee.colorScale,Ie=Ee.customHoverBehavior,He=Ee.customClickBehavior,Re=Ee.crosshairProps,We=ss({lineWidth:M,colorBy:w,colorScale:De,color:ee,fillArea:C,areaOpacity:j,stroke:te,strokeWidth:oe,opacity:ne,effectiveSelectionHook:Ee.effectiveSelectionHook,resolvedSelection:Ee.resolvedSelection}),[Fe,ze]=u(null);s(()=>{if(!I)return void ze(null);let e=!1;return function(...e){return ls(this,void 0,void 0,function*(){return(yield us()).createSegmentLineStyle(...e)})}(We,I).then(t=>{e||ze(()=>t)}).catch(()=>{e||ze(null)}),()=>{e=!0}},[We,I]);const $e=Fe||We,Ye=r(()=>{if(O)return e=>{const t={r:_,fillOpacity:1};return w?De&&(t.fill=vt(e.parentLine||e,w,De)):t.fill=ee||xr,t}},[O,_,w,De,ee]),Ge=Array.isArray(C)?"mixed":C?"area":"line",qe=r(()=>{var e;if(!N||!w)return[];const t="function"==typeof m?m:e=>e[m],o="function"==typeof b?b:e=>e[b],n="function"==typeof w?w:e=>e[w],i=new Map;for(const t of je){const o=t[k]||[];if(0===o.length)continue;const r="end"===Le?o[o.length-1]:o[0],s=null!==(e=n(r))&&void 0!==e?e:n(t);if(null==s)continue;const a=s+"";""===a||i.has(a)||i.set(a,r)}const r=Array.from(i.entries()).map(([e,n])=>({type:"text",label:e,["string"==typeof m?m:"x"]:t(n),["string"==typeof b?b:"y"]:o(n),dx:"end"===Le?6:-6,dy:0,color:De?De(e):xr,fontSize:Te}));r.sort((e,t)=>{const o="string"==typeof b?b:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",o=r[e-1],n=r[e];Te+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=Te+2)}return r},[N,w,De,je,k,m,b,Le,Te]),Xe=Ee.margin,Ve=x||w,Ue=r(()=>Hr([{label:ge||Nr(m),accessor:m,role:"x",format:p},{label:pe||Nr(b),accessor:b,role:"y",format:y},...Ve?[{label:Nr(Ve),accessor:Ve,role:"group"}]:[]]),[m,b,ge,pe,Ve,p,y]),Ke=es({componentName:"LineChart",data:_e?(null===(a=ve[0])||void 0===a?void 0:a[k])||[]:h,accessors:{xAccessor:m,yAccessor:b}}),Qe=r(()=>_e||ke||Me?je.flatMap(e=>{const t=e[k]||[];return ke&&"string"==typeof ke?t.map(t=>Object.assign(Object.assign({},t),{[ke]:e[ke]})):t}):Ae,[je,k,_e,ke,Ae,Me]),Ze=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Ge},Array.isArray(C)&&{areaGroups:C}),P&&{lineGradient:P}),null!=q&&{hoverRadius:q}),null!=h&&{data:Qe}),{xAccessor:m,yAccessor:b,xScaleType:Z,yScaleType:J}),H&&{xExtent:H}),!R||null==R[0]&&null==R[1]?Se?{yExtent:Se}:{}:{yExtent:R}),{groupAccessor:"break"===E&&Me?"_gapSegment":ke||void 0,curve:S,lineStyle:$e}),O&&{pointStyle:Ye}),{size:[ie,re],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Xe,showAxes:d.showAxes,xLabel:ge,yLabel:pe,xFormat:p,yFormat:y}),void 0!==v&&{axisExtent:v}),{enableHover:se,showGrid:ae}),Ee.legendBehaviorProps),ce&&{title:ce}),de&&{description:de}),ue&&{summary:ue}),void 0!==he&&{accessibleTable:he}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?Un():Kn(L)||Ue}),"multi"===L&&{tooltipMode:"multi"}),(z||$||Y||G)&&{customHoverBehavior:Ie}),($||Y||z)&&{customClickBehavior:He}),T&&{pointIdAccessor:T}),((null==B?void 0:B.length)||me.length||qe.length)&&{annotations:[...B||[],...me,...qe]}),Re),W);return Ee.earlyReturn?Ee.earlyReturn:Ke?e(Wr,{componentName:"LineChart",message:Ke,width:ie,height:re}):e(Yr,{componentName:"LineChart",width:ie,height:re,children:e(Di,Object.assign({ref:c},Ze))})});function ys(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s,axisExtent:a}=e,l={};return t&&(l.title=t),o&&(l.description=o),n&&(l.summary=n),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),void 0!==a&&(l.axisExtent=a),l}function vs(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 ms(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Kn(t)||o}}function bs(e){var t;const{safeData:o,data:n,areaBy:i,lineDataAccessor:s,colorBy:a,colorScale:l,color:c,stroke:d,strokeWidth:u,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:v,showPoints:m,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:S,yFormat:O,groupField:_}=e,C=void 0!==(null===(t=o[0])||void 0===t?void 0:t[s]),j=r(()=>{if(null==n)return[];if(!C&&!i)return o;let e;if(C)e=o;else{const t=o.reduce((e,t)=>{const o="function"==typeof i?i(t):t[i];if(!e[o]){const t={[s]:[]};"string"==typeof i&&(t[i]=o),e[o]=t}return e[o][s].push(t),e},{});e=Object.values(t)}return e.flatMap(e=>{const t=e[s]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[n,o,i,s,C]),M=r(()=>e=>{const t={};if(a){if(l){const o=vt(e,a,l);t.fill=o,y?(t.stroke=o,t.strokeWidth=v):t.stroke="none"}}else{const e=c||xr;t.fill=e,y?(t.stroke=e,t.strokeWidth=v):t.stroke="none"}return t.fillOpacity=p,t},[a,l,c,p,y,v]),P=r(()=>rs(M,{stroke:d,strokeWidth:u,opacity:h}),[M,d,u,h]);return{flattenedData:j,lineStyle:r(()=>dr(P,null!=g?g:null,f),[P,g,f]),pointStyle:r(()=>{if(m)return e=>{const t={r:b,fillOpacity:1};return a?l&&(t.fill=vt(e.parentLine||e,a,l)):t.fill=c||xr,t}},[m,b,a,l,c]),defaultTooltipContent:r(()=>Hr([{label:w||Nr(x),accessor:x,role:"x",format:S},{label:A||Nr(k),accessor:k,role:"y",format:O},..._?[{label:Nr(_),accessor:_,role:"group"}]:[]]),[x,k,w,A,_,S,O])}}ps.displayName="LineChart";const xs=g(function(t,o){const n=i(null);as(o,{variant:"xy",frameRef:n});const s=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",yAccessor:g="y",areaBy:f,y0Accessor:p,gradientFill:y=!1,lineDataAccessor:v="coordinates",colorBy:m,colorScheme:b,curve:x="monotoneX",areaOpacity:k=.7,lineGradient:w,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:_=3,tooltip:C,annotations:j,forecast:M,anomaly:P,xExtent:L,yExtent:T,frameProps:B={},selection:N,linkedHover:E,onObservation:D,onClick:I,hoverHighlight:H,chartId:R,loading:W,emptyContent:F,legendInteraction:z,legendPosition:$,color:Y,stroke:G,strokeWidth:q,opacity:X}=t,{width:V,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:oe,xLabel:ne,yLabel:ie}=s,re=r(()=>fe(a),[a]);Ur("AreaChart",re,"xAccessor",h),Ur("AreaChart",re,"yAccessor",g);const se=is({data:re,rawData:a,colorBy:m,colorScheme:b,legendInteraction:z,legendPosition:$,selection:N,linkedHover:E,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:D,onClick:I,hoverHighlight:H,chartType:"AreaChart",chartId:R,showLegend:Z,userMargin:l,marginDefaults:s.marginDefaults,loading:W,emptyContent:F,width:V,height:U}),{effectiveData:ae,statisticalAnnotations:le}=fs({data:re,xAccessor:h,yAccessor:g,forecast:M,anomaly:P,groupBy:f}),{flattenedData:ce,lineStyle:de,pointStyle:ue,defaultTooltipContent:he}=bs({safeData:ae,data:a,areaBy:f,lineDataAccessor:v,colorBy:m,colorScale:se.colorScale,color:Y,stroke:G,strokeWidth:q,opacity:X,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,areaOpacity:k,showLine:A,lineWidth:S,showPoints:O,pointRadius:_,xAccessor:h,yAccessor:g,xLabel:ne,yLabel:ie,xFormat:d,yFormat:u,groupField:f||m}),ge=es({componentName:"AreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=a&&{data:ce}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0}),p&&{y0Accessor:p}),y&&{gradientFill:y}),w&&{lineGradient:w}),{curve:x,lineStyle:de}),O&&ue&&{pointStyle:ue}),{size:[V,U],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:ne,yLabel:ie,xFormat:d,yFormat:u,enableHover:K}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:Q}),se.legendBehaviorProps),ys({title:J,description:ee,summary:te,accessibleTable:oe,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===C?{tooltipContent:Un(),tooltipMode:"multi"}:ms({tooltip:C,defaultTooltipContent:he})),vs({linkedHover:E,onObservation:D,onClick:I,hoverHighlight:H,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),(j&&j.length>0||le.length>0)&&{annotations:[...j||[],...le]}),L&&{xExtent:L}),T&&{yExtent:T}),se.crosshairProps),B);return se.earlyReturn?se.earlyReturn:ge?e(Wr,{componentName:"AreaChart",message:ge,width:V,height:U}):e(Yr,{componentName:"AreaChart",width:V,height:U,children:e(Di,Object.assign({ref:n},pe))})});function ks(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}xs.displayName="AreaChart";const ws=g(function(o,n){const s=i(null),a=Tr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:y="x",seriesAAccessor:v="a",seriesBAccessor:m="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:k="var(--semiotic-danger, #dc2626)",seriesBColor:w="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:S=1.5,showPoints:O=!1,pointRadius:_=3,curve:C="linear",areaOpacity:j=.6,gradientFill:M,tooltip:P,annotations:L,xExtent:T,yExtent:B,frameProps:N={},selection:E,linkedHover:D,onObservation:I,onClick:H,hoverHighlight:R,chartId:W,loading:F,emptyContent:z,legendInteraction:$,legendPosition:Y,pointIdAccessor:G,windowSize:q}=o,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=a,ie=r(()=>"function"==typeof y?e=>ks(y(e)):e=>ks(e[y]),[y]),re=r(()=>"function"==typeof v?e=>ks(v(e)):e=>ks(e[v]),[v]),se=r(()=>"function"==typeof m?e=>ks(m(e)):e=>ks(e[m]),[m]),[ae,le]=u([]),ce=i([]),de=null==c,ue=r(()=>fe(de?ae:c),[de,ae,c]),he=r(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let s=0,a=null,l=null,c=[];const d=(e,t)=>e>t?"A":t>e?"B":null,u=e=>`seg-${s}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:u(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],f=t(r),p=o(r),y=n(r);if(!Number.isFinite(f)||!Number.isFinite(p)||!Number.isFinite(y))continue;const v=d(p,y);if(null!==v)if(null!=a){if(l&&l.w!==v){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=p-l.a-(y-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(f-l.x),t=l.a+n*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:u(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=v,h({__x:e,__y:t,__y0:t,__diffSegment:u(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],a)}else for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:u(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:v}}else{a=v;for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:u(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:v}}else c.push({x:f,y:p,datum:r})}for(const e of c)g(e,null!=a?a:"A");return r}(ue,ie,re,se),[ue,ie,re,se]),ge=r(()=>A?function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of i){const i=t(e),s=o(e),a=n(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-B"})}return r}(ue,ie,re,se):[],[A,ue,ie,re,se]),pe=r(()=>[...he,...ge],[he,ge]),ye=r(()=>{const e=new Set;for(const t of he)e.add(t.__diffSegment);return Array.from(e)},[he]);p(n,()=>{const e=e=>{const t=q&&e.length>q?e.slice(e.length-q):e;ce.current=t,le(t)},t=G?"function"==typeof G?G:e=>e[G]:null;return{push:t=>e([...ce.current,t]),pushMany:t=>e([...ce.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of ce.current)n.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(o,n)=>{if(!t)return[];const i=Array.isArray(o)?o:[o],r=[],s=ce.current.map(e=>{if(i.includes(t(e))){const t=n(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>de?ce.current:ue,getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[de,ue,G,q]);const ve=is({data:ue,rawData:c,colorBy:"__diffWinner",colorScheme:[k,w],legendInteraction:$,legendPosition:Y,selection:E,linkedHover:D,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:I,onClick:H,hoverHighlight:R,chartType:"DifferenceChart",chartId:W,showLegend:Q,userMargin:d,marginDefaults:a.marginDefaults,loading:F,emptyContent:z,width:X,height:V}),me=r(()=>{if(!1!==Q)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:k},{label:x,color:w}]}]}},[Q,b,x,k,w]),be=l(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?k:w,stroke:"none",fillOpacity:j}},[k,w,j]),xe=l(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,strokeWidth:S,fill:"none"}),[k,w,S]),ke=l(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,r:_}),[k,w,_]),we=l(o=>{const n=o.data,i=null==n?void 0:n.__x;let r=null==n?void 0:n.__valA,s=null==n?void 0:n.__valB;if(null!=i&&(null==r||null==s)){const e=ue.find(e=>ie(e)===i);e&&(r=re(e),s=se(e))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=g&&null!=i?g(i):null!=i?i+"":"";return t("div",{className:"semiotic-tooltip",style:Yn,children:[l&&e("div",{style:{fontWeight:600,marginBottom:4},children:l}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",a(r)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",a(s)]})]}),null!=r&&null!=s&&Number.isFinite(r)&&Number.isFinite(s)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(r-s)]})]})},[ue,ie,re,se,g,k,w,b,x]),Ae=r(()=>!1===P?()=>null:Kn(P)||we,[P,we]),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({chartType:"mixed",data:pe,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ye,curve:C,areaStyle:be,lineStyle:xe},O&&{pointStyle:ke}),{size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ve.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ne,xFormat:g,yFormat:f,enableHover:U,showGrid:K}),M&&{gradientFill:!0===M?{topOpacity:.85,bottomOpacity:.15}:M}),me&&{legend:me,legendPosition:ve.legendPosition}),ys({title:Z,description:J,summary:ee,accessibleTable:te,className:h,animate:o.animate,axisExtent:o.axisExtent})),{tooltipContent:Ae}),vs({linkedHover:D,onObservation:I,onClick:H,hoverHighlight:R,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),T&&{xExtent:T}),B&&{yExtent:B}),ve.crosshairProps),N);return ve.earlyReturn?ve.earlyReturn:e(Yr,{componentName:"DifferenceChart",width:X,height:V,children:e(Di,Object.assign({ref:s},Se))})});"function"==typeof ws&&(ws.displayName="DifferenceChart");const As=g(function(t,o){const n=i(null),s=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",yAccessor:g="y",areaBy:f,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:v,curve:m="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:A=3,normalize:S=!1,baseline:O="zero",stackOrder:_,tooltip:C,annotations:j,xExtent:M,yExtent:P,frameProps:L={},selection:T,linkedHover:B,onObservation:N,onClick:E,hoverHighlight:D,chartId:I,loading:H,emptyContent:R,legendInteraction:W,legendPosition:F,color:z,stroke:$,strokeWidth:Y,opacity:G}=t,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:oe}=s,ne=r(()=>fe(a),[a]),ie=y||f;as(o,{variant:"xy",frameRef:n});const re=is({data:ne,rawData:a,colorBy:ie,colorScheme:v,legendInteraction:W,legendPosition:F,selection:T,linkedHover:B,fallbackFields:ie?["string"==typeof ie?ie:""]:[],unwrapData:!1,onObservation:N,onClick:E,hoverHighlight:D,chartType:"StackedAreaChart",chartId:I,showLegend:K,userMargin:l,marginDefaults:s.marginDefaults,loading:H,emptyContent:R,width:q,height:X}),{flattenedData:se,lineStyle:ae,pointStyle:le,defaultTooltipContent:ce}=bs({safeData:ne,data:a,areaBy:f,lineDataAccessor:p,colorBy:ie,colorScale:re.colorScale,color:z,stroke:$,strokeWidth:Y,opacity:G,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:A,xAccessor:h,yAccessor:g,xLabel:te,yLabel:oe,xFormat:d,yFormat:u,groupField:f||y}),de=es({componentName:"StackedAreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),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:"stackedarea"},null!=a&&{data:se}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0,curve:m,normalize:S,baseline:S?"zero":O,stackOrder:_,lineStyle:ae}),w&&le&&{pointStyle:le}),{size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:s.showAxes,xLabel:te,yLabel:oe,xFormat:d,yFormat:u,enableHover:V}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:U}),re.legendBehaviorProps),ys({title:Q,description:Z,summary:J,accessibleTable:ee,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===C?{tooltipContent:Un(),tooltipMode:"multi"}:ms({tooltip:C,defaultTooltipContent:ce})),vs({linkedHover:B,onObservation:N,onClick:E,hoverHighlight:D,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),j&&j.length>0&&{annotations:j}),M&&{xExtent:M}),P&&{yExtent:P}),re.crosshairProps),L);return re.earlyReturn?re.earlyReturn:de?e(Wr,{componentName:"StackedAreaChart",message:de,width:q,height:X}):e(Yr,{componentName:"StackedAreaChart",width:q,height:X,children:e(Di,Object.assign({ref:n},ue))})});function Ss(e){const{colorBy:t,colorScale:o,color:n,pointRadius:i=5,radiusFn:s,fillOpacity:a=1,fallbackFill:l,baseStyleExtras:c,stroke:d,strokeWidth:u,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,d=r?Object.assign({},r):{};if(void 0===d.fillOpacity&&(d.fillOpacity=a),void 0===d.fill)if(t){if(o){const n=p?p(e):e;d.fill=vt(n,t,o)}}else d.fill=l?l(e):n||xr;return void 0===d.r&&(d.r=s?s(e):i),d},[t,o,n,i,s,a,l,c,p]),v=r(()=>rs(y,{stroke:d,strokeWidth:u,opacity:h}),[y,d,u,h]);return r(()=>dr(v,null!=g?g:null,f),[v,g,f])}function Os(e){const{accessor:t,data:o,isPushMode:n}=e,s=i(null),[a,c]=u(0),d=l(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(s.current?(s.current[0]>i&&(s.current[0]=i,o=!0),i>s.current[1]&&(s.current[1]=i,o=!0)):(s.current=[i,i],o=!0))}o&&c(e=>e+1)},[n,t]),h=l(()=>{n&&(s.current=null,c(e=>e+1))},[n]),g=r(()=>{var e;if(n)return null!==(e=s.current)&&void 0!==e?e:void 0;if(!t||0===o.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const e of o){const t=i(e);if(null==t)continue;const o="number"==typeof t?t:Number(t);Number.isFinite(o)&&(r>o&&(r=o),o>a&&(a=o))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[o,t,n,a]);return{domain:g,trackPushed:d,reset:h}}function _s(e){var t;if(!e)return;const o="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=o.method)&&void 0!==t?t:"linear"},null!=o.bandwidth&&{bandwidth:o.bandwidth}),null!=o.order&&{order:o.order}),null!=o.color&&{color:o.color}),null!=o.strokeWidth&&{strokeWidth:o.strokeWidth}),null!=o.strokeDasharray&&{strokeDasharray:o.strokeDasharray}),null!=o.label&&{label:o.label})}As.displayName="StackedAreaChart";const Cs=g(function(t,o){const s=i(null),a=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:d,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:v,sizeBy:m,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:_,forecast:C,anomaly:j,xExtent:M,yExtent:P,frameProps:L={},selection:T,linkedHover:B,linkedBrush:N,onObservation:E,onClick:D,hoverHighlight:I,chartId:H,loading:R,emptyContent:W,legendInteraction:F,legendPosition:z,color:$,stroke:Y,strokeWidth:G,opacity:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=a,ie=r(()=>fe(c),[c]),re=void 0===c,{domain:se,trackPushed:ae,reset:le}=Os({accessor:m,data:ie,isPushMode:re}),ce=l(e=>{var t;ae([e]),null===(t=s.current)||void 0===t||t.push(e)},[ae]),de=l(e=>{var t;ae(e),null===(t=s.current)||void 0===t||t.pushMany(e)},[ae]);as(o,{variant:"xy",frameRef:s,overrides:{push:ce,pushMany:de,clear:()=>{var e;le(),null===(e=s.current)||void 0===e||e.clear()}},deps:[ce,de,le]});const ue=is({data:ie,rawData:c,colorBy:y,colorScheme:v,legendInteraction:F,legendPosition:z,selection:T,linkedHover:B,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:E,onClick:D,hoverHighlight:I,chartType:"Scatterplot",chartId:H,showLegend:Q,userMargin:d,marginDefaults:a.marginDefaults,loading:R,emptyContent:W,width:X,height:V}),he=cr(N),ge=Ki({name:(null==he?void 0:he.name)||"__unused_brush__",xField:(null==he?void 0:he.xField)||("string"==typeof f?f:void 0),yField:(null==he?void 0:he.yField)||("string"==typeof p?p:void 0)}),pe=he?"xyBrush"===ge.brushInteraction.brush?"xy":"xBrush"===ge.brushInteraction.brush?"x":"y":void 0,ye=n.useRef(ge.brushInteraction);ye.current=ge.brushInteraction;const ve=l(e=>{const t=ye.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(ue.earlyReturn)return ue.earlyReturn;Ur("Scatterplot",ie,"xAccessor",f),Ur("Scatterplot",ie,"yAccessor",p);const me=r(()=>m?null!=se?se:[0,1]:void 0,[m,se]),be=r(()=>m?e=>bt(e,m,b,me):void 0,[m,b,me]),xe=Ss({colorBy:y,colorScale:ue.colorScale,color:$,pointRadius:x,fillOpacity:k,radiusFn:be,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection}),ke=r(()=>Hr([{label:oe||Nr(f),accessor:f,role:"x",format:h},{label:ne||Nr(p),accessor:p,role:"y",format:g},...y?[{label:Nr(y),accessor:y,role:"color"}]:[],...m?[{label:Nr(m),accessor:m,role:"size"}]:[]]),[f,p,oe,ne,y,m,h,g]),{effectiveData:we,statisticalAnnotations:Ae}=fs({data:ie,xAccessor:f,yAccessor:p,forecast:C,anomaly:j}),Se=r(()=>{const e=_s(_);return e||0!==Ae.length?[...e?[e]:[],...O||[],...Ae]:O},[_,O,Ae]),Oe=es({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(Oe)return e(Wr,{componentName:"Scatterplot",message:Oe,width:X,height:V});const _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({chartType:"scatter"},null!=c&&{data:we}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:m||void 0,sizeRange:b,pointStyle:xe,colorScheme:v,size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ne,xFormat:h,yFormat:g,enableHover:U,showGrid:K}),ue.legendBehaviorProps),ys({title:Z,description:J,summary:ee,accessibleTable:te,className:u,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:w,defaultTooltipContent:ke})),vs({linkedHover:B,onObservation:E,onClick:D,hoverHighlight:I,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),Se&&Se.length>0&&{annotations:Se}),M&&{xExtent:M}),P&&{yExtent:P}),he&&{brush:{dimension:pe},onBrush:ve}),ue.crosshairProps),L);return e(Yr,{componentName:"Scatterplot",width:X,height:V,children:e(Di,Object.assign({ref:s},_e))})});function js(e,t){return Je(1===t?.5:e/(t-1))}Cs.displayName="Scatterplot";const Ms=g(function(t,n){var s,a;const l=i(null);as(n,{variant:"xy",frameRef:l});const c=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:d,margin:u,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:v,orderLabel:m,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,regression:A,forecast:S,anomaly:O,xExtent:_,yExtent:C,frameProps:j={},selection:M,linkedHover:P,onObservation:L,onClick:T,hoverHighlight:B,chartId:N,loading:E,emptyContent:D,legendInteraction:I,stroke:H,strokeWidth:R,opacity:W}=t,{width:F,height:z,enableHover:$,showGrid:Y,title:G,description:q,summary:X,accessibleTable:V,xLabel:U,yLabel:K}=c,Q=d||[],{safeData:Z,orderMap:J}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let o=Q;if(v&&Q.length>0){const e="function"==typeof v?v:e=>e[v];o=[...Q].sort((t,o)=>{const n=e(t),i=e(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const n=new WeakMap;let i=0;for(const n of o){const o=e(n),r=t(n);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i++}let r=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&n.set(s,{idx:r++,total:i})}return{safeData:o,orderMap:n}},[Q,v,p,y]);Ur("ConnectedScatterplot",Z,"xAccessor",p),Ur("ConnectedScatterplot",Z,"yAccessor",y);const ee=is({data:Z,rawData:d,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:M,linkedHover:P,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:B,chartType:"ConnectedScatterplot",chartId:N,showLegend:void 0,userMargin:u,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:E,emptyContent:D,width:F,height:z}),te=null!==(a=null===(s=ee.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==a?a:.5,oe=r(()=>(e,t)=>{var o,n,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(o=ee.effectiveSelectionHook)||void 0===o?void 0:o.isActive,l=null===(n=ee.effectiveSelectionHook)||void 0===n?void 0:n.predicate,c=100>s.length,d=s.length;e.lineCap="round";for(let t=0;d-1>t;t++){const o=s[t],n=s[t+1],u=js(t,d),h=!a||!l||l(null!==(i=o.datum)&&void 0!==i?i:o)||l(null!==(r=n.datum)&&void 0!==r?r:n),g=a?h?1:te:1;c&&(e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle=u,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,ee.effectiveSelectionHook,te]),ne=r(()=>[oe],[oe]),ie=r(()=>(t,n,i)=>{var r,s;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const l=a.length,c=100>l,d=[];for(let t=0;l-1>t;t++){const o=a[t],n=a[t+1],i=js(t,l),u="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,h="number"==typeof(null===(s=n.style)||void 0===s?void 0:s.opacity)?n.style.opacity:1,g=Math.min(u,h);c&&d.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),d.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(o,{children:d})},[b]),re=r(()=>[ie],[ie]),se=r(()=>e=>{var t,o;const n=J.get(e),i=null!==(t=null==n?void 0:n.idx)&&void 0!==t?t:0,r=null!==(o=null==n?void 0:n.total)&&void 0!==o?o:1;return{fill:r>0?js(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,J]),ae=Ss({colorScale:void 0,baseStyleExtras:se,stroke:H,strokeWidth:R,opacity:W,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),le=m||("string"==typeof v?v:"Order"),ce=r(()=>Hr([{label:U||Nr(p),accessor:p,role:"x",format:g},{label:K||Nr(y),accessor:y,role:"y",format:f},...v?[{label:le,accessor:v,role:"group"}]:[]]),[p,y,U,K,v,le,g,f]),de=es({componentName:"ConnectedScatterplot",data:d,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:ue,statisticalAnnotations:he}=fs({data:Z,xAccessor:p,yAccessor:y,forecast:S,anomaly:O}),ge=_s(A),fe=ge||he.length>0?[...ge?[ge]:[],...w||[],...he]:w,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({chartType:"scatter"},null!=d&&{data:ue}),{xAccessor:p,yAccessor:y,pointStyle:ae,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,showAxes:c.showAxes,xLabel:U,yLabel:K,xFormat:g,yFormat:f,enableHover:$,showGrid:Y}),ys({title:G,description:q,summary:X,accessibleTable:V,className:h,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:x,defaultTooltipContent:ce})),vs({linkedHover:P,onObservation:L,onClick:T,hoverHighlight:B,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ne,svgPreRenderers:re}),fe&&fe.length>0&&{annotations:fe}),_&&{xExtent:_}),C&&{yExtent:C}),ee.crosshairProps),j);return ee.earlyReturn?ee.earlyReturn:de?e(Wr,{componentName:"ConnectedScatterplot",message:de,width:F,height:z}):e(Yr,{componentName:"ConnectedScatterplot",width:F,height:z,children:e(Di,Object.assign({ref:l},pe))})});Ms.displayName="ConnectedScatterplot";const Ps=g(function(t,o){const n=i(null),s=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:c,className:d,xFormat:u,yFormat:h,xAccessor:g="x",yAccessor:f="y",sizeBy:p,sizeRange:y=[5,40],colorBy:v,colorScheme:m,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:_,xExtent:C,yExtent:j,frameProps:M={},selection:P,linkedHover:L,linkedBrush:T,onObservation:B,onClick:N,hoverHighlight:E,chartId:D,loading:I,emptyContent:H,legendInteraction:R,legendPosition:W,color:F,stroke:z,strokeWidth:$,opacity:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,oe=r(()=>fe(a),[a]),ne=void 0===a,ie=is({data:oe,rawData:a,colorBy:v,colorScheme:m,legendInteraction:R,legendPosition:W,selection:P,linkedHover:L,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:B,onClick:N,hoverHighlight:E,chartType:"BubbleChart",chartId:D,showLegend:U,userMargin:c,marginDefaults:s.marginDefaults,loading:I,emptyContent:H,width:G,height:q}),{domain:re,trackPushed:se,reset:ae}=Os({accessor:p,data:oe,isPushMode:ne}),le=l(e=>{var t;se([e]),null===(t=n.current)||void 0===t||t.push(e)},[se]),ce=l(e=>{var t;se(e),null===(t=n.current)||void 0===t||t.pushMany(e)},[se]);as(o,{variant:"xy",frameRef:n,overrides:{push:le,pushMany:ce,clear:()=>{var e;ae(),null===(e=n.current)||void 0===e||e.clear()}},deps:[le,ce,ae]});const de=cr(T);Ki({name:(null==de?void 0:de.name)||"__unused_brush__",xField:(null==de?void 0:de.xField)||("string"==typeof g?g:void 0),yField:(null==de?void 0:de.yField)||("string"==typeof f?f:void 0)});const ue=r(()=>({stroke:k,strokeWidth:x}),[k,x]),he=r(()=>null!=re?re:[0,1],[re]),ge=l(e=>bt(e,p,y,he),[p,y,he]),pe=Ss({colorBy:v,colorScale:ie.colorScale,color:F,fillOpacity:b,radiusFn:ge,baseStyleExtras:ue,stroke:z,strokeWidth:$,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),ye=r(()=>Hr([{label:ee||Nr(g),accessor:g,role:"x",format:u},{label:te||Nr(f),accessor:f,role:"y",format:h},{label:Nr(p),accessor:p,role:"size"},...v?[{label:Nr(v),accessor:v,role:"color"}]:[]]),[g,f,ee,te,p,v,u,h]),ve=es({componentName:"BubbleChart",data:a,accessors:{xAccessor:g,yAccessor:f},requiredProps:{sizeBy:p}});if(ve)return e(Wr,{componentName:"BubbleChart",message:ve,width:G,height:q});const me=_s(_),be=me?[me,...O||[]]:O,xe=Object.assign(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:"bubble"},null!=a&&{data:oe}),{xAccessor:g,yAccessor:f,colorAccessor:v||void 0,sizeAccessor:p,sizeRange:y,pointStyle:pe,colorScheme:m,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:u,yFormat:h,enableHover:X,showGrid:V}),ie.legendBehaviorProps),ys({title:K,description:Q,summary:Z,accessibleTable:J,className:d,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:w,defaultTooltipContent:ye})),vs({linkedHover:L,onObservation:B,onClick:N,hoverHighlight:E,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),be&&be.length>0&&{annotations:be}),C&&{xExtent:C}),j&&{yExtent:j}),ie.crosshairProps),M);return ie.earlyReturn?ie.earlyReturn:e(Yr,{componentName:"BubbleChart",width:G,height:q,children:e(Di,Object.assign({ref:n},xe))})});Ps.displayName="BubbleChart";const Ls=g(function(t,o){var n;const s=i(null);as(o,{variant:"xy",frameRef:s});const a=Tr(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:d,xAccessor:u="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:v,showValues:m=!1,valueFormat:b,tooltip:x,annotations:k,xExtent:w,yExtent:A,frameProps:O={},selection:_,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,showLegend:N,legendPosition:E,legendInteraction:D}=t,{width:I,height:H,enableHover:R,title:W,description:F,summary:z,accessibleTable:$,xLabel:Y,yLabel:G}=a,q=Vr(T,I,H),X=q?null:Xr(l,I,H,B),V=r(()=>fe(l),[l]),U=function(){var e;const t=br();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),K=null!==(n=null!=y?y:U)&&void 0!==n?n:"blues",Q=null!=N&&N,Z=null!=E?E:"right",{margin:J}=Mr({data:V,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:oe}=Cr({selection:_,linkedHover:C,fallbackFields:[],onObservation:j,onClick:M,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});ns(_);const ne=jr(C,oe);Pr(D,void 0,[]);const ie=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),re=r(()=>{const e=V.map(ie);return[Math.min(...e),Math.max(...e)]},[V,ie]),se=r(()=>"custom"===K&&v?v:S({blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it}[K]||Xe).domain(re),[K,v,re]),ae=r(()=>Hr([{label:Y||Nr(u),accessor:u,role:"x",format:f},{label:G||Nr(h),accessor:h,role:"y",format:p},{label:Nr(g),accessor:g,role:"value",format:b}]),[u,h,Y,G,g,f,p,b]),le=es({componentName:"Heatmap",data:l,accessors:{xAccessor:u,yAccessor:h,valueAccessor:g}}),ce=r(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:re,label:"string"==typeof g?g:"value",format:b}}},[Q,se,re,g,b]),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({chartType:"heatmap"},null!=l&&{data:V}),{xAccessor:u,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==K?K:void 0,showValues:m,heatmapValueFormat:b,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,showAxes:a.showAxes,xLabel:Y,yLabel:G,xFormat:f,yFormat:p,enableHover:R}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ce&&{legend:ce,legendPosition:Z}),ys({title:W,description:F,summary:z,accessibleTable:$,className:d,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:x,defaultTooltipContent:ae})),vs({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:ee,customClickBehavior:te})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),ne),O);return q||X||(le?e(Wr,{componentName:"Heatmap",message:le,width:I,height:H}):e(Yr,{componentName:"Heatmap",width:I,height:H,children:e(Di,Object.assign({ref:s},de))}))});Ls.displayName="Heatmap";const Ts="__splomIdx",Bs={top:4,bottom:4,left:4,right:4};function Ns({frameRef:t,cellSize:o,onBrush:n}){const r=i(null),a=o-Bs.left-Bs.right,l=o-Bs.top-Bs.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),o=b().extent([[0,0],[a,l]]).on("brush end",e=>{var o;const i=null===(o=t.current)||void 0===o?void 0:o.getScales();if(!i)return;if(!e.selection)return void n(null);const[[r,s],[a,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(a),i.y.invert(l)]];n(c)});return e.call(o),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[a,l,t,n]),e("svg",{ref:r,width:o,height:o,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${Bs.left},${Bs.top})`})})}function Es({data:o,xField:n,yField:r,cellSize:s,pointRadius:a,pointOpacity:c,colorBy:d,colorScale:u,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const v=i(null),m=Xi({name:h,clientId:`splom-${n}-${r}`}),b=Ki({name:h,xField:n,yField:r}),x=Xi({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,o=null==t?void 0:t[Ts];void 0!==o&&(k({[Ts]:[o]}),null==y||y(t,e.x+Bs.left,e.y+Bs.top))},[k,y]),S=l(e=>{const t={opacity:c,r:a};return t.fill=d?vt(e,d,u):xr,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):m.isActive&&!m.predicate(e)&&(t.opacity=f),t},[d,u,c,a,p,m.isActive,m.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(Di,{ref:v,chartType:"scatter",data:o,size:[s,s],xAccessor:n,yAccessor:r,pointStyle:S,margin:Bs,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(Ns,{frameRef:v,cellSize:s,xField:n,yField:r,onBrush:w})]})}function Ds({data:o,field:n,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:d,hoverSelectionName:u,mode:h}){const g=Xi({name:d,clientId:"splom-diag-"+n}),f=Xi({name:u,clientId:`splom-diag-${n}-hover`}),p="hover"===h?f:g,y=p.isActive,v=p.predicate,m=r(()=>{const e=o.map(e=>e[n]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/a||1,r="string"==typeof l?l:null,c=r?[...new Set(o.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],d=new Map(c.map((e,t)=>[e,t])),u=Array(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),f=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const s=Math.min(Math.floor((o-t)/i),a-1);if(u[s]++,y&&!v(e)||h[s]++,r){const t=d.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!v(e)||f[s][t]++)}}const p=Math.max(...u,1),m=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})});return{bars:u.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),categoryBars:m,selectedCategoryBars:b,max:p,categories:c}},[o,n,a,s,y,v,l]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,o)=>t.map((t,n)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):xr,opacity:y?.3:.6},`bg-${o}-${n}`))):m.bars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:xr,opacity:y?.3:.6},"bg-"+o)),y&&(m.categories.length>0?m.selectedCategoryBars.map((t,o)=>t.map((t,n)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):xr,opacity:.7},`sel-${o}-${n}`))):m.selectedBars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:xr,opacity:.7},"sel-"+o)))]})}function Is({label:t,cellSize:o}){return e("svg",{width:o,height:o,children:e("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Hs(o){const{data:i,fields:s,fieldLabels:a={},colorBy:c,colorScheme:d,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:v=20,brushMode:m="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:_,chartId:C}=o,j="splom",M="splom-hover",P=b?"hover":m?"brush":"hover",L=Yi(e=>e.clearSelection),[T,B]=u(null),N=l(()=>{L(M),B(null)},[L,M]),E=r(()=>(i||[]).map((e,t)=>void 0!==e[Ts]?e:Object.assign(Object.assign({},e),{[Ts]:t})),[i]),D=Or(E,c,d),I=void 0!==A?A:!!c,H=r(()=>{if(!I||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(E.map(t=>t[e]))].map(e=>({label:e+"",color:D?D(e+""):xr})):null},[I,c,E,D]),R=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[s,h,g,40]);return t("div",{className:O,style:{position:"relative"},children:[H&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:H.map(o=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:o.color}}),e("span",{style:{fontSize:11},children:o.label})]},o.label))}),t("div",{style:R,onMouseLeave:"hover"===P?N:void 0,children:[s.map((o,i)=>t(n.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:a[o]||o}),s.map((t,n)=>i===n?"label"===y?e(Is,{label:a[o]||o,cellSize:h},"diag-"+o):e(Ds,{data:E,field:o,label:a[o]||o,cellSize:h,bins:v,colorBy:c,colorScale:D,brushSelectionName:j,hoverSelectionName:M,unselectedOpacity:x,mode:P},"diag-"+o):e(Es,{data:E,xField:t,yField:o,fieldLabels:a,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:D,brushSelectionName:j,hoverSelectionName:M,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(B({datum:e,xField:t,yField:o,colIndex:n,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),_&&_({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:C})):(B(null),_&&_({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:C}))}:void 0},`cell-${o}-${t}`))]},"row-"+o)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:a[t]||t},"col-label-"+t))]}),T&&"hover"===P&&(()=>{const o=T.datum,n=a[T.xField]||T.xField,i=a[T.yField]||T.yField,r=c?"function"==typeof c?c(o):o[c]:null,s=S?"function"==typeof S?S(o):o[S]:"Row "+o[Ts];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[n,": ",null!=o[T.xField]?Number(o[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=o[T.yField]?Number(o[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function Rs(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e(ar,{selections:i,children:e(Hs,Object.assign({},t))})}function Ws({width:t,height:o,margin:n,scales:r,brushDirection:a,extent:l,onBrush:c}){const d=i(null),u=i(null),h=i(!1),g=t+n.left+n.right,f=o+n.top+n.bottom;return s(()=>{if(!d.current||!r)return;const e=y(d.current).select(".brush-group"),n="x"===a?v().extent([[0,0],[t,o]]):m().extent([[0,0],[t,o]]);return n.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const o=("x"===a?r.x:r.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];c(n)}),e.call(n),u.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[r,t,o,a,c]),s(()=>{if(!u.current||!r||!d.current)return;const e=y(d.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const o=[t(l[0]),t(l[1])];e.call(u.current.move,o)}else e.call(u.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:d,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function Fs(o){var n,a;const{data:c,width:d=600,height:h=400,margin:g,className:f,title:p,description:y,summary:v,xLabel:m,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:_,colorScheme:C,curve:j="linear",lineWidth:M=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:B=3,enableHover:N=!0,showGrid:E=!1,showLegend:D,legendPosition:I,tooltip:H,minimap:R={},renderBefore:W=!1,onBrush:F,brushExtent:z,yExtent:$,frameProps:Y={},loading:G,emptyContent:q}=o,X=Vr(G,d,h),V=X?null:Xr(c,d,h,q),U=r(()=>fe(c),[c]),[K,Q]=u(null),Z=null!=z?z:K,J=l(e=>{z||Q(e),null==F||F(e)},[z,F]),ee=i(null),[te,oe]=u(null);s(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=ee.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?oe(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const ne=void 0!==(null===(n=U[0])||void 0===n?void 0:n[O]),ie=r(()=>{if(ne)return U;if(S){const e=U.reduce((e,t)=>{const o="function"==typeof S?S(t):t[S];if(!e[o]){const t={[O]:[]};"string"==typeof S&&(t[S]=o),e[o]=t}return e[o][O].push(t),e},{});return Object.values(e)}return[{[O]:U}]},[U,S,O,ne]),re=r(()=>ne||S?ie.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):U,[ie,O,ne,S,U]),se=Or(U,_,C),ae=ss({lineWidth:M,colorBy:_,colorScale:se,fillArea:P,areaOpacity:L}),le=r(()=>{if(R.lineStyle)return R.lineStyle},[R.lineStyle]),ce=ss({lineWidth:1,colorBy:_,colorScale:se}),de=null!=le?le:ce,ue=r(()=>{if(T)return e=>{const t={r:B,fillOpacity:1};return t.fill=_?vt(e.parentLine||e,_,se):xr,t}},[T,B,_,se]),{legend:he,margin:ge,legendPosition:pe}=Mr({data:ie,colorBy:_,colorScale:se,showLegend:D,legendPosition:I,userMargin:g}),ye=R.height||60,ve=r(()=>{var e,t,o,n,i,r,s,a;return{top:null!==(t=null===(e=R.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(n=null===(o=R.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(r=null===(i=R.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ge.left,right:null!==(a=null===(s=R.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ge.right}},[R.margin,ge]),me=R.brushDirection||"x",be=es({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(be)return e(Wr,{componentName:"MinimapChart",message:be,width:d,height:h});const xe=P?"area":"line",ke=r(()=>Hr([{label:m||Nr(w),accessor:w,role:"x",format:x},{label:b||Nr(A),accessor:A,role:"y",format:k}]),[w,A,m,b,x,k]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:xe,data:re,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:j,lineStyle:ae},T&&{pointStyle:ue}),{size:[d,h],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge,showAxes:!0,xLabel:m,yLabel:b,xFormat:x,yFormat:k,enableHover:N,showGrid:E}),he&&{legend:he,legendPosition:pe}),p&&{title:p}),y&&{description:y}),v&&{summary:v}),{tooltipContent:!1===H?()=>null:Kn(H)||ke}),Z&&{xExtent:Z}),$&&{yExtent:$}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),Y),Ae=Object.assign({chartType:xe,data:re,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:j,lineStyle:de,size:[d,ye+ve.top+ve.bottom],margin:ve,showAxes:null!==(a=R.showAxes)&&void 0!==a&&a,background:R.background,enableHover:!1},$&&{yExtent:$}),Se=t("div",{style:{position:"relative",width:d,overflow:"hidden"},children:[e(Di,Object.assign({ref:ee},Ae)),e(Ws,{width:d-ve.left-ve.right,height:ye,margin:ve,scales:te,brushDirection:me,extent:Z,onBrush:J})]},"minimap"),Oe=e("div",{style:{overflow:"hidden"},children:e(Di,Object.assign({},we))},"main");return X||V||e(Yr,{componentName:"MinimapChart",width:d,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[W?Se:Oe,W?Oe:Se]})})}Rs.displayName="ScatterplotMatrix",Fs.displayName="MinimapChart";const zs=g(function(n,s){const a=i(null);as(s,{variant:"xy",frameRef:a});const l=Tr(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:d,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:v,quadrants:m,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:S,sizeRange:O=[3,15],pointRadius:_=5,pointOpacity:C=.8,tooltip:j,pointIdAccessor:M,annotations:P,frameProps:L={},selection:T,linkedHover:B,onObservation:N,onClick:E,hoverHighlight:D,chartId:I,loading:H,emptyContent:R,legendInteraction:W,legendPosition:F,color:z,stroke:$,strokeWidth:Y,opacity:G}=n,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:oe}=l,ne=r(()=>fe(c),[c]),ie=is({data:ne,rawData:c,colorBy:w,colorScheme:A,legendInteraction:W,legendPosition:F,selection:T,linkedHover:B,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:N,onClick:E,hoverHighlight:D,chartType:"QuadrantChart",chartId:I,showLegend:K,userMargin:d,marginDefaults:l.marginDefaults,loading:H,emptyContent:R,width:q,height:X});Ur("QuadrantChart",ne,"xAccessor",f),Ur("QuadrantChart",ne,"yAccessor",p);const re=r(()=>{if(!ne.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(o>y&&(o=y),y>n&&(n=y)),null!=v&&isFinite(v)&&(i>v&&(i=v),v>r&&(r=v)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(r-i)||1;return{xExtent:[o-s,n+s],yExtent:[i-a,r+a]}},[ne,f,p,y,v]),se=r(()=>{if(!S||0===ne.length)return;const e=ne.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[ne,S]),ae=r(()=>"function"==typeof f?f:e=>+e[f],[f]),le=r(()=>"function"==typeof p?p:e=>+e[p],[p]),ce=r(()=>e=>{const t=ae(e),o=le(e),n=null!=y?t>=y:void 0,i=null!=v?o>=v:void 0;return void 0===i||void 0===n?z||xr:i&&n?m.topRight.color:i&&!n?m.topLeft.color:!i&&n?m.bottomRight.color:m.bottomLeft.color},[ae,le,y,v,m,z]),de=r(()=>S?e=>bt(e,S,O,se):void 0,[S,O,se]),ue=Ss({colorBy:w,colorScale:ie.colorScale,color:z,pointRadius:_,fillOpacity:C,radiusFn:de,fallbackFill:ce,stroke:$,strokeWidth:Y,opacity:G,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),he=r(()=>{if(!ne.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof S&&e.add(S);const t=ne[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ne,f,p,w,S]),ge=r(()=>Hr([...he?[{label:he,accessor:he,role:"title"}]:[],{label:te||Nr(f),accessor:f,role:"x",format:h},{label:oe||Nr(p),accessor:p,role:"y",format:g},...w?[{label:Nr(w),accessor:w,role:"color"}]:[],...S?[{label:Nr(S),accessor:S,role:"size"}]:[]]),[he,f,p,te,oe,w,S,h,g]),pe=es({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),ye=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,o,n,i)=>{var r;if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const s=i.width,a=i.height,l=null!=y?n.x(y):s/2,c=null!=v?n.y(v):a/2;if(null!=y&&!isFinite(l))return;if(null!=v&&!isFinite(c))return;const d=Math.max(0,Math.min(s,l)),u=Math.max(0,Math.min(a,c)),h=[{config:m.topLeft,x:0,y:0,w:d,h:u},{config:m.topRight,x:d,y:0,w:s-d,h:u},{config:m.bottomLeft,x:0,y:u,w:d,h:a-u},{config:m.bottomRight,x:d,y:u,w:s-d,h:a-u}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(d,0),e.lineTo(d,a),e.stroke(),e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke(),e.setLineDash([])}]},[y,v,m,b]),ve=r(()=>x?[...ye,(e,t,o,n)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const i=n.width,r=n.height,s=null!=y?o.x(y):i/2,a=null!=v?o.y(v):r/2;(null==y||isFinite(s))&&(null==v||isFinite(a))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,i-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,r-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ye,[ye,x,k,m,y,v]),me=r(()=>{const e=L.canvasPreRenderers||[];return[...ve,...e]},[ve,L.canvasPreRenderers]),be=r(()=>{var n;const i={stroke:b.stroke||"#999",strokeWidth:null!==(n=b.strokeWidth)&&void 0!==n?n:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(n,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const a=s.width,l=s.height,c=null!=y?r.x(y):a/2,d=null!=v?r.y(v):l/2;if(null!=y&&!isFinite(c))return null;if(null!=v&&!isFinite(d))return null;const u=Math.max(0,Math.min(a,c)),h=Math.max(0,Math.min(l,d));return t(o,{children:[[{config:m.topLeft,x:0,y:0,w:u,h:h},{config:m.topRight,x:u,y:0,w:a-u,h:h},{config:m.bottomLeft,x:0,y:h,w:u,h:l-h},{config:m.bottomRight,x:u,y:h,w:a-u,h:l-h}].map((t,o)=>{var n;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(n=t.config.opacity)&&void 0!==n?n:.08},"qf-"+o):null}),e("line",{x1:u,y1:0,x2:u,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:a,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(o,{children:[e("text",{x:8,y:8+k,fill:m.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:m.topLeft.label}),e("text",{x:a-8,y:8+k,fill:m.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:m.topRight.label}),e("text",{x:8,y:l-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:m.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:m.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:m.bottomRight.label})]})]})}]},[y,v,m,b,x,k]),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"scatter"},null!=c&&{data:ne}),{xAccessor:f,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:S||void 0,sizeRange:O,pointStyle:ue,colorScheme:A,size:[q,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:l.showAxes,xLabel:te,yLabel:oe,xFormat:h,yFormat:g,enableHover:V,showGrid:U}),re&&{xExtent:re.xExtent,yExtent:re.yExtent}),ie.legendBehaviorProps),Q&&{title:Q}),Z&&{description:Z}),J&&{summary:J}),void 0!==ee&&{accessibleTable:ee}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?ge:Kn(j)||ge}),(B||N||E||D)&&{customHoverBehavior:ie.customHoverBehavior}),(N||E||B)&&{customClickBehavior:ie.customClickBehavior}),M&&{pointIdAccessor:M}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:me}),ie.crosshairProps),L),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:be});return ie.earlyReturn?ie.earlyReturn:pe?e(Wr,{componentName:"QuadrantChart",message:pe,width:q,height:X}):e(Yr,{componentName:"QuadrantChart",width:q,height:X,children:e(Di,Object.assign({ref:a},xe))})});zs.displayName="QuadrantChart";const $s="__ma_unitized",Ys="__ma_series";function Gs(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function qs(e,t){return t[0]+e*(t[1]-t[0])}const Xs=g(function(t,o){var s;const a=i(null),c=i([]),d=i(t.series);d.current=t.series,p(o,()=>{const e=()=>{var e;return(null!==(e=d.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!a.current)return;const o=e(),n=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(n);null!=r&&isFinite(r)&&a.current.push(Object.assign(Object.assign({},n),{[$s]:Gs(r,i),[Ys]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!a.current)return;const o=e(),n=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const i=o[t],r=i.extent||c.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&n.push(Object.assign(Object.assign({},e),{[$s]:Gs(s,r),[Ys]:i.label||"Series "+(t+1)}))}a.current.pushMany(n)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},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 u=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:g,className:f,xFormat:y,xAccessor:v="x",series:m,colorScheme:b,curve:x="monotoneX",lineWidth:k=2,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:_,onObservation:C,onClick:j,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:N,stroke:E,strokeWidth:D,opacity:I}=t,{width:H,height:R,enableHover:W,showGrid:F,showLegend:z=!0,title:$,description:Y,summary:G,accessibleTable:q,xLabel:X}=u,V=r(()=>fe(h),[h]),U=r(()=>fe(m),[m]),K=U,Q=2===U.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||Q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${U.length}. Rendering as a standard multi-line chart.`);const Z=Vr(L,H,R),J=Z?null:Xr(h,H,R,T),ee=Ar(),te=r(()=>{let e;if(Array.isArray(b))e=b;else if(ee&&ee.length>0)e=ee;else{const t=ht[b];e=Array.isArray(t)?t:gt}return K.map((t,o)=>t.color||e[o%e.length])},[K,b,ee]),oe=r(()=>U.map((e,t)=>e.label||"Series "+(t+1)),[U]),{unitizedData:ne,extents:ie}=r(()=>{if(0===V.length){const e=U.map(e=>e.extent||null).filter(Boolean);return e.length===U.length&&(c.current=e),{unitizedData:[],extents:e.length===U.length?e:[]}}const e=U.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(V,e.yAccessor));if(c.current=e,!Q){const t=[];for(const e of V)for(let o=0;U.length>o;o++){const n=U[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[$s]:i,[Ys]:oe[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of V)for(let n=0;2>n;n++){const i=U[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[$s]:Gs(r,e[n]),[Ys]:oe[n]}))}return{unitizedData:t,extents:e}},[V,U,Q,oe]),re=r(()=>{if(Q&&ie.length>=2)return[{orient:"left",label:oe[0],tickFormat:U[0].format||(e=>{const t=qs(e,ie[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:oe[1],tickFormat:U[1].format||(e=>{const t=qs(e,ie[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Q,ie,U,oe]),se=is({data:r(()=>ne.length>0?ne:oe.map(e=>({[Ys]:e})),[ne,oe]),rawData:h,colorBy:Ys,colorScheme:te,legendInteraction:B,legendPosition:N,selection:O,linkedHover:_,fallbackFields:[Ys],unwrapData:!1,onObservation:C,onClick:j,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:P,showLegend:z,userMargin:g,marginDefaults:Q?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:L,emptyContent:T,width:H,height:R});if(se.earlyReturn)return se.earlyReturn;const ae=r(()=>{const e=new Map;return oe.forEach((t,o)=>e.set(t,te[o])),e},[oe,te]),le=ss({lineWidth:k,resolveStroke:l(e=>ae.get(e[Ys])||te[0],[ae,te]),stroke:E,strokeWidth:D,opacity:I,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ce=r(()=>{if(!1===w)return()=>null;return Kn(w)||(e=>{var t;const o=e.data||e,i=o[Ys],r=oe.indexOf(i),s=o[$s],a=Q&&r>=0&&ie[r]?qs(s,ie[r]):s,l=r>=0&&(null===(t=U[r])||void 0===t?void 0:t.format)?U[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof v?v(o):o[v];return n.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},n.createElement("div",{style:{fontWeight:600,marginBottom:4,color:te[r]||"inherit"}},i),n.createElement("div",null,`${"string"==typeof v?v:"x"}: ${c}`),n.createElement("div",null,`${i}: ${l(a)}`))})},[w,oe,te,ie,Q,U,v]),de=es({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:v}}),ue=Q?[0,1]:void 0,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:ne}),{xAccessor:v,yAccessor:$s,groupAccessor:Ys,lineStyle:le,colorScheme:te,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:u.showAxes}),re&&{axes:re}),{xLabel:X}),Q?{}:{yLabel:oe[0]}),{xFormat:y}),Q&&ue&&{yExtent:ue}),{enableHover:W}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:F,curve:x}),se.legendBehaviorProps),$&&{title:$}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:ce}),A&&{annotations:A}),(_||C||j||M)&&{customHoverBehavior:se.customHoverBehavior}),(C||j||_)&&{customClickBehavior:se.customClickBehavior}),se.crosshairProps),S);return Z||J||(de?e(Wr,{componentName:"MultiAxisLineChart",message:de,width:H,height:R}):e(Yr,{componentName:"MultiAxisLineChart",width:H,height:R,children:e(Di,Object.assign({ref:a},he))}))});Xs.displayName="MultiAxisLineChart";const Vs=g(function(t,o){const n=i(null);as(o,{variant:"xy",frameRef:n});const s=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",highAccessor:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:v,tooltip:m,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:_,chartId:C,loading:j,emptyContent:M}=t,{width:P,height:L,enableHover:T,showGrid:B,title:N,description:E,summary:D,accessibleTable:I,xLabel:H,yLabel:R}=s,W=Vr(j,P,L),F=W?null:Xr(a,P,L,M),z=r(()=>fe(a),[a]),$=null==p||null==y;Ur("CandlestickChart",z,"xAccessor",h),Ur("CandlestickChart",z,"highAccessor",g),Ur("CandlestickChart",z,"lowAccessor",f),$||(Ur("CandlestickChart",z,"openAccessor",p),Ur("CandlestickChart",z,"closeAccessor",y));const{customHoverBehavior:Y,customClickBehavior:G,crosshairSourceId:q}=Cr({selection:A,linkedHover:S,onObservation:O,onClick:_,chartType:"CandlestickChart",chartId:C}),X=jr(S,q),V=r(()=>{const e=s.marginDefaults,o="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?o:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},o),l)},[l,s.marginDefaults,t.mode]),U=r(()=>{const e=[{label:H||Nr(h),accessor:h,role:"x",format:d}];return $?(e.push({label:"High",accessor:g,role:"y",format:u}),e.push({label:"Low",accessor:f,format:u})):(e.push({label:"Open",accessor:p,format:u}),e.push({label:"High",accessor:g,format:u}),e.push({label:"Low",accessor:f,format:u}),e.push({label:"Close",accessor:y,format:u})),Hr(e)},[h,H,d,u,g,f,p,y,$]),K=es({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!$&&{openAccessor:p,closeAccessor:y})}),Q=Math.max(2,Math.min(12,Math.round(P/40))),Z=P>200?.1:.02,J=Object.assign(Object.assign(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:"candlestick"},null!=a&&{data:z}),{xAccessor:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!$&&{openAccessor:p,closeAccessor:y}),v&&{candlestickStyle:v}),{scalePadding:Q,extentPadding:Z,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,showAxes:s.showAxes,xLabel:H,yLabel:R,xFormat:d,yFormat:u,enableHover:T,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ys({title:N,description:E,summary:D,accessibleTable:I,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:m,defaultTooltipContent:U})),vs({linkedHover:S,onObservation:O,onClick:_,customHoverBehavior:Y,customClickBehavior:G})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),X),w);return W||F||(K?e(Wr,{componentName:"CandlestickChart",message:K,width:P,height:L}):e(Yr,{componentName:"CandlestickChart",width:P,height:L,children:e(Di,Object.assign({ref:n},J))}))});function Us(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 Ks(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=z(e,.25))&&void 0!==t?t:r,median:null!==(o=z(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=z(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function Qs(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function Zs(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"}}Vs.displayName="CandlestickChart";const Js={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(Ie(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(Ie(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(Ie(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(Ie(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:Us,donut:Us,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=z(l,.25))&&void 0!==o?o:c,m=null!==(n=z(l,.5))&&void 0!==n?n:(c+d)/2,b=null!==(i=z(l,.75))&&void 0!==i?i:d,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>w>=e))&&void 0!==s?s:d,O=h(t.pieceData[0],t.name),_=[];if(v)for(const e of t.pieceData){const o=u(e);if(k>o||o>w){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(A),q1Pos:g(f),medianPos:g(m),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:m,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,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:O.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 x;if(p&&t.length>=4){const a=null!==(o=z(t,.25))&&void 0!==o?o:r,l=null!==(n=z(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=z(t,.75))&&void 0!==i?i:s;x={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:x,stats:Ks(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(Ie(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:Ks(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(Ie(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(Ie(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,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return f;const m=[],b=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),m.push(e))}const x=m.length>1&&"_default"!==m[0],w=[];let A=0;for(const e of v){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}w.push({col:e,groups:t,stepTotal:o}),x||o>A&&(A=o)}if(x)for(const e of w){let t=0,o=0;for(let n=0;m.length>n;n++){const i=e.groups.get(m[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 S=new Map;for(const e of m){const t=w[0].groups.get(e);S.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,_=x?.95*p:.9*t.width,C=k().domain([0,A]).range([0,_]),j=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let M=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,d=0===t,u=n.width,h=.55*u,v=n.x+(u-h)/2,b=new Map;if(x){let e=0;for(const t of m){const n=o.groups.get(t);n&&(e+=C(n.total))}let t=p,i=p;for(let r=0;m.length>r;r++){const a=m[r],l=o.groups.get(a);if(!l)continue;const c=C(l.total),u=r%2==0,x=u?t:i-c;u?t+=c:i-=c;const k=g(l.pieces[0],a),w=null!==(s=S.get(a))&&void 0!==s?s:l.total,A=w>0?l.total/w*100:0,O=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&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=v,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=v,O.__funnelBarW=c),f.push(Ie(x,v,c,h,k,O,a)),b.set(a,{x:x,y:v,w:c,h:h})}}else{const e=o.stepTotal,t=C(e),s=p-t/2,a=m[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),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:d,category:l?a:n.name});y&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=v,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=v,w.__funnelBarW=t),f.push(Ie(s,v,t,h,x,w,u)),b.set(a,{x:s,y:v,w:t,h:h})}if(t>0&&M.size>0){const t=x?m:[m[0]];for(const i of t){const t=M.get(i),r=b.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:j},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)}}M=b}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,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=n?0:Math.max(0,w-y),S=o.x+e*a+l/2,O=m(y),_=m(0)-O,C=c(f.pieces[0],p?h:o.name),j=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:S+d/2,__barFunnelLabelY:m(y+A)});if(u.push(Ie(S,O,d,_,C,j,p?h:o.name)),A>0){const e=m(y+A),t=O-e,n=Object.assign({},C),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(Ie(S,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?Ie(s,o.x,a,o.width,n,null,"__track__"):Ie(o.x,s,o.width,a,n,null,"__track__");d.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const o=d.length;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=Ie(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=Ie(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=n}if(p>0&&d.length>o){const e=d.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},n.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},n.cornerRadii={tl:p,tr:p})}}return d}};class ea{constructor(e){this.rExtent=new Le,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 Pe(e.windowSize),this.getO=ze(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>We(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Le)):(this.getR=We(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=ze(e.stackBy),this.getGroup=ze(e.groupBy),this.getColor=ze(e.colorAccessor),this.getConnector=ze(e.connectorAccessor),this.getDataId=ze(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Pe(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=O().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;u=k().domain(s).range([n,o])}else a?(d=O().domain(r).range([0,e.height]).padding(c),u=k().domain(s).range([0,e.width])):(d=O().domain(r).range([0,e.width]).padding(c),u=k().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?k().domain([l,c]).range([0,e.width]):k().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&&"exact"!==this.config.axisExtent){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=Js[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=Qs(r.colorScheme,r.themeCategorical,ft),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:Zs(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||ft,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?xt(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,ea.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=_().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 k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],d=this.getNodeKey(c,S);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),w=!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}),w=!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,w=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!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,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(d,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!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)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:Ot(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=At(e,this.activeTransition),s=wt(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=St(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=St(n.x,e._targetX,s),e.y=St(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=St(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=St(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=St(o.x,e._targetX,s),e.y=St(o.y,e._targetY,s),void 0!==o.w&&(e.w=St(o.w,e._targetW,s),e.h=St(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:St(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=St(o.startAngle,e._targetStartAngle,s),e.endAngle=St(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&&!Re(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!Re(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!Re(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(Re(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=ze(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)=>!Re(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>We(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Le)):(this.getR=We(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Re(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?ze(this.config.stackBy):void 0),"groupBy"in e&&!Re(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?ze(this.config.groupBy):void 0),"colorAccessor"in e&&!Re(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ze(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Re(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?ze(this.config.connectorAccessor):void 0)}}function ta(e,t,o){const n=Bt(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function oa(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Nt(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function na(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=It(Math.atan2(i,n)),a=It(e.startAngle),l=It(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 ia(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 ra(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 sa(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=n,{rTickValues:f,axisExtent:p}=n,y="radial"===(null==d?void 0:d.projection),v="horizontal"===(null==d?void 0:d.projection),m=r(()=>!d||y?[]:(f||Jo(d.r,5,p)).map(e=>({value:e,pixel:d.r(e),label:(g||aa)(e)})),[d,g,y,f,p]),b=h&&d&&!y,x=u&&d&&!y;return b||x?e("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[b&&e("g",{className:"ordinal-grid",children:m.map((t,o)=>e("line",{x1:v?t.pixel:0,y1:v?0:t.pixel,x2:v?t.pixel:i,y2:v?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),x&&e(o,{children:t(o,v?{children:[e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function aa(e){return Math.round(100*e)/100+""}function la(n){var s,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:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:_,legendPosition:C="right",foregroundGraphics:j,annotations:M,svgAnnotationRules:P,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:N,children:E}=n,D="radial"===(null==g?void 0:g.projection),I="horizontal"===(null==g?void 0:g.projection),H=!1!==p,R=r(()=>f&&H&&g&&!D?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,H,g,m,D]),W=n.rTickValues,F=n.tickLabelEdgeAlign,z=n.axisExtent,$=r(()=>f&&g&&!D?(W||Jo(g.r,5,z)).map(e=>({value:e,pixel:g.r(e),label:(b||aa)(e)})):[],[f,g,b,D,W,z]),Y=i(new Map),G=i(null!==(s=null==M?void 0:M.length)&&void 0!==s?s:0),q=null!==(a=null==M?void 0:M.length)&&void 0!==a?a:0;G.current!==q&&(G.current=q,Y.current=new Map);const X=r(()=>{if(!M||0===M.length)return null;const e=zo(),t="horizontal"===(null==g?void 0:g.projection),o=(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,n={scales:g?{x:t?g.r:o||g.r,y:t&&o||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:t?"horizontal":"vertical",stickyPositionCache:Y.current};return M.map((t,o)=>{if(P){const i=P(t,o,n);return null!=i?i:e(t,o,n)}return e(t,o,n)}).filter(Boolean)},[M,P,l,c,g,L,T,B]);return f||k||w||j||X&&X.length>0||x||E?t("svg",{role:"img",width:d,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!D&&!N&&e("g",{className:"ordinal-grid",children:$.map((t,o)=>e("line",{x1:I?t.pixel:0,y1:I?0:t.pixel,x2:I?t.pixel:l,y2:I?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!D&&e("g",{className:"ordinal-axes",children:t(o,I?{children:[!N&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),R.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&e("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}),!N&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!N&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),$.map((o,n)=>{const i=F?0===n?"start":n===$.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)}),v&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:v})]}:{children:[!N&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,o=0>t||t>c?c:t;return e("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),R.map((o,n)=>t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:o.label})})]},"cat-"+n)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y}),!N&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((o,n)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:o.label})]},"val-"+n)),v&&e("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})]})}),X,j,E]}),k&&e("text",{x:d/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof k?k:null}),Co({legend:w,totalWidth:d,totalHeight:u,margin:h,legendPosition:C,title:k,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:_})]}):null}function ca({width:t,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const d=i(null),u=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,s(()=>{if(!d.current)return;const e=y(d.current).select(".brush-g"),n=b?v():m();return n.extent([[0,0],[t,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=x.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)}),e.call(n),u.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),u.current=null}},[t,o,b]),s(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=y(d.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);b?(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,b]),e("svg",{ref:d,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function da(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 ua(e,t){const o=R().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()}ea.QUADTREE_THRESHOLD=500;const ha=(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?qt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),ua(e,t)):(da(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(da(e,t),ui(e,t)),e.globalAlpha=1}},ga=(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=qt(e,"var(--semiotic-primary, #007bff)"),a=qt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?qt(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?qt(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()}},fa=(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?qt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(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()}},pa=(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=qt(e,o.style.stroke)||("string"==typeof o.style.fill?qt(e,o.style.fill):o.style.fill)||qt(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}},ya=(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=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function va(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 ma(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let ba=null;const xa=new Map;function ka(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=xa.get(o);if(void 0!==n)return n;const i=function(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):(ba||(ba=document.createElement("canvas")),ba.width=e,ba.height=e,ba)}(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")}({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return xa.set(o,i),i}function wa(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 Aa(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 Sa(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Oa=e=>[pa,...e],_a={bar:Oa([vi]),clusterbar:Oa([vi]),point:Oa([fi]),swarm:Oa([fi]),pie:[ha],donut:[ha],boxplot:Oa([ga,fi]),violin:Oa([fa]),histogram:Oa([vi]),ridgeline:Oa([fa]),timeline:Oa([vi]),funnel:[vi,ya,(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?va(i):null!=r?`${va(i)} (${ma(r)})`:va(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=va(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":[vi,(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)||qt(e,"var(--semiotic-border, #999)"),n=ka(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]=Xt(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,qt(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?Sa(i):"",u=Aa(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(),wa(e,v,m,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),wa(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:Oa([vi]),custom:Oa([vi,fi,ha,ga,fa,ya])},Ca={top:50,right:40,bottom:60,left:70},ja={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 Ma({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 t("div",{className:"semiotic-tooltip",style:ja,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:["n = ",d.n]}),t("div",{children:["Min: ",d.min.toLocaleString()]}),t("div",{children:["Q1: ",d.q1.toLocaleString()]}),t("div",{children:["Median: ",d.median.toLocaleString()]}),t("div",{children:["Q3: ",d.q3.toLocaleString()]}),t("div",{children:["Max: ",d.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",d.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:ja,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return t("div",{className:"semiotic-tooltip",style:ja,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===o.length&&t("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 e("div",{className:"semiotic-tooltip",style:ja,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}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 e("div",{className:"semiotic-tooltip",style:ja,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}return t("div",{className:"semiotic-tooltip",style:ja,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}const Pa=g(function(o,a){var c,d,h,g,f,y,v,m,b,x,k;const{chartType:w,runtimeMode:A,data:S,oAccessor:O="category",rAccessor:_="value",colorAccessor:C,stackBy:j,groupBy:M,multiAxis:P,timeAccessor:L,valueAccessor:T,categoryAccessor:B,projection:N="vertical",size:E=[600,400],responsiveWidth:D,responsiveHeight:I,margin:H,barPadding:W,roundedTop:F,gradientFill:z,trackFill:$,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,rExtent:se,oExtent:ae,extentPadding:le=.05,oSort:ce,windowMode:de="sliding",windowSize:ue=200,pieceStyle:he,summaryStyle:ge,colorScheme:pe,barColors:ye,showAxes:ve=!0,showCategoryTicks:be,categoryLabel:xe,valueLabel:we,categoryFormat:Ae,valueFormat:Se,oLabel:Oe,rLabel:_e,oFormat:Ce,rFormat:je,rTickValues:Me,tickLabelEdgeAlign:Pe,axisExtent:Le,enableHover:Te=!0,hoverAnnotation:Be,tooltipContent:Ne,customHoverBehavior:Ee,annotations:De,svgAnnotationRules:Ie,showGrid:He=!1,legend:Re,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:Ye,legendCategoryAccessor:Ge,onCategoriesChange:qe,backgroundGraphics:Xe,foregroundGraphics:Ve,title:Ue,className:Ke,background:Qe,centerContent:Ze,decay:Je,pulse:et,transition:tt,animate:ot,staleness:nt,brush:it,onBrush:rt,accessibleTable:st=!0,description:at,summary:lt,customLayout:ct,layoutConfig:dt}=o,ut=i(!0),ht=oi({sizeProp:E,responsiveWidth:D,responsiveHeight:I,userMargin:H,marginDefault:Ca,foregroundGraphics:Ve,backgroundGraphics:Xe,animate:ot,transitionProp:tt,themeDirtyRef:ut}),{reducedMotionRef:gt,responsiveRef:ft,size:pt,margin:yt,adjustedWidth:vt,adjustedHeight:mt,resolvedForeground:bt,resolvedBackground:xt,currentTheme:kt,transition:wt,introEnabled:At,tableId:St,rafRef:Ot,renderFnRef:_t,scheduleRender:Ct}=ht,jt=gn(),Mt=vn(),Pt=r(()=>fe(S),[S]),Lt=null!=xe?xe:Oe,Bt=null!=we?we:_e,Nt=null!=Ae?Ae:Ce,Et=null!=Se?Se:je,Dt=i(null),It=i(null),Rt=i([]),Wt=i(Ge),Ft=i(qe);Wt.current=Ge,Ft.current=qe;const[zt,$t]=u(null),[Yt,Gt]=u(null),[Xt,Vt]=u(0),[Ut,Kt]=u(!1),[Qt,Zt]=u(null),Jt=l(()=>{var e,t;Zt(null!==(t=null===(e=io.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),eo=Te||Be,to="streaming"===A,oo=r(()=>{var e,t,o;return{chartType:w,runtimeMode:to?"streaming":"bounded",windowSize:ue,windowMode:de,extentPadding:le,projection:N,oAccessor:to?void 0:O,rAccessor:to?void 0:_,colorAccessor:C,stackBy:j,groupBy:M,multiAxis:P,timeAccessor:to?L:void 0,valueAccessor:to?T||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:to?B||O:void 0,rExtent:se,oExtent:ae,axisExtent:Le,barPadding:W,roundedTop:F,gradientFill:z,trackFill:$,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:pe,themeCategorical:null===(e=null==kt?void 0:kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(kt),themeSequential:null===(t=null==kt?void 0:kt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==kt?void 0:kt.colors)||void 0===o?void 0:o.diverging,barColors:ye,decay:Je,pulse:et,transition:wt,introAnimation:At,staleness:nt,customLayout:ct,layoutConfig:dt,layoutMargin:yt}},[w,ue,de,le,N,O,_,C,j,M,P,L,T,B,se,ae,Le,W,F,z,$,Y,G,q,X,V,U,K,Q,Z,J,ee,te,oe,ne,ie,re,ce,he,ge,pe,ye,Je,et,null==wt?void 0:wt.duration,null==wt?void 0:wt.easing,At,nt,to,kt,ct,dt,yt]),no=bn(oo),io=i(null);io.current||(io.current=new ea(no));const ro=l(()=>{var e,t;const o=Wt.current,n=Ft.current;if(!n||!o)return;const i=Si(null!==(t=null===(e=io.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Oi(i,Rt.current)||(Rt.current=i,n(i))},[]);s(()=>{var e;null===(e=io.current)||void 0===e||e.updateConfig(no),ut.current=!0,Ct()},[no,Ct]);const so=i(null);so.current||(so.current=new me(e=>{const t=io.current;t&&t.ingest(e)&&(ut.current=!0,Ct())}));const ao=l(e=>{var t;null===(t=so.current)||void 0===t||t.push(e)},[]),lo=l(e=>{var t;null===(t=so.current)||void 0===t||t.pushMany(e)},[]),co=l(()=>{var e,t;null===(e=so.current)||void 0===e||e.clear(),null===(t=io.current)||void 0===t||t.clear(),ut.current=!0,Ct()},[Ct]),fo=l(e=>{var t,o;null===(t=so.current)||void 0===t||t.clearLastData(),null===(o=so.current)||void 0===o||o.setReplacementData(e)},[]);p(a,()=>({push:ao,pushMany:lo,replace:fo,remove:e=>{var t,o,n,i;null===(t=so.current)||void 0===t||t.flush();const r=null!==(n=null===(o=io.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=It.current)||void 0===i?void 0:i.data;!!It.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(It.current=null,$t(null)),ut.current=!0,Ct()}return r},update:(e,t)=>{var o,n,i;null===(o=so.current)||void 0===o||o.flush();const r=null!==(i=null===(n=io.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(ut.current=!0,Ct()),r},clear:co,getData:()=>{var e,t,o;return null===(e=so.current)||void 0===e||e.flush(),null!==(o=null===(t=io.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=io.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[ao,lo,fo,co,Ct]),s(()=>{var e;S&&(null===(e=so.current)||void 0===e||e.setBoundedData(Pt))},[S,Pt]);const{hoverHandlerRef:po,hoverLeaveRef:mo,onPointerMove:bo,onPointerLeave:xo}=ht;po.current=e=>{if(!eo)return;const t=Dt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-yt.left,i=e.clientY-o.top-yt.top;if(0>n||n>vt||0>i||i>mt)return void(It.current&&(It.current=null,$t(null),Ee&&Ee(null),Ct()));const r=io.current;if(!r||0===r.scene.length)return;const s="radial"===N,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Ht(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=ta(r,t,o);break;case"point":if(i)break;e=oa(r,t,o,n);break;case"wedge":e=na(r,t,o);break;case"boxplot":e=ia(r,t,o);break;case"violin":e=ra(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-vt/2:n,s?i-mt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(It.current&&(It.current=null,$t(null),Ee&&Ee(null),Ct()));const l=bi(a.datum||{},a.x,a.y,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 _?_:void 0,__chartType:w}));It.current=l,$t(l),Ee&&(Ee(l),ut.current=!0),Ct()},mo.current=()=>{It.current&&(It.current=null,$t(null),Ee&&(Ee(null),ut.current=!0),Ct())};const ko=i(-1),wo=i(null),Ao=i(null),So=l(e=>{const t=io.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Ao.current&&Ao.current.version===o)n=Ao.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=uo(e),Ao.current={version:o,graph:n}}const i=ko.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),ko.current=0;const t=n.flat[0];wo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},yo(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:w});return It.current=o,$t(o),Ee&&Ee(o),void Ct()}const r=ho(n,i),s=go(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return ko.current=-1,wo.current=null,It.current=null,$t(null),Ee&&Ee(null),void Ct();ko.current=s;const a=n.flat[s];wo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},yo(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:w});It.current=l,$t(l),Ee&&Ee(l),Ct()},[Ee,Ct]),Oo=l(e=>{ko.current=-1,wo.current=null,bo(e)},[bo]);_t.current=()=>{var e,t;Ot.current=0;const o=Dt.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=io.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=ut.current;l&&!s&&(i.computeScene({width:vt,height:mt}),ro(),Jt(),ut.current=!1),(l||a)&&o.setAttribute("aria-label",Cn(i.scene,w+" chart"));const c=ii(),d=pt[0]*c,u=pt[1]*c;o.width===d&&o.height===u||(o.width=d,o.height=u,o.style.width=pt[0]+"px",o.style.height=pt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,pt[0],pt[1]);const h=null!==(e=null==nt?void 0:nt.threshold)&&void 0!==e?e:5e3,g=nt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==nt?void 0:nt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Qe&&!Xe){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Qe||(e&&"transparent"!==e?e:null),i=t?qt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,pt[0],pt[1]))}const f="radial"===N;n.save(),n.beginPath(),n.rect(yt.left,yt.top,vt,mt),n.clip(),f?(n.save(),n.translate(yt.left+vt/2,yt.top+mt/2)):n.translate(yt.left,yt.top);const p=ct?_a.custom:_a[w]||[],y={width:vt,height:mt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(Gt(i.scales),Vt(e=>e+1)),(null==nt?void 0:nt.showBadge)&&Kt(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Ot.current=requestAnimationFrame(()=>_t.current()))},mn({hydrated:jt,wasHydratingFromSSR:Mt,storeRef:io,dirtyRef:ut,renderFnRef:_t,cleanup:()=>{var e;return null===(e=so.current)||void 0===e?void 0:e.clear()}}),s(()=>{ut.current=!0,Ct()},[w,vt,mt,ve,Qe,Ct]),vo(nt,io,ut,Ct,Ut,Kt);const _o=eo&&zt?Ne?Ne(zt):e(Ma,{hover:zt}):null,Co="radial"===N,jo=_o?e(Qn,{x:zt?Co?zt.x+vt/2:zt.x:0,y:zt?Co?zt.y+mt/2:zt.y:0,containerWidth:vt,containerHeight:mt,margin:yt,className:"stream-ordinal-tooltip",children:_o}):null,Mo=_i(O,void 0,"__semiotic_resolvedO",""),Po=_i(_,void 0,"__semiotic_resolvedR",""),Lo=Mo.key,To=Po.key,Bo=Ci(Mo,Po,De&&De.length>0||!1);if(un||!jt&&Mt){const o=io.current;o&&S&&(o.ingest({inserts:Pt,bounded:!0}),o.computeScene({width:vt,height:mt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(d=null==o?void 0:o.scales)&&void 0!==d?d:null,s="radial"===N,a=s?yt.left+vt/2:yt.left,l=s?yt.top+mt/2:yt.top;return t("div",{ref:ft,className:"stream-ordinal-frame"+(Ke?" "+Ke:""),role:"img","aria-label":at||("string"==typeof Ue?Ue:"Ordinal chart"),style:{position:"relative",width:D?"100%":pt[0],height:I?"100%":pt[1]},children:[e(Rn,{summary:lt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:pt[0],height:pt[1],style:{position:"absolute",left:0,top:0},children:[xt&&e("g",{transform:`translate(${yt.left},${yt.top})`,children:xt}),t("g",{transform:`translate(${a},${l})`,children:[Qe&&e("rect",{x:0,y:0,width:vt,height:mt,fill:Qe}),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(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let o=0;t.length>o;o++)l.push(e("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=dn(t.style.fill);l.push(e("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:dn(i.style.fill);if(i.cornerRadii&&an(i.cornerRadii)){const o=function(e){const{x:t,y:o,w:n,h:i}=e,{tl:r,tr:s,br:a,bl:l}=ln(e);let c=`M${t+r},${o}`;return c+=` L${t+n-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n},${o+s}`),c+=` L${t+n},${o+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n-a},${o+i}`),c+=` L${t+l},${o+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+i-l}`),c+=` L${t},${o+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${o}`),c+=" Z",c}(i);return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:o,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}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 t(n.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:u,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("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 t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:dn(t.style.fill),opacity:null!==(r=t.style.opacity)&&void 0!==r?r:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}case"wedge":{const t=o,n=R().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2);t.cornerRadius&&n.cornerRadius(t.cornerRadius);const i=n(cn)||"";return e("path",{d:i,transform:`translate(${t.cx},${t.cy})`,fill:dn(t.style.fill),stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity},h)}case"boxplot":{const n=o,i=n.columnWidth/2;return t("g","vertical"===n.projection?{children:[e("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:dn(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("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:[e("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:dn(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),e("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 t=o,n=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:dn(t.style.fill),fillOpacity:null!==(l=t.style.fillOpacity)&&void 0!==l?l:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},u("path"))];if(t.iqrLine&&t.bounds){const o=t.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},u("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},u("med"))):n.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},u("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},u("med")))}return e("g",{children:n},h)}case"connector":return e("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 t=o,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:n,fill:dn(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},h)}default:return null}}(o,i)).filter(Boolean)]})]}),e(la,{width:vt,height:mt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:r,showAxes:ve,showCategoryTicks:be,oLabel:Lt,rLabel:Bt,oFormat:Nt,rFormat:Et,rTickValues:Me,tickLabelEdgeAlign:Pe,axisExtent:Le,showGrid:He,title:Ue,legend:Re,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:Ye,foregroundGraphics:Tt(bt,null===(h=io.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:De,svgAnnotationRules:Ie,annotationFrame:0,xAccessor:Lo,yAccessor:To,annotationData:Bo(null==o?void 0:o.getData())}),Ze&&"radial"===N&&e("div",{style:{position:"absolute",left:yt.left+vt/2,top:yt.top+mt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ze})]})}return t("div",{ref:ft,className:"stream-ordinal-frame"+(Ke?" "+Ke:""),role:"group","aria-label":at||("string"==typeof Ue?Ue:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:D?"100%":pt[0],height:I?"100%":pt[1],overflow:"visible"},onKeyDown:So,children:[st&&e(Wn,{tableId:St}),st&&e(In,{scene:null!==(f=null===(g=io.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:w+" chart",tableId:St,chartTitle:"string"==typeof Ue?Ue:void 0}),e(Rn,{summary:lt}),t("div",{role:"img","aria-label":at||("string"==typeof Ue?Ue:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:eo?Oo:void 0,onMouseLeave:eo?xo:void 0,children:[xt&&e("svg",{style:{position:"absolute",top:0,left:0,width:pt[0],height:pt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${yt.left},${yt.top})`,children:xt})}),e(sa,{width:vt,height:mt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:Yt,showAxes:ve,showGrid:He,rFormat:Et,rTickValues:Me,axisExtent:Le}),e("canvas",{ref:Dt,"aria-label":Cn(null!==(v=null===(y=io.current)||void 0===y?void 0:y.scene)&&void 0!==v?v:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:pt[0],height:pt[1]}}),e(Fn,{hoverPoint:zt}),e(la,{width:vt,height:mt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:Yt,showAxes:ve,showCategoryTicks:be,oLabel:Lt,rLabel:Bt,oFormat:Nt,rFormat:Et,rTickValues:Me,axisExtent:Le,showGrid:He,title:Ue,legend:Re,legendHoverBehavior:We,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:Ye,foregroundGraphics:Tt(bt,Qt),annotations:De,svgAnnotationRules:Ie,annotationFrame:Xt,xAccessor:Lo,yAccessor:To,annotationData:Bo(null===(m=io.current)||void 0===m?void 0:m.getData()),underlayRendered:!0}),(it||rt)&&"radial"!==N&&e(ca,{width:vt,height:mt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:Yt,onBrush:rt||(()=>{})}),Ze&&"radial"===N&&e("div",{style:{position:"absolute",left:yt.left+vt/2,top:yt.top+mt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ze}),(null==nt?void 0:nt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===nt.badgePosition?{top:4,left:4}:"bottom-left"===nt.badgePosition?{bottom:4,left:4}:"bottom-right"===nt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ut?"#dc3545":"#28a745",color:"white"}),children:Ut?"STALE":"LIVE"}),e($n,{active:ko.current>=0,hoverPoint:zt,margin:yt,size:pt,shape:null===(b=wo.current)||void 0===b?void 0:b.shape,width:null===(x=wo.current)||void 0===x?void 0:x.w,height:null===(k=wo.current)||void 0===k?void 0:k.h}),jo]})]})});function La({ref:e,frameRef:t,setup:o}){return p(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}}function Ta(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:i,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,v=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=vt(e,t,o)}else c.fill=Sr(n,i,s,f?r:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,i,s,a,f,p,y]),m=r(()=>rs(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},v(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},v(e,t)),l):v,{stroke:c,strokeWidth:d,opacity:u}),[v,l,c,d,u]);return r(()=>dr(m,null!=h?h:null,g),[m,h,g])}Pa.displayName="StreamOrdinalFrame";const Ba=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:k,annotations:w,regression:A,valueExtent:S,frameProps:O={},selection:_,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:N,legendPosition:E,color:D,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:W,categoryFormat:F,dataIdAccessor:z}=t,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=r(()=>fe(a),[a]),te=is({data:ee,rawData:a,colorBy:f,colorScheme:p,legendInteraction:N,legendPosition:E,selection:_,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:X,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:B,width:$,height:Y}),{effectiveLegendProps:oe,effectiveMargin:ne}=La({ref:o,frameRef:s,setup:te});if(te.earlyReturn)return te.earlyReturn;Ur("BarChart",ee,"categoryAccessor",d),Ur("BarChart",ee,"valueAccessor",u);const ie=_r(ee,y,u),re=Ar(),se=r(()=>new Map,[ee]),ae=Ta({colorBy:f,colorScale:te.colorScale,color:D,themeCategorical:re,colorScheme:p,categoryIndexMap:se,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),le=r(()=>Rr({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),ce=es({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ce)return e(Wr,{componentName:"BarChart",message:ce,width:$,height:Y});const de=_s(A),ue=de?[de,...w||[]]:w,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:ae,size:[$,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne,barPadding:v}),null!=m&&{roundedTop:m}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:G,showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:g}),F&&{oFormat:F}),{showGrid:q,showCategoryTicks:W,oSort:y}),oe),ys({title:V,description:U,summary:K,accessibleTable:Q,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:k,defaultTooltipContent:le})),vs({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),ue&&ue.length>0&&{annotations:ue}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"BarChart",width:$,height:Y,children:e(Pa,Object.assign({ref:s},he))})});Ba.displayName="BarChart";const Na=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:k=!1,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:_,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:N,legendPosition:E,color:D,stroke:I,strokeWidth:H,opacity:R,categoryFormat:W}=t,{width:F,height:z,enableHover:$,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=r(()=>fe(a),[a]),J=p||u,ee=is({data:Z,rawData:a,colorBy:J,colorScheme:y,legendInteraction:N,legendPosition:E,selection:_,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:B,width:F,height:z});if(ee.earlyReturn)return ee.earlyReturn;const te=Ar(),oe=r(()=>new Map,[Z]),ne=Ta({colorBy:J,colorScale:ee.colorScale,color:D,themeCategorical:te,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=r(()=>Rr({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),re=es({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=La({ref:o,frameRef:s,setup:ee}),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({chartType:"bar"},null!=a&&{data:Z}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:v,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:f}),W&&{oFormat:W}),{showGrid:Y}),se),ys({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:w,defaultTooltipContent:ie})),vs({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return re?e(Wr,{componentName:"StackedBarChart",message:re,width:F,height:z}):e(Yr,{componentName:"StackedBarChart",width:F,height:z,children:e(Pa,Object.assign({ref:s},le))})});Na.displayName="StackedBarChart";const Ea=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:k,annotations:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:_,onObservation:C,onClick:j,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:N,color:E,stroke:D,strokeWidth:I,opacity:H,categoryFormat:R}=t,{width:W,height:F,enableHover:z,showGrid:$,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=n,Q=r(()=>fe(a),[a]),Z=p||u,J=is({data:Q,rawData:a,colorBy:Z,colorScheme:y,legendInteraction:B,legendPosition:N,selection:O,linkedHover:_,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:M,chartType:"GroupedBarChart",chartId:P,showLegend:Y,userMargin:l,marginDefaults:n.marginDefaults,loading:L,emptyContent:T,width:W,height:F});if(J.earlyReturn)return J.earlyReturn;const ee=Ar(),te=r(()=>new Map,[Q]),oe=Ta({colorBy:Z,colorScale:J.colorScale,color:E,themeCategorical:ee,colorScheme:y,categoryIndexMap:te,userPieceStyle:S.pieceStyle,stroke:D,strokeWidth:I,opacity:H,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ne=r(()=>Rr({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ie=es({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:re,effectiveMargin:se}=La({ref:o,frameRef:s,setup:J}),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({chartType:"clusterbar"},null!=a&&{data:Q}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[W,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:m}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:f}),R&&{oFormat:R}),{showGrid:$}),re),ys({title:G,description:q,summary:X,accessibleTable:V,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:k,defaultTooltipContent:ne})),vs({linkedHover:_,onObservation:C,onClick:j,hoverHighlight:M,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ie?e(Wr,{componentName:"GroupedBarChart",message:ie,width:W,height:F}):e(Yr,{componentName:"GroupedBarChart",width:W,height:F,children:e(Pa,Object.assign({ref:s},ae))})});function Da({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=cr("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),s=Ki({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof n?n:"value")}),a=i(s.brushInteraction);a.current=s.brushInteraction;const c=l(e=>{if(r){a.current.end(e?e.r:null)}null==t||t(e)},[t,r]),d=!!(e||o||t);return{hasBrush:d,handleBrush:c,brushStreamProps:d?{brush:{dimension:"r"},onBrush:c}:{}}}Ea.displayName="GroupedBarChart";const Ia=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);as(o,{variant:"xy",frameRef:s});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:k,annotations:w,valueExtent:A,brush:S,onBrush:O,linkedBrush:_,frameProps:C={},selection:j,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,chartId:B,loading:N,emptyContent:E,legendInteraction:D,legendPosition:I,color:H,stroke:R,strokeWidth:W,opacity:F,showCategoryTicks:z,categoryFormat:$}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=n,te=r(()=>fe(a),[a]),oe=is({data:te,rawData:a,colorBy:f,colorScheme:p,legendInteraction:D,legendPosition:I,selection:j,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:B,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:N,emptyContent:E,width:Y,height:G}),ne=Da({brushProp:S,onBrushProp:O,linkedBrush:_,valueAccessor:u});if(oe.earlyReturn)return oe.earlyReturn;const ie=r(()=>{if(!y)return;const e=te.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[te,y]),re=Ar(),se=r(()=>new Map,[te]),ae=Ta({colorBy:f,colorScale:oe.colorScale,color:H,themeCategorical:re,colorScheme:p,categoryIndexMap:se,userPieceStyle:null==C?void 0:C.pieceStyle,stroke:R,strokeWidth:W,opacity:F,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?bt(e,y,v,ie):m})}),le=r(()=>Rr({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),ce=es({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ce)return e(Wr,{componentName:"SwarmPlot",message:ce,width:Y,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:"swarm"},null!=a&&{data:te}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ae,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,barPadding:x,enableHover:q}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:J,rLabel:ee,rFormat:g}),$&&{oFormat:$}),{showGrid:X,showCategoryTicks:z}),oe.legendBehaviorProps),ys({title:U,description:K,summary:Q,accessibleTable:Z,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:k,defaultTooltipContent:le})),vs({linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),ne.brushStreamProps),Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"SwarmPlot",width:Y,height:G,children:e(Pa,Object.assign({ref:s},de))})});function Ha(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 t("div",{className:"semiotic-tooltip",style:Yn,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&t("div",{children:["n = ",s.n]}),null!=s.min&&t("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&t("div",{children:["Q1: ",s.q1.toLocaleString()]}),t("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&t("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&t("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&t("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 t("div",{className:"semiotic-tooltip",style:Yn,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&t("div",{children:["n = ",a]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:Yn,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}Ia.displayName="SwarmPlot";const Ra=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);as(o,{variant:"xy",frameRef:s});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:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:_,chartId:C,loading:j,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:B,strokeWidth:N,opacity:E,showCategoryTicks:D,categoryFormat:I}=t,{width:H,height:R,enableHover:W,showGrid:F,showLegend:z,title:$,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=n,U=r(()=>fe(a),[a]),K=is({data:U,rawData:a,colorBy:f,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:_,chartType:"BoxPlot",chartId:C,showLegend:z,userMargin:l,marginDefaults:n.marginDefaults,loading:j,emptyContent:M,width:H,height:R});if(K.earlyReturn)return K.earlyReturn;const Q=Ar(),Z=r(()=>new Map,[U]),J=Ta({colorBy:f,colorScale:K.colorScale,color:T,themeCategorical:Q,colorScheme:p,categoryIndexMap:Z,userPieceStyle:void 0,stroke:B,strokeWidth:N,opacity:E,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=r(()=>Ha(),[]),te=es({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(te)return e(Wr,{componentName:"BoxPlot",message:te,width:H,height:R});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({chartType:"boxplot"},null!=a&&{data:U}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:J,showOutliers:y,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:v,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:X,rLabel:V,rFormat:g}),I&&{oFormat:I}),{showGrid:F,showCategoryTicks:D}),K.legendBehaviorProps),ys({title:$,description:Y,summary:G,accessibleTable:q,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:m,defaultTooltipContent:ee})),vs({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:_,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"BoxPlot",width:H,height:R,children:e(Pa,Object.assign({ref:s},oe))})});Ra.displayName="BoxPlot";const Wa=g(function(o,n){const s=Tr(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=i(null);as(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:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:_,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:N,legendPosition:E,color:D,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:W,categoryFormat:F}=o,{width:z,height:$,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=s,J=r(()=>fe(l),[l]),ee=is({data:J,rawData:l,colorBy:y,colorScheme:v,legendInteraction:N,legendPosition:E,selection:_,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:q,userMargin:c,marginDefaults:s.marginDefaults,loading:T,emptyContent:B,width:z,height:$}),te=Da({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(ee.earlyReturn)return ee.earlyReturn;const oe=r(()=>{if(0===J.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of J){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[J,h]),ne=Ar(),ie=r(()=>new Map,[J]),re=Ta({colorBy:y,colorScale:ee.colorScale,color:D,themeCategorical:ne,colorScheme:v,categoryIndexMap:ie,userPieceStyle:void 0,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return t("div",{className:"semiotic-tooltip",style:Yn,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),s&&2===s.length&&t("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),ae=es({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ae)return e(Wr,{componentName:"Histogram",message:ae,width:z,height:$});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({chartType:"histogram"},null!=l&&{data:J}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:re,bins:g,normalize:f}),k?{rExtent:k}:oe&&{rExtent:oe}),{size:[z,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:s.showAxes,oLabel:Q,rLabel:Z,rFormat:p}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),ee.legendBehaviorProps),ys({title:X,description:V,summary:U,accessibleTable:K,className:d,animate:o.animate,axisExtent:o.axisExtent})),ms({tooltip:b,defaultTooltipContent:se})),vs({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),x&&x.length>0&&{annotations:x}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"Histogram",width:z,height:$,children:e(Pa,Object.assign({ref:a},le))})});Wa.displayName="Histogram";const Fa=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);as(o,{variant:"xy",frameRef:s});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:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:_,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:N,legendPosition:E,color:D,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:W,categoryFormat:F}=t,{width:z,height:$,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=r(()=>fe(a),[a]),ee=is({data:J,rawData:a,colorBy:y,colorScheme:v,legendInteraction:N,legendPosition:E,selection:_,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:T,emptyContent:B,width:z,height:$}),te=Da({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const oe=Ar(),ne=r(()=>new Map,[J]),ie=Ta({colorBy:y,colorScale:ee.colorScale,color:D,themeCategorical:oe,colorScheme:v,categoryIndexMap:ne,userPieceStyle:void 0,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),re=r(()=>Ha({valueAccessor:u}),[u]),se=es({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(se)return e(Wr,{componentName:"ViolinPlot",message:se,width:z,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({chartType:"violin"},null!=a&&{data:J}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ie,bins:g,showIQR:f,size:[z,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:p}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),ee.legendBehaviorProps),ys({title:X,description:V,summary:U,accessibleTable:K,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:b,defaultTooltipContent:re})),vs({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),te.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"ViolinPlot",width:z,height:$,children:e(Pa,Object.assign({ref:s},ae))})});Fa.displayName="ViolinPlot";const za=g(function(t,o){var n;const s=Tr(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);as(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:k,regression:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:_,onObservation:C,onClick:j,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:N,color:E,stroke:D,strokeWidth:I,opacity:H,categoryFormat:R}=t,{width:W,height:F,enableHover:z,showGrid:$,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=s,Q=r(()=>fe(l),[l]),Z=is({data:Q,rawData:l,colorBy:p,colorScheme:y,legendInteraction:B,legendPosition:N,selection:O,linkedHover:_,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:M,chartType:"DotPlot",chartId:P,showLegend:Y,userMargin:c,marginDefaults:s.marginDefaults,loading:L,emptyContent:T,width:W,height:F});if(Z.earlyReturn)return Z.earlyReturn;const J=_r(Q,v,h),ee=Ar(),te=r(()=>new Map,[Q]),oe=Ta({colorBy:p,colorScale:Z.colorScale,color:E,themeCategorical:ee,colorScheme:y,categoryIndexMap:te,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:I,opacity:H,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),ne=r(()=>Rr({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),ie=es({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ie)return e(Wr,{componentName:"DotPlot",message:ie,width:W,height:F});const re=_s(w),se=re?[re,...k||[]]:k,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({chartType:"point"},null!=l&&{data:J}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[W,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:b,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:U,rLabel:K,rFormat:f}),R&&{oFormat:R}),{showGrid:$,oSort:v}),Z.legendBehaviorProps),ys({title:G,description:q,summary:X,accessibleTable:V,className:d,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:x,defaultTooltipContent:ne})),vs({linkedHover:_,onObservation:C,onClick:j,hoverHighlight:M,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),se&&se.length>0&&{annotations:se}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"DotPlot",width:W,height:F,children:e(Pa,Object.assign({ref:a},ae))})});za.displayName="DotPlot";const $a=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);as(o,{variant:"xy",frameRef:s});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:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:_,hoverHighlight:C,chartId:j,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:N,strokeWidth:E,opacity:D,showCategoryTicks:I,categoryFormat:H}=t,{width:R,height:W,enableHover:F,showGrid:z,showLegend:$,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=n,K=r(()=>fe(a),[a]),Q=is({data:K,rawData:a,colorBy:y,colorScheme:v,legendInteraction:L,legendPosition:T,selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:_,hoverHighlight:C,chartType:"RidgelinePlot",chartId:j,showLegend:$,userMargin:l,marginDefaults:n.marginDefaults,loading:M,emptyContent:P,width:R,height:W});if(Q.earlyReturn)return Q.earlyReturn;const Z=Ar(),J=r(()=>new Map,[K]),ee=Ta({colorBy:y,colorScale:Q.colorScale,color:B,themeCategorical:Z,colorScheme:v,categoryIndexMap:J,userPieceStyle:void 0,stroke:N,strokeWidth:E,opacity:D,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),te=r(()=>Ha(),[]),oe=es({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(oe)return e(Wr,{componentName:"RidgelinePlot",message:oe,width:R,height:W});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,bins:g,size:[R,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:V,rLabel:U,rFormat:p}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:I,oSort:!1,amplitude:f}),Q.legendBehaviorProps),ys({title:Y,description:G,summary:q,accessibleTable:X,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:b,defaultTooltipContent:te})),vs({linkedHover:S,onObservation:O,onClick:_,hoverHighlight:C,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"RidgelinePlot",width:R,height:W,children:e(Pa,Object.assign({ref:s},ne))})});$a.displayName="RidgelinePlot";const Ya=g(function(t,o){var n,s;const a=Tr(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(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:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:_,loading:C,emptyContent:j,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:N}=t,{width:E,height:D,enableHover:I,showLegend:H,title:R,description:W,summary:F,accessibleTable:z}=a,$=r(()=>fe(c),[c]),Y=f||h,G=is({data:$,rawData:c,colorBy:Y,colorScheme:p,legendInteraction:M,legendPosition:P,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:_,showLegend:H,userMargin:d,marginDefaults:a.marginDefaults,loading:C,emptyContent:j,width:E,height:D});if(G.earlyReturn)return G.earlyReturn;const q=Ar(),X=r(()=>new Map,[$]),V=Ta({colorBy:Y,colorScale:G.colorScale,color:L,themeCategorical:q,colorScheme:p,categoryIndexMap:X,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:N,effectiveSelectionHook:G.effectiveSelectionHook,resolvedSelection:G.resolvedSelection,cycleByCategory:!0}),U=r(()=>Rr({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),K=es({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:Z}=La({ref:o,frameRef:l,setup:G}),J=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:$}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:V,startAngle:y}),null!=v&&{cornerRadius:v}),{size:[E,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),Q),ys({title:R,description:W,summary:F,accessibleTable:z,className:u,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:m,defaultTooltipContent:U})),vs({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e(Wr,{componentName:"PieChart",message:K,width:E,height:D}):e(Yr,{componentName:"PieChart",width:E,height:D,children:e(Pa,Object.assign({ref:l},J))})});Ya.displayName="PieChart";const Ga=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),s=i(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:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:_,loading:C,emptyContent:j,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:N}=t,{width:E,height:D,enableHover:I,showLegend:H,title:R,description:W,summary:F,accessibleTable:z}=n,$=r(()=>fe(a),[a]),Y=f||d,G=is({data:$,rawData:a,colorBy:Y,colorScheme:p,legendInteraction:M,legendPosition:P,selection:k,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:_,showLegend:H,userMargin:l,marginDefaults:n.marginDefaults,loading:C,emptyContent:j,width:E,height:D});if(G.earlyReturn)return G.earlyReturn;const q=null!=h?h:Math.max(2,.15*Math.min(E,D)),X=Ar(),V=r(()=>new Map,[$]),U=Ta({colorBy:Y,colorScale:G.colorScale,color:L,themeCategorical:X,colorScheme:p,categoryIndexMap:V,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:N,effectiveSelectionHook:G.effectiveSelectionHook,resolvedSelection:G.resolvedSelection,cycleByCategory:!0}),K=r(()=>Rr({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),Q=es({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:Z,effectiveMargin:J}=La({ref:o,frameRef:s,setup:G}),ee=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:$}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:U,innerRadius:q,startAngle:y}),null!=v&&{cornerRadius:v}),{centerContent:g,size:[E,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),Z),ys({title:R,description:W,summary:F,accessibleTable:z,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:m,defaultTooltipContent:K})),vs({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Q?e(Wr,{componentName:"DonutChart",message:Q,width:E,height:D}):e(Yr,{componentName:"DonutChart",width:E,height:D,children:e(Pa,Object.assign({ref:s},ee))})});function qa(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}Ga.displayName="DonutChart";const Xa=g(function(o,n){const s=Tr(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=i(null),l="context"===o.mode,{compactMode:c}=s,{value:d,min:u=0,max:h=100,thresholds:g,color:f,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,cornerRadius:v,showNeedle:m=!0,needleColor:b="var(--semiotic-text, #333)",centerContent:x,valueFormat:k,showScaleLabels:w=!c,sweep:A=240,fillZones:S=!0,tooltip:O,annotations:_,frameProps:C={},className:j,stroke:M,strokeWidth:P,opacity:L}=o,{width:T,height:B,title:N,description:E,summary:D,accessibleTable:I}=s,H=Math.max(u,Math.min(h,d)),R=h-u||1,W=(H-u)/R,{gaugeData:F,pieceStyle:z,gaugeAnnotations:$}=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)/R;if(S){const n=(i-u)/R,a=Math.max(0,Math.min(W,(r.value-u)/R)-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,W,R,w,S]),Y=r(()=>rs(z,{stroke:M,strokeWidth:P,opacity:L}),[z,M,P,L]),{sweepRad:G,startAngleDeg:q}=qa(A),X=function(e=240){const{sweepRad:t,offsetRad:o}=qa(e),n=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||n.push([Math.cos(e),Math.sin(e)]);const i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(A),V=Math.min(10,Math.max(1,Math.min(T,B)/12)),U=X.cx,K=X.cy,Q=Math.max(4,Math.min((T-2*V)/X.width,(B-2*V)/X.height)-2),Z=Math.max(0,Math.min(Q-1.5,Q*(1-y))),J=T/2-U*Q,ee=B/2-K*Q,te=2*(Q+4),oe=r(()=>{if(c&&null==x)return null;if(null!=x)return"function"==typeof x?x(H,u,h):x;const o=k?k(H):Math.round(H)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*Q),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),w&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[x,H,u,h,k,w,Q,c]),ne=r(()=>l&&null==x?{type:"gauge-value",text:k?k(H):Math.round(H)+""}:null,[l,x,H,k]),ie=r(()=>{if(!m)return null;const e=-Math.PI/2+q*Math.PI/180+W*G,t=Z>20?Z-8:Q-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:b}},[m,W,q,G,Z,b]),re=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||T)/2,s=(i.height||B)/2,a=Math.max(1,Q-Z),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return t("g",{transform:`translate(${r},${s})`,children:[e("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const t=-Math.PI/2+q*Math.PI/180+(o.value-u)/R*G,r=Z-14,s=(i.height||B)/2;return e("text",{x:(i.width||T)/2+Math.cos(t)*r,y:s+Math.sin(t)*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?e("text",{x:(i.width||T)/2,y:(i.height||B)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*Q)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[T,B,u,R,q,G,Z,Q]),se=r(()=>{const e=[...$,..._||[]];return ie&&e.push(ie),ne&&e.push(ne),e},[$,_,ie,ne]),ae=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 t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===F.length)return e(Wr,{componentName:"GaugeChart",message:"No data to display",width:T,height:B});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:F,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:Y,innerRadius:Z,startAngle:q,sweepAngle:A},null!=v&&{cornerRadius:v}),{centerContent:oe,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ee-te/2,bottom:B-ee-te/2,left:J-te/2,right:T-J-te/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Kn(O)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),N&&{title:N}),E&&{description:E}),D&&{summary:D}),void 0!==I&&{accessibleTable:I}),j&&{className:j}),null!=o.animate&&{animate:o.animate}),C);return e(Yr,{componentName:"GaugeChart",width:T,height:B,children:e(Pa,Object.assign({ref:a},le))})});Xa.displayName="GaugeChart";const Va=g(function(o,n){const s=Tr(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=i(null);as(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:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:_,chartId:C,loading:j,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:B,strokeWidth:N,opacity:E,categoryFormat:D}=o,I="vertical"===y,{width:H,height:R,enableHover:W,showLegend:F,title:z,description:$,summary:Y,accessibleTable:G}=s,q=I?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},X=r(()=>fe(l),[l]),V=f||g,U=!V,K=is({data:X,rawData:l,colorBy:V,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:A,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:_,chartType:"FunnelChart",chartId:C,showLegend:F,userMargin:c,marginDefaults:q,loading:j,emptyContent:M,width:H,height:R});if(K.earlyReturn)return K.earlyReturn;Ur("FunnelChart",X,"stepAccessor",u),Ur("FunnelChart",X,"valueAccessor",h);const Q=Ar(),Z=r(()=>new Map,[X]),J=r(()=>{if(U)return T||((null==Q?void 0:Q[0])?Q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[U,T,Q,p]),ee=Ta({colorBy:J?void 0:V,colorScale:K.colorScale,color:null!=J?J:T,themeCategorical:Q,colorScheme:p,categoryIndexMap:Z,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:B,strokeWidth:N,opacity:E,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection}),te=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 t("div",{className:"semiotic-tooltip",style:Yn,children:[d&&e("div",{style:{fontWeight:"bold"},children:d+""}),p&&p!==d&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[u+"",y]})]})},[]),oe=es({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(oe)return e(Wr,{componentName:"FunnelChart",message:oe,width:H,height:R});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:I?"bar-funnel":"funnel"},null!=l&&{data:X}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:I?"vertical":"horizontal",barPadding:I?40:0,pieceStyle:ee,size:[H,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,enableHover:W}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:I,showCategoryTicks:I}),D&&{oFormat:D}),{showGrid:I}),!I&&{connectorOpacity:v}),{showLabels:m}),K.legendBehaviorProps),z&&{title:z}),$&&{description:$}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?te:Kn(b)||te}),(A||S||O||_)&&{customHoverBehavior:K.customHoverBehavior}),(S||O||A)&&{customClickBehavior:K.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Yr,{componentName:"FunnelChart",width:H,height:R,children:e(Pa,Object.assign({ref:a},ne))})});Va.displayName="FunnelChart";const Ua={RdBu:rt,PiYG:st,PRGn:at,BrBG:lt,RdYlBu:ct,RdYlGn:dt,Spectral:ut},Ka="__likert_neutral_neg",Qa="__likert_neutral_pos";function Za(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Ja(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 el(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:Ka,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Qa,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function tl(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===Ka?r=o:o.__likertLevel===Qa?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 ol=new Map,nl=g(function(t,o){const s=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:c,margin:d,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:v="count",levels:m,orientation:b="horizontal",colorScheme:x,barPadding:k=20,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:_,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,valueFormat:T,loading:B,emptyContent:N,legendInteraction:E,legendPosition:D,categoryFormat:I,stroke:H,strokeWidth:R,opacity:W}=t,{width:F,height:z,enableHover:$,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=s,Z="horizontal"===b,J=void 0===c,ee=!y,te=function(){var e;const t=br();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=Ua[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:s,countAccessor:a,isDiverging:c,frameRef:d}){const u=!s,h=r(()=>Za(o,"question"),[o]),g=r(()=>u?Za(n,"score"):null,[u,n]),f=r(()=>u?null:Za(s,"level"),[u,s]),p=r(()=>u?null:Za(a,"count"),[u,a]),y=e||[],v=i([]),m=r(()=>{if(0===y.length)return[];let e=Ja(y,t,h,g,f,p);return c&&(e=el(e,t),e=tl(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var o;let n=Ja(e,t,h,g,f,p);c&&(n=el(n,t),n=tl(n,t)),null===(o=d.current)||void 0===o||o.replace(n)},[t,h,g,f,p,c,d]);return{processedData:m,reAggregate:b,accumulatorRef:v}}({data:c,levels:m,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:v,isDiverging:Z,frameRef:a}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:s="right"}){const a=i(new Set),c=i([]),[d,h]=u(0),g=Ri(),f=Ar(),p=l(e=>{const o=e[t];return null!=o?o+"":null},[t]),y=l(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||a.current.has(t)||(a.current.add(t),c.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,p]),v=l(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])||(a.current=new Set(n),c.current=n,h(e=>e+1))},[e,t]),m=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{a.current=new Set,c.current=[],h(e=>e+1)},[]);ir(e&&t?c.current:[]);const k=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:ft,s=t,a=i.map(e=>({[s]:e})),l=mt(a,s,r);return lr({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:vt})},[e,t,n,o,g,f,d]),w=r(()=>{if(k)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[k,s]);return{wrapPush:m,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:v}:{},streamingLegend:k,streamingMarginAdjust:w}}({isPushMode:J,colorBy:ae,colorScheme:oe,showLegend:G,legendPosition:D}),ce=l(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),de=l(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);p(o,()=>({push:ce,pushMany:de,remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;se.current=[],le.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}}),[ce,de,le.resetCategories,se]);const ue=is({data:ie,rawData:c,colorBy:ae,colorScheme:oe,legendInteraction:E,legendPosition:D,selection:_,linkedHover:C,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:G,userMargin:d,marginDefaults:s.marginDefaults,loading:B,emptyContent:N,width:F,height:z});if(ue.earlyReturn)return ue.earlyReturn;const he=r(()=>{const e=m.length;return e%2!=0&&ne.get(m[Math.floor(e/2)])||"#888"},[m,ne]),ge=Ta({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:ol,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:H,strokeWidth:R,opacity:W,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,baseStyleExtras:e=>{var t,o;const n=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);if(i===Ka||i===Qa)return{fill:he};const r=n||i;return r&&ne.has(r)?{fill:ne.get(r)}:{fill:"#888"}}}),fe=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),pe=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Ka||o===Qa?fe:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===Ka||o===Qa?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:Yn},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[fe]),ye=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&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?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),v&&(e.countAccessor=v)),es({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:m}})},[c,g,f,y,v,m,ee]),ve=r(()=>[{styleFn:e=>({fill:ne.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,ne]),me=r(()=>!1!==G?Object.assign(Object.assign({},ue.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:D||ue.legendPosition||"bottom"}):ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,D,G,ve]),be=r(()=>{const e=Object.assign({},ue.margin);if(J&&!1!==G){const t=D||"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 Z&&100>e.left&&(e.left=100),e},[ue.margin,le.streamingMarginAdjust,Z,J,G,D]),xe=r(()=>T||(Z?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Z,T]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Z?"horizontal":"vertical",pieceStyle:ge,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:be,barPadding:k,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:K,rLabel:Q||(Z?void 0:"Percentage"),rFormat:xe}),I&&{oFormat:I}),{showGrid:Y}),me),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:!1===w?()=>null:!0===w?pe:Kn(w)||pe}),(C||j||M||P)&&{customHoverBehavior:ue.customHoverBehavior}),(j||M||C)&&{customClickBehavior:ue.customClickBehavior}),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ye?e(Wr,{componentName:"LikertChart",message:ye,width:F,height:z}):e(Yr,{componentName:"LikertChart",width:F,height:z,children:e(Pa,Object.assign({ref:a},ke))})});nl.displayName="LikertChart";const il=g(function(t,o){const n=Tr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:_,onClick:C,hoverHighlight:j,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:N,stroke:E,strokeWidth:D,opacity:I,categoryFormat:H,rTickValues:R,tickLabelEdgeAlign:W,showCategoryTicks:F,gradientFill:z,trackFill:$,roundedTop:Y,valueExtent:G}=t,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=n,ne=r(()=>fe(a),[a]),ie=p||u,re=r(()=>{if(null!=v)return v;if("sparkline"!==t.mode)return 40;const e=new Set(ne.map(e=>"function"==typeof d?d(e):e[d])),o=Math.max(1,e.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?X:q)-2*o)/(o-1))):1},[v,t.mode,ne,d,g,q,X]),se=is({data:ne,rawData:a,colorBy:ie,colorScheme:y,legendInteraction:T,legendPosition:B,selection:S,linkedHover:O,fallbackFields:ie?["string"==typeof ie?ie:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:j,chartType:"SwimlaneChart",chartId:M,showLegend:K,userMargin:l,marginDefaults:n.marginDefaults,loading:P,emptyContent:L,width:q,height:X}),ae=Da({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(se.earlyReturn)return se.earlyReturn;const le=Ar(),ce=r(()=>new Map,[ne]),de=Ta({colorBy:ie,colorScale:se.colorScale,color:N,themeCategorical:le,colorScheme:y,categoryIndexMap:ce,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:E,strokeWidth:D,opacity:I,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,cycleByCategory:!0}),ue=r(()=>Rr({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),he=es({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ge,effectiveMargin:pe}=La({ref:o,frameRef:s,setup:se}),ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:de,size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe,barPadding:re,enableHover:V}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===F?void 0:te,rLabel:oe,rFormat:f}),R&&{rTickValues:R}),null!=W&&{tickLabelEdgeAlign:W}),H&&{oFormat:H}),void 0!==F&&{showCategoryTicks:F}),{showGrid:U}),ge),ys({title:Q,description:Z,summary:J,accessibleTable:ee,className:c,animate:t.animate,axisExtent:t.axisExtent})),ms({tooltip:m,defaultTooltipContent:ue})),vs({linkedHover:O,onObservation:_,onClick:C,hoverHighlight:j,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=$&&{trackFill:$}),null!=Y&&{roundedTop:Y}),G&&{rExtent:G}),ae.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return he?e(Wr,{componentName:"SwimlaneChart",message:he,width:q,height:X}):e(Yr,{componentName:"SwimlaneChart",width:q,height:X,children:e(Pa,Object.assign({ref:s},ye))})});il.displayName="SwimlaneChart";const rl={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},sl={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class al{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,n){var i;for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const a=o[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=n&&null!==(i=n[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?ll(a.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}}function ll(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,d,u,h]=e[a];cl(c,d,u,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*o*n*2,i.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[i,r,s,a]=e.points;cl(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,d=Math.sqrt(l*l+c*c);if(d>.001){const t=l/d;n.x+=-c/d*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function cl(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,d=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+d*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+d*n.y}function dl(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function ul(e,t){var o,n=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,n,u=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(d(o,i),u=!0):r[n]||(u=c(n));if(u)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return i.pop(),u}function d(e,t){var o=[].concat(t).concat(e);n.push(o)}function u(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),i=Array(t),r=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,d=0,u=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=d,i[t]=!0,d+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>o[p]){o[p]=n[p]=d,i[p]=!0,d+=1,l.push(p),c.push(p);break}i[p]&&(n[t]=0|Math.min(n[t],n[p])),0>s[p]||a[t].push(s[p])}r[t]=f}else{if(n[t]===o[t]){var y=[],v=[],m=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),v.push(a[b]),m+=a[b].length,s[b]=u.length,b===t){l.length=f;break}}u.push(y);var x=Array(m);for(f=0;v.length>f;f++)for(var k=0;v[f].length>k;k++)x[--m]=v[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:u,adjacencyList:h}}(e),i=n.components.filter(function(e){return e.length>1}),r=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],o=s);var l=i[o];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}o=0;for(var h=e.length;h>o;){var g=u(o);if(o=g.leastVertex,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(o),o+=1}else o=h}return n}function hl(e){return e.y0-e.y1>0?"up":"down"}function gl(e,t){return t(e.source)==t(e.target)}function fl(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function pl(e){return e.target.x0-e.source.x1}function yl(e,t){var o=ml(e),n=pl(t)/Math.tan(o);return"up"==hl(e)?e.y1-n:e.y1+n}function vl(e,t){var o=ml(e),n=pl(t)/Math.tan(o);return"up"==hl(e)?e.y1+n:e.y1-n}function ml(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function bl(e,t){return t(e)}function xl(e){return wl(e.source)}function kl(e){return wl(e.target)}function wl(e){return(e.y0+e.y1)/2}function Al(e){return e.virtual?0:e.value}function Sl(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!gl(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!gl(e,t)?n+1:n}),o+n}function Ol(e){return e.target.depth}function _l(e,t){return e.sourceLinks.length?e.depth:t-1}function Cl(e,t){return e.y0-t.y0}function jl(e,t){return t.y0-e.y0}function Ml(e,t){return e.y1-t.y1}function Pl(e,t){return t.y1-e.y1}function Ll(e,t){return Bl(e.source,t.source)||e.index-t.index}function Tl(e,t){return Bl(e.target,t.target)||e.index-t.index}function Bl(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Nl(e,t){return El(e)==El(t)?"bottom"==e.circularLinkType?jl(e,t):Cl(e,t):El(t)-El(e)}function El(e){return e.target.column-e.source.column}function Dl(e,t){return Il(e)==Il(t)}function Il(e){return e.y0-e.y1>0?"up":"down"}function Hl(e,t,o,n,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=$(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Rl(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),Rl(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,gl(e,t)&&fl(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?jl:Cl);var d=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+d,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+d),d+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Pl:Ml),d=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+d,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+d),d+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,i=e.y1,r=(t+n)/2;return"M"+t+","+o+"C"+r+","+o+" "+r+","+i+" "+n+","+i}(e)}),r}function Rl(e,t,o){e.sort(Nl);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(gl(e,t)&&fl(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&Wl(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function Wl(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Fl(e){return function(){return e}}function zl(e){return e.index}function $l(e){return e.nodes}function Yl(e){return e.links}function Gl(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(i,r){var s=i.length;if(t)i.sort(t);else if(r>0){var a=new Map;i.forEach(function(e,t){var o,n,i,r=(n=0,i=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=wl(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=wl(e.target)*t,n+=t}}),n>0?i/n:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var o=a.get(e),n=a.get(t),i=o.bc,r=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?o.idx-n.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Sl(t,o)-Sl(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Sl(t,o)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function ql(e,t,o,n,i,r){var s=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});d();for(var a=1,l=r;l>0;--l)c(a*=.99,o),d();function c(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var a;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&Sl(i,o)>0){var l=X(i.sourceLinks,kl),c=X(i.targetLinks,xl),d=l&&c?(l+c)/2:l||c;if(d){var u=(d-wl(i))*t*.3;i.y0+=u,i.y1+=u}}else if(0==s&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)a=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+a;else{var h=X(i.sourceLinks,kl),g=X(i.targetLinks,xl),f=((h&&g?(h+g)/2:h||g)-wl(i))*t;i.y0+=f,i.y1+=f}})})}function d(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||Bl),a=0;c>a;++a)(s=l-(r=o[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+n;if((s=l-n-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=o[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function Xl(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Tl),e.targetLinks.sort(Ll)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,i=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Vl(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,a=zl,l=_l,c=void 0,d=32,u=2,h=$l,g=Yl;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return V(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,i=e.target;"object"!=typeof n&&(n=e.source=dl(o,n)),"object"!=typeof i&&(i=e.target=dl(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var n=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=ul(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var d=l[i].slice(-2);c[d[0]]||(c[d[0]]={}),c[d[0]][d[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:n>o?"top":"bottom","top"==i.circularLinkType?o++:n++,e.nodes.forEach(function(e){bl(e,t)!=bl(i.source,t)&&bl(e,t)!=bl(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),gl(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(q(e.sourceLinks,Al),q(e.targetLinks,Al)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var n,i,r;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,r):e.column})}(h,c,l);var g=r;if(null!==s){var f=Y(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=G(f,function(e){return e.length});p>1&&(g=Math.max(1,(n-t)*s/(p-1)))}(function(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=$(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/q(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=G(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/r),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,g,i),Gl(h,c,a),ql(h,c,a,g,g,d),Xl(h),Hl(h,a,u,10,8),Gl(h,c,a),ql(h,c,a,g,g,d),Xl(h),Hl(h,a,u,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return bl(o.source,t)==bl(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Dl(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=yl(t,e);return e.y1-o}if(t.target.column>e.target.column)return yl(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return bl(o.target,t)==bl(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Dl(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=vl(t,e);return e.y0-o}if(t.source.column>e.source.column)return vl(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,n=!1,i=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==n||0==i){var r=$(t,function(e){return e.y0}),s=G(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-r);function l(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>a?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),o.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),Hl(h,a,u,10,8)}(f),f}return f.update=function(e){return Xl(e),Hl(e,a,u,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Fl(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:Fl(e),f):g},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:Fl(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Fl(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(d=+e,f):d},f.circularLinkGap=function(e){return arguments.length?(u=+e,f):u},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],f):[[e,t],[o,n]]},f.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],f):[o-e,n-t]},f}function Ul(e){const{sx:t,sTop:o,sBot:n,tx:i,tTop:r,tBot:s,cp1X:a,cp2X:l}=e,c=(o+n)/2,d=(r+s)/2;return{pathD:[`M${t},${o}`,`C${a},${o} ${l},${r} ${i},${r}`,`L${i},${s}`,`C${l},${s} ${a},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:d},{x:i,y:d}],halfWidth:(n-o)/2}}}const Kl=e=>{let t,o,n,i,r,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,s=e.target.x0,a=ie(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${i},${l} ${i},${r}Z`;const d=e.sankeyWidth/2,u=ie(e.source.x1,e.target.x0),{pathD:h}=Ul({sx:e.source.x1,sTop:e.y0-d,sBot:e.y0+d,tx:e.target.x0,tTop:e.y1-d,tBot:e.y1+d,cp1X:u(.5),cp2X:u(.5)});return h};function Ql(e){var t;const o=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,n=i.sourceY,r=i.targetX,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${n-o}L${t+a},${n-o}L${t+a},${n+o}L${t},${n+o}ZM${r},${s-o}L${r-l},${s-o}L${r-l},${s+o}L${r},${s+o}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,d=i.leftFullExtent,u=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(n,15));return`M${r},${s-h*o}L${c},${s-h*o}L${c+n},${s-h*o+h*g}L${c+n},${u+h*n-h*g}L${c+n-g},${u+h*n}L${d-n+g},${u+h*n}L${d-n},${u+h*n-h*g}L${d-n},${l-h*o+h*g}L${d-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${d+n},${l+h*o}L${d+n},${u-h*n}L${c-n},${u-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const Zl=new Set,Jl=new WeakMap;function ec(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Jl.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Jl.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;Zl.has(e)||(Zl.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}const tc={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Ol))-1:0},justify:_l};function oc(e){return"string"==typeof e?e:e.id}const nc={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,d;if(0===e.length)return;const u="vertical"===o.orientation?"down":"right",h=o.nodeAlign||"justify",g=null!==(i=o.nodeWidth)&&void 0!==i?i:15,f=null!==(r=o.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(s=o.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),v=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let m;m="down"===u?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Vl().extent(m).links(v).nodes(y).nodeAlign(tc[h]||_l).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,o=1/0,i=-1/0;for(const n of y)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>i&&(i=n.y1);for(const n of v){if(!n.circular||!n.circularPathData)continue;const r=n.circularPathData,s=(null!==(l=null!==(a=n._circularWidth)&&void 0!==a?a:n.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),o>r.verticalFullExtent-s&&(o=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-o,d=n[0],u=n[1];if(r>0&&s>0&&(0>e||0>o||t>d||i>u)){const t=Math.min(d/r,u/s),n=-e*t+(d-r*t)/2,i=-o*t+(u-s*t)/2;for(const e of y)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of v)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+i,o.targetY=o.targetY*t+i,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+i,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+i,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+i,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of v){const t=oc(e.source),o=oc(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(d=e.width)&&void 0!==d?d:0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=u;const i=x.get(t),r=x.get(o);i&&(n.source=i),r&&(n.target=r)}}},buildScene(e,t,o,n){var i,r,s,a,l,c;const d="vertical"===o.orientation?"down":"right",u=o.nodeStyle,h=o.edgeStyle,g=null!==(i=o.edgeOpacity)&&void 0!==i?i:.5,f=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const v=[],m=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=u?u(ec(t,"nodeStyle")):{},i={fill:n.fill||y.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),v.push("down"===d?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(n.id)||y.get(n.id)||i:x.get(t.id)||y.get(t.id)||i;const d=h?h(ec(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=d.fill||i;m.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:s,fillOpacity:null!==(a=d.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),m.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-r},${t.targetY-o}L${t.targetX-r},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:s,fillOpacity:null!==(l=d.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let u;if(u=e.circular&&e.circularPathData?Ql(e):Kl(e),!u)continue;const p={fill:d.fill||i,fillOpacity:null!==(c=d.fillOpacity)&&void 0!==c?c:g,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};m.push({type:"bezier",pathD:u,bezierCache:e.bezier,style:p,datum:e})}if(!1!==o.showLabels){const t=(w=o.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const r=t?t(o):o.id;if(!r)continue;let s,a,l;"down"===d?(s=o.y0+(o.y1-o.y0)/2,a=o.x1+14,l="start"):(n[0]/2>o.x0+e/2?(s=o.x0-6,l="end"):(s=o.x1+6,l="start"),a=o.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===d?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:b}}},ic={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r;if(0===e.length)return;const s=null!==(i=o.forceStrength)&&void 0!==i?i:.1,a=n[0]/2,l=n[1]/2,c=o.__previousPositions;let d=0;const u=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=null==c?void 0:c.get(t.id);e?d++:o?(t.x=o.x,t.y=o.y,d++):u.push(t)}const h=d>0&&.3>=(e.length>0?u.length/e.length:1);if(h){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of u){const n=rc(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const i=sc(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/n.length+s*Math.cos(r),e.y=o/n.length+s*Math.sin(r)}else{const t=sc(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=a+n*Math.cos(o),e.y=l+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),i=o*t;n.x=a+e*Math.cos(i),n.y=l+e*Math.sin(i)}}}const g=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===o.iterations?0:h?40:g,p=ac(o.nodeSize,o.nodeSizeRange,e),y=e=>p(e);if(f>0){const o=re().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=se().force("charge",ae().strength(e=>-25*y(e))).force("center",le(a,l).strength(.8)).force("x",ce(a).strength(.15)).force("y",de(l).strength(.15));if(n.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.force("link",o),n.force("link").links(e)}h?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;f>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){var i,r,s,a,l,c,d;const u=o.nodeStyle,h=o.edgeStyle,g=ac(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],v=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(ec(t,"nodeSize")),n=u?u(ec(t,"nodeStyle")):{},a={fill:n.fill||p.get(t.id)||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:2,opacity:n.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),n="object"==typeof e.target?e.target:b.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const i=h?h(ec(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=o.themeSemantic)||void 0===a?void 0:a.border)||(null===(l=o.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(d=i.opacity)&&void 0!==d?d:.6};v.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==o.showLabels){const t=(x=o.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=g(ec(o,"nodeSize"));m.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:v,labels:m}}};function rc(e,t,o){const n=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let s=null;if(t===e?s=r:r===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function sc(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function ac(e,t,o){var n,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],s=o.map(t=>{var o;return null===(o=t.data)||void 0===o?void 0:o[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>r[0];const a=null!==(n=$(s))&&void 0!==n?n:0,l=null!==(i=G(s))&&void 0!==i?i:1;if(a===l)return()=>(r[0]+r[1])/2;const c=k().domain([a,l]).range(r).clamp(!0);return t=>{var o;const n=null===(o=t.data)||void 0===o?void 0:o[e];return null==n||"number"!=typeof n?r[0]:c(n)}}const lc=qe,cc={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,l=a-r,c=n[0]/2,d=n[1]/2,u=(h=o.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=g.get("string"==typeof e.source?e.source:e.source.id),n=g.get(t);if(void 0===o||void 0===n)continue;const i=u(e);p[o][n]=i}const y=he().padAngle(i);s&&y.sortGroups(s);const v=y(p),m=v.groups,b=R().innerRadius(l).outerRadius(a);for(const t of m){const o=e[t.index],n=b.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+c,o.y=n[1]+d,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);o&&(e.source=o),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of v){const o=e[t.source.index].id,n=e[t.target.index].id,i=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);i&&(i.__chordData=t)}},buildScene(e,t,o,n){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=o,d=Math.min(n[0],n[1])/2,u=d-l,h=n[0]/2,g=n[1]/2,f=o.nodeStyle,p=o.edgeStyle,y=o.edgeColorBy||"source",v=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:lc,m=new Map;e.forEach((e,t)=>{m.set(e.id,v[t%v.length])});const b=ue().radius(u),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=f?f(ec(o,"nodeStyle")).fill||m.get(o.id)||v[t%v.length]:m.get(o.id)||v[t%v.length];const s=f?f(ec(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};x.push({type:"arc",cx:h,cy:g,innerR:u,outerR:d,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:a,datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=b(t);if(!n)continue;const i=dc(n,h,g);let l=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(p)l=p(ec(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===y&&o?l=m.get(o.id)||l:t&&(l=m.get(t.id)||l)}const d=p?p(ec(e,"edgeStyle")):{},u={fill:l,fillOpacity:null!==(a=d.fillOpacity)&&void 0!==a?a:c,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};k.push({type:"ribbon",pathD:i,style:u,datum:e})}if(!1!==o.showLabels){const t=(A=o.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=d+12;for(const o of e){const e=o.__arcData;if(!e)continue;const i=t?t(o):o.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,s=r-Math.PI/2;w.push({x:h+Math.cos(s)*n,y:g+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function dc(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const i=[];let r=0;for(;n.length>r;){const e=n[r];if("M"===e||"L"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("C"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;3>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("Q"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;2>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("A"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&(i.push(Number(n[r])+t+""),r++),n.length>r&&(i.push(Number(n[r])+o+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(n[r]),r++)}return i.join(" ")}const uc=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function hc(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>150?"#222":"#fff"}function gc(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function fc(e){return e?"function"==typeof e?e:t=>{var o;return(null===(o=t.data)||void 0===o?void 0:o[e])||t[e]||t.id}:null}function pc(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:uc}function yc(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function vc(e,t,o,n,i){if("horizontal"===i){const i=(e+o)/2;return`M ${e},${t} C ${i},${t} ${i},${n} ${o},${n}`}if("radial"===i){const i=(e+o)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+n)/2} T ${o},${n}`}{const i=(t+n)/2;return`M ${e},${t} C ${e},${i} ${o},${i} ${o},${n}`}}const mc={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){var i;const r=o.__hierarchyRoot;if(!r)return;const s=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),l=o.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,d=K(r,a);d.sum(c),d.sort((e,t)=>{var o,n;return(null!==(o=t.value)&&void 0!==o?o:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[u,h]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=oe();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,u,h);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=te();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,u,h);break;case"treemap":!function(e,t,o,n){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=J().size([o,n]).tile(ee).padding(s);a>0&&l.paddingTop(a),l(e)}(d,o,u,h);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;Z().size([o,n]).padding(r)(e)}(d,o,u,h);break;case"partition":!function(e,t,o,n){var i;Q().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(d,o,u,h)}const g=d.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const n=g[t],r={id:gc(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=n.value)&&void 0!==i?i:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===s||"cluster"===s?bc(r,n,o):"treemap"===s||"partition"===s?xc(r,n):"circlepack"===s&&kc(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===s||"cluster"===s)for(const e of g)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const i=o.nodeStyle||(()=>({})),r=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,i,r){var s,a,l,c,d,u,h,g;const f=[],p=[],y=[],v=o.treeOrientation||"vertical",m="radial"===v,b=n[0]/2,x=n[1]/2,k="number"==typeof(w=o.nodeSize)?w:5;var w;for(const t of e){let e=t.x,n=t.y;m&&(e+=b,n+=x);const r=i(ec(t,"nodeStyle"));let l=r.fill||yc(o);if(o.colorByDepth&&void 0!==t.depth){const e=pc(o);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=o.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:n,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=o.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=t.x,s=t.y,a=n.x,l=n.y;m&&(i+=b,s+=x,a+=b,l+=x);const g=vc(i,s,a,l,v),f=r(ec(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(d=o.themeSemantic)||void 0===d?void 0:d.secondary)||"#999",strokeWidth:null!==(u=f.strokeWidth)&&void 0!==u?u:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=fc(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,i,r,s=o.x,a=o.y;if(m&&(s+=b,a+=x),m){const e=s-b,t=a-x,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,i=a+t/o*10,r=0>e?"end":"start"):(n=s,i=a-12,r="middle")}else"horizontal"===v?((null===(g=o.data)||void 0===g?void 0:g.children)&&0!==o.data.children.length?(n=s-k-6,r="end"):(n=s+k+6,r="start"),i=a):(n=s,i=a+k+14,r="middle");y.push({x:n,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,o,n,i,r);case"treemap":case"partition":return function(e,t,o,n){var i,r,s,a,l;const c=[],d=[];for(const o of e){const e=o.x1-o.x0,s=o.y1-o.y0;if(0>=e||0>=s)continue;const a=n(ec(o,"nodeStyle"));let l=a.fill||yc(t);if(t.colorByDepth&&void 0!==o.depth){const e=pc(t);l=e[o.depth%e.length]}const d={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:o.x0,y:o.y0,w:e,h:s,style:d,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=fc(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,u=c.y1-c.y0;if(0>=e||0>=u)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=o?o(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>u)continue;let f=n(ec(c,"nodeStyle")).fill||yc(t);if(t.colorByDepth&&void 0!==c.depth){const e=pc(t);f=e[c.depth%e.length]}const p="string"==typeof f?hc(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";d.push(h?{x:c.x0+e/2,y:c.y0+u/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,u)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:d}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,d,u,h,g;const f=[],p=[];for(const o of e){const e=null!==(i=o.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=n(ec(o,"nodeStyle"));let c=l.fill||yc(t);if(t.colorByDepth&&void 0!==o.depth){const e=pc(t);c=e[o.depth%e.length]}const d={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.7};f.push({type:"circle",cx:o.x,cy:o.y,r:e,style:d,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=fc(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=o?o(i):i.id;if(!r)continue;if(15>e)continue;const s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=n(ec(i,"nodeStyle")).fill||yc(t);if(t.colorByDepth&&void 0!==i.depth){const e=pc(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?hc(a):null!==(u=null===(d=t.themeSemantic)||void 0===d?void 0:d.text)&&void 0!==u?u:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,o,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function bc(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function xc(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function kc(e,t){var o;const n=null!==(o=t.r)&&void 0!==o?o:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function wc(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Ac={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,s;const a=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var o;return(null!==(o=e[t])&&void 0!==o?o:"")+""}}(o.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),d=null!==(r=o.orbitSize)&&void 0!==r?r:2.95,u=null!==(s=o.orbitEccentricity)&&void 0!==s?s:1,h="number"==typeof d?()=>d:d,g="number"==typeof u?()=>u:u,f=wc(o);f.metaMap.clear(),n.length=0,i.length=0;const p=new Map;function y(e){var t;const o=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,o+1),0===o?e:`${e}__${o}`}const v=t[0]/2,m=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));n.push({id:x,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,s,d,u,p){const v=a(t);if(!(null==v?void 0:v.length))return;const m=v.length;let b=0,x=0,k=0;for(;m>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let m=0;b>m;m++){const x=c[Math.min(m,c.length-1)],k=v.slice(w,w+x);if(!k.length)break;const A=(m+1)/b,S={id:o,depth:u,data:t,parentId:o},O=p?d/h(S)*A:d*A,_=W().value(e=>{var t;return(null===(t=a(e))||void 0===t?void 0:t.length)?4:1}).sort(null),C=_(k),j=g(S);for(let t=0;k.length>t;t++){const a=(C[t].startAngle+C[t].endAngle)/2,c=k[t],d=y(l(c)),h=r+O*Math.sin(a),g=s+O*Math.cos(a)*j;n.push({id:d,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:u,data:c}),f.metaMap.set(d,{ring:O,angle:a,depth:u,parentId:o,eccentricity:j}),i.push({source:o,target:d,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:d}}),e(c,d,h,g,O,u+1,!0)}w+=x}}(e,x,v,m,b,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,d;const u=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=wc(o),n=new Map;for(const t of e)n.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;i.has(o)||i.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of i)for(let i=0;r>i;i++){const a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(l),y2:t+o*Math.cos(l)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(ec(t,"nodeSize")),n=u?u(ec(t,"nodeStyle")):{},c={fill:n.fill||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:v.get(e.source),o="object"==typeof e.target?e.target:v.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=g(ec(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(d=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==d?d:o.id;y.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,o,n,i)=>!1!==o.orbitAnimated&&(function(e,t){var o,n;const i=wc(t),r=null!==(o=t.orbitSpeed)&&void 0!==o?o:.25,s=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const o=null!==(t=e.depth)&&void 0!==t?t:0;return(o%2==0?1:-1)/(o+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const o=c.get(e.parentId);if(!o)continue;const n=e.angle+a*l*s({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=o.x+e.ring*Math.sin(n),t.y=o.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)},Sc={sankey:nc,force:ic,chord:cc,tree:mc,cluster:mc,treemap:mc,circlepack:mc,partition:mc,orbit:Ac};function Oc(e){return Sc[e]}class _c{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},rl),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new al(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},rl),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new al(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:s="value"}=this.config,a="function"==typeof n?n:e=>e[n],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],d="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Cc(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=d(o),s=null==r?NaN:Number(r),a=Number.isFinite(s)?s:1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Cc(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Cc(i)),{data:o}));const u=`${n}\0${i}\0${e}`,h={source:n,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:u};o&&"object"==typeof o&&jc(o.bezier)&&(h.bezier=o.bezier),this.edges.set(u,h)}this.runLayout(o)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,i=0===this.nodes.size;let r=!1;const s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Cc(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,Cc(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,o,n,i,r,s,a,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=Oc(this.config.chartType);if(!c)return;let d=Array.from(this.nodes.values());const u=Array.from(this.edges.values());if(0===d.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of d)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(o=a._prevX0)&&void 0!==o?o:0),c=(null!==(n=a._prevY1)&&void 0!==n?n:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(d,u,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&d.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of d)this.nodes.set(e.id,e);for(let e=0;u.length>e;e++){const t=u[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,d=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=d.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&d.length>0&&f>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}buildScene(e){var t,o,n,i,r,s;const a=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=Qs(this.config.colorScheme,this.config.themeCategorical,qe),d={nodes:a,edges:l,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...c]},resolveColor:Zs(c),config:null!==(o=this.config.layoutConfig)&&void 0!==o?o:{}};let u;try{u=this.config.customNetworkLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(n=u.sceneNodes)&&void 0!==n?n:[],this.sceneEdges=null!==(i=u.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=u.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(s=u.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const c=Oc(this.config.chartType);if(!c)return;const{sceneNodes:d,sceneEdges:u,labels:h}=c.buildScene(a,l,this.config,e);this.sceneNodes=d,this.sceneEdges=u,this.labels=h}get isAnimating(){const e=Oc(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=Oc(this.config.chartType);if(!(null==o?void 0:o.tick))return!1;const n=Array.from(this.nodes.values()),i=Array.from(this.edges.values());return o.tick(n,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=At(e,this.transition),o=wt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,o),e.x1=St(e._prevX1,e._targetX1,o),e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=null==e?void 0:e.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,o="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&o&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,o))}buildStandardBezier(e,t,o){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:n}}const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const i=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,s=o.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},o])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,o,n,i,r;const s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(o=s.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",c=null!==(n=s.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const n=this.nodeTimestamps.get(o);if(!n)continue;const i=e-n;a>i&&(t._pulseIntensity=1-i/a,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const o=t.datum;if(!o)continue;const n="object"==typeof o.source?null===(i=o.source)||void 0===i?void 0:i.id:o.source,s="object"==typeof o.target?null===(r=o.target)||void 0===r?void 0:r.id:o.target;if(!n||!s)continue;const c=this.edgeTimestamps.get(`${n}\0${s}`);if(!c)continue;const d=e-c;a>d&&(t._pulseIntensity=1-d/a,t._pulseColor=l)}}applyDecay(){var e,t;const o=this.config.decay;if(!o)return;const n=this.nodeTimestamps.size;if(1>=n)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const i=this._decaySortedNodes,r=new Map;for(let e=0;i.length>e;e++)r.set(i[e][0],e);for(const i of this.sceneNodes){const s=i.id;if(!s)continue;const a=r.get(s);if(void 0===a)continue;const l=xt(o,a,n),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const o=e-this.lastTopologyChangeTime;if(o>=2e3)return;const n=1-o/2e3;for(const e of this.sceneNodes){const o=e.id;o&&this.addedNodes.has(o)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,o;const n=this.config.thresholds;if(!n)return;const i=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(o=n.criticalColor)&&void 0!==o?o:"#ef4444",s=!1!==n.pulse;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const a=this.nodes.get(o);if(!a)continue;const l=n.metric(a);let c=null;void 0===n.critical||n.critical>l?void 0===n.warning||n.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const o=e.metric(t);if(void 0!==e.warning&&o>=e.warning||void 0!==e.critical&&o>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const o="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>o-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var o;const n=this.nodes.get(e);if(!n)return null;const i=n.data?Object.assign({},n.data):{};return n.data=t(null!==(o=n.data)&&void 0!==o?o:{}),this.layoutVersion++,i}updateEdge(e,t,o){var n;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=o(null!==(n=i.data)&&void 0!==n?n:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&this.layoutVersion++,s}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&n(i.data)===e&&o.push(t)}else for(const[n,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&this.layoutVersion++,o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Cc(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function jc(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!Mc(e))return!1;return!0}return Mc(t.points)}function Mc(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function Pc(e,t,o,n,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=Lc(t,o,n,i);if(e)if("rect"===t.type){const o=t.w*t.h;a>o&&(r=e,a=o)}else s>e.distance&&(r=e,s=e.distance)}if(r)return r;for(const e of t){const t=Dc(e,o,n);t&&s>t.distance&&(r=t,s=t.distance)}return r}function Lc(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const i=t-e.cx,r=o-e.cy,s=Math.sqrt(i*i+r*r);return s>Nt(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=Bt(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const s=It(Math.atan2(i,n)),a=It(e.startAngle),l=It(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);default:return null}}let Tc=null,Bc=null;function Nc(){return Bc||(Tc=document.createElement("canvas"),Tc.width=1,Tc.height=1,Bc=Tc.getContext("2d")),Bc}function Ec(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function Dc(e,t,o){switch(e.type){case"bezier":return function(e,t,o){var n,i;if(!e.pathD)return null;const r=Ec(e),s=Nc();if(!r||!s)return null;try{if(s.isPointInPath(r,t,o)){const r="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,s="object"==typeof(null===(i=e.datum)||void 0===i?void 0:i.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:r&&s?(r.x1+s.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:o,distance:0}}const a=s.lineWidth;s.lineWidth=10;const l=s.isPointInStroke(r,t,o);if(s.lineWidth=a,l)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,i=e.y2-e.y1,r=n*n+i*i;if(0===r)return null;let s=((t-e.x1)*n+(o-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*i,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(o-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=Ec(e),i=Nc();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);default:return null}}function Ic(i){const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,labels:d,title:u,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:v="right",foregroundGraphics:m,sceneNodes:b,annotations:x,svgAnnotationRules:k}=i;return t(o,{children:[t("svg",{role:"img",width:a,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof u?u:"Network Chart"}),e("desc",{children:"string"==typeof u?u+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[d.map((t,o)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+o)),x&&x.filter(e=>"widget"!==e.type).map((t,o)=>{if(k){const i=k(t,o,{width:r,height:s,sceneNodes:b});if(i)return e(n.Fragment,{children:i},"annotation-"+o)}return null}),m]}),u&&"string"==typeof u?e("text",{x:a/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor",children:u}):u?e("foreignObject",{x:0,y:0,width:a,height:c.top,children:u}):null,Co({legend:h,totalWidth:a,totalHeight:l,margin:c,legendPosition:v,title:u,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==x?void 0:x.filter(e=>"widget"===e.type&&e.nodeId&&b).map((t,o)=>{var n,i,r,s,a,l,d,u,h;const g=b.find(e=>{var o,n,i,r,s;return e.id===t.nodeId||(null===(o=e.datum)||void 0===o?void 0:o.id)===t.nodeId||(null===(i=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!g)return null;const f=c.left+(null!==(n=g.cx)&&void 0!==n?n:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(i=g.x)&&void 0!==i?i:0),p=c.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),y=null!==(a=t.dx)&&void 0!==a?a:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,m=null!==(d=t.width)&&void 0!==d?d:32,x=null!==(u=t.height)&&void 0!==u?u:32,k=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{style:{position:"absolute",left:f+y-m/2,top:p+v-x/2,width:m,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+o)})]})}function Hc(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Rc(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=Hc(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=qt(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Wc(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=qt(e,i)||i,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Fc(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=Hc(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function zc(e,t){var o,n;if(!t.pathD)return;e.save();const i=Hc(t),r=t.style.stroke||"#999";e.strokeStyle=qt(e,r)||r,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}Ic.displayName="NetworkSVGOverlay";const $c={top:20,right:80,bottom:20,left:80},Yc={top:40,right:40,bottom:40,left:40},Gc=new Set(["chord","force","circlepack","orbit"]),qc=[800,600],Xc={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Vc({data:o}){var n,i,r,s,a,l;if("edge"===o.nodeOrEdge){const e=o.data;return e?t("div",{className:"semiotic-tooltip",style:Xc,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=o.data;if(!c)return null;const d=c.__hierarchyNode;if(d){const o=[];let a=d;for(;a;){const e=null!==(s=null!==(i=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==i?i:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==s?s:c.id;null!=e&&o.unshift(e+""),a=a.parent}o.length>1&&o.shift();const l=o.length-1;return t("div",{className:"semiotic-tooltip",style:Xc,children:[e("div",{children:o.map((o,n)=>t("span",{children:[n>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===l?e("strong",{children:o}):e("span",{style:{opacity:.7},children:o})]},n))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const u=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:Xc,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),u>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",u,h!==u&&` (weighted: ${h.toLocaleString()})`]})]})}const Uc=g(function(o,n){var a,c,d,h,g,f,y,v,m,b,x,k,w,A,S,O,_,C;const{chartType:j,nodes:M,edges:P,data:L,initialEdges:T,nodeIDAccessor:B="id",sourceAccessor:N="source",targetAccessor:E="target",valueAccessor:D="value",edgeIdAccessor:I,childrenAccessor:H,hierarchySum:W,orientation:F="horizontal",nodeAlign:z="justify",nodePaddingRatio:$=.05,nodeWidth:Y=15,iterations:G=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:V=20,sortGroups:U,edgeSort:K,treeOrientation:Q="vertical",edgeType:Z="curve",padding:J,paddingTop:ee,tensionConfig:te,showParticles:oe=!1,particleStyle:ne,nodeStyle:ie,edgeStyle:re,colorBy:se,colorScheme:ae="category10",edgeColorBy:le="source",edgeOpacity:ce=.5,colorByDepth:de=!1,nodeSize:ue=8,nodeSizeRange:he=[5,20],nodeLabel:ge,showLabels:pe=!0,labelMode:ye,size:ve=qc,responsiveWidth:me,responsiveHeight:be,margin:xe,className:we,background:Ae,enableHover:Se=!0,tooltipContent:Oe,customHoverBehavior:_e,customClickBehavior:Ce,onObservation:je,chartId:Me,onTopologyChange:Pe,annotations:Le,svgAnnotationRules:Te,legend:Be,legendPosition:Ne,legendHoverBehavior:Ee,legendClickBehavior:De,legendHighlightedCategory:Ie,legendIsolatedCategories:He,title:Re,foregroundGraphics:We,backgroundGraphics:Fe,decay:ze,pulse:$e,transition:Ye,animate:Ge,staleness:qe,thresholds:Xe,accessibleTable:Ve=!0,description:Ue,summary:Ke,orbitMode:Qe,orbitSize:Ze,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:ot,orbitShowRings:nt,orbitAnimated:it,customNetworkLayout:rt,layoutConfig:st}=o,at=Gc.has(j)?Yc:$c,lt=i(!0),ct=oi({sizeProp:ve,responsiveWidth:me,responsiveHeight:be,userMargin:xe,marginDefault:at,foregroundGraphics:We,backgroundGraphics:Fe,animate:Ge,transitionProp:Ye,themeDirtyRef:lt}),{reducedMotionRef:dt,responsiveRef:ut,size:ht,margin:ft,adjustedWidth:pt,adjustedHeight:yt,resolvedForeground:vt,resolvedBackground:mt,transition:bt,introEnabled:xt,tableId:kt,rafRef:wt,renderFnRef:At,scheduleRender:St,currentTheme:Ot}=ct,_t=gn(),Ct=vn(),jt=r(()=>fe(M),[M]),Mt=r(()=>Array.isArray(P)?fe(P):P,[P]),Pt=r(()=>Object.assign(Object.assign({},rl),te),[te]),Lt=r(()=>Object.assign(Object.assign({},sl),ne),[ne]),Bt=r(()=>{var e;return{chartType:j,nodeIDAccessor:B,sourceAccessor:N,targetAccessor:E,valueAccessor:D,edgeIdAccessor:I,childrenAccessor:H,hierarchySum:W,orientation:F,nodeAlign:z,nodePaddingRatio:$,nodeWidth:Y,iterations:G,forceStrength:q,padAngle:X,groupWidth:V,sortGroups:U,edgeSort:K,treeOrientation:Q,edgeType:Z,padding:J,paddingTop:ee,tensionConfig:Pt,showParticles:oe,particleStyle:Lt,nodeStyle:ie,edgeStyle:re,nodeLabel:ge,showLabels:pe,labelMode:ye,colorBy:se,colorScheme:ae,themeCategorical:null===(e=null==Ot?void 0:Ot.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Ot),edgeColorBy:le,edgeOpacity:ce,colorByDepth:de,nodeSize:ue,nodeSizeRange:he,decay:ze,pulse:$e,transition:bt,introAnimation:xt,staleness:qe,thresholds:Xe,orbitMode:Qe,orbitSize:Ze,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:ot,orbitShowRings:nt,orbitAnimated:it,customNetworkLayout:rt,layoutConfig:st}},[j,B,N,E,D,H,W,F,z,$,Y,G,q,X,V,U,K,Q,Z,J,ee,Pt,oe,Lt,ie,re,ge,pe,ye,se,ae,le,ce,de,ue,he,ze,$e,null==bt?void 0:bt.duration,null==bt?void 0:bt.easing,xt,qe,Xe,Qe,Ze,Je,et,tt,ot,nt,it,Ot,rt,st]),Nt=bn(Bt),Et=i(null),Dt=i(0),It=i(0),Ht=i(!1),Rt=i(null);Rt.current||(Rt.current=new _c(Nt));const[Wt,Ft]=u(null),[zt,$t]=u(0),[Yt,Gt]=u(0),[Xt,Vt]=u(!1),[Ut,Kt]=u(null),Qt=i(null),Zt=i(new Map),Jt=i(0),eo=l(e=>{if("function"==typeof se)return se(e)+"";if("string"==typeof se&&e.data){const t=e.data[se];if(void 0!==t){if(!Zt.current.has(t+"")){const e=Array.isArray(ae)?ae:gt;Zt.current.set(t+"",e[Jt.current++%e.length])}return Zt.current.get(t+"")}}if(Zt.current.has(e.id))return Zt.current.get(e.id);const t=Array.isArray(ae)?ae:gt,o=se?t[Jt.current++%t.length]:t[0];return Zt.current.set(e.id,o),o},[se,ae]),to=(null===(a=null==Ot?void 0:Ot.colors)||void 0===a?void 0:a.border)||(null===(c=null==Ot?void 0:Ot.colors)||void 0===c?void 0:c.secondary)||(null===(d=null==Ot?void 0:Ot.colors)||void 0===d?void 0:d.primary)||"#999",oo=l(e=>{var t,o;return e?"object"==typeof e?e:null!==(o=null===(t=Rt.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==o?o:null:null},[]),no=l(e=>{if("function"==typeof le)return le(e);const t=oo(e.source),o=oo(e.target);return"target"===le&&o?eo(o):t?eo(t):to},[le,eo,to,oo]),io=l(e=>{if("function"==typeof Lt.color){const t=oo(e.source);return t?Lt.color(e,t):to}if(!(null==ne?void 0:ne.colorBy))return no(e);const t=Lt.colorBy,o=oo(e.source),n=oo(e.target);return"target"===t&&n?eo(n):o?eo(o):to},[null==ne?void 0:ne.colorBy,Lt.color,Lt.colorBy,eo,no,to,oo]),ro=("sankey"===j||!!rt)&&oe||!!$e||null!==(g=null===(h=Rt.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;s(()=>{var e;null===(e=Rt.current)||void 0===e||e.updateConfig(Nt),lt.current=!0,St()},[Nt,St]);const so=l(()=>{var e,t;Kt(null!==(t=null===(e=Rt.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);s(()=>{var e;const t=Rt.current;if(t){t.buildScene([pt,yt]),so();for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);lt.current=!0,St()}},[Ot,pt,yt,St,so]);const ao=l(()=>{var e;const t=Rt.current;if(!t)return;t.runLayout([pt,yt]),t.buildScene([pt,yt]),so(),lt.current=!0;for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);const o=Array.isArray(ae)?ae:gt,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];Zt.current.has(t.id)||Zt.current.set(t.id,o[e%o.length])}if(Jt.current=n.length,$t(t.layoutVersion),Pe){const{nodes:e,edges:o}=t.getLayoutData();Pe(e,o)}},[pt,yt,Pe,ae,so]),lo=l(e=>{if(null==e||"object"!=typeof e)return;const t=Rt.current;t&&(t.ingestEdge(e)&&ao(),St())},[ao,St]),co=l(e=>{const t=Rt.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&ao(),St()},[ao,St]),fo=l(()=>{var e;null===(e=Rt.current)||void 0===e||e.clear(),Zt.current.clear(),Jt.current=0,$t(0),Ft(null),Qt.current=null,lt.current=!0,St()},[St]),yo=l(()=>{const e=Rt.current;e&&(e.tension+=999,ao(),St())},[ao,St]);p(n,()=>({push:lo,pushMany:co,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=Rt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==o&&o;if(i){const t=(null===(n=Qt.current)||void 0===n?void 0:n.data)?"function"==typeof B?B(Qt.current.data):Qt.current.data[B]:void 0;Qt.current&&"node"===Qt.current.nodeOrEdge&&t===e&&(Qt.current=null,Ft(null)),Zt.current.delete(e),ao(),lt.current=!0,St()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=Rt.current)||void 0===o?void 0:o.removeEdge(e,t))&&void 0!==n&&n;if(i){if(Qt.current&&"edge"===Qt.current.nodeOrEdge){const o=Qt.current.data;let n;n=void 0!==t?("object"==typeof(null==o?void 0:o.source)?o.source.id:null==o?void 0:o.source)===e&&("object"==typeof(null==o?void 0:o.target)?o.target.id:null==o?void 0:o.target)===t:!I||!o||("function"==typeof I?I:e=>null==e?void 0:e[I])(o)===e,n&&(Qt.current=null,Ft(null))}ao(),lt.current=!0,St()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=Rt.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(lt.current=!0,St()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=Rt.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(ao(),lt.current=!0,St()),r},clear:fo,getTopology:()=>{var e,t;return null!==(t=null===(e=Rt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Rt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:yo,getTension:()=>{var e,t;return null!==(t=null===(e=Rt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[lo,co,fo,yo,ao,St]);const mo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(j),bo=mo?L||(Array.isArray(P)?void 0:P):void 0;s(()=>{var e;const t=Rt.current;if(t)if(mo&&bo)t.ingestHierarchy(bo,[pt,yt]),t.buildScene([pt,yt]),so(),lt.current=!0,St();else{const o=jt,n=Array.isArray(Mt)?Mt:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[pt,yt]),t.buildScene([pt,yt]),so();for(const o of t.sceneNodes)o.id&&(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill+"");const i=Array.isArray(ae)?ae:gt,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];Zt.current.has(t.id)||Zt.current.set(t.id,i[e%i.length])}Jt.current=r.length,lt.current=!0,St()}},[jt,Mt,L,bo,mo,pt,yt,Nt,St,ae,so]),s(()=>{T&&T.length>0&&co(T)},[]);const xo=l(e=>{if(_e&&_e(e),je){const t=Date.now();je(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Me}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Me})}},[_e,je,Me]),ko=l(e=>{if(Ce&&Ce(e),je){const t=Date.now();je(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Me}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Me})}},[Ce,je,Me]),{hoverHandlerRef:wo,hoverLeaveRef:Ao,onPointerMove:So,onPointerLeave:Oo}=ct;wo.current=e=>{if(!Se)return;const t=Et.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return void(Qt.current&&(Qt.current=null,Ft(null),xo&&(xo(null),lt.current=!0),St()));const r=Rt.current;if(!r)return;const s=Pc(r.sceneNodes,r.sceneEdges,n,i);if(!s)return void(Qt.current&&(Qt.current=null,Ft(null),xo&&(xo(null),lt.current=!0),St()));const a=bi(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Qt.current=a,Ft(a),xo&&(xo(a),lt.current=!0),St()},Ao.current=()=>{Qt.current&&(Qt.current=null,Ft(null),xo&&(xo(null),lt.current=!0),St())};const _o=i(()=>{});_o.current=e=>{if(!Ce&&!je)return;const t=Et.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return;const r=Rt.current;if(!r)return;const s=Pc(r.sceneNodes,r.sceneEdges,n,i);ko(s?bi(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const Co=l(e=>_o.current(e),[]),jo=i(-1),Mo=i(null),Po=i(-1),Lo=l(e=>{var t;const o=Rt.current;if(!o)return;const n=function(e){var t,o,n,i,r,s;const a=[];for(const l of e)if("circle"===l.type&&null!=l.cx){if(0>=l.r)continue;a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(o=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==o?o:"_default"})}else if("rect"===l.type&&null!=l.x){if(0>=l.w||0>=l.h)continue;a.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(n=l.datum)||void 0===n?void 0:n.id)&&void 0!==i?i:"_default"})}else"arc"===l.type&&null!=l.cx&&a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(s=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});return a.sort((e,t)=>e.x-t.x||e.y-t.y),a}(o.sceneNodes);if(0===n.length)return;const i=uo(n),r=jo.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),jo.current=0,Po.current=-1;const t=i.flat[0];Mo.current={shape:t.shape,w:t.w,h:t.h};const o=bi(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Qt.current=o,Ft(o),xo&&(xo(o),lt.current=!0),void St()}const s=ho(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return go(e,t,o);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(s=function(e,t,o){let n=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const d=a*a+l*l;i>d&&(i=d,n=r)}return n}(o,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s:t.flatIndex;return n!==t.flatIndex&&(i.current=-1),n}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var o;const n=e+"",i=[];for(const e of t){const t=null!==(o=e.datum)&&void 0!==o?o:e,r=po(t.source),s=po(t.target),a=null!=r,l=null!=s;a&&r+""===n&&l?i.push(s+""):l&&s+""===n&&a&&i.push(r+"")}return i}(c,n);if(0===e.length)return t.flatIndex;const r=null!==(a=o.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const n=go(e,t,o);return null!==n&&n!==t.flatIndex&&(i.current=-1),n}}}(e.key,s,i,null!==(t=o.sceneEdges)&&void 0!==t?t:[],Po);if(null===a)return;if(e.preventDefault(),0>a)return jo.current=-1,Mo.current=null,Po.current=-1,Qt.current=null,Ft(null),xo&&(xo(null),lt.current=!0),void St();jo.current=a;const l=i.flat[a];Mo.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Qt.current=c,Ft(c),xo&&(xo(c),lt.current=!0),St()},[xo,St]),To=l(e=>{jo.current=-1,Mo.current=null,So(e)},[So]);At.current=()=>{var e,t,o,n,i,r,s;wt.current=0;const a=Et.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=Rt.current;if(!c)return;const d=performance.now(),u=Dt.current?Math.min((d-Dt.current)/1e3,.1):.016;Dt.current=d;const h=c.advanceTransition(dt.current?d+1e6:d),g=!dt.current&&h,f=!dt.current&&c.tickAnimation([pt,yt],u);(h||lt.current||f)&&c.buildScene([pt,yt]);const p=ii();if(!ni(a,ht,ft,p))return;if(l.clearRect(-ft.left,-ft.top,ht[0],ht[1]),Ae){const e=qt(l,Ae);e&&(l.fillStyle=e,l.fillRect(0,0,pt,yt))}ze&&c.applyDecay(),$e&&c.applyPulse(d),Xe&&c.applyThresholds(d),c.applyTopologyDiff(d);const y=null!==(e=null==qe?void 0:qe.threshold)&&void 0!==e?e:5e3,v=qe&&c.lastIngestTime>0&&d-c.lastIngestTime>y;if(v&&(l.globalAlpha=null!==(t=null==qe?void 0:qe.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":Rc(e,o);break;case"line":Wc(e,o);break;case"ribbon":Fc(e,o);break;case"curved":zc(e,o)}}(l,c.sceneEdges),function(e,t){var o,n,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),ci(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),di(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),oe&&c.particlePool&&!v){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,o,n){var i,r;const s=null!==(i=n.spawnRate)&&void 0!==i?i:sl.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:sl.maxPerEdge;for(let n=0;t.length>n;n++){const i=t[n];if(!i.bezier)continue;if(e.countForEdge(n)>=a)continue;const r=i.value*s*o*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let d=l;Math.random()<c&&d++;for(let t=0;d>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,u,Lt);const t=.5*(null!==(o=Lt.speedMultiplier)&&void 0!==o?o:1);let n;if(Lt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(u,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:sl.radius,l=null!==(s=n.opacity)&&void 0!==s?s:sl.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=o[s.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:i(l),e.fillStyle=qt(e,c)||c,e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,Lt,io)}}v&&(l.globalAlpha=1);const m=lt.current;if(lt.current=!1,m||g||f){const e=Et.current;e&&e.setAttribute("aria-label",jn(null!==(i=null===(n=c.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}const b=m||g||f||Ht.current;b&&d-It.current>=33?(Gt(e=>e+1),It.current=d,Ht.current=!1):Ht.current=!!b,(ro||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Ht.current)&&(wt.current=requestAnimationFrame(()=>At.current()))},mn({hydrated:_t,wasHydratingFromSSR:Ct,storeRef:Rt,dirtyRef:lt,renderFnRef:At}),s(()=>{lt.current=!0,St()},[j,pt,yt,Ae,St]),vo(qe,Rt,lt,St,Xt,Vt);const Bo=Se&&Wt?e(Qn,{x:Wt.x,y:Wt.y,containerWidth:pt,containerHeight:yt,margin:ft,className:"stream-network-tooltip",zIndex:2,children:Oe?Oe(Wt):e(Vc,{data:Wt})}):null;if(un||!_t&&Ct){const o=Rt.current;if(o){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(j),t=e?L||(Array.isArray(P)?void 0:P):void 0;if(e&&t)o.ingestHierarchy(t,[pt,yt]),o.buildScene([pt,yt]);else{const e=jt,t=Array.isArray(Mt)?Mt:[];(e.length>0||t.length>0)&&(o.ingestBounded(e,t,[pt,yt]),o.buildScene([pt,yt]))}}const n=null!==(f=null==o?void 0:o.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==o?void 0:o.sceneEdges)&&void 0!==y?y:[],r=null!==(v=null==o?void 0:o.labels)&&void 0!==v?v:[];return t("div",{ref:ut,className:"stream-network-frame"+(we?" "+we:""),role:"img","aria-label":Ue||("string"==typeof Re?Re:"Network chart"),style:{position:"relative",width:me?"100%":ht[0],height:be?"100%":ht[1]},children:[e(Rn,{summary:Ke}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ht[0],height:ht[1],style:{position:"absolute",left:0,top:0},children:[mt&&e("g",{transform:`translate(${ft.left},${ft.top})`,children:mt}),t("g",{transform:`translate(${ft.left},${ft.top})`,children:[Ae&&e("rect",{x:0,y:0,width:pt,height:yt,fill:Ae}),i.map((t,o)=>function(t,o){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e("path",{d:n.pathD,fill:dn(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"ribbon":{const n=t;return e("path",{d:n.pathD,fill:dn(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"curved":{const n=t;return e("path",{d:n.pathD,fill:dn(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+o)}default:return null}}(t,o)).filter(Boolean),n.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:dn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+o)}case"rect":{const n=t;return e("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:dn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=R().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(cn)||"";return e("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:dn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+o)}default:return null}}(t,o)).filter(Boolean),r.map((t,o)=>function(t,o){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+o)}(t,o)).filter(Boolean)]})]}),e(Ic,{width:pt,height:yt,totalWidth:ht[0],totalHeight:ht[1],margin:ft,labels:r,sceneNodes:n,title:Re,legend:Be,legendPosition:Ne,legendHoverBehavior:Ee,legendClickBehavior:De,legendHighlightedCategory:Ie,legendIsolatedCategories:He,foregroundGraphics:Tt(vt,null===(m=Rt.current)||void 0===m?void 0:m.customLayoutOverlays),annotations:Le,svgAnnotationRules:Te,annotationFrame:0})]})}const No=Rt.current;return t("div",{ref:ut,className:"stream-network-frame"+(we?" "+we:""),role:"group","aria-label":Ue||("string"==typeof Re?Re:"Network chart"),tabIndex:0,style:{position:"relative",width:me?"100%":ht[0],height:be?"100%":ht[1],overflow:"visible"},onKeyDown:Lo,children:[Ve&&e(Wn,{tableId:kt}),Ve&&e(Hn,{nodes:null!==(b=null==No?void 0:No.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==No?void 0:No.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:kt,chartTitle:"string"==typeof Re?Re:void 0}),e(Rn,{summary:Ke}),t("div",{role:"img","aria-label":Ue||("string"==typeof Re?Re:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?To:void 0,onMouseLeave:Se?Oo:void 0,onClick:Ce||je?Co:void 0,children:[mt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ht[0],height:ht[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${ft.left},${ft.top})`,children:mt})}),e("canvas",{ref:Et,"aria-label":jn(null!==(w=null===(k=null==No?void 0:No.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==No?void 0:No.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Fn,{hoverPoint:Wt}),e(Ic,{width:pt,height:yt,totalWidth:ht[0],totalHeight:ht[1],margin:ft,labels:(null==No?void 0:No.labels)||[],sceneNodes:null==No?void 0:No.sceneNodes,title:Re,legend:Be,legendPosition:Ne,legendHoverBehavior:Ee,legendClickBehavior:De,legendHighlightedCategory:Ie,legendIsolatedCategories:He,foregroundGraphics:Tt(vt,Ut),annotations:Le,svgAnnotationRules:Te,annotationFrame:Yt}),e($n,{active:jo.current>=0,hoverPoint:Wt,margin:ft,size:ht,shape:null===(O=Mo.current)||void 0===O?void 0:O.shape,width:null===(_=Mo.current)||void 0===_?void 0:_.w,height:null===(C=Mo.current)||void 0===C?void 0:C.h}),Bo,(null==qe?void 0:qe.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===qe.badgePosition?{top:4,left:4}:"bottom-left"===qe.badgePosition?{bottom:4,left:4}:"bottom-right"===qe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Xt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Xt?"STALE":"LIVE"})]})]})});function Kc(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function Qc(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function Zc(e){return"function"==typeof e?e:t=>t[e]||1}function Jc({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=vt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=vt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function ed(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:i="source",targetAccessor:s="target",colorBy:a,colorScheme:l,showLegend:c,legendPosition:d,legendInteraction:u,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:v,marginDefaults:m,userMargin:b,width:x,height:k,loading:w,emptyContent:A,emptyDataKey:S="edges"}=e,O=r(()=>fe(o),[o]),_=r(()=>fe(t),[t]),C=Vr(w,x,k),j=C?null:Xr("nodes"===S?void 0===t?void 0:_:void 0===o?void 0:O,x,k,A),M=r(()=>n?Qc(_,O,i,s):_,[n,_,O,i,s]),P=Or(M,a,l),L=Ar(),T=r(()=>{if(Array.isArray(l))return l;if(L&&L.length>0)return L;if("string"==typeof l){const e=ht[l];if(Array.isArray(e)&&e.length>0)return e}return gt},[l,L]),B=r(()=>{if(!a)return[];const e=new Set;for(const t of M){const o="function"==typeof a?a(t):t[a];null!=o&&e.add(o+"")}return Array.from(e)},[M,a]),N=Pr(u,a,B),{legend:E,margin:D,legendPosition:I}=Mr({data:M,colorBy:a,colorScale:P,showLegend:c,legendPosition:d,userMargin:b,defaults:m,categories:B}),H=Cr({selection:h,linkedHover:g,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:v}),{customHoverBehavior:R,customClickBehavior:W,activeSelectionHook:F,hoverSelectionHook:z,crosshairSourceId:$}=H;return{safeNodes:M,safeEdges:O,colorScale:P,effectivePalette:T,themeCategorical:L,allCategories:B,legendState:N,legend:E,margin:D,legendPosition:I,customHoverBehavior:R,customClickBehavior:W,activeSelectionHook:F,hoverSelectionHook:z,crosshairSourceId:$,loadingEl:C,emptyEl:j}}Uc.displayName="StreamNetworkFrame";const td=g(function(t,o){var n;const s=i(null);as(o,{variant:"network",frameRef:s});const a=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:u,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:v,colorScheme:m,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:_,frameProps:C={},onObservation:j,onClick:M,chartId:P,selection:L,linkedHover:T,loading:B,emptyContent:N,legendInteraction:E,legendPosition:D,stroke:I,strokeWidth:H,opacity:R}=t,W=null!==(n=null!=h?h:g)&&void 0!==n?n:"id",{width:F,height:z,enableHover:$,showLegend:Y,showLabels:G=!1,title:q,description:X,summary:V,accessibleTable:U}=a,K=ed({nodes:l,edges:c,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:v,colorScheme:m,showLegend:Y,legendPosition:D,legendInteraction:E,selection:L,linkedHover:T,onObservation:j,onClick:M,chartType:"ForceDirectedGraph",chartId:P,marginDefaults:a.marginDefaults,userMargin:d,width:F,height:z,loading:B,emptyContent:N,emptyDataKey:"nodes"}),Q=r(()=>new Map,[]),Z=r(()=>e=>{const t={};return t.fill=v?vt(e.data||e,v,K.colorScale):Sr(void 0,K.themeCategorical,m,void 0,Q),"number"==typeof b&&(t.r=b),t},[v,K.colorScale,b,K.themeCategorical,m,Q]),J=r(()=>rs(Z,{stroke:I,strokeWidth:H,opacity:R}),[Z,I,H,R]),ee=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),te=r(()=>rs(ee,{stroke:I,strokeWidth:H,opacity:R}),[ee,I,H,R]),oe=r(()=>{if(G&&y)return"function"==typeof y?y:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==o?o:e[y])&&void 0!==n?n:e.id}},[G,y]),ne=os({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:W}});return ne?e(Wr,{componentName:"ForceDirectedGraph",message:ne,width:F,height:z}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:e(Yr,{componentName:"ForceDirectedGraph",width:F,height:z,children:e(Uc,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:K.safeNodes},null!=c&&{edges:K.safeEdges},{size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,nodeIDAccessor:W,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:J,edgeStyle:te,colorBy:v,colorScheme:K.effectivePalette,nodeSize:b,nodeSizeRange:x,nodeLabel:oe,showLabels:G,enableHover:$,tooltipContent:!1===_?()=>null:Kn(_)||void 0,customHoverBehavior:T||j||M?K.customHoverBehavior:void 0,customClickBehavior:j||M?K.customClickBehavior:void 0,legend:K.legend,legendPosition:K.legendPosition},E&&"none"!==E&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},{className:u,title:q,description:X,summary:V,accessibleTable:U},null!=t.animate&&{animate:t.animate},C))})});td.displayName="ForceDirectedGraph";const od=g(function(t,o){const n=i(null);as(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:v="source",padAngle:m=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:O,onClick:_,chartId:C,selection:j,linkedHover:M,loading:P,emptyContent:L,legendInteraction:T,stroke:B,strokeWidth:N,opacity:E}=t,{width:D,height:I,enableHover:H,showLabels:R=!0,title:W,description:F,summary:z,accessibleTable:$}=s,Y=ed({nodes:a,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:!1,legendInteraction:T,selection:j,linkedHover:M,onObservation:O,onClick:_,chartType:"ChordDiagram",chartId:C,marginDefaults:s.marginDefaults,userMargin:c,width:D,height:I,loading:P,emptyContent:L}),G=r(()=>new Map,[]),q=Y.safeNodes.length>0,X=r(()=>{if(q)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(p)i.fill=vt(e.data||e,p,Y.colorScale);else{const r=Array.isArray(y)?y:ht[y]||gt,s=Array.isArray(r)?r:gt,a=null!==(n=null!==(o=e.index)&&void 0!==o?o:t)&&void 0!==n?n:0;i.fill=s[a%s.length]}return i}},[q,p,Y.colorScale,y]),V=r(()=>X?rs(X,{stroke:B,strokeWidth:N,opacity:E}):void 0,[X,B,N,E]),U=r(()=>{if(q)return Jc({edgeColorBy:v,colorBy:p,colorScale:Y.colorScale,nodeStyleFn:V||(e=>({fill:Sr(void 0,Y.themeCategorical,y,void 0,G)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[q,v,p,Y.colorScale,V,w,Y.themeCategorical,y,G]),K=r(()=>U?rs(U,{stroke:B,strokeWidth:N,opacity:E}):void 0,[U,B,N,E]),Q=r(()=>{if(!R)return;const e=k||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[R,k,f]),Z=os({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return Z?e(Wr,{componentName:"ChordDiagram",message:Z,width:D,height:I}):Y.loadingEl?Y.loadingEl:Y.emptyEl?Y.emptyEl:e(Yr,{componentName:"ChordDiagram",width:D,height:I,children:e(Uc,Object.assign({ref:n,chartType:"chord"},Y.safeNodes.length>0&&{nodes:Y.safeNodes},null!=l&&{edges:Y.safeEdges},{size:[D,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y.margin,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:h,valueAccessor:g,padAngle:m,groupWidth:b,sortGroups:x,nodeStyle:V,edgeStyle:K,colorBy:p,colorScheme:Y.effectivePalette,edgeColorBy:v,edgeOpacity:w,nodeLabel:Q,showLabels:R,enableHover:H,tooltipContent:!1===A?()=>null:Kn(A)||void 0,customHoverBehavior:M||O||_?Y.customHoverBehavior:void 0,customClickBehavior:O||_?Y.customClickBehavior:void 0},T&&"none"!==T&&{legendHoverBehavior:Y.legendState.onLegendHover,legendClickBehavior:Y.legendState.onLegendClick,legendHighlightedCategory:Y.legendState.highlightedCategory,legendIsolatedCategories:Y.legendState.isolatedCategories},{className:d,title:W,description:F,summary:z,accessibleTable:$},null!=t.animate&&{animate:t.animate},S))})});od.displayName="ChordDiagram";const nd=g(function(t,o){const n=i(null);as(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:a,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:v="source",orientation:m="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:O,frameProps:_={},onObservation:C,onClick:j,chartId:M,selection:P,linkedHover:L,loading:T,emptyContent:B,legendInteraction:N,stroke:E,strokeWidth:D,opacity:I}=t,{width:H,height:R,enableHover:W,showLabels:F=!0,title:z,description:$,summary:Y,accessibleTable:G}=s,q=ed({nodes:a,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:void 0,legendInteraction:N,selection:P,linkedHover:L,onObservation:C,onClick:j,chartType:"SankeyDiagram",chartId:M,marginDefaults:s.marginDefaults,userMargin:c,width:H,height:R,loading:T,emptyContent:B}),X=r(()=>new Map,[]),V=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?vt(e.data||e,p,q.colorScale):Sr(void 0,q.themeCategorical,y,void 0,X),t},[p,q.colorScale,q.themeCategorical,y,X]),U=r(()=>rs(V,{stroke:E,strokeWidth:D,opacity:I}),[V,E,D,I]),K=r(()=>Jc({edgeColorBy:v,colorBy:p,colorScale:q.colorScale,nodeStyleFn:U,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[v,p,q.colorScale,U,A]),Q=r(()=>rs(K,{stroke:E,strokeWidth:D,opacity:I}),[K,E,D,I]),Z=r(()=>{if(!F)return;const e=w||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[F,w,f]),J=os({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return J?e(Wr,{componentName:"SankeyDiagram",message:J,width:H,height:R}):q.loadingEl?q.loadingEl:q.emptyEl?q.emptyEl:e(Yr,{componentName:"SankeyDiagram",width:H,height:R,children:e(Uc,Object.assign({ref:n,chartType:"sankey"},q.safeNodes.length>0&&{nodes:q.safeNodes},null!=l&&{edges:q.safeEdges},{size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q.margin,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:h,valueAccessor:g,orientation:m,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:U,edgeStyle:Q,colorBy:p,colorScheme:q.effectivePalette,edgeColorBy:v,edgeOpacity:A,edgeSort:S,nodeLabel:Z,showLabels:F,enableHover:W,tooltipContent:!1===O?()=>null:Kn(O)||void 0,customHoverBehavior:L||C||j?q.customHoverBehavior:void 0,customClickBehavior:C||j?q.customClickBehavior:void 0},N&&"none"!==N&&{legendHoverBehavior:q.legendState.onLegendHover,legendClickBehavior:q.legendState.onLegendClick,legendHighlightedCategory:q.legendState.highlightedCategory,legendIsolatedCategories:q.legendState.isolatedCategories},{className:d,title:z,description:$,summary:Y,accessibleTable:G},null!=t.animate&&{animate:t.animate},_))})});function id(e,t,o){const n=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of n)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{r.sort((e,t)=>{var o,n;return e.time-t.time||(null!==(o=s[e.kind])&&void 0!==o?o:99)-(null!==(n=s[t.kind])&&void 0!==n?n:99)})},l=r.length?Math.min(...r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,u=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;u.length>e;e++)h.set(u[e],u[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=d?d:e};a();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?p:y);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?p:y);if(n>0){const i=g(e.time);f.push({time:i,delta:-n,kind:"transfer-out",side:t}),f.push({time:i,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?p-=n:y-=n,"top"===e.side?p+=n:y+=n,o-=n}o>0&&null!==d&&(f.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?p+=o:y+=o)}"top"===e.side?p-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:y+=t}r.push(...f),a();let v=0,m=0,b=0,x=0,k=0;const w=[],A=new Map;for(const e of r){if(w.push({t:e.time,topMass:v,botMass:m}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?v:m;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?v+=e.delta:m+=e.delta,v+m>b&&(b=v+m),v>x&&(x=v),m>k&&(k=m),w.push({t:e.time,topMass:v,botMass:m})}const S=[];let O=0;for(;w.length>O;){let e=O;for(;w.length>e+1&&w[e+1].t===w[O].t;)e++;S.push(w[O]);for(let t=O+1;e>=t;t++){const e=S[S.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||S.push(w[t])}O=e+1}const _=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;if(S.length>0){const e=S[S.length-1];null!=_&&_>e.t&&e.topMass+e.botMass>0&&S.push({t:_,topMass:e.topMass,botMass:e.botMass});const t=S[0];null!=c&&t.t>c&&t.topMass+t.botMass>0&&S.unshift({t:c,topMass:t.topMass,botMass:t.botMass})}return{samples:S,peak:b,topPeak:x,botPeak:k,localAttachments:A}}function rd(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function sd(e,t){return e.map(e=>({t:rd(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function ad(e,t){let o=0;for(let n=0;t.length>n;n++)for(let i=n+1;t.length>i;i++){const r=t[n],s=t[i];r.source!==s.source&&r.target!==s.target&&r.source!==s.target&&r.target!==s.source&&(Math.min(r.endTime,s.endTime)>Math.max(r.startTime,s.startTime)&&e[s.source]>e[r.source]!=e[s.target]>e[r.target]&&o++)}return o}function ld(e,t){let o=0;for(const n of t)o+=Math.abs(e[n.source]-e[n.target])*(n.value||1);return o}function cd(e,t){return 1e3*ad(e,t)+ld(e,t)}function dd(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function ud(e,t,o){e.length>8||o.length>40?(function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=dd(e,t),s=cd(t,o);for(let a=0;n>a;a++){const n=Array(i).fill(0),a=Array(i).fill(0);for(const e of o){const o=t[e.source],i=t[e.target];n[o]+=i*(e.value||1),a[o]+=e.value||1,n[i]+=o*(e.value||1),a[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(a[e]>0?n[e]/a[e]:e)-(a[t]>0?n[t]/a[t]:t)),c=l.map(t=>e[t]),d=new Map;l.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t);const u=cd(t,o);if(s>u)s=u,r=dd(e,t);else if(u===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,r)}(e,t,o,6),function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=cd(t,o);for(let s=0;n>s;s++){let n=!1;for(let s=0;i-1>s;s++){const i=e[s];e[s]=e[s+1],e[s+1]=i;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=cd(t,o);if(r>a)r=a,n=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!n)break}}(e,t,o,6)):function(e,t,o){const n=e.length;if(1>=n)return;const i=Object.assign({},t),r=Object.keys(i),s=Array.from({length:n},(e,t)=>t),a=s.slice(),l=Object.assign({},i);let c=s.slice(),d=1/0;const u=()=>{for(const e of r)l[e]=a[i[e]];const e=cd(l,o);d>e&&(d=e,c=s.slice())},h=(e,t)=>{const o=s[e],n=s[t];s[e]=n,s[t]=o,a[o]=t,a[n]=e};u();const g=Array(n).fill(0);let f=0;for(;n>f;)f>g[f]?(h(f%2==0?0:g[f],f),u(),g[f]++,f=0):(g[f]=0,f++);const p=c.map(t=>e[t]),y=new Map;c.forEach((e,t)=>y.set(e,t));for(const e of Object.keys(t))t[e]=y.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,o)}function hd(e,t,o,n,i){var r,s,a,l,c,d,u,h;const{plotH:g,padding:f,valueScale:p,packing:y,laneOrder:v,lifetimeMode:m="full"}=i,b={},x={};for(const t of e)b[t.id]=o[t.id].topPeak||0,x[t.id]=o[t.id].botPeak||0;const k="half"===m,w={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){i>e.startTime&&(i=e.startTime);const t=k?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of n.incoming[t.id]){const t=k?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime)}w[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const A={},S=[];if("reuse"===y){const o=new Map;for(const t of e)o.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(null!==(r=i.get(e.target))&&void 0!==r?r:0)+1);const u=[];for(const t of e)0===(null!==(s=i.get(t.id))&&void 0!==s?s:0)&&u.push(t.id);for(;u.length;){const e=u.shift();for(const t of null!==(a=n.outgoing[e])&&void 0!==a?a:[]){const n=(null!==(l=o.get(e))&&void 0!==l?l:0)+1;n>(null!==(c=o.get(t.target))&&void 0!==c?c:0)&&o.set(t.target,n),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&u.push(t.target)}}const h=[...e].filter(e=>null!==w[e.id].start).sort((e,t)=>{var n,i;const r=null!==(n=o.get(e.id))&&void 0!==n?n:0,s=null!==(i=o.get(t.id))&&void 0!==i?i:0;return r!==s?r-s:w[e.id].start-w[t.id].start}),g=e.filter(e=>null===w[e.id].start);for(const e of[...h,...g]){const t=w[e.id];let o=-1;for(let e=0;S.length>e;e++){const n=S[e].occupants[S[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(S.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=S.length-1),S[o].occupants.push({id:e.id,end:null!==(d=null==t?void 0:t.end)&&void 0!==d?d:-1/0}),S[o].peak.topPeak=Math.max(S[o].peak.topPeak,b[e.id]),S[o].peak.botPeak=Math.max(S[o].peak.botPeak,x[e.id]),A[e.id]=o}}else e.forEach((e,t)=>{var o,n;S.push({occupants:[{id:e.id,end:null!==(n=null===(o=w[e.id])||void 0===o?void 0:o.end)&&void 0!==n?n:-1/0}],peak:{topPeak:b[e.id],botPeak:x[e.id]}}),A[e.id]=t});let O=null,_=null,C=null,j=null;const M=()=>{O=ad(A,t),C=ld(A,t)},P=()=>{_=ad(A,t),j=ld(A,t)};"crossing-min"===v?(M(),ud(S,A,t),P()):"inside-out"===v?(M(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),r=Array(o),s=Math.floor((o-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&o>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),d=new Map;r.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t)}(S,A),P()):"crossing-min+inside-out"===v&&(M(),ud(S,A,t),function(e,t,o){const n=e.length;if(1>=n)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((n-1)/2);let s=cd(t,o);for(const{slot:a}of i){const i=e.indexOf(a);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const d=new Map;for(let e=0;n>e;e++)d.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)d.set(e,e-1);d.set(i,l)}else{for(let e=l;i>e;e++)d.set(e,e+1);d.set(i,l)}for(const e of Object.keys(t))t[e]=d.get(t[e]);const u=cd(t,o);if(u>s){const o=e[l];e.splice(l,1),e.splice(i,0,o);const r=new Map;for(let e=0;n>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else s=u}}(S,A,t),P());const L=S.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let o={top:0,bot:0};for(const[n,i]of e){if(n>t)break;o=i}return o},B=[];for(let e=0;S.length-1>e;e++){const t=L[e],o=L[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let i=0;for(const e of n){const n=T(t,e),r=T(o,e);n.bot+r.top>i&&(i=n.bot+r.top)}B.push(i)}const N=[];let E=f+(null!==(h=null===(u=S[0])||void 0===u?void 0:u.peak.topPeak)&&void 0!==h?h:0)*p;S.length>0&&N.push(E);for(let e=1;S.length>e;e++)E+=B[e-1]*p+f,N.push(E);if(S.length>0&&(E+=S[S.length-1].peak.botPeak*p+f),E>g){const e=g/E;for(let t=0;N.length>t;t++)N[t]*=e}const D=0===S.length?0:S[0].peak.topPeak+B.reduce((e,t)=>e+t,0)+S[S.length-1].peak.botPeak,I={};for(const t of e)I[t.id]=N[A[t.id]];return{effectiveSlotsHeight:D,centerlines:I,laneLifetime:w,slots:S,slotByNode:A,slotCenter:N,crossingsBefore:O,crossingsAfter:_,lengthBefore:C,lengthAfter:j}}nd.displayName="SankeyDiagram";const gd=e=>{var t,o;const{bands:n=[],ribbons:i=[],showLabels:r=!0}=e.config,s=[];for(const e of i)s.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of n)s.push({type:"bezier",pathD:e.pathD,style:{fill:e.fill,fillOpacity:.86,stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(o=e.strokeWidth)&&void 0!==o?o:.5},datum:{__kind:"band",data:e.rawDatum,id:e.id}});const a=r?n.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:n.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:s,labels:a}};function fd(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function pd(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function yd(e,t){return"function"==typeof e?e(t):t[e]}const vd=g(function(n,s){const{nodes:a,edges:c,domain:d,axisTicks:h=[],nodeIdAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:y="value",startTimeAccessor:v="startTime",endTimeAccessor:m="endTime",xExtentAccessor:b="xExtent",edgeIdAccessor:x="id",colorBy:k,colorScheme:w,showLegend:S,legendPosition:O="right",pairing:_="temporal",packing:C="reuse",laneOrder:j="crossing-min",ribbonLane:M="both",lifetimeMode:P="half",showLaneRails:L=!1,showQualityReadout:T=!1,width:B=600,height:N=400,margin:E,title:D,description:I,summary:H,accessibleTable:R,responsiveWidth:W,responsiveHeight:F,loading:z,emptyContent:$,edgeOpacity:Y=.35,timeFormat:G,valueFormat:q,tooltip:X,enableHover:V=!0,onObservation:U,onClick:K,showParticles:Q=!1,particleStyle:Z,chartId:J,frameProps:ee={}}=n,[te,oe]=u([]),[ne,ie]=u([]),re=i(te),se=i(ne);re.current=te,se.current=ne;const ae=l(e=>{re.current=e,oe(e)},[]),le=l(e=>{se.current=e,ie(e)},[]),ce=void 0!==c,de=fe(ce?c:te),ue=r(()=>{const e=fe(null!=a?a:[]),t=ne;if(0===e.length&&0===t.length)return Qc([],de,f,p);const o=new Set,n=[];for(const t of e){const e=yd(g,t)+"";o.has(e)||(o.add(e),n.push(t))}for(const e of t){const t=yd(g,e)+"";o.has(t)||(o.add(t),n.push(e))}const i=Qc([],de,f,p);for(const e of i)o.has(e.id)||(o.add(e.id),n.push(e));return n},[a,ne,de,g,f,p]),he=i(null),ge=l((e,t)=>{const o=yd(x,e);return null!=o?o+"":`${yd(f,e)}-${yd(p,e)}-${t}`},[x,f,p]),pe=l(e=>{if(null==e)return!1;const t=e;return null!=yd(f,t)&&null!=yd(p,t)},[f,p]);as(s,{variant:"network",frameRef:he,overrides:{push(e){if(pe(e)){if(ce)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");ae([...re.current,e])}else le([...se.current,e])},pushMany(e){const t=[],o=[];for(const n of e)pe(n)?t.push(n):o.push(n);t.length>0&&(ce?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):ae([...re.current,...t])),o.length>0&&le([...se.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!ce){const e=re.current,n=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(ge(r,i))?o.push(r):n.push(r)}n.length!==e.length&&ae(n)}const n=se.current,i=[];for(const e of n){const n=yd(g,e)+"";t.has(n)?o.push(e):i.push(e)}return i.length!==n.length&&le(i),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!ce){let e=!1;const i=re.current.map((i,r)=>o.has(ge(i,r))?(n.push(i),e=!0,t(i)):i);e&&ae(i)}let i=!1;const r=se.current.map(e=>{const r=yd(g,e)+"";return o.has(r)?(n.push(e),i=!0,t(e)):e});return i&&le(r),n},clear(){var e;ce||ae([]),le([]),null===(e=he.current)||void 0===e||e.clear()},getData:()=>null!=de?de:[],getScales:()=>null},deps:[ce,pe,ge,g,de,ae,le]});const ye=ge,ve=l(e=>yd(g,e)+"",[g]),{nodes:me,edges:be,domain:xe,rawNodeById:ke,rawEdgeById:we}=r(()=>{const e=(null!=ue?ue:[]).map(e=>{const t={id:ve(e),__raw:e},o=b?yd(b,e):null;if(Array.isArray(o)&&2===o.length){const e=pd(o[0]),n=pd(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(null!=de?de:[]).map((e,t)=>({id:ye(e,t),source:yd(f,e)+"",target:yd(p,e)+"",value:Number(yd(y,e)),startTime:pd(yd(v,e)),endTime:pd(yd(m,e)),__raw:e})),o=[pd(d[0]),pd(d[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[ue,de,d,ve,ye,b,f,p,y,v,m]),Ae=ed({nodes:ue,edges:de,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:k,colorScheme:w,showLegend:!1,legendPosition:O,selection:void 0,linkedHover:void 0,onObservation:U,onClick:K,chartType:"ProcessSankey",chartId:J,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:E,width:B,height:N,loading:z,emptyContent:$}),Se=(null!=S?S:!!k)&&!!k,Oe=r(()=>{const e=Object.assign({},Ae.margin);return Se&&("right"===O&&140>e.right?e.right=140:"bottom"===O&&80>e.bottom&&(e.bottom=80)),e},[Ae.margin,Se,O]),_e=B-Oe.left-Oe.right,Ce=N-Oe.top-Oe.bottom,je=r(()=>function(e,t,o){const n=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(o)&&2===o.length,s=r&&Number.isFinite(o[0])&&Number.isFinite(o[1]);r&&s&&s&&o[1]>=o[0]||n.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||n.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||n.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||n.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||n.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||n.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):n.push({kind:"invalid-edge-time",id:e.id});return n}(me,be,xe),[me,be,xe]),Me=r(()=>je.length>0?null:function(e,t,o){var n;const{plotH:i,pairing:r="temporal",packing:s="reuse",laneOrder:a="crossing-min",lifetimeMode:l="half"}=o,c=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),d=function(e,t,o,n="value"){const i="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=o.get(e);i.edges.push(n),i.total+=n.value,i.earliestStart=Math.min(i.earliestStart,n.startTime),i.latestEnd=Math.max(i.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),i=Math.max(t.length,o.length);for(let e=0;i>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,c,r);let u={};for(const t of e)u[t.id]=id(t,c,d);const h=hd(e,t,u,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],o=h.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=d.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(g.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=c.outgoing[t.id],o=c.incoming[t.id],n=new Set(e.map(e=>d.get(e.id).sourceSide)),i=new Set(o.map(e=>d.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)h.slotByNode[t.source]===h.slotByNode[t.target]&&(d.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const o of e)h.slotByNode[o.source]===h.slotByNode[o.target]&&(d.get(o.id).sourceSide=t)}}for(const t of e){const e=c.incoming[t.id],o=c.outgoing[t.id];if(0===e.length||0===o.length)continue;const n=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===d.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===d.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=n(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,s="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=s)return!1;const a=Math.min(r,s),l=o.filter(t=>!g.has(t.id)&&d.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(d.get(l[0].id).sourceSide=t,!0)};let r=o.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}u={};for(const t of e)u[t.id]=id(t,c,d);const f=hd(e,t,u,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),p=null!==(n=f.effectiveSlotsHeight)&&void 0!==n?n:f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),y=Math.min(12,.35*i/Math.max(f.slots.length+1,1)),v=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,m=hd(e,t,u,c,{plotH:i,padding:y,valueScale:v,packing:s,laneOrder:a,lifetimeMode:l});return{nodeData:u,sides:d,valueScale:v,padding:y,compressedPadding:12>y,centerlines:m.centerlines,laneLifetime:m.laneLifetime,slots:m.slots,slotByNode:m.slotByNode,crossingsBefore:m.crossingsBefore,crossingsAfter:m.crossingsAfter,lengthBefore:m.lengthBefore,lengthAfter:m.lengthAfter}}(me,be,{plotH:Ce,pairing:_,packing:C,laneOrder:j,lifetimeMode:P}),[je,me,be,Ce,_,C,j,P]),Pe=r(()=>A().domain(xe).range([0,_e]),[xe,_e]),Le=l((e,t)=>{if(k&&ue){const t=ke.get(e);if(t)return vt(t,k,Ae.colorScale)}return Ae.effectivePalette[t%Ae.effectivePalette.length]||"#475569"},[k,ue,ke,Ae.colorScale,Ae.effectivePalette]),Te=r(()=>{const e=new Map;return me.forEach((t,o)=>e.set(t.id,o)),e},[me]),Be=r(()=>{if(!Me)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Me,n=[],i=[];return me.forEach((i,r)=>{var s;const a=t[i.id];if(!a||0===a.samples.length)return;const l=function(e,t,o,n,i){if(0===e.length)return null;const r=sd(e,i),s=e=>t-r[e].topMass*o,a=e=>t+r[e].botMass*o;let l=`M${n(r[0].t)},${s(0)}`;for(let e=1;r.length>e;e++)l+=` L${n(r[e].t)},${s(e)}`;l+=` L${n(r[r.length-1].t)},${a(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${n(r[e].t)},${a(e)}`;return l+" Z"}(a.samples,e[i.id],o,Pe,xe);if(!l)return;const c=sd(a.samples,xe),d=c.find(e=>e.topMass+e.botMass>0)||c[0],u=e[i.id]+(d.botMass-d.topMass)*o/2,h=Le(i.id,r),g=null!==(s=ke.get(i.id))&&void 0!==s?s:i;n.push({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5,rawDatum:g,labelX:Pe(d.t)-4,labelY:u,labelText:i.id})}),be.forEach(n=>{var r,s,a,l;const c=null===(r=t[n.source])||void 0===r?void 0:r.localAttachments.get(n.id),d=null===(s=t[n.target])||void 0===s?void 0:s.localAttachments.get(n.id);if(!c||!d)return;const u=null!==(a=Te.get(n.source))&&void 0!==a?a:0,h=Le(n.source,u),g=function(e,t,o,n,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,d=r(c(e.time)),u=r(c(o.time)),h=e.value*l,g=o.value*l,f=e.sideMassBefore*l,p=o.sideMassAfter*l;let y,v,m,b;"top"===e.side?(y=t-f,v=y+h):(v=t+f,y=v-h),"top"===o.side?(m=n-p,b=m+g):(b=n+p,m=b-g);const x="source"===s?d+.85*(u-d):"target"===s?d+.15*(u-d):(d+u)/2;return{sx:d,sTop:y,sBot:v,tx:u,tTop:m,tBot:b,cp1X:x,cp2X:x}}(c,e[n.source],d,e[n.target],o,Pe,M,xe),{pathD:f,bezier:p}=Ul(g),y=null!==(l=we.get(n.id))&&void 0!==l?l:n;i.push({id:n.id,pathD:f,fill:h,opacity:Y,rawDatum:y,bezier:p})}),{bands:n,ribbons:i}},[Me,me,be,Pe,xe,Le,ke,we,M,Y,Te]),Ne=r(()=>({bands:Be.bands,ribbons:Be.ribbons,showLabels:!0}),[Be]),Ee=r(()=>{if(!Se||!k)return;const e=new Map;(null!=ue?ue:[]).forEach((t,o)=>{const n=yd(k,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:Le(ve(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[Se,k,ue,Le,ve]),De=r(()=>!1!==X&&V?void 0===X||!0===X?null:Kn(X)||null:null,[X,V]),Ie=l(e=>G?G(new Date(e)):new Date(e).toISOString().slice(0,10),[G]),He=l(e=>q?q(e):e+"",[q]),Re=l(n=>{if(!n||!n.data)return null;const i=n.data;if(!fd(i))return null;const r=i.data;if(De)return De(r);if("band"===i.__kind){const o=i.id,n=Me?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,i=`${n.t}:${e}`;t.has(i)||(t.add(i),o.push({t:n.t,total:e}))}return o}(Me.nodeData[o]):[],r=5,s=n.length>r?n.length:null,a=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),n=o.length-1,i=[Object.assign(Object.assign({},o[0]),{mark:"min"}),Object.assign(Object.assign({},o[Math.floor(.25*n)]),{mark:"q25"}),Object.assign(Object.assign({},o[Math.floor(.5*n)]),{mark:"median"}),Object.assign(Object.assign({},o[Math.floor(.75*n)]),{mark:"q75"}),Object.assign(Object.assign({},o[n]),{mark:"max"})],r=new Set,s=[];for(const e of i)r.has(e.t)||(r.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(n,r);return t("div",{style:{minWidth:160},children:[e("div",{style:{fontWeight:600,marginBottom:4},children:o}),a.length>0&&t("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e("thead",{children:t("tr",{style:{opacity:.6},children:[e("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=s&&e("th",{})]})}),e("tbody",{children:a.map((o,n)=>t("tr",{children:[e("td",{style:{paddingRight:8},children:Ie(o.t)}),e("td",{style:{textAlign:"right"},children:He(o.total)}),null!=s&&e("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:o.mark})]},n))})]}),null!=s&&t("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",a.length," of ",s," samples"]})]})}const s=r,a=yd(f,s),l=yd(p,s),c=yd(y,s),d=yd(v,s),u=yd(m,s);return t("div",{style:{minWidth:160},children:[t("div",{style:{fontWeight:600,marginBottom:4},children:[a+""," → ",l+""]}),t("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=c&&t(o,{children:[e("span",{style:{opacity:.6},children:"value"}),e("span",{style:{textAlign:"right"},children:He(Number(c))})]}),null!=d&&t(o,{children:[e("span",{style:{opacity:.6},children:"start"}),e("span",{style:{textAlign:"right"},children:Ie(pd(d))})]}),null!=u&&t(o,{children:[e("span",{style:{opacity:.6},children:"end"}),e("span",{style:{textAlign:"right"},children:Ie(pd(u))})]})]})]})},[Me,De,Ie,He,f,p,y,v,m]),We=r(()=>{if(!Me)return null;const{centerlines:o,laneLifetime:n,nodeData:i,valueScale:r,compressedPadding:s,crossingsBefore:a,crossingsAfter:l,lengthBefore:c,lengthAfter:d}=Me;return t("g",{children:[T&&null!==(null!=l?l:null)&&t("text",{x:_e,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",a," → ",l," ","edge length: ",Math.round(c)," → ",Math.round(d)]}),s&&e("text",{x:_e,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),h.map((t,o)=>{const n=Pe(pd(t.date));return e("line",{x1:n,y1:0,x2:n,y2:Ce,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+o)}),L&&me.map((s,a)=>{const l=n[s.id];if(!l||null===l.start)return null;const c=i[s.id],d=c?{topPeak:c.topPeak,botPeak:c.botPeak}:{topPeak:0,botPeak:0},u=o[s.id]+(d.botPeak-d.topPeak)*r/2,h=Pe(l.start),g=Pe(l.end),f=Le(s.id,a);return t("g",{children:[e("line",{x1:h,y1:u,x2:g,y2:u,stroke:f,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:f,strokeOpacity:.5}),e("line",{x1:g,y1:u-4,x2:g,y2:u+4,stroke:f,strokeOpacity:.5})]},"lane-"+s.id)}),e("line",{x1:0,y1:Ce+4,x2:_e,y2:Ce+4,stroke:"#94a3b8"}),h.map((o,n)=>{const i=pd(o.date),r=Pe(i),s=null!=o.label?o.label:G?G(new Date(i)):"";return t("g",{transform:`translate(${r},${Ce+4})`,children:[e("line",{y2:6,stroke:"#94a3b8"}),e("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:s})]},n)})]})},[Me,h,Pe,_e,Ce,L,me,Le,T,G]),Fe=r(()=>(null!=ue?ue:[]).map(e=>({id:ve(e),data:e})),[ue,ve]),ze=r(()=>{const e=new Map;for(const t of Be.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Be]),$e=r(()=>(null!=de?de:[]).map((e,t)=>{const o=ye(e,t),n=Number(yd(y,e));return{id:o,source:yd(f,e)+"",target:yd(p,e)+"",value:Number.isFinite(n)?n:0,bezier:ze.get(o),data:e}}),[de,ye,f,p,y,ze]),Ye=Ae.loadingEl,Ge=Ae.emptyEl;return je.length>0?t("svg",{width:B,height:N,role:"img","aria-label":null!=D?D:"Process Sankey validation failed",children:[e("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),je.map((t,o)=>{return e("text",{x:20,y:56+18*o,fontSize:12,fill:"#64748b",children:"• "+(n=t,"invalid-node-time"===n.kind?`node ${n.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===n.kind?`edge ${n.id} has an invalid startTime or endTime`:"invalid-domain"===n.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===n.kind?`edge ${n.id} must have a positive finite value`:"missing-node"===n.kind?`edge ${n.id} references missing ${n.endpoint} node "${n.nodeId}"`:"backward-edge"===n.kind?`edge ${n.id} (${n.source}->${n.target}) ends before it starts`:n.kind)},o);var n})]}):Ye||Ge||e(Uc,Object.assign({ref:he,chartType:"force",nodes:Fe,edges:$e,customNetworkLayout:gd,layoutConfig:Ne,size:[B,N],responsiveWidth:W,responsiveHeight:F,margin:Oe,title:D,description:null!=I?I:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:H,accessibleTable:R,enableHover:V,tooltipContent:!1===X?()=>null:Re,backgroundGraphics:We,showParticles:Q,particleStyle:Z,legend:Ee,legendPosition:O,onObservation:U,customClickBehavior:K?e=>{if(!e||!e.data)return;const t=e.data;fd(t)&&K(t.data,{x:e.x,y:e.y})}:void 0,chartId:J,colorScheme:Array.isArray(w)?w:void 0},ee))});function md(t){const o=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:d="value",nodeIdAccessor:u="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:v=5,tooltip:m,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:S,loading:O,legendInteraction:_,stroke:C,strokeWidth:j,opacity:M}=t,{width:P,height:L,enableHover:T,showLabels:B=!0,title:N,description:E,summary:D,accessibleTable:I}=o,H=ed({nodes:r(()=>Kc(null!=n?n:null,c),[n,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:_,selection:A,linkedHover:S,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:o.marginDefaults,userMargin:i,width:P,height:L,loading:O}),R=r(()=>new Map,[]),W=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?pt[(e.depth||0)%pt.length]:h?vt(e.data||e,h,H.colorScale):Sr(void 0,H.themeCategorical,g,void 0,R),t},[h,f,H.colorScale,H.themeCategorical,g,R]),F=r(()=>rs(W,{stroke:C,strokeWidth:j,opacity:M}),[W,C,j,M]),z=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),$=r(()=>rs(z,{stroke:C,strokeWidth:j,opacity:M}),[z,C,j,M]),Y=r(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return Zc(d)},[a,d]),G=ts({componentName:"TreeDiagram",data:n});return G?e(Wr,{componentName:"TreeDiagram",message:G,width:P,height:L}):H.loadingEl?H.loadingEl:e(Yr,{componentName:"TreeDiagram",width:P,height:L,children:e(Uc,Object.assign({chartType:a},null!=n&&{data:n},{size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:H.margin,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:Y,treeOrientation:l,edgeType:p,nodeStyle:F,edgeStyle:$,colorBy:h,colorScheme:H.effectivePalette,colorByDepth:f,nodeSize:v,nodeLabel:B?y||u:void 0,showLabels:B,enableHover:T,tooltipContent:!1===m?()=>null:Kn(m)||void 0,customHoverBehavior:S||x||k?H.customHoverBehavior:void 0,customClickBehavior:x||k?H.customClickBehavior:void 0},_&&"none"!==_&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:s,title:N,description:E,summary:D,accessibleTable:I},null!=t.animate&&{animate:t.animate},b))})}function bd(t){const o=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:c="value",nodeIdAccessor:d="name",colorBy:u,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:v,tooltip:m,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:O,legendInteraction:_,stroke:C,strokeWidth:j,opacity:M}=t,{width:P,height:L,enableHover:T,showLabels:B=!0,title:N,description:E,summary:D,accessibleTable:I}=o,H=ed({nodes:r(()=>Kc(null!=n?n:null,a),[n,a]),edges:void 0,inferNodes:!1,colorBy:g?void 0:u,colorScheme:h,showLegend:!1,legendInteraction:_,selection:x,linkedHover:k,onObservation:w,onClick:A,chartType:"Treemap",chartId:S,marginDefaults:o.marginDefaults,userMargin:i,width:P,height:L,loading:O}),R=ns(x),W=H.customHoverBehavior,F=l(e=>{if(!e)return W(null);const t=e.data||e;W({data:(null==t?void 0:t.data)||t})},[W]),z=r(()=>new Map,[]),$=r(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=g?pt[(e.depth||0)%pt.length]:u?vt(e.data||e,u,H.colorScale):Sr(void 0,H.themeCategorical,h,void 0,z),t},[u,g,H.colorScale,H.themeCategorical,h,z]),Y=r(()=>rs($,{stroke:C,strokeWidth:j,opacity:M}),[$,C,j,M]),G=r(()=>H.activeSelectionHook?e=>{var t;const o=Object.assign({},Y(e));if(H.activeSelectionHook.isActive)if(H.activeSelectionHook.predicate(e.data||e))(null==R?void 0:R.selectedStyle)&&Object.assign(o,R.selectedStyle);else{const e=null!==(t=null==R?void 0:R.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==R?void 0:R.unselectedStyle)&&Object.assign(o,R.unselectedStyle)}return o}:Y,[Y,H.activeSelectionHook,R]),q=r(()=>Zc(c),[c]),X=void 0!==v?v:!B||"parent"!==f&&"all"!==f?void 0:18,V=ts({componentName:"Treemap",data:n});return V?e(Wr,{componentName:"Treemap",message:V,width:P,height:L}):H.loadingEl?H.loadingEl:e(Yr,{componentName:"Treemap",width:P,height:L,children:e(Uc,Object.assign({chartType:"treemap"},null!=n&&{data:n},{size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:H.margin,nodeIDAccessor:d,childrenAccessor:a,hierarchySum:q,padding:y,paddingTop:X,nodeStyle:G,colorBy:u,colorScheme:H.effectivePalette,colorByDepth:g,nodeLabel:B?p||d:void 0,showLabels:B,labelMode:f,enableHover:T,tooltipContent:!1===m?()=>null:Kn(m)||void 0},(k||w||A)&&{customHoverBehavior:F},(w||A)&&{customClickBehavior:H.customClickBehavior},_&&"none"!==_&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:s,title:N,description:E,summary:D,accessibleTable:I},null!=t.animate&&{animate:t.animate},b))})}function xd(t){const o=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:d,colorScheme:u,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:v={},onObservation:m,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,legendInteraction:S,stroke:O,strokeWidth:_,opacity:C}=t,{width:j,height:M,enableHover:P,showLabels:L=!0,title:T,description:B,summary:N,accessibleTable:E}=o,D=ed({nodes:r(()=>Kc(null!=n?n:null,a),[n,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:d,colorScheme:u,showLegend:!1,legendInteraction:S,selection:k,linkedHover:w,onObservation:m,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:o.marginDefaults,userMargin:i,width:j,height:M,loading:A}),I=r(()=>new Map,[]),H=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?pt[(e.depth||0)%pt.length]:d?vt(e.data||e,d,D.colorScale):Sr(void 0,D.themeCategorical,u,void 0,I),t},[d,h,D.colorScale,f,D.themeCategorical,u,I]),R=r(()=>rs(H,{stroke:O,strokeWidth:_,opacity:C}),[H,O,_,C]),W=r(()=>Zc(l),[l]),F=ts({componentName:"CirclePack",data:n});return F?e(Wr,{componentName:"CirclePack",message:F,width:j,height:M}):D.loadingEl?D.loadingEl:e(Yr,{componentName:"CirclePack",width:j,height:M,children:e(Uc,Object.assign({chartType:"circlepack"},null!=n&&{data:n},{size:[j,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:W,padding:p,nodeStyle:R,colorBy:d,colorScheme:D.effectivePalette,colorByDepth:h,nodeLabel:L?g||c:void 0,showLabels:L,enableHover:P,tooltipContent:!1===y?()=>null:Kn(y)||void 0,customHoverBehavior:w||m||b?D.customHoverBehavior:void 0,customClickBehavior:m||b?D.customClickBehavior:void 0},S&&"none"!==S&&{legendHoverBehavior:D.legendState.onLegendHover,legendClickBehavior:D.legendState.onLegendClick,legendHighlightedCategory:D.legendState.highlightedCategory,legendIsolatedCategories:D.legendState.isolatedCategories},{className:s,title:T,description:B,summary:N,accessibleTable:E},null!=t.animate&&{animate:t.animate},v))})}vd.displayName="ProcessSankey",md.displayName="TreeDiagram",bd.displayName="Treemap",xd.displayName="CirclePack";const kd=pt;function wd(t){const o=Tr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:d,colorByDepth:u=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:v=1,showRings:m=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:_,onClick:C,chartId:j,selection:M,linkedHover:P,loading:L,stroke:T,strokeWidth:B,opacity:N}=t,{width:E,height:D,enableHover:I,title:H,description:R,summary:W,accessibleTable:F}=o,z=ed({nodes:r(()=>Kc(n,a),[n,a]),edges:void 0,inferNodes:!1,colorBy:u?void 0:c,colorScheme:d,showLegend:!1,legendInteraction:void 0,selection:M,linkedHover:P,onObservation:_,onClick:C,chartType:"OrbitDiagram",chartId:j,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:i,width:E,height:D,loading:L}),$=r(()=>new Map,[]),Y=r(()=>{if(Array.isArray(d))return d;const e=ht[d];return Array.isArray(e)?e:gt},[d]),G=r(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=u?n?Y[0]:kd[(e.depth||0)%kd.length]:c?vt(e.data||e,c,z.colorScale):Sr(void 0,z.themeCategorical,d,void 0,$),o.opacity=n?1:.85,o},[c,u,z.colorScale,Y,z.themeCategorical,d,$]),q=r(()=>rs(G,{stroke:T,strokeWidth:B,opacity:N}),[G,T,B,N]),X=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),V=r(()=>{if(z.customHoverBehavior)return e=>{z.customHoverBehavior(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z.customHoverBehavior]),U=r(()=>{if(z.customClickBehavior)return e=>{z.customClickBehavior(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z.customClickBehavior]),K=ts({componentName:"OrbitDiagram",data:n});return K?e(Wr,{componentName:"OrbitDiagram",message:K,width:E,height:D}):z.loadingEl?z.loadingEl:e(Yr,{componentName:"OrbitDiagram",width:E,height:D,children:e(Uc,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[E,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:q,edgeStyle:X,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:u,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&I,tooltipContent:k?void 0:!1===w?()=>null:Kn(w)||void 0,customHoverBehavior:P||_||C?V:void 0,customClickBehavior:_||C?U:void 0,foregroundGraphics:A,annotations:S,className:s,title:H,description:R,summary:W,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:v,orbitShowRings:m,orbitAnimated:k,accessibleTable:F},null!=t.animate&&{animate:t.animate},O))})}wd.displayName="OrbitDiagram";const Ad={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Sd={opacity:.7,marginRight:4};function Od(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function _d(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Cd(e={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=e;return e=>{var s;const a=null!==(s=null==e?void 0:e.data)&&void 0!==s?s:null,l=Od(a,o,"time"),c=Od(a,n,"value");return t("div",{className:"semiotic-tooltip",style:Ad,children:[t("div",{children:[t("span",{style:Sd,children:[i,":"]}),_d(l)]}),t("div",{children:[t("span",{style:Sd,children:[r,":"]}),_d(c)]})]})}}function jd(e,t){var o;return null!=e?e:Math.max(null!==(o=null==t?void 0:t.length)&&void 0!==o?o:0,200)}const Md=g(function(t,o){var n,r,s,a,c;const d=Tr(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:v,data:m,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:O=2,strokeDasharray:_,opacity:C,background:j,tooltipContent:M,tooltip:P,onHover:L,annotations:T,svgAnnotationRules:B,tickFormatTime:N,tickFormatValue:E,decay:D,pulse:I,staleness:H,transition:R,linkedHover:W,selection:F,onObservation:z,chartId:$,loading:Y,emptyContent:G,emphasis:q,legendPosition:X}=t,V=d.showAxes,U=d.enableHover,K=null!=h?h:d.marginDefaults,Q=null!=u?u:[d.width,d.height],Z=null!==(c=null!=M?M:P)&&void 0!==c?c:Cd({timeAccessor:b,valueAccessor:x}),J=i(null),{customHoverBehavior:ee}=Cr({selection:F,linkedHover:W,unwrapData:!0,onObservation:z,chartType:"RealtimeLineChart",chartId:$}),te=l(e=>{L&&L(e),ee(e)},[L,ee]);p(o,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Vr(Y,Q[0],Q[1]),ne=oe?null:Xr(m,Q[0],Q[1],G),ie={stroke:S,strokeWidth:O,strokeDasharray:_};null!=C&&(ie.opacity=C);const re=jd(v,m);return oe||ne||e(Di,{ref:J,chartType:"line",runtimeMode:"streaming",size:Q,margin:K,className:q?`${g||""} semiotic-emphasis-${q}`.trim():g,arrowOfTime:f,windowMode:y,windowSize:re,data:m,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,lineStyle:ie,showAxes:V,background:j,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:T,svgAnnotationRules:B,tickFormatTime:N,tickFormatValue:E,decay:D,pulse:I,staleness:H,transition:R,pointIdAccessor:t.pointIdAccessor,legendPosition:X})});Md.displayName="RealtimeLineChart";const Pd=g(function(o,n){var r,s,a,c,d;const u=Tr(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,showAxes:o.showAxes,enableHover:null!=o.enableHover?!!o.enableHover:void 0,linkedHover:o.linkedHover}),{binSize:h,size:g,margin:f,className:y,arrowOfTime:v="right",windowMode:m="sliding",windowSize:b,data:x,timeAccessor:k,valueAccessor:w,timeExtent:A,valueExtent:S,extentPadding:O,categoryAccessor:_,colors:C,fill:j,stroke:M,strokeWidth:P,opacity:L,gap:T,background:B,tooltipContent:N,tooltip:E,onHover:D,annotations:I,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,linkedHover:F,selection:z,decay:$,pulse:Y,staleness:G,transition:q,onObservation:X,chartId:V,loading:U,emptyContent:K,emphasis:Q,legendPosition:Z,brush:J,onBrush:ee,linkedBrush:te}=o,oe=u.showAxes,ne=u.enableHover,ie=null!=f?f:u.marginDefaults,re=null!=g?g:[u.width,u.height],se=null!==(d=null!=N?N:E)&&void 0!==d?d:function(o={}){const{timeAccessor:n,valueAccessor:i}=o;return o=>{var r;const s=null!==(r=null==o?void 0:o.data)&&void 0!==r?r:null;if(null==(null==s?void 0:s.binStart)||null==(null==s?void 0:s.binEnd)){const o=Od(s,n,"time"),r=Od(s,i,"value");return t("div",{className:"semiotic-tooltip",style:Ad,children:[t("div",{children:[e("span",{style:Sd,children:"x:"}),_d(o)]}),t("div",{children:[e("span",{style:Sd,children:"y:"}),_d(r)]})]})}return t("div",{className:"semiotic-tooltip",style:Ad,children:[t("div",{children:[e("span",{style:Sd,children:"range:"}),_d(s.binStart),"–",_d(s.binEnd)]}),null!=s.total&&t("div",{children:[e("span",{style:Sd,children:"count:"}),_d(s.total)]}),null!=s.category&&t("div",{children:[e("span",{style:Sd,children:"category:"}),_d(s.category)]})]})}}({timeAccessor:k,valueAccessor:w}),ae=i(null),{customHoverBehavior:le}=Cr({selection:z,linkedHover:F,unwrapData:!0,onObservation:X,chartType:"RealtimeHistogram",chartId:V}),ce=l(e=>{D&&D(e),le(e)},[D,le]),de=!0===J?{dimension:"x",snap:"bin"}:"x"===J?{dimension:"x"}:"object"==typeof J?J:void 0,ue=cr(te),he=Ki(Object.assign({name:(null==ue?void 0:ue.name)||"__unused_hist_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof k?k:"time")},(null==ue?void 0:ue.yField)?{yField:ue.yField}:{})),ge=i(he.brushInteraction);ge.current=he.brushInteraction;const fe=l(e=>{if(ee&&ee(e),X&&X(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:V}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:V}),ue){const t=ge.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ee,X,V,ue]);p(n,()=>({push:e=>{var t;return null===(t=ae.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ae.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=ae.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=ae.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=ae.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const pe=Vr(U,re[0],re[1]),ye=pe?null:Xr(x,re[0],re[1],K),ve={};null!=j&&(ve.fill=j),null!=M&&(ve.stroke=M),null!=P&&(ve.strokeWidth=P),null!=L&&(ve.opacity=L),null!=T&&(ve.gap=T);const me=Q?`${y||""} semiotic-emphasis-${Q}`.trim():y,be=jd(b,x);return pe||ye||e(Di,{ref:ae,chartType:"bar",runtimeMode:"streaming",size:re,margin:ie,className:me,arrowOfTime:v,windowMode:m,windowSize:be,data:x,timeAccessor:k,valueAccessor:w,xExtent:A,yExtent:S,extentPadding:O,binSize:h,categoryAccessor:_,barColors:C,barStyle:ve,showAxes:oe,background:B,hoverAnnotation:ne,tooltipContent:se,customHoverBehavior:ce,annotations:I,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,decay:$,pulse:Y,staleness:G,transition:q,pointIdAccessor:o.pointIdAccessor,legendPosition:Z,brush:de||(te?{dimension:"x"}:void 0),onBrush:de||te?fe:void 0})});Pd.displayName="RealtimeHistogram";const Ld=g(function(t,o){var n,r,s,a,c;const d=Tr(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:v,data:m,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,radius:_,fill:C,opacity:j,stroke:M,strokeWidth:P,background:L,tooltipContent:T,tooltip:B,onHover:N,annotations:E,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:H,linkedHover:R,selection:W,onObservation:F,chartId:z,loading:$,emptyContent:Y,emphasis:G,legendPosition:q}=t,X=d.showAxes,V=d.enableHover,U=null!=h?h:d.marginDefaults,K=null!=u?u:[d.width,d.height],Q=null!==(c=null!=T?T:B)&&void 0!==c?c:Cd({timeAccessor:b,valueAccessor:x}),Z=i(null),{customHoverBehavior:J}=Cr({selection:W,linkedHover:R,unwrapData:!0,onObservation:F,chartType:"RealtimeSwarmChart",chartId:z}),ee=l(e=>{N&&N(e),J(e)},[N,J]);p(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=Vr($,K[0],K[1]),oe=te?null:Xr(m,K[0],K[1],Y),ne={};null!=_&&(ne.radius=_),null!=C&&(ne.fill=C),null!=j&&(ne.opacity=j),null!=M&&(ne.stroke=M),null!=P&&(ne.strokeWidth=P);const ie=G?`${g||""} semiotic-emphasis-${G}`.trim():g,re=jd(v,m);return te||oe||e(Di,{ref:Z,chartType:"swarm",runtimeMode:"streaming",size:K,margin:U,className:ie,arrowOfTime:f,windowMode:y,windowSize:re,data:m,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:O,swarmStyle:ne,showAxes:X,background:L,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:E,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:H,legendPosition:q,pointIdAccessor:t.pointIdAccessor})});Ld.displayName="RealtimeSwarmChart";const Td=g(function(o,n){var r,s,a,c,d;const u=Tr(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:v="sliding",windowSize:m,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:O,negativeColor:_,connectorStroke:C,connectorWidth:j,gap:M,stroke:P,strokeWidth:L,opacity:T,background:B,tooltipContent:N,tooltip:E,onHover:D,annotations:I,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,linkedHover:F,selection:z,onObservation:$,chartId:Y,loading:G,emptyContent:q,emphasis:X,legendPosition:V}=o,U=u.showAxes,K=u.enableHover,Q=null!=g?g:u.marginDefaults,Z=null!=h?h:[u.width,u.height],J=null!==(d=null!=N?N:E)&&void 0!==d?d:function(o={}){const{timeAccessor:n,valueAccessor:i}=o;return o=>{var r,s;const a=null!==(r=null==o?void 0:o.data)&&void 0!==r?r:null,l=Od(a,n,"time"),c=null!==(s=null==a?void 0:a.delta)&&void 0!==s?s:Od(a,i,"value"),d=null==a?void 0:a.cumEnd,u="number"==typeof c?0>c?_d(c):"+"+_d(c):_d(c);return t("div",{className:"semiotic-tooltip",style:Ad,children:[t("div",{children:[e("span",{style:Sd,children:"x:"}),_d(l)]}),t("div",{children:[e("span",{style:Sd,children:"Δ:"}),u]}),null!=d&&t("div",{children:[e("span",{style:Sd,children:"total:"}),_d(d)]})]})}}({timeAccessor:x,valueAccessor:k}),ee=i(null),{customHoverBehavior:te}=Cr({selection:z,linkedHover:F,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:Y}),oe=l(e=>{D&&D(e),te(e)},[D,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=ee.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ne=Vr(G,Z[0],Z[1]),ie=ne?null:Xr(b,Z[0],Z[1],q),re={};null!=O&&(re.positiveColor=O),null!=_&&(re.negativeColor=_),null!=C&&(re.connectorStroke=C),null!=j&&(re.connectorWidth=j),null!=M&&(re.gap=M),null!=P&&(re.stroke=P),null!=L&&(re.strokeWidth=L),null!=T&&(re.opacity=T);const se=X?`${f||""} semiotic-emphasis-${X}`.trim():f,ae=jd(m,b);return ne||ie||e(Di,{ref:ee,chartType:"waterfall",runtimeMode:"streaming",size:Z,margin:Q,className:se,arrowOfTime:y,windowMode:v,windowSize:ae,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:re,showAxes:U,background:B,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:oe,annotations:I,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:W,legendPosition:V,pointIdAccessor:o.pointIdAccessor})});Td.displayName="RealtimeWaterfallChart";const Bd=g(function(o,n){var r,s,a,c,d;const u=Tr(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:v="sliding",windowSize:m,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:S,extentPadding:O,heatmapXBins:_=20,heatmapYBins:C=20,aggregation:j="count",background:M,tooltipContent:P,tooltip:L,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:E,tickFormatValue:D,decay:I,pulse:H,staleness:R,linkedHover:W,selection:F,onObservation:z,chartId:$,loading:Y,emptyContent:G,emphasis:q,legendPosition:X}=o,V=u.showAxes,U=u.enableHover,K=null!=g?g:u.marginDefaults,Q=null!=h?h:[u.width,u.height],Z=null!==(d=null!=P?P:L)&&void 0!==d?d:function(o={}){const{timeAccessor:n,valueAccessor:i,xLabel:r="x",yLabel:s="y"}=o;return o=>{var a,l,c,d;const u=null!==(a=null==o?void 0:o.data)&&void 0!==a?a:null,h=null!==(l=null==u?void 0:u.xCenter)&&void 0!==l?l:Od(u,n,"time"),g=null!==(c=null==u?void 0:u.yCenter)&&void 0!==c?c:Od(u,i,"value"),f=null==u?void 0:u.count,p=null==u?void 0:u.sum,y=null==u?void 0:u.value,v=null!==(d=null==u?void 0:u.agg)&&void 0!==d?d:"count";return t("div",{className:"semiotic-tooltip",style:Ad,children:[t("div",{children:[t("span",{style:Sd,children:[r,":"]}),_d(h)]}),t("div",{children:[t("span",{style:Sd,children:[s,":"]}),_d(g)]}),null!=f&&t("div",{children:[e("span",{style:Sd,children:"count:"}),_d(f)]}),"sum"===v&&null!=p&&t("div",{children:[e("span",{style:Sd,children:"sum:"}),_d(p)]}),"mean"===v&&null!=y&&t("div",{children:[e("span",{style:Sd,children:"mean:"}),_d(y)]})]})}}({timeAccessor:x,valueAccessor:k}),J=i(null),{customHoverBehavior:ee}=Cr({selection:F,linkedHover:W,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:$}),te=l(e=>{T&&T(e),ee(e)},[T,ee]);p(n,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Vr(Y,Q[0],Q[1]),ne=oe?null:Xr(b,Q[0],Q[1],G),ie=q?`${f||""} semiotic-emphasis-${q}`.trim():f,re=jd(m,b);return oe||ne||e(Di,{ref:J,chartType:"heatmap",runtimeMode:"streaming",size:Q,margin:K,className:ie,arrowOfTime:y,windowMode:v,windowSize:re,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:S,extentPadding:O,heatmapXBins:_,heatmapYBins:C,heatmapAggregation:j,showAxes:V,background:M,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:B,svgAnnotationRules:N,tickFormatTime:E,tickFormatValue:D,decay:I,pulse:H,staleness:R,legendPosition:X,pointIdAccessor:o.pointIdAccessor})});Bd.displayName="RealtimeHeatmap";const[Nd]=be(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function Ed(e,t){return ls(this,void 0,void 0,function*(){const{format:o="png",filename:n="chart",scale:i=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),Dd(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);Id(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*i,o=l.height*i,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,o),c.scale(i,i);const d=e.querySelector("canvas");d&&c.drawImage(d,0,0,l.width,l.height);const u=(new XMLSerializer).serializeToString(a),h=new Blob([u],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(Id(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function Dd(e,t){var o;const n=e.children,i=t.children,r=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const n=r.getPropertyValue(e);n&&"none"!==n&&""!==n&&(null===(o=t.style)||void 0===o||o.setProperty(e,n))}for(let e=0;Math.min(n.length,i.length)>e;e++)Dd(n[e],i[e])}function Id(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}const Hd={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"},axisExtent:{type:"string",enum:["nice","exact"]},frameProps:{type:"object"},onClick:{type:"function"}},Rd={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Wd={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Fd=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],zd=["vertical","horizontal"],$d={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Rd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Fd},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Rd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Fd},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"}})},DifferenceChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Rd),{data:{type:"array"},xAccessor:{type:["string","function"]},seriesAAccessor:{type:["string","function"]},seriesBAccessor:{type:["string","function"]},seriesALabel:{type:"string"},seriesBLabel:{type:"string"},seriesAColor:{type:"string"},seriesBColor:{type:"string"},showLines:{type:"boolean"},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},curve:{type:"string",enum:Fd},areaOpacity:{type:"number"},gradientFill:{type:["boolean","object"]},xExtent:{type:"array"},yExtent:{type:"array"},pointIdAccessor:{type:["string","function"]},windowSize:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Rd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Fd},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({},Hd),Rd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Rd),{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"},regression:{type:["boolean","string","object"]}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Rd),{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({},Hd),Rd),{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({},Hd),Rd),{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({},Hd),Rd),{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({},Hd),Rd),{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"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:zd},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"},regression:{type:["boolean","string","object"]}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:zd},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({},Hd),Wd),{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:zd},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:zd},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({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:zd},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({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:zd},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Hd),Wd),{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({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:zd},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({},Hd),Wd),{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({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:zd},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"},regression:{type:["boolean","string","object"]}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Hd),{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({},Hd),{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:"none",dataAccessors:[],props:Object.assign(Object.assign({},Hd),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},cornerRadius:{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({},Hd),Wd),{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({},Hd),Wd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},roundedTop:{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({},Hd),{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({},Hd),{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:zd},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"}})},ProcessSankey:{required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Hd),{nodes:{type:"array"},edges:{type:"array"},domain:{type:"array"},axisTicks:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},startTimeAccessor:{type:["string","function"]},endTimeAccessor:{type:["string","function"]},xExtentAccessor:{type:["string","function"]},edgeIdAccessor:{type:["string","function"]},legendPosition:{type:"string",enum:["right","left","top","bottom"]},pairing:{type:"string",enum:["value","temporal"]},packing:{type:"string",enum:["off","reuse"]},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"]},ribbonLane:{type:"string",enum:["source","target","both"]},lifetimeMode:{type:"string",enum:["full","half"]},showLaneRails:{type:"boolean"},showQualityReadout:{type:"boolean"},edgeOpacity:{type:"number"},timeFormat:{type:"function"},valueFormat:{type:"function"},showParticles:{type:"boolean"},particleStyle:{type:"object"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Hd),{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({},Hd),{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({},Hd),{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({},Hd),{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({},Hd),{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({},Hd),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Hd),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Hd),{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({},Hd),{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({},Hd),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Hd),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Yd(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function Gd(e,t){const o=[],n=$d[e];if(!n)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys($d).join(", ")}`]};for(const i of n.required)null==t[i]&&o.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=n.props[e];if(t){if(!Yd(i,t.type)){const n=Array.isArray(t.type)?t.type.join(" | "):t.type;o.push(`"${e}" should be ${n}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&o.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(n.props),r=new Set(i);for(const n of Object.keys(t))if(void 0!==t[n]&&!r.has(n)){const t=Qr(n,i),r=t?`Unknown prop "${n}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${n}" for ${e}. Valid props: ${i.join(", ")}.`;o.push(r)}if("array"===n.dataShape){const i=t.data,r={};for(const e of n.dataAccessors){const o=t[e];"string"==typeof o&&(r[e]=o)}const s=es({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&o.push(s)}else if("object"===n.dataShape){const n=ts({componentName:e,data:t.data});n&&o.push(n)}else if("network"===n.dataShape){const i=os({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:n.required.includes("nodes"),edgesRequired:n.required.includes("edges")});i&&o.push(i)}return{valid:0===o.length,errors:o}}const qd=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Xd=new Set(["data","nodes","edges"]),Vd="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Ud(e,t,o){if(!$d[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys($d).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(qd.has(e)||!n&&Xd.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=Vd(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})}function Kd(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!$d[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Vd(e.props)}}function Qd(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Zd(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}function Jd(e){return ls(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?eu(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(o)})}function eu(e){const{component:t,props:o}=e,n=["<"+t];for(const[e,t]of Object.entries(o))if("string"==typeof t)n.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)n.push(" "+e);else if("boolean"==typeof t&&!1===t)n.push(` ${e}={false}`);else if("number"==typeof t)n.push(` ${e}={${t}}`);else{const o=JSON.stringify(t);n.push(80>o.length?` ${e}={${o}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return n.push("/>"),n.join("\n")}function tu(){const o=function(){const e=n.useContext(An);return e?()=>e.setVisible(e=>!e):null}();return o?e("button",{className:"semiotic-chart-action",onClick:o,title:"Data summary","aria-label":"Toggle data summary",style:su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const ou={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function nu({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function iu({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const ru=n.forwardRef(function({title:i,subtitle:r,children:s,width:a="100%",height:l=400,actions:c,chartConfig:d,controls:u,loading:h=!1,error:g,errorBoundary:f=!1,status:p,detailsPanel:y,className:v,style:m},b){const x=n.useRef(null),k=n.useRef(null),[w,A]=n.useState(!1),S=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),O=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),_=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&d,C=!0===(null==c?void 0:c.dataSummary),j="object"==typeof(null==c?void 0:c.export)?c.export:{},M="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",P=n.useCallback(e=>ls(this,void 0,void 0,function*(){k.current&&(yield Ed(k.current,Object.assign(Object.assign({},j),e)))}),[j]),L=n.useCallback(()=>{x.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):x.current.requestFullscreen().catch(()=>{}))},[]),T=n.useCallback(e=>ls(this,void 0,void 0,function*(){d&&(yield Jd(d,e||M||"json"))}),[d,M]);n.useEffect(()=>{const e=()=>{A(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),n.useImperativeHandle(b,()=>({export:P,toggleFullscreen:L,copyConfig:T,element:x.current}),[P,L,T]);const B=i||r||u||S||O||_||C||p,N=h?e(nu,{height:l}):g?e(iu,{error:g}):f?e(Fr,{children:s}):s;return E=t(o,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:x,className:"semiotic-chart-container"+(v?" "+v:""),style:Object.assign(Object.assign({width:a,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),m),children:[B&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[u,S&&e("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Export chart","aria-label":"Export chart",style:su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),C&&e(tu,{}),O&&e("button",{className:"semiotic-chart-action",onClick:L,title:w?"Exit fullscreen":"Fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",style:su,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(o,w?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),_&&e("button",{className:"semiotic-chart-action",onClick:()=>T(),title:"Copy config","aria-label":"Copy chart configuration",style:su,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),p&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:ou[p].bg,color:ou[p].color,lineHeight:"18px"},children:p})]})]}),t("div",{className:"semiotic-chart-body",ref:k,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},w?{flex:1}:{height:l}),children:[N,y]})]})]}),C?e(Sn,{children:E}):E;var E}),su={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function au({children:t,columns:o="auto",minCellWidth:i=300,gap:r=16,className:s,style:a}){const l="number"==typeof o?o:void 0;return e("div",{className:"semiotic-chart-grid"+(s?" "+s:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${o}, 1fr)`,gap:r,width:"100%"},a),children:n.Children.map(t,t=>n.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function lu({children:o,context:n,position:i="right",contextSize:r=250,gap:s=12,className:a,style:l}){const c="left"===i||"right"===i,d="left"===i||"top"===i,u=Object.assign({display:"flex",flexDirection:c?d?"row-reverse":"row":d?"column-reverse":"column",gap:s,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:o}),e("div",{style:h,children:n})]})}au.displayName="ChartGrid",lu.displayName="ContextLayout";function cu({children:o,position:n="right",size:r=300,trigger:a="click",chartId:c,observation:d,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[v,m]=u(null),[b,x]=u(null),[k,w]=u(!1),[A,S]=u(!1),O=i(null),_=i(void 0),C="click"===a?["click","click-end"]:["hover","hover-end"],{latest:j}=Zi({types:C,chartId:c,limit:1}),M=void 0!==d?d:j;s(()=>{if(M)if("click"===M.type||"hover"===M.type){const e=M;m(e.datum),x(e),k||(w(!0),S(!0),clearTimeout(_.current),_.current=setTimeout(()=>S(!1),200))}else!h||"click-end"!==M.type&&"hover-end"!==M.type||P()},[M]),s(()=>{null==f||f(k)},[k,f]);const P=l(()=>{S(!0),w(!1),clearTimeout(_.current),_.current=setTimeout(()=>{S(!1),m(null),x(null)},200)},[]);if(s(()=>()=>clearTimeout(_.current),[]),!v&&!A)return null;const L=v&&b?o(v,b):null;if(null===L&&!A)return null;const T=function(e,t,o,n){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${n}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:du,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const du={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};cu.displayName="DetailsPanel";const uu=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),hu=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),gu=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),fu=new Set(["LineChart","AreaChart","StackedAreaChart"]),pu=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function yu(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[o,n,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(o)+.7152*r(n)+.0722*r(i)}function vu(e,t){const o=yu(e),n=yu(t);return null===o||null===n?null:(Math.max(o,n)+.05)/(Math.min(o,n)+.05)}const mu=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function bu(e,t){const o=[],n=Gd(e,t);for(const e of n.errors)o.push({severity:"error",code:"VALIDATION",message:e,fix:""});return $d[e]?(function(e,t,o){const n=$d[e];if(n){if("array"===n.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&o.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"===n.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&o.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,o),function(e,t,o){const n=t.width,i=t.height;if(void 0===n||"number"==typeof n&&n>0||o.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(n)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||o.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,n]=t.size;(null!=e&&0>=e||null!=n&&0>=n)&&o.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${n}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,o),function(e,t,o){const n=$d[e];if(!n||"array"!==n.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 n.dataAccessors){const n=t[e];"string"==typeof n&&(n in r||o.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${n}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,o),function(e,t,o){uu.has(e)&&Array.isArray(t.data)&&o.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,o),function(e,t,o){hu.has(e)&&(t.edges||t.data||o.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,o),function(e,t,o){const n=$d[e];if(!n||"array"!==n.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&&o.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,o),function(e,t,o){t.linkedHover&&!t.selection&&o.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,o),function(e,t,o){var n;if(!gu.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&o.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!==(n=i[1])&&void 0!==n?n:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,o),function(e,t,o){if(!fu.has(e))return;if(t.gapStrategy)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=t.yAccessor||"y";"string"==typeof i&&n.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&o.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,o),function(e,t,o){var n,i;const r=null!==(n=t.width)&&void 0!==n?n: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||o.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||o.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,o),function(e,t,o){var n;const i=$d[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 o=0;a>o;o++){const i=null===(n=r[o])||void 0===n?void 0:n[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&o.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,o),function(e,t,o){if(!pu.has(e))return;const n=t.barPadding;"number"==typeof n&&10>n&&o.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${n} 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,o),function(e,t,o){if("bottom"!==t.legendPosition)return;const n=t.margin;if(!n||"object"!=typeof n)return;const i=n.bottom;"number"==typeof i&&70>i&&o.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,o),function(e,t,o){var n;if(!t.showLegend)return;if("right"!==(null!==(n=t.legendPosition)&&void 0!==n?n:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&o.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,o),function(e,t,o){if("Heatmap"!==e)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const i=n[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const n=t[e];if("string"!=typeof n)continue;const r=i[n];"string"==typeof r&&o.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${n}" 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,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=vu(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&o.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,o),function(e,t,o){const n=t.colorScheme;if(!n||!Array.isArray(n)||2>n.length)return;const i=n.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=vu(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&o.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,o),function(e,t,o){const n="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;n||i||r||o.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,o),function(e,t,o){const n=[];for(const e of mu)"function"==typeof t[e]&&n.push(e);n.length>0&&o.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${n.length>1?"s":""} detected: ${n.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,o),{ok:o.every(e=>"warning"===e.severity),diagnoses:o}):{ok:0===o.length,diagnoses:o}}function xu(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function ku(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function wu(e){return"nominal"===e||"ordinal"===e}function Au(e){return"quantitative"===e||"temporal"===e}const Su={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},Ou={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},_u={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Cu(e){var t,o,n,i,r,s,a,l,c,d,u,h,g,f;const p=[],{type:y,markProps:v}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);n.length>i;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}return o}(e,["type"])}}(e.mark),m=e.encoding||{},b=m.x,x=m.y,k=m.color,w=m.size,A=m.theta,S=m.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.url)&&p.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&p.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&p.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&p.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||e.encoding&&e.encoding.facet||e.encoding&&(e.encoding.row||e.encoding.column))&&p.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&p.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&p.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const _={};e.width&&(_.width=e.width),e.height&&(_.height=e.height);const C=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(C&&(_.title=C),(null==k?void 0:k.field)&&(_.colorBy=k.field,null===(n=k.scale)||void 0===n?void 0:n.scheme)){const e=Su[k.scale.scheme];e&&(_.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(_.pointOpacity=S.value);const j=null==b?void 0:b.aggregate,M=null==x?void 0:x.aggregate;if(O&&(j||M)){const e=M?x:b,t=M?b:x,o=_u[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:o,value:n,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[o]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of r){let n;switch(i){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=Math.min(...t);break;case"max":n=Math.max(...t);break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}return s}(O,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const o of O){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}O=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(_.data=O),(null==b?void 0:b.bin)?(_.valueAccessor=b.field,(null==x?void 0:x.field)&&(_.categoryAccessor=x.field),(null===(i=b.axis)||void 0===i?void 0:i.title)&&(_.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(_.valueAccessor=x.field,(null==b?void 0:b.field)&&(_.categoryAccessor=b.field),(null===(r=x.axis)||void 0===r?void 0:r.title)&&(_.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(s=null==b?void 0:b.bin)||void 0===s?void 0:s.maxbins)||(null===(a=null==x?void 0:x.bin)||void 0===a?void 0:a.maxbins):void 0;return t&&(_.bins=t),Mu(e,_,p)}let P;switch(y){case"bar":P=function(e,t,o,n,i,r,s){var a,l,c,d,u,h;let g;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",n.stackBy=o.field):g="BarChart",wu(null==e?void 0:e.type)&&Au(null==t?void 0:t.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(n.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(n.valueLabel=t.axis.title)):Au(null==e?void 0:e.type)&&wu(null==t?void 0:t.type)?(n.categoryAccessor=t.field,n.valueAccessor=r?"value":e.field,n.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(n.categoryLabel=t.axis.title),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(n.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(n.categoryAccessor=e.field),(null==t?void 0:t.field)&&(n.valueAccessor=s?"value":t.field),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(n.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(n.valueLabel=t.axis.title)),i&&(n.data=i),g}(b,x,k,_,O,j,M);break;case"line":if(P="LineChart",ju(b,x,_,j,M),(null==k?void 0:k.field)&&(_.lineBy=k.field),v.interpolate){const e=Ou[v.interpolate];e&&(_.curve=e)}!0===v.point&&(_.showPoints=!0),O&&(_.data=O);break;case"area":if((null==k?void 0:k.field)?(P="StackedAreaChart",_.areaBy=k.field):P="AreaChart",ju(b,x,_,j,M),v.interpolate){const e=Ou[v.interpolate];e&&(_.curve=e)}void 0!==v.opacity&&(_.areaOpacity=v.opacity),O&&(_.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(P="BubbleChart",_.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(_.sizeRange=w.scale.range)):P="Scatterplot",ju(b,x,_,j,M),O&&(_.data=O);break;case"rect":P="Heatmap",(null==b?void 0:b.field)&&(_.xAccessor=b.field),(null==x?void 0:x.field)&&(_.yAccessor=x.field),(null==k?void 0:k.field)&&(_.valueAccessor=k.field,delete _.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(_.xLabel=b.axis.title),(null===(d=null==x?void 0:x.axis)||void 0===d?void 0:d.title)&&(_.yLabel=x.axis.title),O&&(_.data=O);break;case"arc":v.innerRadius&&v.innerRadius>0?(P="DonutChart",_.innerRadius=v.innerRadius):P="PieChart",(null==A?void 0:A.field)?_.valueAccessor=A.field:(null==x?void 0:x.field)&&(_.valueAccessor=M?"value":x.field),(null==k?void 0:k.field)&&(_.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(_.categoryAccessor=b.field),O&&(_.data=O);break;case"tick":P="DotPlot",wu(null==b?void 0:b.type)?(_.categoryAccessor=b.field,(null==x?void 0:x.field)&&(_.valueAccessor=M?"value":x.field),(null===(u=null==b?void 0:b.axis)||void 0===u?void 0:u.title)&&(_.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(_.valueLabel=x.axis.title)):wu(null==x?void 0:x.type)?(_.categoryAccessor=x.field,(null==b?void 0:b.field)&&(_.valueAccessor=j?"value":b.field),_.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(_.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(_.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(_.categoryAccessor=b.field),(null==x?void 0:x.field)&&(_.valueAccessor=M?"value":x.field)),O&&(_.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),P="Scatterplot",ju(b,x,_,j,M),O&&(_.data=O)}return Mu(P,_,p)}function ju(e,t,o,n,i){var r,s;(null==e?void 0:e.field)&&(o.xAccessor=n?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(o.xLabel=e.axis.title),(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(o.yLabel=t.axis.title)}function Mu(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}export{xs as AreaChart,Ba as BarChart,Ra as BoxPlot,Ps as BubbleChart,Vs as CandlestickChart,Hi as CategoryColorProvider,ru as ChartContainer,au as ChartGrid,od as ChordDiagram,xd as CirclePack,Ms as ConnectedScatterplot,lu as ContextLayout,cu as DetailsPanel,ws as DifferenceChart,Ga as DonutChart,za as DotPlot,td as ForceDirectedGraph,Va as FunnelChart,Xa as GaugeChart,Ea as GroupedBarChart,Ls as Heatmap,Wa as Histogram,nl as LikertChart,ps as LineChart,ar as LinkedCharts,Fs as MinimapChart,Xs as MultiAxisLineChart,Vn as MultiLineTooltip,wd as OrbitDiagram,Ya as PieChart,vd as ProcessSankey,zs as QuadrantChart,Bd as RealtimeHeatmap,Pd as RealtimeHistogram,Md as RealtimeLineChart,Ld as RealtimeSwarmChart,Td as RealtimeWaterfallChart,$a as RidgelinePlot,nd as SankeyDiagram,Cs as Scatterplot,Rs as ScatterplotMatrix,As as StackedAreaChart,Na as StackedBarChart,Ia as SwarmPlot,il as SwimlaneChart,mr as ThemeProvider,Nd as TooltipProvider,md as TreeDiagram,bd as Treemap,Fa as ViolinPlot,eu as configToJSX,Jd as copyConfig,ku as deserializeSelections,bu as diagnoseConfig,Ed as exportChart,Kd as fromConfig,Zd as fromURL,Cu as fromVegaLite,xu as serializeSelections,Ud as toConfig,Qd as toURL,Ki as useBrushSelection,Ri as useCategoryColors,Zi as useChartObserver,Qi as useFilteredData,Vi as useLinkedHover,Xi as useSelection,br as useTheme,Gd as validateProps};
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as a,useCallback as l,useSyncExternalStore as c,createContext as d,useState as u,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleSequential as S,scaleBand as O}from"d3-scale";import{quadtree as C}from"d3-quadtree";import{curveNatural as _,curveBasis as j,curveStepAfter as M,curveStepBefore as P,curveStep as L,curveCatmullRom as T,curveCardinal as N,curveMonotoneY as B,curveMonotoneX as E,line as D,area as I,curveLinear as R,arc as H,pie as F}from"d3-shape";import{bin as $,quantile as W,min as z,groups as Y,max as G,sum as q,mean as X,group as V}from"d3-array";import{packEnclose as U,hierarchy as K,partition as Z,pack as Q,treemap as J,treemapBinary as ee,cluster as te,tree as ne}from"d3-hierarchy";import oe from"regression";import{interpolateNumber as ie}from"d3-interpolate";import{forceLink as re,forceSimulation as se,forceManyBody as ae,forceCenter as le,forceX as ce,forceY as de}from"d3-force";import{ribbon as ue,chord as he}from"d3-chord";const ge=Object.freeze([]);function fe(e){if(!e)return ge;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}function pe(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function ye(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function me({width:t,height:n,totalWidth:o,totalHeight:a,margin:l,dimension:c,scales:d,onBrush:u,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(u);A.current=u;const S=i(d);S.current=d;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),C=i(O);C.current=O;const _=i(!1),j=i(null);return s(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),o="x"===c?m():"y"===c?v():b();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(_.current)return;const r=S.current;if(!r)return;if(!i.selection)return j.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],a=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;s=[r.x.invert(e),r.x.invert(n)],a=[r.y.invert(o),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[pe(e[0],t),ye(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const n=r.x(s[0]),a=r.x(s[1]);if(_.current=!0,"x"===c)e.call(o.move,[n,a]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[a,t[1][1]]])}_.current=!1}const l={x:s,y:a};j.current=l,A.current(l)}),e.call(o),w.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),w.current=null}},[t,n,c,g,h,p]),s(()=>{if(!(x&&d&&w.current&&j.current))return;if(!k.current)return;if("y"===c)return;const e=j.current,t=d.x.domain()[0],n=y(k.current).select(".brush-g");if(t>=e.x[1])return _.current=!0,n.call(w.current.move,null),_.current=!1,j.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===g){const e=C.current;e&&e.length>0?o=ye(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return _.current=!0,n.call(w.current.move,null),_.current=!1,j.current=null,void A.current(null);i=!0}const r=d.x(o),s=d.x(e.x[1]);if(_.current=!0,"x"===c)n.call(w.current.move,[r,s]);else{const t=d.y(e.y[1]),o=d.y(e.y[0]);n.call(w.current.move,[[r,t],[s,o]])}if(_.current=!1,i){const t={x:[o,e.x[1]],y:e.y};j.current=t,A.current(t)}},[d,x,c,g,h]),e("svg",{ref:k,width:o,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class ve{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(e=fe(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 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(e=fe(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 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){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),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}}function be(t){let n=null;const o=()=>(n||(n=d(null)),n),s=xe(t);return[function({children:n,initialState:s}){const a=i(s),l=r(()=>xe(t,a.current),[]),c=o();return e(c.Provider,{value:l,children:n})},e=>{var t;const n=o(),r=null!==(t=a(n))&&void 0!==t?t:s,d=i(e);d.current=e;const u=l(()=>d.current(r.getState()),[r]),h=l(()=>d.current(r.getState()),[r]);return c(r.subscribe,u,h)}]}function xe(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function ke(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 we(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:Ae})})),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 Ae=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Se={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}},Oe={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}},Ce={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ae,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 _e(e,t){if("light"===t)return Se;if("dark"===t)return Oe;if("high-contrast"===t)return Ce;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?Oe:Se;return we(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 we(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[je,Me]=be(e=>({theme:Se,setTheme(t){e(e=>({theme:_e(e.theme,t)}))}}));class Pe{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 Le{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 n of e){const e=t?t(n):n;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 Te(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function Ne(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function Be(e,t,n,o,i,r,s,a){const l=[];for(const r of e){const e=n(r),s=o(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),d=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(d)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),d=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],d[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:d,style:r,datum:e,group:s}}function Ee(e,t,n,o){var i,r,s;const a=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;a.set(o,-e/2)}else if("wiggle"===o){e.length>0&&a.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],s=e[o];let l=0,c=0,d=0;for(const e of t){const t=n(e,s)||0;l+=(2*d+t)*(t-(n(e,r)||0)),c+=t,d+=t}const u=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,u-(c>0?l/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=a.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)a.set(t,(null!==(s=a.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)a.set(t,0);return a}function De(e,t,n,o,i,r,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function Ie(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 Re(e,t,n,o,i,r,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function He(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Fe(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function $e(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function We(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function ze(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Ge(e){const t=e.map(ze),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Ye(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Ye(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,a,l]=t[i],[c,d,u]=t[i+1];return Ye(Math.round(s+(c-s)*r),Math.round(a+(d-a)*r),Math.round(l+(u-l)*r))}}const qe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe=Ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ve=Ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ue=Ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Ke=Ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Ze=Ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Qe=Ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Je=Ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),et=Ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),tt=Ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),nt=Ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ot=Ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),it=Ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),rt=Ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),st=Ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),at=Ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),lt=Ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ct=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),dt=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ut=Ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ht={category10:qe,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:Xe,reds:Ve,greens:Ue,oranges:Ke,purples:Ze,viridis:Je,plasma:et},gt=qe,ft=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],yt=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 mt(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")||yt.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):gt[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))%gt.length]}function vt(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return x().domain(o).range(n).unknown("#999");const r=ht[n]||ht.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:gt;return x().domain(o).range(e).unknown("#999")}}function bt(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;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function xt(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}}function kt(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function wt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function At(e,t){return Math.min((e-t.startTime)/t.duration,1)}function St(e,t,n){return e+(t-e)*n}function Ot(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ct(e,t,n){var o,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function _t(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function jt(e,t,n,o){if(!e.scales)return null;const i=[],r=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),d=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(d)&&(i.push([l,c]),r.push([l,d]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:_t(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Mt(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Pt(e,t,n){const o=[];for(const i of n){const n=jt(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function Lt(e,t,n,o){const i=[];for(const r of o){const o=jt(e,t,n,r);o&&i.push(o)}return i}function Tt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function Nt(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const a=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=De(s,e.scales,e.getX,r,a,o,l);c&&n.push(c)}}}const Bt={topOpacity:.8,bottomOpacity:.05};function Et(e){var t,n;if(e)return!0===e?Bt:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Bt.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:Bt.bottomOpacity}}const Dt={blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Ze,greys:Qe,plasma:et,inferno:tt,magma:nt,cividis:ot,turbo:it},It=new Map;function Rt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function Ht(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=Rt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=Fe(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:Rt(e.y1Accessor,"y1"),getBottom:Rt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Ft{constructor(e){if(this.xExtent=new Le,this.yExtent=new Le,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new Pe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Fe(e.timeAccessor||e.xAccessor,"time"),this.getY=Fe(e.valueAccessor||e.yAccessor,"value")):(this.getX=Fe(e.xAccessor,"x"),this.getY=Fe(e.yAccessor,"y")),this.getGroup=We(e.groupAccessor),this.getCategory=We(e.categoryAccessor),this.getSize=e.sizeAccessor?Fe(e.sizeAccessor,"size"):void 0,this.getColor=We(e.colorAccessor),this.getY0=e.y0Accessor?Fe(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Ht(e),this.getPointId=We(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?Fe(e.openAccessor,"open"):void 0,this.getHigh=Fe(e.highAccessor,"high"),this.getLow=Fe(e.lowAccessor,"low"),this.getClose=n?Fe(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Pe(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Fe(this.config.timeAccessor||this.config.xAccessor,"time"):Fe(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}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)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,i,r,s,a,l,c,d,u,h,g,f;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(n=p.xExtent[0])&&void 0!==n?n:v[0],null!==(o=p.xExtent[1])&&void 0!==o?o:v[1]]:v,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const O=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],C="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!O&&y.size>0)if(p.normalize)S=[0,C?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(a=p.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(m),n=new Map,o=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let a=0;for(const n of e.data){const e=this.getX(n),s=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),o.add(e),a+=s;const l=(r.get(e)||0)+s;r.set(e,l),l>i&&(i=l)}n.set(e.key,t),s.set(e.key,a)}const a=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===a){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(o.push(t),r+=null!==(d=s.get(t))&&void 0!==d?d:0);f=[...o.reverse(),...n]}else f="asc"===a?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(e))&&void 0!==n?n:0)-(null!==(o=s.get(t))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):"desc"===a?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=Ee(e,f,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const n of e){const e=null!==(u=t.get(n))&&void 0!==u?u:0,o=null!==(h=r.get(n))&&void 0!==h?h:0;i>e&&(i=e),e+o>s&&(s=e+o)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const a=s-i,l=C?0:a>0?a*p.extentPadding:1;S=[i-l,s+l]}else S=[0,i+(C?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!O&&y.size>0){const[,e]=function(e,t,n,o,i){const r=Te(e,t,n,o,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,C?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!O&&y.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(y,this.getY),n=t-e,o=C?0:n>0?n*p.extentPadding:1;S=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!O&&S[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(S[0]>n&&(S[0]=n),n>S[1]&&(S[1]=n)),Number.isFinite(o)&&(S[0]>o&&(S[0]=o),o>S[1]&&(S[1]=o))}const e=S[1]-S[0],t=C?0:e>0?e*p.extentPadding:1,n=null===(g=p.yExtent)||void 0===g?void 0:g[0],o=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=n?S[0]:S[0]-t,null!=o?S[1]:S[1]+t],"log"!==p.yScaleType||S[0]>0||0>=b[0]||C||(S[0]=null!=n?S[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!O){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(S=[null!=e?e:S[0],null!=t?t:S[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const _="streaming"===p.runtimeMode,j=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(_)if("x"==("up"===(M=p.arrowOfTime)||"down"===M?"y":"x")){const t="right"===p.arrowOfTime?[j,e.width-j]:[e.width-j,j];this.scales={x:k().domain(x).range(t),y:k().domain(S).range([e.height-j,j])}}else{const t="down"===p.arrowOfTime?[j,e.height-j]:[e.height-j,j];this.scales={x:k().domain(S).range([j,e.width-j]),y:k().domain(x).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)};this.scales={x:t(p.xScaleType,x,[j,e.width-j]),y:t(p.yScaleType,S,[e.height-j,j])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),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.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,Ft.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=C().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,s,a,l;const{config:c,scales:d}=this;if(!d)return[];if(c.customLayout){const l=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},u={data:t,scales:d,dimensions:{width:e.width,height:e.height,margin:l,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=c.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ft},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(o=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(u)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(a=h.nodes)&&void 0!==a?a:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const u={scales:d,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:r}=Mt(e.ribbons);if(r.length>0&&i.push(...Pt(e,t,r)),n.length>0)for(const t of o)i.push(...Lt(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=Ne(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return Nt(e,o,i),i}(u,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Mt(e.ribbons);if(r.length>0&&o.push(...Pt(e,t,r)),i.length>0)for(const t of n)o.push(...Lt(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=Be(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),a=Et(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return Nt(e,n,o),o}(u,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Mt(e.ribbons);if(r.length>0&&o.push(...Pt(e,t,r)),i.length>0)for(const t of n)o.push(...Lt(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=Be(t.data,e.scales,e.getX,e.getY,r,n,t.key,s),a=Et(e.config.gradientFill);a&&(i.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=Ne(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Nt(e,n,o),o}(u,t);case"stackedarea":return function(e,t){var n,o,i,r;const s=e.groupData(t),a=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",l=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===a)l();else if("asc"===a||"desc"===a||"insideOut"===a){const t=new Map;for(const n of s){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===a)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else if("desc"===a)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else{const e=[...s].sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)}),r=[],a=[];let l=0,c=0;for(const n of e)c>l?(r.push(n),l+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(a.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);s.length=0,s.push(...a.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,d=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:u,stackedTops:h}=function(e,t,n,o,i,r,s,a="zero"){var l,c;const d=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&d.add(t)}const u=Array.from(d).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of u){let n=0;for(const o of e)n+=(null===(l=h.get(o.key))||void 0===l?void 0:l.get(t))||0;g.set(t,n||1)}}const f=Ee(u,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},a),p=[],y=new Map,m=new Map;for(const e of u)m.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],a=[],l=new Map;for(const n of u){let i=e.get(n)||0;const s=m.get(n);r&&(i/=g.get(n));const c=s+i,d=t.x(n);a.push([d,t.y(s)]),o.push([d,t.y(c)]),m.set(n,c),l.set(n,c)}y.set(n.key,l);const c={type:"area",topPath:o,bottomPath:a,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,d),g=u;if(e.config.pointStyle){const t=new WeakMap;for(const n of s){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Nt(e,s,g,n)}return g}(u,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);s=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const o=e.getColor(n);o&&a.has(o)&&(t=Object.assign(Object.assign({},t),{fill:a.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,d=De(n,e.scales,e.getX,e.getY,r,t,c);d&&o.push(d)}return o}(u,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=Fe(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[d,u]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(u-d||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-d)/f),s-1),u=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>u)continue;const g=u*s+l;m[g]++;const y=c(o);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/s,A=n.height/a,S=e.config.showValues,O=e.config.heatmapValueFormat,C=[];for(let e=0;a>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(l){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;C.push(Re(n*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:d+(n+.5)*f,yCenter:h+(e+.5)*p,agg:l},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return C}(e,t,n);if(0===t.length)return[];const o=Fe(e.config.valueAccessor,"value"),i=$e(e.config.xAccessor,"x"),r=$e(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),d=r(n);l[e]=o,c[e]=d,s.has(o)||s.set(o,s.size),a.has(d)||a.set(d,a.size)}const d=s.size,u=a.size;if(0===d||0===u)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const u=o(n),h=r*d+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=u,v[f]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Dt?e:"blues";let n=It.get(t);if(n)return n;n=Array(256);const o=Dt[t]||Xe;for(let e=0;256>e;e++)n[e]=o(e/255);return It.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=n.width/d,C=n.height/u,_=e.config.showValues,j=e.config.heatmapValueFormat,M=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%d;M.push(Re(o*O,(u-1-(n-o)/d)*C,O,C,A[Math.min((t-k)*S+.5|0,255)],v[e],_?{value:t,showValues:!0,valueFormat:j}:void 0))}return M}(u,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Te(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),s=Array.from(t).filter(e=>!o.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.x.domain(),d=e.config.barStyle,u=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==d?void 0:d.gap,g="number"!=typeof h||0>h?1:h,f={};(null==d?void 0:d.stroke)&&(f.stroke=d.stroke),"number"==typeof(null==d?void 0:d.strokeWidth)&&(f.strokeWidth=d.strokeWidth),"number"==typeof(null==d?void 0:d.opacity)&&(f.opacity=d.opacity);for(const t of i.values()){const n=Math.max(t.start,l),i=Math.min(t.end,c);if(n>=i)continue;const h=a.x(n),p=a.x(i),y=Math.abs(p-h),m=y>g+1?g:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(n),c=a.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==d?void 0:d.fill)||u||"#4e79a7";s.push(Ie(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=a.y(0),n=a.y(t.total);s.push(Ie(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==d?void 0:d.fill)||u||"#007bff"},f),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(u,t);return this._barCategoryCache=null!==(l=u.barCategoryCache)&&void 0!==l?l:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,a;const l=[],c=e.config.swarmStyle||{},d=null!==(n=c.radius)&&void 0!==n?n:3,u=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,g=c.stroke,f=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=u;if(e.getCategory){const t=e.getCategory(n);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:d,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(u,t);case"waterfall":return function(e,t,n){var o,i,r,s,a,l,c;const d=[],u=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===g.length)return d;const f=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(l=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const o=g[t],i=e.getX(o),r=e.getY(o),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=u.x(i),c=0!==a?u.x(i+a):l+n.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=u.y(x),S=u.y(s),O=Math.min(A,S),C=Math.abs(A-S),_={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(_.opacity=b),d.push(Ie(k,O,w,C,_,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return d}(u,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",d=i?a:s.wickColor||"#333",u=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const a=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:d,wickWidth:u,isUp:f,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(u,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?xt(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const a=s.get(t[n]);null!=a?(o[n]=xt(e,a,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=xt(e,o,r),1>i[n]&&(a=!0)):i[n]=1}a&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=xt(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const a=xt(e,t,r);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const a=kt(e,r,s);a>i&&(i=a)}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=kt(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=a,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,r,s,a;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],d=Ct(e,c,l);d&&("point"===c.type?n.set(d,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(d,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(d,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(d,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?o.set(d,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&o.set(d,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=c.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=Ct(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,_,j,M,P,L,T,N,B,E,D,I,R,H,F,$,W,z,Y,G;if(0===o.size&&0===i.size)return n;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=Ct(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];X=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];X=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;continue}const L=o.get(P);if("point"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(d=r.style.opacity)&&void 0!==d?d:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(u=L.r)&&void 0!==u?u:r.r,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("rect"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(g=r.style.opacity)&&void 0!==g?g:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("heatcell"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,X=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){V.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(_=L.lowY)&&void 0!==_?_:r.lowY,X=!0)}else r._targetOpacity=null!==(M=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==M?M:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),X=!0}for(const[e,t]of o)if(!V.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(B=t.w)&&void 0!==B?B:0,h:null!==(E=t.h)&&void 0!==E?E:0,style:{opacity:null!==(D=t.opacity)&&void 0!==D?D:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(I=t.w)&&void 0!==I?I:0,h:null!==(R=t.h)&&void 0!==R?R:0,fill:"#999",datum:null,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(F=t.openY)&&void 0!==F?F:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==($=t.closeY)&&void 0!==$?$:o,highY:null!==(W=t.highY)&&void 0!==W?W:o,lowY:null!==(z=t.lowY)&&void 0!==z?z:o,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}X=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),X&&(n.activeTransition={startTime:Ot(),duration:q}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,r,s,a,l,c;if(!n.activeTransition)return!1;const d=At(e,n.activeTransition),u=wt(d,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=St(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,u),e.y=St(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=St(n.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=St(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,u),e.y=St(n.y,e._targetY,u),void 0!==n.w&&(e.w=St(n.w,e._targetW,u)),void 0!==n.h&&(e.h=St(n.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,u),e.y=St(n.y,e._targetY,u),void 0!==n.w&&(e.w=St(n.w,e._targetW,u)),void 0!==n.h&&(e.h=St(n.h,e._targetH,u))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,u),void 0!==n.openY&&(e.openY=St(n.openY,e._targetOpenY,u)),void 0!==n.closeY&&(e.closeY=St(n.closeY,e._targetCloseY,u)),void 0!==n.highY&&(e.highY=St(n.highY,e._targetHighY,u)),void 0!==n.lowY&&(e.lowY=St(n.lowY,e._targetLowY,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=St(t[o][0],n[o][0],u),e.path[o][1]=St(t[o][1],n[o][1],u)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=St(t[n][0],o[n][0],u),e.topPath[n][1]=St(t[n][1],o[n][1],u);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=St(n[t][0],i[t][0],u),e.bottomPath[t][1]=St(n[t][1],i[t][1],u)}}if(d>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;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 if("heatcell"===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 if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||ft;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>Ft.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,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.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,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.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,a=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!He(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),d=l||!He(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||d)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Fe(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Fe(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Fe(this.config.xAccessor,"x"),this.getY=Fe(this.config.yAccessor,"y")),d&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Ht(this.config)),s=!0,a=!0)}if("groupAccessor"in e&&!He(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?We(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!He(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?We(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!He(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Fe(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!He(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!He(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Fe(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),("boundsAccessor"in e&&!He(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=Ht(this.config),s=!0,a=!0),"pointIdAccessor"in e&&!He(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?We(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!He(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!He(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!He(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!He(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Fe(this.config.openAccessor,"open"):void 0,this.getHigh=Fe(this.config.highAccessor,"high"),this.getLow=Fe(this.config.lowAccessor,"low"),this.getClose=t?Fe(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,a=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){s=!0;break}}s&&(a&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function $t(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function Wt(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}}function zt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Yt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Gt(e,t){const n=Yt(e);if(!n)return!1;const o=Yt(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function qt(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Xt(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 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-n,a=Math.sqrt(r*r+s*s);zt(e.r,o)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}Ft.GROUP_COLOR_MAP_CAP=1e3,Ft.QUADTREE_THRESHOLD=500;const Vt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ut=new WeakMap;let Kt=0,Zt=!1,Qt=null,Jt=null,en=null;function tn(e,t){var n,o;if(!t)return t;const i=Vt.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(Zt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Zt=!0;const e=()=>{Kt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Qt=new MutationObserver(e),Qt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Jt=window.matchMedia("(prefers-color-scheme: dark)"),en=e,"function"==typeof Jt.addEventListener?Jt.addEventListener("change",en):"function"==typeof Jt.addListener&&Jt.addListener(en)}catch(e){}}();let s=Ut.get(r);s&&s.version===Kt||(s={version:Kt,map:new Map},Ut.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 nn(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]}function on(e){switch(e){case"monotoneX":return E;case"monotoneY":return B;case"cardinal":return N;case"catmullRom":return T;case"step":return L;case"stepBefore":return P;case"stepAfter":return M;case"basis":return j;case"natural":return _;default:return null}}function rn(e,t,n){return null==t?n:"string"!=typeof t?t:tn(e,t)||n}function sn(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,i,r,s);for(const e of n)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(o,i,r,s),[h,g,f]=nn(e,n);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function an(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,i,r);for(const e of s)a.addColorStop(e.offset,e.color);return a}const ln=new WeakMap;function cn(e,t){const n=on(t);if(!n)return e;const o=ln.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const r={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,r,s,a,l){if(!i)return i=[a,l],void o.push([a,l]);const[c,d]=i;for(let i=1;n>=i;i++){const u=i/n,h=1-u;o.push([h*h*h*c+3*h*h*u*e+3*h*u*u*r+u*u*u*a,h*h*h*d+3*h*h*u*t+3*h*u*u*s+u*u*u*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return D().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return ln.set(e,i),i}function dn(e,t,n,o=30,i,r=0){let s=null;if(i){const e=Xt(i,t,n,o,r);e&&(s={node:e.node,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"point":if(i)break;e=hn(r,t,n,o);break;case"line":e=gn(r,t,n,o);break;case"rect":if(null==r.datum)break;e=pn(r,t,n);break;case"heatcell":e=yn(r,t,n);break;case"area":if(!1===r.interactive)break;e=vn(r,t,n);break;case"candlestick":e=mn(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function un(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=bn(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[s,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function hn(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>zt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function gn(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const s=bn(e.path,t);if(0>s)return null;const[a,l]=e.path[s];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,s-1),r=Math.min(e.path.length-2,s);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=fn(t,n,i,r,a,l);o>c&&(o=c)}c=o}else{const e=t-a,o=n-l;c=Math.sqrt(e*e+o*o)}const d=e.style,u=null!==(r=null!==(i=d.strokeWidth)&&void 0!==i?i:d.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,u/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:a,y:l,distance:c}}function fn(e,t,n,o,i,r){const s=i-n,a=r-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const d=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-d,2))}function pn(e,t,n){const o=Wt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function yn(e,t,n){const o=Wt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function mn(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+s*s)}}return null}function vn(e,t,n){if(0===e.topPath.length)return null;const o=bn(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,a=n-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function bn(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function xn(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}}function kn(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}}function wn(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?An(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?An(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}}function An(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 Sn(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function On(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function Cn(e,t,n,o,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,d=l-a.lastIngestTime>c;d!==i&&(r(d),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,i,o])}const _n={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function jn(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,_n[n])(o(e,t),i),r}function Mn({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Pn(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Ln=(n,o,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===u||void 0===u&&null!=s,{swatchSize:x,labelGap:k,rowHeight:w}=h;return p.forEach((n,u)=>{const h=jn(n,u,g,f,x),A=Pn(n,r,s),S=s&&s.size>0&&s.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):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&&b?S||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;d(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:v?e=>{d(c,u),i&&i(n);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:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,S&&e(Mn,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+u)),m+=w}),y};function Tn({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,d=c||(e=>Math.round(100*e)/100+""),u="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 t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${u})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${u})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])})]})}function Nn(n){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",legendLayout:f}=n,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),k="vertical"===g?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:Ln(t,o,i,r,s,a,l,f,c,d,u)},"legend-group-"+f)),h+=t.items.length*u.rowHeight+8}),g})({legendGroups:i||[],width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h,metrics:g})=>{var f;let p=0;const y=[];n.forEach((n,o)=>{var f;let m=0;n.label&&(m+=16);const v=((n,o,i,r,s,a,l,c,d,u,h,g)=>{const{type:f="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,A=!(!o&&!i),S="isolate"===u||void 0===u&&null!=s,O=y.map(e=>v+b+7*e.label.length),C=[];let _=0,j=0;O.forEach((e,t)=>{const n=0===j?e:j+x+e;g&&g>0&&j>0&&n>g?(C.push({start:_,end:t,width:j}),_=t,j=e):j=n}),y.length>0&&C.push({start:_,end:y.length,width:j}),C.forEach((n,u)=>{let h="center"===w?Math.max(0,((null!=g?g:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=g?g:n.width)-n.width):0;for(let g=n.start;n.end>g;g++){const n=y[g],w=jn(n,g,f,p,v),C=Pn(n,r,s),_=s&&s.size>0&&s.has(n.label);m.push(t("g",{transform:`translate(${h},${u*k})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===a&&g===l?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&S?_||!1:void 0,"aria-current":A&&!S&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(g+("ArrowRight"===e.key?1:-1)+y.length)%y.length;d(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:A?e=>{d(c,g),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:C,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,_&&e(Mn,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+g)),h+=O[g]+x}});const M=Math.max(0,...C.map(e=>e.width)),P=C.length;return{items:m,offset:M,totalRows:P,totalHeight:P*k}})(n,r,s,a,l,c,d,o,u,h,g,null!==(f=g.maxWidth)&&void 0!==f?f:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(f=g.maxWidth)&&void 0!==f?f:i;let v=p>m?0:"center"===g.align?Math.max(0,(m-p)/2):"end"===g.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},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)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:d,height:h,width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),w=!(!r&&!s);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"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&&e("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}),k]})}function Bn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function En(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Dn(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-m-10),b=s.top):"top"===a?(v=s.left,b=y?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e("g",{transform:`translate(${v}, ${b})`,children:En(o)?e(Tn,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Bn(o)?e(Nn,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:d,customClickBehavior:u,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o})}function In(e){return"string"==typeof e?{type:e}:e}function Rn({orient:n,config:o,values:i,scale:s,size:a,length:l}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),d="top"===n||"bottom"===n,u=r(()=>{if(0===i.length)return null;const o=s.domain(),r=a-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!o)return null;const{q1:a,median:l,q3:u,whiskerLow:h,whiskerHigh:g}=o,f=Math.min(.5*r,20),p=(r-f)/2+4;if(d){const o=s(a),i=s(u),r=s(l),d=s(h),y=s(g),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:d,y1:v+m*(p+f/2),x2:y,y2:v+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:d,y1:v+m*p,x2:d,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-p-f:v+p,width:Math.abs(i-o),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-p-f:v+p,x2:r,y2:"top"===n?v-p:v+p+f,stroke:c.fill,strokeWidth:2})]})}{const o=s(a),i=s(u),r=s(l),d=s(h),y=s(g),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(p+f/2),y1:d,x2:v+m*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:d,x2:v+m*(p+f),y2:d,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-p-f:v+p,y:Math.min(o,i),width:f,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-p-f:v+p,y1:r,x2:"left"===n?v-p:v+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const u=$().domain(o).thresholds(c.bins)(i);if(0===u.length)return null;const h=Math.max(...u.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:u.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(d){const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),a=s((e.x0+e.x1)/2);o.push(d?`${a},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${a}`)}for(let e=u.length-1;e>=0;e--){const i=u[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(r/2),l=s((i.x0+i.x1)/2);o.push(d?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(d){const e=0,o=null!=u[0].x0?s(u[0].x0):0;t.push(`M${o},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=u[0].x0?s(u[0].x0):0;t.push(`M${e},${o}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,a,l,n,d,4]);return u?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:u}):null}function Hn(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 Fn(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 $n(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=n;if(!s&&!a)return e("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 f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>o?"end":"start";const p=16,y=a?u?[a]:Hn(a,d):[],m=s?u?[s]:Hn(s,d):[],v="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let w=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(d,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function Wn(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,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 t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e("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(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,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(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e("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 t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e("path",{d:Fn((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function zn(t,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 e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),d=e/2,u=o/2,h=t*u>n*d?d/t:u/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 e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e("line",{x1:l,y1:c,x2:t,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,t-l);a.push(e("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 e("g",{className:"annotation-connector",children:a})}function Yn(e){const{x:n=0,y:o=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}=e,m=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof u?u:"label";if("bracket"===x&&d&&0===v&&0===b)if(void 0!==d.width){v=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;v=e+(0>e?-5:5),b=d.height/2}return t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&&zn(v,b,c,h,x,d),!m.has("subject")&&Wn(x,d,h,n,o),!m.has("note")&&$n(l,v,b,h)]}))}function Gn(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=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:t,ny:a});return e(Yn,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Yn,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function qn(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 Xn(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 Vn(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,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)}}(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=qn(e,n),c=Xn(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 Un(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Kn={linear:R,monotoneX:E,monotoneY:B,step:L,stepAfter:M,stepBefore:P,basis:j,cardinal:N,catmullRom:T};function Zn(n){return function(n,o,i){var r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,_,j,M,P,L,T,N,B,E,D,H,F,$,W,z,Y,G,q,X,V,K,Z,Q,J,ee,te;switch(n.type){case"label":{const t=Vn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return Un(r,s,i)?e(Gn,{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 t=Vn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return Un(r,s,i)?e(Gn,{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=qn(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):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,t("g",{children:[e("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&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Xn(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):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"),t("g",{children:[e("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&&e("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:qn(Object.assign(Object.assign({},e),{type:"point"}),i),y:Xn(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=U(r),a=n.padding||10;return t("g",{children:[e("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&&e("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:qn(Object.assign(Object.assign({},e),{type:"point"}),i),y:Xn(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,d=Math.max(...a)+s,u=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:u,width:d-c,height:h-u,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=qn(t,i),a=Xn(t,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=qn(n,i),r=Xn(n,i);return e(Gn,{noteData:{x:null!=t?t: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",f=i.yAccessor||"y",p="ordinal"===i.frameType,y="horizontal"===i.projection,m=p?g:null,v=p?f:null;let b;const x=[],k=new Map;if(p&&m&&v){for(const e of h){const t=e[m];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=h.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=k.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=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,A=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(!w||!A)return null;const S=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},O=w,C=A;let _;if(p)if(y){const e=S(C);_=(t,n)=>[O(n),e(t)]}else{const e=S(O);_=(t,n)=>[e(t),C(n)]}else _=(e,t)=>[O(e),C(t)];const j=n.method||"linear";let M;M="loess"===j?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 d=0,u=0,h=0,g=0,f=0;for(let e=0;n>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}(b,null!==(u=n.bandwidth)&&void 0!==u?u:.3):("polynomial"===j?oe.polynomial(b,{order:n.order||2}):oe.linear(b)).points;const P=M.map(([e,t])=>{const[n,o]=_(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",T=M[M.length-1],[N,B]=_(T[0],T[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:N+4,y:B-4,fill:L,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===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(n.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("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&&e("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!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",d=n.lowerAccessor||"lowerBounds",u=n.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=Kn[i.curve||"linear"]||R,f=I().x(e=>a(e[s])).y0(e=>l(e[d])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(A=n.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,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!==(O=null===(S=i.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(C=i.scales)||void 0===C?void 0:C.time,l=null!==(j=null===(_=i.scales)||void 0===_?void 0:_.y)&&void 0!==j?j: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 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!==(P=n.threshold)&&void 0!==P?P:2,f=d-g*h,p=!1!==n.showBand,y=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(d+g*h),k=l(f),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-d)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=qn(t,i),r=Xn(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,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!==(B=null===(N=i.scales)||void 0===N?void 0:N.x)&&void 0!==B?B:null===(E=i.scales)||void 0===E?void 0:E.time,c=null!==(H=null===(D=i.scales)||void 0===D?void 0:D.y)&&void 0!==H?H:null===(F=i.scales)||void 0===F?void 0:F.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"===(n.method||"linear")){const e=oe.polynomial(d,{order:n.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=d.length;let t=0,n=0,o=0,i=0;for(const[e,r]of d)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;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),m=null!==($=n.confidence)&&void 0!==$?$:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(W=n.steps)&&void 0!==W?W:5,x=d[h-1][0],k=(x-d[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=u(e),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`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`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),C=`${l(x)},${c(u(x))}`,_=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:n.fill||"#6366f1",fillOpacity:null!==(z=n.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e("polyline",{points:`${C} ${O}`,fill:"none",stroke:_,strokeWidth:null!==(Y=n.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:_,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=Vn(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!Un(t,r,i))return null;const s=null!==(q=n.dx)&&void 0!==q?q:0,a=null!==(X=n.dy)&&void 0!==X?X:0,l=null!==(V=n.width)&&void 0!==V?V:32,c=null!==(K=n.height)&&void 0!==K?K:32,d=null!==(Z=n.content)&&void 0!==Z?Z:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+o)}case"text":{const t=Vn(n,o,i);if(!t)return null;const{x:r,y:s}=t;return e("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=e=>"function"==typeof e&&"function"==typeof e.bandwidth,a=null===(Q=i.scales)||void 0===Q?void 0:Q.o,l=null===(J=i.scales)||void 0===J?void 0:J.x,c=null===(ee=i.scales)||void 0===ee?void 0:ee.y,d=s(a)?a:s(l)?l:s(c)?c:null;if(!d)return null;const u=d(r+"");if(null==u)return null;const h=d.bandwidth(),g=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(te=n.opacity)&&void 0!==te?te:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:d===l)?{children:[e("rect",{x:u,y:0,width:h,height:i.height||0,fill:g,fillOpacity:f}),p&&e("text",{x:u+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:h,fill:g,fillOpacity:f}),p&&e("text",{x:12,y:u+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}}}let Qn={positions:new Map};const Jn=new Set;function eo(){for(const e of Jn)e()}function to(e,t){const n=Qn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Qn.positions);o.delete(e),Qn={positions:o},eo()}function no(e,t){const n=Qn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Qn.positions);o.delete(e),Qn={positions:o},eo()}function oo(){return Qn}function io(e){return Jn.add(e),()=>Jn.delete(e)}const ro={positions:new Map};function so(){return()=>{}}function ao(){return ro}function lo(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(2>t||s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function co(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function uo(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function ho(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function go(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function fo(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function po(n){const{width:o,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:d,axes:u,showGrid:h,xFormat:g,yFormat:f,axisExtent:p}=n,y=r(()=>{var e,t;if(!c)return[];const n=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||g||yo,r=Math.max(2,Math.floor(o/70)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,a=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:lo(c.x,"exact"===p?Math.max(2,s):Math.min(s,r),p),l=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,l)})),h=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return mo(d,Math.max(55,h+8))},[c,u,g,o,p]),m=r(()=>{var e,t;if(!c)return[];const n=null==u?void 0:u.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||f||yo,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return mo((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:lo(c.y,"exact"===p?Math.max(2,s):Math.min(s,r),p)).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,u,f,i,p]),v=h&&c,b=d&&c;if(!v&&!b)return null;const x=null==u?void 0:u.find(e=>"bottom"===e.orient),k=null==u?void 0:u.find(e=>"left"===e.orient),w=b&&(!x||!1!==x.baseline),A=b&&(!k||!1!==k.baseline),S=(null==x?void 0:x.jaggedBase)||!1,O=(null==k?void 0:k.jaggedBase)||!1,C="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[v&&(()=>{var n,r;const s=go(null===(n=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),a=go(null===(r=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),m.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+n))]})})(),w&&!S&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:C,strokeWidth:1}),S&&e("path",{d:fo("bottom",o,i),fill:"none",stroke:C,strokeWidth:1}),A&&!O&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),O&&e("path",{d:fo("left",o,i),fill:"none",stroke:C,strokeWidth:1})]})})}function yo(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function mo(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function vo(o){var a,l;const{width:d,height:u,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:A,showGrid:S,title:O,legend:C,legendHoverBehavior:_,legendClickBehavior:j,legendHighlightedCategory:M,legendIsolatedCategories:P,legendPosition:L="right",legendLayout:T,foregroundGraphics:N,marginalGraphics:B,xValues:E,yValues:D,annotations:I,svgAnnotationRules:R,xAccessor:H,yAccessor:F,annotationData:$,pointNodes:W,curve:z,underlayRendered:Y,canvasObscuresUnderlay:G=!0,linkedCrosshairName:q,linkedCrosshairSourceId:X,children:V}=o,U=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||yo,i=Math.max(2,Math.floor(d/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:lo(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),a=s.map(e=>e.valueOf()),l=s.map((e,t)=>({value:e,pixel:p.x(e),label:o(e,t,a)})),c=l.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),u=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=mo(l,u);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.x.domain()[1],t=p.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,a);u>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,m,k,d,A]),K=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||w||yo,i=Math.max(2,Math.floor(u/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=mo((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:lo(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.y.domain()[1],t=p.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[y,p,m,w,u,A]),Z=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||w||yo,i=Math.max(2,Math.floor(u/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return mo((null!==(t=n.tickValues)&&void 0!==t?t:lo(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,m,w,u,A]),Q=i(new Map),J=i(null!==(a=null==I?void 0:I.length)&&void 0!==a?a:0),ee=null!==(l=null==I?void 0:I.length)&&void 0!==l?l:0;J.current!==ee&&(J.current=ee,Q.current=new Map);const te=r(()=>{if(!I||0===I.length)return null;const e=Zn(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:H,yAccessor:F,width:d,height:u,data:$,frameType:"xy",pointNodes:W,curve:z,stickyPositionCache:Q.current};return I.map((n,o)=>{if(R){const i=R(n,o,t);return null!=i?i:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[I,R,d,u,H,F,$,p,W,z]),ne=function(e){var t;const n=c(e?io:so,e?oo:ao,e?oo:ao);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(q);return s(()=>{if(!(null==ne?void 0:ne.locked)||!q)return;const e=e=>{"Escape"===e.key&&no(q)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ne?void 0:ne.locked,q]),y||O||C||N||B||te&&te.length>0||S||V||ne?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[S&&p&&(!Y||G)&&(()=>{var n,o;const i=go(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=go(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[U.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),K.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:d,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&p&&(()=>{const n=null==m?void 0:m.find(e=>"left"===e.orient),o=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,s=(null==n?void 0:n.jaggedBase)||!1,a=(null==o?void 0:o.jaggedBase)||!1,l=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&U.length>1&&(()=>{const e=d/Math.max(U.length-1,1),t=U.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=null==o?void 0:o.tickAnchor,O=null==n?void 0:n.tickAnchor,C=ho(U),_=ho(K);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!Y||G)&&r&&!a&&e("line",{x1:0,y1:u,x2:d,y2:u,stroke:h,strokeWidth:1}),(!Y||G)&&a&&e("path",{d:fo("bottom",d,u),fill:"none",stroke:h,strokeWidth:1}),U.map((n,o)=>{const i=!!l&&("function"==typeof l?l(n.value,o):Gt(n.value,o>0?U[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${u})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":co(S,n.pixel===C.min,n.pixel===C.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:d/2,y:u+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!Y||G)&&i&&!s&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:h,strokeWidth:1}),(!Y||G)&&s&&e("path",{d:fo("left",d,u),fill:"none",stroke:h,strokeWidth:1}),K.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):Gt(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:uo(O,n.pixel===_.min,n.pixel===_.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:u/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-f.left}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n||0===Z.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,s=n.tickAnchor,a=ho(Z);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:d,y1:0,x2:d,y2:u,stroke:h,strokeWidth:1}),Z.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):Gt(n.value,o>0?Z[o-1].value:void 0));return t("g",{transform:`translate(${d},${n.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:uo(s,n.pixel===a.min,n.pixel===a.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:d+f.right-15,y:u/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${d+f.right-15}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),te,B&&p&&E&&D&&t(n,{children:[B.top&&e("g",{transform:"translate(0, 0)",children:e(Rn,{orient:"top",config:In(B.top),values:E,scale:p.x,size:f.top,length:d})}),B.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(Rn,{orient:"bottom",config:In(B.bottom),values:E,scale:p.x,size:f.bottom,length:d})}),B.left&&e("g",{transform:"translate(0, 0)",children:e(Rn,{orient:"left",config:In(B.left),values:D,scale:p.y,size:f.left,length:u})}),B.right&&e("g",{transform:`translate(${d}, 0)`,children:e(Rn,{orient:"right",config:In(B.right),values:D,scale:p.y,size:f.right,length:u})})]}),N,ne&&ne.sourceId!==X&&(null==p?void 0:p.x)&&(()=>{const t=p.x(ne.xValue);if(null==t||0>t||t>d)return null;const n=ne.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),V]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof O?O:null}),Dn({legend:C,totalWidth:h,totalHeight:g,margin:f,legendPosition:L,title:O,legendLayout:T,legendHoverBehavior:_,legendClickBehavior:j,legendHighlightedCategory:M,legendIsolatedCategories:P})]}):null}function bo(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function xo(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const ko=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function wo(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=ko(i,r),t=ko(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=ko(i,r),t=ko(i,s),n=ko(o,s),l=ko(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return wo(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),d=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),u=s-r,h=e.roundStart&&e.roundEnd?u/2:u,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return wo(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=s-(f?c:0),m=r+(g?d:0),v=s-(f?d:0),b=ko(i,p),x=ko(i,y),k=(i-l)*Math.cos(c),w=ko(k,r),A=ko(k,s),S=a?null:ko(o,v),O=a?null:ko(o,m),C=a?0:(o+l)*Math.cos(d),_=a?null:ko(C,r),j=a?null:ko(C,s),M=y-p>Math.PI?1:0,P=a?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${w.x},${w.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=ko(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${M} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=ko(i,s);L+=` A${i},${i} 0 ${M} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${j.x},${j.y}`,L+=` A${l},${l} 0 0 1 ${S.x},${S.y}`;else{const e=ko(o,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${P} 0 ${O.x},${O.y}`,L+=` A${l},${l} 0 0 1 ${_.x},${_.y}`;else{const e=ko(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Ao(e){const t=wo({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:wo({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const So={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Oo(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Co(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const _o="undefined"==typeof window||"undefined"==typeof document,jo="undefined"!=typeof window?h:s;function Mo(){const[e,t]=u(!1);return jo(()=>{t(!0)},[]),e}const Po=()=>()=>{},Lo=()=>!1,To=()=>!0;function No(){const e=c(Po,Lo,To);return i(e).current}function Bo(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:a,cleanup:l}=e;jo(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,n]);const c=i(l);c.current=l,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function Eo(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Io(e,t);if(!Ro(e)||!Ro(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Io(n,i))return!1}else{if(!Ro(n)||!Ro(i))return!1;if(!Do(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function Do(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Io(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Ro(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 Ho=o.createContext(null);function Fo({children:t}){const[n,i]=o.useState(!1),r=o.useMemo(()=>({visible:n,setVisible:i}),[n]);return e(Ho.Provider,{value:r,children:t})}function $o(){return o.useContext(Ho)}const Wo={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function zo(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";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(", ")}`}function Yo(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const Go=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},qo="semiotic-accessible-data-table",Xo=qo+" semiotic-accessible-data-table-hidden",Vo=qo+" semiotic-accessible-data-table-visible",Uo=Vo+" semiotic-accessible-data-table-network",Ko={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, 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-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Zo={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Qo={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Jo={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ei={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},ti={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},ni={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function oi({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),d=$o(),u=null!==(a=null==d?void 0:d.visible)&&void 0!==a&&a,h=l||u,g=o.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=o.useCallback(()=>{l||u||c(!0)},[l,u]),y=o.useCallback(e=>{var t;u||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[u]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Wo}):null;if(!h)return e("div",{id:r,className:Xo,tabIndex:-1,onFocus:p,style:Wo,role:"region","aria-label":f,children:t("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,d,u,h,g,f,p,y,m,v,b,x,k,w,A,S,O;const C=[];if(!Array.isArray(e))return C;for(const _ of e)if(_&&"object"==typeof _&&null!==_.datum)try{switch(_.type){case"point":C.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)&&C.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)&&C.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;C.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":C.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":C.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":C.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":C.push({label:"Arc",values:{id:null!==(y=null===(p=_.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.y}});break;case"candlestick":C.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":C.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=_.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=_.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return C}(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}: ${Go(e.min)} to ${Go(e.max)}, mean ${Go(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),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:g,id:r,className:Vo,tabIndex:-1,onBlur:y,style:Ko,role:"region","aria-label":f,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Qo,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Zo,children:b}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:Jo,children:[t("caption",{className:"semiotic-accessible-data-table-caption",style:ni,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:ei,children:"type"}),w.map(t=>e("th",{style:ei,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:ti,children:n.label}),w.map(t=>{return e("td",{style:ti,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Go(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function ii({nodes:n,edges:i,chartType:r,tableId:s,chartTitle:a}){var l,c,d,u,h,g,f,p,y,m,v,b,x,k;const[w,A]=o.useState(!1),S=$o(),O=null!==(l=null==S?void 0:S.visible)&&void 0!==l&&l,C=w||O,_=a?"Data summary for "+a:s?`Data summary for ${r} ${s}`:"Data summary for "+r,j=o.useRef(null),M=o.useCallback(()=>{w||O||A(!0)},[w,O]),P=o.useCallback(e=>{var t;O||(null===(t=j.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[O]);if(!n||0===n.length)return s?e("span",{id:s,tabIndex:-1,style:Wo}):null;if(!C)return e("div",{id:s,className:Xo,tabIndex:-1,onFocus:M,style:Wo,role:"region","aria-label":_,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",n.length," nodes, ",i.length," edges)"]})});const L=Array.isArray(n)?n:[],T=Array.isArray(i)?i:[],N=new Map,B=new Map,E=new Map,D=new Map;for(const e of T){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,n="object"==typeof t.source?null===(d=t.source)||void 0===d?void 0:d.id:t.source,o="object"==typeof t.target?null===(u=t.target)||void 0===u?void 0:u.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";B.set(e,(null!==(h=B.get(e))&&void 0!==h?h:0)+1),D.set(e,(null!==(g=D.get(e))&&void 0!==g?g:0)+i)}if(null!=o&&""!==o){const e=o+"";N.set(e,(null!==(f=N.get(e))&&void 0!==f?f:0)+1),E.set(e,(null!==(p=E.get(e))&&void 0!==p?p:0)+i)}}const I=[];for(let e=0;L.length>e;e++){const t=L[e];if(!t||"object"!=typeof t)continue;const n=null!==(m=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==m?m:t.id,o=null!=n?n+"":"node-"+e,i=null!==(v=N.get(o))&&void 0!==v?v:0,r=null!==(b=B.get(o))&&void 0!==b?b:0,s=null!==(x=E.get(o))&&void 0!==x?x:0,a=null!==(k=D.get(o))&&void 0!==k?k:0;I.push({id:o,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}I.sort((e,t)=>t.degree-e.degree);let R=0,H=0;if(I.length>0){let e=0;for(const t of I)e+=t.degree,t.degree>H&&(H=t.degree);R=e/I.length}const F=T.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),$=[`${I.length} nodes, ${T.length} edges.`];I.length>0&&$.push(`Mean degree: ${Go(R)}, max degree: ${H}.`);const W=I.slice(0,5);return t("div",{ref:j,id:s,className:Uo,tabIndex:-1,onBlur:P,style:Ko,role:"region","aria-label":_,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{O&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Qo,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Zo,children:$.join(" ")}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+r,style:Jo,children:[t("caption",{className:"semiotic-accessible-data-table-caption",style:ni,children:["Top ",W.length," of ",I.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:ei,children:"id"}),e("th",{style:ei,children:"degree"}),e("th",{style:ei,children:"in"}),e("th",{style:ei,children:"out"}),F&&e("th",{style:ei,children:"w. degree"}),F&&e("th",{style:ei,children:"w. in"}),F&&e("th",{style:ei,children:"w. out"})]})}),e("tbody",{children:W.map((n,o)=>t("tr",{children:[e("td",{style:ti,children:n.id}),e("td",{style:ti,children:n.degree}),e("td",{style:ti,children:n.inDeg}),e("td",{style:ti,children:n.outDeg}),F&&e("td",{style:ti,children:Go(n.wDegree)}),F&&e("td",{style:ti,children:Go(n.wInDeg)}),F&&e("td",{style:ti,children:Go(n.wOutDeg)})]},o))})]})]})}function ri({summary:t}){return t?e("div",{role:"note",style:Wo,children:t}):null}function si({tableId:t}){return e("a",{href:"#"+t,style:Wo,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Wo)},children:"Skip to data table"})}function ai({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Wo,children:n})}const li="var(--semiotic-focus, #005fcc)";function ci({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let d;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);d=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:li,strokeWidth:2,strokeDasharray:"4,2"})}else d=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:li,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:li,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}function di(e){return Array.isArray(e)?e[0]:e}function ui(e,t,n,o){return Object.assign({data:di(e),x:t,y:n,__semioticHoverData:!0},o)}const hi={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 gi(e,t){return"function"==typeof t?t(e):e[t]}function fi(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 pi(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=gi(n,i);l=fi(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=gi(n,o);c.push({label:t,value:fi(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=fi(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=fi(n[e[0]],r))}}const d=Object.assign(Object.assign({},hi),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:d,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function yi(n={}){const{fields:o=[],title:i,format:r,style:s={},className:a="",showLabels:l=!0,separator:c=": "}=n;return n=>{if(!n||"object"!=typeof n)return null;const d=[];if(i){const e=gi(n,i);d.push({value:fi(e,r)})}o&&Array.isArray(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=fi(gi(n,o),i);d.push({label:l?t:void 0,value:s})}):Object.keys(n).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{d.push({label:l?e:void 0,value:fi(n[e],r)})});const u=Object.assign(Object.assign({},hi),s);return Array.isArray(d)&&0!==d.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u,children:d.map((e,n)=>t("div",{style:{marginBottom:d.length-1>n?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},n))}):null}}function mi(){return n=>{var o,i,r,s,a,l,c;const d=n.allSeries;if(!d||0===d.length){const t=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:hi,children:e("div",{children:fi(t)})})}const u=null!==(l=null!==(s=n.xValue)&&void 0!==s?s:null===(a=n.data)||void 0===a?void 0:a.time)&&void 0!==l?l:null===(c=n.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:hi,children:[null!=u&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:fi(u)}),d.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:fi(n.value)})]},o))]})}}function vi(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=di(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:hi,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?pi(t):pi())}}function bi({x:t,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=Number.isFinite(t)&&Number.isFinite(n),u=o.useRef(null),[h,g]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let f;f=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(a),y=p?null:hi;return d?e("div",{ref:u,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:a}):null}function xi(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}function ki(e,t,n){const o=i(null),[r,a]=u(null);return s(()=>{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]]]}const wi="undefined"==typeof window?s:h;function Ai(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Si(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),xi(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[a,c]=ki(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=Ai(e.foregroundGraphics,c,d),p=Ai(e.backgroundGraphics,c,d),y=Me(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=i(0),k=i(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),C=i(0),_=l(()=>{C.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),j=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(_))},[_]),M=l(()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),S.current()},[]);s(()=>()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const P=e.themeDirtyRef;return wi(()=>{P&&(Kt++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:j,onPointerLeave:M}}function Oi(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function Ci(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function _i(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function ji(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;l>o&&(r*=o/l),l>a-o&&(r*=(a-o)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const Mi=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=a.style.stroke||"#007bff",d=tn(e,c)||c,u=a.style.strokeWidth||2,h=a.colorThresholds,g=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=u,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const m=null!==(i=a.style.opacity)&&void 0!==i?i:1;ji(e,a.path,d,u,m,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=on(a.curve),p=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!p){e.strokeStyle=d;const v=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let b=0;a.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(a.path[b][0],a.path[b][1]),e.lineTo(a.path[b+1][0],a.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),S=!0}function C(){S&&(e.stroke(),S=!1)}for(let _=0;a.path.length>_;_++){const[j,M]=a.path[_],P=g[_],L=_i(P,h,d);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(j,M);else{const T=[];for(const N of h){const B=N.value;(w>B||B>P)&&(B>w||P>B)||w===B||P===B||T.push({t:(B-w)/(P-w)})}T.sort((e,t)=>e.t-t.t);for(const E of T){const I=x+(j-x)*E.t,R=k+(M-k)*E.t,H=_i(w+(P-w)*Math.min(E.t+1e-4,1),h,d);e.lineTo(I,R),C(),O(H,I,R)}e.lineTo(j,M)}x=j,k=M,w=P,A=L}else O(L,j,M),x=j,k=M,w=P,A=L}C()}else{e.beginPath();const F=a.strokeGradient&&a.path.length>=2?an(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=F||d,f)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[$,W]=a.path[0];e.moveTo($,W);for(let z=1;a.path.length>z;z++)e.lineTo(a.path[z][0],a.path[z][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=rn(e,a.style.fill,a.style.fill),f&&!p)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[G,q]=a.path[0];e.moveTo(G,q);for(let X=1;a.path.length>X;X++)e.lineTo(a.path[X][0],a.path[X][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Pi(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Li(e,t,n=.3){Pi(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 Ti(e,t,n=.6){var o,i,r,s,a;if(!Pi(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o: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*n,e.stroke()}function Ni(e,t,n,o=.35){Pi(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Bi(e,t){const n=on(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=I().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Ei=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const l=rn(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const d=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Bi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=sn(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,n,0,o);e.fillStyle=i||l,e.globalAlpha=d}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*d,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Bi(e,t),Ni(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const n=t.strokeGradient&&t.topPath.length>=2?an(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=on(t.curve);if(e.beginPath(),o)D().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==a&&1>a&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Di=(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=rn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=rn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Ti(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Ii(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=xo(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Ri(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 Hi=(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)Fi(e,t);else if(t.cornerRadii&&bo(t.cornerRadii)){const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=Ri(t),i=t.fillGradient&&"string"==typeof n?sn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Ii(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=Ri(t),i=t.fillGradient&&"string"==typeof n?sn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;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=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=Ri(t),i=t.fillGradient&&"string"==typeof n?sn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Li(e,t),e.globalAlpha=1}};function Fi(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()}function $i(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Wi(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const zi=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=tn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Li(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Wi(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=$i(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},Yi=(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const a=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==a&&(e.globalAlpha=a);const l=tn(e,t.wickColor)||t.wickColor,c=60>o.height,d=c?Math.max(t.wickWidth,2):t.wickWidth,u=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=d,e.stroke()};if(c||u(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=tn(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&u(),e.restore()}};function Gi(e,t){if(!t)return[];const n=new Set,o=[];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+"";n.has(r)||(n.add(r),o.push(r))}return o}function qi(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function Xi(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}function Vi(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}const Ui=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ki(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${Ui[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Ui[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Zi={line:[Ei,Mi,Di],area:[Ei,Di],stackedarea:[Ei,Di],scatter:[Di],bubble:[Di],heatmap:[zi],bar:[Hi],swarm:[Di],waterfall:[(e,t,n,o)=>{var i;Hi(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,a=null==s?void 0:s._connectorStroke;if(a){e.save(),e.strokeStyle=tn(e,a)||a,e.lineWidth=null!==(i=null==s?void 0:s._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==a?void 0:a.baseline))continue;const l=n.y(s.cumEnd),c=o.x+o.w,d=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(d,l),e.stroke()}e.restore()}}],candlestick:[Yi],mixed:[Ei,Mi,Di],custom:[Ei,Hi,zi,Mi,Di,Yi]},Qi={top:20,right:20,bottom:30,left:40},Ji={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function er(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const tr={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function nr({hover:n}){var o,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",a=null!==(o=n.data)&&void 0!==o?o:{},l=null!==(i=a.y)&&void 0!==i?i:a.value,c=null!==(r=a.x)&&void 0!==r?r:a.time;return t("div",{className:"semiotic-tooltip",style:tr,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(l)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}nr.ownsChrome=!0;const or=g(function(n,a){var c,d,h,g,y,m,v,b,x,k,w,A,S;const{chartType:O,runtimeMode:C,data:_,chunkThreshold:j,chunkSize:M,xAccessor:P,yAccessor:L,colorAccessor:T,sizeAccessor:N,groupAccessor:B,lineDataAccessor:E,curve:D,normalize:I,baseline:R,stackOrder:H,binSize:F,valueAccessor:$,arrowOfTime:W="right",windowMode:z="sliding",windowSize:Y=200,timeAccessor:G,xExtent:q,yExtent:X,extentPadding:V=.1,scalePadding:U,sizeRange:K,size:Z=[500,300],responsiveWidth:Q,responsiveHeight:J,margin:ee,className:te,background:ne,lineStyle:oe,pointStyle:ie,areaStyle:re,barStyle:se,waterfallStyle:ae,swarmStyle:le,barColors:ce,colorScheme:de,boundsAccessor:ue,boundsStyle:he,y0Accessor:ge,band:pe,gradientFill:ye,lineGradient:be,areaGroups:xe,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,showAxes:_e=!0,axes:je,xLabel:Me,yLabel:Pe,yLabelRight:Le,xFormat:Te,yFormat:Ne,axisExtent:Be,tickFormatTime:Ee,tickFormatValue:De,hoverAnnotation:Ie,tooltipContent:Re,customHoverBehavior:He,customClickBehavior:Fe,enableHover:$e,hoverRadius:We=30,tooltipMode:ze,annotations:Ye,svgAnnotationRules:Ge,showGrid:qe,legend:Xe,legendHoverBehavior:Ve,legendClickBehavior:Ue,legendHighlightedCategory:Ke,legendIsolatedCategories:Ze,legendPosition:Qe,legendLayout:Je,legendCategoryAccessor:et,onCategoriesChange:tt,backgroundGraphics:nt,foregroundGraphics:ot,canvasPreRenderers:it,svgPreRenderers:rt,title:st,categoryAccessor:at,brush:lt,onBrush:ct,decay:dt,pulse:ut,transition:ht,animate:gt,staleness:ft,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,marginalGraphics:xt,pointIdAccessor:kt,xScaleType:wt,yScaleType:At,accessibleTable:St=!0,description:Ot,summary:Ct,linkedCrosshairName:_t,linkedCrosshairSourceId:jt,customLayout:Mt,layoutConfig:Pt}=n,Lt=f().replace(/:/g,""),Nt=i(!1),Bt=Si({sizeProp:Z,responsiveWidth:Q,responsiveHeight:J,userMargin:ee,marginDefault:Qi,animate:gt,transitionProp:ht,themeDirtyRef:Nt}),Et=Mo(),Dt=No(),{reducedMotionRef:It,responsiveRef:Rt,size:Ht,currentTheme:Wt,transition:zt,introEnabled:Yt,tableId:Gt,rafRef:qt,renderFnRef:Xt,scheduleRender:Vt}=Bt;let Ut=Bt.margin;if(xt){const e=60,t=Object.assign({},Bt.margin);xt.top&&e>t.top&&(t.top=e),xt.bottom&&e>t.bottom&&(t.bottom=e),xt.left&&e>t.left&&(t.left=e),xt.right&&e>t.right&&(t.right=e),Ut=t}const Kt="function"==typeof ot?ot({size:Ht,margin:Ut}):ot,Zt="function"==typeof nt?nt({size:Ht,margin:Ut}):nt,Qt=Ht[0]-Ut.left-Ut.right,Jt=Ht[1]-Ut.top-Ut.bottom,en=r(()=>fe(_),[_]),nn=null!=Ie?Ie:$e,on=i(null),rn=i(null),[sn,an]=u(0),[ln,hn]=u(null),gn=i(null),fn=i(null),[pn,yn]=u(null),mn=i(Ji.primary),vn=i([]),An=i(et),Sn=i(tt);An.current=et,Sn.current=tt;const[_n,jn]=u(!1),[Mn,Pn]=u([]),[Ln,Tn]=u([]),Nn="streaming"===C||["bar","swarm","waterfall"].includes(O),Bn=r(()=>{var e,t,n;return{chartType:O,runtimeMode:Nn?"streaming":"bounded",windowSize:Y,windowMode:z,arrowOfTime:Nn?W:"right",extentPadding:V,scalePadding:U,axisExtent:Be,xAccessor:P,yAccessor:L,timeAccessor:Nn?G:void 0,valueAccessor:$,colorAccessor:T,sizeAccessor:N,groupAccessor:B||(E?"_lineGroup":void 0),categoryAccessor:at,lineDataAccessor:E,xScaleType:wt,yScaleType:At,xExtent:q,yExtent:X,sizeRange:K,binSize:F,normalize:I,baseline:R,stackOrder:H,boundsAccessor:ue,boundsStyle:he,y0Accessor:ge,band:pe,gradientFill:!0===ye?{topOpacity:.8,bottomOpacity:.05}:!1===ye?void 0:ye,areaGroups:xe?new Set(xe):void 0,lineGradient:be,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,lineStyle:oe,pointStyle:ie,areaStyle:re,swarmStyle:le,waterfallStyle:ae,colorScheme:de,barColors:ce,barStyle:se,annotations:Ye,decay:dt,pulse:ut,transition:zt,introAnimation:Yt,staleness:ft,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,pointIdAccessor:kt,curve:D,themeCategorical:null===(e=null==Wt?void 0:Wt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Wt),themeSequential:null===(t=null==Wt?void 0:Wt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Wt?void 0:Wt.colors)||void 0===n?void 0:n.diverging,customLayout:Mt,layoutConfig:Pt,layoutMargin:Ut}},[O,Y,z,W,V,U,Be,P,L,G,$,wt,At,T,N,B,at,E,q,X,K,F,I,R,H,ue,he,ge,pe,ye,be,xe,we,Ae,Se,Oe,Ce,oe,ie,re,le,ae,se,de,ce,Ye,dt,ut,null==zt?void 0:zt.duration,null==zt?void 0:zt.easing,Yt,ft,pt,yt,mt,vt,bt,Nn,kt,D,Wt,Mt,Pt,Ut]),En=Eo(Bn),Dn=i(null);Dn.current||(Dn.current=new Ft(En));const In=l(()=>{var e,t;const n=An.current,o=Sn.current;if(!o||!n)return;const i=Gi(null!==(t=null===(e=Dn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);qi(i,vn.current)||(vn.current=i,o(i))},[]);s(()=>{var e;null===(e=Dn.current)||void 0===e||e.updateConfig(En),Nt.current=!0,Vt()},[En,Vt]);const Rn=i(null);Rn.current||(Rn.current=new ve(e=>{const t=Dn.current;t&&t.ingest(e)&&(Nt.current=!0,Vt())},{chunkThreshold:j,chunkSize:M})),s(()=>{var e;null===(e=Rn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:j,chunkSize:M})},[j,M]);const Hn=l(e=>{var t;null===(t=Rn.current)||void 0===t||t.push(e)},[]),Fn=l(e=>{var t;null===(t=Rn.current)||void 0===t||t.pushMany(e)},[]),$n=l(()=>{var e,t;null===(e=Rn.current)||void 0===e||e.clear(),null===(t=Dn.current)||void 0===t||t.clear(),Nt.current=!0,Vt()},[Vt]);p(a,()=>({push:Hn,pushMany:Fn,remove:e=>{var t,n,o;null===(t=Rn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Dn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(gn.current&&i.some(e=>{var t;return e===(null===(t=gn.current)||void 0===t?void 0:t.data)})&&(gn.current=null,yn(null)),Nt.current=!0,Vt()),i},update:(e,t)=>{var n,o,i;null===(n=Rn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Dn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Nt.current=!0,Vt()),r},clear:$n,getData:()=>{var e,t,n;return null===(e=Rn.current)||void 0===e||e.flush(),null!==(n=null===(t=Dn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Dn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Dn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Hn,Fn,$n,Vt]),s(()=>{var e,t;if(_){if(E&&en.length>0&&"object"==typeof en[0]&&null!==en[0]){const t="string"==typeof E?E:"coordinates";if(Array.isArray(en[0][t])){const n=[];for(const e of en){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=Rn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Rn.current)||void 0===t||t.setBoundedData(en)}},[_,en,E]);const{hoverHandlerRef:Wn,hoverLeaveRef:zn,onPointerMove:Yn,onPointerLeave:Gn}=Bt;Wn.current=e=>{var t,n;if(!nn)return;const o=on.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-Ut.left,s=e.clientY-i.top-Ut.top;if(0>r||r>Qt||0>s||s>Jt)return void(gn.current&&(gn.current=null,fn.current=null,yn(null),He&&(He(null),Nt.current=!0),Vt()));const a=Dn.current;if(!a||0===a.scene.length)return;const l=dn(a.scene,r,s,We,a.quadtree,a.maxPointRadius),c="multi"===ze,d=()=>{gn.current&&(gn.current=null,fn.current=null,yn(null),He&&He(null),Vt())};if(!l&&!c)return void d();const u=c||!l?r:l.x,h=c||!l?s:l.y;let g=ui((null==l?void 0:l.datum)?Tt(l.datum,a.resolvedRibbons):{},u,h);if(c&&a.scene.length>0&&a.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=un(cn(e.path,e.curve),t,n);if(null===r)continue;const s=bn(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=cn(e.topPath,e.curve),s=cn(e.bottomPath,e.curve),a=un(r,t,n);if(null===a)continue;const l=un(s,t,n),c=bn(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:null!=l?l:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(a.scene,u,Math.max(We,Qt));if(e.length>0){const t=a.scales.y.invert,n=a.scales.x.invert,o=mn.current,i=n?n(u):u;if(l)g.xValue=i,g.xPx=u;else{const e={xValue:i};"string"==typeof P&&(e[P]=i),g=ui(e,u,h,{xValue:i,xPx:u})}g.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===O&&null!=i?n-i:n,valuePx:e.y,color:e.color||o,datum:Tt(e.datum,a.resolvedRibbons)}})}}l||(null===(t=g.allSeries)||void 0===t?void 0:t.length)?(gn.current=g,fn.current=null!==(n=null==l?void 0:l.node)&&void 0!==n?n:null,yn(g),He&&(He(g),Nt.current=!0),Vt()):d()},zn.current=()=>{gn.current&&(gn.current=null,fn.current=null,yn(null),He&&(He(null),Nt.current=!0),Vt())};const qn=i(()=>{});qn.current=e=>{if(!Fe)return;const t=on.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ut.left,i=e.clientY-n.top-Ut.top;if(0>o||o>Qt||0>i||i>Jt)return void Fe(null);const r=Dn.current;if(!r||0===r.scene.length)return void Fe(null);const s=dn(r.scene,o,i,We,r.quadtree,r.maxPointRadius);Fe(s?ui(s.datum||{},s.x,s.y):null)};const Xn=l(e=>qn.current(e),[]),Vn=i(-1),Un=i(null),Kn=i(null),Zn=l(e=>{const t=Dn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Kn.current&&Kn.current.version===n)o=Kn.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});break}case"rect":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:"_default"});break;case"heatcell":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:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=xn(e),Kn.current={version:n,graph:o}}const i=Vn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Vn.current=0;const n=o.flat[0];Un.current={shape:n.shape,w:n.w,h:n.h};const i=On(Object.assign(Object.assign({},n),{datum:Tt(n.datum,t.resolvedRibbons)}));return gn.current=i,yn(i),He&&He(i),void Vt()}const r=kn(o,i),s=wn(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return Vn.current=-1,Un.current=null,gn.current=null,fn.current=null,yn(null),He&&He(null),void Vt();Vn.current=s;const a=o.flat[s];Un.current={shape:a.shape,w:a.w,h:a.h};const l=On(Object.assign(Object.assign({},a),{datum:Tt(a.datum,t.resolvedRibbons)}));gn.current=l,yn(l),He&&He(l),Vt()},[He,Vt]),Qn=l(e=>{Vn.current=-1,Un.current=null,Yn(e)},[Yn]);Xt.current=()=>{var e,t;qt.current=0;const n=on.current,o=rn.current;if(!n||!o)return;const i=Dn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(It.current?r+1e6:r),a=!It.current&&s,l=Nt.current||s;l&&!a&&(i.computeScene({width:Qt,height:Jt}),In());const c=Ci(),d=function(e){if(!e)return Ji;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||n||r?{axisStroke:l||Ji.axisStroke,tickText:s||Ji.tickText,crosshair:s?er(s,"66"):Ji.crosshair,hoverFill:c?er(c,"4D"):Ji.hoverFill,hoverStroke:s?er(s,"99"):Ji.hoverStroke,pointRing:c||Ji.pointRing,primary:r||Ji.primary}:Ji}(n);mn.current=d.primary;const u=null!==(e=null==ft?void 0:ft.threshold)&&void 0!==e?e:5e3,h=ft&&i.lastIngestTime>0&&r-i.lastIngestTime>u;if(l){const e=Oi(n,Ht,Ut,c);if(e){if(e.clearRect(-Ut.left,-Ut.top,Ht[0],Ht[1]),h&&(e.globalAlpha=null!==(t=null==ft?void 0:ft.dimOpacity)&&void 0!==t?t:.5),"transparent"!==ne&&!nt){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=ne||(t&&"transparent"!==t?t:null),i=o?tn(e,o):null;i&&(e.fillStyle=i,e.fillRect(-Ut.left,-Ut.top,Ht[0],Ht[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Qt,Jt),e.clip()),it&&i.scales)for(const t of it)e.save(),t(e,i.scene,i.scales,{width:Qt,height:Jt}),e.restore();const o=Mt?Zi.custom:Zi[O];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:Qt,height:Jt});e.restore(),h&&(e.globalAlpha=1)}}{const e=Oi(o,Ht,Ut,c);if(e&&(e.clearRect(-Ut.left,-Ut.top,Ht[0],Ht[1]),nn&&gn.current&&i.scales&&function(e,t,n,o,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,d=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const u="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?d:t.x,0),e.lineTo(c?d:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of l)null!=t.valuePx&&(e.beginPath(),e.arc(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,gn.current,Qt,Jt,"object"==typeof nn?nn:{},fn.current,d),fn.current&&Array.isArray(Ie))){const t=Ie.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s="group"in n?n.group:void 0;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,fn.current,t,d)}}l&&n&&n.setAttribute("aria-label",zo(i.scene,O+" chart"));const g=Nt.current;if(Nt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!ln||e(ln.x.domain()[0])!==e(i.scales.x.domain()[0])||e(ln.x.domain()[1])!==e(i.scales.x.domain()[1])||e(ln.y.domain()[0])!==e(i.scales.y.domain()[0])||e(ln.y.domain()[1])!==e(i.scales.y.domain()[1])||ln.x.range()[0]!==i.scales.x.range()[0]||ln.x.range()[1]!==i.scales.x.range()[1]||ln.y.range()[0]!==i.scales.y.range()[0]||ln.y.range()[1]!==i.scales.y.range()[1])&&hn(i.scales),xt){const e=i.getData(),t="function"==typeof P?P:e=>e[P||"x"],n="function"==typeof L?L:e=>e[L||"y"];Pn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Tn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Ye&&Ye.length>0&&an(e=>e+1),(null==ft?void 0:ft.showBadge)&&jn(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(qt.current=requestAnimationFrame(()=>Xt.current()))},Bo({hydrated:Et,wasHydratingFromSSR:Dt,storeRef:Dn,dirtyRef:Nt,renderFnRef:Xt,cleanup:()=>{var e;return null===(e=Rn.current)||void 0===e?void 0:e.clear()}}),s(()=>{Nt.current=!0,Vt()},[O,Qt,Jt,_e,ne,oe,it,Vt]),Cn(ft,Dn,Nt,Vt,_n,jn);const Jn=r(()=>{if(Te||Ee)return;const e=Dn.current;return(null==e?void 0:e.xIsDate)&&ln?Ki(ln.x.domain()):void 0},[Te,Ee,ln]),eo=Te||Ee||Jn,to=nn&&pn?Re?Re(pn):e(nr,{hover:pn}):null,no=to?e(bi,{x:pn.x,y:pn.y,containerWidth:Qt,containerHeight:Jt,margin:Ut,className:"stream-frame-tooltip",children:to}):null,oo=Un.current,io=e(ci,{active:Vn.current>=0,hoverPoint:pn,margin:Ut,size:Ht,shape:null==oo?void 0:oo.shape,width:null==oo?void 0:oo.w,height:null==oo?void 0:oo.h}),ro=Xi(P,G,"__semiotic_resolvedX","__semiotic_resolvedTime"),so=Xi(L,$,"__semiotic_resolvedY","__semiotic_resolvedValue"),ao=ro.key,lo=so.key,co=Vi(ro,so,Ye&&Ye.length>0||!1);if(_o||!Et&&Dt){const n=Dn.current;n&&_&&(n.ingest({inserts:en,bounded:!0}),n.computeScene({width:Qt,height:Jt}));const i=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(d=null==n?void 0:n.scales)&&void 0!==d?d:null,s=eo||(()=>{if((null==n?void 0:n.xIsDate)&&r)return Ki(r.x.domain())})();return t("div",{ref:Rt,className:"stream-xy-frame"+(te?" "+te:""),role:"img","aria-label":Ot||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:Q?"100%":Ht[0],height:J?"100%":Ht[1]},children:[e(ri,{summary:Ct}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Ut.left},${Ut.top})`,children:Zt}),t("g",{transform:`translate(${Ut.left},${Ut.top})`,children:[ne&&e("rect",{x:0,y:0,width:Qt,height:Jt,fill:ne}),rt&&r&&rt.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:Qt,height:Jt})},"svgpre-"+n)),i.map((n,o)=>function(n,o,i){var r,s,a,l,c;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const c=n;if(0===c.topPath.length)return null;const d=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const n=`${i?i+"-":""}area-clip-${o}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:n,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:d,fill:Oo(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+o)}return e("path",{d:d,fill:Oo(c.style.fill),fillOpacity:null!==(l=null!==(a=c.style.fillOpacity)&&void 0!==a?a:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Oo(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Oo(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,a]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),l=.299*r+.587*s+.114*a>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),a=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:a,stroke:a,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o,Lt)).filter(Boolean)]})]}),e(vo,{width:Qt,height:Jt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,scales:r,showAxes:_e,axes:je,xLabel:Me,yLabel:Pe,yLabelRight:Le,xFormat:s,yFormat:Ne||De,axisExtent:Be,showGrid:qe,title:st,legend:Xe,legendHoverBehavior:Ve,legendClickBehavior:Ue,legendHighlightedCategory:Ke,legendIsolatedCategories:Ze,legendPosition:Qe,legendLayout:Je,foregroundGraphics:$t(Kt,null===(h=Dn.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:xt,xValues:[],yValues:[],annotations:Ye,svgAnnotationRules:Ge,annotationFrame:0,xAccessor:ao,yAccessor:lo,annotationData:co(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,linkedCrosshairName:_t,linkedCrosshairSourceId:jt})]})}return t("div",{ref:Rt,className:"stream-xy-frame"+(te?" "+te:""),role:"group","aria-label":Ot||("string"==typeof st?st:"XY chart"),tabIndex:0,style:{position:"relative",width:Q?"100%":Ht[0],height:J?"100%":Ht[1],overflow:"visible"},onKeyDown:Zn,children:[St&&e(si,{tableId:Gt}),St&&e(oi,{scene:null!==(y=null===(g=Dn.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:Gt,chartTitle:"string"==typeof st?st:void 0}),e(ri,{summary:Ct}),t("div",{role:"img","aria-label":Ot||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?Qn:void 0,onMouseLeave:nn?Gn:void 0,onClick:Fe?Xn:void 0,children:[Zt&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ht[0],height:Ht[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Ut.left},${Ut.top})`,children:Zt})}),e(po,{width:Qt,height:Jt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,scales:ln,showAxes:_e,axes:je,showGrid:qe,xFormat:eo,yFormat:Ne||De,axisExtent:Be}),e("canvas",{ref:on,"aria-label":zo(null!==(v=null===(m=Dn.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],O+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:rn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(ai,{hoverPoint:pn}),e(vo,{width:Qt,height:Jt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,scales:ln,showAxes:_e,axes:je,xLabel:Me,yLabel:Pe,yLabelRight:Le,xFormat:eo,yFormat:Ne||De,axisExtent:Be,showGrid:qe,title:st,legend:Xe,legendHoverBehavior:Ve,legendClickBehavior:Ue,legendHighlightedCategory:Ke,legendIsolatedCategories:Ze,legendPosition:Qe,legendLayout:Je,foregroundGraphics:$t(Kt,null===(b=Dn.current)||void 0===b?void 0:b.customLayoutOverlays),marginalGraphics:xt,xValues:Mn,yValues:Ln,annotations:Ye,svgAnnotationRules:Ge,annotationFrame:sn,xAccessor:ao,yAccessor:lo,annotationData:co(null===(x=Dn.current)||void 0===x?void 0:x.getData()),pointNodes:null===(k=Dn.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==ne&&!nt,linkedCrosshairName:_t,linkedCrosshairSourceId:jt}),(lt||ct)&&e(me,{width:Qt,height:Jt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,dimension:null!==(w=null==lt?void 0:lt.dimension)&&void 0!==w?w:"xy",scales:ln,onBrush:null!=ct?ct:()=>{},binSize:F,snap:null==lt?void 0:lt.snap,binBoundaries:null!==(A=null==lt?void 0:lt.binBoundaries)&&void 0!==A?A:"bar"===O?null===(S=Dn.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==lt?void 0:lt.snapDuring,streaming:"streaming"===C}),(null==ft?void 0:ft.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ft.badgePosition?{top:4,left:4}:"bottom-left"===ft.badgePosition?{bottom:4,left:4}:"bottom-right"===ft.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:_n?"#dc3545":"#28a745",color:"white"}),children:_n?"STALE":"LIVE"}),io,no]})]})});or.displayName="StreamXYFrame";const ir=d(null);function rr({colors:t,categories:n,colorScheme:o="category10",children:i}){const s=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:ht[o]||gt,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e(ir.Provider,{value:s,children:i})}function sr(){return a(ir)}function ar(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 lr(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(ar(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function cr(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}rr.displayName="CategoryColorProvider";const[dr,ur]=be(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=cr(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=cr(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}})}})),[hr,gr]=be(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function fr(e){const t=f(),n=e.clientId||t,{name:o}=e,i=ur(e=>e.selections.get(o)),s=ur(e=>e.setClause),a=ur(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?lr(i,n):()=>!0,[i,n]),isActive:c,selectPoints:l(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:l(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:l(()=>{a(o,n)},[a,o,n]),clientId:n}}function pr(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=fr({name:t});return{onHover:l(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}}function yr(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function mr(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:c}=fr({name:t}),d=n&&o?"xyBrush":n?"xBrush":"yBrush",u=l(e=>{if(!e)return void c();const t={};"xyBrush"===d&&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"===d&&yr(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===d&&yr(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[d,n,o,a,c]);return{brushInteraction:r(()=>({brush:d,during:u,end:u}),[d,u]),predicate:i,isActive:s,clear:c}}function vr(e,t,n){const o=ur(e=>e.selections.get(t));return r(()=>{if(!o||0===o.clauses.size)return e;const t=lr(o,n);return e.filter(t)},[e,o,n])}function br(e={}){const{limit:t=50,types:n,chartId:o}=e,i=gr(e=>e.version),s=gr(e=>e.observations),a=gr(e=>e.clearObservations),l=r(()=>{let e=s;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return o&&(e=e.filter(e=>e.chartId===o)),e.length>t&&(e=e.slice(e.length-t)),e},[s,n,o,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const xr=d(!1),kr=d(null),wr="undefined"==typeof window?s:h;function Ar(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Sr(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function Or(e){const t=a(kr),n=f(),o=Ar(e),r=i([]);Sr(r.current,o)||(r.current=o);const s=r.current;wr(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),wr(()=>{t&&t.registerCategories(n,s)},[t,n,s])}function Cr({selections:e}){const t=ur(e=>e.setResolution);return s(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function _r({categoryColors:t,interaction:n,selectionName:o,field:a}){const c=Object.entries(t),d=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=pr({name:o,fields:[a]}),f=fr({name:o,clientId:"__linked-legend-isolate__"}),[p,y]=u(new Set),[m,v]=u(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,s(()=>{"isolate"===n&&(p.size>0?b.current({[a]:Array.from(p)}):x.current())},[n,p,a]);const k=l(e=>{"highlight"===n&&(e?(v(e.label),g.onHover({[a]:e.label})):(v(null),g.onHover(null)))},[n,a,g]),w=l(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===d.length?new Set:n})},[n,d.length]),[A,[S]]=ki([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e(Nn,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===n?k:void 0,customClickBehavior:"isolate"===n?w:void 0,highlightedCategory:m,isolatedCategories:p})})})}function jr({children:n,selections:o,showLegend:s,legendPosition:a="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:d="category"}){const h=sr(),[g,f]=u({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const n=Ar(t);f(t=>{var o;return Sr(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(g))for(const n of t)e.push(n);return Ar(e)},[g]),v=r(()=>{var e;const t=null!=h?h:{},n=p.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of m)t[e]||n[e]||(n[e]=gt[o%gt.length],o++);const i=Object.assign({},t);for(const o of m)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[h,m]),b=void 0===s||s,x=b&&Object.keys(v).length>0;return e(dr,{children:t(hr,{children:[o&&e(Cr,{selections:o}),e(kr.Provider,{value:y,children:e(rr,{colors:v,children:t(xr.Provider,{value:x,children:[b&&"top"===a&&e(_r,{categoryColors:v,interaction:l,selectionName:c,field:d}),n,b&&"bottom"===a&&e(_r,{categoryColors:v,interaction:l,selectionName:c,field:d})]})})})]})})}function Mr({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){const a=(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):ft[r%ft.length];return{label:i+"",color:a}});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:a,label:""}]}}function Pr(e){return e?"string"==typeof e?{name:e}:e:null}function Lr(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}const Tr={light:Se,dark:Oe,"high-contrast":Ce,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Nr(e){return Tr[e]}const Br=o.createContext(void 0),Er="undefined"==typeof window?o.useEffect:o.useLayoutEffect;function Dr(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Nr(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Ir({theme:e}){const t=Me(e=>e.setTheme),n=Me(e=>e.theme),i=o.useRef(n);i.current=n;const r=o.useRef(null);o.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const n=window.matchMedia("(forced-colors: active)");return n.matches&&(r.current=i.current===Ce?Se:i.current,t("high-contrast")),xi(n,e=>{var n,o;e.matches?(r.current=i.current===Ce?null!==(n=r.current)&&void 0!==n?n:Se:i.current,t("high-contrast")):(function(e,t){e(t===Se?"light":t===Oe?"dark":t===Ce?"high-contrast":t)}(t,null!==(o=r.current)&&void 0!==o?o:Se),r.current=null)})},[e,t]);const s=o.useRef(!1);return Er(()=>{s.current?void 0!==e&&t(Dr(e)):s.current=!0},[e,t]),null}function Rr({children:t}){var n,i,r,s,a;const l=Me(e=>e.theme),c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-cell-border":l.colors.cellBorder||l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(n=l.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),null!=l.typography.tickSize?{"--semiotic-tick-font-size":l.typography.tickSize+"px"}:{}),null!=l.typography.labelSize?{"--semiotic-axis-label-font-size":l.typography.labelSize+"px"}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),d=o.useContext(Br),u={};return d&&(u["data-semiotic-theme"]=d),e("div",Object.assign({style:c},u,{children:t}))}function Hr({theme:n,children:i}){const r="string"==typeof n&&Nr(n)?n:void 0,s=o.useMemo(()=>function(e){return void 0!==e?_e(Se,Dr(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Ce:Se}(n),[n]);return e(je,{initialState:{theme:s},children:t(Br.Provider,{value:r,children:[e(Ir,{theme:n}),e(Rr,{children:i})]})})}function Fr(){return Me(e=>e.theme)}const $r="#007bff";function Wr(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function zr(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 Yr(){var e;const t=Fr(),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 Gr(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=ht[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]:$r}function qr(e,t,n){const o=sr(),i=Yr();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=vt(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return vt(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=vt(e,t,s);return e=>o[e]||n(e)}return vt(e,t,s)}if(o&&Object.keys(o).length>0){const e=vt([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}function Xr(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(n);return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}function Vr({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:a,chartId:c,onClick:d,hoverHighlight:h,colorByField:g}){const p=f(),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,n),m=fr({name:(null==e?void 0:e.name)||"__unused__"}),v=pr({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=gr(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=u(null),A=g||n[0],S=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,A]),O=l(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==y?void 0:y.mode)&&y.xField){const n=Wr(e,t,y.xField);null!=n&&function(e,t,n){const o=Qn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Qn={positions:new Map(Qn.positions).set(e,{xValue:t,sourceId:n})},eo())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&to(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const r=zr(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,v,y,p,i,a,c,b,h,A]),C=l(e=>{var t,n,o,r;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 n=Wr(e,t,y.xField);null!=n&&function(e,t,n){const o=Qn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Qn.positions);return t.delete(e),Qn={positions:t},eo(),!1}Qn={positions:new Map(Qn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},eo()}(y.name||"hover",n,p)}if(e&&d){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),d(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const n=zr(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[d,i,b,a,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{no(e,p),to(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:C,crosshairSourceId:p}}function Ur(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}}function Kr({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const d=a(xr),u=null!==a(kr),h=void 0!==o?o:!d&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==c)return c;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[c,t,e,g]);Or(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const o=Mr({data:e,colorBy:t,colorScale:n,getColor:mt,categories:f}),i=o.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?o:void 0},[h,t,e,n,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===i&&!o("right")&&110>n.right?n.right=110:"left"===i&&!o("left")&&110>n.left?n.left=110:"top"===i&&!o("top")&&50>n.top?n.top=50:"bottom"===i&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,s,p,i]);return{legend:p,margin:y,legendPosition:i}}function Zr(e,t,n){const[o,i]=u(null),[s,a]=u(new Set),c=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=l(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:c,onLegendClick:d,legendSelectionHook:h}}const Qr={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 Jr(e,t,n){var o,i,r,s,a,l,c;const d=Qr[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?d.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?d.height:n.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:es(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function es(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 ts(e){return"string"==typeof e?e:"value"}function ns(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function os(e,t){if(!t)return ns(e);try{const n=t(e);return null==n?ns(e):n}catch(t){return ns(e)}}function is(e,t){return"function"==typeof t?t(e):e[t]}function rs(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),n}function ss(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const s=o?os(is(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:hi,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((n,o)=>{const i=os(is(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function as({categoryAccessor:n,valueAccessor:o,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=is(d,n),h=is(d,o),g=i?is(d,i):void 0;return t("div",{className:"semiotic-tooltip",style:hi,children:[e("div",{style:{fontWeight:"bold"},children:ns(u)}),e("div",{style:{marginTop:4},children:os(h,a)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||ts(i),": ",ns(g)]})]})}}function ls({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return e("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:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("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 cs 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:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(ls,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ds;const us="undefined"!=typeof process&&"production"!==(null===(ds=process.env)||void 0===ds?void 0:ds.NODE_ENV);function hs({componentName:t,width:n,height:o,children:i}){return e(cs,{fallback:i=>e(ls,{componentName:t,message:i.message,width:n,height:o}),children:i})}const gs={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"},fs={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function ps(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},gs),{width:n,height:o}),children:i||"No data available"}):null}function ys(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},fs),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function ms(e,t,n,o){if(!us)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 vs(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 bs(e,t,n=3){let o,i=n+1;for(const n of t){const t=vs(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function xs(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function ks(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=bs(e,t,3))&&void 0!==n?n:null)}function ws({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=xs(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=ks(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function As({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}function Ss({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=xs(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=ks(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Os(e){const t=Me(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])}function Cs(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:s,legendPosition:a,selection:c,linkedHover:d,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,loadingContent:A,emptyContent:S,width:O,height:C}=e,_=void 0===n,j=r(()=>fe(t),[t]),[M,P]=u([]),L=l(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:N,hoverSelectionHook:B,customHoverBehavior:E,customClickBehavior:D,crosshairSourceId:I}=Vr({selection:c,linkedHover:d,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:T}),R=Ur(d,I),H=qr(j,o,i),F=r(()=>{if(!o)return[];const e=new Set;for(const t of j){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[j,o]),$=r(()=>_&&M.length>0?M:F,[_,M,F]),W=Zr(s,o,$),z=r(()=>B||(W.legendSelectionHook?W.legendSelectionHook:N),[B,W.legendSelectionHook,N]),Y=Os(c),G=Yr(),q=sr(),X=r(()=>{if(H)return H;if(!o||0===$.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:G&&G.length>0?G:ft,t="__streamCat",n=vt($.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[H,o,$,i,G,q]),{legend:V,margin:U,legendPosition:K}=Kr({data:j,colorBy:o,colorScale:X,showLegend:m,legendPosition:a,userMargin:v,defaults:b,categories:$}),Z=r(()=>{const e={};return V&&(e.legend=V,e.legendPosition=K),s&&"none"!==s&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),_&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[V,K,s,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,_,o,L]),Q=Array.isArray(n)?fe(n):n,J=ys(w,O,C,A),ee=J?null:ps(Q,O,C,S);return{data:j,colorScale:H,allCategories:$,legendState:W,effectiveSelectionHook:z,activeSelectionHook:N,customHoverBehavior:E,customClickBehavior:D,legend:V,margin:U,legendPosition:K,earlyReturn:J||ee||null,legendBehaviorProps:Z,crosshairProps:R,resolvedSelection:Y}}function _s(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)}function js(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:i,resolveStroke:s,fillArea:a,areaOpacity:l=.3,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g}=e,f=r(()=>(e,r)=>{const c={strokeWidth:t},d=!0===a||Array.isArray(a)&&null!=r&&a.includes(r);let u;return s?u=s(e,r):n?o&&(u=mt(e,n,o)):u=i||$r,void 0!==u&&(c.stroke=u,d&&(c.fill=u,c.fillOpacity=l)),c},[t,n,o,i,s,a,l]),p=r(()=>_s(f,{stroke:c,strokeWidth:d,opacity:u}),[f,c,d,u]);return r(()=>Lr(p,null!=h?h:null,g),[p,h,g])}function Ms(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);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,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function Ps(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);o.length>i;i++)0>t.indexOf(o[i])&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n}function Ls(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Ts="__forecastSegment";let Ns=null;function Bs(){return Ls(this,void 0,void 0,function*(){return Ns||(Ns=yield import("./semiotic-ai-statisticalOverlays-C2PPlmXv.js")),Ns})}const Es="__semiotic_resolvedX",Ds="__semiotic_resolvedY";function Is(e){const{data:t,xAccessor:n,yAccessor:o,forecast:a,anomaly:l,groupBy:c}=e,d="string"==typeof n?n:Es,h="string"==typeof o?o:Ds,g=r(()=>{if(!a&&!l)return t;const e="function"==typeof n,i="function"==typeof o;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[Es]=n(t)),i&&(r[Ds]=o(t)),r}):t},[t,a,l,n,o]),[f,p]=u(null),[y,m]=u([]),v=i(a),b=i(l);return s(()=>{if(!a&&!l)return void((v.current||b.current)&&(p(null),m([]),v.current=a,b.current=l));let e=!1;const t=a!==v.current||l!==b.current;if(v.current=a,b.current=l,t&&(p(null),m([])),a){const t=c&&"string"==typeof c&&"object"==typeof a?Object.assign(Object.assign({},a),{_groupBy:c}):a;(function(...e){return Ls(this,void 0,void 0,function*(){return(yield Bs()).buildForecast(...e)})})(g,d,h,t,l).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else l&&function(...e){return Ls(this,void 0,void 0,function*(){return(yield Bs()).buildAnomalyAnnotations(...e)})}(l).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[g,a,l,d,h,c]),{effectiveData:f?f.processedData:t,statisticalAnnotations:y,hasForecast:!!f,xAccessorKey:d,yAccessorKey:h}}const Rs=g(function(t,n){var o,a;const c=i(null);Ms(n,{variant:"xy",frameRef:c});const d=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:C=3,fillArea:_=!1,areaOpacity:j=.3,lineWidth:M=2,lineGradient:P,tooltip:L,pointIdAccessor:T,annotations:N,directLabel:B,gapStrategy:E="break",anomaly:D,forecast:I,band:R,xExtent:H,yExtent:F,frameProps:$={},selection:W,linkedHover:z,onObservation:Y,onClick:G,hoverHighlight:q,hoverRadius:X,chartId:V,loading:U,loadingContent:K,emptyContent:Z,legendInteraction:Q,legendPosition:J,xScaleType:ee,yScaleType:te,color:ne,stroke:oe,strokeWidth:ie,opacity:re}=t,{width:se,height:ae,enableHover:le,showGrid:ce,showLegend:de,title:ue,description:he,summary:ge,accessibleTable:pe,xLabel:ye,yLabel:me}=d,ve=r(()=>fe(h),[h]);ms("LineChart",ve,"xAccessor",v),ms("LineChart",ve,"yAccessor",b);const{effectiveData:be,statisticalAnnotations:xe}=Is({data:ve,xAccessor:v,yAccessor:b,forecast:I,anomaly:D,groupBy:x}),ke="__compoundGroup",we=!(!I||!x),Ae=we?ke:I?Ts:x,Se=r(()=>{if(!we)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const n=Object.assign({},t);return n[ke]=`${e(t)}__${t[Ts]||"observed"}`,n})},[be,we,x]),Oe=we?Se:be,Ce=w||x,_e=r(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[I,be,b]),je=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Me=void 0!==(null===(o=Oe[0])||void 0===o?void 0:o[k]),Pe=r(()=>{if(Me)return Oe;if(Ae){const e=Oe.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[k]:[]};"string"==typeof Ae&&(o[Ae]=n),we&&(o[Ts]=t[Ts],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Oe}]},[Oe,Ae,k,Me]),{gapProcessedLineData:Le,hasGaps:Te}=r(()=>{if("interpolate"===E){let e=!1;const t=[];for(const n of Pe){const o=(n[k]||[]).filter(t=>!je(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===E){let e=!1;const t=[];for(const n of Pe){const o=n[k]||[];let i=[],r=0;const s=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const a of o)if(je(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===E){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Pe){const i=o[k]||[],r=[];for(const n of i)je(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[k]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Pe,hasGaps:!1}},[Pe,E,k,je,Ae,b]),Ne="object"==typeof B?B:{},Be=Ne.position||"end",Ee=Ne.fontSize||11,De=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof Ce?Ce:e=>e[Ce],n=new Set;for(const o of Le){const i=o[k]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Be?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const s=r+"";""!==s&&n.add(s)}return Array.from(n)},[B,Ce,Le,k,Be]),Ie=r(()=>{if(!B)return d.marginDefaults;const e=De.reduce((e,t)=>Math.max(e,t.length*(.6*Ee)),0),t=e+10,n="end"===Be?"right":"left";return Object.assign(Object.assign({},d.marginDefaults),{[n]:Math.max(d.marginDefaults[n]||0,t)})},[B,De,Ee,Be,d.marginDefaults]),Re=Cs({data:be,rawData:h,colorBy:Ce,colorScheme:A,legendInteraction:Q,legendPosition:J,selection:W,linkedHover:z,fallbackFields:Ce?["string"==typeof Ce?Ce:""]:[],unwrapData:!1,onObservation:Y,onClick:G,hoverHighlight:q,chartType:"LineChart",chartId:V,showLegend:(!B||void 0!==de)&&de,userMargin:g,marginDefaults:Ie,loading:U,loadingContent:K,emptyContent:Z,width:se,height:ae}),He=Re.colorScale,Fe=Re.customHoverBehavior,$e=Re.customClickBehavior,We=Re.crosshairProps,ze=js({lineWidth:M,colorBy:Ce,colorScale:He,color:ne,fillArea:_,areaOpacity:j,stroke:oe,strokeWidth:ie,opacity:re,effectiveSelectionHook:Re.effectiveSelectionHook,resolvedSelection:Re.resolvedSelection}),[Ye,Ge]=u(null);s(()=>{if(!I)return void Ge(null);let e=!1;return function(...e){return Ls(this,void 0,void 0,function*(){return(yield Bs()).createSegmentLineStyle(...e)})}(ze,I).then(t=>{e||Ge(()=>t)}).catch(()=>{e||Ge(null)}),()=>{e=!0}},[ze,I]);const qe=Ye||ze,Xe=r(()=>{if(O)return e=>{const t={r:C,fillOpacity:1};return Ce?He&&(t.fill=mt(e.parentLine||e,Ce,He)):t.fill=ne||$r,t}},[O,C,Ce,He,ne]),Ve=Array.isArray(_)?"mixed":_?"area":"line",Ue=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof v?v:e=>e[v],n="function"==typeof b?b:e=>e[b],o="function"==typeof Ce?Ce:e=>e[Ce],i=new Map;for(const t of Le){const n=t[k]||[];if(0===n.length)continue;const r="end"===Be?n[n.length-1]:n[0],s=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==s)continue;const a=s+"";""===a||i.has(a)||i.set(a,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(o),["string"==typeof b?b:"y"]:n(o),dx:"end"===Be?6:-6,dy:0,color:He?He(e):$r,fontSize:Ee}));r.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",n=r[e-1],o=r[e];Ee+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Ee+2)}return r},[B,Ce,He,Le,k,v,b,Be,Ee]),Ke=Re.margin,Ze=x||w,Qe=r(()=>ss([{label:ye||ts(v),accessor:v,role:"x",format:p},{label:me||ts(b),accessor:b,role:"y",format:y},...Ze?[{label:ts(Ze),accessor:Ze,role:"group"}]:[],...rs(R,y)]),[v,b,ye,me,Ze,p,y,R]),Je=ws({componentName:"LineChart",data:Me?(null===(a=be[0])||void 0===a?void 0:a[k])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),et=r(()=>Me||Ae||Te?Le.flatMap(e=>{const t=e[k]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Oe,[Le,k,Me,Ae,Oe,Te]),tt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Ve},Array.isArray(_)&&{areaGroups:_}),P&&{lineGradient:P}),null!=X&&{hoverRadius:X}),null!=h&&{data:et}),{xAccessor:v,yAccessor:b,xScaleType:ee,yScaleType:te}),H&&{xExtent:H}),!F||null==F[0]&&null==F[1]?_e?{yExtent:_e}:{}:{yExtent:F}),{groupAccessor:"break"===E&&Te?"_gapSegment":Ae||void 0}),R&&{band:R}),{curve:S,lineStyle:qe}),O&&{pointStyle:Xe}),{size:[se,ae],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Ke,showAxes:d.showAxes,xLabel:ye,yLabel:me,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),{enableHover:le,showGrid:ce}),Re.legendBehaviorProps),ue&&{title:ue}),he&&{description:he}),ge&&{summary:ge}),void 0!==pe&&{accessibleTable:pe}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?mi():vi(L)||Qe}),"multi"===L&&{tooltipMode:"multi"}),(z||Y||G||q)&&{customHoverBehavior:Fe}),(Y||G||z)&&{customClickBehavior:$e}),T&&{pointIdAccessor:T}),((null==N?void 0:N.length)||xe.length||Ue.length)&&{annotations:[...N||[],...xe,...Ue]}),We),$);return Re.earlyReturn?Re.earlyReturn:Je?e(ls,{componentName:"LineChart",message:Je,width:se,height:ae}):e(hs,{componentName:"LineChart",width:se,height:ae,children:e(or,Object.assign({ref:c},tt))})});function Hs(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),void 0!==a&&(l.axisExtent=a),l}function Fs(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function $s(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:vi(t)||n}}function Ws(e){var t;const{safeData:n,data:o,areaBy:i,lineDataAccessor:s,colorBy:a,colorScale:l,color:c,stroke:d,strokeWidth:u,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:S,yFormat:O,groupField:C}=e,_=void 0!==(null===(t=n[0])||void 0===t?void 0:t[s]),j=r(()=>{if(null==o)return[];if(!_&&!i)return n;let e;if(_)e=n;else{const t=i,o=n.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[s]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][s].push(n),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[s]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[o,n,i,s,_]),M=r(()=>e=>{const t={};if(a){if(l){const n=mt(e,a,l);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||$r;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[a,l,c,p,y,m]),P=r(()=>_s(M,{stroke:d,strokeWidth:u,opacity:h}),[M,d,u,h]);return{flattenedData:j,lineStyle:r(()=>Lr(P,null!=g?g:null,f),[P,g,f]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return a?l&&(t.fill=mt(e.parentLine||e,a,l)):t.fill=c||$r,t}},[v,b,a,l,c]),defaultTooltipContent:r(()=>ss([{label:w||ts(x),accessor:x,role:"x",format:S},{label:A||ts(k),accessor:k,role:"y",format:O},...C?[{label:ts(C),accessor:C,role:"group"}]:[],...rs(e.band,O)]),[x,k,w,A,C,S,O,e.band])}}function zs(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}Rs.displayName="LineChart";const Ys=g(function(t,n){const o=i(null);Ms(n,{variant:"xy",frameRef:o});const s=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",yAccessor:g="y",areaBy:f,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:S=!0,lineWidth:O=2,showPoints:C=!1,pointRadius:_=3,tooltip:j,annotations:M,forecast:P,anomaly:L,band:T,xExtent:N,yExtent:B,frameProps:E={},selection:D,linkedHover:I,onObservation:R,onClick:H,hoverHighlight:F,chartId:$,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:K}=t,{width:Z,height:Q,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:se,yLabel:ae}=s,le=r(()=>fe(a),[a]),ce=b||f,de=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:zs(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);ms("AreaChart",le,"xAccessor",h),ms("AreaChart",le,"yAccessor",g);const ue=Cs({data:le,rawData:a,colorBy:ce,colorScheme:x,legendInteraction:G,legendPosition:q,selection:D,linkedHover:I,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:R,onClick:H,hoverHighlight:F,chartType:"AreaChart",chartId:$,showLegend:te,userMargin:l,marginDefaults:s.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:Z,height:Q}),{effectiveData:he,statisticalAnnotations:ge}=Is({data:le,xAccessor:h,yAccessor:g,forecast:P,anomaly:L,groupBy:f}),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ve}=Ws({safeData:he,data:a,areaBy:f,lineDataAccessor:v,colorBy:ce,colorScale:ue.colorScale,color:X,stroke:V,strokeWidth:U,opacity:K,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,areaOpacity:w,showLine:S,lineWidth:O,showPoints:C,pointRadius:_,xAccessor:h,yAccessor:g,xLabel:se,yLabel:ae,xFormat:d,yFormat:u,groupField:f||b,band:T}),be=ws({componentName:"AreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"area"},null!=a&&{data:pe}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0}),p&&{y0Accessor:p}),T&&{band:T}),de&&{gradientFill:de}),A&&{lineGradient:A}),{curve:k,lineStyle:ye}),C&&me&&{pointStyle:me}),{size:[Z,Q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue.margin,showAxes:s.showAxes,xLabel:se,yLabel:ae,xFormat:d,yFormat:u,enableHover:J}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:ee}),ue.legendBehaviorProps),Hs({title:ne,description:oe,summary:ie,accessibleTable:re,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===j?{tooltipContent:mi(),tooltipMode:"multi"}:$s({tooltip:j,defaultTooltipContent:ve})),Fs({linkedHover:I,onObservation:R,onClick:H,hoverHighlight:F,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior})),(M&&M.length>0||ge.length>0)&&{annotations:[...M||[],...ge]}),N&&{xExtent:N}),B&&{yExtent:B}),ue.crosshairProps),E);return ue.earlyReturn?ue.earlyReturn:be?e(ls,{componentName:"AreaChart",message:be,width:Z,height:Q}):e(hs,{componentName:"AreaChart",width:Z,height:Q,children:e(or,Object.assign({ref:o},xe))})});function Gs(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}Ys.displayName="AreaChart";const qs=g(function(n,o){const s=i(null),a=Jr(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:k="var(--semiotic-danger, #dc2626)",seriesBColor:w="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:S=1.5,showPoints:O=!1,pointRadius:C=3,curve:_="linear",areaOpacity:j=.6,gradientFill:M,tooltip:P,annotations:L,xExtent:T,yExtent:N,frameProps:B={},selection:E,linkedHover:D,onObservation:I,onClick:R,hoverHighlight:H,chartId:F,loading:$,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,pointIdAccessor:q,windowSize:X}=n,{width:V,height:U,enableHover:K,showGrid:Z,showLegend:Q,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=a,re=r(()=>"function"==typeof y?e=>Gs(y(e)):e=>Gs(e[y]),[y]),se=r(()=>"function"==typeof m?e=>Gs(m(e)):e=>Gs(e[m]),[m]),ae=r(()=>"function"==typeof v?e=>Gs(v(e)):e=>Gs(e[v]),[v]),[le,ce]=u([]),de=i([]),ue=null==c,he=r(()=>fe(ue?le:c),[ue,le,c]),ge=r(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let s=0,a=null,l=null,c=[];const d=(e,t)=>e>t?"A":t>e?"B":null,u=e=>`seg-${s}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:u(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],f=t(r),p=n(r),y=o(r);if(!Number.isFinite(f)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=d(p,y);if(null!==m)if(null!=a){if(l&&l.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-l.a-(y-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(f-l.x),t=l.a+o*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:u(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=m,h({__x:e,__y:t,__y0:t,__diffSegment:u(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],a)}else for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:u(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else{a=m;for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:u(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else c.push({x:f,y:p,datum:r})}for(const e of c)g(e,null!=a?a:"A");return r}(he,re,se,ae),[he,re,se,ae]),pe=r(()=>A?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];for(const e of i){const i=t(e),s=n(e),a=o(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-B"})}return r}(he,re,se,ae):[],[A,he,re,se,ae]),ye=r(()=>[...ge,...pe],[ge,pe]),me=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(o,()=>{const e=e=>{const t=X&&e.length>X?e.slice(e.length-X):e;de.current=t,ce(t)},t=q?"function"==typeof q?q:e=>e[q]:null;return{push:t=>e([...de.current,t]),pushMany:t=>e([...de.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of de.current)o.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],r=[],s=de.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>ue?de.current:he,getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[ue,he,q,X]);const ve=Cs({data:he,rawData:c,colorBy:"__diffWinner",colorScheme:[k,w],legendInteraction:Y,legendPosition:G,selection:E,linkedHover:D,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:I,onClick:R,hoverHighlight:H,chartType:"DifferenceChart",chartId:F,showLegend:Q,userMargin:d,marginDefaults:a.marginDefaults,loading:$,loadingContent:W,emptyContent:z,width:V,height:U}),be=r(()=>{if(!1!==Q)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:k},{label:x,color:w}]}]}},[Q,b,x,k,w]),xe=l(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?k:w,stroke:"none",fillOpacity:j}},[k,w,j]),ke=l(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,strokeWidth:S,fill:"none"}),[k,w,S]),we=l(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,r:C}),[k,w,C]),Ae=l(n=>{var o;const i=n.data,r=n.allSeries,s=null!==(o=n.xValue)&&void 0!==o?o:null==i?void 0:i.__x;let a=null==i?void 0:i.__valA,l=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(a=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(l=t.value)}if(null!=s&&(null==a||null==l)){const e=he.find(e=>re(e)===s);e&&(null==a&&(a=se(e)),null==l&&(l=ae(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",d=g&&null!=s?g(s):null!=s?s+"":"";return t("div",{className:"semiotic-tooltip",style:hi,children:[d&&e("div",{style:{fontWeight:600,marginBottom:4},children:d}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(a)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(l)]})]}),null!=a&&null!=l&&Number.isFinite(a)&&Number.isFinite(l)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(a-l)]})]})},[he,re,se,ae,g,k,w,b,x]),Se="multi"===P,Oe=r(()=>!1===P?()=>null:Se?Ae:vi(P)||Ae,[P,Se,Ae]),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({chartType:"mixed",data:ye,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:me,curve:_,areaStyle:xe,lineStyle:ke},O&&{pointStyle:we}),{size:[V,U],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ve.margin,showAxes:a.showAxes,xLabel:oe,yLabel:ie,xFormat:g,yFormat:f,enableHover:K,showGrid:Z}),M&&{gradientFill:!0===M?{topOpacity:.85,bottomOpacity:.15}:M}),be&&{legend:be,legendPosition:ve.legendPosition}),Hs({title:J,description:ee,summary:te,accessibleTable:ne,className:h,animate:n.animate,axisExtent:n.axisExtent})),{tooltipContent:Oe}),Se&&{tooltipMode:"multi"}),Fs({linkedHover:D,onObservation:I,onClick:R,hoverHighlight:H,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),T&&{xExtent:T}),N&&{yExtent:N}),ve.crosshairProps),B);return ve.earlyReturn?ve.earlyReturn:e(hs,{componentName:"DifferenceChart",width:V,height:U,children:e(or,Object.assign({ref:s},Ce))})});"function"==typeof qs&&(qs.displayName="DifferenceChart");const Xs=g(function(t,n){const o=i(null),s=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",yAccessor:g="y",areaBy:f,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:A=3,normalize:S=!1,baseline:O="zero",stackOrder:C,tooltip:_,annotations:j,xExtent:M,yExtent:P,frameProps:L={},selection:T,linkedHover:N,onObservation:B,onClick:E,hoverHighlight:D,chartId:I,loading:R,loadingContent:H,emptyContent:F,legendInteraction:$,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Z,title:Q,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=s,ie=r(()=>fe(a),[a]),re=y||f;Ms(n,{variant:"xy",frameRef:o});const se=Cs({data:ie,rawData:a,colorBy:re,colorScheme:m,legendInteraction:$,legendPosition:W,selection:T,linkedHover:N,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:B,onClick:E,hoverHighlight:D,chartType:"StackedAreaChart",chartId:I,showLegend:Z,userMargin:l,marginDefaults:s.marginDefaults,loading:R,loadingContent:H,emptyContent:F,width:X,height:V}),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:de}=Ws({safeData:ie,data:a,areaBy:f,lineDataAccessor:p,colorBy:re,colorScale:se.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:A,xAccessor:h,yAccessor:g,xLabel:ne,yLabel:oe,xFormat:d,yFormat:u,groupField:f||y}),ue=ws({componentName:"StackedAreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),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:"stackedarea"},null!=a&&{data:ae}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0,curve:v,normalize:S,baseline:S?"zero":O,stackOrder:C,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:ne,yLabel:oe,xFormat:d,yFormat:u,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:K}),se.legendBehaviorProps),Hs({title:Q,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===_?{tooltipContent:mi(),tooltipMode:"multi"}:$s({tooltip:_,defaultTooltipContent:de})),Fs({linkedHover:N,onObservation:B,onClick:E,hoverHighlight:D,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),j&&j.length>0&&{annotations:j}),M&&{xExtent:M}),P&&{yExtent:P}),se.crosshairProps),L);return se.earlyReturn?se.earlyReturn:ue?e(ls,{componentName:"StackedAreaChart",message:ue,width:X,height:V}):e(hs,{componentName:"StackedAreaChart",width:X,height:V,children:e(or,Object.assign({ref:o},he))})});function Vs(e){const{colorBy:t,colorScale:n,color:o,pointRadius:i=5,radiusFn:s,fillOpacity:a=1,fallbackFill:l,baseStyleExtras:c,stroke:d,strokeWidth:u,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,d=r?Object.assign({},r):{};if(void 0===d.fillOpacity&&(d.fillOpacity=a),void 0===d.fill)if(t){if(n){const o=p?p(e):e;d.fill=mt(o,t,n)}}else d.fill=l?l(e):o||$r;return void 0===d.r&&(d.r=s?s(e):i),d},[t,n,o,i,s,a,l,c,p]),m=r(()=>_s(y,{stroke:d,strokeWidth:u,opacity:h}),[y,d,u,h]);return r(()=>Lr(m,null!=g?g:null,f),[m,g,f])}function Us(e){const{accessor:t,data:n,isPushMode:o}=e,s=i(null),[a,c]=u(0),d=l(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(s.current?(s.current[0]>i&&(s.current[0]=i,n=!0),i>s.current[1]&&(s.current[1]=i,n=!0)):(s.current=[i,i],n=!0))}n&&c(e=>e+1)},[o,t]),h=l(()=>{o&&(s.current=null,c(e=>e+1))},[o]),g=r(()=>{var e;if(o)return null!==(e=s.current)&&void 0!==e?e:void 0;if(!t||0===n.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const e of n){const t=i(e);if(null==t)continue;const n="number"==typeof t?t:Number(t);Number.isFinite(n)&&(r>n&&(r=n),n>a&&(a=n))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[n,t,o,a]);return{domain:g,trackPushed:d,reset:h}}function Ks(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}Xs.displayName="StackedAreaChart";const Zs=g(function(t,n){const s=i(null),a=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:d,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:A=.8,tooltip:S,marginalGraphics:O,pointIdAccessor:C,annotations:_,regression:j,forecast:M,anomaly:P,xExtent:L,yExtent:T,frameProps:N={},selection:B,linkedHover:E,linkedBrush:D,onObservation:I,onClick:R,hoverHighlight:H,chartId:F,loading:$,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,color:q,stroke:X,strokeWidth:V,opacity:U}=t,{width:K,height:Z,enableHover:Q,showGrid:J,showLegend:ee,title:te,description:ne,summary:oe,accessibleTable:ie,xLabel:re,yLabel:se}=a,ae=r(()=>fe(c),[c]),le=void 0===c,{domain:ce,trackPushed:de,reset:ue}=Us({accessor:x,data:ae,isPushMode:le}),he=l(e=>{var t;de([e]),null===(t=s.current)||void 0===t||t.push(e)},[de]),ge=l(e=>{var t;de(e),null===(t=s.current)||void 0===t||t.pushMany(e)},[de]);Ms(n,{variant:"xy",frameRef:s,overrides:{push:he,pushMany:ge,clear:()=>{var e;ue(),null===(e=s.current)||void 0===e||e.clear()}},deps:[he,ge,ue]});const pe=Cs({data:ae,rawData:c,colorBy:v,colorScheme:b,legendInteraction:Y,legendPosition:G,selection:B,linkedHover:E,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:I,onClick:R,hoverHighlight:H,chartType:"Scatterplot",chartId:F,showLegend:ee,userMargin:d,marginDefaults:a.marginDefaults,loading:$,loadingContent:W,emptyContent:z,width:K,height:Z}),ye=Pr(D),me=mr({name:(null==ye?void 0:ye.name)||"__unused_brush__",xField:(null==ye?void 0:ye.xField)||("string"==typeof f?f:void 0),yField:(null==ye?void 0:ye.yField)||("string"==typeof p?p:void 0)}),ve=ye?"xyBrush"===me.brushInteraction.brush?"xy":"xBrush"===me.brushInteraction.brush?"x":"y":void 0,be=o.useRef(me.brushInteraction);be.current=me.brushInteraction;const xe=l(e=>{const t=be.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(pe.earlyReturn)return pe.earlyReturn;ms("Scatterplot",ae,"xAccessor",f),ms("Scatterplot",ae,"yAccessor",p);const ke=r(()=>x?null!=ce?ce:[0,1]:void 0,[x,ce]),we=r(()=>x?e=>bt(e,x,k,ke):void 0,[x,k,ke]),Ae=Vs({colorBy:v,colorScale:pe.colorScale,color:q,pointRadius:w,fillOpacity:A,radiusFn:we,stroke:X,strokeWidth:V,opacity:U,effectiveSelectionHook:pe.effectiveSelectionHook,resolvedSelection:pe.resolvedSelection}),Se=r(()=>ss([{label:re||ts(f),accessor:f,role:"x",format:h},{label:se||ts(p),accessor:p,role:"y",format:g},...v?[{label:ts(v),accessor:v,role:"color"}]:[],...x?[{label:ts(x),accessor:x,role:"size"}]:[]]),[f,p,re,se,v,x,h,g]),{effectiveData:Oe,statisticalAnnotations:Ce}=Is({data:ae,xAccessor:f,yAccessor:p,forecast:M,anomaly:P}),_e=r(()=>{const e=Ks(j);return e||0!==Ce.length?[...e?[e]:[],..._||[],...Ce]:_},[j,_,Ce]),je=ws({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(je)return e(ls,{componentName:"Scatterplot",message:je,width:K,height:Z});const Me=Object.assign(Object.assign(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:"scatter"},null!=c&&{data:Oe}),{xAccessor:f,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:Ae,colorScheme:b,size:[K,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe.margin,showAxes:a.showAxes,xLabel:re,yLabel:se,xFormat:h,yFormat:g,enableHover:Q,showGrid:J}),pe.legendBehaviorProps),Hs({title:te,description:ne,summary:oe,accessibleTable:ie,className:u,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:S,defaultTooltipContent:Se})),Fs({linkedHover:E,onObservation:I,onClick:R,hoverHighlight:H,customHoverBehavior:pe.customHoverBehavior,customClickBehavior:pe.customClickBehavior})),O&&{marginalGraphics:O}),C&&{pointIdAccessor:C}),_e&&_e.length>0&&{annotations:_e}),L&&{xExtent:L}),T&&{yExtent:T}),ye&&{brush:{dimension:ve},onBrush:xe}),pe.crosshairProps),N);return e(hs,{componentName:"Scatterplot",width:K,height:Z,children:e(or,Object.assign({ref:s},Me))})});function Qs(e,t){return Je(1===t?.5:e/(t-1))}Zs.displayName="Scatterplot";const Js=g(function(t,o){var s,a;const l=i(null);Ms(o,{variant:"xy",frameRef:l});const c=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:d,margin:u,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,regression:A,forecast:S,anomaly:O,xExtent:C,yExtent:_,frameProps:j={},selection:M,linkedHover:P,onObservation:L,onClick:T,hoverHighlight:N,chartId:B,loading:E,loadingContent:D,emptyContent:I,legendInteraction:R,stroke:H,strokeWidth:F,opacity:$}=t,{width:W,height:z,enableHover:Y,showGrid:G,title:q,description:X,summary:V,accessibleTable:U,xLabel:K,yLabel:Z}=c,Q=d||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let n=Q;if(m&&Q.length>0){const e="function"==typeof m?m:e=>e[m];n=[...Q].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Q,m,p,y]);ms("ConnectedScatterplot",J,"xAccessor",p),ms("ConnectedScatterplot",J,"yAccessor",y);const te=Cs({data:J,rawData:d,colorBy:void 0,colorScheme:void 0,legendInteraction:R,selection:M,linkedHover:P,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:N,chartType:"ConnectedScatterplot",chartId:B,showLegend:void 0,userMargin:u,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:E,loadingContent:D,emptyContent:I,width:W,height:z}),ne=null!==(a=null===(s=te.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==a?a:.5,oe=r(()=>(e,t)=>{var n,o,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.isActive,l=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>s.length,d=s.length;e.lineCap="round";for(let t=0;d-1>t;t++){const n=s[t],o=s[t+1],u=Qs(t,d),h=!a||!l||l(null!==(i=n.datum)&&void 0!==i?i:n)||l(null!==(r=o.datum)&&void 0!==r?r:o),g=a?h?1:ne:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=u,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,ne]),ie=r(()=>[oe],[oe]),re=r(()=>(t,o,i)=>{var r,s;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const l=a.length,c=100>l,d=[];for(let t=0;l-1>t;t++){const n=a[t],o=a[t+1],i=Qs(t,l),u="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,g=Math.min(u,h);c&&d.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),d.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(n,{children:d})},[b]),se=r(()=>[re],[re]),ae=r(()=>e=>{var t,n;const o=ee.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?Qs(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),le=Vs({colorScale:void 0,baseStyleExtras:ae,stroke:H,strokeWidth:F,opacity:$,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),de=r(()=>ss([{label:K||ts(p),accessor:p,role:"x",format:g},{label:Z||ts(y),accessor:y,role:"y",format:f},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,K,Z,m,ce,g,f]),ue=ws({componentName:"ConnectedScatterplot",data:d,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:ge}=Is({data:J,xAccessor:p,yAccessor:y,forecast:S,anomaly:O}),fe=Ks(A),pe=fe||ge.length>0?[...fe?[fe]:[],...w||[],...ge]:w,ye=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:"scatter"},null!=d&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:le,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:K,yLabel:Z,xFormat:g,yFormat:f,enableHover:Y,showGrid:G}),Hs({title:q,description:X,summary:V,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:x,defaultTooltipContent:de})),Fs({linkedHover:P,onObservation:L,onClick:T,hoverHighlight:N,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ie,svgPreRenderers:se}),pe&&pe.length>0&&{annotations:pe}),C&&{xExtent:C}),_&&{yExtent:_}),te.crosshairProps),j);return te.earlyReturn?te.earlyReturn:ue?e(ls,{componentName:"ConnectedScatterplot",message:ue,width:W,height:z}):e(hs,{componentName:"ConnectedScatterplot",width:W,height:z,children:e(or,Object.assign({ref:l},ye))})});Js.displayName="ConnectedScatterplot";const ea=g(function(t,n){const o=i(null),s=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:c,className:d,xFormat:u,yFormat:h,xAccessor:g="x",yAccessor:f="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:C,xExtent:_,yExtent:j,frameProps:M={},selection:P,linkedHover:L,linkedBrush:T,onObservation:N,onClick:B,hoverHighlight:E,chartId:D,loading:I,loadingContent:R,emptyContent:H,legendInteraction:F,legendPosition:$,color:W,stroke:z,strokeWidth:Y,opacity:G}=t,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Z,description:Q,summary:J,accessibleTable:ee,xLabel:te,yLabel:ne}=s,oe=r(()=>fe(a),[a]),ie=void 0===a,re=Cs({data:oe,rawData:a,colorBy:m,colorScheme:v,legendInteraction:F,legendPosition:$,selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:N,onClick:B,hoverHighlight:E,chartType:"BubbleChart",chartId:D,showLegend:K,userMargin:c,marginDefaults:s.marginDefaults,loading:I,loadingContent:R,emptyContent:H,width:q,height:X}),{domain:se,trackPushed:ae,reset:le}=Us({accessor:p,data:oe,isPushMode:ie}),ce=l(e=>{var t;ae([e]),null===(t=o.current)||void 0===t||t.push(e)},[ae]),de=l(e=>{var t;ae(e),null===(t=o.current)||void 0===t||t.pushMany(e)},[ae]);Ms(n,{variant:"xy",frameRef:o,overrides:{push:ce,pushMany:de,clear:()=>{var e;le(),null===(e=o.current)||void 0===e||e.clear()}},deps:[ce,de,le]});const ue=Pr(T);mr({name:(null==ue?void 0:ue.name)||"__unused_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof g?g:void 0),yField:(null==ue?void 0:ue.yField)||("string"==typeof f?f:void 0)});const he=r(()=>({stroke:k,strokeWidth:x}),[k,x]),ge=r(()=>null!=se?se:[0,1],[se]),pe=l(e=>bt(e,p,y,ge),[p,y,ge]),ye=Vs({colorBy:m,colorScale:re.colorScale,color:W,fillOpacity:b,radiusFn:pe,baseStyleExtras:he,stroke:z,strokeWidth:Y,opacity:G,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),me=r(()=>ss([{label:te||ts(g),accessor:g,role:"x",format:u},{label:ne||ts(f),accessor:f,role:"y",format:h},{label:ts(p),accessor:p,role:"size"},...m?[{label:ts(m),accessor:m,role:"color"}]:[]]),[g,f,te,ne,p,m,u,h]),ve=ws({componentName:"BubbleChart",data:a,accessors:{xAccessor:g,yAccessor:f},requiredProps:{sizeBy:p}});if(ve)return e(ls,{componentName:"BubbleChart",message:ve,width:q,height:X});const be=Ks(C),xe=be?[be,...O||[]]:O,ke=Object.assign(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:"bubble"},null!=a&&{data:oe}),{xAccessor:g,yAccessor:f,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:ye,colorScheme:v,size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:s.showAxes,xLabel:te,yLabel:ne,xFormat:u,yFormat:h,enableHover:V,showGrid:U}),re.legendBehaviorProps),Hs({title:Z,description:Q,summary:J,accessibleTable:ee,className:d,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:w,defaultTooltipContent:me})),Fs({linkedHover:L,onObservation:N,onClick:B,hoverHighlight:E,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),xe&&xe.length>0&&{annotations:xe}),_&&{xExtent:_}),j&&{yExtent:j}),re.crosshairProps),M);return re.earlyReturn?re.earlyReturn:e(hs,{componentName:"BubbleChart",width:q,height:X,children:e(or,Object.assign({ref:o},ke))})});ea.displayName="BubbleChart";const ta=g(function(t,n){var o;const s=i(null);Ms(n,{variant:"xy",frameRef:s});const a=Jr(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:d,xAccessor:u="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:k,xExtent:w,yExtent:A,frameProps:O={},selection:C,linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,showLegend:E,legendPosition:D,legendInteraction:I}=t,{width:R,height:H,enableHover:F,title:$,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=a,X=ys(T,R,H,N),V=X?null:ps(l,R,H,B),U=r(()=>fe(l),[l]),K=function(){var e;const t=Fr();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Z=null!==(o=null!=y?y:K)&&void 0!==o?o:"blues",Q=null!=E&&E,J=null!=D?D:"right",{margin:ee}=Kr({data:U,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:J,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=Vr({selection:C,linkedHover:_,fallbackFields:[],onObservation:j,onClick:M,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});Os(C);const ie=Ur(_,oe);Zr(I,void 0,[]);const re=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),se=r(()=>{const e=U.map(re);return[Math.min(...e),Math.max(...e)]},[U,re]),ae=r(()=>"custom"===Z&&m?m:S({blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Ze,greys:Qe,plasma:et,inferno:tt,magma:nt,cividis:ot,turbo:it}[Z]||Xe).domain(se),[Z,m,se]),le=r(()=>ss([{label:G||ts(u),accessor:u,role:"x",format:f},{label:q||ts(h),accessor:h,role:"y",format:p},{label:ts(g),accessor:g,role:"value",format:b}]),[u,h,G,q,g,f,p,b]),ce=ws({componentName:"Heatmap",data:l,accessors:{xAccessor:u,yAccessor:h,valueAccessor:g}}),de=r(()=>{if(Q)return{gradient:{colorFn:e=>ae(e),domain:se,label:"string"==typeof g?g:"value",format:b}}},[Q,ae,se,g,b]),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({chartType:"heatmap"},null!=l&&{data:U}),{xAccessor:u,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==Z?Z:void 0,showValues:v,heatmapValueFormat:b,size:[R,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,showAxes:a.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:F}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),de&&{legend:de,legendPosition:J}),Hs({title:$,description:W,summary:z,accessibleTable:Y,className:d,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:x,defaultTooltipContent:le})),Fs({linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:te,customClickBehavior:ne})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),ie),O);return X||V||(ce?e(ls,{componentName:"Heatmap",message:ce,width:R,height:H}):e(hs,{componentName:"Heatmap",width:R,height:H,children:e(or,Object.assign({ref:s},ue))}))});ta.displayName="Heatmap";const na="__splomIdx",oa={top:4,bottom:4,left:4,right:4};function ia({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),a=n-oa.left-oa.right,l=n-oa.top-oa.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),n=b().extent([[0,0],[a,l]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,s],[a,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(a),i.y.invert(l)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[a,l,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${oa.left},${oa.top})`})})}function ra({data:n,xField:o,yField:r,cellSize:s,pointRadius:a,pointOpacity:c,colorBy:d,colorScale:u,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const m=i(null),v=fr({name:h,clientId:`splom-${o}-${r}`}),b=mr({name:h,xField:o,yField:r}),x=fr({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[na];void 0!==n&&(k({[na]:[n]}),null==y||y(t,e.x+oa.left,e.y+oa.top))},[k,y]),S=l(e=>{const t={opacity:c,r:a};return t.fill=d?mt(e,d,u):$r,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=f),t},[d,u,c,a,p,v.isActive,v.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(or,{ref:m,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:r,pointStyle:S,margin:oa,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(ia,{frameRef:m,cellSize:s,xField:o,yField:r,onBrush:w})]})}function sa({data:n,field:o,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:d,hoverSelectionName:u,mode:h}){const g=fr({name:d,clientId:"splom-diag-"+o}),f=fr({name:u,clientId:`splom-diag-${o}-hover`}),p="hover"===h?f:g,y=p.isActive,m=p.predicate,v=r(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/a||1,r="string"==typeof l?l:null,c=r?[...new Set(n.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],d=new Map(c.map((e,t)=>[e,t])),u=Array(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),f=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const s=Math.min(Math.floor((n-t)/i),a-1);if(u[s]++,y&&!m(e)||h[s]++,r){const t=d.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!m(e)||f[s][t]++)}}const p=Math.max(...u,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:n,category:c[o]};return n+=i,r})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:n,category:c[o]};return n+=i,r})});return{bars:u.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:p,categories:c}},[n,o,a,s,y,m,l]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):$r,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:$r,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):$r,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:$r,opacity:.7},"sel-"+n)))]})}function aa({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function la(n){const{data:i,fields:s,fieldLabels:a={},colorBy:c,colorScheme:d,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:C,chartId:_}=n,j="splom",M="splom-hover",P=b?"hover":v?"brush":"hover",L=ur(e=>e.clearSelection),[T,N]=u(null),B=l(()=>{L(M),N(null)},[L,M]),E=r(()=>(i||[]).map((e,t)=>void 0!==e[na]?e:Object.assign(Object.assign({},e),{[na]:t})),[i]),D=qr(E,c,d),I=void 0!==A?A:!!c,R=r(()=>{if(!I||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(E.map(t=>t[e]))].map(e=>({label:e+"",color:D?D(e+""):$r})):null},[I,c,E,D]),H=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[s,h,g,40]);return t("div",{className:O,style:{position:"relative"},children:[R&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:R.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:H,onMouseLeave:"hover"===P?B:void 0,children:[s.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:a[n]||n}),s.map((t,o)=>i===o?"label"===y?e(aa,{label:a[n]||n,cellSize:h},"diag-"+n):e(sa,{data:E,field:n,label:a[n]||n,cellSize:h,bins:m,colorBy:c,colorScale:D,brushSelectionName:j,hoverSelectionName:M,unselectedOpacity:x,mode:P},"diag-"+n):e(ra,{data:E,xField:t,yField:n,fieldLabels:a,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:D,brushSelectionName:j,hoverSelectionName:M,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(N({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:_})):(N(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:_}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:a[t]||t},"col-label-"+t))]}),T&&"hover"===P&&(()=>{const n=T.datum,o=a[T.xField]||T.xField,i=a[T.yField]||T.yField,r=c?"function"==typeof c?c(n):n[c]:null,s=S?"function"==typeof S?S(n):n[S]:"Row "+n[na];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[o,": ",null!=n[T.xField]?Number(n[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[T.yField]?Number(n[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function ca(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(jr,{selections:i,children:e(la,Object.assign({},t))})}function da({width:t,height:n,margin:o,scales:r,brushDirection:a,extent:l,onBrush:c}){const d=i(null),u=i(null),h=i(!1),g=t+o.left+o.right,f=n+o.top+o.bottom;return s(()=>{if(!d.current||!r)return;const e=y(d.current).select(".brush-group"),o="x"===a?m().extent([[0,0],[t,n]]):v().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===a?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),u.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,a,c]),s(()=>{if(!u.current||!r||!d.current)return;const e=y(d.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(u.current.move,n)}else e.call(u.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:d,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function ua(n){var o,a;const{data:c,width:d=600,height:h=400,margin:g,className:f,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:C,colorScheme:_,curve:j="linear",lineWidth:M=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:N=3,enableHover:B=!0,showGrid:E=!1,showLegend:D,legendPosition:I,tooltip:R,minimap:H={},renderBefore:F=!1,onBrush:$,brushExtent:W,yExtent:z,frameProps:Y={},loading:G,loadingContent:q,emptyContent:X}=n,V=ys(G,d,h,q),U=V?null:ps(c,d,h,X),K=r(()=>fe(c),[c]),[Z,Q]=u(null),J=null!=W?W:Z,ee=l(e=>{W||Q(e),null==$||$(e)},[W,$]),te=i(null),[ne,oe]=u(null);s(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=te.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?oe(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const ie=void 0!==(null===(o=K[0])||void 0===o?void 0:o[O]),re=r(()=>{if(ie)return K;if(S){const e=K.reduce((e,t)=>{const n="function"==typeof S?S(t):t[S];if(!e[n]){const t={[O]:[]};"string"==typeof S&&(t[S]=n),e[n]=t}return e[n][O].push(t),e},{});return Object.values(e)}return[{[O]:K}]},[K,S,O,ie]),se=r(()=>ie||S?re.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):K,[re,O,ie,S,K]),ae=qr(K,C,_),le=js({lineWidth:M,colorBy:C,colorScale:ae,fillArea:P,areaOpacity:L}),ce=r(()=>{if(H.lineStyle)return H.lineStyle},[H.lineStyle]),de=js({lineWidth:1,colorBy:C,colorScale:ae}),ue=null!=ce?ce:de,he=r(()=>{if(T)return e=>{const t={r:N,fillOpacity:1};return t.fill=C?mt(e.parentLine||e,C,ae):$r,t}},[T,N,C,ae]),{legend:ge,margin:pe,legendPosition:ye}=Kr({data:re,colorBy:C,colorScale:ae,showLegend:D,legendPosition:I,userMargin:g}),me=H.height||60,ve=r(()=>{var e,t,n,o,i,r,s,a;return{top:null!==(t=null===(e=H.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=H.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=H.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:pe.left,right:null!==(a=null===(s=H.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:pe.right}},[H.margin,pe]),be=H.brushDirection||"x",xe=ws({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(xe)return e(ls,{componentName:"MinimapChart",message:xe,width:d,height:h});const ke=P?"area":"line",we=r(()=>ss([{label:v||ts(w),accessor:w,role:"x",format:x},{label:b||ts(A),accessor:A,role:"y",format:k}]),[w,A,v,b,x,k]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ke,data:se,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:j,lineStyle:le},T&&{pointStyle:he}),{size:[d,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:B,showGrid:E}),ge&&{legend:ge,legendPosition:ye}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===R?()=>null:vi(R)||we}),J&&{xExtent:J}),z&&{yExtent:z}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),Y),Se=Object.assign({chartType:ke,data:se,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:j,lineStyle:ue,size:[d,me+ve.top+ve.bottom],margin:ve,showAxes:null!==(a=H.showAxes)&&void 0!==a&&a,background:H.background,enableHover:!1},z&&{yExtent:z}),Oe=t("div",{style:{position:"relative",width:d,overflow:"hidden"},children:[e(or,Object.assign({ref:te},Se)),e(da,{width:d-ve.left-ve.right,height:me,margin:ve,scales:ne,brushDirection:be,extent:J,onBrush:ee})]},"minimap"),Ce=e("div",{style:{overflow:"hidden"},children:e(or,Object.assign({},Ae))},"main");return V||U||e(hs,{componentName:"MinimapChart",width:d,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[F?Oe:Ce,F?Ce:Oe]})})}ca.displayName="ScatterplotMatrix",ua.displayName="MinimapChart";const ha=g(function(o,s){const a=i(null);Ms(s,{variant:"xy",frameRef:a});const l=Jr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:S,sizeRange:O=[3,15],pointRadius:C=5,pointOpacity:_=.8,tooltip:j,pointIdAccessor:M,annotations:P,frameProps:L={},selection:T,linkedHover:N,onObservation:B,onClick:E,hoverHighlight:D,chartId:I,loading:R,loadingContent:H,emptyContent:F,legendInteraction:$,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=o,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Z,title:Q,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=l,ie=r(()=>fe(c),[c]),re=Cs({data:ie,rawData:c,colorBy:w,colorScheme:A,legendInteraction:$,legendPosition:W,selection:T,linkedHover:N,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:B,onClick:E,hoverHighlight:D,chartType:"QuadrantChart",chartId:I,showLegend:Z,userMargin:d,marginDefaults:l.marginDefaults,loading:R,loadingContent:H,emptyContent:F,width:X,height:V});ms("QuadrantChart",ie,"xAccessor",f),ms("QuadrantChart",ie,"yAccessor",p);const se=r(()=>{if(!ie.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of ie){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-a,r+a]}},[ie,f,p,y,m]),ae=r(()=>{if(!S||0===ie.length)return;const e=ie.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[ie,S]),le=r(()=>"function"==typeof f?f:e=>+e[f],[f]),ce=r(()=>"function"==typeof p?p:e=>+e[p],[p]),de=r(()=>e=>{const t=le(e),n=ce(e),o=null!=y?t>=y:void 0,i=null!=m?n>=m:void 0;return void 0===i||void 0===o?z||$r:i&&o?v.topRight.color:i&&!o?v.topLeft.color:!i&&o?v.bottomRight.color:v.bottomLeft.color},[le,ce,y,m,v,z]),ue=r(()=>S?e=>bt(e,S,O,ae):void 0,[S,O,ae]),he=Vs({colorBy:w,colorScale:re.colorScale,color:z,pointRadius:C,fillOpacity:_,radiusFn:ue,fallbackFill:de,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),ge=r(()=>{if(!ie.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof S&&e.add(S);const t=ie[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[ie,f,p,w,S]),pe=r(()=>ss([...ge?[{label:ge,accessor:ge,role:"title"}]:[],{label:ne||ts(f),accessor:f,role:"x",format:h},{label:oe||ts(p),accessor:p,role:"y",format:g},...w?[{label:ts(w),accessor:w,role:"color"}]:[],...S?[{label:ts(S),accessor:S,role:"size"}]:[]]),[ge,f,p,ne,oe,w,S,h,g]),ye=ws({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),me=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=i.width,a=i.height,l=null!=y?o.x(y):s/2,c=null!=m?o.y(m):a/2;if(null!=y&&!isFinite(l))return;if(null!=m&&!isFinite(c))return;const d=Math.max(0,Math.min(s,l)),u=Math.max(0,Math.min(a,c)),h=[{config:v.topLeft,x:0,y:0,w:d,h:u},{config:v.topRight,x:d,y:0,w:s-d,h:u},{config:v.bottomLeft,x:0,y:u,w:d,h:a-u},{config:v.bottomRight,x:d,y:u,w:s-d,h:a-u}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(d,0),e.lineTo(d,a),e.stroke(),e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke(),e.setLineDash([])}]},[y,m,v,b]),ve=r(()=>x?[...me,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,s=null!=y?n.x(y):i/2,a=null!=m?n.y(m):r/2;(null==y||isFinite(s))&&(null==m||isFinite(a))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=v.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(v.topLeft.label,8,8),e.fillStyle=v.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(v.topRight.label,i-8,8),e.fillStyle=v.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(v.bottomLeft.label,8,r-8),e.fillStyle=v.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(v.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:me,[me,x,k,v,y,m]),be=r(()=>{const e=L.canvasPreRenderers||[];return[...ve,...e]},[ve,L.canvasPreRenderers]),xe=r(()=>{var o;const i={stroke:b.stroke||"#999",strokeWidth:null!==(o=b.strokeWidth)&&void 0!==o?o:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(o,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const a=s.width,l=s.height,c=null!=y?r.x(y):a/2,d=null!=m?r.y(m):l/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(d))return null;const u=Math.max(0,Math.min(a,c)),h=Math.max(0,Math.min(l,d));return t(n,{children:[[{config:v.topLeft,x:0,y:0,w:u,h:h},{config:v.topRight,x:u,y:0,w:a-u,h:h},{config:v.bottomLeft,x:0,y:h,w:u,h:l-h},{config:v.bottomRight,x:u,y:h,w:a-u,h:l-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:u,y1:0,x2:u,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:a,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(n,{children:[e("text",{x:8,y:8+k,fill:v.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:v.topLeft.label}),e("text",{x:a-8,y:8+k,fill:v.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:v.topRight.label}),e("text",{x:8,y:l-8,fill:v.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:v.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:v.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:v.bottomRight.label})]})]})}]},[y,m,v,b,x,k]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"scatter"},null!=c&&{data:ie}),{xAccessor:f,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:S||void 0,sizeRange:O,pointStyle:he,colorScheme:A,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re.margin,showAxes:l.showAxes,xLabel:ne,yLabel:oe,xFormat:h,yFormat:g,enableHover:U,showGrid:K}),se&&{xExtent:se.xExtent,yExtent:se.yExtent}),re.legendBehaviorProps),Q&&{title:Q}),J&&{description:J}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?pe:vi(j)||pe}),(N||B||E||D)&&{customHoverBehavior:re.customHoverBehavior}),(B||E||N)&&{customClickBehavior:re.customClickBehavior}),M&&{pointIdAccessor:M}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:be}),re.crosshairProps),L),be.length>0&&{canvasPreRenderers:be}),{svgPreRenderers:xe});return re.earlyReturn?re.earlyReturn:ye?e(ls,{componentName:"QuadrantChart",message:ye,width:X,height:V}):e(hs,{componentName:"QuadrantChart",width:X,height:V,children:e(or,Object.assign({ref:a},ke))})});ha.displayName="QuadrantChart";const ga="__ma_unitized",fa="__ma_series";function pa(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function ya(e,t){return t[0]+e*(t[1]-t[0])}const ma=g(function(t,n){var s;const a=i(null),c=i([]),d=i(t.series);d.current=t.series,p(n,()=>{const e=()=>{var e;return(null!==(e=d.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!a.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=r&&isFinite(r)&&a.current.push(Object.assign(Object.assign({},o),{[ga]:pa(r,i),[fa]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!a.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||c.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&o.push(Object.assign(Object.assign({},e),{[ga]:pa(s,r),[fa]:i.label||"Series "+(t+1)}))}a.current.pushMany(o)},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 u=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:g,className:f,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:k=2,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:C,onObservation:_,onClick:j,hoverHighlight:M,chartId:P,loading:L,loadingContent:T,emptyContent:N,legendInteraction:B,legendPosition:E,stroke:D,strokeWidth:I,opacity:R}=t,{width:H,height:F,enableHover:$,showGrid:W,showLegend:z=!0,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V}=u,U=r(()=>fe(h),[h]),K=r(()=>fe(v),[v]),Z=K,Q=2===K.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||Q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${K.length}. Rendering as a standard multi-line chart.`);const J=ys(L,H,F,T),ee=J?null:ps(h,H,F,N),te=Yr(),ne=r(()=>{let e;if(Array.isArray(b))e=b;else if(te&&te.length>0)e=te;else{const t=ht[b];e=Array.isArray(t)?t:gt}return Z.map((t,n)=>t.color||e[n%e.length])},[Z,b,te]),oe=r(()=>K.map((e,t)=>e.label||"Series "+(t+1)),[K]),{unitizedData:ie,extents:re}=r(()=>{if(0===U.length){const e=K.map(e=>e.extent||null).filter(Boolean);return e.length===K.length&&(c.current=e),{unitizedData:[],extents:e.length===K.length?e:[]}}const e=K.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(U,e.yAccessor));if(c.current=e,!Q){const t=[];for(const e of U)for(let n=0;K.length>n;n++){const o=K[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[ga]:i,[fa]:oe[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of U)for(let o=0;2>o;o++){const i=K[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[ga]:pa(r,e[o]),[fa]:oe[o]}))}return{unitizedData:t,extents:e}},[U,K,Q,oe]),se=r(()=>{if(Q&&re.length>=2)return[{orient:"left",label:oe[0],tickFormat:K[0].format||(e=>{const t=ya(e,re[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:oe[1],tickFormat:K[1].format||(e=>{const t=ya(e,re[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Q,re,K,oe]),ae=Cs({data:r(()=>ie.length>0?ie:oe.map(e=>({[fa]:e})),[ie,oe]),rawData:h,colorBy:fa,colorScheme:ne,legendInteraction:B,legendPosition:E,selection:O,linkedHover:C,fallbackFields:[fa],unwrapData:!1,onObservation:_,onClick:j,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:P,showLegend:z,userMargin:g,marginDefaults:Q?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:L,loadingContent:T,emptyContent:N,width:H,height:F});if(ae.earlyReturn)return ae.earlyReturn;const le=r(()=>{const e=new Map;return oe.forEach((t,n)=>e.set(t,ne[n])),e},[oe,ne]),ce=js({lineWidth:k,resolveStroke:l(e=>le.get(e[fa])||ne[0],[le,ne]),stroke:D,strokeWidth:I,opacity:R,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),de=r(()=>{if(!1===w)return()=>null;return vi(w)||(e=>{var t;const n=e.data||e,i=n[fa],r=oe.indexOf(i),s=n[ga],a=Q&&r>=0&&re[r]?ya(s,re[r]):s,l=r>=0&&(null===(t=K[r])||void 0===t?void 0:t.format)?K[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(n):n[m];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ne[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),o.createElement("div",null,`${i}: ${l(a)}`))})},[w,oe,ne,re,Q,K,m]),ue=ws({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),he=Q?[0,1]:void 0,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:ie}),{xAccessor:m,yAccessor:ga,groupAccessor:fa,lineStyle:ce,colorScheme:ne,size:[H,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:u.showAxes}),se&&{axes:se}),{xLabel:V}),Q?{}:{yLabel:oe[0]}),{xFormat:y}),Q&&he&&{yExtent:he}),{enableHover:$}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:W,curve:x}),ae.legendBehaviorProps),Y&&{title:Y}),G&&{description:G}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:de}),A&&{annotations:A}),(C||_||j||M)&&{customHoverBehavior:ae.customHoverBehavior}),(_||j||C)&&{customClickBehavior:ae.customClickBehavior}),ae.crosshairProps),S);return J||ee||(ue?e(ls,{componentName:"MultiAxisLineChart",message:ue,width:H,height:F}):e(hs,{componentName:"MultiAxisLineChart",width:H,height:F,children:e(or,Object.assign({ref:a},ge))}))});ma.displayName="MultiAxisLineChart";const va=g(function(t,n){const o=i(null);Ms(n,{variant:"xy",frameRef:o});const s=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",highAccessor:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,chartId:_,loading:j,loadingContent:M,emptyContent:P}=t,{width:L,height:T,enableHover:N,showGrid:B,title:E,description:D,summary:I,accessibleTable:R,xLabel:H,yLabel:F}=s,$=ys(j,L,T,M),W=$?null:ps(a,L,T,P),z=r(()=>fe(a),[a]),Y=null==p||null==y;ms("CandlestickChart",z,"xAccessor",h),ms("CandlestickChart",z,"highAccessor",g),ms("CandlestickChart",z,"lowAccessor",f),Y||(ms("CandlestickChart",z,"openAccessor",p),ms("CandlestickChart",z,"closeAccessor",y));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=Vr({selection:A,linkedHover:S,onObservation:O,onClick:C,chartType:"CandlestickChart",chartId:_}),V=Ur(S,X),U=r(()=>{const e=s.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?n:Object.assign(Object.assign({},n),function(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(l))},[l,s.marginDefaults,t.mode]),K=r(()=>{const e=[{label:H||ts(h),accessor:h,role:"x",format:d}];return Y?(e.push({label:"High",accessor:g,role:"y",format:u}),e.push({label:"Low",accessor:f,format:u})):(e.push({label:"Open",accessor:p,format:u}),e.push({label:"High",accessor:g,format:u}),e.push({label:"Low",accessor:f,format:u}),e.push({label:"Close",accessor:y,format:u})),ss(e)},[h,H,d,u,g,f,p,y,Y]),Z=ws({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!Y&&{openAccessor:p,closeAccessor:y})}),Q=Math.max(2,Math.min(12,Math.round(L/40))),J=L>200?.1:.02,ee=Object.assign(Object.assign(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:"candlestick"},null!=a&&{data:z}),{xAccessor:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!Y&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:Q,extentPadding:J,size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,showAxes:s.showAxes,xLabel:H,yLabel:F,xFormat:d,yFormat:u,enableHover:N,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),Hs({title:E,description:D,summary:I,accessibleTable:R,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:v,defaultTooltipContent:K})),Fs({linkedHover:S,onObservation:O,onClick:C,customHoverBehavior:G,customClickBehavior:q})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),V),w);return $||W||(Z?e(ls,{componentName:"CandlestickChart",message:Z,width:L,height:T}):e(hs,{componentName:"CandlestickChart",width:L,height:T,children:e(or,Object.assign({ref:o},ee))}))});function ba(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,d=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,u=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!g&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,u=c+o*d,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*d,p=r(t.pieceData[0],t.name),y=0===e,m=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:u,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),s.push(v)}return s}function xa(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=W(e,.25))&&void 0!==t?t:r,median:null!==(n=W(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=W(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function ka(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}function wa(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}va.displayName="CandlestickChart";const Aa={bar:function(e,t){var n,o,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,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(y)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;y&&n>0&&(a/=n);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:o+a),n=0>a?u(i+a)-u(i):u(o)-u(o+a);g.push(Ie(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(p){const t=u(0>a?i+a:o),n=0>a?u(i)-u(i+a):u(o+a)-u(o);g.push(Ie(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,d=[],u="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 f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,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(u){const r=e.x+s*t+n/2,a=l(0),u=l(c);d.push(Ie(r,Math.min(a,u),o,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),u=l(c);d.push(Ie(Math.min(a,u),r,Math.abs(u-a),o,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 n,o;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!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),d=f&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=d(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return u},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),d=r(o,e.name),u=d.r||4,h=(7919*n%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:o})}}return l},pie:ba,donut:ba,boxplot:function(e,t){var n,o,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,m=!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!==(n=W(l,.25))&&void 0!==n?n:c,v=null!==(o=W(l,.5))&&void 0!==o?o:(c+d)/2,b=null!==(i=W(l,.75))&&void 0!==i?i:d,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>w>=e))&&void 0!==s?s:d,O=h(t.pieceData[0],t.name),C=[];if(m)for(const e of t.pieceData){const n=u(e);if(k>n||n>w){const o=y?t.middle:g(n),i=y?g(n):t.middle;C.push({px:o,py:i,value:n,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(A),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,datum:t.pieceData,category:t.name,outliers:C}),m)for(const t of C)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.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 n,o,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),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const n=d(r+(t+.5)*a);v+=` L ${e.middle+u[t]/y*m} ${n}`}v+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const n=d(r+(t+.5)*a);v+=` L ${e.middle-u[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*m}`;v+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const a=null!==(n=W(t,.25))&&void 0!==n?n:r,l=null!==(o=W(t,.5))&&void 0!==o?o:(r+s)/2,c=null!==(i=W(t,.75))&&void 0!==i?i:s;x={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:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:xa(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=[],d=r.bins||25,u=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.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 n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/d||1,r=Array(d).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/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 o=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(Ie(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,y,{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,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 o=t[0],i=t[t.length-1],r=(i-o)/u||1,c=Array(u).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;u>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;u>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${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))};d.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:xa(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return d},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,d=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(Ie(n,e.x,i-n,e.width,d,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(Ie(e.x,n,e.width,i-n,d,t,e.name))}}return l},funnel:function(e,t){var n,o,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 v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let A=0;for(const e of m){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=u(o);i.total+=r,i.pieces.push(o),n+=r}w.push({col:e,groups:t,stepTotal:n}),x||n>A&&(A=n)}if(x)for(const e of w){let t=0,n=0;for(let o=0;v.length>o;o++){const i=e.groups.get(v[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return f;const S=new Map;for(const e of v){const t=w[0].groups.get(e);S.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=w[0].stepTotal,C=x?.95*p:.9*t.width,_=k().domain([0,A]).range([0,C]),j=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let M=new Map;for(let t=0;w.length>t;t++){const n=w[t],o=n.col,d=0===t,u=o.width,h=.55*u,m=o.x+(u-h)/2,b=new Map;if(x){let e=0;for(const t of v){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=p,i=p;for(let r=0;v.length>r;r++){const a=v[r],l=n.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 k=g(l.pieces[0],a),w=null!==(s=S.get(a))&&void 0!==s?s:l.total,A=w>0?l.total/w*100:0,O=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:o.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(O.__funnelStepLabel=o.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=m,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=m,O.__funnelBarW=c),f.push(Ie(x,m,c,h,k,O,a)),b.set(a,{x:x,y:m,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),s=p-t/2,a=v[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],u=l?a:o.name,x=g(c,u),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:d,category:l?a:o.name});y&&(w.__funnelStepLabel=o.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=m,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=m,w.__funnelBarW=t),f.push(Ie(s,m,t,h,x,w,u)),b.set(a,{x:s,y:m,w:t,h:h})}if(t>0&&M.size>0){const t=x?v:[v[0]];for(const i of t){const t=M.get(i),r=b.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)})(),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:j},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};f.push(d)}}M=b}return f},"bar-funnel":function(e,t){var n,o,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 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}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,s=e>0?y[e-1]:null,a=n.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=m.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=o?0:Math.max(0,w-y),S=n.x+e*a+l/2,O=v(y),C=v(0)-O,_=c(f.pieces[0],p?h:n.name),j=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+d/2,__barFunnelLabelY:v(y+A)});if(u.push(Ie(S,O,d,C,_,j,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},_),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});u.push(Ie(S,e,d,t,o,i,p?h:n.name))}}}return u},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,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!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=u?Ie(s,n.x,a,n.width,o,null,"__track__"):Ie(n.x,s,n.width,a,o,null,"__track__");d.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=d.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let f;if(u){const r=l(t),s=l(t+o);f=Ie(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);f=Ie(e.x,r,e.width,s-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=o}if(p>0&&d.length>n){const e=d.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},o.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},o.cornerRadii={tl:p,tr:p})}}return d}};class Sa{constructor(e){this.rExtent=new Le,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 Pe(e.windowSize),this.getO=We(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Fe(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Le)):(this.getR=Fe(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=We(e.stackBy),this.getGroup=We(e.groupBy),this.getColor=We(e.colorAccessor),this.getConnector=We(e.connectorAccessor),this.getDataId=We(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Pe(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 d,u;if(l){d=O().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=k().domain(s).range([o,n])}else a?(d=O().domain(r).range([0,e.height]).padding(c),u=k().domain(s).range([0,e.width])):(d=O().domain(r).range([0,e.width]).padding(c),u=k().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((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 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?k().domain([l,c]).range([0,e.width]):k().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,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,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,d=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,d=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>d&&(d=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>d&&(d=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>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===(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>d&&(d=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){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,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 d=null;if(c&&"radial"!==o){d=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),d.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 d)d.set(t,n/e*r)}let u=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;d?(c=h,g=d.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: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 n,o;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!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Aa[this.config.chartType];let s=r?r(i,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,d=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)),d.has(n)||d.set(n,[]),d.get(n).push({x:o,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===(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}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var n,o,i;const r=this.config,s=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},a=ka(r.colorScheme,r.themeCategorical,ft),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!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...a]},resolveColor:wa(a),config:null!==(i=r.layoutConfig)&&void 0!==i?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||ft,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?xt(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,Sa.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=C().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 d=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;d||(d=this.getCategoryIndexMap(t));const o=d.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,d,u,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],d=this.getNodeKey(c,S);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),w=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o: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,w=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!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,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(d,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!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 n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:Ot(),duration:k})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=At(e,this.activeTransition),s=wt(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=St(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=St(o.x,e._targetX,s),e.y=St(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=St(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=St(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=St(n.x,e._targetX,s),e.y=St(n.y,e._targetY,s),void 0!==n.w&&(e.w=St(n.w,e._targetW,s),e.h=St(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:St(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=St(n.startAngle,e._targetStartAngle,s),e.endAngle=St(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}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]),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&&!He(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!He(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!He(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(He(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=We(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)=>!He(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Fe(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Le)):(this.getR=Fe(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!He(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?We(this.config.stackBy):void 0),"groupBy"in e&&!He(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?We(this.config.groupBy):void 0),"colorAccessor"in e&&!He(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!He(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?We(this.config.connectorAccessor):void 0)}}function Oa(e,t,n){const o=Wt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Ca(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>zt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _a(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=qt(Math.atan2(i,o)),a=qt(e.startAngle),l=qt(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 ja(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 Ma(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 Pa(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=o,{rTickValues:f,axisExtent:p}=o,y="radial"===(null==d?void 0:d.projection),m="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||y?[]:(f||lo(d.r,5,p)).map(e=>({value:e,pixel:d.r(e),label:(g||La)(e)})),[d,g,y,f,p]),b=h&&d&&!y,x=u&&d&&!y;return b||x?e("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[b&&e("g",{className:"ordinal-grid",children:v.map((t,n)=>e("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:i,y2:m?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),x&&e(n,{children:t(n,m?{children:[e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function La(e){return Math.round(100*e)/100+""}function Ta(o){var s,a;const{width:l,height:c,totalWidth:d,totalHeight:u,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C,legendPosition:_="right",legendLayout:j,foregroundGraphics:M,annotations:P,svgAnnotationRules:L,xAccessor:T,yAccessor:N,annotationData:B,underlayRendered:E,children:D}=o,I="radial"===(null==g?void 0:g.projection),R="horizontal"===(null==g?void 0:g.projection),H=!1!==p,F=r(()=>f&&H&&g&&!I?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}}):[],[f,H,g,v,I]),$=o.rTickValues,W=o.tickLabelEdgeAlign,z=o.axisExtent,Y=r(()=>f&&g&&!I?($||lo(g.r,5,z)).map(e=>({value:e,pixel:g.r(e),label:(b||La)(e)})):[],[f,g,b,I,$,z]),G=i(new Map),q=i(null!==(s=null==P?void 0:P.length)&&void 0!==s?s:0),X=null!==(a=null==P?void 0:P.length)&&void 0!==a?a:0;q.current!==X&&(q.current=X,G.current=new Map);const V=r(()=>{if(!P||0===P.length)return null;const e=Zn(),t="horizontal"===(null==g?void 0:g.projection),n=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,o={scales:g?{x:t?g.r:n||g.r,y:t&&n||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:T,yAccessor:N,width:l,height:c,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:G.current};return P.map((t,n)=>{if(L){const i=L(t,n,o);return null!=i?i:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[P,L,l,c,g,T,N,B]);return f||k||w||M||V&&V.length>0||x||D?t("svg",{role:"img",width:d,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!I&&!E&&e("g",{className:"ordinal-grid",children:Y.map((t,n)=>e("line",{x1:R?t.pixel:0,y1:R?0:t.pixel,x2:R?t.pixel:l,y2:R?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&g&&!I&&(()=>{const o={fontSize:"var(--semiotic-tick-font-size, 10px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e("g",{className:"ordinal-axes",children:t(n,R?{children:[t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!E&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!E&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!E&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),Y.map((n,i)=>{const r=W?0===i?"start":i===Y.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)}),m&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]}:{children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!E&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,n=0>t||t>c?c:t;return e("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((n,i)=>t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!E&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Y.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)),m&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]})})})(),V,M,D]}),k&&e("text",{x:d/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof k?k:null}),Dn({legend:w,totalWidth:d,totalHeight:u,margin:h,legendPosition:_,title:k,legendLayout:j,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C})]}):null}function Na({width:t,height:n,totalWidth:o,totalHeight:r,margin:a,scales:l,onBrush:c}){const d=i(null),u=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,s(()=>{if(!d.current)return;const e=y(d.current).select(".brush-g"),o=b?m():v();return o.extent([[0,0],[t,n]]),o.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[n,o]=e.selection;let i;i=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,h.current(r)}),e.call(o),u.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),u.current=null}},[t,n,b]),s(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=y(d.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1)},[l,b]),e("svg",{ref:d,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Ba(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=Ao({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=tn(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function Ea(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 Da(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=H().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}Sa.QUADTREE_THRESHOLD=500;const Ia=(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;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)Ba(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Ea(e,t),Ni(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?tn(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=wo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});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()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Da(e,t)):(Ea(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Ea(e,t),Ni(e,t)),e.globalAlpha=1}}},Ra=(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=tn(e,"var(--semiotic-primary, #007bff)"),a=tn(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?tn(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?tn(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(),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()}},Ha=(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?tn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(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()}},Fa=(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=tn(e,n.style.stroke)||("string"==typeof n.style.fill?tn(e,n.style.fill):n.style.fill)||tn(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}},$a=(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=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Wa(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 za(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Ya=null;const Ga=new Map;function qa(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Ga.get(n);if(void 0!==o)return o;const i=function(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):(Ya||(Ya=document.createElement("canvas")),Ya.width=e,Ya.height=e,Ya)}(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 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")}({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ga.set(n,i),i}function Xa(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 Va(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 Ua(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Ka=e=>[Fa,...e],Za={bar:Ka([Hi]),clusterbar:Ka([Hi]),point:Ka([Di]),swarm:Ka([Di]),pie:[Ia],donut:[Ia],boxplot:Ka([Ra,Di]),violin:Ka([Ha]),histogram:Ka([Hi]),ridgeline:Ka([Ha]),timeline:Ka([Hi]),funnel:[Hi,$a,(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?Wa(i):null!=r?`${Wa(i)} (${za(r)})`:Wa(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Wa(i),e.measureText(c).width+16>o)continue}const d=n.__funnelValueLabelX,u=(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,d,u),e.fillStyle="#fff",e.fillText(c,d,u)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Hi,(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)||tn(e,"var(--semiotic-border, #999)"),o=qa(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=function(e,t){const[n,o,i]=nn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,tn(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 n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,d=r?Ua(i):"",u=Va(o);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=n.__barFunnelLabelX,m=y-f/2,v=n.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Xa(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Xa(e,m,v,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,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3))}e.lineWidth=1}],swimlane:Ka([Hi]),custom:Ka([Hi,Di,Ia,Ra,Ha,$a])},Qa={top:50,right:40,bottom:60,left:70},Ja={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 el({hover:n}){var o,i,r,s,a,l;const c=n.data||{},d=n.stats,u=n.category;if(Array.isArray(c)){const n=u||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(d)return t("div",{className:"semiotic-tooltip",style:Ja,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:["n = ",d.n]}),t("div",{children:["Min: ",d.min.toLocaleString()]}),t("div",{children:["Q1: ",d.q1.toLocaleString()]}),t("div",{children:["Median: ",d.median.toLocaleString()]}),t("div",{children:["Q3: ",d.q3.toLocaleString()]}),t("div",{children:["Max: ",d.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",d.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:Ja,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return t("div",{className:"semiotic-tooltip",style:Ja,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===n.length&&t("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,f=n.__chartType;if("swarm"===f||"point"===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:Ja,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}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 n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:Ja,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}return t("div",{className:"semiotic-tooltip",style:Ja,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}el.ownsChrome=!0;const tl=g(function(n,a){var c,d,h,g,f,y,m,v,b,x,k;const{chartType:w,runtimeMode:A,data:S,oAccessor:O="category",rAccessor:C="value",colorAccessor:_,stackBy:j,groupBy:M,multiAxis:P,timeAccessor:L,valueAccessor:T,categoryAccessor:N,projection:B="vertical",size:E=[600,400],responsiveWidth:D,responsiveHeight:I,margin:R,barPadding:F,roundedTop:$,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Z,showOutliers:Q,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:ne,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,rExtent:se,oExtent:ae,extentPadding:le=.05,oSort:ce,windowMode:de="sliding",windowSize:ue=200,pieceStyle:he,summaryStyle:ge,colorScheme:pe,barColors:ye,showAxes:me=!0,showCategoryTicks:be,categoryLabel:xe,valueLabel:we,categoryFormat:Ae,valueFormat:Se,oLabel:Oe,rLabel:Ce,oFormat:_e,rFormat:je,rTickValues:Me,tickLabelEdgeAlign:Pe,axisExtent:Le,enableHover:Te=!0,hoverAnnotation:Ne,tooltipContent:Be,customHoverBehavior:Ee,annotations:De,svgAnnotationRules:Ie,showGrid:Re=!1,legend:He,legendHoverBehavior:Fe,legendClickBehavior:$e,legendHighlightedCategory:We,legendIsolatedCategories:ze,legendPosition:Ye,legendLayout:Ge,legendCategoryAccessor:qe,onCategoriesChange:Xe,backgroundGraphics:Ve,foregroundGraphics:Ue,title:Ke,className:Ze,background:Qe,centerContent:Je,decay:et,pulse:tt,transition:nt,animate:ot,staleness:it,brush:rt,onBrush:st,accessibleTable:at=!0,description:lt,summary:ct,customLayout:dt,layoutConfig:ut}=n,ht=i(!0),gt=Si({sizeProp:E,responsiveWidth:D,responsiveHeight:I,userMargin:R,marginDefault:Qa,foregroundGraphics:Ue,backgroundGraphics:Ve,animate:ot,transitionProp:nt,themeDirtyRef:ht}),{reducedMotionRef:ft,responsiveRef:pt,size:yt,margin:mt,adjustedWidth:vt,adjustedHeight:bt,resolvedForeground:xt,resolvedBackground:kt,currentTheme:wt,transition:At,introEnabled:St,tableId:Ot,rafRef:Ct,renderFnRef:_t,scheduleRender:jt}=gt,Mt=Mo(),Pt=No(),Lt=r(()=>fe(S),[S]),Tt=null!=xe?xe:Oe,Nt=null!=we?we:Ce,Bt=null!=Ae?Ae:_e,Et=null!=Se?Se:je,Dt=i(null),It=i(null),Rt=i([]),Ht=i(qe),Ft=i(Xe);Ht.current=qe,Ft.current=Xe;const[Wt,zt]=u(null),[Yt,Gt]=u(null),[qt,Vt]=u(0),[Ut,Kt]=u(!1),[Zt,Qt]=u(null),Jt=l(()=>{var e,t;Qt(null!==(t=null===(e=sn.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),en=Te||Ne,nn="streaming"===A,on=r(()=>{var e,t,n;return{chartType:w,runtimeMode:nn?"streaming":"bounded",windowSize:ue,windowMode:de,extentPadding:le,projection:B,oAccessor:nn?void 0:O,rAccessor:nn?void 0:C,colorAccessor:_,stackBy:j,groupBy:M,multiAxis:P,timeAccessor:nn?L:void 0,valueAccessor:nn?T||("string"==typeof C||"function"==typeof C?C:void 0):void 0,categoryAccessor:nn?N||O:void 0,rExtent:se,oExtent:ae,axisExtent:Le,barPadding:F,roundedTop:$,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Z,showOutliers:Q,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:ne,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:pe,themeCategorical:null===(e=null==wt?void 0:wt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(wt),themeSequential:null===(t=null==wt?void 0:wt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==wt?void 0:wt.colors)||void 0===n?void 0:n.diverging,barColors:ye,decay:et,pulse:tt,transition:At,introAnimation:St,staleness:it,customLayout:dt,layoutConfig:ut,layoutMargin:mt}},[w,ue,de,le,B,O,C,_,j,M,P,L,T,N,se,ae,Le,F,$,W,z,Y,G,q,X,V,U,K,Z,Q,J,ee,te,ne,oe,ie,re,ce,he,ge,pe,ye,et,tt,null==At?void 0:At.duration,null==At?void 0:At.easing,St,it,nn,wt,dt,ut,mt]),rn=Eo(on),sn=i(null);sn.current||(sn.current=new Sa(rn));const an=l(()=>{var e,t;const n=Ht.current,o=Ft.current;if(!o||!n)return;const i=Gi(null!==(t=null===(e=sn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);qi(i,Rt.current)||(Rt.current=i,o(i))},[]);s(()=>{var e;null===(e=sn.current)||void 0===e||e.updateConfig(rn),ht.current=!0,jt()},[rn,jt]);const ln=i(null);ln.current||(ln.current=new ve(e=>{const t=sn.current;t&&t.ingest(e)&&(ht.current=!0,jt())}));const cn=l(e=>{var t;null===(t=ln.current)||void 0===t||t.push(e)},[]),dn=l(e=>{var t;null===(t=ln.current)||void 0===t||t.pushMany(e)},[]),un=l(()=>{var e,t;null===(e=ln.current)||void 0===e||e.clear(),null===(t=sn.current)||void 0===t||t.clear(),ht.current=!0,jt()},[jt]),hn=l(e=>{var t,n;null===(t=ln.current)||void 0===t||t.clearLastData(),null===(n=ln.current)||void 0===n||n.setReplacementData(e)},[]);p(a,()=>({push:cn,pushMany:dn,replace:hn,remove:e=>{var t,n,o,i;null===(t=ln.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=It.current)||void 0===i?void 0:i.data;!!It.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(It.current=null,zt(null)),ht.current=!0,jt()}return r},update:(e,t)=>{var n,o,i;null===(n=ln.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&&(ht.current=!0,jt()),r},clear:un,getData:()=>{var e,t,n;return null===(e=ln.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}}),[cn,dn,hn,un,jt]),s(()=>{var e;S&&(null===(e=ln.current)||void 0===e||e.setBoundedData(Lt))},[S,Lt]);const{hoverHandlerRef:gn,hoverLeaveRef:fn,onPointerMove:pn,onPointerLeave:yn}=gt;gn.current=e=>{if(!en)return;const t=Dt.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>vt||0>i||i>bt)return void(It.current&&(It.current=null,zt(null),Ee&&Ee(null),jt()));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=Xt(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":if(null==r.datum)break;e=Oa(r,t,n);break;case"point":if(i)break;e=Ca(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=_a(r,t,n);break;case"boxplot":e=ja(r,t,n);break;case"violin":e=Ma(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-vt/2:o,s?i-bt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(It.current&&(It.current=null,zt(null),Ee&&Ee(null),jt()));const l=ui(a.datum||{},a.x,a.y,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 C?C:void 0,__chartType:w}));It.current=l,zt(l),Ee&&(Ee(l),ht.current=!0),jt()},fn.current=()=>{It.current&&(It.current=null,zt(null),Ee&&(Ee(null),ht.current=!0),jt())};const mn=i(-1),vn=i(null),bn=i(null),An=l(e=>{const t=sn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(bn.current&&bn.current.version===n)o=bn.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){if(null==r.datum)continue;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){if(null===r.datum)continue;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=xn(e),bn.current={version:n,graph:o}}const i=mn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),mn.current=0;const t=o.flat[0];vn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},On(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});return It.current=n,zt(n),Ee&&Ee(n),void jt()}const r=kn(o,i),s=wn(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return mn.current=-1,vn.current=null,It.current=null,zt(null),Ee&&Ee(null),void jt();mn.current=s;const a=o.flat[s];vn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},On(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});It.current=l,zt(l),Ee&&Ee(l),jt()},[Ee,jt]),Sn=l(e=>{mn.current=-1,vn.current=null,pn(e)},[pn]);_t.current=()=>{var e,t;Ct.current=0;const n=Dt.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(ft.current?r+1e6:r),a=!ft.current&&s,l=ht.current;l&&!s&&(i.computeScene({width:vt,height:bt}),an(),Jt(),ht.current=!1),(l||a)&&n.setAttribute("aria-label",zo(i.scene,w+" chart"));const c=Ci(),d=yt[0]*c,u=yt[1]*c;n.width===d&&n.height===u||(n.width=d,n.height=u,n.style.width=yt[0]+"px",n.style.height=yt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,yt[0],yt[1]);const h=null!==(e=null==it?void 0:it.threshold)&&void 0!==e?e:5e3,g=it&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==it?void 0:it.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Qe&&!Ve){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=Qe||(e&&"transparent"!==e?e:null),i=t?tn(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,yt[0],yt[1]))}const f="radial"===B;o.save(),o.beginPath(),o.rect(mt.left,mt.top,vt,bt),o.clip(),f?(o.save(),o.translate(mt.left+vt/2,mt.top+bt/2)):o.translate(mt.left,mt.top);const p=dt?Za.custom:Za[w]||[],y={width:vt,height:bt};for(const e of p)e(o,i.scene,i.scales,y);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Gt(i.scales),Vt(e=>e+1)),(null==it?void 0:it.showBadge)&&Kt(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Ct.current=requestAnimationFrame(()=>_t.current()))},Bo({hydrated:Mt,wasHydratingFromSSR:Pt,storeRef:sn,dirtyRef:ht,renderFnRef:_t,cleanup:()=>{var e;return null===(e=ln.current)||void 0===e?void 0:e.clear()}}),s(()=>{ht.current=!0,jt()},[w,vt,bt,me,Qe,jt]),Cn(it,sn,ht,jt,Ut,Kt);const _n=en&&Wt?Be?Be(Wt):e(el,{hover:Wt}):null,jn="radial"===B,Mn=_n?e(bi,{x:Wt?jn?Wt.x+vt/2:Wt.x:0,y:Wt?jn?Wt.y+bt/2:Wt.y:0,containerWidth:vt,containerHeight:bt,margin:mt,className:"stream-ordinal-tooltip",children:_n}):null,Pn=Xi(O,void 0,"__semiotic_resolvedO",""),Ln=Xi(C,void 0,"__semiotic_resolvedR",""),Tn=Pn.key,Nn=Ln.key,Bn=Vi(Pn,Ln,De&&De.length>0||!1);if(_o||!Mt&&Pt){const n=sn.current;n&&S&&(n.ingest({inserts:Lt,bounded:!0}),n.computeScene({width:vt,height:bt}));const i=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(d=null==n?void 0:n.scales)&&void 0!==d?d:null,s="radial"===B,a=s?mt.left+vt/2:mt.left,l=s?mt.top+bt/2:mt.top;return t("div",{ref:pt,className:"stream-ordinal-frame"+(Ze?" "+Ze:""),role:"img","aria-label":lt||("string"==typeof Ke?Ke:"Ordinal chart"),style:{position:"relative",width:D?"100%":yt[0],height:I?"100%":yt[1]},children:[e(ri,{summary:ct}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:yt[0],height:yt[1],style:{position:"absolute",left:0,top:0},children:[kt&&e("g",{transform:`translate(${mt.left},${mt.top})`,children:kt}),t("g",{transform:`translate(${a},${l})`,children:[Qe&&e("rect",{x:0,y:0,width:vt,height:bt,fill:Qe}),i.map((n,i)=>function(n,i,r){var s,a,l,c,d,u,h,g,f;const p=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",y=e=>`ord-${n.type}-${p}-${i}-${e}`,m=`ord-${n.type}-${p}-${i}`;switch(n.type){case"rect":{const i=n,r=Co(m)+"-grad",s=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let n=0;t.length>n;n++)l.push(e("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=Oo(t.style.fill);l.push(e("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:Oo(i.style.fill);if(i.cornerRadii&&bo(i.cornerRadii)){const n=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=xo(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(i);return t(o.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:n,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}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:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+d-n} A${n},${n} 0 0 0 ${r+n},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r+n},${l+d} A${n},${n} 0 0 1 ${r},${l+d-n} Z`;break;default:u=`M${r},${l+d} 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+d} Z`}return t(o.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:u,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}return t(o.Fragment,{children:[s&&e("defs",{children:s}),e("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})]},m)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Oo(t.style.fill),opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}case"wedge":{const o=n;if(o._gradientBand&&o._gradientBand.colors.length>0){const n=Co(`${r?r+"-":""}gauge-grad-${o.category||m}-${i}`),{clipPath:s,slices:u}=Ao({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:null===(l=null===(a=o.roundedEnds)||void 0===a?void 0:a.start)||void 0===l||l,roundEnd:null===(d=null===(c=o.roundedEnds)||void 0===c?void 0:c.end)||void 0===d||d,colors:o._gradientBand.colors});return t("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[e("defs",{children:e("clipPath",{id:n,children:e("path",{d:s})})}),e("g",{clipPath:`url(#${n})`,children:u.map((t,n)=>e("path",{d:t.d,fill:Oo(t.color)},n))}),o.style.stroke&&"none"!==o.style.stroke&&e("path",{d:s,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}let s;if(o.roundedEnds)s=wo({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=H().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),s=e(So)||""}return e("path",{d:s,transform:`translate(${o.cx},${o.cy})`,fill:Oo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},m)}case"boxplot":{const o=n,i=o.columnWidth/2;return t("g","vertical"===o.projection?{children:[e("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Oo(o.style.fill),fillOpacity:null!==(u=o.style.fillOpacity)&&void 0!==u?u:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("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:[e("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Oo(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const t=n,o=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Oo(t.style.fill),fillOpacity:null!==(g=t.style.fillOpacity)&&void 0!==g?g:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},y("path"))];if(t.iqrLine&&t.bounds){const n=t.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med"))):o.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med")))}return e("g",{children:o},m)}case"connector":return e("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!==(f=n.style.opacity)&&void 0!==f?f:.5},m);case"trapezoid":{const t=n,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:o,fill:Oo(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}default:return null}}(n,i,Ot)).filter(Boolean)]})]}),e(Ta,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:r,showAxes:me,showCategoryTicks:be,oLabel:Tt,rLabel:Nt,oFormat:Bt,rFormat:Et,rTickValues:Me,tickLabelEdgeAlign:Pe,axisExtent:Le,showGrid:Re,title:Ke,legend:He,legendHoverBehavior:Fe,legendClickBehavior:$e,legendHighlightedCategory:We,legendIsolatedCategories:ze,legendPosition:Ye,legendLayout:Ge,foregroundGraphics:$t(xt,null===(h=sn.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:De,svgAnnotationRules:Ie,annotationFrame:0,xAccessor:Tn,yAccessor:Nn,annotationData:Bn(null==n?void 0:n.getData())}),Je&&"radial"===B&&e("div",{style:{position:"absolute",left:mt.left+vt/2,top:mt.top+bt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Je})]})}return t("div",{ref:pt,className:"stream-ordinal-frame"+(Ze?" "+Ze:""),role:"group","aria-label":lt||("string"==typeof Ke?Ke:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:D?"100%":yt[0],height:I?"100%":yt[1],overflow:"visible"},onKeyDown:An,children:[at&&e(si,{tableId:Ot}),at&&e(oi,{scene:null!==(f=null===(g=sn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:w+" chart",tableId:Ot,chartTitle:"string"==typeof Ke?Ke:void 0}),e(ri,{summary:ct}),t("div",{role:"img","aria-label":lt||("string"==typeof Ke?Ke:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:en?Sn:void 0,onMouseLeave:en?yn:void 0,children:[kt&&e("svg",{style:{position:"absolute",top:0,left:0,width:yt[0],height:yt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${mt.left},${mt.top})`,children:kt})}),e(Pa,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:Yt,showAxes:me,showGrid:Re,rFormat:Et,rTickValues:Me,axisExtent:Le}),e("canvas",{ref:Dt,"aria-label":zo(null!==(m=null===(y=sn.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:yt[0],height:yt[1]}}),e(ai,{hoverPoint:Wt}),e(Ta,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:Yt,showAxes:me,showCategoryTicks:be,oLabel:Tt,rLabel:Nt,oFormat:Bt,rFormat:Et,rTickValues:Me,axisExtent:Le,showGrid:Re,title:Ke,legend:He,legendHoverBehavior:Fe,legendClickBehavior:$e,legendHighlightedCategory:We,legendIsolatedCategories:ze,legendPosition:Ye,legendLayout:Ge,foregroundGraphics:$t(xt,Zt),annotations:De,svgAnnotationRules:Ie,annotationFrame:qt,xAccessor:Tn,yAccessor:Nn,annotationData:Bn(null===(v=sn.current)||void 0===v?void 0:v.getData()),underlayRendered:!0}),(rt||st)&&"radial"!==B&&e(Na,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:Yt,onBrush:st||(()=>{})}),Je&&"radial"===B&&e("div",{style:{position:"absolute",left:mt.left+vt/2,top:mt.top+bt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Je}),(null==it?void 0:it.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===it.badgePosition?{top:4,left:4}:"bottom-left"===it.badgePosition?{bottom:4,left:4}:"bottom-right"===it.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ut?"#dc3545":"#28a745",color:"white"}),children:Ut?"STALE":"LIVE"}),e(ci,{active:mn.current>=0,hoverPoint:Wt,margin:mt,size:yt,shape:null===(b=vn.current)||void 0===b?void 0:b.shape,width:null===(x=vn.current)||void 0===x?void 0:x.w,height:null===(k=vn.current)||void 0===k?void 0:k.h}),Mn]})]})});function nl({ref:e,frameRef:t,setup:n}){return p(e,()=>({push:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)},pushMany:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)},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;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==n?n:null}}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function ol(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:i,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=mt(e,t,n)}else c.fill=Gr(o,i,s,f?r:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,i,s,a,f,p,y]),v=r(()=>_s(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:d,opacity:u}),[m,l,c,d,u]);return r(()=>Lr(v,null!=h?h:null,g),[v,h,g])}tl.displayName="StreamOrdinalFrame";const il=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:k,annotations:w,regression:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:E,legendPosition:D,color:I,stroke:R,strokeWidth:H,opacity:F,showCategoryTicks:$,categoryFormat:W,dataIdAccessor:z}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Z,accessibleTable:Q,categoryLabel:J,valueLabel:ee}=o,te=r(()=>fe(a),[a]),ne=Cs({data:te,rawData:a,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:D,selection:C,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:Y,height:G}),{effectiveLegendProps:oe,effectiveMargin:ie}=nl({ref:n,frameRef:s,setup:ne});if(ne.earlyReturn)return ne.earlyReturn;ms("BarChart",te,"categoryAccessor",d),ms("BarChart",te,"valueAccessor",u);const re=Xr(te,y,u),se=Yr(),ae=r(()=>new Map,[te]),le=ol({colorBy:f,colorScale:ne.colorScale,color:I,themeCategorical:se,colorScheme:p,categoryIndexMap:ae,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:R,strokeWidth:H,opacity:F,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=r(()=>as({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),de=ws({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(de)return e(ls,{componentName:"BarChart",message:de,width:Y,height:G});const ue=Ks(A),he=ue?[ue,...w||[]]:w,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({chartType:"bar"},null!=a&&{data:re}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:q,showAxes:o.showAxes,oLabel:J,rLabel:ee,rFormat:g}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:$,oSort:y}),oe),Hs({title:U,description:K,summary:Z,accessibleTable:Q,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:k,defaultTooltipContent:ce})),Fs({linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"BarChart",width:Y,height:G,children:e(tl,Object.assign({ref:s},ge))})});il.displayName="BarChart";const rl=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:E,legendPosition:D,color:I,stroke:R,strokeWidth:H,opacity:F,categoryFormat:$}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Z,valueLabel:Q}=o,J=r(()=>fe(a),[a]),ee=p||u,te=Cs({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:E,legendPosition:D,selection:C,linkedHover:_,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const ne=Yr(),oe=r(()=>new Map,[J]),ie=ol({colorBy:ee,colorScale:te.colorScale,color:I,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:R,strokeWidth:H,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>as({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),se=ws({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=nl({ref:n,frameRef:s,setup:te}),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({chartType:"bar"},null!=a&&{data:J}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:Q,rFormat:f}),$&&{oFormat:$}),{showGrid:G}),ae),Hs({title:X,description:V,summary:U,accessibleTable:K,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:w,defaultTooltipContent:re})),Fs({linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return se?e(ls,{componentName:"StackedBarChart",message:se,width:W,height:z}):e(hs,{componentName:"StackedBarChart",width:W,height:z,children:e(tl,Object.assign({ref:s},ce))})});rl.displayName="StackedBarChart";const sl=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:_,onClick:j,hoverHighlight:M,chartId:P,loading:L,loadingContent:T,emptyContent:N,legendInteraction:B,legendPosition:E,color:D,stroke:I,strokeWidth:R,opacity:H,categoryFormat:F}=t,{width:$,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Z}=o,Q=r(()=>fe(a),[a]),J=p||u,ee=Cs({data:Q,rawData:a,colorBy:J,colorScheme:y,legendInteraction:B,legendPosition:E,selection:O,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:j,hoverHighlight:M,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:l,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:N,width:$,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=Yr(),ne=r(()=>new Map,[Q]),oe=ol({colorBy:J,colorScale:ee.colorScale,color:D,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:S.pieceStyle,stroke:I,strokeWidth:R,opacity:H,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=r(()=>as({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),re=ws({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=nl({ref:n,frameRef:s,setup:ee}),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({chartType:"clusterbar"},null!=a&&{data:Q}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[$,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:f}),F&&{oFormat:F}),{showGrid:Y}),se),Hs({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:k,defaultTooltipContent:ie})),Fs({linkedHover:C,onObservation:_,onClick:j,hoverHighlight:M,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e(ls,{componentName:"GroupedBarChart",message:re,width:$,height:W}):e(hs,{componentName:"GroupedBarChart",width:$,height:W,children:e(tl,Object.assign({ref:s},le))})});function al({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=Pr("string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0),s=mr({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof o?o:"value")}),a=i(s.brushInteraction);a.current=s.brushInteraction;const c=l(e=>{if(r){a.current.end(e?e.r:null)}null==t||t(e)},[t,r]),d=!!(e||n||t);return{hasBrush:d,handleBrush:c,brushStreamProps:d?{brush:{dimension:"r"},onBrush:c}:{}}}sl.displayName="GroupedBarChart";const ll=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);Ms(n,{variant:"xy",frameRef:s});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:m=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:A,brush:S,onBrush:O,linkedBrush:C,frameProps:_={},selection:j,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,chartId:N,loading:B,loadingContent:E,emptyContent:D,legendInteraction:I,legendPosition:R,color:H,stroke:F,strokeWidth:$,opacity:W,showCategoryTicks:z,categoryFormat:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Z,summary:Q,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,ne=r(()=>fe(a),[a]),oe=Cs({data:ne,rawData:a,colorBy:f,colorScheme:p,legendInteraction:I,legendPosition:R,selection:j,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:N,showLegend:U,userMargin:l,marginDefaults:o.marginDefaults,loading:B,loadingContent:E,emptyContent:D,width:G,height:q}),ie=al({brushProp:S,onBrushProp:O,linkedBrush:C,valueAccessor:u});if(oe.earlyReturn)return oe.earlyReturn;const re=r(()=>{if(!y)return;const e=ne.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[ne,y]),se=Yr(),ae=r(()=>new Map,[ne]),le=ol({colorBy:f,colorScale:oe.colorScale,color:H,themeCategorical:se,colorScheme:p,categoryIndexMap:ae,userPieceStyle:null==_?void 0:_.pieceStyle,stroke:F,strokeWidth:$,opacity:W,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?bt(e,y,m,re):v})}),ce=r(()=>as({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),de=ws({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(de)return e(ls,{componentName:"SwarmPlot",message:de,width:G,height:q});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({chartType:"swarm"},null!=a&&{data:ne}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,barPadding:x,enableHover:X}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:ee,rLabel:te,rFormat:g}),Y&&{oFormat:Y}),{showGrid:V,showCategoryTicks:z}),oe.legendBehaviorProps),Hs({title:K,description:Z,summary:Q,accessibleTable:J,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:k,defaultTooltipContent:ce})),Fs({linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),ie.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"SwarmPlot",width:G,height:q,children:e(tl,Object.assign({ref:s},ue))})});function cl(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 t("div",{className:"semiotic-tooltip",style:hi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&t("div",{children:["n = ",s.n]}),null!=s.min&&t("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&t("div",{children:["Q1: ",s.q1.toLocaleString()]}),t("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&t("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&t("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&t("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 t("div",{className:"semiotic-tooltip",style:hi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&t("div",{children:["n = ",a]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:hi,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}ll.displayName="SwarmPlot";const dl=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);Ms(n,{variant:"xy",frameRef:s});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:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:_,loading:j,loadingContent:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:N,stroke:B,strokeWidth:E,opacity:D,showCategoryTicks:I,categoryFormat:R}=t,{width:H,height:F,enableHover:$,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=o,K=r(()=>fe(a),[a]),Z=Cs({data:K,rawData:a,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"BoxPlot",chartId:_,showLegend:z,userMargin:l,marginDefaults:o.marginDefaults,loading:j,loadingContent:M,emptyContent:P,width:H,height:F});if(Z.earlyReturn)return Z.earlyReturn;const Q=Yr(),J=r(()=>new Map,[K]),ee=ol({colorBy:f,colorScale:Z.colorScale,color:N,themeCategorical:Q,colorScheme:p,categoryIndexMap:J,userPieceStyle:void 0,stroke:B,strokeWidth:E,opacity:D,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=r(()=>cl(),[]),ne=ws({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ne)return e(ls,{componentName:"BoxPlot",message:ne,width:H,height:F});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({chartType:"boxplot"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:y,size:[H,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:U,rFormat:g}),R&&{oFormat:R}),{showGrid:W,showCategoryTicks:I}),Z.legendBehaviorProps),Hs({title:Y,description:G,summary:q,accessibleTable:X,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:v,defaultTooltipContent:te})),Fs({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"BoxPlot",width:H,height:F,children:e(tl,Object.assign({ref:s},oe))})});dl.displayName="BoxPlot";const ul=g(function(n,o){const s=Jr(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=i(null);Ms(o,{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:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:E,legendPosition:D,color:I,stroke:R,strokeWidth:H,opacity:F,showCategoryTicks:$,categoryFormat:W}=n,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:J}=s,ee=r(()=>fe(l),[l]),te=Cs({data:ee,rawData:l,colorBy:y,colorScheme:m,legendInteraction:E,legendPosition:D,selection:C,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:X,userMargin:c,marginDefaults:s.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:z,height:Y}),ne=al({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(te.earlyReturn)return te.earlyReturn;const oe=r(()=>{if(0===ee.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of ee){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[ee,h]),ie=Yr(),re=r(()=>new Map,[ee]),se=ol({colorBy:y,colorScale:te.colorScale,color:I,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:R,strokeWidth:H,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ae=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return t("div",{className:"semiotic-tooltip",style:hi,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),s&&2===s.length&&t("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=ws({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(le)return e(ls,{componentName:"Histogram",message:le,width:z,height:Y});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({chartType:"histogram"},null!=l&&{data:ee}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:g,normalize:f}),k?{rExtent:k}:oe&&{rExtent:oe}),{size:[z,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:s.showAxes,oLabel:Q,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:$}),te.legendBehaviorProps),Hs({title:V,description:U,summary:K,accessibleTable:Z,className:d,animate:n.animate,axisExtent:n.axisExtent})),$s({tooltip:b,defaultTooltipContent:ae})),Fs({linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),ne.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"Histogram",width:z,height:Y,children:e(tl,Object.assign({ref:a},ce))})});ul.displayName="Histogram";const hl=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);Ms(n,{variant:"xy",frameRef:s});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:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:E,legendPosition:D,color:I,stroke:R,strokeWidth:H,opacity:F,showCategoryTicks:$,categoryFormat:W}=t,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:J}=o,ee=r(()=>fe(a),[a]),te=Cs({data:ee,rawData:a,colorBy:y,colorScheme:m,legendInteraction:E,legendPosition:D,selection:C,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:z,height:Y}),ne=al({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const oe=Yr(),ie=r(()=>new Map,[ee]),re=ol({colorBy:y,colorScale:te.colorScale,color:I,themeCategorical:oe,colorScheme:m,categoryIndexMap:ie,userPieceStyle:void 0,stroke:R,strokeWidth:H,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=r(()=>cl({valueAccessor:u}),[u]),ae=ws({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ae)return e(ls,{componentName:"ViolinPlot",message:ae,width:z,height:Y});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({chartType:"violin"},null!=a&&{data:ee}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:g,showIQR:f,size:[z,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:$}),te.legendBehaviorProps),Hs({title:V,description:U,summary:K,accessibleTable:Z,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:b,defaultTooltipContent:se})),Fs({linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"ViolinPlot",width:z,height:Y,children:e(tl,Object.assign({ref:s},le))})});hl.displayName="ViolinPlot";const gl=g(function(t,n){var o;const s=Jr(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Ms(n,{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:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:k,regression:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:_,onClick:j,hoverHighlight:M,chartId:P,loading:L,loadingContent:T,emptyContent:N,legendInteraction:B,legendPosition:E,color:D,stroke:I,strokeWidth:R,opacity:H,categoryFormat:F}=t,{width:$,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Z}=s,Q=r(()=>fe(l),[l]),J=Cs({data:Q,rawData:l,colorBy:p,colorScheme:y,legendInteraction:B,legendPosition:E,selection:O,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:j,hoverHighlight:M,chartType:"DotPlot",chartId:P,showLegend:G,userMargin:c,marginDefaults:s.marginDefaults,loading:L,loadingContent:T,emptyContent:N,width:$,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=Xr(Q,m,h),te=Yr(),ne=r(()=>new Map,[Q]),oe=ol({colorBy:p,colorScale:J.colorScale,color:D,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:I,strokeWidth:R,opacity:H,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=r(()=>as({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),re=ws({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(re)return e(ls,{componentName:"DotPlot",message:re,width:$,height:W});const se=Ks(w),ae=se?[se,...k||[]]:k,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:ee}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[$,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:b,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:K,rLabel:Z,rFormat:f}),F&&{oFormat:F}),{showGrid:Y,oSort:m}),J.legendBehaviorProps),Hs({title:q,description:X,summary:V,accessibleTable:U,className:d,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:x,defaultTooltipContent:ie})),Fs({linkedHover:C,onObservation:_,onClick:j,hoverHighlight:M,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"DotPlot",width:$,height:W,children:e(tl,Object.assign({ref:a},le))})});gl.displayName="DotPlot";const fl=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);Ms(n,{variant:"xy",frameRef:s});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:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,hoverHighlight:_,chartId:j,loading:M,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:N,color:B,stroke:E,strokeWidth:D,opacity:I,showCategoryTicks:R,categoryFormat:H}=t,{width:F,height:$,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=o,Z=r(()=>fe(a),[a]),Q=Cs({data:Z,rawData:a,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:N,selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:C,hoverHighlight:_,chartType:"RidgelinePlot",chartId:j,showLegend:Y,userMargin:l,marginDefaults:o.marginDefaults,loading:M,loadingContent:P,emptyContent:L,width:F,height:$});if(Q.earlyReturn)return Q.earlyReturn;const J=Yr(),ee=r(()=>new Map,[Z]),te=ol({colorBy:y,colorScale:Q.colorScale,color:B,themeCategorical:J,colorScheme:m,categoryIndexMap:ee,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:I,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=r(()=>cl(),[]),oe=ws({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(oe)return e(ls,{componentName:"RidgelinePlot",message:oe,width:F,height:$});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({chartType:"ridgeline"},null!=a&&{data:Z}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:g,size:[F,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:p}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:R,oSort:!1,amplitude:f}),Q.legendBehaviorProps),Hs({title:G,description:q,summary:X,accessibleTable:V,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:b,defaultTooltipContent:ne})),Fs({linkedHover:S,onObservation:O,onClick:C,hoverHighlight:_,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"RidgelinePlot",width:F,height:$,children:e(tl,Object.assign({ref:s},ie))})});fl.displayName="RidgelinePlot";const pl=g(function(t,n){var o,s;const a=Jr(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:d,className:u,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:_,loadingContent:j,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:N,strokeWidth:B,opacity:E}=t,{width:D,height:I,enableHover:R,showLegend:H,title:F,description:$,summary:W,accessibleTable:z}=a,Y=r(()=>fe(c),[c]),G=f||h,q=Cs({data:Y,rawData:c,colorBy:G,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:C,showLegend:H,userMargin:d,marginDefaults:a.marginDefaults,loading:_,loadingContent:j,emptyContent:M,width:D,height:I});if(q.earlyReturn)return q.earlyReturn;const X=Yr(),V=r(()=>new Map,[Y]),U=ol({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:p,categoryIndexMap:V,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:N,strokeWidth:B,opacity:E,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=r(()=>as({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Z=ws({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:J}=nl({ref:n,frameRef:l,setup:q}),ee=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:Y}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:U,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[D,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),Q),Hs({title:F,description:$,summary:W,accessibleTable:z,className:u,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:v,defaultTooltipContent:K})),Fs({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e(ls,{componentName:"PieChart",message:Z,width:D,height:I}):e(hs,{componentName:"PieChart",width:D,height:I,children:e(tl,Object.assign({ref:l},ee))})});pl.displayName="PieChart";const yl=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),s=i(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:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:_,loadingContent:j,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:N,strokeWidth:B,opacity:E}=t,{width:D,height:I,enableHover:R,showLegend:H,title:F,description:$,summary:W,accessibleTable:z}=o,Y=r(()=>fe(a),[a]),G=f||d,q=Cs({data:Y,rawData:a,colorBy:G,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:C,showLegend:H,userMargin:l,marginDefaults:o.marginDefaults,loading:_,loadingContent:j,emptyContent:M,width:D,height:I});if(q.earlyReturn)return q.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(D,I)),V=Yr(),U=r(()=>new Map,[Y]),K=ol({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:p,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:N,strokeWidth:B,opacity:E,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Z=r(()=>as({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),Q=ws({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=nl({ref:n,frameRef:s,setup:q}),te=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:Y}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:K,innerRadius:X,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[D,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),Hs({title:F,description:$,summary:W,accessibleTable:z,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:v,defaultTooltipContent:Z})),Fs({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Q?e(ls,{componentName:"DonutChart",message:Q,width:D,height:I}):e(hs,{componentName:"DonutChart",width:D,height:I,children:e(tl,Object.assign({ref:s},te))})});function ml(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function vl(e){return Math.max(0,Math.min(1,e))}function bl(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function xl(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function kl(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:vl(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=vl(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,s=r>0?(o-t.offset)/r:0,a=bl(t.color),l=bl(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,d,u]=a,[h,g,f]=l;return xl(c+(h-c)*s,d+(g-d)*s,u+(f-u)*s)}return n[n.length-1].color}function wl(e,t,n){return`${e}-${t}`}yl.displayName="DonutChart";const Al=g(function(n,o){const s=Jr(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=i(null),l="context"===n.mode,{compactMode:c}=s,{value:d,min:u=0,max:h=100,thresholds:g,gradientFill:f,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:v,showNeedle:b=!0,needleColor:x="var(--semiotic-text, #333)",centerContent:k,valueFormat:w,showScaleLabels:A=!c,sweep:S=240,fillZones:O=!0,tooltip:C,annotations:_,frameProps:j={},className:M,stroke:P,strokeWidth:L,opacity:T}=n,{width:N,height:B,title:E,description:D,summary:I,accessibleTable:R}=s,H=f&&"object"==typeof f?f:void 0,F=Math.max(u,Math.min(h,d)),$=h-u||1,W=(F-u)/$,{gaugeData:z,pieceStyle:Y,gaugeAnnotations:G}=r(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:d=240}=e,u=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/u;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=a?h:1,t=wl("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(d)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(kl(c.colorStops,e*(t+.5)/n));const i=wl("fill",0);p.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(i,{fill:o[0]||s})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/u,r=(e-t)/u,l=(o.value-t)/u,c=Math.max(0,(a?Math.min(h,l):l)-r),d=a?Math.max(0,i-c):0;if(c>0){const e=wl("fill",n);p.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(d>0){const e=wl("bg",n);p.push({category:e,value:d,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&m.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:m}}({min:u,max:h,value:d,thresholds:g,fillColor:p,backgroundColor:y,fillZones:O,showScaleLabels:A,gradientFill:H}),[d,u,h,g,p,y,A,O,H]),q=r(()=>_s(Y,{stroke:P,strokeWidth:L,opacity:T}),[Y,P,L,T]),{sweepRad:X,startAngleDeg:V}=ml(S),U=function(e=240){const{sweepRad:t,offsetRad:n}=ml(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(S),K=Math.min(10,Math.max(1,Math.min(N,B)/12)),Z=U.cx,Q=U.cy,J=Math.max(4,Math.min((N-2*K)/U.width,(B-2*K)/U.height)-2),ee=Math.max(0,Math.min(J-1.5,J*(1-m))),te=N/2-Z*J,ne=B/2-Q*J,oe=2*(J+4),ie=r(()=>{if(c&&null==k)return null;if(null!=k)return"function"==typeof k?k(F,u,h):k;const n=w?w(F):Math.round(F)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),A&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[k,F,u,h,w,A,J,c]),re=r(()=>l&&null==k?{type:"gauge-value",text:w?w(F):Math.round(F)+""}:null,[l,k,F,w]),se=r(()=>{if(!b)return null;const e=-Math.PI/2+V*Math.PI/180+W*X,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:x}},[b,W,V,X,ee,x]),ae=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||N)/2,s=(i.height||B)/2,a=Math.max(1,J-ee),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return t("g",{transform:`translate(${r},${s})`,children:[e("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const r=-Math.PI/2+V*Math.PI/180+(n.value-u)/$*X,s=(i.width||N)/2,a=(i.height||B)/2,l=ee-1,c=J+1,d=Math.cos(r)*l,h=Math.sin(r)*l,g=Math.cos(r)*c,f=Math.sin(r)*c,p=J+10,y=Math.cos(r)*p,m=Math.sin(r)*p,v=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let b="middle",x="middle";return v>=11||1>v?(b="middle",x="auto"):v>=1&&5>v?(b="start",x="middle"):v>=5&&7>v?(b="middle",x="hanging"):(b="end",x="middle"),t("g",{transform:`translate(${s},${a})`,children:[e("line",{x1:d,y1:h,x2:g,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e("text",{x:y,y:m,textAnchor:b,dominantBaseline:x,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:n.label})]},"gauge-label-"+o)}return"gauge-value"===n.type?e("text",{x:(i.width||N)/2,y:(i.height||B)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[N,B,u,$,V,X,ee,J]),le=r(()=>{const e=[...G,..._||[]];return se&&e.push(se),re&&e.push(re),e},[G,_,se,re]),ce=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 t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(F):"Remaining"})]})},[F]);if(0===z.length)return e(ls,{componentName:"GaugeChart",message:"No data to display",width:N,height:B});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:q,innerRadius:ee,startAngle:V,sweepAngle:S},null!=v&&{cornerRadius:v}),{centerContent:ie,size:[N,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:B-ne-oe/2,left:te-oe/2,right:N-te-oe/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===C?()=>null:vi(C)||ce,svgAnnotationRules:ae}),le.length>0&&{annotations:le}),E&&{title:E}),D&&{description:D}),I&&{summary:I}),void 0!==R&&{accessibleTable:R}),M&&{className:M}),null!=n.animate&&{animate:n.animate}),j);return e(hs,{componentName:"GaugeChart",width:N,height:B,children:e(tl,Object.assign({ref:a},de))})});Al.displayName="GaugeChart";const Sl=g(function(n,o){const s=Jr(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=i(null);Ms(o,{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:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:_,loading:j,loadingContent:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:N,stroke:B,strokeWidth:E,opacity:D,categoryFormat:I}=n,R="vertical"===y,{width:H,height:F,enableHover:$,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q}=s,X=R?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},V=r(()=>fe(l),[l]),U=f||g,K=!U,Z=Cs({data:V,rawData:l,colorBy:U,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"FunnelChart",chartId:_,showLegend:W,userMargin:c,marginDefaults:X,loading:j,loadingContent:M,emptyContent:P,width:H,height:F});if(Z.earlyReturn)return Z.earlyReturn;ms("FunnelChart",V,"stepAccessor",u),ms("FunnelChart",V,"valueAccessor",h);const Q=Yr(),J=r(()=>new Map,[V]),ee=r(()=>{if(K)return N||((null==Q?void 0:Q[0])?Q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,N,Q,p]),te=ol({colorBy:ee?void 0:U,colorScale:Z.colorScale,color:null!=ee?ee:N,themeCategorical:Q,colorScheme:p,categoryIndexMap:J,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:B,strokeWidth:E,opacity:D,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),ne=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,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!==(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,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 t("div",{className:"semiotic-tooltip",style:hi,children:[d&&e("div",{style:{fontWeight:"bold"},children:d+""}),p&&p!==d&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[u+"",y]})]})},[]),oe=ws({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(oe)return e(ls,{componentName:"FunnelChart",message:oe,width:H,height:F});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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:R?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:R?"vertical":"horizontal",barPadding:R?40:0,pieceStyle:te,size:[H,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:R,showCategoryTicks:R}),I&&{oFormat:I}),{showGrid:R}),!R&&{connectorOpacity:m}),{showLabels:v}),Z.legendBehaviorProps),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?ne:vi(b)||ne}),(A||S||O||C)&&{customHoverBehavior:Z.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Z.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(hs,{componentName:"FunnelChart",width:H,height:F,children:e(tl,Object.assign({ref:a},ie))})});Sl.displayName="FunnelChart";const Ol={RdBu:rt,PiYG:st,PRGn:at,BrBG:lt,RdYlBu:ct,RdYlGn:dt,Spectral:ut},Cl="__likert_neutral_neg",_l="__likert_neutral_pos";function jl(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Ml(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 Pl(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:Cl,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:_l,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Ll(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===Cl?r=n:n.__likertLevel===_l?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 Tl=new Map,Nl=g(function(t,n){const s=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:c,margin:d,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:m="count",levels:v,orientation:b="horizontal",colorScheme:x,barPadding:k=20,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:_,onObservation:j,onClick:M,hoverHighlight:P,chartId:L,valueFormat:T,loading:N,loadingContent:B,emptyContent:E,legendInteraction:D,legendPosition:I,categoryFormat:R,stroke:H,strokeWidth:F,opacity:$}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Z,valueLabel:Q}=s,J="horizontal"===b,ee=void 0===c,te=!y,ne=function(){var e;const t=Fr();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>=v.length?x:function(e,t){if(0>=e)return[];if(t){const n=Ol[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}(v.length,ne),[x,v.length,ne]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],oe[t]||"#888");return e},[v,oe]),{processedData:re,reAggregate:se,accumulatorRef:ae}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:s,countAccessor:a,isDiverging:c,frameRef:d}){const u=!s,h=r(()=>jl(n,"question"),[n]),g=r(()=>u?jl(o,"score"):null,[u,o]),f=r(()=>u?null:jl(s,"level"),[u,s]),p=r(()=>u?null:jl(a,"count"),[u,a]),y=e||[],m=i([]),v=r(()=>{if(0===y.length)return[];let e=Ml(y,t,h,g,f,p);return c&&(e=Pl(e,t),e=Ll(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var n;let o=Ml(e,t,h,g,f,p);c&&(o=Pl(o,t),o=Ll(o,t)),null===(n=d.current)||void 0===n||n.replace(o)},[t,h,g,f,p,c,d]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:a}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:s="right"}){const a=i(new Set),c=i([]),[d,h]=u(0),g=sr(),f=Yr(),p=l(e=>{const n=e[t];return null!=n?n+"":null},[t]),y=l(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||a.current.has(t)||(a.current.add(t),c.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,p]),m=l(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),i=c.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(a.current=new Set(o),c.current=o,h(e=>e+1))},[e,t]),v=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{a.current=new Set,c.current=[],h(e=>e+1)},[]);Or(e&&t?c.current:[]);const k=r(()=>{if(!e||!t||!1===o)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:f&&f.length>0?f:ft,s=t,a=i.map(e=>({[s]:e})),l=vt(a,s,r);return Mr({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:mt})},[e,t,o,n,g,f,d]),w=r(()=>{if(k)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[k,s]);return{wrapPush:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:k,streamingMarginAdjust:w}}({isPushMode:ee,colorBy:le,colorScheme:oe,showLegend:q,legendPosition:I}),de=l(ce.wrapPush(e=>{ae.current.push(e),se(ae.current)}),[ce.wrapPush,se,ae]),ue=l(ce.wrapPushMany(e=>{ae.current.push(...e),se(ae.current)}),[ce.wrapPushMany,se,ae]);p(n,()=>({push:de,pushMany:ue,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;ae.current=[],ce.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}}),[de,ue,ce.resetCategories,ae]);const he=Cs({data:re,rawData:c,colorBy:le,colorScheme:oe,legendInteraction:D,legendPosition:I,selection:C,linkedHover:_,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:q,userMargin:d,marginDefaults:s.marginDefaults,loading:N,loadingContent:B,emptyContent:E,width:W,height:z});if(he.earlyReturn)return he.earlyReturn;const ge=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),fe=ol({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Tl,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:H,strokeWidth:F,opacity:$,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===Cl||i===_l)return{fill:ge};const r=o||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),pe=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),ye=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===Cl||n===_l?pe:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===Cl||n===_l?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:hi},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[pe]),me=r(()=>{if(!v||2>v.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),ws({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,f,y,m,v,te]),ve=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),be=r(()=>!1!==q?Object.assign(Object.assign({},he.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:I||he.legendPosition||"bottom"}):he.legendBehaviorProps,[he.legendBehaviorProps,he.legendPosition,I,q,ve]),xe=r(()=>{const e=Object.assign({},he.margin);if(ee&&!1!==q){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(ce.streamingMarginAdjust)for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return J&&100>e.left&&(e.left=100),e},[he.margin,ce.streamingMarginAdjust,J,ee,q,I]),ke=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:fe,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:xe,barPadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:Z,rLabel:Q||(J?void 0:"Percentage"),rFormat:ke}),R&&{oFormat:R}),{showGrid:G}),be),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:!1===w?()=>null:!0===w?ye:vi(w)||ye}),(_||j||M||P)&&{customHoverBehavior:he.customHoverBehavior}),(j||M||_)&&{customClickBehavior:he.customClickBehavior}),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return me?e(ls,{componentName:"LikertChart",message:me,width:W,height:z}):e(hs,{componentName:"LikertChart",width:W,height:z,children:e(tl,Object.assign({ref:a},we))})});Nl.displayName="LikertChart";const Bl=g(function(t,n){const o=Jr(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(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:m,tooltip:v,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:_,hoverHighlight:j,chartId:M,loading:P,loadingContent:L,emptyContent:T,legendInteraction:N,legendPosition:B,color:E,stroke:D,strokeWidth:I,opacity:R,categoryFormat:H,rTickValues:F,tickLabelEdgeAlign:$,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Z,title:Q,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=o,ie=r(()=>fe(a),[a]),re=p||u,se=r(()=>{if(null!=m)return m;if("sparkline"!==t.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof d?d(e):e[d])),n=Math.max(1,e.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?V:X)-2*n)/(n-1))):1},[m,t.mode,ie,d,g,X,V]),ae=Cs({data:ie,rawData:a,colorBy:re,colorScheme:y,legendInteraction:N,legendPosition:B,selection:S,linkedHover:O,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:j,chartType:"SwimlaneChart",chartId:M,showLegend:Z,userMargin:l,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:X,height:V}),le=al({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(ae.earlyReturn)return ae.earlyReturn;const ce=Yr(),de=r(()=>new Map,[ie]),ue=ol({colorBy:re,colorScale:ae.colorScale,color:E,themeCategorical:ce,colorScheme:y,categoryIndexMap:de,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:D,strokeWidth:I,opacity:R,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=r(()=>as({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ge=ws({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:pe,effectiveMargin:ye}=nl({ref:n,frameRef:s,setup:ae}),me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:ie}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ue,size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ye,barPadding:se,enableHover:U}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:f}),F&&{rTickValues:F}),null!=$&&{tickLabelEdgeAlign:$}),H&&{oFormat:H}),void 0!==W&&{showCategoryTicks:W}),{showGrid:K}),pe),Hs({title:Q,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent})),$s({tooltip:v,defaultTooltipContent:he})),Fs({linkedHover:O,onObservation:C,onClick:_,hoverHighlight:j,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=Y&&{trackFill:Y}),null!=G&&{roundedTop:G}),q&&{rExtent:q}),le.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ge?e(ls,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e(hs,{componentName:"SwimlaneChart",width:X,height:V,children:e(tl,Object.assign({ref:s},me))})});Bl.displayName="SwimlaneChart";const El={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Dl={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Il{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const n=this.particles[t];return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,n,o){var i;for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const a=n[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=o&&null!==(i=o[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?Rl(a.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)t.length>n?this.particles[n]=t[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=e}}function Rl(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,d,u,h]=e[a];Hl(c,d,u,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*n*o*2,i.y+=e*n*o*2}}(e.segments,t,n,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);const[i,r,s,a]=e.points;Hl(i,r,s,a,t,o);const l=a.x-i.x,c=a.y-i.y,d=Math.sqrt(l*l+c*c);if(d>.001){const t=l/d;o.x+=-c/d*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function Hl(e,t,n,o,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,d=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*n.x+d*o.x,r.y=l*e.y+3*a*i*t.y+3*s*c*n.y+d*o.y}function Fl(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function $l(e,t){var n,o=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,o,u=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(o=a[e][t])===n?(d(n,i),u=!0):r[o]||(u=c(o));if(u)l(e);else for(t=0;a[e].length>t;t++){var h=s[o=a[e][t]];h||(s[o]=h={}),h[o]=!0}return i.pop(),u}function d(e,t){var n=[].concat(t).concat(e);o.push(n)}function u(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),i=Array(t),r=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,d=0,u=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=d,i[t]=!0,d+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=d,i[p]=!0,d+=1,l.push(p),c.push(p);break}i[p]&&(o[t]=0|Math.min(o[t],o[p])),0>s[p]||a[t].push(s[p])}r[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),m.push(a[b]),v+=a[b].length,s[b]=u.length,b===t){l.length=f;break}}u.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:u,adjacencyList:h}}(e),i=o.components.filter(function(e){return e.length>1}),r=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],n=s);var l=i[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}n=0;for(var h=e.length;h>n;){var g=u(n);if(n=g.leastVertex,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(n),n+=1}else n=h}return o}function Wl(e){return e.y0-e.y1>0?"up":"down"}function zl(e,t){return t(e.source)==t(e.target)}function Yl(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function Gl(e){return e.target.x0-e.source.x1}function ql(e,t){var n=Vl(e),o=Gl(t)/Math.tan(n);return"up"==Wl(e)?e.y1-o:e.y1+o}function Xl(e,t){var n=Vl(e),o=Gl(t)/Math.tan(n);return"up"==Wl(e)?e.y1+o:e.y1-o}function Vl(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Ul(e,t){return t(e)}function Kl(e){return Ql(e.source)}function Zl(e){return Ql(e.target)}function Ql(e){return(e.y0+e.y1)/2}function Jl(e){return e.virtual?0:e.value}function ec(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!zl(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!zl(e,t)?o+1:o}),n+o}function tc(e){return e.target.depth}function nc(e,t){return e.sourceLinks.length?e.depth:t-1}function oc(e,t){return e.y0-t.y0}function ic(e,t){return t.y0-e.y0}function rc(e,t){return e.y1-t.y1}function sc(e,t){return t.y1-e.y1}function ac(e,t){return cc(e.source,t.source)||e.index-t.index}function lc(e,t){return cc(e.target,t.target)||e.index-t.index}function cc(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function dc(e,t){return uc(e)==uc(t)?"bottom"==e.circularLinkType?ic(e,t):oc(e,t):uc(t)-uc(e)}function uc(e){return e.target.column-e.source.column}function hc(e,t){return gc(e)==gc(t)}function gc(e){return e.y0-e.y1>0?"up":"down"}function fc(e,t,n,o,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=z(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),pc(r.links.filter(function(e){return"top"==e.circularLinkType}),t,n),pc(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,zl(e,t)&&Yl(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?ic:oc);var d=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+d,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+i*n+d),d+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?sc:rc),d=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+d,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+i*n+d),d+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,i=e.y1,r=(t+o)/2;return"M"+t+","+n+"C"+r+","+n+" "+r+","+i+" "+o+","+i}(e)}),r}function pc(e,t,n){e.sort(dc);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(zl(e,t)&&Yl(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;o.length>s;s++){var a=o[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&yc(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+n;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function yc(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function mc(e){return function(){return e}}function vc(e){return e.index}function bc(e){return e.nodes}function xc(e){return e.links}function kc(e,t,n){var o=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(i,r){var s=i.length;if(t)i.sort(t);else if(r>0){var a=new Map;i.forEach(function(e,t){var n,o,i,r=(o=0,i=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Ql(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Ql(e.target)*t,o+=t}}),o>0?i/o:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var n=a.get(e),o=a.get(t),i=n.bc,r=o.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?n.idx-o.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?ec(t,n)-ec(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==o.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==ec(t,n)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function wc(e,t,n,o,i,r){var s=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});d();for(var a=1,l=r;l>0;--l)c(a*=.99,n),d();function c(t,n){var o=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var a;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&ec(i,n)>0){var l=X(i.sourceLinks,Zl),c=X(i.targetLinks,Kl),d=l&&c?(l+c)/2:l||c;if(d){var u=(d-Ql(i))*t*.3;i.y0+=u,i.y1+=u}}else if(0==s&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(s==o-1&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)a=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+a;else{var h=X(i.sourceLinks,Zl),g=X(i.targetLinks,Kl),f=((h&&g?(h+g)/2:h||g)-Ql(i))*t;i.y0+=f,i.y1+=f}})})}function d(){s.forEach(function(n){var r,s,a,l=e.y0,c=n.length;for(n.sort(t||cc),a=0;c>a;++a)(s=l-(r=n[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+o;if((s=l-o-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=n[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function Ac(e){e.nodes.forEach(function(e){e.sourceLinks.sort(lc),e.targetLinks.sort(ac)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,i=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function Sc(){var e=0,t=0,n=1,o=1,i=24,r=8,s=null,a=vc,l=nc,c=void 0,d=32,u=2,h=bc,g=xc;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return V(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,i=e.target;"object"!=typeof o&&(o=e.source=Fl(n,o)),"object"!=typeof i&&(i=e.target=Fl(n,i)),o.sourceLinks.push(e),i.targetLinks.push(e)})}(h,a),function(e,t){var n=0;if(null==t){for(var o=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;o[s]||(o[s]=[]),o[a]||(o[a]=[]),-1===o[s].indexOf(a)&&o[s].push(a)}var l=$l(o);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var d=l[i].slice(-2);c[d[0]]||(c[d[0]]={}),c[d[0]][d[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:o>n?"top":"bottom","top"==i.circularLinkType?n++:o++,e.nodes.forEach(function(e){Ul(e,t)!=Ul(i.source,t)&&Ul(e,t)!=Ul(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),zl(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(q(e.sourceLinks,Jl),q(e.targetLinks,Jl)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,i,r;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,r):e.column})}(h,c,l);var g=r;if(null!==s){var f=Y(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=G(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*s/(p-1)))}(function(e,t,n){var o=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=z(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/q(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=G(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/r),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,i),kc(h,c,a),wc(h,c,a,g,g,d),Ac(h),fc(h,a,u,10,8),kc(h,c,a),wc(h,c,a,g,g,d),Ac(h),fc(h,a,u,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return Ul(n.source,t)==Ul(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!hc(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=ql(t,e);return e.y1-n}if(t.target.column>e.target.column)return ql(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;o.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,s=0;i>r;r++)s+=o[r].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return Ul(n.target,t)==Ul(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!hc(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Xl(t,e);return e.y0-n}if(t.source.column>e.source.column)return Xl(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;o.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,s=0;i>r;r++)s+=o[r].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,n=e.links,o=!1,i=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==o||0==i){var r=z(t,function(e){return e.y0}),s=G(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-r);function l(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>a?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),fc(h,a,u,10,8)}(f),f}return f.update=function(e){return Ac(e),fc(e,a,u,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:mc(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:mc(e),f):g},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:mc(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:mc(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(d=+e,f):d},f.circularLinkGap=function(e){return arguments.length?(u=+e,f):u},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],n=+i[1][0],o=+i[1][1],f):[[e,t],[n,o]]},f.size=function(i){return arguments.length?(e=t=0,n=+i[0],o=+i[1],f):[n-e,o-t]},f}function Oc(e){const{sx:t,sTop:n,sBot:o,tx:i,tTop:r,tBot:s,cp1X:a,cp2X:l}=e,c=(n+o)/2,d=(r+s)/2;return{pathD:[`M${t},${n}`,`C${a},${n} ${l},${r} ${i},${r}`,`L${i},${s}`,`C${l},${s} ${a},${o} ${t},${o}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:d},{x:i,y:d}],halfWidth:(o-n)/2}}}const Cc=e=>{let t,n,o,i,r,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,s=e.target.x0,a=ie(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${n},${c} ${n},${s}L${o},${s}C${o},${c} ${i},${l} ${i},${r}Z`;const d=e.sankeyWidth/2,u=ie(e.source.x1,e.target.x0),{pathD:h}=Oc({sx:e.source.x1,sTop:e.y0-d,sBot:e.y0+d,tx:e.target.x0,tTop:e.y1-d,tBot:e.y1+d,cp1X:u(.5),cp2X:u(.5)});return h};function _c(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,o=i.sourceY,r=i.targetX,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${o-n}L${t+a},${o-n}L${t+a},${o+n}L${t},${o+n}ZM${r},${s-n}L${r-l},${s-n}L${r-l},${s+n}L${r},${s+n}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,d=i.leftFullExtent,u=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${r},${s-h*n}L${c},${s-h*n}L${c+o},${s-h*n+h*g}L${c+o},${u+h*o-h*g}L${c+o-g},${u+h*o}L${d-o+g},${u+h*o}L${d-o},${u+h*o-h*g}L${d-o},${l-h*n+h*g}L${d-o+g},${l-h*n}L${a},${l-h*n}L${a},${l+h*n}L${d+o},${l+h*n}L${d+o},${u-h*o}L${c-o},${u-h*o}L${c-o},${s+h*n}L${r},${s+h*n}Z`}const jc=new Set,Mc=new WeakMap;function Pc(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=Mc.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,Mc.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;jc.has(e)||(jc.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const Lc={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(tc))-1:0},justify:nc};function Tc(e){return"string"==typeof e?e:e.id}const Nc={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r,s,a,l,c,d;if(0===e.length)return;const u="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(i=n.nodeWidth)&&void 0!==i?i:15,f=null!==(r=n.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(s=n.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===u?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=Sc().extent(v).links(m).nodes(y).nodeAlign(Lc[h]||nc).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,i=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>i&&(i=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const r=o.circularPathData,s=(null!==(l=null!==(a=o._circularWidth)&&void 0!==a?a:o.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),n>r.verticalFullExtent-s&&(n=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-n,d=o[0],u=o[1];if(r>0&&s>0&&(0>e||0>n||t>d||i>u)){const t=Math.min(d/r,u/s),o=-e*t+(d-r*t)/2,i=-n*t+(u-s*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of m)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+i,n.targetY=n.targetY*t+i,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+i,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+i,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+i,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=Tc(e.source),n=Tc(e.target),o=k.get(e._edgeKey?e._edgeKey:`${t}\0${n}`);if(o){o.y0=e.y0,o.y1=e.y1,o.sankeyWidth=null!==(d=e.width)&&void 0!==d?d:0,o.circular=!!e.circular,o.circularPathData=e.circularPathData,o._circularWidth=e._circularWidth,o._circularStub=e._circularStub,o.path=e.path,o.circularLinkType=e.circularLinkType,o.direction=u;const i=x.get(t),r=x.get(n);i&&(o.source=i),r&&(o.target=r)}}},buildScene(e,t,n,o){var i,r,s,a,l,c;const d="vertical"===n.orientation?"down":"right",u=n.nodeStyle,h=n.edgeStyle,g=null!==(i=n.edgeOpacity)&&void 0!==i?i:.5,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:qe,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=[],v=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=u?u(Pc(t,"nodeStyle")):{},i={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),m.push("down"===d?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=n.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(o.id)||y.get(o.id)||i:x.get(t.id)||y.get(t.id)||i;const d=h?h(Pc(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,o=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=d.fill||i;v.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+o},${t.sourceY-n}L${t.sourceX+o},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:s,fillOpacity:null!==(a=d.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+o}}),v.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-r},${t.targetY-n}L${t.targetX-r},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:s,fillOpacity:null!==(l=d.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let u;if(u=e.circular&&e.circularPathData?_c(e):Cc(e),!u)continue;const p={fill:d.fill||i,fillOpacity:null!==(c=d.fillOpacity)&&void 0!==c?c:g,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};v.push({type:"bezier",pathD:u,bezierCache:e.bezier,style:p,datum:e})}if(!1!==n.showLabels){const t=(w=n.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const r=t?t(n):n.id;if(!r)continue;let s,a,l;"down"===d?(s=n.y0+(n.y1-n.y0)/2,a=n.x1+14,l="start"):(o[0]/2>n.x0+e/2?(s=n.x0-6,l="end"):(s=n.x1+6,l="start"),a=n.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===d?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},Bc={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r;if(0===e.length)return;const s=null!==(i=n.forceStrength)&&void 0!==i?i:.1,a=o[0]/2,l=o[1]/2,c=n.__previousPositions;let d=0;const u=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?d++:n?(t.x=n.x,t.y=n.y,d++):u.push(t)}const h=d>0&&.3>=(e.length>0?u.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of u){const o=Ec(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const i=Dc(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/o.length+s*Math.cos(r),e.y=n/o.length+s*Math.sin(r)}else{const t=Dc(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=a+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),i=n*t;o.x=a+e*Math.cos(i),o.y=l+e*Math.sin(i)}}}const g=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=Ic(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=re().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),o=se().force("charge",ae().strength(e=>-25*y(e))).force("center",le(a,l).strength(.8)).force("x",ce(a).strength(.15)).force("y",de(l).strength(.15));if(o.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.links(e),o.force("link",n)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var i,r,s,a,l,c,d;const u=n.nodeStyle,h=n.edgeStyle,g=Ic(n.nodeSize,n.nodeSizeRange,e),f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:qe,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],m=[],v=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Pc(t,"nodeSize")),o=u?u(Pc(t,"nodeStyle")):{},a={fill:o.fill||p.get(t.id)||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=o.strokeWidth)&&void 0!==s?s:2,opacity:o.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),o="object"==typeof e.target?e.target:b.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const i=h?h(Pc(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=n.themeSemantic)||void 0===a?void 0:a.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(d=i.opacity)&&void 0!==d?d:.6};m.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=g(Pc(n,"nodeSize"));v.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function Ec(e,t,n){const o=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let s=null;if(t===e?s=r:r===e&&(s=t),s){const e=n.get(s);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function Dc(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Ic(e,t,n){var o,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],s=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>r[0];const a=null!==(o=z(s))&&void 0!==o?o:0,l=null!==(i=G(s))&&void 0!==i?i:1;if(a===l)return()=>(r[0]+r[1])/2;const c=k().domain([a,l]).range(r).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?r[0]:c(o)}}const Rc=qe,Hc={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:s}=n,a=Math.min(o[0],o[1])/2,l=a-r,c=o[0]/2,d=o[1]/2,u=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const i=u(e);p[n][o]=i}const y=he().padAngle(i);s&&y.sortGroups(s);const m=y(p),v=m.groups,b=H().innerRadius(l).outerRadius(a);for(const t of v){const n=e[t.index],o=b.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});n.x=o[0]+c,n.y=o[1]+d,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,i=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);i&&(i.__chordData=t)}},buildScene(e,t,n,o){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=n,d=Math.min(o[0],o[1])/2,u=d-l,h=o[0]/2,g=o[1]/2,f=n.nodeStyle,p=n.edgeStyle,y=n.edgeColorBy||"source",m=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:Rc,v=new Map;e.forEach((e,t)=>{v.set(e.id,m[t%m.length])});const b=ue().radius(u),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.__arcData;if(!o)continue;let r;r=f?f(Pc(n,"nodeStyle")).fill||v.get(n.id)||m[t%m.length]:v.get(n.id)||m[t%m.length];const s=f?f(Pc(n,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};x.push({type:"arc",cx:h,cy:g,innerR:u,outerR:d,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:a,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const o=b(t);if(!o)continue;const i=Fc(o,h,g);let l=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=n.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(p)l=p(Pc(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?l=v.get(n.id)||l:t&&(l=v.get(t.id)||l)}const d=p?p(Pc(e,"edgeStyle")):{},u={fill:l,fillOpacity:null!==(a=d.fillOpacity)&&void 0!==a?a:c,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};k.push({type:"ribbon",pathD:i,style:u,datum:e})}if(!1!==n.showLabels){const t=(A=n.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,o=d+12;for(const n of e){const e=n.__arcData;if(!e)continue;const i=t?t(n):n.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,s=r-Math.PI/2;w.push({x:h+Math.cos(s)*o,y:g+Math.sin(s)*o,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function Fc(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const i=[];let r=0;for(;o.length>r;){const e=o[r];if("M"===e||"L"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("C"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;3>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("Q"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;2>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("A"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&(i.push(Number(o[r])+t+""),r++),o.length>r&&(i.push(Number(o[r])+n+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(o[r]),r++)}return i.join(" ")}const $c=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Wc(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>150?"#222":"#fff"}function zc(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Yc(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function Gc(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:$c}function qc(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Xc(e,t,n,o,i){if("horizontal"===i){const i=(e+n)/2;return`M ${e},${t} C ${i},${t} ${i},${o} ${n},${o}`}if("radial"===i){const i=(e+n)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+o)/2} T ${n},${o}`}{const i=(t+o)/2;return`M ${e},${t} C ${e},${i} ${n},${i} ${n},${o}`}}const Vc={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var i;const r=n.__hierarchyRoot;if(!r)return;const s=n.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,d=K(r,a);d.sum(c),d.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[u,h]=o;switch(s){case"tree":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=ne();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(d,n,u,h);break;case"cluster":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=te();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(d,n,u,h);break;case"treemap":!function(e,t,n,o){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=J().size([n,o]).tile(ee).padding(s);a>0&&l.paddingTop(a),l(e)}(d,n,u,h);break;case"circlepack":!function(e,t,n,o){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;Q().size([n,o]).padding(r)(e)}(d,n,u,h);break;case"partition":!function(e,t,n,o){var i;Z().size([n,o]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(d,n,u,h)}const g=d.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const o=g[t],r={id:zc(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=o.value)&&void 0!==i?i:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===s||"cluster"===s?Uc(r,o,n):"treemap"===s||"partition"===s?Kc(r,o):"circlepack"===s&&Zc(r,o),r.__hierarchyNode=o,e.push(r),f.set(o,r)}if("tree"===s||"cluster"===s)for(const e of g)if(e.parent){const n=f.get(e.parent),o=f.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const i=n.nodeStyle||(()=>({})),r=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,i,r){var s,a,l,c,d,u,h,g;const f=[],p=[],y=[],m=n.treeOrientation||"vertical",v="radial"===m,b=o[0]/2,x=o[1]/2,k="number"==typeof(w=n.nodeSize)?w:5;var w;for(const t of e){let e=t.x,o=t.y;v&&(e+=b,o+=x);const r=i(Pc(t,"nodeStyle"));let l=r.fill||qc(n);if(n.colorByDepth&&void 0!==t.depth){const e=Gc(n);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:o,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=n.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=t.x,s=t.y,a=o.x,l=o.y;v&&(i+=b,s+=x,a+=b,l+=x);const g=Xc(i,s,a,l,m),f=r(Pc(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=n.themeSemantic)||void 0===c?void 0:c.border)||(null===(d=n.themeSemantic)||void 0===d?void 0:d.secondary)||"#999",strokeWidth:null!==(u=f.strokeWidth)&&void 0!==u?u:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==n.showLabels){const t=Yc(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,i,r,s=n.x,a=n.y;if(v&&(s+=b,a+=x),v){const e=s-b,t=a-x,n=Math.sqrt(e*e+t*t);n>0?(o=s+e/n*10,i=a+t/n*10,r=0>e?"end":"start"):(o=s,i=a-12,r="middle")}else"horizontal"===m?((null===(g=n.data)||void 0===g?void 0:g.children)&&0!==n.data.children.length?(o=s-k-6,r="end"):(o=s+k+6,r="start"),i=a):(o=s,i=a+k+14,r="middle");y.push({x:o,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,n,o,i,r);case"treemap":case"partition":return function(e,t,n,o){var i,r,s,a,l;const c=[],d=[];for(const n of e){const e=n.x1-n.x0,s=n.y1-n.y0;if(0>=e||0>=s)continue;const a=o(Pc(n,"nodeStyle"));let l=a.fill||qc(t);if(t.colorByDepth&&void 0!==n.depth){const e=Gc(t);l=e[n.depth%e.length]}const d={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:n.x0,y:n.y0,w:e,h:s,style:d,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Yc(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,u=c.y1-c.y0;if(0>=e||0>=u)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=n?n(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>u)continue;let f=o(Pc(c,"nodeStyle")).fill||qc(t);if(t.colorByDepth&&void 0!==c.depth){const e=Gc(t);f=e[c.depth%e.length]}const p="string"==typeof f?Wc(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";d.push(h?{x:c.x0+e/2,y:c.y0+u/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,u)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:d}}(e,n,0,i);case"circlepack":return function(e,t,n,o){var i,r,s,a,l,c,d,u,h,g;const f=[],p=[];for(const n of e){const e=null!==(i=n.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=o(Pc(n,"nodeStyle"));let c=l.fill||qc(t);if(t.colorByDepth&&void 0!==n.depth){const e=Gc(t);c=e[n.depth%e.length]}const d={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.7};f.push({type:"circle",cx:n.x,cy:n.y,r:e,style:d,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Yc(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=n?n(i):i.id;if(!r)continue;if(15>e)continue;const s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=o(Pc(i,"nodeStyle")).fill||qc(t);if(t.colorByDepth&&void 0!==i.depth){const e=Gc(t);a=e[i.depth%e.length]}if(s){const n="string"==typeof a?Wc(a):null!==(u=null===(d=t.themeSemantic)||void 0===d?void 0:d.text)&&void 0!==u?u:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:n})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,n,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Uc(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Kc(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Zc(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Qc(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Jc={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const i=n.__hierarchyRoot;i&&function(e,t,n,o,i){var r,s;const a=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),d=null!==(r=n.orbitSize)&&void 0!==r?r:2.95,u=null!==(s=n.orbitEccentricity)&&void 0!==s?s:1,h="number"==typeof d?()=>d:d,g="number"==typeof u?()=>u:u,f=Qc(n);f.metaMap.clear(),o.length=0,i.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,r,s,d,u,p){const m=a(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:u,data:t,parentId:n},O=p?d/h(S)*A:d*A,C=F().value(e=>{var t;return(null===(t=a(e))||void 0===t?void 0:t.length)?4:1}).sort(null),_=C(k),j=g(S);for(let t=0;k.length>t;t++){const a=(_[t].startAngle+_[t].endAngle)/2,c=k[t],d=y(l(c)),h=r+O*Math.sin(a),g=s+O*Math.cos(a)*j;o.push({id:d,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:u,data:c}),f.metaMap.set(d,{ring:O,angle:a,depth:u,parentId:n,eccentricity:j}),i.push({source:n,target:d,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:d}}),e(c,d,h,g,O,u+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(i,o,n,e,t)},buildScene(e,t,n,o){var i,r,s,a,l,c,d;const u=n.nodeStyle,h=n.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==n.orbitShowRings){const t=Qc(n),o=new Map;for(const t of e)o.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;i.has(n)||i.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of i)for(let i=0;r>i;i++){const a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+n*Math.sin(a),y1:t+n*Math.cos(a)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Pc(t,"nodeSize")),o=u?u(Pc(t,"nodeStyle")):{},c={fill:o.fill||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=o.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:m.get(e.source),n="object"==typeof e.target?e.target:m.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=g(Pc(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(d=null===(c=n.data)||void 0===c?void 0:c[t])&&void 0!==d?d:n.id;y.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,n,o,i)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const i=Qc(t),r=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,s=null!==(o=t.orbitRevolution)&&void 0!==o?o:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+a*l*s({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},ed={sankey:Nc,force:Bc,chord:Hc,tree:Vc,cluster:Vc,treemap:Vc,circlepack:Vc,partition:Vc,orbit:Jc};function td(e){return ed[e]}class nd{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},El),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Il(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},El),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new Il(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:s="value"}=this.config,a="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],d="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},od(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",i=c(n)+"",r=d(n),s=null==r?NaN:Number(r),a=Number.isFinite(s)?s:1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},od(o)),{data:n})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},od(i)),{data:n}));const u=`${o}\0${i}\0${e}`,h={source:o,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:u};n&&"object"==typeof n&&id(n.bezier)&&(h.bezier=n.bezier),this.edges.set(u,h)}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,i=0===this.nodes.size;let r=!1;const s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,od(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(n)||(this.nodes.set(n,od(n)),this.nodeTimestamps.set(n,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,n),l=this.edges.get(a);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,i,r,s,a,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=td(this.config.chartType);if(!c)return;let d=Array.from(this.nodes.values());const u=Array.from(this.edges.values());if(0===d.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of d)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(n=a._prevX0)&&void 0!==n?n:0),c=(null!==(o=a._prevY1)&&void 0!==o?o:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(d,u,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&d.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of d)this.nodes.set(e.id,e);for(let e=0;u.length>e;e++){const t=u[e],n=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=n,this.edges.set(n,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const n=e.get(t.id);n&&(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,d=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=d.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&d.length>0&&f>0){const t=e[0]/2,n=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=n,e._prevY1=n;for(const e of this.edges.values())e._prevY0=n,e._prevY1=n,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}buildScene(e){var t,n,o,i,r,s;const a=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=ka(this.config.colorScheme,this.config.themeCategorical,qe),d={nodes:a,edges:l,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...c]},resolveColor:wa(c),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{}};let u;try{u=this.config.customNetworkLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(o=u.sceneNodes)&&void 0!==o?o:[],this.sceneEdges=null!==(i=u.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=u.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(s=u.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const c=td(this.config.chartType);if(!c)return;const{sceneNodes:d,sceneEdges:u,labels:h}=c.buildScene(a,l,this.config,e);this.sceneNodes=d,this.sceneEdges=u,this.labels=h}get isAnimating(){const e=td(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=td(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=Array.from(this.nodes.values()),i=Array.from(this.edges.values());return n.tick(o,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=At(e,this.transition),n=wt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,n),e.x1=St(e._prevX1,e._targetX1,n),e.y0=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=null==e?void 0:e.get(t.id);n&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const n=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(n){e._prevY0=n.y0,e._prevY1=n.y1,e._prevSankeyWidth=n.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=n.x0,s=ie(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:o}}const i=t.x1,r=n.x0,s=ie(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const i=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],r=n.x-t.x,s=n.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},n])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,i,r;const s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(n=s.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=s.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const i=e-o;a>i&&(t._pulseIntensity=1-i/a,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(i=n.source)||void 0===i?void 0:i.id:n.source,s="object"==typeof n.target?null===(r=n.target)||void 0===r?void 0:r.id:n.target;if(!o||!s)continue;const c=this.edgeTimestamps.get(`${o}\0${s}`);if(!c)continue;const d=e-c;a>d&&(t._pulseIntensity=1-d/a,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const i=this._decaySortedNodes,r=new Map;for(let e=0;i.length>e;e++)r.set(i[e][0],e);for(const i of this.sceneNodes){const s=i.id;if(!s)continue;const a=r.get(s);if(void 0===a)continue;const l=xt(n,a,o),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const i=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",s=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const a=this.nodes.get(n);if(!a)continue;const l=o.metric(a);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const i=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,i}updateEdge(e,t,n){var o;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=n(null!==(o=i.data)&&void 0!==o?o:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&this.layoutVersion++,s}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const n=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const o="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&o(i.data)===e&&n.push(t)}else for(const[o,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&this.layoutVersion++,n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function od(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function id(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!rd(e))return!1;return!0}return rd(t.points)}function rd(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function sd(e,t,n,o,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=ad(t,n,o,i);if(e)if("rect"===t.type){const n=t.w*t.h;a>n&&(r=e,a=n)}else s>e.distance&&(r=e,s=e.distance)}if(r)return r;for(const e of t){if(!1===e.interactive)continue;const t=hd(e,n,o);t&&s>t.distance&&(r=t,s=t.distance)}return r}function ad(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const i=t-e.cx,r=n-e.cy,s=Math.sqrt(i*i+r*r);return s>zt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,n,o);case"rect":return function(e,t,n){const o=Wt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const s=qt(Math.atan2(i,o)),a=qt(e.startAngle),l=qt(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}let ld=null,cd=null;function dd(){return cd||(ld=document.createElement("canvas"),ld.width=1,ld.height=1,cd=ld.getContext("2d")),cd}function ud(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function hd(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const o=ud(e),i=dd();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(o,t,n);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,i=e.y2-e.y1,r=o*o+i*i;if(0===r)return null;let s=((t-e.x1)*o+(n-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*o,l=e.y1+s*i,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=ud(e),i=dd();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(o,t,n);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function gd(i){const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,labels:d,title:u,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:m="right",legendLayout:v,foregroundGraphics:b,sceneNodes:x,annotations:k,svgAnnotationRules:w}=i;return t(n,{children:[t("svg",{role:"img",width:a,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof u?u:"Network Chart"}),e("desc",{children:"string"==typeof u?u+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[d.map((t,n)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+n)),k&&k.filter(e=>"widget"!==e.type).map((t,n)=>{if(w){const i=w(t,n,{width:r,height:s,sceneNodes:x});if(i)return e(o.Fragment,{children:i},"annotation-"+n)}return null}),b]}),u&&"string"==typeof u?e("text",{x:a/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:u}):u?e("foreignObject",{x:0,y:0,width:a,height:c.top,children:u}):null,Dn({legend:h,totalWidth:a,totalHeight:l,margin:c,legendPosition:m,title:u,legendLayout:v,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==k?void 0:k.filter(e=>"widget"===e.type&&e.nodeId&&x).map((t,n)=>{var o,i,r,s,a,l,d,u,h;const g=x.find(e=>{var n,o,i,r,s;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(i=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!g)return null;const f=c.left+(null!==(o=g.cx)&&void 0!==o?o:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(i=g.x)&&void 0!==i?i:0),p=c.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),y=null!==(a=t.dx)&&void 0!==a?a:0,m=null!==(l=t.dy)&&void 0!==l?l:-16,v=null!==(d=t.width)&&void 0!==d?d:32,b=null!==(u=t.height)&&void 0!==u?u:32,k=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{style:{position:"absolute",left:f+y-v/2,top:p+m-b/2,width:v,height:b,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+n)})]})}function fd(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function pd(e,t){var n,o,i,r,s,a;if(!t.pathD)return;e.save();const l=fd(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=tn(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function yd(e,t){var n,o;e.save();const i=t.style.stroke||"#999";e.strokeStyle=tn(e,i)||i,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function md(e,t){var n,o,i,r;if(!t.pathD)return;e.save();const s=fd(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function vd(e,t){var n,o;if(!t.pathD)return;e.save();const i=fd(t),r=t.style.stroke||"#999";e.strokeStyle=tn(e,r)||r,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(i)),e.restore()}gd.displayName="NetworkSVGOverlay";const bd={top:20,right:80,bottom:20,left:80},xd={top:40,right:40,bottom:40,left:40},kd=new Set(["chord","force","circlepack","orbit"]),wd=[800,600],Ad={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Sd({data:n}){var o,i,r,s,a,l;if("edge"===n.nodeOrEdge){const e=n.data;return e?t("div",{className:"semiotic-tooltip",style:Ad,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=n.data;if(!c)return null;const d=c.__hierarchyNode;if(d){const n=[];let a=d;for(;a;){const e=null!==(s=null!==(i=null===(o=a.data)||void 0===o?void 0:o.name)&&void 0!==i?i:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==s?s:c.id;null!=e&&n.unshift(e+""),a=a.parent}n.length>1&&n.shift();const l=n.length-1;return t("div",{className:"semiotic-tooltip",style:Ad,children:[e("div",{children:n.map((n,o)=>t("span",{children:[o>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===l?e("strong",{children:n}):e("span",{style:{opacity:.7},children:n})]},o))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const u=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:Ad,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),u>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",u,h!==u&&` (weighted: ${h.toLocaleString()})`]})]})}Sd.ownsChrome=!0;const Od=g(function(n,o){var a,c,d,h,g,f,y,m,v,b,x,k,w,A,S,O,C,_;const{chartType:j,nodes:M,edges:P,data:L,initialEdges:T,nodeIDAccessor:N="id",sourceAccessor:B="source",targetAccessor:E="target",valueAccessor:D="value",edgeIdAccessor:I,childrenAccessor:R,hierarchySum:F,orientation:$="horizontal",nodeAlign:W="justify",nodePaddingRatio:z=.05,nodeWidth:Y=15,iterations:G=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:V=20,sortGroups:U,edgeSort:K,treeOrientation:Z="vertical",edgeType:Q="curve",padding:J,paddingTop:ee,tensionConfig:te,showParticles:ne=!1,particleStyle:oe,nodeStyle:ie,edgeStyle:re,colorBy:se,colorScheme:ae="category10",edgeColorBy:le="source",edgeOpacity:ce=.5,colorByDepth:de=!1,nodeSize:ue=8,nodeSizeRange:he=[5,20],nodeLabel:ge,showLabels:pe=!0,labelMode:ye,size:me=wd,responsiveWidth:ve,responsiveHeight:be,margin:xe,className:we,background:Ae,enableHover:Se=!0,tooltipContent:Oe,customHoverBehavior:Ce,customClickBehavior:_e,onObservation:je,chartId:Me,onTopologyChange:Pe,annotations:Le,svgAnnotationRules:Te,legend:Ne,legendPosition:Be,legendLayout:Ee,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Re,legendIsolatedCategories:He,title:Fe,foregroundGraphics:$e,backgroundGraphics:We,decay:ze,pulse:Ye,transition:Ge,animate:qe,staleness:Xe,thresholds:Ve,accessibleTable:Ue=!0,description:Ke,summary:Ze,orbitMode:Qe,orbitSize:Je,orbitSpeed:et,orbitRevolution:tt,orbitRevolutionStyle:nt,orbitEccentricity:ot,orbitShowRings:it,orbitAnimated:rt,customNetworkLayout:st,layoutConfig:at}=n,lt=kd.has(j)?xd:bd,ct=i(!0),dt=Si({sizeProp:me,responsiveWidth:ve,responsiveHeight:be,userMargin:xe,marginDefault:lt,foregroundGraphics:$e,backgroundGraphics:We,animate:qe,transitionProp:Ge,themeDirtyRef:ct}),{reducedMotionRef:ut,responsiveRef:ht,size:ft,margin:pt,adjustedWidth:yt,adjustedHeight:mt,resolvedForeground:vt,resolvedBackground:bt,transition:xt,introEnabled:kt,tableId:wt,rafRef:At,renderFnRef:St,scheduleRender:Ot,currentTheme:Ct}=dt,_t=Mo(),jt=No(),Mt=r(()=>fe(M),[M]),Pt=r(()=>Array.isArray(P)?fe(P):P,[P]),Lt=r(()=>Object.assign(Object.assign({},El),te),[te]),Tt=r(()=>Object.assign(Object.assign({},Dl),oe),[oe]),Nt=r(()=>{var e;return{chartType:j,nodeIDAccessor:N,sourceAccessor:B,targetAccessor:E,valueAccessor:D,edgeIdAccessor:I,childrenAccessor:R,hierarchySum:F,orientation:$,nodeAlign:W,nodePaddingRatio:z,nodeWidth:Y,iterations:G,forceStrength:q,padAngle:X,groupWidth:V,sortGroups:U,edgeSort:K,treeOrientation:Z,edgeType:Q,padding:J,paddingTop:ee,tensionConfig:Lt,showParticles:ne,particleStyle:Tt,nodeStyle:ie,edgeStyle:re,nodeLabel:ge,showLabels:pe,labelMode:ye,colorBy:se,colorScheme:ae,themeCategorical:null===(e=null==Ct?void 0:Ct.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Ct),edgeColorBy:le,edgeOpacity:ce,colorByDepth:de,nodeSize:ue,nodeSizeRange:he,decay:ze,pulse:Ye,transition:xt,introAnimation:kt,staleness:Xe,thresholds:Ve,orbitMode:Qe,orbitSize:Je,orbitSpeed:et,orbitRevolution:tt,orbitRevolutionStyle:nt,orbitEccentricity:ot,orbitShowRings:it,orbitAnimated:rt,customNetworkLayout:st,layoutConfig:at}},[j,N,B,E,D,R,F,$,W,z,Y,G,q,X,V,U,K,Z,Q,J,ee,Lt,ne,Tt,ie,re,ge,pe,ye,se,ae,le,ce,de,ue,he,ze,Ye,null==xt?void 0:xt.duration,null==xt?void 0:xt.easing,kt,Xe,Ve,Qe,Je,et,tt,nt,ot,it,rt,Ct,st,at]),Bt=Eo(Nt),Et=i(null),Dt=i(0),It=i(0),Rt=i(!1),Ht=i(null);Ht.current||(Ht.current=new nd(Bt));const[Ft,Wt]=u(null),[zt,Yt]=u(0),[Gt,qt]=u(0),[Xt,Vt]=u(!1),[Ut,Kt]=u(null),Zt=i(null),Qt=i(new Map),Jt=i(0),en=l(e=>{if("function"==typeof se)return se(e)+"";if("string"==typeof se&&e.data){const t=e.data[se];if(void 0!==t){if(!Qt.current.has(t+"")){const e=Array.isArray(ae)?ae:gt;Qt.current.set(t+"",e[Jt.current++%e.length])}return Qt.current.get(t+"")}}if(Qt.current.has(e.id))return Qt.current.get(e.id);const t=Array.isArray(ae)?ae:gt,n=se?t[Jt.current++%t.length]:t[0];return Qt.current.set(e.id,n),n},[se,ae]),nn=(null===(a=null==Ct?void 0:Ct.colors)||void 0===a?void 0:a.border)||(null===(c=null==Ct?void 0:Ct.colors)||void 0===c?void 0:c.secondary)||(null===(d=null==Ct?void 0:Ct.colors)||void 0===d?void 0:d.primary)||"#999",on=l(e=>{var t,n;return e?"object"==typeof e?e:null!==(n=null===(t=Ht.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==n?n:null:null},[]),rn=l(e=>{if("function"==typeof le)return le(e);const t=on(e.source),n=on(e.target);return"target"===le&&n?en(n):t?en(t):nn},[le,en,nn,on]),sn=l(e=>{if("function"==typeof Tt.color){const t=on(e.source);return t?Tt.color(e,t):nn}if(!(null==oe?void 0:oe.colorBy))return rn(e);const t=Tt.colorBy,n=on(e.source),o=on(e.target);return"target"===t&&o?en(o):n?en(n):nn},[null==oe?void 0:oe.colorBy,Tt.color,Tt.colorBy,en,rn,nn,on]),an=("sankey"===j||!!st)&&ne||!!Ye||null!==(g=null===(h=Ht.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;s(()=>{var e;null===(e=Ht.current)||void 0===e||e.updateConfig(Bt),ct.current=!0,Ot()},[Bt,Ot]);const ln=l(()=>{var e,t;Kt(null!==(t=null===(e=Ht.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);s(()=>{var e;const t=Ht.current;if(t){t.buildScene([yt,mt]),ln();for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&Qt.current.set(n.id,n.style.fill);ct.current=!0,Ot()}},[Ct,yt,mt,Ot,ln]);const cn=l(()=>{var e;const t=Ht.current;if(!t)return;t.runLayout([yt,mt]),t.buildScene([yt,mt]),ln(),ct.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&Qt.current.set(n.id,n.style.fill);const n=Array.isArray(ae)?ae:gt,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];Qt.current.has(t.id)||Qt.current.set(t.id,n[e%n.length])}if(Jt.current=o.length,Yt(t.layoutVersion),Pe){const{nodes:e,edges:n}=t.getLayoutData();Pe(e,n)}},[yt,mt,Pe,ae,ln]),dn=l(e=>{if(null==e||"object"!=typeof e)return;const t=Ht.current;t&&(t.ingestEdge(e)&&cn(),Ot())},[cn,Ot]),un=l(e=>{const t=Ht.current;if(!t)return;let n=!1;for(const o of e)null!=o&&"object"==typeof o&&t.ingestEdge(o)&&(n=!0);n&&cn(),Ot()},[cn,Ot]),hn=l(()=>{var e;null===(e=Ht.current)||void 0===e||e.clear(),Qt.current.clear(),Jt.current=0,Yt(0),Wt(null),Zt.current=null,ct.current=!0,Ot()},[Ot]),gn=l(()=>{const e=Ht.current;e&&(e.tension+=999,cn(),Ot())},[cn,Ot]);p(o,()=>({push:dn,pushMany:un,removeNode:e=>{var t,n,o;const i=null!==(n=null===(t=Ht.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(i){const t=(null===(o=Zt.current)||void 0===o?void 0:o.data)?"function"==typeof N?N(Zt.current.data):Zt.current.data[N]:void 0;Zt.current&&"node"===Zt.current.nodeOrEdge&&t===e&&(Zt.current=null,Wt(null)),Qt.current.delete(e),cn(),ct.current=!0,Ot()}return i},removeEdge:(e,t)=>{var n,o;const i=null!==(o=null===(n=Ht.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(i){if(Zt.current&&"edge"===Zt.current.nodeOrEdge){const n=Zt.current.data;let o;o=void 0!==t?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===e&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===t:!I||!n||("function"==typeof I?I:e=>null==e?void 0:e[I])(n)===e,o&&(Zt.current=null,Wt(null))}cn(),ct.current=!0,Ot()}return i},updateNode:(e,t)=>{var n,o;const i=null!==(o=null===(n=Ht.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return i&&(ct.current=!0,Ot()),i},updateEdge:(e,t,n)=>{var o,i;const r=null!==(i=null===(o=Ht.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==i?i:[];return r.length>0&&(cn(),ct.current=!0,Ot()),r},clear:hn,getTopology:()=>{var e,t;return null!==(t=null===(e=Ht.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Ht.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:gn,getTension:()=>{var e,t;return null!==(t=null===(e=Ht.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[dn,un,hn,gn,cn,Ot]);const fn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(j),pn=fn?L||(Array.isArray(P)?void 0:P):void 0;s(()=>{var e;const t=Ht.current;if(t)if(fn&&pn)t.ingestHierarchy(pn,[yt,mt]),t.buildScene([yt,mt]),ln(),ct.current=!0,Ot();else{const n=Mt,o=Array.isArray(Pt)?Pt:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[yt,mt]),t.buildScene([yt,mt]),ln();for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&Qt.current.set(n.id,n.style.fill+"");const i=Array.isArray(ae)?ae:gt,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];Qt.current.has(t.id)||Qt.current.set(t.id,i[e%i.length])}Jt.current=r.length,ct.current=!0,Ot()}},[Mt,Pt,L,pn,fn,yt,mt,Bt,Ot,ae,ln]),s(()=>{T&&T.length>0&&un(T)},[]);const yn=l(e=>{if(Ce&&Ce(e),je){const t=Date.now();je(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Me}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Me})}},[Ce,je,Me]),mn=l(e=>{if(_e&&_e(e),je){const t=Date.now();je(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Me}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Me})}},[_e,je,Me]),{hoverHandlerRef:vn,hoverLeaveRef:bn,onPointerMove:An,onPointerLeave:On}=dt;vn.current=e=>{if(!Se)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pt.left,i=e.clientY-n.top-pt.top;if(0>o||o>yt||0>i||i>mt)return void(Zt.current&&(Zt.current=null,Wt(null),yn&&(yn(null),ct.current=!0),Ot()));const r=Ht.current;if(!r)return;const s=sd(r.sceneNodes,r.sceneEdges,o,i);if(!s)return void(Zt.current&&(Zt.current=null,Wt(null),yn&&(yn(null),ct.current=!0),Ot()));const a=ui(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Zt.current=a,Wt(a),yn&&(yn(a),ct.current=!0),Ot()},bn.current=()=>{Zt.current&&(Zt.current=null,Wt(null),yn&&(yn(null),ct.current=!0),Ot())};const _n=i(()=>{});_n.current=e=>{if(!_e&&!je)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pt.left,i=e.clientY-n.top-pt.top;if(0>o||o>yt||0>i||i>mt)return;const r=Ht.current;if(!r)return;const s=sd(r.sceneNodes,r.sceneEdges,o,i);mn(s?ui(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const jn=l(e=>_n.current(e),[]),Mn=i(-1),Pn=i(null),Ln=i(-1),Tn=l(e=>{var t;const n=Ht.current;if(!n)return;const o=function(e){var t,n,o,i,r,s;const a=[];for(const l of e)if("circle"===l.type&&null!=l.cx){if(0>=l.r)continue;a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"})}else if("rect"===l.type&&null!=l.x){if(0>=l.w||0>=l.h)continue;a.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==i?i:"_default"})}else"arc"===l.type&&null!=l.cx&&a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(s=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});return a.sort((e,t)=>e.x-t.x||e.y-t.y),a}(n.sceneNodes);if(0===o.length)return;const i=xn(o),r=Mn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Mn.current=0,Ln.current=-1;const t=i.flat[0];Pn.current={shape:t.shape,w:t.w,h:t.h};const n=ui(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Zt.current=n,Wt(n),yn&&(yn(n),ct.current=!0),void Ot()}const s=kn(i,r),a=function(e,t,n,o,i){var r,s,a;const l=n.flat[t.flatIndex];if(!l)return wn(e,t,n);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(s=function(e,t,n){let o=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(n){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const d=a*a+l*l;i>d&&(i=d,o=r)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s:t.flatIndex;return o!==t.flatIndex&&(i.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n;const o=e+"",i=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,r=Sn(t.source),s=Sn(t.target),a=null!=r,l=null!=s;a&&r+""===o&&l?i.push(s+""):l&&s+""===o&&a&&i.push(r+"")}return i}(c,o);if(0===e.length)return t.flatIndex;const r=null!==(a=n.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const o=wn(e,t,n);return null!==o&&o!==t.flatIndex&&(i.current=-1),o}}}(e.key,s,i,null!==(t=n.sceneEdges)&&void 0!==t?t:[],Ln);if(null===a)return;if(e.preventDefault(),0>a)return Mn.current=-1,Pn.current=null,Ln.current=-1,Zt.current=null,Wt(null),yn&&(yn(null),ct.current=!0),void Ot();Mn.current=a;const l=i.flat[a];Pn.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Zt.current=c,Wt(c),yn&&(yn(c),ct.current=!0),Ot()},[yn,Ot]),Nn=l(e=>{Mn.current=-1,Pn.current=null,An(e)},[An]);St.current=()=>{var e,t,n,o,i,r,s;At.current=0;const a=Et.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=Ht.current;if(!c)return;const d=performance.now(),u=Dt.current?Math.min((d-Dt.current)/1e3,.1):.016;Dt.current=d;const h=c.advanceTransition(ut.current?d+1e6:d),g=!ut.current&&h,f=!ut.current&&c.tickAnimation([yt,mt],u);(h||ct.current||f)&&c.buildScene([yt,mt]);const p=Ci();if(!Oi(a,ft,pt,p))return;if(l.clearRect(-pt.left,-pt.top,ft[0],ft[1]),Ae){const e=tn(l,Ae);e&&(l.fillStyle=e,l.fillRect(0,0,yt,mt))}ze&&c.applyDecay(),Ye&&c.applyPulse(d),Ve&&c.applyThresholds(d),c.applyTopologyDiff(d);const y=null!==(e=null==Xe?void 0:Xe.threshold)&&void 0!==e?e:5e3,m=Xe&&c.lastIngestTime>0&&d-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Xe?void 0:Xe.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":pd(e,n);break;case"line":yd(e,n);break;case"ribbon":md(e,n);break;case"curved":vd(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),Li(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),Ti(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),ne&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,n,o){var i,r;const s=null!==(i=o.spawnRate)&&void 0!==i?i:Dl.spawnRate,a=null!==(r=o.maxPerEdge)&&void 0!==r?r:Dl.maxPerEdge;for(let o=0;t.length>o;o++){const i=t[o];if(!i.bezier)continue;if(e.countForEdge(o)>=a)continue;const r=i.value*s*n*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let d=l;Math.random()<c&&d++;for(let t=0;d>t&&e.countForEdge(o)<a;t++)e.spawn(o)}}(c.particlePool,e,u,Tt);const t=.5*(null!==(n=Tt.speedMultiplier)&&void 0!==n?n:1);let o;if(Tt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(u,t,e,o),function(e,t,n,o,i){var r,s;const a=null!==(r=o.radius)&&void 0!==r?r:Dl.radius,l=null!==(s=o.opacity)&&void 0!==s?s:Dl.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=n[s.edgeIndex];if(!l)continue;let c;c="string"==typeof o.color&&"inherit"!==o.color?o.color:i(l),e.fillStyle=tn(e,c)||c,e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,Tt,sn)}}m&&(l.globalAlpha=1);const v=ct.current;if(ct.current=!1,v||g||f){const e=Et.current;e&&e.setAttribute("aria-label",Yo(null!==(i=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}const b=v||g||f||Rt.current;b&&d-It.current>=33?(qt(e=>e+1),It.current=d,Rt.current=!1):Rt.current=!!b,(an||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Rt.current)&&(At.current=requestAnimationFrame(()=>St.current()))},Bo({hydrated:_t,wasHydratingFromSSR:jt,storeRef:Ht,dirtyRef:ct,renderFnRef:St}),s(()=>{ct.current=!0,Ot()},[j,yt,mt,Ae,Ot]),Cn(Xe,Ht,ct,Ot,Xt,Vt);const Bn=Se&&Ft?e(bi,{x:Ft.x,y:Ft.y,containerWidth:yt,containerHeight:mt,margin:pt,className:"stream-network-tooltip",zIndex:2,children:Oe?Oe(Ft):e(Sd,{data:Ft})}):null;if(_o||!_t&&jt){const n=Ht.current;if(n){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(j),t=e?L||(Array.isArray(P)?void 0:P):void 0;if(e&&t)n.ingestHierarchy(t,[yt,mt]),n.buildScene([yt,mt]);else{const e=Mt,t=Array.isArray(Pt)?Pt:[];(e.length>0||t.length>0)&&(n.ingestBounded(e,t,[yt,mt]),n.buildScene([yt,mt]))}}const o=null!==(f=null==n?void 0:n.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==n?void 0:n.sceneEdges)&&void 0!==y?y:[],r=null!==(m=null==n?void 0:n.labels)&&void 0!==m?m:[];return t("div",{ref:ht,className:"stream-network-frame"+(we?" "+we:""),role:"img","aria-label":Ke||("string"==typeof Fe?Fe:"Network chart"),style:{position:"relative",width:ve?"100%":ft[0],height:be?"100%":ft[1]},children:[e(ri,{summary:Ze}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ft[0],height:ft[1],style:{position:"absolute",left:0,top:0},children:[bt&&e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt}),t("g",{transform:`translate(${pt.left},${pt.top})`,children:[Ae&&e("rect",{x:0,y:0,width:yt,height:mt,fill:Ae}),i.map((t,n)=>function(t,n){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+n);case"bezier":{const o=t;return e("path",{d:o.pathD,fill:Oo(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"ribbon":{const o=t;return e("path",{d:o.pathD,fill:Oo(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"curved":{const o=t;return e("path",{d:o.pathD,fill:Oo(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+n)}default:return null}}(t,n)).filter(Boolean),o.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:Oo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+n)}case"rect":{const o=t;return e("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Oo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+n)}case"arc":{const o=t,i=H().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(So)||"";return e("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:Oo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+n)}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+n)}(t,n)).filter(Boolean)]})]}),e(gd,{width:yt,height:mt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,labels:r,sceneNodes:o,title:Fe,legend:Ne,legendPosition:Be,legendLayout:Ee,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Re,legendIsolatedCategories:He,foregroundGraphics:$t(vt,null===(v=Ht.current)||void 0===v?void 0:v.customLayoutOverlays),annotations:Le,svgAnnotationRules:Te,annotationFrame:0})]})}const En=Ht.current;return t("div",{ref:ht,className:"stream-network-frame"+(we?" "+we:""),role:"group","aria-label":Ke||("string"==typeof Fe?Fe:"Network chart"),tabIndex:0,style:{position:"relative",width:ve?"100%":ft[0],height:be?"100%":ft[1],overflow:"visible"},onKeyDown:Tn,children:[Ue&&e(si,{tableId:wt}),Ue&&e(ii,{nodes:null!==(b=null==En?void 0:En.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==En?void 0:En.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:wt,chartTitle:"string"==typeof Fe?Fe:void 0}),e(ri,{summary:Ze}),t("div",{role:"img","aria-label":Ke||("string"==typeof Fe?Fe:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?Nn:void 0,onMouseLeave:Se?On:void 0,onClick:_e||je?jn:void 0,children:[bt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ft[0],height:ft[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt})}),e("canvas",{ref:Et,"aria-label":Yo(null!==(w=null===(k=null==En?void 0:En.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==En?void 0:En.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(ai,{hoverPoint:Ft}),e(gd,{width:yt,height:mt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,labels:(null==En?void 0:En.labels)||[],sceneNodes:null==En?void 0:En.sceneNodes,title:Fe,legend:Ne,legendPosition:Be,legendLayout:Ee,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Re,legendIsolatedCategories:He,foregroundGraphics:$t(vt,Ut),annotations:Le,svgAnnotationRules:Te,annotationFrame:Gt}),e(ci,{active:Mn.current>=0,hoverPoint:Ft,margin:pt,size:ft,shape:null===(O=Pn.current)||void 0===O?void 0:O.shape,width:null===(C=Pn.current)||void 0===C?void 0:C.w,height:null===(_=Pn.current)||void 0===_?void 0:_.h}),Bn,(null==Xe?void 0:Xe.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Xe.badgePosition?{top:4,left:4}:"bottom-left"===Xe.badgePosition?{bottom:4,left:4}:"bottom-right"===Xe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Xt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Xt?"STALE":"LIVE"})]})]})});function Cd(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(o)};return o(e),n}function _d(e,t,n,o){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],r="function"==typeof o?o(e):e[o];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function jd(e){return"function"==typeof e?e:t=>t[e]||1}function Md({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=mt(e.data||e,t,n):e&&(a.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=mt(e.data||e,t,n):e&&(a.fill=o(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function Pd(e){const{nodes:t,edges:n,inferNodes:o=!0,sourceAccessor:i="source",targetAccessor:s="target",colorBy:a,colorScheme:l,showLegend:c,legendPosition:d,legendInteraction:u,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:k,loading:w,loadingContent:A,emptyContent:S,emptyDataKey:O="edges"}=e,C=r(()=>fe(n),[n]),_=r(()=>fe(t),[t]),j=ys(w,x,k,A),M=j?null:ps("nodes"===O?void 0===t?void 0:_:void 0===n?void 0:C,x,k,S),P=r(()=>o?_d(_,C,i,s):_,[o,_,C,i,s]),L=qr(P,a,l),T=Yr(),N=r(()=>{if(Array.isArray(l))return l;if(T&&T.length>0)return T;if("string"==typeof l){const e=ht[l];if(Array.isArray(e)&&e.length>0)return e}return gt},[l,T]),B=r(()=>{if(!a)return[];const e=new Set;for(const t of P){const n="function"==typeof a?a(t):t[a];null!=n&&e.add(n+"")}return Array.from(e)},[P,a]),E=Zr(u,a,B),{legend:D,margin:I,legendPosition:R}=Kr({data:P,colorBy:a,colorScale:L,showLegend:c,legendPosition:d,userMargin:b,defaults:v,categories:B}),H=Vr({selection:h,linkedHover:g,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:F,customClickBehavior:$,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y}=H;return{safeNodes:P,safeEdges:C,colorScale:L,effectivePalette:N,themeCategorical:T,allCategories:B,legendState:E,legend:D,margin:I,legendPosition:R,customHoverBehavior:F,customClickBehavior:$,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y,loadingEl:j,emptyEl:M}}Od.displayName="StreamNetworkFrame";const Ld=g(function(t,n){var o;const s=i(null);Ms(n,{variant:"network",frameRef:s});const a=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:u,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:C,frameProps:_={},onObservation:j,onClick:M,chartId:P,selection:L,linkedHover:T,loading:N,loadingContent:B,emptyContent:E,legendInteraction:D,legendPosition:I,stroke:R,strokeWidth:H,opacity:F}=t,$=null!==(o=null!=h?h:g)&&void 0!==o?o:"id",{width:W,height:z,enableHover:Y,showLegend:G,showLabels:q=!1,title:X,description:V,summary:U,accessibleTable:K}=a,Z=Pd({nodes:l,edges:c,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:m,colorScheme:v,showLegend:G,legendPosition:I,legendInteraction:D,selection:L,linkedHover:T,onObservation:j,onClick:M,chartType:"ForceDirectedGraph",chartId:P,marginDefaults:a.marginDefaults,userMargin:d,width:W,height:z,loading:N,loadingContent:B,emptyContent:E,emptyDataKey:"nodes"}),Q=r(()=>new Map,[]),J=r(()=>e=>{const t={};return t.fill=m?mt(e.data||e,m,Z.colorScale):Gr(void 0,Z.themeCategorical,v,void 0,Q),"number"==typeof b&&(t.r=b),t},[m,Z.colorScale,b,Z.themeCategorical,v,Q]),ee=r(()=>_s(J,{stroke:R,strokeWidth:H,opacity:F}),[J,R,H,F]),te=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),ne=r(()=>_s(te,{stroke:R,strokeWidth:H,opacity:F}),[te,R,H,F]),oe=r(()=>{if(q&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[q,y]),ie=Ss({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:$}});return ie?e(ls,{componentName:"ForceDirectedGraph",message:ie,width:W,height:z}):Z.loadingEl?Z.loadingEl:Z.emptyEl?Z.emptyEl:e(hs,{componentName:"ForceDirectedGraph",width:W,height:z,children:e(Od,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:Z.safeNodes},null!=c&&{edges:Z.safeEdges},{size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,nodeIDAccessor:$,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ee,edgeStyle:ne,colorBy:m,colorScheme:Z.effectivePalette,nodeSize:b,nodeSizeRange:x,nodeLabel:oe,showLabels:q,enableHover:Y,tooltipContent:!1===C?()=>null:vi(C)||void 0,customHoverBehavior:T||j||M?Z.customHoverBehavior:void 0,customClickBehavior:j||M?Z.customClickBehavior:void 0,legend:Z.legend,legendPosition:Z.legendPosition},D&&"none"!==D&&{legendHoverBehavior:Z.legendState.onLegendHover,legendClickBehavior:Z.legendState.onLegendClick,legendHighlightedCategory:Z.legendState.highlightedCategory,legendIsolatedCategories:Z.legendState.isolatedCategories},{className:u,title:X,description:V,summary:U,accessibleTable:K},null!=t.animate&&{animate:t.animate},_))})});Ld.displayName="ForceDirectedGraph";const Td=g(function(t,n){const o=i(null);Ms(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const s=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",padAngle:v=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:O,onClick:C,chartId:_,selection:j,linkedHover:M,loading:P,loadingContent:L,emptyContent:T,legendInteraction:N,stroke:B,strokeWidth:E,opacity:D}=t,{width:I,height:R,enableHover:H,showLabels:F=!0,title:$,description:W,summary:z,accessibleTable:Y}=s,G=Pd({nodes:a,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:!1,legendInteraction:N,selection:j,linkedHover:M,onObservation:O,onClick:C,chartType:"ChordDiagram",chartId:_,marginDefaults:s.marginDefaults,userMargin:c,width:I,height:R,loading:P,loadingContent:L,emptyContent:T}),q=r(()=>new Map,[]),X=G.safeNodes.length>0,V=r(()=>{if(X)return(e,t)=>{var n,o;const i={stroke:"black",strokeWidth:1};if(p)i.fill=mt(e.data||e,p,G.colorScale);else{const r=Array.isArray(y)?y:ht[y]||gt,s=Array.isArray(r)?r:gt,a=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;i.fill=s[a%s.length]}return i}},[X,p,G.colorScale,y]),U=r(()=>V?_s(V,{stroke:B,strokeWidth:E,opacity:D}):void 0,[V,B,E,D]),K=r(()=>{if(X)return Md({edgeColorBy:m,colorBy:p,colorScale:G.colorScale,nodeStyleFn:U||(e=>({fill:Gr(void 0,G.themeCategorical,y,void 0,q)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[X,m,p,G.colorScale,U,w,G.themeCategorical,y,q]),Z=r(()=>K?_s(K,{stroke:B,strokeWidth:E,opacity:D}):void 0,[K,B,E,D]),Q=r(()=>{if(!F)return;const e=k||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[F,k,f]),J=Ss({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return J?e(ls,{componentName:"ChordDiagram",message:J,width:I,height:R}):G.loadingEl?G.loadingEl:G.emptyEl?G.emptyEl:e(hs,{componentName:"ChordDiagram",width:I,height:R,children:e(Od,Object.assign({ref:o,chartType:"chord"},G.safeNodes.length>0&&{nodes:G.safeNodes},null!=l&&{edges:G.safeEdges},{size:[I,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:h,valueAccessor:g,padAngle:v,groupWidth:b,sortGroups:x,nodeStyle:U,edgeStyle:Z,colorBy:p,colorScheme:G.effectivePalette,edgeColorBy:m,edgeOpacity:w,nodeLabel:Q,showLabels:F,enableHover:H,tooltipContent:!1===A?()=>null:vi(A)||void 0,customHoverBehavior:M||O||C?G.customHoverBehavior:void 0,customClickBehavior:O||C?G.customClickBehavior:void 0},N&&"none"!==N&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},{className:d,title:$,description:W,summary:z,accessibleTable:Y},null!=t.animate&&{animate:t.animate},S))})});Td.displayName="ChordDiagram";const Nd=g(function(t,n){const o=i(null);Ms(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const s=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:a,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",orientation:v="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:O,frameProps:C={},onObservation:_,onClick:j,chartId:M,selection:P,linkedHover:L,loading:T,loadingContent:N,emptyContent:B,showLegend:E,legendPosition:D,legendInteraction:I,stroke:R,strokeWidth:H,opacity:F}=t,{width:$,height:W,enableHover:z,showLabels:Y=!0,title:G,description:q,summary:X,accessibleTable:V}=s,U=Pd({nodes:a,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:E,legendPosition:D,legendInteraction:I,selection:P,linkedHover:L,onObservation:_,onClick:j,chartType:"SankeyDiagram",chartId:M,marginDefaults:s.marginDefaults,userMargin:c,width:$,height:W,loading:T,loadingContent:N,emptyContent:B}),K=r(()=>new Map,[]),Z=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?mt(e.data||e,p,U.colorScale):Gr(void 0,U.themeCategorical,y,void 0,K),t},[p,U.colorScale,U.themeCategorical,y,K]),Q=r(()=>_s(Z,{stroke:R,strokeWidth:H,opacity:F}),[Z,R,H,F]),J=r(()=>Md({edgeColorBy:m,colorBy:p,colorScale:U.colorScale,nodeStyleFn:Q,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[m,p,U.colorScale,Q,A]),ee=r(()=>_s(J,{stroke:R,strokeWidth:H,opacity:F}),[J,R,H,F]),te=r(()=>{if(!Y)return;const e=w||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[Y,w,f]),ne=Ss({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return ne?e(ls,{componentName:"SankeyDiagram",message:ne,width:$,height:W}):U.loadingEl?U.loadingEl:U.emptyEl?U.emptyEl:e(hs,{componentName:"SankeyDiagram",width:$,height:W,children:e(Od,Object.assign({ref:o,chartType:"sankey"},U.safeNodes.length>0&&{nodes:U.safeNodes},null!=l&&{edges:U.safeEdges},{size:[$,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:h,valueAccessor:g,orientation:v,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:Q,edgeStyle:ee,colorBy:p,colorScheme:U.effectivePalette,edgeColorBy:m,edgeOpacity:A,edgeSort:S,nodeLabel:te,showLabels:Y,enableHover:z,tooltipContent:!1===O?()=>null:vi(O)||void 0,customHoverBehavior:L||_||j?U.customHoverBehavior:void 0,customClickBehavior:_||j?U.customClickBehavior:void 0,legend:U.legend,legendPosition:U.legendPosition},I&&"none"!==I&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},{className:d,title:G,description:q,summary:X,accessibleTable:V},null!=t.animate&&{animate:t.animate},C))})});function Bd(e,t,n){const o=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of o)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:n.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:n.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{r.sort((e,t)=>{var n,o;return e.time-t.time||(null!==(n=s[e.kind])&&void 0!==n?n:99)-(null!==(o=s[t.kind])&&void 0!==o?o:99)})},l=r.length?Math.min(...r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,u=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;u.length>e;e++)h.set(u[e],u[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=d?d:e};a();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let n=t-("top"===e.side?p:y);if(n>0){const t="top"===e.side?"bot":"top",o=Math.min(n,"top"===t?p:y);if(o>0){const i=g(e.time);f.push({time:i,delta:-o,kind:"transfer-out",side:t}),f.push({time:i,delta:+o,kind:"transfer-in",side:e.side}),"top"===t?p-=o:y-=o,"top"===e.side?p+=o:y+=o,n-=o}n>0&&null!==d&&(f.push({time:d,delta:+n,kind:"create",side:e.side}),"top"===e.side?p+=n:y+=n)}"top"===e.side?p-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:y+=t}r.push(...f),a();let m=0,v=0,b=0,x=0,k=0;const w=[],A=new Map;for(const e of r){if(w.push({t:e.time,topMass:m,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?m:v;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?m+=e.delta:v+=e.delta,m+v>b&&(b=m+v),m>x&&(x=m),v>k&&(k=v),w.push({t:e.time,topMass:m,botMass:v})}const S=[];let O=0;for(;w.length>O;){let e=O;for(;w.length>e+1&&w[e+1].t===w[O].t;)e++;S.push(w[O]);for(let t=O+1;e>=t;t++){const e=S[S.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||S.push(w[t])}O=e+1}const C=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let _=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===_||_>e.systemInTime)&&(_=e.systemInTime);let j=null;for(const e of o)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===j||e.systemOutTime>j)&&(j=e.systemOutTime);if(S.length>0){const e=S[S.length-1],t=Math.max(null!=C?C:-1/0,null!=j?j:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&S.push({t:t,topMass:e.topMass,botMass:e.botMass});const n=S[0],o=Math.min(null!=c?c:1/0,null!=_?_:1/0);Number.isFinite(o)&&n.t>o&&n.topMass+n.botMass>0&&S.unshift({t:o,topMass:n.topMass,botMass:n.botMass})}return{samples:S,peak:b,topPeak:x,botPeak:k,localAttachments:A}}function Ed(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function Dd(e,t){return e.map(e=>({t:Ed(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Id(e,t,n){const o=e.value*n;if("out"===e.kind){const i=e.sideMassBefore*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}const i=e.sideMassAfter*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}function Rd(e,t){let n=0;for(let o=0;t.length>o;o++)for(let i=o+1;t.length>i;i++){const r=t[o],s=t[i];r.source!==s.source&&r.target!==s.target&&r.source!==s.target&&r.target!==s.source&&(Math.min(r.endTime,s.endTime)>Math.max(r.startTime,s.startTime)&&e[s.source]>e[r.source]!=e[s.target]>e[r.target]&&n++)}return n}function Hd(e,t){let n=0;for(const o of t)n+=Math.abs(e[o.source]-e[o.target])*(o.value||1);return n}function Fd(e,t){return 1e3*Rd(e,t)+Hd(e,t)}function $d(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function Wd(e,t,n){e.length>8||n.length>40?(function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=$d(e,t),s=Fd(t,n);for(let a=0;o>a;a++){const o=Array(i).fill(0),a=Array(i).fill(0);for(const e of n){const n=t[e.source],i=t[e.target];o[n]+=i*(e.value||1),a[n]+=e.value||1,o[i]+=n*(e.value||1),a[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(a[e]>0?o[e]/a[e]:e)-(a[t]>0?o[t]/a[t]:t)),c=l.map(t=>e[t]),d=new Map;l.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t);const u=Fd(t,n);if(s>u)s=u,r=$d(e,t);else if(u===s)break}!function(e,t,n){e.length=0;for(const t of n.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(n.map))t[e]=n.map[e]}(e,t,r)}(e,t,n,6),function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=Fd(t,n);for(let s=0;o>s;s++){let o=!1;for(let s=0;i-1>s;s++){const i=e[s];e[s]=e[s+1],e[s+1]=i;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=Fd(t,n);if(r>a)r=a,o=!0;else{const n=e[s];e[s]=e[s+1],e[s+1]=n;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!o)break}}(e,t,n,6)):function(e,t,n){const o=e.length;if(1>=o)return;const i=Object.assign({},t),r=Object.keys(i),s=Array.from({length:o},(e,t)=>t),a=s.slice(),l=Object.assign({},i);let c=s.slice(),d=1/0;const u=()=>{for(const e of r)l[e]=a[i[e]];const e=Fd(l,n);d>e&&(d=e,c=s.slice())},h=(e,t)=>{const n=s[e],o=s[t];s[e]=o,s[t]=n,a[n]=t,a[o]=e};u();const g=Array(o).fill(0);let f=0;for(;o>f;)f>g[f]?(h(f%2==0?0:g[f],f),u(),g[f]++,f=0):(g[f]=0,f++);const p=c.map(t=>e[t]),y=new Map;c.forEach((e,t)=>y.set(e,t));for(const e of Object.keys(t))t[e]=y.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,n)}function zd(e,t,n,o,i){var r,s,a,l,c,d,u,h;const{plotH:g,padding:f,valueScale:p,packing:y,laneOrder:m,lifetimeMode:v="full"}=i,b={},x={};for(const t of e)b[t.id]=n[t.id].topPeak||0,x[t.id]=n[t.id].botPeak||0;const k="half"===v,w={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,n=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=n&&Number.isFinite(n)?n:-1/0;for(const e of o.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=k?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of o.incoming[t.id]){const t=k?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}w[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const A={},S=[];if("reuse"===y){const n=new Map;for(const t of e)n.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(null!==(r=i.get(e.target))&&void 0!==r?r:0)+1);const u=[];for(const t of e)0===(null!==(s=i.get(t.id))&&void 0!==s?s:0)&&u.push(t.id);for(;u.length;){const e=u.shift();for(const t of null!==(a=o.outgoing[e])&&void 0!==a?a:[]){const o=(null!==(l=n.get(e))&&void 0!==l?l:0)+1;o>(null!==(c=n.get(t.target))&&void 0!==c?c:0)&&n.set(t.target,o),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&u.push(t.target)}}const h=[...e].filter(e=>null!==w[e.id].start).sort((e,t)=>{var o,i;const r=null!==(o=n.get(e.id))&&void 0!==o?o:0,s=null!==(i=n.get(t.id))&&void 0!==i?i:0;return r!==s?r-s:w[e.id].start-w[t.id].start}),g=e.filter(e=>null===w[e.id].start);for(const e of[...h,...g]){const t=w[e.id];let n=-1;for(let e=0;S.length>e;e++){const o=S[e].occupants[S[e].occupants.length-1];if(null===t.start||void 0===o||t.start>=o.end){n=e;break}}-1===n&&(S.push({occupants:[],peak:{topPeak:0,botPeak:0}}),n=S.length-1),S[n].occupants.push({id:e.id,end:null!==(d=null==t?void 0:t.end)&&void 0!==d?d:-1/0}),S[n].peak.topPeak=Math.max(S[n].peak.topPeak,b[e.id]),S[n].peak.botPeak=Math.max(S[n].peak.botPeak,x[e.id]),A[e.id]=n}}else e.forEach((e,t)=>{var n,o;S.push({occupants:[{id:e.id,end:null!==(o=null===(n=w[e.id])||void 0===n?void 0:n.end)&&void 0!==o?o:-1/0}],peak:{topPeak:b[e.id],botPeak:x[e.id]}}),A[e.id]=t});let O=null,C=null,_=null,j=null;const M=()=>{O=Rd(A,t),_=Hd(A,t)},P=()=>{C=Rd(A,t),j=Hd(A,t)};"crossing-min"===m?(M(),Wd(S,A,t),P()):"inside-out"===m?(M(),function(e,t){const n=e.length;if(1>=n)return;const o=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>o(t.slot)-o(e.slot)),r=Array(n),s=Math.floor((n-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&n>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),d=new Map;r.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t)}(S,A),P()):"crossing-min+inside-out"===m&&(M(),Wd(S,A,t),function(e,t,n){const o=e.length;if(1>=o)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((o-1)/2);let s=Fd(t,n);for(const{slot:a}of i){const i=e.indexOf(a);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const d=new Map;for(let e=0;o>e;e++)d.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)d.set(e,e-1);d.set(i,l)}else{for(let e=l;i>e;e++)d.set(e,e+1);d.set(i,l)}for(const e of Object.keys(t))t[e]=d.get(t[e]);const u=Fd(t,n);if(u>s){const n=e[l];e.splice(l,1),e.splice(i,0,n);const r=new Map;for(let e=0;o>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else s=u}}(S,A,t),P());const L=S.map(e=>{const t=new Map;for(const o of e.occupants){const e=n[o.id];if(e)for(const n of e.samples){const e=t.get(n.t)||{top:0,bot:0};t.set(n.t,{top:Math.max(e.top,n.topMass),bot:Math.max(e.bot,n.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let n={top:0,bot:0};for(const[o,i]of e){if(o>t)break;n=i}return n},N=[];for(let e=0;S.length-1>e;e++){const t=L[e],n=L[e+1],o=new Set([...t.map(e=>e[0]),...n.map(e=>e[0])]);let i=0;for(const e of o){const o=T(t,e),r=T(n,e);o.bot+r.top>i&&(i=o.bot+r.top)}N.push(i)}const B=[];let E=f+(null!==(h=null===(u=S[0])||void 0===u?void 0:u.peak.topPeak)&&void 0!==h?h:0)*p;S.length>0&&B.push(E);for(let e=1;S.length>e;e++)E+=N[e-1]*p+f,B.push(E);if(S.length>0&&(E+=S[S.length-1].peak.botPeak*p+f),E>g){const e=g/E;for(let t=0;B.length>t;t++)B[t]*=e}const D=0===S.length?0:S[0].peak.topPeak+N.reduce((e,t)=>e+t,0)+S[S.length-1].peak.botPeak,I={};for(const t of e)I[t.id]=B[A[t.id]];return{effectiveSlotsHeight:D,centerlines:I,laneLifetime:w,slots:S,slotByNode:A,slotCenter:B,crossingsBefore:O,crossingsAfter:C,lengthBefore:_,lengthAfter:j}}Nd.displayName="SankeyDiagram";const Yd=e=>{var t,n;const{bands:o=[],ribbons:i=[],showLabels:r=!0}=e.config,s=[];for(const e of i)s.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of o)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const n=e.gradientStubs[t];s.push({type:"bezier",pathD:n.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:n.x0,x1:n.x1,from:n.from,to:n.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of o)s.push({type:"bezier",pathD:e.pathD,style:Object.assign(Object.assign({},e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86}),{stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(n=e.strokeWidth)&&void 0!==n?n:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const a=r?o.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:o.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:s,labels:a}};function Gd(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function qd(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Xd(e,t){return"function"==typeof e?e(t):t[e]}const Vd=g(function(o,s){const{nodes:a,edges:c,domain:d,axisTicks:h=[],nodeIdAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:y="value",startTimeAccessor:m="startTime",endTimeAccessor:v="endTime",systemInTimeAccessor:b,systemOutTimeAccessor:x,xExtentAccessor:k="xExtent",edgeIdAccessor:w="id",colorBy:S,colorScheme:O,showLegend:C,legendPosition:_="right",pairing:j="temporal",packing:M="reuse",laneOrder:P="crossing-min",ribbonLane:L="both",lifetimeMode:T="half",showLaneRails:N=!1,showQualityReadout:B=!1,showLabels:E=!0,width:D=600,height:I=400,margin:R,title:H,description:F,summary:$,accessibleTable:W,responsiveWidth:z,responsiveHeight:Y,loading:G,loadingContent:q,emptyContent:X,edgeOpacity:V=.35,timeFormat:U,valueFormat:K,tooltip:Z,enableHover:Q=!0,onObservation:J,onClick:ee,showParticles:te=!1,particleStyle:ne,chartId:oe,frameProps:ie={}}=o,[re,se]=u([]),[ae,le]=u([]),ce=i(re),de=i(ae);ce.current=re,de.current=ae;const ue=l(e=>{ce.current=e,se(e)},[]),he=l(e=>{de.current=e,le(e)},[]),ge=void 0!==c,pe=fe(ge?c:re),ye=r(()=>{const e=fe(null!=a?a:[]),t=ae;if(0===e.length&&0===t.length)return _d([],pe,f,p);const n=new Set,o=[];for(const t of e){const e=Xd(g,t)+"";n.has(e)||(n.add(e),o.push(t))}for(const e of t){const t=Xd(g,e)+"";n.has(t)||(n.add(t),o.push(e))}const i=_d([],pe,f,p);for(const e of i)n.has(e.id)||(n.add(e.id),o.push(e));return o},[a,ae,pe,g,f,p]),me=i(null),ve=l((e,t)=>{const n=Xd(w,e);return null!=n?n+"":`${Xd(f,e)}-${Xd(p,e)}-${t}`},[w,f,p]),be=l(e=>{if(null==e)return!1;const t=e;return null!=Xd(f,t)&&null!=Xd(p,t)},[f,p]);Ms(s,{variant:"network",frameRef:me,overrides:{push(e){if(be(e)){if(ge)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");ue([...ce.current,e])}else he([...de.current,e])},pushMany(e){const t=[],n=[];for(const o of e)be(o)?t.push(o):n.push(o);t.length>0&&(ge?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):ue([...ce.current,...t])),n.length>0&&he([...de.current,...n])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),n=[];if(!ge){const e=ce.current,o=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(ve(r,i))?n.push(r):o.push(r)}o.length!==e.length&&ue(o)}const o=de.current,i=[];for(const e of o){const o=Xd(g,e)+"";t.has(o)?n.push(e):i.push(e)}return i.length!==o.length&&he(i),n},update(e,t){const n=new Set(Array.isArray(e)?e:[e]),o=[];if(!ge){let e=!1;const i=ce.current.map((i,r)=>n.has(ve(i,r))?(o.push(i),e=!0,t(i)):i);e&&ue(i)}let i=!1;const r=de.current.map(e=>{const r=Xd(g,e)+"";return n.has(r)?(o.push(e),i=!0,t(e)):e});return i&&he(r),o},clear(){var e;ge||ue([]),he([]),null===(e=me.current)||void 0===e||e.clear()},getData:()=>null!=pe?pe:[],getScales:()=>null},deps:[ge,be,ve,g,pe,ue,he]});const xe=ve,ke=l(e=>Xd(g,e)+"",[g]),{nodes:we,edges:Ae,domain:Se,rawNodeById:Oe,rawEdgeById:Ce}=r(()=>{const e=(null!=ye?ye:[]).map(e=>{const t={id:ke(e),__raw:e},n=k?Xd(k,e):null;if(Array.isArray(n)&&2===n.length){const e=qd(n[0]),o=qd(n[1]);Number.isFinite(e)&&Number.isFinite(o)&&(t.xExtent=[e,o])}return t}),t=(null!=pe?pe:[]).map((e,t)=>{const n={id:xe(e,t),source:Xd(f,e)+"",target:Xd(p,e)+"",value:Number(Xd(y,e)),startTime:qd(Xd(m,e)),endTime:qd(Xd(v,e)),__raw:e};if(b){const t=qd(Xd(b,e));Number.isFinite(t)&&(n.systemInTime=t)}if(x){const t=qd(Xd(x,e));Number.isFinite(t)&&(n.systemOutTime=t)}return n}),n=[qd(d[0]),qd(d[1])],o=new Map;for(const t of e)null!=t.__raw&&o.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:n,rawNodeById:o,rawEdgeById:i}},[ye,pe,d,ke,xe,k,f,p,y,m,v,b,x]),_e=Pd({nodes:ye,edges:pe,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:S,colorScheme:O,showLegend:!1,legendPosition:_,selection:void 0,linkedHover:void 0,onObservation:J,onClick:ee,chartType:"ProcessSankey",chartId:oe,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:R,width:D,height:I,loading:G,loadingContent:q,emptyContent:X}),je=(null!=C?C:!!S)&&!!S,Me=l(e=>null!=R&&("number"==typeof R||null!=R[e]),[R]),Pe=r(()=>{const e=Object.assign({},_e.margin);return je&&("right"===_&&!Me("right")&&140>e.right?e.right=140:"bottom"===_&&!Me("bottom")&&80>e.bottom&&(e.bottom=80)),e},[_e.margin,je,_,Me]),Le=D-Pe.left-Pe.right,Te=I-Pe.top-Pe.bottom,Ne=r(()=>function(e,t,n){const o=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(n)&&2===n.length,s=r&&Number.isFinite(n[0])&&Number.isFinite(n[1]);r&&s&&s&&n[1]>=n[0]||o.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||o.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||o.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||o.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||o.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||o.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):o.push({kind:"invalid-edge-time",id:e.id});return o}(we,Ae,Se),[we,Ae,Se]),Be=r(()=>Ne.length>0?null:function(e,t,n){var o;const{plotH:i,pairing:r="temporal",packing:s="reuse",laneOrder:a="crossing-min",lifetimeMode:l="half"}=n,c=function(e,t){const n={},o={};for(const t of e)n[t.id]=[],o[t.id]=[];for(const e of t)o[e.source]&&o[e.source].push(e),n[e.target]&&n[e.target].push(e);return{incoming:n,outgoing:o}}(e,t),d=function(e,t,n,o="value"){const i="temporal"===o?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===o?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const n=new Map;for(const o of e){const e=o[t];n.has(e)||n.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=n.get(e);i.edges.push(o),i.total+=o.value,i.earliestStart=Math.min(i.earliestStart,o.startTime),i.latestEnd=Math.max(i.latestEnd,o.endTime)}const s=[...n.values()];s.sort("temporal"===o?(e,n)=>"target"===t?e.earliestStart-n.earliestStart:e.latestEnd-n.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=n.outgoing[t.id],o=n.incoming[t.id];if(0===o.length)a(e,"target").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=n});else if(0===e.length)a(o,"source").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=n});else{const t=a(o,"source"),n=a(e,"target"),i=Math.max(t.length,n.length);for(let e=0;i>e;e++){const o=e%2==0?"top":"bot";if(t[e])for(const n of t[e].edges)s.get(n.id).targetSide=o;if(n[e])for(const t of n[e].edges)s.get(t.id).sourceSide=o}}}return s}(e,t,c,r);let u={};for(const t of e)u[t.id]=Bd(t,c,d);const h=zd(e,t,u,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],n=h.slotByNode[e.target];if(void 0===t||void 0===n)continue;const o=d.get(e.id);t!==n?t>n?(o.sourceSide="top",o.targetSide="bot"):(o.sourceSide="bot",o.targetSide="top"):(g.add(e.id),o.sourceSide="bot",o.targetSide="bot")}for(const t of e){const e=c.outgoing[t.id],n=c.incoming[t.id],o=new Set(e.map(e=>d.get(e.id).sourceSide)),i=new Set(n.map(e=>d.get(e.id).targetSide));if(1===o.size&&n.length>0){const e=[...o][0];for(const t of n)h.slotByNode[t.source]===h.slotByNode[t.target]&&(d.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const n of e)h.slotByNode[n.source]===h.slotByNode[n.target]&&(d.get(n.id).sourceSide=t)}}for(const t of e){const e=c.incoming[t.id],n=c.outgoing[t.id];if(0===e.length||0===n.length)continue;const o=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const n of e)"top"===d.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of n)"top"===d.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=o(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,s="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=s)return!1;const a=Math.min(r,s),l=n.filter(t=>!g.has(t.id)&&d.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(d.get(l[0].id).sourceSide=t,!0)};let r=n.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}u={};for(const t of e)u[t.id]=Bd(t,c,d);const f=zd(e,t,u,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),p=null!==(o=f.effectiveSlotsHeight)&&void 0!==o?o:f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),y=Math.min(12,.35*i/Math.max(f.slots.length+1,1)),m=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,v=zd(e,t,u,c,{plotH:i,padding:y,valueScale:m,packing:s,laneOrder:a,lifetimeMode:l});return{nodeData:u,sides:d,valueScale:m,padding:y,compressedPadding:12>y,centerlines:v.centerlines,laneLifetime:v.laneLifetime,slots:v.slots,slotByNode:v.slotByNode,crossingsBefore:v.crossingsBefore,crossingsAfter:v.crossingsAfter,lengthBefore:v.lengthBefore,lengthAfter:v.lengthAfter}}(we,Ae,{plotH:Te,pairing:j,packing:M,laneOrder:P,lifetimeMode:T}),[Ne,we,Ae,Te,j,M,P,T]),Ee=r(()=>A().domain(Se).range([0,Le]),[Se,Le]),De=l((e,t)=>{if(S&&ye){const t=Oe.get(e);if(t)return mt(t,S,_e.colorScale)}return _e.effectivePalette[t%_e.effectivePalette.length]||"#475569"},[S,ye,Oe,_e.colorScale,_e.effectivePalette]),Ie=r(()=>{const e=new Map;return we.forEach((t,n)=>e.set(t.id,n)),e},[we]),Re=r(()=>{if(!Be)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:n}=Be,o=[],i=[];return we.forEach((i,r)=>{var s;const a=t[i.id];if(!a||0===a.samples.length)return;const l=function(e,t,n,o,i){if(0===e.length)return null;const r=Dd(e,i),s=e=>t-r[e].topMass*n,a=e=>t+r[e].botMass*n;let l=`M${o(r[0].t)},${s(0)}`;for(let e=1;r.length>e;e++)l+=` L${o(r[e].t)},${s(e)}`;l+=` L${o(r[r.length-1].t)},${a(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${o(r[e].t)},${a(e)}`;return l+" Z"}(a.samples,e[i.id],n,Ee,Se);if(!l)return;const c=Dd(a.samples,Se),d=c.find(e=>e.topMass+e.botMass>0)||c[0],u=e[i.id]+(d.botMass-d.topMass)*n/2,h=De(i.id,r),g=null!==(s=Oe.get(i.id))&&void 0!==s?s:i,f=function(e,t,n,o,i){const r=n.nodeData[e];if(!r||0===r.samples.length)return[];const s=n.valueScale,a=n.centerlines[e],l=Dd(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],d=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],u=o(c.t),h=o(d.t),g=e=>o(Ed(e,i)),f=[],p=(e,t,n,o)=>`M${e},${t} L${n},${t} L${n},${o} L${e},${o} Z`;for(const n of t){if(n.source===e&&null!=n.systemInTime&&Number.isFinite(n.systemInTime)){const e=r.localAttachments.get(n.id);if(e&&"out"===e.kind&&n.startTime>n.systemInTime){const t=g(n.systemInTime),o=g(n.startTime),i=t-20,r=Math.max(u,i);if(o>r){const[n,l]=Id(e,a,s);f.push({pathD:p(r,n,o,l),x0:i,x1:t,from:0,to:1})}}}if(n.target===e&&null!=n.systemOutTime&&Number.isFinite(n.systemOutTime)){const e=r.localAttachments.get(n.id);if(e&&"in"===e.kind&&n.systemOutTime>n.endTime){const t=g(n.systemOutTime),o=g(n.endTime),i=t+20,r=Math.min(h,i);if(r>o){const[n,l]=Id(e,a,s);f.push({pathD:p(o,n,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,Ae,Be,Ee,Se);o.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:Ee(d.t)-4,labelY:u,labelText:i.id}))}),Ae.forEach(o=>{var r,s,a,l;const c=null===(r=t[o.source])||void 0===r?void 0:r.localAttachments.get(o.id),d=null===(s=t[o.target])||void 0===s?void 0:s.localAttachments.get(o.id);if(!c||!d)return;const u=null!==(a=Ie.get(o.source))&&void 0!==a?a:0,h=De(o.source,u),g=function(e,t,n,o,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,d=r(c(e.time)),u=r(c(n.time)),h=e.value*l,g=n.value*l,f=e.sideMassBefore*l,p=n.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===n.side?(v=o-p,b=v+g):(b=o+p,v=b-g);const x="source"===s?d+.85*(u-d):"target"===s?d+.15*(u-d):(d+u)/2;return{sx:d,sTop:y,sBot:m,tx:u,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[o.source],d,e[o.target],n,Ee,L,Se),{pathD:f,bezier:p}=Oc(g),y=null!==(l=Ce.get(o.id))&&void 0!==l?l:o;i.push({id:o.id,pathD:f,fill:h,opacity:V,rawDatum:y,bezier:p})}),{bands:o,ribbons:i}},[Be,we,Ae,Ee,Se,De,Oe,Ce,L,V,Ie]),He=r(()=>({bands:Re.bands,ribbons:Re.ribbons,showLabels:E}),[Re,E]),Fe=r(()=>{if(!je||!S)return;const e=new Map;(null!=ye?ye:[]).forEach((t,n)=>{const o=Xd(S,t),i=null==o?"":o+"";i&&!e.has(i)&&e.set(i,{label:i,color:De(ke(t),n)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[je,S,ye,De,ke]),$e=r(()=>!1!==Z&&Q?void 0===Z||!0===Z?null:vi(Z)||null:null,[Z,Q]),We=l(e=>U?U(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[U]),ze=l(e=>K?K(e):e+"",[K]),Ye=l(o=>{if(!o||!o.data)return null;const i=o.data;if(!Gd(i))return null;const r=i.data;if($e)return $e(r);if("band"===i.__kind){const n=i.id,o=Be?function(e){if(!e)return[];const t=new Set,n=[];for(const o of e.samples){const e=o.topMass+o.botMass,i=`${o.t}:${e}`;t.has(i)||(t.add(i),n.push({t:o.t,total:e}))}return n}(Be.nodeData[n]):[],r=5,s=o.length>r?o.length:null,a=function(e,t=5){if(t>=e.length)return e.slice();const n=[...e].sort((e,t)=>e.total-t.total),o=n.length-1,i=[Object.assign(Object.assign({},n[0]),{mark:"min"}),Object.assign(Object.assign({},n[Math.floor(.25*o)]),{mark:"q25"}),Object.assign(Object.assign({},n[Math.floor(.5*o)]),{mark:"median"}),Object.assign(Object.assign({},n[Math.floor(.75*o)]),{mark:"q75"}),Object.assign(Object.assign({},n[o]),{mark:"max"})],r=new Set,s=[];for(const e of i)r.has(e.t)||(r.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,r);return t("div",{style:{minWidth:160},children:[e("div",{style:{fontWeight:600,marginBottom:4},children:n}),a.length>0&&t("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e("thead",{children:t("tr",{style:{opacity:.6},children:[e("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=s&&e("th",{})]})}),e("tbody",{children:a.map((n,o)=>t("tr",{children:[e("td",{style:{paddingRight:8},children:We(n.t)}),e("td",{style:{textAlign:"right"},children:ze(n.total)}),null!=s&&e("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:n.mark})]},o))})]}),null!=s&&t("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",a.length," of ",s," samples"]})]})}const s=r,a=Xd(f,s),l=Xd(p,s),c=Xd(y,s),d=Xd(m,s),u=Xd(v,s);return t("div",{style:{minWidth:160},children:[t("div",{style:{fontWeight:600,marginBottom:4},children:[a+""," → ",l+""]}),t("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=c&&t(n,{children:[e("span",{style:{opacity:.6},children:"value"}),e("span",{style:{textAlign:"right"},children:ze(Number(c))})]}),null!=d&&t(n,{children:[e("span",{style:{opacity:.6},children:"start"}),e("span",{style:{textAlign:"right"},children:We(qd(d))})]}),null!=u&&t(n,{children:[e("span",{style:{opacity:.6},children:"end"}),e("span",{style:{textAlign:"right"},children:We(qd(u))})]})]})]})},[Be,$e,We,ze,f,p,y,m,v]),Ge=r(()=>{if(!Be)return null;const{centerlines:n,laneLifetime:o,nodeData:i,valueScale:r,compressedPadding:s,crossingsBefore:a,crossingsAfter:l,lengthBefore:c,lengthAfter:d}=Be;let u=null,g=null;for(const e of we){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=Ee(t.start),i=Ee(t.end);(null===u||u>n)&&(u=n),(null===g||i>g)&&(g=i)}const f=e=>Math.max(0,Math.min(Le,e)),p=f(null!=u?u:0),y=Math.max(p,f(null!=g?g:Le));return t("g",{children:[B&&null!==(null!=l?l:null)&&t("text",{x:Le,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",a," → ",l," ","edge length: ",Math.round(c)," → ",Math.round(d)]}),s&&e("text",{x:Le,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),h.map((t,n)=>{const o=Ee(qd(t.date));return p-.5>o||o>y+.5?null:e("line",{x1:o,y1:0,x2:o,y2:Te,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+n)}),N&&we.map((s,a)=>{const l=o[s.id];if(!l||null===l.start)return null;const c=i[s.id],d=c?{topPeak:c.topPeak,botPeak:c.botPeak}:{topPeak:0,botPeak:0},u=n[s.id]+(d.botPeak-d.topPeak)*r/2,h=Ee(l.start),g=Ee(l.end),f=De(s.id,a);return t("g",{children:[e("line",{x1:h,y1:u,x2:g,y2:u,stroke:f,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:f,strokeOpacity:.5}),e("line",{x1:g,y1:u-4,x2:g,y2:u+4,stroke:f,strokeOpacity:.5})]},"lane-"+s.id)}),e("line",{x1:p,y1:Te+4,x2:y,y2:Te+4,stroke:"#94a3b8"}),h.map((n,o)=>{const i=qd(n.date),r=Ee(i);if(p-.5>r||r>y+.5)return null;const s=null!=n.label?n.label:U?U(new Date(i)):"";return t("g",{transform:`translate(${r},${Te+4})`,children:[e("line",{y2:6,stroke:"#94a3b8"}),e("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:s})]},o)})]})},[Be,h,Ee,Le,Te,N,we,De,B,U]),qe=r(()=>(null!=ye?ye:[]).map(e=>({id:ke(e),data:e})),[ye,ke]),Xe=r(()=>{const e=new Map;for(const t of Re.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Re]),Ve=r(()=>(null!=pe?pe:[]).map((e,t)=>{const n=xe(e,t),o=Number(Xd(y,e));return{id:n,source:Xd(f,e)+"",target:Xd(p,e)+"",value:Number.isFinite(o)?o:0,bezier:Xe.get(n),data:e}}),[pe,xe,f,p,y,Xe]),Ue=_e.loadingEl,Ke=_e.emptyEl;return Ne.length>0?t("svg",{width:D,height:I,role:"img","aria-label":null!=H?H:"Process Sankey validation failed",children:[e("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ne.map((t,n)=>{return e("text",{x:20,y:56+18*n,fontSize:12,fill:"#64748b",children:"• "+(o=t,"invalid-node-time"===o.kind?`node ${o.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===o.kind?`edge ${o.id} has an invalid startTime or endTime`:"invalid-domain"===o.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===o.kind?`edge ${o.id} must have a positive finite value`:"missing-node"===o.kind?`edge ${o.id} references missing ${o.endpoint} node "${o.nodeId}"`:"backward-edge"===o.kind?`edge ${o.id} (${o.source}->${o.target}) ends before it starts`:o.kind)},n);var o})]}):Ue||Ke||e(Od,Object.assign({ref:me,chartType:"force",nodes:qe,edges:Ve,customNetworkLayout:Yd,layoutConfig:He,size:[D,I],responsiveWidth:z,responsiveHeight:Y,margin:Pe,title:H,description:null!=F?F:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:$,accessibleTable:W,enableHover:Q,tooltipContent:!1===Z?()=>null:Ye,backgroundGraphics:Ge,showParticles:te,particleStyle:ne,legend:Fe,legendPosition:_,onObservation:J,customClickBehavior:ee?e=>{if(!e||!e.data)return;const t=e.data;Gd(t)&&ee(t.data,{x:e.x,y:e.y})}:void 0,chartId:oe,colorScheme:Array.isArray(O)?O:void 0},ie))});function Ud(t){const n=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:d="value",nodeIdAccessor:u="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:m=5,tooltip:v,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:S,loading:O,loadingContent:C,legendInteraction:_,stroke:j,strokeWidth:M,opacity:P}=t,{width:L,height:T,enableHover:N,showLabels:B=!0,title:E,description:D,summary:I,accessibleTable:R}=n,H=Pd({nodes:r(()=>Cd(null!=o?o:null,c),[o,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:_,selection:A,linkedHover:S,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:n.marginDefaults,userMargin:i,width:L,height:T,loading:O,loadingContent:C}),F=r(()=>new Map,[]),$=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?pt[(e.depth||0)%pt.length]:h?mt(e.data||e,h,H.colorScale):Gr(void 0,H.themeCategorical,g,void 0,F),t},[h,f,H.colorScale,H.themeCategorical,g,F]),W=r(()=>_s($,{stroke:j,strokeWidth:M,opacity:P}),[$,j,M,P]),z=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=r(()=>_s(z,{stroke:j,strokeWidth:M,opacity:P}),[z,j,M,P]),G=r(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return jd(d)},[a,d]),q=As({componentName:"TreeDiagram",data:o});return q?e(ls,{componentName:"TreeDiagram",message:q,width:L,height:T}):H.loadingEl?H.loadingEl:e(hs,{componentName:"TreeDiagram",width:L,height:T,children:e(Od,Object.assign({chartType:a},null!=o&&{data:o},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:H.margin,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:H.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:B?y||u:void 0,showLabels:B,enableHover:N,tooltipContent:!1===v?()=>null:vi(v)||void 0,customHoverBehavior:S||x||k?H.customHoverBehavior:void 0,customClickBehavior:x||k?H.customClickBehavior:void 0},_&&"none"!==_&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:s,title:E,description:D,summary:I,accessibleTable:R},null!=t.animate&&{animate:t.animate},b))})}function Kd(t){const n=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:o,margin:i,className:s,childrenAccessor:a="children",valueAccessor:c="value",nodeIdAccessor:d="name",colorBy:u,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:m,nodeStyle:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:C,loadingContent:_,legendInteraction:j,stroke:M,strokeWidth:P,opacity:L}=t,{nodeStyle:T}=x,N=Ps(x,["nodeStyle"]),{width:B,height:E,enableHover:D,showLabels:I=!0,title:R,description:H,summary:F,accessibleTable:$}=n,W=Pd({nodes:r(()=>Cd(null!=o?o:null,a),[o,a]),edges:void 0,inferNodes:!1,colorBy:g?void 0:u,colorScheme:h,showLegend:!1,legendInteraction:j,selection:k,linkedHover:w,onObservation:A,onClick:S,chartType:"Treemap",chartId:O,marginDefaults:n.marginDefaults,userMargin:i,width:B,height:E,loading:C,loadingContent:_}),z=Os(k),Y=W.customHoverBehavior,G=l(e=>{if(!e)return Y(null);const t=e.data||e;Y({data:(null==t?void 0:t.data)||t})},[Y]),q=r(()=>new Map,[]),X=r(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=g?pt[(e.depth||0)%pt.length]:u?mt(e.data||e,u,W.colorScale):Gr(void 0,W.themeCategorical,h,void 0,q),t},[u,g,W.colorScale,W.themeCategorical,h,q]),V=r(()=>v||T?e=>{var t,n;return Object.assign(Object.assign(Object.assign({},X(e)),T&&null!==(t=T(e))&&void 0!==t?t:{}),v&&null!==(n=v(e))&&void 0!==n?n:{})}:X,[X,v,T]),U=r(()=>_s(V,{stroke:M,strokeWidth:P,opacity:L}),[V,M,P,L]),K=r(()=>W.activeSelectionHook?e=>{var t;const n=Object.assign({},U(e));if(W.activeSelectionHook.isActive)if(W.activeSelectionHook.predicate(e.data||e))(null==z?void 0:z.selectedStyle)&&Object.assign(n,z.selectedStyle);else{const e=null!==(t=null==z?void 0:z.unselectedOpacity)&&void 0!==t?t:.5;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==z?void 0:z.unselectedStyle)&&Object.assign(n,z.unselectedStyle)}return n}:U,[U,W.activeSelectionHook,z]),Z=r(()=>jd(c),[c]),Q=void 0!==m?m:!I||"parent"!==f&&"all"!==f?void 0:18,J=As({componentName:"Treemap",data:o});return J?e(ls,{componentName:"Treemap",message:J,width:B,height:E}):W.loadingEl?W.loadingEl:e(hs,{componentName:"Treemap",width:B,height:E,children:e(Od,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[B,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,nodeIDAccessor:d,childrenAccessor:a,hierarchySum:Z,padding:y,paddingTop:Q,nodeStyle:K,colorBy:u,colorScheme:W.effectivePalette,colorByDepth:g,nodeLabel:I?p||d:void 0,showLabels:I,labelMode:f,enableHover:D,tooltipContent:!1===b?()=>null:vi(b)||void 0},(w||A||S)&&{customHoverBehavior:G},(A||S)&&{customClickBehavior:W.customClickBehavior},j&&"none"!==j&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},{className:s,title:R,description:H,summary:F,accessibleTable:$},null!=t.animate&&{animate:t.animate},N))})}function Zd(t){const n=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:d,colorScheme:u,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:m={},onObservation:v,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,loadingContent:S,legendInteraction:O,stroke:C,strokeWidth:_,opacity:j}=t,{width:M,height:P,enableHover:L,showLabels:T=!0,title:N,description:B,summary:E,accessibleTable:D}=n,I=Pd({nodes:r(()=>Cd(null!=o?o:null,a),[o,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:d,colorScheme:u,showLegend:!1,legendInteraction:O,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:i,width:M,height:P,loading:A,loadingContent:S}),R=r(()=>new Map,[]),H=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?pt[(e.depth||0)%pt.length]:d?mt(e.data||e,d,I.colorScale):Gr(void 0,I.themeCategorical,u,void 0,R),t},[d,h,I.colorScale,f,I.themeCategorical,u,R]),F=r(()=>_s(H,{stroke:C,strokeWidth:_,opacity:j}),[H,C,_,j]),$=r(()=>jd(l),[l]),W=As({componentName:"CirclePack",data:o});return W?e(ls,{componentName:"CirclePack",message:W,width:M,height:P}):I.loadingEl?I.loadingEl:e(hs,{componentName:"CirclePack",width:M,height:P,children:e(Od,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[M,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:$,padding:p,nodeStyle:F,colorBy:d,colorScheme:I.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:vi(y)||void 0,customHoverBehavior:w||v||b?I.customHoverBehavior:void 0,customClickBehavior:v||b?I.customClickBehavior:void 0},O&&"none"!==O&&{legendHoverBehavior:I.legendState.onLegendHover,legendClickBehavior:I.legendState.onLegendClick,legendHighlightedCategory:I.legendState.highlightedCategory,legendIsolatedCategories:I.legendState.isolatedCategories},{className:s,title:N,description:B,summary:E,accessibleTable:D},null!=t.animate&&{animate:t.animate},m))})}Vd.displayName="ProcessSankey",Ud.displayName="TreeDiagram",Kd.displayName="Treemap",Zd.displayName="CirclePack";const Qd=pt;function Jd(t){const n=Jr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:d,colorByDepth:u=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:C,onClick:_,chartId:j,selection:M,linkedHover:P,loading:L,loadingContent:T,stroke:N,strokeWidth:B,opacity:E}=t,{width:D,height:I,enableHover:R,title:H,description:F,summary:$,accessibleTable:W}=n,z=Pd({nodes:r(()=>Cd(o,a),[o,a]),edges:void 0,inferNodes:!1,colorBy:u?void 0:c,colorScheme:d,showLegend:!1,legendInteraction:void 0,selection:M,linkedHover:P,onObservation:C,onClick:_,chartType:"OrbitDiagram",chartId:j,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:i,width:D,height:I,loading:L,loadingContent:T}),Y=r(()=>new Map,[]),G=r(()=>{if(Array.isArray(d))return d;const e=ht[d];return Array.isArray(e)?e:gt},[d]),q=r(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=u?o?G[0]:Qd[(e.depth||0)%Qd.length]:c?mt(e.data||e,c,z.colorScale):Gr(void 0,z.themeCategorical,d,void 0,Y),n.opacity=o?1:.85,n},[c,u,z.colorScale,G,z.themeCategorical,d,Y]),X=r(()=>_s(q,{stroke:N,strokeWidth:B,opacity:E}),[q,N,B,E]),V=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),U=r(()=>{if(z.customHoverBehavior)return e=>{z.customHoverBehavior(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z.customHoverBehavior]),K=r(()=>{if(z.customClickBehavior)return e=>{z.customClickBehavior(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z.customClickBehavior]),Z=As({componentName:"OrbitDiagram",data:o});return Z?e(ls,{componentName:"OrbitDiagram",message:Z,width:D,height:I}):z.loadingEl?z.loadingEl:e(hs,{componentName:"OrbitDiagram",width:D,height:I,children:e(Od,Object.assign({chartType:"orbit"},null!=o&&{data:o},{size:[D,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:X,edgeStyle:V,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:u,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&R,tooltipContent:k?void 0:!1===w?()=>null:vi(w)||void 0,customHoverBehavior:P||C||_?U:void 0,customClickBehavior:C||_?K:void 0,foregroundGraphics:A,annotations:S,className:s,title:H,description:F,summary:$,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=t.animate&&{animate:t.animate},O))})}Jd.displayName="OrbitDiagram";const eu={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},tu={opacity:.7,marginRight:4};function nu(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function ou(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function iu(e={}){const{timeAccessor:n,valueAccessor:o,xLabel:i="x",yLabel:r="y"}=e;return e=>{var s;const a=null!==(s=null==e?void 0:e.data)&&void 0!==s?s:null,l=nu(a,n,"time"),c=nu(a,o,"value");return t("div",{className:"semiotic-tooltip",style:eu,children:[t("div",{children:[t("span",{style:tu,children:[i,":"]}),ou(l)]}),t("div",{children:[t("span",{style:tu,children:[r,":"]}),ou(c)]})]})}}function ru(e,t){var n;return null!=e?e:Math.max(null!==(n=null==t?void 0:t.length)&&void 0!==n?n:0,200)}const su=g(function(t,n){var o,r,s,a,c;const d=Jr(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:O=2,strokeDasharray:C,opacity:_,background:j,tooltipContent:M,tooltip:P,onHover:L,annotations:T,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:E,decay:D,pulse:I,staleness:R,transition:H,linkedHover:F,selection:$,onObservation:W,chartId:z,loading:Y,loadingContent:G,emptyContent:q,emphasis:X,legendPosition:V}=t,U=d.showAxes,K=d.enableHover,Z=null!=h?h:d.marginDefaults,Q=null!=u?u:[d.width,d.height],J=null!==(c=null!=M?M:P)&&void 0!==c?c:iu({timeAccessor:b,valueAccessor:x}),ee=i(null),{customHoverBehavior:te}=Vr({selection:$,linkedHover:F,unwrapData:!0,onObservation:W,chartType:"RealtimeLineChart",chartId:z}),ne=l(e=>{L&&L(e),te(e)},[L,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ee.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=ys(Y,Q[0],Q[1],G),ie=oe?null:ps(v,Q[0],Q[1],q),re={stroke:S,strokeWidth:O,strokeDasharray:C};null!=_&&(re.opacity=_);const se=ru(m,v);return oe||ie||e(or,{ref:ee,chartType:"line",runtimeMode:"streaming",size:Q,margin:Z,className:X?`${g||""} semiotic-emphasis-${X}`.trim():g,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,lineStyle:re,showAxes:U,background:j,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:ne,annotations:T,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:E,decay:D,pulse:I,staleness:R,transition:H,pointIdAccessor:t.pointIdAccessor,legendPosition:V})});function au(e,t,n){const o="function"==typeof t?t(e):e[null!=t?t:n];if(null==o)return null;if(o instanceof Date)return o.getTime();if("string"==typeof o&&""===o.trim())return null;const i=Number(o);return Number.isFinite(i)?i:null}su.displayName="RealtimeLineChart";const lu=g(function(n,o){var s,a,c,d,u;const h=Jr(n.mode,{width:null!==(a=null===(s=n.size)||void 0===s?void 0:s[0])&&void 0!==a?a:n.width,height:null!==(d=null===(c=n.size)||void 0===c?void 0:c[1])&&void 0!==d?d:n.height,showAxes:n.showAxes,enableHover:null!=n.enableHover?!!n.enableHover:void 0,linkedHover:n.linkedHover}),{binSize:g,size:f,margin:y,className:m,arrowOfTime:v="right",windowMode:b="sliding",windowSize:x,data:k,timeAccessor:w,valueAccessor:A,direction:S="up",timeExtent:O,valueExtent:C,extentPadding:_,categoryAccessor:j,colors:M,fill:P,stroke:L,strokeWidth:T,opacity:N,gap:B,background:E,tooltipContent:D,tooltip:I,onHover:R,annotations:H,svgAnnotationRules:F,tickFormatTime:$,tickFormatValue:W,linkedHover:z,selection:Y,decay:G,pulse:q,staleness:X,transition:V,onObservation:U,chartId:K,loading:Z,loadingContent:Q,emptyContent:J,emphasis:ee,legendPosition:te,brush:ne,onBrush:oe,linkedBrush:ie}=n,re=h.showAxes,se=h.enableHover,ae=null!=y?y:h.marginDefaults,le=null!=f?f:[h.width,h.height],ce=null!==(u=null!=D?D:I)&&void 0!==u?u:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r;const s=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null;if(null==(null==s?void 0:s.binStart)||null==(null==s?void 0:s.binEnd)){const n=nu(s,o,"time"),r=nu(s,i,"value");return t("div",{className:"semiotic-tooltip",style:eu,children:[t("div",{children:[e("span",{style:tu,children:"x:"}),ou(n)]}),t("div",{children:[e("span",{style:tu,children:"y:"}),ou(r)]})]})}return t("div",{className:"semiotic-tooltip",style:eu,children:[t("div",{children:[e("span",{style:tu,children:"range:"}),ou(s.binStart),"–",ou(s.binEnd)]}),null!=s.total&&t("div",{children:[e("span",{style:tu,children:"count:"}),ou(s.total)]}),null!=s.category&&t("div",{children:[e("span",{style:tu,children:"category:"}),ou(s.category)]})]})}}({timeAccessor:w,valueAccessor:A}),de=i(null),{customHoverBehavior:ue}=Vr({selection:Y,linkedHover:z,unwrapData:!0,onObservation:U,chartType:"RealtimeHistogram",chartId:K}),he=l(e=>{R&&R(e),ue(e)},[R,ue]),ge=!0===ne?{dimension:"x",snap:"bin"}:"x"===ne?{dimension:"x"}:"object"==typeof ne?ne:void 0,fe=Pr(ie),pe=mr(Object.assign({name:(null==fe?void 0:fe.name)||"__unused_hist_brush__",xField:(null==fe?void 0:fe.xField)||("string"==typeof w?w:"time")},(null==fe?void 0:fe.yField)?{yField:fe.yField}:{})),ye=i(pe.brushInteraction);ye.current=pe.brushInteraction;const me=l(e=>{if(oe&&oe(e),U&&U(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}),fe){const t=ye.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[oe,U,K,fe]);p(o,()=>({push:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=de.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=de.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=de.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ve=ys(Z,le[0],le[1],Q),be=ve?null:ps(k,le[0],le[1],J),xe={};null!=P&&(xe.fill=P),null!=L&&(xe.stroke=L),null!=T&&(xe.strokeWidth=T),null!=N&&(xe.opacity=N),null!=B&&(xe.gap=B);const ke=ee?`${m||""} semiotic-emphasis-${ee}`.trim():m,we=ru(x,k),Ae=r(()=>"down"!==S?C:function({data:e,valueAccessor:t,timeAccessor:n,binSize:o,valueExtent:i,extentPadding:r}){var s;if(i)return[i[1],i[0]];if(!e||0===e.length)return;const a=new Map;for(const i of e){const e=au(i,n,"time"),r=au(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/o)*o;a.set(l,(null!==(s=a.get(l))&&void 0!==s?s:0)+r)}let l=0;for(const e of a.values())e>l&&(l=e);return[l>0?l+l*(null!=r?r:.1):1,0]}({data:k,valueAccessor:A,timeAccessor:w,binSize:g,valueExtent:C,extentPadding:_}),[S,k,A,w,g,C,_]);return ve||be||e(or,{ref:de,chartType:"bar",runtimeMode:"streaming",size:le,margin:ae,className:ke,arrowOfTime:v,windowMode:b,windowSize:we,data:k,timeAccessor:w,valueAccessor:A,xExtent:O,yExtent:Ae,extentPadding:_,binSize:g,categoryAccessor:j,barColors:M,barStyle:xe,showAxes:re,background:E,hoverAnnotation:se,tooltipContent:ce,customHoverBehavior:he,annotations:H,svgAnnotationRules:F,tickFormatTime:$,tickFormatValue:W,decay:G,pulse:q,staleness:X,transition:V,pointIdAccessor:n.pointIdAccessor,legendPosition:te,brush:ge||(ie?{dimension:"x"}:void 0),onBrush:ge||ie?me:void 0})});function cu(t){return e(lu,Object.assign({},t,{windowMode:"growing"}))}lu.displayName="RealtimeHistogram",cu.displayName="TemporalHistogram";const du=g(function(t,n){var o,r,s,a,c;const d=Jr(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,radius:C,fill:_,opacity:j,stroke:M,strokeWidth:P,background:L,tooltipContent:T,tooltip:N,onHover:B,annotations:E,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:R,linkedHover:H,selection:F,onObservation:$,chartId:W,loading:z,loadingContent:Y,emptyContent:G,emphasis:q,legendPosition:X}=t,V=d.showAxes,U=d.enableHover,K=null!=h?h:d.marginDefaults,Z=null!=u?u:[d.width,d.height],Q=null!==(c=null!=T?T:N)&&void 0!==c?c:iu({timeAccessor:b,valueAccessor:x}),J=i(null),{customHoverBehavior:ee}=Vr({selection:F,linkedHover:H,unwrapData:!0,onObservation:$,chartType:"RealtimeSwarmChart",chartId:W}),te=l(e=>{B&&B(e),ee(e)},[B,ee]);p(n,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=J.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ne=ys(z,Z[0],Z[1],Y),oe=ne?null:ps(v,Z[0],Z[1],G),ie={};null!=C&&(ie.radius=C),null!=_&&(ie.fill=_),null!=j&&(ie.opacity=j),null!=M&&(ie.stroke=M),null!=P&&(ie.strokeWidth=P);const re=q?`${g||""} semiotic-emphasis-${q}`.trim():g,se=ru(m,v);return ne||oe||e(or,{ref:J,chartType:"swarm",runtimeMode:"streaming",size:Z,margin:K,className:re,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:O,swarmStyle:ie,showAxes:V,background:L,hoverAnnotation:U,tooltipContent:Q,customHoverBehavior:te,annotations:E,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:R,legendPosition:X,pointIdAccessor:t.pointIdAccessor})});du.displayName="RealtimeSwarmChart";const uu=g(function(n,o){var r,s,a,c,d;const u=Jr(n.mode,{width:null!==(s=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==s?s:n.width,height:null!==(c=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:O,negativeColor:C,connectorStroke:_,connectorWidth:j,gap:M,stroke:P,strokeWidth:L,opacity:T,background:N,tooltipContent:B,tooltip:E,onHover:D,annotations:I,svgAnnotationRules:R,tickFormatTime:H,tickFormatValue:F,linkedHover:$,selection:W,onObservation:z,chartId:Y,loading:G,loadingContent:q,emptyContent:X,emphasis:V,legendPosition:U}=n,K=u.showAxes,Z=u.enableHover,Q=null!=g?g:u.marginDefaults,J=null!=h?h:[u.width,u.height],ee=null!==(d=null!=B?B:E)&&void 0!==d?d:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r,s;const a=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null,l=nu(a,o,"time"),c=null!==(s=null==a?void 0:a.delta)&&void 0!==s?s:nu(a,i,"value"),d=null==a?void 0:a.cumEnd,u="number"==typeof c?0>c?ou(c):"+"+ou(c):ou(c);return t("div",{className:"semiotic-tooltip",style:eu,children:[t("div",{children:[e("span",{style:tu,children:"x:"}),ou(l)]}),t("div",{children:[e("span",{style:tu,children:"Δ:"}),u]}),null!=d&&t("div",{children:[e("span",{style:tu,children:"total:"}),ou(d)]})]})}}({timeAccessor:x,valueAccessor:k}),te=i(null),{customHoverBehavior:ne}=Vr({selection:W,linkedHover:$,unwrapData:!0,onObservation:z,chartType:"RealtimeWaterfallChart",chartId:Y}),oe=l(e=>{D&&D(e),ne(e)},[D,ne]);p(o,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=te.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=te.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ie=ys(G,J[0],J[1],q),re=ie?null:ps(b,J[0],J[1],X),se={};null!=O&&(se.positiveColor=O),null!=C&&(se.negativeColor=C),null!=_&&(se.connectorStroke=_),null!=j&&(se.connectorWidth=j),null!=M&&(se.gap=M),null!=P&&(se.stroke=P),null!=L&&(se.strokeWidth=L),null!=T&&(se.opacity=T);const ae=V?`${f||""} semiotic-emphasis-${V}`.trim():f,le=ru(v,b);return ie||re||e(or,{ref:te,chartType:"waterfall",runtimeMode:"streaming",size:J,margin:Q,className:ae,arrowOfTime:y,windowMode:m,windowSize:le,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:se,showAxes:K,background:N,hoverAnnotation:Z,tooltipContent:ee,customHoverBehavior:oe,annotations:I,svgAnnotationRules:R,tickFormatTime:H,tickFormatValue:F,legendPosition:U,pointIdAccessor:n.pointIdAccessor})});uu.displayName="RealtimeWaterfallChart";const hu=g(function(n,o){var r,s,a,c,d;const u=Jr(n.mode,{width:null!==(s=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==s?s:n.width,height:null!==(c=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:S,extentPadding:O,heatmapXBins:C=20,heatmapYBins:_=20,aggregation:j="count",background:M,tooltipContent:P,tooltip:L,onHover:T,annotations:N,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:D,decay:I,pulse:R,staleness:H,linkedHover:F,selection:$,onObservation:W,chartId:z,loading:Y,loadingContent:G,emptyContent:q,emphasis:X,legendPosition:V}=n,U=u.showAxes,K=u.enableHover,Z=null!=g?g:u.marginDefaults,Q=null!=h?h:[u.width,u.height],J=null!==(d=null!=P?P:L)&&void 0!==d?d:function(n={}){const{timeAccessor:o,valueAccessor:i,xLabel:r="x",yLabel:s="y"}=n;return n=>{var a,l,c,d;const u=null!==(a=null==n?void 0:n.data)&&void 0!==a?a:null,h=null!==(l=null==u?void 0:u.xCenter)&&void 0!==l?l:nu(u,o,"time"),g=null!==(c=null==u?void 0:u.yCenter)&&void 0!==c?c:nu(u,i,"value"),f=null==u?void 0:u.count,p=null==u?void 0:u.sum,y=null==u?void 0:u.value,m=null!==(d=null==u?void 0:u.agg)&&void 0!==d?d:"count";return t("div",{className:"semiotic-tooltip",style:eu,children:[t("div",{children:[t("span",{style:tu,children:[r,":"]}),ou(h)]}),t("div",{children:[t("span",{style:tu,children:[s,":"]}),ou(g)]}),null!=f&&t("div",{children:[e("span",{style:tu,children:"count:"}),ou(f)]}),"sum"===m&&null!=p&&t("div",{children:[e("span",{style:tu,children:"sum:"}),ou(p)]}),"mean"===m&&null!=y&&t("div",{children:[e("span",{style:tu,children:"mean:"}),ou(y)]})]})}}({timeAccessor:x,valueAccessor:k}),ee=i(null),{customHoverBehavior:te}=Vr({selection:$,linkedHover:F,unwrapData:!0,onObservation:W,chartType:"RealtimeHeatmap",chartId:z}),ne=l(e=>{T&&T(e),te(e)},[T,te]);p(o,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ee.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=ys(Y,Q[0],Q[1],G),ie=oe?null:ps(b,Q[0],Q[1],q),re=X?`${f||""} semiotic-emphasis-${X}`.trim():f,se=ru(v,b);return oe||ie||e(or,{ref:ee,chartType:"heatmap",runtimeMode:"streaming",size:Q,margin:Z,className:re,arrowOfTime:y,windowMode:m,windowSize:se,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:S,extentPadding:O,heatmapXBins:C,heatmapYBins:_,heatmapAggregation:j,showAxes:U,background:M,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:ne,annotations:N,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:D,decay:I,pulse:R,staleness:H,legendPosition:V,pointIdAccessor:n.pointIdAccessor})});hu.displayName="RealtimeHeatmap";const[gu]=be(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function fu(e,t){return Ls(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:i=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),pu(s,a),"svg"===n){const e=(new XMLSerializer).serializeToString(a);yu(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*i,n=l.height*i,s=document.createElement("canvas");s.width=t,s.height=n;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,n),c.scale(i,i);const d=e.querySelector("canvas");d&&c.drawImage(d,0,0,l.width,l.height);const u=(new XMLSerializer).serializeToString(a),h=new Blob([u],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(n=>{n?(yu(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function pu(e,t){var n;const o=e.children,i=t.children,r=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const o=r.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,i.length)>e;e++)pu(o[e],i[e])}function yu(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const mu={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"},axisExtent:{type:"string",enum:["nice","exact"]},frameProps:{type:"object"},onClick:{type:"function"}},vu={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},bu={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},xu=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],ku=["vertical","horizontal"],wu={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),vu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xu},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),vu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xu},gradientFill:{type:["boolean","object"]},semanticGradient:{type:"array"},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},DifferenceChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),vu),{data:{type:"array"},xAccessor:{type:["string","function"]},seriesAAccessor:{type:["string","function"]},seriesBAccessor:{type:["string","function"]},seriesALabel:{type:"string"},seriesBLabel:{type:"string"},seriesAColor:{type:"string"},seriesBColor:{type:"string"},showLines:{type:"boolean"},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},curve:{type:"string",enum:xu},areaOpacity:{type:"number"},gradientFill:{type:["boolean","object"]},xExtent:{type:"array"},yExtent:{type:"array"},pointIdAccessor:{type:["string","function"]},windowSize:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),vu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xu},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({},mu),vu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),vu),{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"},regression:{type:["boolean","string","object"]}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),vu),{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({},mu),vu),{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({},mu),vu),{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({},mu),vu),{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({},mu),vu),{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"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ku},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"},regression:{type:["boolean","string","object"]}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ku},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({},mu),bu),{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:ku},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ku},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({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ku},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({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ku},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mu),bu),{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({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ku},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({},mu),bu),{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({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ku},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"},regression:{type:["boolean","string","object"]}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},mu),{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({},mu),{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:"none",dataAccessors:[],props:Object.assign(Object.assign({},mu),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},gradientFill:{type:"object"},arcWidth:{type:"number"},cornerRadius:{type:"number"},sweep:{type:"number"},fillZones:{type:"boolean"},showNeedle:{type:"boolean"},needleColor:{type:"string"},color:{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({},mu),bu),{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({},mu),bu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},roundedTop:{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({},mu),{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({},mu),{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:ku},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"}})},ProcessSankey:{required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},mu),{nodes:{type:"array"},edges:{type:"array"},domain:{type:"array"},axisTicks:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},startTimeAccessor:{type:["string","function"]},endTimeAccessor:{type:["string","function"]},xExtentAccessor:{type:["string","function"]},edgeIdAccessor:{type:["string","function"]},legendPosition:{type:"string",enum:["right","left","top","bottom"]},pairing:{type:"string",enum:["value","temporal"]},packing:{type:"string",enum:["off","reuse"]},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"]},ribbonLane:{type:"string",enum:["source","target","both"]},lifetimeMode:{type:"string",enum:["full","half"]},showLaneRails:{type:"boolean"},showQualityReadout:{type:"boolean"},edgeOpacity:{type:"number"},timeFormat:{type:"function"},valueFormat:{type:"function"},showParticles:{type:"boolean"},particleStyle:{type:"object"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},mu),{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({},mu),{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({},mu),{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"]},nodeStyle:{type:"function"}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},mu),{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({},mu),{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"},direction:{type:"string",enum:["up","down"]},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"}}},TemporalHistogram:{required:["data","binSize"],dataShape:"array",dataAccessors:["timeAccessor","valueAccessor","categoryAccessor"],props:{data:{type:"array"},binSize:{type:"number"},direction:{type:"string",enum:["up","down"]},size:{type:"array"},width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"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"},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},linkedHover:{type:["boolean","string","object"]},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","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({},mu),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},mu),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},mu),{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({},mu),{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({},mu),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},mu),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Au(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function Su(e,t){const n=[],o=wu[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(wu).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(!Au(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=bs(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=ws({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=As({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=Ss({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}}const Ou=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Cu=new Set(["data","nodes","edges"]),_u="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function ju(e,t,n){if(!wu[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(wu).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),i={};for(const[e,n]of Object.entries(t))null!=n&&(Ou.has(e)||!o&&Cu.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(i[e]=_u(n))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Mu(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!wu[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:_u(e.props)}}function Pu(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Lu(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Tu(e){return Ls(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Nu(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function Nu(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function Bu(){const n=function(){const e=o.useContext(Ho);return e?()=>e.setVisible(e=>!e):null}();return n?e("button",{className:"semiotic-chart-action",onClick:n,title:"Data summary","aria-label":"Toggle data summary",style:Hu,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const Eu={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function Du({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function Iu({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const Ru=o.forwardRef(function({title:i,subtitle:r,children:s,width:a="100%",height:l=400,actions:c,chartConfig:d,controls:u,loading:h=!1,error:g,errorBoundary:f=!1,status:p,detailsPanel:y,className:m,style:v},b){const x=o.useRef(null),k=o.useRef(null),[w,A]=o.useState(!1),S=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),O=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),C=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&d,_=!0===(null==c?void 0:c.dataSummary),j="object"==typeof(null==c?void 0:c.export)?c.export:{},M="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",P=o.useCallback(e=>Ls(this,void 0,void 0,function*(){k.current&&(yield fu(k.current,Object.assign(Object.assign({},j),e)))}),[j]),L=o.useCallback(()=>{x.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):x.current.requestFullscreen().catch(()=>{}))},[]),T=o.useCallback(e=>Ls(this,void 0,void 0,function*(){d&&(yield Tu(d,e||M||"json"))}),[d,M]);o.useEffect(()=>{const e=()=>{A(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),o.useImperativeHandle(b,()=>({export:P,toggleFullscreen:L,copyConfig:T,element:x.current}),[P,L,T]);const N=i||r||u||S||O||C||_||p,B=h?e(Du,{height:l}):g?e(Iu,{error:g}):f?e(cs,{children:s}):s;return E=t(n,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:x,className:"semiotic-chart-container"+(m?" "+m:""),style:Object.assign(Object.assign({width:a,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),v),children:[N&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[u,S&&e("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Export chart","aria-label":"Export chart",style:Hu,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),_&&e(Bu,{}),O&&e("button",{className:"semiotic-chart-action",onClick:L,title:w?"Exit fullscreen":"Fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",style:Hu,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(n,w?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),C&&e("button",{className:"semiotic-chart-action",onClick:()=>T(),title:"Copy config","aria-label":"Copy chart configuration",style:Hu,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),p&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Eu[p].bg,color:Eu[p].color,lineHeight:"18px"},children:p})]})]}),t("div",{className:"semiotic-chart-body",ref:k,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},w?{flex:1}:{height:l}),children:[B,y]})]})]}),_?e(Fo,{children:E}):E;var E}),Hu={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function Fu({children:t,columns:n="auto",minCellWidth:i=300,gap:r=16,className:s,style:a}){const l="number"==typeof n?n:void 0;return e("div",{className:"semiotic-chart-grid"+(s?" "+s:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},a),children:o.Children.map(t,t=>o.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function $u({children:n,context:o,position:i="right",contextSize:r=250,gap:s=12,className:a,style:l}){const c="left"===i||"right"===i,d="left"===i||"top"===i,u=Object.assign({display:"flex",flexDirection:c?d?"row-reverse":"row":d?"column-reverse":"column",gap:s,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:n}),e("div",{style:h,children:o})]})}Fu.displayName="ChartGrid",$u.displayName="ContextLayout";function Wu({children:n,position:o="right",size:r=300,trigger:a="click",chartId:c,observation:d,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[m,v]=u(null),[b,x]=u(null),[k,w]=u(!1),[A,S]=u(!1),O=i(null),C=i(void 0),_="click"===a?["click","click-end"]:["hover","hover-end"],{latest:j}=br({types:_,chartId:c,limit:1}),M=void 0!==d?d:j;s(()=>{if(M)if("click"===M.type||"hover"===M.type){const e=M;v(e.datum),x(e),k||(w(!0),S(!0),clearTimeout(C.current),C.current=setTimeout(()=>S(!1),200))}else!h||"click-end"!==M.type&&"hover-end"!==M.type||P()},[M]),s(()=>{null==f||f(k)},[k,f]);const P=l(()=>{S(!0),w(!1),clearTimeout(C.current),C.current=setTimeout(()=>{S(!1),v(null),x(null)},200)},[]);if(s(()=>()=>clearTimeout(C.current),[]),!m&&!A)return null;const L=m&&b?n(m,b):null;if(null===L&&!A)return null;const T=function(e,t,n,o){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(o,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${o}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:zu,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const zu={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};Wu.displayName="DetailsPanel";const Yu=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Gu=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),qu=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Xu=new Set(["LineChart","AreaChart","StackedAreaChart"]),Vu=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Uu(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 Ku(e,t){const n=Uu(e),o=Uu(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Zu=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Qu(e,t){const n=[],o=Su(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return wu[e]?(function(e,t,n){const o=wu[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=wu[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){Yu.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){Gu.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=wu[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(!qu.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(!Xu.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=wu[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(!Vu.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=Ku(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=Ku(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 Zu)"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}}function Ju(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function eh(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function th(e){return"nominal"===e||"ordinal"===e}function nh(e){return"quantitative"===e||"temporal"===e}const oh={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},ih={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},rh={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function sh(e){var t,n,o,i,r,s,a,l,c,d,u,h;const g=[],{type:f,markProps:p}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:Ps(e,["type"])}}(e.mark),y=e.encoding||{},m=y.x,v=y.y,b=y.color,x=y.size,k=y.theta,w=y.opacity;let A;(null===(t=e.data)||void 0===t?void 0:t.values)?A=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&g.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&g.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&g.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&g.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||y.facet||y.row||y.column)&&g.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&g.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&g.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const S={};e.width&&(S.width=e.width),e.height&&(S.height=e.height);const O=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(O&&(S.title=O),(null==b?void 0:b.field)&&(S.colorBy=b.field,null===(o=b.scale)||void 0===o?void 0:o.scheme)){const e=oh[b.scale.scheme];e&&(S.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(S.pointOpacity=w.value);const C=null==m?void 0:m.aggregate,_=null==v?void 0:v.aggregate;if(A&&(C||_)){const e=_?v:m,t=_?m:v,n=rh[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)A=function(e,t){const{groupBy:n,value:o,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[n]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[o]))}const s=[];for(const[e,t]of r){let o;switch(i){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}s.push({[n]:e,value:o})}return s}(A,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&A){const e=new Map;for(const n of A){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}A=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";A&&(S.data=A),(null==m?void 0:m.bin)?(S.valueAccessor=m.field,(null==v?void 0:v.field)&&(S.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(S.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(S.valueAccessor=v.field,(null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(S.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),n="object"==typeof t?t.maxbins:void 0;return n&&(S.bins=n),lh(e,S,g)}let j;switch(f){case"bar":j=function(e,t,n,o,i,r,s){var a,l,c,d,u,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",th(null==e?void 0:e.type)&&nh(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):nh(null==e?void 0:e.type)&&th(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=r?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=s?"value":t.field),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),i&&(o.data=i),g}(m,v,b,S,A,C,_);break;case"line":if(j="LineChart",ah(m,v,S,C,_),(null==b?void 0:b.field)&&(S.lineBy=b.field),p.interpolate){const e=ih[p.interpolate];e&&(S.curve=e)}!0===p.point&&(S.showPoints=!0),A&&(S.data=A);break;case"area":if((null==b?void 0:b.field)?(j="StackedAreaChart",S.areaBy=b.field):j="AreaChart",ah(m,v,S,C,_),p.interpolate){const e=ih[p.interpolate];e&&(S.curve=e)}void 0!==p.opacity&&(S.areaOpacity=p.opacity),A&&(S.data=A);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(j="BubbleChart",S.sizeBy=x.field,(null===(s=x.scale)||void 0===s?void 0:s.range)&&(S.sizeRange=x.scale.range)):j="Scatterplot",ah(m,v,S,C,_),A&&(S.data=A);break;case"rect":j="Heatmap",(null==m?void 0:m.field)&&(S.xAccessor=m.field),(null==v?void 0:v.field)&&(S.yAccessor=v.field),(null==b?void 0:b.field)&&(S.valueAccessor=b.field,delete S.colorBy),(null===(a=null==m?void 0:m.axis)||void 0===a?void 0:a.title)&&(S.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(S.yLabel=v.axis.title),A&&(S.data=A);break;case"arc":p.innerRadius&&p.innerRadius>0?(j="DonutChart",S.innerRadius=p.innerRadius):j="PieChart",(null==k?void 0:k.field)?S.valueAccessor=k.field:(null==v?void 0:v.field)&&(S.valueAccessor=_?"value":v.field),(null==b?void 0:b.field)&&(S.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(S.categoryAccessor=m.field),A&&(S.data=A);break;case"tick":j="DotPlot",th(null==m?void 0:m.type)?(S.categoryAccessor=m.field,(null==v?void 0:v.field)&&(S.valueAccessor=_?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(S.categoryLabel=m.axis.title),(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(S.valueLabel=v.axis.title)):th(null==v?void 0:v.type)?(S.categoryAccessor=v.field,(null==m?void 0:m.field)&&(S.valueAccessor=C?"value":m.field),S.orientation="horizontal",(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(S.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(S.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null==v?void 0:v.field)&&(S.valueAccessor=_?"value":v.field)),A&&(S.data=A);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),j="Scatterplot",ah(m,v,S,C,_),A&&(S.data=A)}return lh(j,S,g)}function ah(e,t,n,o,i){var r,s;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(n.xLabel=e.axis.title),(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(n.yLabel=t.axis.title)}function lh(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}export{Ys as AreaChart,il as BarChart,dl as BoxPlot,ea as BubbleChart,va as CandlestickChart,rr as CategoryColorProvider,Ru as ChartContainer,Fu as ChartGrid,Td as ChordDiagram,Zd as CirclePack,Js as ConnectedScatterplot,$u as ContextLayout,Wu as DetailsPanel,qs as DifferenceChart,yl as DonutChart,gl as DotPlot,Ld as ForceDirectedGraph,Sl as FunnelChart,Al as GaugeChart,sl as GroupedBarChart,ta as Heatmap,ul as Histogram,Nl as LikertChart,Rs as LineChart,jr as LinkedCharts,ua as MinimapChart,ma as MultiAxisLineChart,yi as MultiLineTooltip,Jd as OrbitDiagram,pl as PieChart,Vd as ProcessSankey,ha as QuadrantChart,hu as RealtimeHeatmap,lu as RealtimeHistogram,su as RealtimeLineChart,du as RealtimeSwarmChart,uu as RealtimeWaterfallChart,fl as RidgelinePlot,Nd as SankeyDiagram,Zs as Scatterplot,ca as ScatterplotMatrix,Xs as StackedAreaChart,rl as StackedBarChart,ll as SwarmPlot,Bl as SwimlaneChart,cu as TemporalHistogram,Hr as ThemeProvider,gu as TooltipProvider,Ud as TreeDiagram,Kd as Treemap,hl as ViolinPlot,Nu as configToJSX,Tu as copyConfig,eh as deserializeSelections,Qu as diagnoseConfig,fu as exportChart,Mu as fromConfig,Lu as fromURL,sh as fromVegaLite,Ju as serializeSelections,ju as toConfig,Pu as toURL,mr as useBrushSelection,sr as useCategoryColors,br as useChartObserver,vr as useFilteredData,pr as useLinkedHover,fr as useSelection,Fr as useTheme,Su as validateProps};
|