semiotic 3.5.4 → 3.6.0

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.
Files changed (94) hide show
  1. package/CLAUDE.md +61 -3
  2. package/README.md +17 -10
  3. package/ai/dist/mcp-server.js +249 -2
  4. package/ai/schema.json +34 -9
  5. package/ai/system-prompt.md +1 -1
  6. package/dist/components/ai/audienceProfile.d.ts +90 -0
  7. package/dist/components/ai/audiences.d.ts +31 -0
  8. package/dist/components/ai/chartCapabilities.d.ts +55 -0
  9. package/dist/components/ai/chartCapabilityTypes.d.ts +196 -0
  10. package/dist/components/ai/diffProfile.d.ts +51 -0
  11. package/dist/components/ai/inferIntent.d.ts +24 -0
  12. package/dist/components/ai/intents.d.ts +34 -0
  13. package/dist/components/ai/profileData.d.ts +16 -0
  14. package/dist/components/ai/qualityFixtures.d.ts +2 -0
  15. package/dist/components/ai/qualityScorecard.d.ts +82 -0
  16. package/dist/components/ai/repairChartConfig.d.ts +73 -0
  17. package/dist/components/ai/streamingTypes.d.ts +64 -0
  18. package/dist/components/ai/suggestCharts.d.ts +76 -0
  19. package/dist/components/ai/suggestDashboard.d.ts +92 -0
  20. package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
  21. package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
  22. package/dist/components/ai/useChartSuggestions.d.ts +22 -0
  23. package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
  24. package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
  25. package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
  26. package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
  27. package/dist/components/charts/index.d.ts +1 -1
  28. package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
  29. package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
  30. package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
  31. package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
  32. package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
  33. package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
  34. package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
  35. package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
  36. package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
  37. package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
  38. package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
  39. package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
  40. package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
  41. package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
  42. package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
  43. package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
  44. package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
  45. package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
  46. package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
  47. package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
  48. package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
  49. package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
  50. package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
  51. package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
  52. package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
  53. package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
  54. package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
  55. package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
  56. package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
  57. package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
  58. package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
  59. package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
  60. package/dist/components/charts/shared/chartSpecs.d.ts +0 -34
  61. package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
  62. package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
  63. package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
  64. package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
  65. package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
  66. package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
  67. package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
  68. package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
  69. package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
  70. package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
  71. package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
  72. package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
  73. package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
  74. package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
  75. package/dist/components/data/DataSummarizer.d.ts +45 -0
  76. package/dist/components/semiotic-ai.d.ts +35 -0
  77. package/dist/components/semiotic-xy.d.ts +1 -1
  78. package/dist/components/semiotic.d.ts +1 -1
  79. package/dist/components/store/useChartFocus.d.ts +43 -0
  80. package/dist/components/store/useChartInterrogation.d.ts +141 -0
  81. package/dist/ordinal.min.js +1 -1
  82. package/dist/ordinal.module.min.js +1 -1
  83. package/dist/semiotic-ai.d.ts +35 -0
  84. package/dist/semiotic-ai.min.js +1 -1
  85. package/dist/semiotic-ai.module.min.js +1 -1
  86. package/dist/semiotic-utils.min.js +1 -1
  87. package/dist/semiotic-utils.module.min.js +1 -1
  88. package/dist/semiotic-xy.d.ts +1 -1
  89. package/dist/semiotic.d.ts +1 -1
  90. package/dist/semiotic.min.js +1 -1
  91. package/dist/semiotic.module.min.js +1 -1
  92. package/dist/xy.min.js +1 -1
  93. package/dist/xy.module.min.js +1 -1
  94. package/package.json +13 -4
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),o=require("d3-selection"),n=require("d3-brush"),i=require("d3-scale"),r=require("d3-quadtree"),s=require("d3-shape"),a=require("d3-array"),l=require("d3-hierarchy"),c=require("regression"),u=require("d3-interpolate"),d=require("d3-force"),h=require("d3-chord");function g(e){return e&&e.__esModule?e:{default:e}}function f(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const o in e)if("default"!==o){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}return t.default=e,Object.freeze(t)}const p=f(t),y=g(c);function m(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 v(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 b({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:y}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(d);k.current=d;const w=t.useRef(u);w.current=u;const j=t.useMemo(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),A=t.useRef(j);A.current=j;const S=t.useRef(!1),O=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=o.select(b.current).select(".brush-g"),t="x"===c?n.brushX():"y"===c?n.brushY():n.brush();return t.extent([[0,0],[i,r]]),t.on("brush end",o=>{if(S.current)return;const n=w.current;if(!n)return;if(!o.selection)return O.current=null,void k.current(null);let s,a;if("x"===c){const[e,t]=o.selection;s=[n.x.invert(e),n.x.invert(t)],a=[n.y.invert(r),n.y.invert(0)]}else if("y"===c){const[e,t]=o.selection;s=[n.x.invert(0),n.x.invert(i)],a=[n.y.invert(t),n.y.invert(e)]}else{const[[e,t],[i,r]]=o.selection;s=[n.x.invert(e),n.x.invert(i)],a=[n.y.invert(r),n.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===o.type||"brush"===o.type&&p)){const i=A.current;i&&i.length>0?s=function(e,t){return 0===t.length?e:[m(e[0],t),v(e[1],t)]}(s,i):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const r=n.x(s[0]),a=n.x(s[1]);if(S.current=!0,"x"===c)e.call(t.move,[r,a]);else if("xy"===c){const n=o.selection;e.call(t.move,[[r,n[0][1]],[a,n[1][1]]])}S.current=!1}const l={x:s,y:a};O.current=l,k.current(l)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,r,c,g,h,p]),t.useEffect(()=>{if(!(y&&u&&x.current&&O.current))return;if(!b.current)return;if("y"===c)return;const e=O.current,t=u.x.domain()[0],n=o.select(b.current).select(".brush-g");if(t>=e.x[1])return S.current=!0,n.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);let i=e.x[0],r=!1;if(t>e.x[0]){if(i=t,"bin"===g){const e=A.current;e&&e.length>0?i=v(t,e):h&&h>0&&(i=Math.ceil(t/h)*h)}if(i>=e.x[1])return S.current=!0,n.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);r=!0}const s=u.x(i),a=u.x(e.x[1]);if(S.current=!0,"x"===c)n.call(x.current.move,[s,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(x.current.move,[[s,t],[a,o]])}if(S.current=!1,r){const t={x:[i,e.x[1]],y:e.y};O.current=t,k.current(t)}},[u,y,c,g,h]),e.jsx("svg",{ref:b,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}const x=Object.freeze([]);function k(e){if(!e)return x;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class w{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=k(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=k(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 j(o){let n=null;const i=()=>(n||(n=t.createContext(null)),n),r=A(o);return[function({children:n,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>A(o,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:n})},e=>{var o;const n=i(),s=null!==(o=t.useContext(n))&&void 0!==o?o:r,a=t.useRef(e);a.current=e;const l=t.useCallback(()=>a.current(s.getState()),[s]),c=t.useCallback(()=>a.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,l,c)}]}function A(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 S(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 O(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:M})})),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 M=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],C={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}},_={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}},P={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:M,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 L(e,t){if("light"===t)return C;if("dark"===t)return _;if("high-contrast"===t)return P;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?_:C;return O(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 O(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[T,R]=j(e=>({theme:C,setTheme(t){e(e=>({theme:L(e.theme,t)}))}}));class B{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 E{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function N(e,t,o,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 $(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 D(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),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function H(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,u=0;for(const e of t){const t=o(e,s)||0;l+=(2*u+t)*(t-(o(e,r)||0)),c+=t,u+=t}const d=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,d-(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 I(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 F(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 W(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 z(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Y(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function G(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function X(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function V(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function U(e){const t=e.map(X),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return V(e,o,n)}if(e>=1){const[e,n,i]=t[o];return V(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return V(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const K=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Q=U(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Z=U(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),J=U(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ee=U(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),te=U(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),oe=U(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ne=U(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ie=U(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),re=U(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),se=U(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ae=U(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),le=U(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),ce=U(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ue=U(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),de=U(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),he=U(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ge=U(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),fe=U(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),pe=U(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ye={category10:K,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:Q,reds:Z,greens:J,oranges:ee,purples:te,viridis:ne,plasma:ie},me=K,ve=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],be=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],xe=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 ke(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")||xe.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):me[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))%me.length]}function we(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+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return i.scaleOrdinal().domain(n).range(o).unknown("#999");const s=ye[o]||ye.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:me;return i.scaleOrdinal().domain(n).range(e).unknown("#999")}}function je(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 Ae(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 Se(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 Oe(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Me(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Ce(e,t,o){return e+(t-e)*o}function _e(){return"undefined"!=typeof performance?performance.now():Date.now()}function Pe(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 Le(e,t,o,n){return"function"==typeof t.style?t.style(n||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,n)}function Te(e,t,o,n){if(!e.scales)return null;const i=[],r=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=n.getTop(o),a=n.getBottom(o);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),r.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:Le(e,n,o,t[0]),datum:t,group:o,interactive:n.interactive}}function Re(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const n of e)n.perSeries?t.push(n):o.push(n);return{perSeries:t,aggregate:o}}function Be(e,t,o){const n=[];for(const i of o){const o=Te(e,t,"__ribbon_aggregate",i);o&&n.push(o)}return n}function Ee(e,t,o,n){const i=[];for(const r of n){const n=Te(e,t,o,r);n&&i.push(n)}return i}function Ne(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const n of t){if("band"!==n.kind)continue;const t=n.getTop(e),i=n.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&o.push({y0:i,y1:t})}return 0===o.length?e:Object.assign(Object.assign({},e),{band:o[0],bands:o})}function $e(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=I(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const De={topOpacity:.8,bottomOpacity:.05};function He(e){var t,o;if(e)return!0===e?De:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:De.topOpacity,bottomOpacity:null!==(o=e.bottomOpacity)&&void 0!==o?o:De.bottomOpacity}}const Ie={blues:Q,reds:Z,greens:J,viridis:ne,oranges:ee,purples:te,greys:oe,plasma:ie,inferno:re,magma:se,cividis:ae,turbo:le},Fe=new Map;function We(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function ze(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,n=We(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=Y(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:We(e.y1Accessor,"y1"),getBottom:We(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Ye{constructor(e){if(this.xExtent=new E,this.yExtent=new E,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 B(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Y(e.timeAccessor||e.xAccessor,"time"),this.getY=Y(e.valueAccessor||e.yAccessor,"value")):(this.getX=Y(e.xAccessor,"x"),this.getY=Y(e.yAccessor,"y")),this.getGroup=q(e.groupAccessor),this.getCategory=q(e.categoryAccessor),this.getSize=e.sizeAccessor?Y(e.sizeAccessor,"size"):void 0,this.getColor=q(e.colorAccessor),this.getY0=e.y0Accessor?Y(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=ze(e),this.getPointId=q(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Y(e.openAccessor,"open"):void 0,this.getHigh=Y(e.highAccessor,"high"),this.getLow=Y(e.lowAccessor,"low"),this.getClose=o?Y(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new B(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 o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(n)&&this.yExtent.push(n)}}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?Y(this.config.timeAccessor||this.config.xAccessor,"time"):Y(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)if(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));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}}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);if(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));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}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 o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(n)&&this.yExtent.evict(n)}}}return!0}computeScene(e){var t,o,n,r,s,a,l,c,u,d,h,g,f,p;const{config:y,buffer:m}=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(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(o=y.xExtent[0])&&void 0!==o?o:b[0],null!==(n=y.xExtent[1])&&void 0!==n?n:b[1]]:b,w=y.yExtent?[null!==(r=y.yExtent[0])&&void 0!==r?r:x[0],null!==(s=y.yExtent[1])&&void 0!==s?s:x[1]]:x;const j=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1],A="exact"===y.axisExtent;if("stackedarea"===y.chartType&&!j&&m.size>0)if(y.normalize)w=[0,A?1:1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(a=y.baseline)&&void 0!==a?a:"zero"}:${null!==(l=y.stackOrder)&&void 0!==l?l:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=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!==(c=y.stackOrder)&&void 0!==c?c:"key",l=(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:l(e,t)}),o=[],n=[];let i=0,r=0;for(const t of e)r>i?(o.push(t),i+=null!==(u=s.get(t))&&void 0!==u?u: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:l(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:l(e,t)}):t.map(e=>e.key).sort(l);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(n).sort((e,t)=>e-t),t=H(e,f,(e,t)=>{var n;return(null===(n=o.get(e))||void 0===n?void 0:n.get(t))||0},y.baseline);let i=1/0,s=-1/0;for(const o of e){const e=null!==(h=t.get(o))&&void 0!==h?h:0,n=null!==(g=r.get(o))&&void 0!==g?g: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=A?0:a>0?a*y.extentPadding:1;w=[i-l,s+l]}else w=[0,i+(A?0:i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!j&&m.size>0){const[,e]=function(e,t,o,n,i){const r=N(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]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,A?e:e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!j&&m.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]}(m,this.getY),o=t-e,n=A?0:o>0?o*y.extentPadding:1;w=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!j&&w[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of v)for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&(w[0]>o&&(w[0]=o),o>w[1]&&(w[1]=o)),Number.isFinite(n)&&(w[0]>n&&(w[0]=n),n>w[1]&&(w[1]=n))}const e=w[1]-w[0],t=A?0:e>0?e*y.extentPadding:1,o=null===(f=y.yExtent)||void 0===f?void 0:f[0],n=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=o?w[0]:w[0]-t,null!=n?w[1]:w[1]+t],"log"!==y.yScaleType||w[0]>0||0>=x[0]||A||(w[0]=null!=o?w[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!j){const e=y.yExtent[0],t=y.yExtent[1];null==e&&null==t||(w=[null!=e?e:w[0],null!=t?t:w[1]])}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const S="streaming"===y.runtimeMode,O=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(S)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[O,e.width-O]:[e.width-O,O];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-O,O])}}else{const t="down"===y.arrowOfTime?[O,e.height-O]:[e.height-O,O];this.scales={x:i.scaleLinear().domain(w).range([O,e.width-O]),y:i.scaleLinear().domain(k).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 i.scaleLog().domain(e).range(o).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(o):i.scaleLinear().domain(t).range(o)};this.scales={x:t(y.xScaleType,k,[O,e.width-O]),y:t(y.yScaleType,w,[e.height-O,O])}}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,Ye.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=r.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(),r=this.scales.y.domain(),s=this.scales.x.range(),a=this.scales.y.range(),l=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(o).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(o):i.scaleLinear().domain(t).range(o)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=a[1]>a[0];this.scales={x:l(this.config.xScaleType,n,s[0]>s[1]?[e.width-c,c]:[c,e.width-c]),y:l(this.config.yScaleType,r,u?[c,e.height-c]:[e.height-c,c])},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:u}=this;if(!u)return[];if(c.customLayout){const l=null!==(o=c.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,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:ve},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(d)}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 d={scales:u,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 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.ribbons&&e.ribbons.length>0){const{perSeries:o,aggregate:r}=Re(e.ribbons);if(r.length>0&&i.push(...Be(e,t,r)),o.length>0)for(const t of n)i.push(...Ee(e,t.data,t.key,o))}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=$(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 $e(e,n,i),i}(d,t);case"area":return function(e,t){const o=e.groupData(t),n=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Re(e.ribbons);if(r.length>0&&n.push(...Be(e,t,r)),i.length>0)for(const t of o)n.push(...Ee(e,t.data,t.key,i))}const 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=D(t.data,e.scales,e.getX,e.getY,i,o,t.key,r),a=He(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),n.push(s)}return $e(e,o,n),n}(d,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Re(e.ribbons);if(r.length>0&&n.push(...Be(e,t,r)),i.length>0)for(const t of o)n.push(...Ee(e,t.data,t.key,i))}const 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=D(t.data,e.scales,e.getX,e.getY,r,o,t.key,s),a=He(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),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=$(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 $e(e,o,n),n}(d,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,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,o,n,i,r,s,a="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).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 d){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=H(d,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,m=new Map;for(const e of d)m.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 d){let i=e.get(o)||0;const s=m.get(o);r&&(i/=g.get(o));const c=s+i,u=t.x(o);a.push([u,t.y(s)]),n.push([u,t.y(c)]),m.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,u),g=d;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)};$e(e,s,g,o)}return g}(d,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,u=I(o,e.scales,e.getX,e.getY,r,t,c);u&&n.push(u)}return n}(d,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=Y(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||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 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-u)/f),s-1),d=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(n);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=o.width/s,j=o.height/a,A=e.config.showValues,S=e.config.heatmapValueFormat,O=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===m[n])continue;let i;switch(l){case"sum":i=v[n];break;case"mean":i=v[n]/m[n];break;default:i=m[n]}const r=(i-b)/k;O.push(W(o*w,(a-1-e)*j,w,j,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:m[n],sum:v[n],xCenter:u+(o+.5)*f,yCenter:h+(e+.5)*p,agg:l},A?{value:i,showValues:!0,valueFormat:S}:void 0))}}return O}(e,t,o);if(0===t.length)return[];const n=Y(e.config.valueAccessor,"value"),i=G(e.config.xAccessor,"x"),r=G(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),u=r(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)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 o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=n(o),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=o}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 j=function(e){const t=e in Ie?e:"blues";let o=Fe.get(t);if(o)return o;o=Array(256);const n=Ie[t]||Q;for(let e=0;256>e;e++)o[e]=n(e/255);return Fe.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),S=o.width/u,O=o.height/d,M=e.config.showValues,C=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const o=y[e],n=o%u;_.push(W(n*S,(d-1-(o-n)/u)*O,S,O,j[Math.min((t-k)*A+.5|0,255)],v[e],M?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(d,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=N(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(),u=e.config.barStyle,d=null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.opacity=u.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),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 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==u?void 0:u.fill)||d||"#4e79a7";s.push(F(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)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(F(v,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==u?void 0:u.fill)||d||"#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)}}(d,t);return this._barCategoryCache=null!==(l=d.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||{},u=null!==(o=c.radius)&&void 0!==o?o:3,d=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=d;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:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(d,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const u=[],d=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 u;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,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 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=d.x(i),c=0!==a?d.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 j=d.y(x),A=d.y(s),S=Math.min(j,A),O=Math.abs(j-A),M={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(M.opacity=b),u.push(F(k,S,w,O,M,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 u}(d,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",u=i?a:s.wickColor||"#333",d=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:u,wickWidth:d,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(d,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?Ae(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]=Ae(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]=Ae(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=Ae(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=Ae(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=Se(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=Se(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],u=Pe(e,c,l);u&&("point"===c.type?o.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.set(u,{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(u,{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(u,{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(u,{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=Pe(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,u,d,h,g,f,p,y,m,v,b,x,k,w,j,A,S,O,M,C,_,P,L,T,R,B,E,N,$,D,H,I,F,W,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=Pe(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!==(u=r.style.opacity)&&void 0!==u?u: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!==(d=L.r)&&void 0!==d?d: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!==(A=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==A?A: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!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(O=L.highY)&&void 0!==O?O:r.highY,r.lowY=null!==(M=L.lowY)&&void 0!==M?M:r.lowY,X=!0)}else r._targetOpacity=null!==(_=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_: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!==(R=t.opacity)&&void 0!==R?R: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!==(B=t.w)&&void 0!==B?B:0,h:null!==(E=t.h)&&void 0!==E?E:0,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N: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!==($=t.w)&&void 0!==$?$:0,h:null!==(D=t.h)&&void 0!==D?D:0,fill:"#999",datum:null,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(I=t.openY)&&void 0!==I?I:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(F=t.closeY)&&void 0!==F?F:n,highY:null!==(W=t.highY)&&void 0!==W?W:n,lowY:null!==(z=t.lowY)&&void 0!==z?z: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:_e(),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 u=Me(e,o.activeTransition),d=Oe(u,"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=Ce(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==e._targetR&&void 0!==o.r&&(e.r=Ce(o.r,e._targetR,d))}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=Ce(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,d)),void 0!==o.h&&(e.h=Ce(o.h,e._targetH,d))}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:Ce(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,d)),void 0!==o.h&&(e.h=Ce(o.h,e._targetH,d))}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:Ce(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),void 0!==o.openY&&(e.openY=Ce(o.openY,e._targetOpenY,d)),void 0!==o.closeY&&(e.closeY=Ce(o.closeY,e._targetCloseY,d)),void 0!==o.highY&&(e.highY=Ce(o.highY,e._targetHighY,d)),void 0!==o.lowY&&(e.lowY=Ce(o.lowY,e._targetLowY,d))}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:Ce(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);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]=Ce(t[n][0],o[n][0],d),e.path[n][1]=Ce(t[n][1],o[n][1],d)}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:Ce(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);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]=Ce(t[o][0],n[o][0],d),e.topPath[o][1]=Ce(t[o][1],n[o][1],d);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Ce(o[t][0],i[t][0],d),e.bottomPath[t][1]=Ce(o[t][1],i[t][1],d)}}if(u>=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||ve,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)||ve;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Ye.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||"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||!z(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),u=l||!z(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Y(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Y(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Y(this.config.xAccessor,"x"),this.getY=Y(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=ze(this.config)),s=!0,a=!0)}if("groupAccessor"in e&&!z(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?q(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!z(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?q(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!z(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Y(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!z(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!z(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Y(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),("boundsAccessor"in e&&!z(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=ze(this.config),s=!0,a=!0),"pointIdAccessor"in e&&!z(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?q(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!z(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!z(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!z(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!z(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Y(this.config.openAccessor,"open"):void 0,this.getHigh=Y(this.config.highAccessor,"high"),this.getLow=Y(this.config.lowAccessor,"low"),this.getClose=t?Y(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 Ge(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:p.createElement(p.Fragment,null,...t)}function qe(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 Xe(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Ve(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ue(e,t){const o=Ve(e);if(!o)return!1;const n=Ve(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function Ke(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Qe(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 u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);Xe(e.r,n)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}Ye.GROUP_COLOR_MAP_CAP=1e3,Ye.QUADTREE_THRESHOLD=500;const Ze=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Je=new WeakMap;let et=0,tt=!1,ot=null,nt=null,it=null;function rt(e,t){var o,n;if(!t)return t;const i=Ze.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(tt)return;if("undefined"==typeof window||"undefined"==typeof document)return;tt=!0;const e=()=>{et++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ot=new MutationObserver(e),ot.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{nt=window.matchMedia("(prefers-color-scheme: dark)"),it=e,"function"==typeof nt.addEventListener?nt.addEventListener("change",it):"function"==typeof nt.addListener&&nt.addListener(it)}catch(e){}}();let s=Je.get(r);s&&s.version===et||(s={version:et,map:new Map},Je.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 st(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 at(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function lt(e,t,o){return null==t?o:"string"!=typeof t?t:rt(e,t)||o}function ct(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)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,i,r,s),[h,g,f]=st(e,o);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function ut(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 dt=new WeakMap;function ht(e,t){const o=at(t);if(!o)return e;const n=dt.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,u]=i;for(let i=1;o>=i;i++){const d=i/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,r){i=[o,r],n.push([o,r])}};return s.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),n}(e,o);return dt.set(e,i),i}function gt(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Qe(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=pt(r,t,o,n);break;case"line":e=yt(r,t,o,n);break;case"rect":if(null==r.datum)break;e=vt(r,t,o);break;case"heatcell":e=bt(r,t,o);break;case"area":if(!1===r.interactive)break;e=kt(r,t,o);break;case"candlestick":e=xt(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ft(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=wt(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 pt(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Xe(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function yt(e,t,o,n=30){var i,r;if(0===e.path.length)return null;const s=wt(e.path,t);if(0>s)return null;const[a,l]=e.path[s];let c;if(e.path.length>1){let n=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=mt(t,o,i,r,a,l);n>c&&(n=c)}c=n}else{const e=t-a,n=o-l;c=Math.sqrt(e*e+n*n)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:a,y:l,distance:c}}function mt(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 u=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-u,2))}function vt(e,t,o){const n=qe(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function bt(e,t,o){const n=qe(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function xt(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 kt(e,t,o){if(0===e.topPath.length)return null;const n=wt(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 wt(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 jt(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 At(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 St(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?Ot(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Ot(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 Ot(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 Mt(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Ct(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function _t(e,o,n,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=o.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}const Pt={fill:(t,o)=>e.jsx("rect",{style:t,width:o,height:o}),line:(t,o)=>e.jsx("line",{style:t,x1:0,y1:0,x2:o,y2:o})};function Lt(e,t,o,n,i){let r;return r="function"==typeof o?o(e):(0,Pt[o])(n(e,t),i),r}function Tt({swatchSize:t}){return e.jsx("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 Rt(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Bt=(t,o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0;const m=!(!o&&!n),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:k}=d;return f.forEach((t,u)=>{const d=Lt(t,u,h,g,b),w=Rt(t,i,r),j=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${y})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?l===s&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?j||!1:void 0,"aria-current":m&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:m?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{c(l,u),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,j&&e.jsx(Tt,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k}),p};function Et({config:t,orientation:o="vertical",width:n=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+p.useId();if("horizontal"===o){const t=12,o=Math.min(n,200),a=Math.max(0,(n-o)/2),u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[0]+o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:o,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+o,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[1]-o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function Nt(t){const{legendGroups:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,g=function(e){var t,o,n,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!==(o=null==e?void 0:e.rowHeight)&&void 0!==o?o:22);return{swatchSize:s,labelGap:Math.max(0,null!==(n=null==e?void 0:e.labelGap)&&void 0!==n?n: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}}(h),[f,y]=p.useState(0),[m,v]=p.useState(0),b=p.useCallback((e,t)=>{y(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:o,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e.jsx("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.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:Bt(t,n,i,r,s,a,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:o||[],width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}):(({legendGroups:t,height:o,width:n,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var g;let f=0;const p=[];t.forEach((t,o)=>{var g;let y=0;t.label&&(y+=16);const m=((t,o,n,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=t,y=[],{swatchSize:m,labelGap:v,itemGap:b,rowHeight:x,align:k}=d,w=!(!o&&!n),j="isolate"===u||void 0===u&&null!=r,A=p.map(e=>m+v+7*e.label.length),S=[];let O=0,M=0;A.forEach((e,t)=>{const o=0===M?e:M+b+e;h&&h>0&&M>0&&o>h?(S.push({start:O,end:t,width:M}),O=t,M=e):M=o}),p.length>0&&S.push({start:O,end:p.length,width:M}),S.forEach((t,u)=>{let d="center"===k?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===k?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=p[h],k=Lt(t,h,g,f,m),S=Rt(t,i,r),O=r&&r.size>0&&r.has(t.label);y.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?l===s&&h===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&j?O||!1:void 0,"aria-current":w&&!j&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:w?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:w?e=>{c(l,h),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+v+2+7*t.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,O&&e.jsx(Tt,{swatchSize:m}),e.jsx("text",{y:m/2,x:m+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=A[h]+b}});const C=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,o,u,d,h,null!==(g=h.maxWidth)&&void 0!==g?g:n);y+=m.offset+5,p.push(Object.assign(Object.assign({label:t.label},m),{offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight})),f+=y+12});const y=null!==(g=h.maxWidth)&&void 0!==g?g:n;let m=f>y?0:"center"===h.align?Math.max(0,(y-f)/2):"end"===h.align?Math.max(0,y-f):0;const v=[];return p.forEach((n,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${m},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)),m+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+i)),m+=n.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),m+=12}),e.jsx("g",{children:v})})({legendGroups:o||[],title:l,height:u,width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}),k=!(!n&&!i);return e.jsxs("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),x]})}function $t(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Dt(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Ht(t){var o;const{legend:n,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!n)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(o=null==l?void 0:l.maxWidth)&&void 0!==o?o: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.jsx("g",{transform:`translate(${v}, ${b})`,children:Dt(n)?e.jsx(Et,{config:n.gradient,orientation:p?"horizontal":"vertical",width:m}):$t(n)?e.jsx(Nt,{legendGroups:n.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):n})}function It(e){return"string"==typeof e?{type:e}:e}function Ft({orient:o,config:n,values:i,scale:r,size:s,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),u="top"===o||"bottom"===o,d=t.useMemo(()=>{if(0===i.length)return null;const t=r.domain(),n=s-8;if("boxplot"===c.type){const t=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(!t)return null;const{q1:s,median:a,q3:l,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*n,20),f=(n-g)/2+4;if(u){const t=r(s),n=r(l),i=r(a),u=r(d),p=r(h),y="top"===o?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+o,children:[e.jsx("line",{x1:u,y1:m+y*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*f,x2:u,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,n),y:"top"===o?m-f-g:m+f,width:Math.abs(n-t),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===o?m-f-g:m+f,x2:i,y2:"top"===o?m-f:m+f+g,stroke:c.fill,strokeWidth:2})]})}{const t=r(s),n=r(l),i=r(a),u=r(d),p=r(h),y="left"===o?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+o,children:[e.jsx("line",{x1:m+y*(f+g/2),y1:u,x2:m+y*(f+g/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:u,x2:m+y*(f+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===o?m-f-g:m+f,y:Math.min(t,n),width:g,height:Math.abs(n-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===o?m-f-g:m+f,y1:i,x2:"left"===o?m-f:m+f+g,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=a.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+o,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/h*n;if(u){const n=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:n,y:"top"===o?-4-s:4,width:Math.max(a,.5),height:s,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const n=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:"left"===o?-4-s:4,y:Math.min(n,n+a),width:s,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=n/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const s=e.length/h*(n/2),a=r((e.x0+e.x1)/2);i.push(u?`${a},${"top"===o?-(t-s):t-s}`:`${"left"===o?-(t-s):t-s},${a}`)}for(let e=d.length-1;e>=0;e--){const s=d[e];if(null==s.x0||null==s.x1)continue;const a=s.length/h*(n/2),l=r((s.x0+s.x1)/2);i.push(u?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+o,children:e.jsx("polygon",{points:i.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(u){const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*n,s=r((e.x0+e.x1)/2);t.push(`L${s},${"top"===o?-i-4:i+4}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*n,s=r((e.x0+e.x1)/2);t.push(`L${"left"===o?-i-4:i+4},${s}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${e},${s}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+o,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,r,c,s,l,o,u,4]);return d?e.jsx("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:d}):null}function Wt(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 zt(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 Yt(t,o,n,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(o)>Math.abs(n)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>o?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>o?"end":"start";const f=16,p=s?u?[s]:Wt(s,c):[],y=r?u?[r]:Wt(r,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:p.map((t,o)=>e.jsx("tspan",{x:m,dy:0===o?0:f,children:t},o))},"annotation-note-title")),v=p.length*f),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,o)=>e.jsx("tspan",{x:m,dy:0===o?0:f,children:t},o))},"annotation-note-label"));let k=null;if((s||r)&&(0!==o||0!==n))if("topBottom"===d){const t=Math.min(c,120);let o=0,n=t;"end"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),k=e.jsx("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*f+(y.length>0?f:0);let o=0,n=t;"bottom"===h?(o=-t,n=0):"middle"===h&&(o=-t/2,n=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*f;let j=0;return"topBottom"===d?j=0>n?-(w+2):18:"leftRight"===d&&(j="middle"===h?-(w+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${o},${n})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),k]})}function Gt(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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("path",{d:zt((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.jsx("g",{className:"annotation-subject",children:a})}function qt(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),u=e/2,d=n/2,h=t*d>o*u?u/t:d/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.jsx("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.jsx("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.jsx("g",{className:"annotation-connector",children:a})}function Xt(t){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-o),null!=a&&(b=a-n);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!m.has("connector")&&qt(v,b,c,h,x,u),!m.has("subject")&&Gt(x,u,h,o,n),!m.has("note")&&Yt(l,v,b,h)]}))}function Vt(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.jsx(Xt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(Xt,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ut(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 Kt(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 Qt(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,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(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=Ut(e,o),c=Kt(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 Zt(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Jt={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};function eo(t){return function(t,o,n){var i,r,a,c,u,d,h,g,f,p,m,v,b,x,k,w,j,A,S,O,M,C,_,P,L,T,R,B,E,N,$,D,H,I,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee;switch(t.type){case"label":{const i=Qt(t,o,n);if(!i)return null;const{x:r,y:s}=i;return Zt(r,s,n)?e.jsx(Vt,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"callout":{const i=Qt(t,o,n);if(!i)return null;const{x:r,y:s}=i;return Zt(r,s,n)?e.jsx(Vt,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"x-threshold":{const i=Ut(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(n.height||0)-4:"center"===s?(n.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:n.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"y-threshold":{const i=Kt(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(n.width||0)/2,l="middle"):(a=(n.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:n.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Ut(Object.assign(Object.assign({},e),{type:"point"}),n),y:Kt(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=l.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Ut(Object.assign(Object.assign({},e),{type:"point"}),n),y:Kt(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),l=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"highlight":{const i=n.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((o,i)=>{const r=Ut(o,n),a=Kt(o,n);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(o):t.r||6,c="function"==typeof t.style?t.style(o):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+o)}case"bracket":{const i=Ut(t,n),r=Kt(t,n);return e.jsx(Vt,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+o)}case"trend":{const s=n.data||[];if(2>s.length)return null;const l=n.xAccessor||"x",g=n.yAccessor||"y",f="ordinal"===n.frameType,p="horizontal"===n.projection,m=f?l:null,v=f?g:null;let b;const x=[],k=new Map;if(f&&m&&v){for(const e of s){const t=e[m];if(null==t)continue;const o=t+"";k.has(o)||(k.set(o,x.length),x.push(o))}b=s.map(e=>{const t=e[m],o=e[v];if(null==t||null==o)return null;const n=k.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else b=s.map(e=>[e[l],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(r=null===(i=n.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(a=n.scales)||void 0===a?void 0:a.time,j=null!==(u=null===(c=n.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=n.scales)||void 0===d?void 0:d.value;if(!w||!j)return null;const A=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},S=w,O=j;let M;if(f)if(p){const e=A(O);M=(t,o)=>[S(o),e(t)]}else{const e=A(S);M=(t,o)=>[e(t),O(o)]}else M=(e,t)=>[S(e),O(t)];const C=t.method||"linear";let _;_="loess"===C?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 u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===C?y.default.polynomial(b,{order:t.order||2}):y.default.linear(b)).points;const P=_.map(([e,t])=>{const[o,n]=M(e,t);return`${o},${n}`}).join(" "),L=t.color||"#6366f1",T=_[_.length-1],[R,B]=M(T[0],T[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:R+4,y:B-4,fill:L,fontSize:11,children:t.label})]},"ann-"+o)}case"band":{const i=null!==(f=null===(g=n.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(p=n.scales)||void 0===p?void 0:p.value,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,s=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:n.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:n.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+o)}case"envelope":{const i=n.data||[];if(2>i.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(k=n.scales)||void 0===k?void 0:k.time,l=null!==(j=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==j?j:null===(A=n.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=Jt[n.curve||"linear"]||s.curveLinear,f=s.area().x(e=>a(e[r])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:p,fillOpacity:null!==(S=t.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][r])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"anomaly-band":{const i=n.data||[];if(2>i.length)return null;const r=n.yAccessor||"y",s=null!==(M=null===(O=n.scales)||void 0===O?void 0:O.x)&&void 0!==M?M:null===(C=n.scales)||void 0===C?void 0:C.time,a=null!==(P=null===(_=n.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=n.scales)||void 0===L?void 0:L.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(T=t.threshold)&&void 0!==T?T:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(R=t.fillOpacity)&&void 0!==R?R:.1,m=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B:6,b=a(c+h*d),x=a(g),k=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[f&&e.jsx("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,o)=>{const i=Ut(t,n),r=Kt(t,n);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"forecast":{const i=n.data||[];if(3>i.length)return null;const r=n.xAccessor||"x",s=n.yAccessor||"y",a=null!==(N=null===(E=n.scales)||void 0===E?void 0:E.x)&&void 0!==N?N:null===($=n.scales)||void 0===$?void 0:$.time,l=null!==(H=null===(D=n.scales)||void 0===D?void 0:D.y)&&void 0!==H?H:null===(I=n.scales)||void 0===I?void 0:I.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=y.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=c.length;let t=0,o=0,n=0,i=0;for(const[e,r]of c)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 d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(F=t.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(W=t.steps)&&void 0!==W?W:5,x=c[d-1][0],k=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=u(e),o=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-f,2)/p:0))*v;j.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const A=`M${j.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),O=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(z=t.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e.jsx("polyline",{points:`${O} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:a(j[j.length-1].x)+4,y:l(j[j.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+o)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Qt(t,o,n);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!Zt(i,r,n))return null;const s=null!==(q=t.dx)&&void 0!==q?q:0,a=null!==(X=t.dy)&&void 0!==X?X:0,l=null!==(V=t.width)&&void 0!==V?V:32,c=null!==(U=t.height)&&void 0!==U?U:32,u=null!==(K=t.content)&&void 0!==K?K:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const i=Qt(t,o,n);if(!i)return null;const{x:r,y:s}=i;return e.jsx("text",{x:r+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+o)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(Q=n.scales)||void 0===Q?void 0:Q.o,a=null===(Z=n.scales)||void 0===Z?void 0:Z.x,l=null===(J=n.scales)||void 0===J?void 0:J.y,c=r(s)?s:r(a)?a:r(l)?l:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",g=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,f=t.label;return e.jsxs("g",(n.projection?"vertical"===n.projection:c===a)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:n.height||0,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:u,width:n.width||0,height:d,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+o)}default:return null}}}let to={positions:new Map};const oo=new Set;function no(){for(const e of oo)e()}function io(e,t){const o=to.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(to.positions);n.delete(e),to={positions:n},no()}function ro(e,t){const o=to.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(to.positions);n.delete(e),to={positions:n},no()}function so(){return to}function ao(e){return oo.add(e),()=>oo.delete(e)}const lo={positions:new Map};function co(){return()=>{}}function uo(){return lo}function ho(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 go(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function fo(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function po(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const n of e)t>n.pixel&&(t=n.pixel),n.pixel>o&&(o=n.pixel);return{min:t,max:o}}function yo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function mo(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 vo(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g,axisExtent:f}=o,p=t.useMemo(()=>{var e,t;if(!l)return[];const o=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==o?void 0:o.tickFormat)||h||bo,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:ho(l.x,"exact"===f?Math.max(2,s):Math.min(s,r),f),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:l.x(e),label:i(e,t,c)})),g=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 xo(d,Math.max(55,g+8))},[l,u,h,n,f]),y=t.useMemo(()=>{var e,t;if(!l)return[];const o=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||g||bo,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;return xo((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:ho(l.y,"exact"===f?Math.max(2,s):Math.min(s,r),f)).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,i,f]),m=d&&l,v=c&&l;if(!m&&!v)return null;const b=null==u?void 0:u.find(e=>"bottom"===e.orient),x=null==u?void 0:u.find(e=>"left"===e.orient),k=v&&(!b||!1!==b.baseline),w=v&&(!x||!1!==x.baseline),j=(null==b?void 0:b.jaggedBase)||!1,A=(null==x?void 0:x.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&(()=>{var t,o;const r=yo(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=yo(null===(o=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[p.map((t,o)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+o)),y.map((t,o)=>e.jsx("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+o))]})})(),k&&!j&&e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:S,strokeWidth:1}),j&&e.jsx("path",{d:mo("bottom",n,i),fill:"none",stroke:S,strokeWidth:1}),w&&!A&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:S,strokeWidth:1}),A&&e.jsx("path",{d:mo("left",n,i),fill:"none",stroke:S,strokeWidth:1})]})})}function bo(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function xo(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 ko(o){var n,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,axes:h,xLabel:g,yLabel:f,yLabelRight:p,xFormat:y,yFormat:m,axisExtent:v,showGrid:b,title:x,legend:k,legendHoverBehavior:w,legendClickBehavior:j,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:O="right",legendLayout:M,foregroundGraphics:C,marginalGraphics:_,xValues:P,yValues:L,annotations:T,svgAnnotationRules:R,xAccessor:B,yAccessor:E,annotationData:N,pointNodes:$,curve:D,underlayRendered:H,canvasObscuresUnderlay:I=!0,linkedCrosshairName:F,linkedCrosshairSourceId:W,children:z}=o,Y=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"bottom"===e.orient),n=(null==o?void 0:o.tickFormat)||y||bo,i=Math.max(2,Math.floor(r/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:ho(u.x,"exact"===v?Math.max(2,s):Math.min(s,i),v),l=a.map(e=>e.valueOf()),c=a.map((e,t)=>({value:e,pixel:u.x(e),label:n(e,t,l)})),g=c.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),f=(null==o?void 0:o.autoRotate)?Math.max(20,Math.min(g+8,55)):Math.max(55,g+8);let p=xo(c,f);if(p.length>1&&(p=p.filter((e,t)=>0===t||e.label+""!=p[t-1].label+"")),(null==o?void 0:o.includeMax)&&p.length>0&&"exact"!==v&&!(null==o?void 0:o.tickValues)){const e=u.x.domain()[1],t=u.x(e),o=p[p.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,p.length,l);f>t-o&&p.length>1&&(p=p.slice(0,-1)),p.push({value:e,pixel:t,label:i})}}return p},[d,u,h,y,r,v]),G=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||m||bo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;let a=xo((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:ho(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.y(e),label:n(e)})),22);if(a.length>1&&(a=a.filter((e,t)=>0===t||e.label+""!=a[t-1].label+"")),(null==o?void 0:o.includeMax)&&a.length>0&&"exact"!==v&&!(null==o?void 0:o.tickValues)){const e=u.y.domain()[1],t=u.y(e),o=a[a.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&a.length>1&&(a=a.slice(0,-1)),a.push({value:e,pixel:t,label:i})}}return a},[d,u,h,m,s,v]),q=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"right"===e.orient);if(!o)return[];const n=o.tickFormat||m||bo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=o.ticks)&&void 0!==e?e:5;return xo((null!==(t=o.tickValues)&&void 0!==t?t:ho(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.y(e),label:n(e)})),22)},[d,u,h,m,s,v]),X=t.useRef(new Map),V=t.useRef(null!==(n=null==T?void 0:T.length)&&void 0!==n?n:0),U=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;V.current!==U&&(V.current=U,X.current=new Map);const K=t.useMemo(()=>{if(!T||0===T.length)return null;const e=eo(),t={scales:u?{x:u.x,y:u.y,time:u.x,value:u.y}:null,timeAxis:"x",xAccessor:B,yAccessor:E,width:r,height:s,data:N,frameType:"xy",pointNodes:$,curve:D,stickyPositionCache:X.current};return T.map((o,n)=>{if(R){const i=R(o,n,t);return null!=i?i:e(o,n,t)}return e(o,n,t)}).filter(Boolean)},[T,R,r,s,B,E,N,u,$,D]),Q=function(e){var o;const n=t.useSyncExternalStore(e?ao:co,e?so:uo,e?so:uo);return e&&null!==(o=n.positions.get(e))&&void 0!==o?o:null}(F);return t.useEffect(()=>{if(!(null==Q?void 0:Q.locked)||!F)return;const e=e=>{"Escape"===e.key&&ro(F)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Q?void 0:Q.locked,F]),d||x||k||C||_||K&&K.length>0||b||z||Q?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof x?x:"XY Chart"}),e.jsx("desc",{children:"string"==typeof x?x+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[b&&u&&(!H||I)&&(()=>{var t,o;const n=yo(null===(t=null==h?void 0:h.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=yo(null===(o=null==h?void 0:h.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[Y.map((t,o)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"xgrid-"+o)),G.map((t,o)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+o))]})})(),d&&u&&(()=>{const t=null==h?void 0:h.find(e=>"left"===e.orient),o=null==h?void 0:h.find(e=>"bottom"===e.orient),n=!t||!1!==t.baseline,i=!o||!1!==o.baseline,a=(null==t?void 0:t.jaggedBase)||!1,l=(null==o?void 0:o.jaggedBase)||!1,u=null==o?void 0:o.landmarkTicks,d=null==t?void 0:t.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",v="var(--semiotic-text, #333)",b=!!(null==o?void 0:o.autoRotate)&&Y.length>1&&(()=>{const e=r/Math.max(Y.length-1,1);return Y.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 10px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},w={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},j=null==o?void 0:o.tickAnchor,A=null==t?void 0:t.tickAnchor,S=po(Y),O=po(G);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||I)&&i&&!l&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:y,strokeWidth:1}),(!H||I)&&l&&e.jsx("path",{d:mo("bottom",r,s),fill:"none",stroke:y,strokeWidth:1}),Y.map((t,o)=>{const n=!!u&&("function"==typeof u?u(t.value,o):Ue(t.value,o>0?Y[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":go(j,t.pixel===S.min,t.pixel===S.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n?k:x),transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+o)}),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:v,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||I)&&n&&!a&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:y,strokeWidth:1}),(!H||I)&&a&&e.jsx("path",{d:mo("left",r,s),fill:"none",stroke:y,strokeWidth:1}),G.map((t,o)=>{const n=!!d&&("function"==typeof d?d(t.value,o):Ue(t.value,o>0?G[o-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:fo(A,t.pixel===O.min,t.pixel===O.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n?k:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+o)}),(()=>{const o=(null==t?void 0:t.label)||f;return o?e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:o}):null})()]}),(()=>{const t=null==h?void 0:h.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const o=!1!==t.baseline,n=t.landmarkTicks,i=t.label||p,a=t.tickAnchor,l=po(q);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e.jsx("line",{x1:r,y1:0,x2:r,y2:s,stroke:y,strokeWidth:1}),q.map((t,o)=>{const i=!!n&&("function"==typeof n?n(t.value,o):Ue(t.value,o>0?q[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:fo(a,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+o)}),i&&e.jsx("text",{x:r+c.right-15,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(90, ${r+c.right-15}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:i})]})})()]})})(),K,_&&u&&P&&L&&e.jsxs(e.Fragment,{children:[_.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Ft,{orient:"top",config:It(_.top),values:P,scale:u.x,size:c.top,length:r})}),_.bottom&&e.jsx("g",{transform:`translate(0, ${s})`,children:e.jsx(Ft,{orient:"bottom",config:It(_.bottom),values:P,scale:u.x,size:c.bottom,length:r})}),_.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Ft,{orient:"left",config:It(_.left),values:L,scale:u.y,size:c.left,length:s})}),_.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(Ft,{orient:"right",config:It(_.right),values:L,scale:u.y,size:c.right,length:s})})]}),C,Q&&Q.sourceId!==W&&(null==u?void 0:u.x)&&(()=>{const t=u.x(Q.xValue);if(null==t||0>t||t>r)return null;const o=Q.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:s,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"})})(),z]}),x&&e.jsx("text",{x:a/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 x?x:null}),Ht({legend:k,totalWidth:a,totalHeight:l,margin:c,legendPosition:O,title:x,legendLayout:M,legendHoverBehavior:w,legendClickBehavior:j,legendHighlightedCategory:A,legendIsolatedCategories:S})]}):null}function wo(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 jo(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 Ao=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function So(e){var t,o;const{innerRadius:n,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=n;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=Ao(i,r),t=Ao(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=Ao(i,r),t=Ao(i,s),o=Ao(n,s),l=Ao(n,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${o.x},${o.y} A${n},${n} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(o=e.cornerRadius)&&void 0!==o?o:0,(i-n)/2));if(0===l)return So(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))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,n+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return So(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?u:0),v=s-(f?u:0),b=Ao(i,p),x=Ao(i,y),k=(i-l)*Math.cos(c),w=Ao(k,r),j=Ao(k,s),A=a?null:Ao(n,v),S=a?null:Ao(n,m),O=a?0:(n+l)*Math.cos(u),M=a?null:Ao(O,r),C=a?null:Ao(O,s),_=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=Ao(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Ao(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=Ao(n,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${n},${n} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=Ao(n,r);L+=` A${n},${n} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Oo(e){const t=So({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let i=0;n.length>i;i++)o.push({d:So({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:n[i]})}return{clipPath:t,slices:o}}const Mo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Co(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function _o(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const Po="undefined"==typeof window||"undefined"==typeof document,Lo="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function To(){const[e,o]=t.useState(!1);return Lo(()=>{o(!0)},[]),e}const Ro=()=>()=>{},Bo=()=>!1,Eo=()=>!0;function No(){const e=t.useSyncExternalStore(Ro,Bo,Eo);return t.useRef(e).current}function $o(e){const{hydrated:o,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Lo(()=>{var e,t;o&&n&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[o,n]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}function Do(e){const o=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Io(e,t);if(!Fo(e)||!Fo(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(!Io(o,i))return!1}else{if(!Fo(o)||!Fo(i))return!1;if(!Ho(o,i))return!1}}return!0}(o.current,e)||(o.current=e),o.current}function Ho(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 Io(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 Fo(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 Wo=p.createContext(null);function zo({children:t}){const[o,n]=p.useState(!1),i=p.useMemo(()=>({visible:o,setVisible:n}),[o]);return e.jsx(Wo.Provider,{value:i,children:t})}function Yo(){return p.useContext(Wo)}const Go={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function qo(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";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 Xo(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 Vo=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Uo="semiotic-accessible-data-table",Ko=Uo+" semiotic-accessible-data-table-hidden",Qo=Uo+" semiotic-accessible-data-table-visible",Zo=Qo+" semiotic-accessible-data-table-network",Jo={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"},en={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, 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-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)"},on={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},nn={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))"},rn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},sn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function an({scene:t,chartType:o,tableId:n,chartTitle:i}){var r;const[s,a]=p.useState(!1),l=Yo(),c=null!==(r=null==l?void 0:l.visible)&&void 0!==r&&r,u=s||c,d=p.useRef(null),h=i?"Data summary for "+i:n?`Data summary for ${o} ${n}`:"Data summary for "+o,g=p.useCallback(()=>{s||c||a(!0)},[s,c]),f=p.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return n?e.jsx("span",{id:n,tabIndex:-1,style:Go}):null;if(!u)return e.jsx("div",{id:n,className:Ko,tabIndex:-1,onFocus:g,style:Go,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,j,A,S;const O=[];if(!Array.isArray(e))return O;for(const M of e)if(M&&"object"==typeof M&&null!==M.datum)try{switch(M.type){case"point":O.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&O.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&O.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;O.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":O.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":O.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=M.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":O.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=M.cx)&&void 0!==g?g:M.x,y:null!==(f=M.cy)&&void 0!==f?f:M.y}});break;case"arc":O.push({label:"Arc",values:{id:null!==(y=null===(p=M.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(v=M.cy)&&void 0!==v?v:M.y}});break;case"candlestick":O.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":O.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=M.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=M.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(S=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==S?S:""}})}}catch(e){}return O}(t),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}(y),v=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Vo(e.min)} to ${Vo(e.max)}, mean ${Vo(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(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const k=Array.from(x);return e.jsxs("div",{ref:d,id:n,className:Qo,tabIndex:-1,onBlur:f,style:Jo,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:tn,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:en,children:v}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+o,style:on,children:[e.jsxs("caption",{className:"semiotic-accessible-data-table-caption",style:sn,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:nn,children:"type"}),k.map(t=>e.jsx("th",{style:nn,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:rn,children:t.label}),k.map(o=>{return e.jsx("td",{style:rn,children:(n=t.values[o],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Vo(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},o);var n})]},o))})]})]})}function ln({nodes:t,edges:o,chartType:n,tableId:i,chartTitle:r}){var s,a,l,c,u,d,h,g,f,y,m,v,b,x;const[k,w]=p.useState(!1),j=Yo(),A=null!==(s=null==j?void 0:j.visible)&&void 0!==s&&s,S=k||A,O=r?"Data summary for "+r:i?`Data summary for ${n} ${i}`:"Data summary for "+n,M=p.useRef(null),C=p.useCallback(()=>{k||A||w(!0)},[k,A]),_=p.useCallback(e=>{var t;A||(null===(t=M.current)||void 0===t?void 0:t.contains(e.relatedTarget))||w(!1)},[A]);if(!t||0===t.length)return i?e.jsx("span",{id:i,tabIndex:-1,style:Go}):null;if(!S)return e.jsx("div",{id:i,className:Ko,tabIndex:-1,onFocus:C,style:Go,role:"region","aria-label":O,children:e.jsxs("button",{type:"button",onClick:()=>w(!0),children:["View data summary (",t.length," nodes, ",o.length," edges)"]})});const P=Array.isArray(t)?t:[],L=Array.isArray(o)?o:[],T=new Map,R=new Map,B=new Map,E=new Map;for(const e of L){if(!e||"object"!=typeof e)continue;const t=null!==(a=e.datum)&&void 0!==a?a:e,o="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,n="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";R.set(e,(null!==(u=R.get(e))&&void 0!==u?u:0)+1),E.set(e,(null!==(d=E.get(e))&&void 0!==d?d:0)+i)}if(null!=n&&""!==n){const e=n+"";T.set(e,(null!==(h=T.get(e))&&void 0!==h?h:0)+1),B.set(e,(null!==(g=B.get(e))&&void 0!==g?g:0)+i)}}const N=[];for(let e=0;P.length>e;e++){const t=P[e];if(!t||"object"!=typeof t)continue;const o=null!==(y=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:t.id,n=null!=o?o+"":"node-"+e,i=null!==(m=T.get(n))&&void 0!==m?m:0,r=null!==(v=R.get(n))&&void 0!==v?v:0,s=null!==(b=B.get(n))&&void 0!==b?b:0,a=null!==(x=E.get(n))&&void 0!==x?x:0;N.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}N.sort((e,t)=>t.degree-e.degree);let $=0,D=0;if(N.length>0){let e=0;for(const t of N)e+=t.degree,t.degree>D&&(D=t.degree);$=e/N.length}const H=L.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)}),I=[`${N.length} nodes, ${L.length} edges.`];N.length>0&&I.push(`Mean degree: ${Vo($)}, max degree: ${D}.`);const F=N.slice(0,5);return e.jsxs("div",{ref:M,id:i,className:Zo,tabIndex:-1,onBlur:_,style:Jo,role:"region","aria-label":O,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{A&&j&&j.setVisible(!1),w(!1)},"aria-label":"Close data summary",style:tn,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:en,children:I.join(" ")}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:on,children:[e.jsxs("caption",{className:"semiotic-accessible-data-table-caption",style:sn,children:["Top ",F.length," of ",N.length," nodes by degree"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:nn,children:"id"}),e.jsx("th",{style:nn,children:"degree"}),e.jsx("th",{style:nn,children:"in"}),e.jsx("th",{style:nn,children:"out"}),H&&e.jsx("th",{style:nn,children:"w. degree"}),H&&e.jsx("th",{style:nn,children:"w. in"}),H&&e.jsx("th",{style:nn,children:"w. out"})]})}),e.jsx("tbody",{children:F.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:rn,children:t.id}),e.jsx("td",{style:rn,children:t.degree}),e.jsx("td",{style:rn,children:t.inDeg}),e.jsx("td",{style:rn,children:t.outDeg}),H&&e.jsx("td",{style:rn,children:Vo(t.wDegree)}),H&&e.jsx("td",{style:rn,children:Vo(t.wInDeg)}),H&&e.jsx("td",{style:rn,children:Vo(t.wOutDeg)})]},o))})]})]})}function cn({summary:t}){return t?e.jsx("div",{role:"note",style:Go,children:t}):null}function un({tableId:t}){return e.jsx("a",{href:"#"+t,style:Go,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,Go)},children:"Skip to data table"})}function dn({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.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Go,children:o})}const hn="var(--semiotic-focus, #005fcc)";function gn({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 u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:hn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:hn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:hn,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function fn(e){return Array.isArray(e)?e[0]:e}function pn(e,t,o,n){return Object.assign({data:fn(e),x:t,y:o,__semioticHoverData:!0},n)}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 mn(e,t){return"function"==typeof t?t(e):e[t]}function vn(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 bn(t={}){const{fields:o,title:n,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(n){const e=mn(t,n);a=vn(e,i)}if(o&&o.length>0)o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=mn(t,n);l.push({label:o,value:vn(s,r)})});else if(!n){const e=["value","y","name","id","label"];for(const o of e)if(void 0!==t[o]){a=vn(t[o],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=vn(t[e[0]],i))}}const c=Object.assign(Object.assign({},yn),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,o)=>e.jsxs("div",{style:{marginTop:0===o&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},o))]})}}function xn(){return t=>{var o,n,i,r,s,a,l;const c=t.allSeries;if(!c||0===c.length){const r=null!==(n=null===(o=t.data)||void 0===o?void 0:o.value)&&void 0!==n?n:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:yn,children:e.jsx("div",{children:vn(r)})})}const u=null!==(a=null!==(r=t.xValue)&&void 0!==r?r:null===(s=t.data)||void 0===s?void 0:s.time)&&void 0!==a?a:null===(l=t.data)||void 0===l?void 0:l.x;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:vn(u)}),c.map((t,o)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:vn(t.value)})]},o))]})}}function kn(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=fn(!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.jsx("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)?bn(t):bn())}}function wn({x:t,y:o,containerWidth:n,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(o),u=p.useRef(null),[d,h]=p.useState(null);p.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,n,i]);let g;g=d?`translate(${d.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*i>o?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!p.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if("string"==typeof o.className&&o.className.trim().length>0)return!0;const n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor)return!0}return!1}(s),y=f?null:yn;return c?e.jsx("div",{ref:u,className:f?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:r.left+t,top:r.top+o,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function jn(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}function An(e,o,n){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!o&&!n)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;s(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return t.observe(e),()=>t.disconnect()},[o,n]),[i,[o&&r?r.w:e[0],n&&r?r.h:e[1]]]}const Sn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function On(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Mn(e){const o=function(){const[e,o]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return o(e.matches),jn(e,e=>o(e.matches))},[]),e}(),n=t.useRef(o);n.current=o;const[i,r]=An(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=On(e.foregroundGraphics,r,s),u=On(e.backgroundGraphics,r,s),d=R(e=>e.theme),{transition:h,introEnabled:g}=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),f="semiotic-table-"+p.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),j=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(j))},[j]),S=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const O=e.themeDirtyRef;return Sn(()=>{O&&(et++,O.current=!0,v())},[d,v,O]),{reducedMotion:o,reducedMotionRef:n,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:g,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:S}}function Cn(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 _n(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Pn(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 Ln(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 Tn=(e,t,o,n)=>{var i,r;const a=t.filter(e=>"line"===e.type);for(const l of a){if(2>l.path.length)continue;const c=l._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,n.width*c,n.height),e.clip());const u=l.style.stroke||"#007bff",d=rt(e,u)||u,h=l.style.strokeWidth||2,g=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=h,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const v=null!==(i=l.style.opacity)&&void 0!==i?i:1;Ln(e,l.path,d,h,v,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=at(l.curve),y=g&&g.length>0&&f&&f.length===l.path.length,m=l._decayOpacities;if(m&&m.length===l.path.length&&!y){e.strokeStyle=d;const b=null!==(r=l.style.opacity)&&void 0!==r?r:1;for(let x=0;l.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(l.path[x][0],l.path[x][1]),e.lineTo(l.path[x+1][0],l.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,j=null,A=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function M(){S&&(e.stroke(),S=!1)}for(let C=0;l.path.length>C;C++){const[_,P]=l.path[C],L=f[C],T=Pn(L,g,d);if(null!==k&&null!==A&&null!==j){if(T===A)e.lineTo(_,P);else{const R=[];for(const B of g){const E=B.value;(j>E||E>L)&&(E>j||L>E)||j===E||L===E||R.push({t:(E-j)/(L-j)})}R.sort((e,t)=>e.t-t.t);for(const N of R){const $=k+(_-k)*N.t,D=w+(P-w)*N.t,H=Pn(j+(L-j)*Math.min(N.t+1e-4,1),g,d);e.lineTo($,D),M(),O(H,$,D)}e.lineTo(_,P)}k=_,w=P,j=L,A=T}else O(T,_,P),k=_,w=P,j=L,A=T}M()}else{e.beginPath();const I=l.strokeGradient&&l.path.length>=2?ut(e,l.strokeGradient,l.path[0][0],0,l.path[l.path.length-1][0],0):null;if(e.strokeStyle=I||d,p)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[F,W]=l.path[0];e.moveTo(F,W);for(let z=1;l.path.length>z;z++)e.lineTo(l.path[z][0],l.path[z][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=lt(e,l.style.fill,l.style.fill),p&&!y)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[G,q]=l.path[0];e.moveTo(G,q);for(let X=1;l.path.length>X;X++)e.lineTo(l.path[X][0],l.path[X][1])}const Y=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Rn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Bn(e,t,o=.3){Rn(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 En(e,t,o=.6){var n,i,r,s,a;if(!Rn(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function Nn(e,t,o,n=.35){Rn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function $n(e,t){const o=at(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=s.area().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 Dn=(e,t,o,n)=>{var i,r,a;const l=t.filter(e=>"area"===e.type);for(const t of l){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 l=t._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,n.width*l,n.height),e.clip());const c=lt(e,t.style.fill,"#4e79a7"),u=t._decayOpacities;if(u&&u.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(u[n]+u[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=rt(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*(u[o]+u[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($n(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=ct(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,o,0,n);e.fillStyle=i||c,e.globalAlpha=d}else{const o=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=o*d,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&($n(e,t),Nn(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const o=t.strokeGradient&&t.topPath.length>=2?ut(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=at(t.curve);if(e.beginPath(),n)s.line().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!==l&&1>l&&e.restore(),o&&e.restore(),e.globalAlpha=1}},Hn=(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=lt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=lt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),En(e,t),e.globalAlpha=1}}finally{e.restore()}}};function In(e,t){const{x:o,y:n,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=jo(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 Fn(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 Wn=(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)zn(e,t);else if(t.cornerRadii&&wo(t.cornerRadii)){const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=Fn(t),i=t.fillGradient&&"string"==typeof o?ct(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,In(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=Fn(t),i=t.fillGradient&&"string"==typeof o?ct(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=Fn(t),i=t.fillGradient&&"string"==typeof o?ct(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Bn(e,t),e.globalAlpha=1}};function zn(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 Yn(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 Gn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const qn=(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=rt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Bn(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):Gn(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=Yn(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}},Xn=(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=rt(e,t.wickColor)||t.wickColor,c=60>n.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),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=rt(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&&d(),e.restore()}};function Vn(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 Un(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 Kn(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 Qn(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 Zn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Jn(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`${Zn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${Zn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const ei={line:[Dn,Tn,Hn],area:[Dn,Hn],stackedarea:[Dn,Hn],scatter:[Hn],bubble:[Hn],heatmap:[qn],bar:[Wn],swarm:[Hn],waterfall:[(e,t,o,n)=>{var i;Wn(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=rt(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 n=r[t],i=r[t+1],s=n.datum,a=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==a?void 0:a.baseline))continue;const l=o.y(s.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Xn],mixed:[Dn,Tn,Hn],custom:[Dn,Wn,qn,Tn,Hn,Xn]},ti={top:20,right:20,bottom:30,left:40},oi={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 ni(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 ii={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 ri({hover:t}){var o,n,i;const r=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(o=t.data)&&void 0!==o?o:{},a=null!==(n=s.y)&&void 0!==n?n:s.value,l=null!==(i=s.x)&&void 0!==i?i:s.time;return e.jsxs("div",{className:"semiotic-tooltip",style:ii,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:r(a)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:r(l)})]})}ri.ownsChrome=!0;const si=t.forwardRef(function(o,n){var i,r,s,a,l,c,u,d,h,g,f,y,m;const{chartType:v,runtimeMode:x,data:j,chunkThreshold:A,chunkSize:O,xAccessor:M,yAccessor:C,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:T,curve:R,normalize:B,baseline:E,stackOrder:N,binSize:$,valueAccessor:D,arrowOfTime:H="right",windowMode:I="sliding",windowSize:F=200,timeAccessor:W,xExtent:z,yExtent:Y,extentPadding:G=.1,scalePadding:q,sizeRange:X,size:V=[500,300],responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,lineStyle:ee,pointStyle:te,areaStyle:oe,barStyle:ne,waterfallStyle:ie,swarmStyle:re,barColors:se,colorScheme:ae,boundsAccessor:le,boundsStyle:ce,y0Accessor:ue,band:de,gradientFill:he,lineGradient:ge,areaGroups:fe,openAccessor:pe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,showAxes:xe=!0,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:Se,yFormat:Oe,axisExtent:Me,tickFormatTime:Ce,tickFormatValue:_e,hoverAnnotation:Pe,tooltipContent:Le,customHoverBehavior:Te,customClickBehavior:Re,enableHover:Be,hoverRadius:Ee=30,tooltipMode:$e,annotations:De,svgAnnotationRules:He,showGrid:Ie,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:qe,legendIsolatedCategories:Xe,legendPosition:Ve,legendLayout:Ue,legendCategoryAccessor:Ke,onCategoriesChange:Qe,backgroundGraphics:Ze,foregroundGraphics:Je,canvasPreRenderers:et,svgPreRenderers:tt,title:ot,categoryAccessor:nt,brush:it,onBrush:st,decay:at,pulse:lt,transition:ct,animate:ut,staleness:dt,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,marginalGraphics:xt,pointIdAccessor:kt,xScaleType:Ot,yScaleType:Mt,accessibleTable:Pt=!0,description:Lt,summary:Tt,linkedCrosshairName:Rt,linkedCrosshairSourceId:Bt,customLayout:Et,layoutConfig:Nt}=o,$t=t.useId().replace(/:/g,""),Dt=t.useRef(!1),Ht=Mn({sizeProp:V,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:ti,animate:ut,transitionProp:ct,themeDirtyRef:Dt}),It=To(),Ft=No(),{reducedMotionRef:Wt,responsiveRef:zt,size:Yt,currentTheme:Gt,transition:qt,introEnabled:Xt,tableId:Vt,rafRef:Ut,renderFnRef:Kt,scheduleRender:Qt}=Ht;let Zt=Ht.margin;if(xt){const e=60,t=Object.assign({},Ht.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),Zt=t}const Jt="function"==typeof Je?Je({size:Yt,margin:Zt}):Je,eo="function"==typeof Ze?Ze({size:Yt,margin:Zt}):Ze,to=Yt[0]-Zt.left-Zt.right,oo=Yt[1]-Zt.top-Zt.bottom,no=t.useMemo(()=>k(j),[j]),io=null!=Pe?Pe:Be,ro=t.useRef(null),so=t.useRef(null),[ao,lo]=t.useState(0),[co,uo]=t.useState(null),ho=t.useRef(null),go=t.useRef(null),[fo,po]=t.useState(null),yo=t.useRef(oi.primary),mo=t.useRef([]),bo=t.useRef(Ke),xo=t.useRef(Qe);bo.current=Ke,xo.current=Qe;const[wo,jo]=t.useState(!1),[Ao,So]=t.useState([]),[Oo,Mo]=t.useState([]),_o="streaming"===x||["bar","swarm","waterfall"].includes(v),Lo=t.useMemo(()=>{var e,t,o;return{chartType:v,runtimeMode:_o?"streaming":"bounded",windowSize:F,windowMode:I,arrowOfTime:_o?H:"right",extentPadding:G,scalePadding:q,axisExtent:Me,xAccessor:M,yAccessor:C,timeAccessor:_o?W:void 0,valueAccessor:D,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(T?"_lineGroup":void 0),categoryAccessor:nt,lineDataAccessor:T,xScaleType:Ot,yScaleType:Mt,xExtent:z,yExtent:Y,sizeRange:X,binSize:$,normalize:B,baseline:E,stackOrder:N,boundsAccessor:le,boundsStyle:ce,y0Accessor:ue,band:de,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:fe?new Set(fe):void 0,lineGradient:ge,openAccessor:pe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,lineStyle:ee,pointStyle:te,areaStyle:oe,swarmStyle:re,waterfallStyle:ie,colorScheme:ae,barColors:se,barStyle:ne,annotations:De,decay:at,pulse:lt,transition:qt,introAnimation:Xt,staleness:dt,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,pointIdAccessor:kt,curve:R,themeCategorical:null===(e=null==Gt?void 0:Gt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(Gt),themeSequential:null===(t=null==Gt?void 0:Gt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Gt?void 0:Gt.colors)||void 0===o?void 0:o.diverging,customLayout:Et,layoutConfig:Nt,layoutMargin:Zt}},[v,F,I,H,G,q,Me,M,C,W,D,Ot,Mt,_,P,L,nt,T,z,Y,X,$,B,E,N,le,ce,ue,de,he,ge,fe,pe,ye,me,ve,be,ee,te,oe,re,ie,ne,ae,se,De,at,lt,null==qt?void 0:qt.duration,null==qt?void 0:qt.easing,Xt,dt,pt,yt,mt,vt,bt,_o,kt,R,Gt,Et,Nt,Zt]),Ro=Do(Lo),Bo=t.useRef(null);Bo.current||(Bo.current=new Ye(Ro));const Eo=t.useCallback(()=>{var e,t;const o=bo.current,n=xo.current;if(!n||!o)return;const i=Vn(null!==(t=null===(e=Bo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Un(i,mo.current)||(mo.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=Bo.current)||void 0===e||e.updateConfig(Ro),Dt.current=!0,Qt()},[Ro,Qt]);const Ho=t.useRef(null);Ho.current||(Ho.current=new w(e=>{const t=Bo.current;t&&t.ingest(e)&&(Dt.current=!0,Qt())},{chunkThreshold:A,chunkSize:O})),t.useEffect(()=>{var e;null===(e=Ho.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:O})},[A,O]);const Io=t.useCallback(e=>{var t;null===(t=Ho.current)||void 0===t||t.push(e)},[]),Fo=t.useCallback(e=>{var t;null===(t=Ho.current)||void 0===t||t.pushMany(e)},[]),Wo=t.useCallback(()=>{var e,t;null===(e=Ho.current)||void 0===e||e.clear(),null===(t=Bo.current)||void 0===t||t.clear(),Dt.current=!0,Qt()},[Qt]);t.useImperativeHandle(n,()=>({push:Io,pushMany:Fo,remove:e=>{var t,o,n;null===(t=Ho.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&&(ho.current&&i.some(e=>{var t;return e===(null===(t=ho.current)||void 0===t?void 0:t.data)})&&(ho.current=null,po(null)),Dt.current=!0,Qt()),i},update:(e,t)=>{var o,n,i;null===(o=Ho.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&&(Dt.current=!0,Qt()),r},clear:Wo,getData:()=>{var e,t,o;return null===(e=Ho.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}}),[Io,Fo,Wo,Qt]),t.useEffect(()=>{var e,t;if(j){if(T&&no.length>0&&"object"==typeof no[0]&&null!==no[0]){const t="string"==typeof T?T:"coordinates";if(Array.isArray(no[0][t])){const o=[];for(const e of no){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=Ho.current)||void 0===e||e.setBoundedData(o))}}null===(t=Ho.current)||void 0===t||t.setBoundedData(no)}},[j,no,T]);const{hoverHandlerRef:zo,hoverLeaveRef:Yo,onPointerMove:Go,onPointerLeave:Xo}=Ht;zo.current=e=>{var t,o;if(!io)return;const n=ro.current;if(!n)return;const i=n.getBoundingClientRect(),r=e.clientX-i.left-Zt.left,s=e.clientY-i.top-Zt.top;if(0>r||r>to||0>s||s>oo)return void(ho.current&&(ho.current=null,go.current=null,po(null),Te&&(Te(null),Dt.current=!0),Qt()));const a=Bo.current;if(!a||0===a.scene.length)return;const l=gt(a.scene,r,s,Ee,a.quadtree,a.maxPointRadius),c="multi"===$e,u=()=>{ho.current&&(ho.current=null,go.current=null,po(null),Te&&Te(null),Qt())};if(!l&&!c)return void u();const d=c||!l?r:l.x,h=c||!l?s:l.y;let g=pn((null==l?void 0:l.datum)?Ne(l.datum,a.resolvedRibbons):{},d,h);if(c&&a.scene.length>0&&a.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=ft(ht(e.path,e.curve),t,o);if(null===r)continue;const s=wt(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=ht(e.topPath,e.curve),s=ht(e.bottomPath,e.curve),a=ft(r,t,o);if(null===a)continue;const l=ft(s,t,o),c=wt(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}(a.scene,d,Math.max(Ee,to));if(e.length>0){const t=a.scales.y.invert,o=a.scales.x.invert,n=yo.current,i=o?o(d):d;if(l)g.xValue=i,g.xPx=d;else{const e={xValue:i};"string"==typeof M&&(e[M]=i),g=pn(e,d,h,{xValue:i,xPx:d})}g.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"===v&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:Ne(e.datum,a.resolvedRibbons)}})}}l||(null===(t=g.allSeries)||void 0===t?void 0:t.length)?(ho.current=g,go.current=null!==(o=null==l?void 0:l.node)&&void 0!==o?o:null,po(g),Te&&(Te(g),Dt.current=!0),Qt()):u()},Yo.current=()=>{ho.current&&(ho.current=null,go.current=null,po(null),Te&&(Te(null),Dt.current=!0),Qt())};const Vo=t.useRef(()=>{});Vo.current=e=>{if(!Re)return;const t=ro.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Zt.left,i=e.clientY-o.top-Zt.top;if(0>n||n>to||0>i||i>oo)return void Re(null);const r=Bo.current;if(!r||0===r.scene.length)return void Re(null);const s=gt(r.scene,n,i,Ee,r.quadtree,r.maxPointRadius);Re(s?pn(s.datum||{},s.x,s.y):null)};const Uo=t.useCallback(e=>Vo.current(e),[]),Ko=t.useRef(-1),Qo=t.useRef(null),Zo=t.useRef(null),Jo=t.useCallback(e=>{const t=Bo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Zo.current&&Zo.current.version===o)n=Zo.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=jt(e),Zo.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 o=n.flat[0];Qo.current={shape:o.shape,w:o.w,h:o.h};const i=Ct(Object.assign(Object.assign({},o),{datum:Ne(o.datum,t.resolvedRibbons)}));return ho.current=i,po(i),Te&&Te(i),void Qt()}const r=At(n,i),s=St(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Ko.current=-1,Qo.current=null,ho.current=null,go.current=null,po(null),Te&&Te(null),void Qt();Ko.current=s;const a=n.flat[s];Qo.current={shape:a.shape,w:a.w,h:a.h};const l=Ct(Object.assign(Object.assign({},a),{datum:Ne(a.datum,t.resolvedRibbons)}));ho.current=l,po(l),Te&&Te(l),Qt()},[Te,Qt]),en=t.useCallback(e=>{Ko.current=-1,Qo.current=null,Go(e)},[Go]);Kt.current=()=>{var e,t;Ut.current=0;const o=ro.current,n=so.current;if(!o||!n)return;const i=Bo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Wt.current?r+1e6:r),a=!Wt.current&&s,l=Dt.current||s;l&&!a&&(i.computeScene({width:to,height:oo}),Eo());const c=_n(),u=function(e){if(!e)return oi;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||oi.axisStroke,tickText:s||oi.tickText,crosshair:s?ni(s,"66"):oi.crosshair,hoverFill:c?ni(c,"4D"):oi.hoverFill,hoverStroke:s?ni(s,"99"):oi.hoverStroke,pointRing:c||oi.pointRing,primary:r||oi.primary}:oi}(o);yo.current=u.primary;const d=null!==(e=null==dt?void 0:dt.threshold)&&void 0!==e?e:5e3,h=dt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=Cn(o,Yt,Zt,c);if(e){if(e.clearRect(-Zt.left,-Zt.top,Yt[0],Yt[1]),h&&(e.globalAlpha=null!==(t=null==dt?void 0:dt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==J&&!Ze){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=J||(t&&"transparent"!==t?t:null),i=n?rt(e,n):null;i&&(e.fillStyle=i,e.fillRect(-Zt.left,-Zt.top,Yt[0],Yt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,to,oo),e.clip()),et&&i.scales)for(const t of et)e.save(),t(e,i.scene,i.scales,{width:to,height:oo}),e.restore();const n=Et?ei.custom:ei[v];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:to,height:oo});e.restore(),h&&(e.globalAlpha=1)}}{const e=Cn(n,Yt,Zt,c);if(e&&(e.clearRect(-Zt.left,-Zt.top,Yt[0],Yt[1]),io&&ho.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,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u: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(u,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,ho.current,to,oo,"object"==typeof io?io:{},go.current,u),go.current&&Array.isArray(Pe))){const t=Pe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s="group"in o?o.group:void 0;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,go.current,t,u)}}l&&o&&o.setAttribute("aria-label",qo(i.scene,v+" chart"));const g=Dt.current;if(Dt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!co||e(co.x.domain()[0])!==e(i.scales.x.domain()[0])||e(co.x.domain()[1])!==e(i.scales.x.domain()[1])||e(co.y.domain()[0])!==e(i.scales.y.domain()[0])||e(co.y.domain()[1])!==e(i.scales.y.domain()[1])||co.x.range()[0]!==i.scales.x.range()[0]||co.x.range()[1]!==i.scales.x.range()[1]||co.y.range()[0]!==i.scales.y.range()[0]||co.y.range()[1]!==i.scales.y.range()[1])&&uo(i.scales),xt){const e=i.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof C?C:e=>e[C||"y"];So(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&&De&&De.length>0&&lo(e=>e+1),(null==dt?void 0:dt.showBadge)&&jo(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Ut.current=requestAnimationFrame(()=>Kt.current()))},$o({hydrated:It,wasHydratingFromSSR:Ft,storeRef:Bo,dirtyRef:Dt,renderFnRef:Kt,cleanup:()=>{var e;return null===(e=Ho.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Dt.current=!0,Qt()},[v,to,oo,xe,J,ee,et,Qt]),_t(dt,Bo,Dt,Qt,wo,jo);const tn=t.useMemo(()=>{if(Se||Ce)return;const e=Bo.current;return(null==e?void 0:e.xIsDate)&&co?Jn(co.x.domain()):void 0},[Se,Ce,co]),on=Se||Ce||tn,nn=io&&fo?Le?Le(fo):e.jsx(ri,{hover:fo}):null,rn=nn?e.jsx(wn,{x:fo.x,y:fo.y,containerWidth:to,containerHeight:oo,margin:Zt,className:"stream-frame-tooltip",children:nn}):null,sn=Qo.current,ln=e.jsx(gn,{active:Ko.current>=0,hoverPoint:fo,margin:Zt,size:Yt,shape:null==sn?void 0:sn.shape,width:null==sn?void 0:sn.w,height:null==sn?void 0:sn.h}),hn=Kn(M,W,"__semiotic_resolvedX","__semiotic_resolvedTime"),fn=Kn(C,D,"__semiotic_resolvedY","__semiotic_resolvedValue"),yn=hn.key,mn=fn.key,vn=Qn(hn,fn,De&&De.length>0||!1);if(Po||!It&&Ft){const t=Bo.current;t&&j&&(t.ingest({inserts:no,bounded:!0}),t.computeScene({width:to,height:oo}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,a=on||(()=>{if((null==t?void 0:t.xIsDate)&&n)return Jn(n.x.domain())})();return e.jsxs("div",{ref:zt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"img","aria-label":Lt||("string"==typeof ot?ot:"XY chart"),style:{position:"relative",width:U?"100%":Yt[0],height:K?"100%":Yt[1]},children:[e.jsx(cn,{summary:Tt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Yt[0],height:Yt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:eo}),e.jsxs("g",{transform:`translate(${Zt.left},${Zt.top})`,children:[J&&e.jsx("rect",{x:0,y:0,width:to,height:oo,fill:J}),tt&&n&&tt.map((t,i)=>e.jsx(p.Fragment,{children:t(o,n,{width:to,height:oo})},"svgpre-"+i)),o.map((t,o)=>function(t,o,n){var i,r,s,a,l;switch(t.type){case"line":{const n=t;if(0===n.path.length)return null;const i="M"+n.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity},"line-"+o)}case"area":{const l=t;if(0===l.topPath.length)return null;const c=`M${l.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...l.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(l.clipRect){const t=`${n?n+"-":""}area-clip-${o}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:l.clipRect.x,y:l.clipRect.y,width:l.clipRect.width,height:l.clipRect.height})})}),e.jsx("path",{d:c,fill:Co(l.style.fill),fillOpacity:null!==(r=null!==(i=l.style.fillOpacity)&&void 0!==i?i:l.style.opacity)&&void 0!==r?r:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+o)}return e.jsx("path",{d:c,fill:Co(l.style.fill),fillOpacity:null!==(a=null!==(s=l.style.fillOpacity)&&void 0!==s?s:l.style.opacity)&&void 0!==a?a:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth},"area-"+o)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:Co(n.style.fill),opacity:null!==(l=n.style.opacity)&&void 0!==l?l:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"point-"+o)}case"rect":{const n=t;return e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:Co(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"rect-"+o)}case"heatcell":{const n=t;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const t=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[i,r,s]=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]}(n.fill),a=.299*i+.587*r+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),e.jsx("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:t})]},"heatcell-"+o)}return e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+o)}case"candlestick":{const n=t,i=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),s=n.isUp?n.upColor:n.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),e.jsx("rect",{x:n.x-n.bodyWidth/2,y:i,width:n.bodyWidth,height:r,fill:s,stroke:s,strokeWidth:1})]},"candle-"+o)}default:return null}}(t,o,$t)).filter(Boolean)]})]}),e.jsx(ko,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,scales:n,showAxes:xe,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:a,yFormat:Oe||_e,axisExtent:Me,showGrid:Ie,title:ot,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:qe,legendIsolatedCategories:Xe,legendPosition:Ve,legendLayout:Ue,foregroundGraphics:Ge(Jt,null===(s=Bo.current)||void 0===s?void 0:s.customLayoutOverlays),marginalGraphics:xt,xValues:[],yValues:[],annotations:De,svgAnnotationRules:He,annotationFrame:0,xAccessor:yn,yAccessor:mn,annotationData:vn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,linkedCrosshairName:Rt,linkedCrosshairSourceId:Bt})]})}return e.jsxs("div",{ref:zt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"group","aria-label":Lt||("string"==typeof ot?ot:"XY chart"),tabIndex:0,style:{position:"relative",width:U?"100%":Yt[0],height:K?"100%":Yt[1],overflow:"visible"},onKeyDown:Jo,children:[Pt&&e.jsx(un,{tableId:Vt}),Pt&&e.jsx(an,{scene:null!==(l=null===(a=Bo.current)||void 0===a?void 0:a.scene)&&void 0!==l?l:[],chartType:v+" chart",tableId:Vt,chartTitle:"string"==typeof ot?ot:void 0}),e.jsx(cn,{summary:Tt}),e.jsxs("div",{role:"img","aria-label":Lt||("string"==typeof ot?ot:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:io?en:void 0,onMouseLeave:io?Xo:void 0,onClick:Re?Uo:void 0,children:[eo&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Yt[0],height:Yt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:eo})}),e.jsx(vo,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,scales:co,showAxes:xe,axes:ke,showGrid:Ie,xFormat:on,yFormat:Oe||_e,axisExtent:Me}),e.jsx("canvas",{ref:ro,"aria-label":qo(null!==(u=null===(c=Bo.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],v+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:so,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(dn,{hoverPoint:fo}),e.jsx(ko,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,scales:co,showAxes:xe,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:on,yFormat:Oe||_e,axisExtent:Me,showGrid:Ie,title:ot,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:qe,legendIsolatedCategories:Xe,legendPosition:Ve,legendLayout:Ue,foregroundGraphics:Ge(Jt,null===(d=Bo.current)||void 0===d?void 0:d.customLayoutOverlays),marginalGraphics:xt,xValues:Ao,yValues:Oo,annotations:De,svgAnnotationRules:He,annotationFrame:ao,xAccessor:yn,yAccessor:mn,annotationData:vn(null===(h=Bo.current)||void 0===h?void 0:h.getData()),pointNodes:null===(g=Bo.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==J&&!Ze,linkedCrosshairName:Rt,linkedCrosshairSourceId:Bt}),(it||st)&&e.jsx(b,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,dimension:null!==(f=null==it?void 0:it.dimension)&&void 0!==f?f:"xy",scales:co,onBrush:null!=st?st:()=>{},binSize:$,snap:null==it?void 0:it.snap,binBoundaries:null!==(y=null==it?void 0:it.binBoundaries)&&void 0!==y?y:"bar"===v?null===(m=Bo.current)||void 0===m?void 0:m.getBinBoundaries():void 0,snapDuring:null==it?void 0:it.snapDuring,streaming:"streaming"===x}),(null==dt?void 0:dt.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===dt.badgePosition?{top:4,left:4}:"bottom-left"===dt.badgePosition?{bottom:4,left:4}:"bottom-right"===dt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:wo?"#dc3545":"#28a745",color:"white"}),children:wo?"STALE":"LIVE"}),ln,rn]})]})});function ai(e,t){var o;const{columns:n,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,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(n),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=d&&!g&&h.length>1&&(null!==(o=i.cornerRadius)&&void 0!==o?o:0)>0;for(let e=0;h.length>e;e++){const t=h[e],o=t.pieceData[0],n="number"==typeof(null==o?void 0:o._pctStart)?o._pctStart:t.pctStart,d=c+n*u,g=c+(n+("number"==typeof(null==o?void 0:o._pct)?o._pct:t.pct))*u,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:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==o?void 0:o._nonInteractive)?null:t.pieceData,category:t.name});(null==o?void 0:o._roundedEnds)?v.roundedEnds=o._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==o?void 0:o._gradientBand)&&(v._gradientBand=o._gradientBand),s.push(v)}return s}function li(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=a.quantile(e,.25))&&void 0!==t?t:r,median:null!==(o=a.quantile(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=a.quantile(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function ci(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ye[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function ui(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"}}si.displayName="StreamXYFrame";const di={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,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 o of t.pieceData){const t=c(o);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 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 m){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(F(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(F(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=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!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n: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 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(v?(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(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:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="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(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(F(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(F(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,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),u=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,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales: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),u=r(n,e.name),d=u.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:d,style:u,datum:n})}}return l},pie:ai,donut:ai,boxplot:function(e,t){var o,n,i,r,s,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:p}=c,y=[],m="vertical"===p,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],p=null!==(o=a.quantile(c,.25))&&void 0!==o?o:u,b=null!==(n=a.quantile(c,.5))&&void 0!==n?n:(u+d)/2,x=null!==(i=a.quantile(c,.75))&&void 0!==i?i:d,k=x-p,w=p-1.5*k,j=x+1.5*k,A=null!==(r=c.find(e=>e>=w))&&void 0!==r?r:u,S=null!==(s=[...c].reverse().find(e=>j>=e))&&void 0!==s?s:d,O=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const o=h(e);if(w>o||o>j){const n=m?t.middle:f(o),i=m?f(o):t.middle;M.push({px:n,py:i,value:o,datum:e})}}if(y.push({type:"boxplot",x:m?t.middle:0,y:m?0:t.middle,projection:m?"vertical":"horizontal",columnWidth:.6*t.width,minPos:f(A),q1Pos:f(p),medianPos:f(b),q3Pos:f(x),maxPos:f(S),stats:{n:c.length,min:A,q1:p,median:b,q3:x,max:S,mean:c.reduce((e,t)=>e+t,0)/c.length},style:O,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],l=(s-r)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-r)/l),p-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(f){b=`M ${e.middle} ${d(r)}`;for(let t=0;p>t;t++){const o=d(r+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${o}`}b+=` L ${e.middle} ${d(s)}`;for(let t=p-1;t>=0;t--){const o=d(r+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${o}`}b+=" Z"}else{b=`M ${d(r)} ${e.middle}`;for(let t=0;p>t;t++)b+=` L ${d(r+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)b+=` L ${d(r+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const l=null!==(o=a.quantile(t,.25))&&void 0!==o?o:r,c=null!==(n=a.quantile(t,.5))&&void 0!==n?n:(r+s)/2,u=null!==(i=a.quantile(t,.75))&&void 0!==i?i:s;k={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:f}}const w=f?{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};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:k,stats:li(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=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)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(F(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,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-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(n)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${o}`}m+=` L ${t} ${l(i)} Z`}const v=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))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:li(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},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,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(F(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(F(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var o,n,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const k=b.length>1&&"_default"!==b[0],w=[];let j=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=g?g(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(n);i.total+=r,i.pieces.push(n),o+=r}w.push({col:e,groups:t,stepTotal:o}),k||o>j&&(j=o)}if(k)for(const e of w){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>j&&(j=n)}if(0===j)return p;const A=new Map;for(const e of b){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=w[0].stepTotal,O=k?.95*y:.9*t.width,M=i.scaleLinear().domain([0,j]).range([0,O]),C=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let _=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,i=0===t,d=n.width,h=.55*d,g=n.x+(d-h)/2,v=new Map;if(k){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=M(n.total))}let t=y,r=y;for(let s=0;b.length>s;s++){const l=b[s],c=o.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const k=f(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,j=w>0?c.total/w*100:0,S=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:n.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});m&&(0===s&&(S.__funnelStepLabel=n.name,S.__funnelStepLabelX=y,S.__funnelStepLabelY=g,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+u/2,S.__funnelValueLabelY=g,S.__funnelBarW=u),p.push(F(x,g,u,h,k,S,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=o.stepTotal,t=M(e),a=y-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=o.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:n.pieceData[0],d=c?l:n.name,x=f(u,d),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:i,category:c?l:n.name});m&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=y,w.__funnelStepLabelY=g,w.__funnelRowWidth=t,w.__funnelValueLabelX=y,w.__funnelValueLabelY=g,w.__funnelBarW=t),p.push(F(a,g,t,h,x,w,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&_.size>0){const t=k?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return f(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),a={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===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=o.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:n.pieceData[0],category:"_default"===i?n.name:i};p.push(a)}}_=v}return p},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],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 m=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);m.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const v=u.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,u=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,j=n?0:Math.max(0,w-y),A=o.x+e*a+l/2,S=v(y),O=v(0)-S,M=c(f.pieces[0],p?h:o.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(y+j)});if(d.push(F(A,S,u,O,M,C,p?h:o.name)),j>0){const e=v(y+j),t=S-e,n=Object.assign({},M),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:j,__barFunnelPercent:b>0?j/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(F(A,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"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=d?F(s,o.x,a,o.width,n,null,"__track__"):F(o.x,s,o.width,a,n,null,"__track__");u.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=u.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(d){const r=l(t),s=l(t+n);f=F(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=F(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=n}if(p>0&&u.length>o){const e=u.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:d?(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 u}};class hi{constructor(e){this.rExtent=new E,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 B(e.windowSize),this.getO=q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new E)):(this.getR=Y(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(e.connectorAccessor),this.getDataId=q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new B(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(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(n),a=this.computeValueDomain(n,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=i.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;h=i.scaleLinear().domain(a).range([n,o])}else l?(d=i.scaleBand().domain(s).range([0,e.height]).padding(u),h=i.scaleLinear().domain(a).range([0,e.width])):(d=i.scaleBand().domain(s).range([0,e.width]).padding(u),h=i.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(o,n);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?i.scaleLinear().domain([c,u]).range([0,e.width]):i.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=n;this.rAccessors.length>1&&(g=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(g,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,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,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=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>u&&(u=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>u&&(u=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>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(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>u&&(u=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,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 u=null;if(c&&"radial"!==n){u=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),u.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 u)u.set(t,o/e*r)}let d=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;u?(c=h,g=u.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:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){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=di[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,u=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)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(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=ci(r.colorScheme,r.themeCategorical,ve),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:ui(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||ve,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?Ae(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,hi.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=r.quadtree().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 u=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;u||(u=this.getCategoryIndexMap(t));const n=u.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,u,d,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 j=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(j.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(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)d?(j.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,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(d)j.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!j.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const 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!==(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: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:_e(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=Me(e,this.activeTransition),s=Oe(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=Ce(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=Ce(n.x,e._targetX,s),e.y=Ce(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=Ce(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=Ce(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,s),e.y=Ce(o.y,e._targetY,s),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,s),e.h=Ce(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:Ce(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=Ce(o.startAngle,e._targetStartAngle,s),e.endAngle=Ce(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&&!z(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!z(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!z(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(z(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!z(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new E)):(this.getR=Y(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!z(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!z(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!z(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function gi(e,t,o){const n=qe(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function fi(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Xe(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function pi(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=Ke(Math.atan2(i,n)),a=Ke(e.startAngle),l=Ke(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function yi(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 mi(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 vi(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=o,{rTickValues:h,axisExtent:g}=o,f="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),y=t.useMemo(()=>!l||f?[]:(h||ho(l.r,5,g)).map(e=>({value:e,pixel:l.r(e),label:(d||bi)(e)})),[l,d,f,h,g]),m=u&&l&&!f,v=c&&l&&!f;return m||v?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&e.jsx("g",{className:"ordinal-grid",children:y.map((t,o)=>e.jsx("line",{x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:n,y2:p?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,p?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function bi(e){return Math.round(100*e)/100+""}function xi(o){var n,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showCategoryTicks:h,oLabel:g,rLabel:f,oFormat:p,rFormat:y,showGrid:m,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:j,legendPosition:A="right",legendLayout:S,foregroundGraphics:O,annotations:M,svgAnnotationRules:C,xAccessor:_,yAccessor:P,annotationData:L,underlayRendered:T,children:R}=o,B="radial"===(null==u?void 0:u.projection),E="horizontal"===(null==u?void 0:u.projection),N=!1!==h,$=t.useMemo(()=>d&&N&&u&&!B?u.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=u.o(e))&&void 0!==o?o:0)+u.o.bandwidth()/2,label:p?p(e,t):e}}):[],[d,N,u,p,B]),D=o.rTickValues,H=o.tickLabelEdgeAlign,I=o.axisExtent,F=t.useMemo(()=>d&&u&&!B?(D||ho(u.r,5,I)).map(e=>({value:e,pixel:u.r(e),label:(y||bi)(e)})):[],[d,u,y,B,D,I]),W=t.useRef(new Map),z=t.useRef(null!==(n=null==M?void 0:M.length)&&void 0!==n?n:0),Y=null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0;z.current!==Y&&(z.current=Y,W.current=new Map);const G=t.useMemo(()=>{if(!M||0===M.length)return null;const e=eo(),t="horizontal"===(null==u?void 0:u.projection),o=(null==u?void 0:u.o)?e=>{var t;return(null!==(t=u.o(e))&&void 0!==t?t:0)+u.o.bandwidth()/2}:null,n={scales:u?{x:t?u.r:o||u.r,y:t&&o||u.r,time:u.r,value:u.r,o:u.o}:null,timeAxis:"x",xAccessor:_,yAccessor:P,width:r,height:s,data:L,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:W.current};return M.map((t,o)=>{if(C){const i=C(t,o,n);return null!=i?i:e(t,o,n)}return e(t,o,n)}).filter(Boolean)},[M,C,r,s,u,_,P,L]);return d||v||b||O||G&&G.length>0||m||R?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof v?v:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof v?v+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[m&&u&&!B&&!T&&e.jsx("g",{className:"ordinal-grid",children:F.map((t,o)=>e.jsx("line",{x1:E?t.pixel:0,y1:E?0:t.pixel,x2:E?t.pixel:r,y2:E?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),d&&u&&!B&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 10px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,E?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!T&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((o,n)=>e.jsxs("g",{transform:`translate(0,${o.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},t),children:o.label})})]},"cat-"+n)),g&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!T&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!T&&(null==u?void 0:u.r)&&(()=>{const t=u.r(0);return t>1&&r-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),F.map((o,n)=>{const i=H?0===n?"start":n===F.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${o.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label})]},"val-"+n)}),f&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:f})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!T&&(()=>{const t=(null==u?void 0:u.r)?u.r(0):s,o=0>t||t>s?s:t;return e.jsx("line",{x1:0,y1:o,x2:r,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),$.map((o,n)=>e.jsxs("g",{transform:`translate(${o.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},t),children:o.label})})]},"cat-"+n)),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!T&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((o,n)=>e.jsxs("g",{transform:`translate(0,${o.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label})]},"val-"+n)),f&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:f})]})]})})})(),G,O,R]}),v&&e.jsx("text",{x:a/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 v?v:null}),Ht({legend:b,totalWidth:a,totalHeight:l,margin:c,legendPosition:A,title:v,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:j})]}):null}function ki({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,scales:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(u);g.current=u;const f=t.useRef(c);f.current=c;const p=t.useRef(!1),y=t.useRef(null),m="horizontal"===(null==c?void 0:c.projection),v=t.useRef(m);return v.current=m,t.useEffect(()=>{if(!d.current)return;const e=o.select(d.current).select(".brush-g"),t=m?n.brushX():n.brushY();return t.extent([[0,0],[i,r]]),t.on("brush end",e=>{if(p.current)return;const t=f.current;if(!t)return;if(!e.selection)return y.current=null,void g.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};y.current=r,g.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[i,r,m]),t.useEffect(()=>{if(!c||!h.current||!y.current)return;if(!d.current)return;const e=y.current,t=o.select(d.current).select(".brush-g"),n=c.r(e.r[0]),i=c.r(e.r[1]);m?(p.current=!0,t.call(h.current.move,[n,i]),p.current=!1):(p.current=!0,t.call(h.current.move,[i,n]),p.current=!1)},[c,m]),e.jsx("svg",{ref:d,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`,style:{pointerEvents:"all"}})})}function wi(e,t){var o,n,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=Oo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(n=null===(o=t.roundedEnds)||void 0===o?void 0:o.start)||void 0===n||n,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=rt(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function ji(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 Ai(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=s.arc().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(n);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}hi.QUADTREE_THRESHOLD=500;const Si=(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;if(e.globalAlpha=o*n,t._gradientBand&&t._gradientBand.colors.length>0)wi(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(ji(e,t),Nn(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?rt(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=So({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 n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Ai(e,t)):(ji(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(ji(e,t),Nn(e,t)),e.globalAlpha=1}}},Oi=(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=rt(e,"var(--semiotic-primary, #007bff)"),a=rt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?rt(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?rt(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),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()}},Mi=(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?rt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(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()}},Ci=(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=rt(e,o.style.stroke)||("string"==typeof o.style.fill?rt(e,o.style.fill):o.style.fill)||rt(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}},_i=(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Pi(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 Li(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Ti=null;function Ri(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):(Ti||(Ti=document.createElement("canvas")),Ti.width=e,Ti.height=e,Ti)}(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 u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Bi=new Map;function Ei(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Bi.get(o);if(void 0!==n)return n;const i=Ri({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Bi.set(o,i),i}function Ni(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 $i(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 Di(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Hi=e=>[Ci,...e],Ii={bar:Hi([Wn]),clusterbar:Hi([Wn]),point:Hi([Hn]),swarm:Hi([Hn]),pie:[Si],donut:[Si],boxplot:Hi([Oi,Hn]),violin:Hi([Mi]),histogram:Hi([Wn]),ridgeline:Hi([Mi]),timeline:Hi([Wn]),funnel:[Wn,_i,(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?Pi(i):null!=r?`${Pi(i)} (${Li(r)})`:Pi(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=Pi(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(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,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Wn,(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)||rt(e,"var(--semiotic-border, #999)"),n=Ei(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]=st(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,rt(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,u=r?Di(i):"",d=$i(n);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,m=y-f/2,v=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(),Ni(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Ni(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(u,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3))}e.lineWidth=1}],swimlane:Hi([Wn]),custom:Hi([Wn,Hn,Si,Oi,Mi,_i])},Fi={top:50,right:40,bottom:60,left:70},Wi={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 zi({hover:t}){var o,n,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(o=l[0])||void 0===o?void 0:o.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[n," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:Wi,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(a=null!==(s=null!==(r=null!==(i=null!==(n=l.__aggregateValue)&&void 0!==n?n:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:Wi,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==p&&e.jsx("div",{children:"number"==typeof p?p.toLocaleString():p+""})]})}zi.ownsChrome=!0;const Yi=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,h,g,f,y;const{chartType:m,runtimeMode:v,data:b,oAccessor:x="category",rAccessor:j="value",colorAccessor:A,stackBy:O,groupBy:M,multiAxis:C,timeAccessor:_,valueAccessor:P,categoryAccessor:L,projection:T="vertical",size:R=[600,400],responsiveWidth:B,responsiveHeight:E,margin:N,barPadding:$,roundedTop:D,gradientFill:H,trackFill:I,baselinePadding:F,innerRadius:W,cornerRadius:z,normalize:Y,startAngle:G,sweepAngle:q,dynamicColumnWidth:X,bins:V,showOutliers:U,showIQR:K,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:ee,connectorStyle:te,dataIdAccessor:oe,rExtent:ne,oExtent:ie,extentPadding:re=.05,oSort:se,windowMode:ae="sliding",windowSize:le=200,pieceStyle:ce,summaryStyle:ue,colorScheme:de,barColors:he,showAxes:ge=!0,showCategoryTicks:fe,categoryLabel:pe,valueLabel:ye,categoryFormat:me,valueFormat:ve,oLabel:be,rLabel:xe,oFormat:ke,rFormat:we,rTickValues:je,tickLabelEdgeAlign:Ae,axisExtent:Se,enableHover:Oe=!0,hoverAnnotation:Me,tooltipContent:Ce,customHoverBehavior:_e,annotations:Pe,svgAnnotationRules:Le,showGrid:Te=!1,legend:Re,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:De,legendLayout:He,legendCategoryAccessor:Ie,onCategoriesChange:Fe,backgroundGraphics:We,foregroundGraphics:ze,title:Ye,className:qe,background:Xe,centerContent:Ve,decay:Ue,pulse:Ke,transition:Ze,animate:Je,staleness:et,brush:tt,onBrush:ot,accessibleTable:nt=!0,description:it,summary:st,customLayout:at,layoutConfig:lt}=o,ct=t.useRef(!0),ut=Mn({sizeProp:R,responsiveWidth:B,responsiveHeight:E,userMargin:N,marginDefault:Fi,foregroundGraphics:ze,backgroundGraphics:We,animate:Je,transitionProp:Ze,themeDirtyRef:ct}),{reducedMotionRef:dt,responsiveRef:ht,size:gt,margin:ft,adjustedWidth:pt,adjustedHeight:yt,resolvedForeground:mt,resolvedBackground:vt,currentTheme:bt,transition:xt,introEnabled:kt,tableId:wt,rafRef:Ot,renderFnRef:Mt,scheduleRender:Pt}=ut,Lt=To(),Tt=No(),Rt=t.useMemo(()=>k(b),[b]),Bt=null!=pe?pe:be,Et=null!=ye?ye:xe,Nt=null!=me?me:ke,$t=null!=ve?ve:we,Dt=t.useRef(null),Ht=t.useRef(null),It=t.useRef([]),Ft=t.useRef(Ie),Wt=t.useRef(Fe);Ft.current=Ie,Wt.current=Fe;const[zt,Yt]=t.useState(null),[Gt,qt]=t.useState(null),[Xt,Vt]=t.useState(0),[Ut,Kt]=t.useState(!1),[Qt,Zt]=t.useState(null),Jt=t.useCallback(()=>{var e,t;Zt(null!==(t=null===(e=io.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),eo=Oe||Me,to="streaming"===v,oo=t.useMemo(()=>{var e,t,o;return{chartType:m,runtimeMode:to?"streaming":"bounded",windowSize:le,windowMode:ae,extentPadding:re,projection:T,oAccessor:to?void 0:x,rAccessor:to?void 0:j,colorAccessor:A,stackBy:O,groupBy:M,multiAxis:C,timeAccessor:to?_:void 0,valueAccessor:to?P||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:to?L||x:void 0,rExtent:ne,oExtent:ie,axisExtent:Se,barPadding:$,roundedTop:D,gradientFill:H,trackFill:I,baselinePadding:F,innerRadius:W,cornerRadius:z,normalize:Y,startAngle:G,sweepAngle:q,dynamicColumnWidth:X,bins:V,showOutliers:U,showIQR:K,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:ee,connectorStyle:te,dataIdAccessor:oe,oSort:se,pieceStyle:ce,summaryStyle:ue,colorScheme:de,themeCategorical:null===(e=null==bt?void 0:bt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(bt),themeSequential:null===(t=null==bt?void 0:bt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==bt?void 0:bt.colors)||void 0===o?void 0:o.diverging,barColors:he,decay:Ue,pulse:Ke,transition:xt,introAnimation:kt,staleness:et,customLayout:at,layoutConfig:lt,layoutMargin:ft}},[m,le,ae,re,T,x,j,A,O,M,C,_,P,L,ne,ie,Se,$,D,H,I,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee,te,oe,se,ce,ue,de,he,Ue,Ke,null==xt?void 0:xt.duration,null==xt?void 0:xt.easing,kt,et,to,bt,at,lt,ft]),no=Do(oo),io=t.useRef(null);io.current||(io.current=new hi(no));const ro=t.useCallback(()=>{var e,t;const o=Ft.current,n=Wt.current;if(!n||!o)return;const i=Vn(null!==(t=null===(e=io.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Un(i,It.current)||(It.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=io.current)||void 0===e||e.updateConfig(no),ct.current=!0,Pt()},[no,Pt]);const so=t.useRef(null);so.current||(so.current=new w(e=>{const t=io.current;t&&t.ingest(e)&&(ct.current=!0,Pt())}));const ao=t.useCallback(e=>{var t;null===(t=so.current)||void 0===t||t.push(e)},[]),lo=t.useCallback(e=>{var t;null===(t=so.current)||void 0===t||t.pushMany(e)},[]),co=t.useCallback(()=>{var e,t;null===(e=so.current)||void 0===e||e.clear(),null===(t=io.current)||void 0===t||t.clear(),ct.current=!0,Pt()},[Pt]),uo=t.useCallback(e=>{var t,o;null===(t=so.current)||void 0===t||t.clearLastData(),null===(o=so.current)||void 0===o||o.setReplacementData(e)},[]);t.useImperativeHandle(n,()=>({push:ao,pushMany:lo,replace:uo,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=Ht.current)||void 0===i?void 0:i.data;!!Ht.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Ht.current=null,Yt(null)),ct.current=!0,Pt()}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&&(ct.current=!0,Pt()),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,uo,co,Pt]),t.useEffect(()=>{var e;b&&(null===(e=so.current)||void 0===e||e.setBoundedData(Rt))},[b,Rt]);const{hoverHandlerRef:ho,hoverLeaveRef:go,onPointerMove:fo,onPointerLeave:po}=ut;ho.current=e=>{if(!eo)return;const t=Dt.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(Ht.current&&(Ht.current=null,Yt(null),_e&&_e(null),Pt()));const r=io.current;if(!r||0===r.scene.length)return;const s="radial"===T,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Qe(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=gi(r,t,o);break;case"point":if(i)break;e=fi(r,t,o,n);break;case"wedge":if(null===r.datum)break;e=pi(r,t,o);break;case"boxplot":e=yi(r,t,o);break;case"violin":e=mi(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-pt/2:n,s?i-yt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Ht.current&&(Ht.current=null,Yt(null),_e&&_e(null),Pt()));const l=pn(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 x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m}));Ht.current=l,Yt(l),_e&&(_e(l),ct.current=!0),Pt()},go.current=()=>{Ht.current&&(Ht.current=null,Yt(null),_e&&(_e(null),ct.current=!0),Pt())};const yo=t.useRef(-1),mo=t.useRef(null),vo=t.useRef(null),bo=t.useCallback(e=>{const t=io.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(vo.current&&vo.current.version===o)n=vo.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){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;n=jt(e),vo.current={version:o,graph:n}}const i=yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),yo.current=0;const t=n.flat[0];mo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Ct(t)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});return Ht.current=o,Yt(o),_e&&_e(o),void Pt()}const r=At(n,i),s=St(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return yo.current=-1,mo.current=null,Ht.current=null,Yt(null),_e&&_e(null),void Pt();yo.current=s;const a=n.flat[s];mo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Ct(a)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});Ht.current=l,Yt(l),_e&&_e(l),Pt()},[_e,Pt]),xo=t.useCallback(e=>{yo.current=-1,mo.current=null,fo(e)},[fo]);Mt.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(dt.current?r+1e6:r),a=!dt.current&&s,l=ct.current;l&&!s&&(i.computeScene({width:pt,height:yt}),ro(),Jt(),ct.current=!1),(l||a)&&o.setAttribute("aria-label",qo(i.scene,m+" chart"));const c=_n(),u=gt[0]*c,d=gt[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=gt[0]+"px",o.style.height=gt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,gt[0],gt[1]);const h=null!==(e=null==et?void 0:et.threshold)&&void 0!==e?e:5e3,g=et&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==et?void 0:et.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Xe&&!We){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Xe||(e&&"transparent"!==e?e:null),i=t?rt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,gt[0],gt[1]))}const f="radial"===T;n.save(),n.beginPath(),n.rect(ft.left,ft.top,pt,yt),n.clip(),f?(n.save(),n.translate(ft.left+pt/2,ft.top+yt/2)):n.translate(ft.left,ft.top);const p=at?Ii.custom:Ii[m]||[],y={width:pt,height:yt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(qt(i.scales),Vt(e=>e+1)),(null==et?void 0:et.showBadge)&&Kt(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Ot.current=requestAnimationFrame(()=>Mt.current()))},$o({hydrated:Lt,wasHydratingFromSSR:Tt,storeRef:io,dirtyRef:ct,renderFnRef:Mt,cleanup:()=>{var e;return null===(e=so.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{ct.current=!0,Pt()},[m,pt,yt,ge,Xe,Pt]),_t(et,io,ct,Pt,Ut,Kt);const ko=eo&&zt?Ce?Ce(zt):e.jsx(zi,{hover:zt}):null,Ao="radial"===T,Lo=ko?e.jsx(wn,{x:zt?Ao?zt.x+pt/2:zt.x:0,y:zt?Ao?zt.y+yt/2:zt.y:0,containerWidth:pt,containerHeight:yt,margin:ft,className:"stream-ordinal-tooltip",children:ko}):null,Ro=Kn(x,void 0,"__semiotic_resolvedO",""),Bo=Kn(j,void 0,"__semiotic_resolvedR",""),Eo=Ro.key,Ho=Bo.key,Io=Qn(Ro,Bo,Pe&&Pe.length>0||!1);if(Po||!Lt&&Tt){const t=io.current;t&&b&&(t.ingest({inserts:Rt,bounded:!0}),t.computeScene({width:pt,height:yt}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===T,c=l?ft.left+pt/2:ft.left,u=l?ft.top+yt/2:ft.top;return e.jsxs("div",{ref:ht,className:"stream-ordinal-frame"+(qe?" "+qe:""),role:"img","aria-label":it||("string"==typeof Ye?Ye:"Ordinal chart"),style:{position:"relative",width:B?"100%":gt[0],height:E?"100%":gt[1]},children:[e.jsx(cn,{summary:st}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:gt[0],height:gt[1],style:{position:"absolute",left:0,top:0},children:[vt&&e.jsx("g",{transform:`translate(${ft.left},${ft.top})`,children:vt}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[Xe&&e.jsx("rect",{x:0,y:0,width:pt,height:yt,fill:Xe}),o.map((t,o)=>function(t,o,n){var i,r,a,l,c,u,d,h,g;const f=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",y=e=>`ord-${t.type}-${f}-${o}-${e}`,m=`ord-${t.type}-${f}-${o}`;switch(t.type){case"rect":{const o=t,n=_o(m)+"-grad",i=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.jsx("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=Co(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(o,n),r=i?`url(#${n})`:Co(o.style.fill);if(o.cornerRadii&&wo(o.cornerRadii)){const t=function(e){const{x:t,y:o,w:n,h:i}=e,{tl:r,tr:s,br:a,bl:l}=jo(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}(o);return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}if(o.roundedTop&&o.roundedTop>0){const t=Math.min(o.roundedTop,o.w/2,o.h/2),{x:n,y:s,w:a,h:l}=o;let c;switch(o.roundedEdge){case"right":c=`M${n},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n},${s+l} Z`;break;case"left":c=`M${n+a},${s} L${n+t},${s} A${t},${t} 0 0 0 ${n},${s+t} L${n},${s+l-t} A${t},${t} 0 0 0 ${n+t},${s+l} L${n+a},${s+l} Z`;break;case"bottom":c=`M${n},${s} L${n+a},${s} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n+t},${s+l} A${t},${t} 0 0 1 ${n},${s+l-t} Z`;break;default:c=`M${n},${s+l} L${n},${s+t} A${t},${t} 0 0 1 ${n+t},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l} Z`}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Co(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},m)}case"wedge":{const i=t;if(i._gradientBand&&i._gradientBand.colors.length>0){const t=_o(`${n?n+"-":""}gauge-grad-${i.category||m}-${o}`),{clipPath:s,slices:u}=Oo({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:null===(a=null===(r=i.roundedEnds)||void 0===r?void 0:r.start)||void 0===a||a,roundEnd:null===(c=null===(l=i.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:i._gradientBand.colors});return e.jsxs("g",{transform:`translate(${i.cx},${i.cy})`,opacity:i.style.opacity,fillOpacity:i.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:s})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,o)=>e.jsx("path",{d:t.d,fill:Co(t.color)},o))}),i.style.stroke&&"none"!==i.style.stroke&&e.jsx("path",{d:s,fill:"none",stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}let u;if(i.roundedEnds)u=So({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:i.roundedEnds.start,roundEnd:i.roundedEnds.end});else{const e=s.arc().innerRadius(i.innerRadius).outerRadius(i.outerRadius).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2);i.cornerRadius&&e.cornerRadius(i.cornerRadius),u=e(Mo)||""}return e.jsx("path",{d:u,transform:`translate(${i.cx},${i.cy})`,fill:Co(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},m)}case"boxplot":{const o=t,n=o.columnWidth/2;return e.jsxs("g","vertical"===o.projection?{children:[e.jsx("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:o.x-n,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Co(o.style.fill),fillOpacity:null!==(u=o.style.fillOpacity)&&void 0!==u?u:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-n,y1:o.medianPos,x2:o.x+n,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.x-.5*n,y1:o.minPos,x2:o.x+.5*n,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-.5*n,y1:o.maxPos,x2:o.x+.5*n,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-n,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Co(o.style.fill),fillOpacity:null!==(d=o.style.fillOpacity)&&void 0!==d?d:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.medianPos,y1:o.y-n,x2:o.medianPos,y2:o.y+n,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.minPos,y1:o.y-.5*n,x2:o.minPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.maxPos,y1:o.y-.5*n,x2:o.maxPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const o=t,n=[e.jsx("path",{d:o.pathString,transform:o.translateX||o.translateY?`translate(${o.translateX},${o.translateY})`:void 0,fill:Co(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:o.style.strokeWidth||1},y("path"))];if(o.iqrLine&&o.bounds){const t=o.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?n.push(e.jsx("line",{x1:i,y1:o.iqrLine.q1Pos,x2:i,y2:o.iqrLine.q3Pos,stroke:o.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:i,cy:o.iqrLine.medianPos,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},y("med"))):n.push(e.jsx("line",{x1:o.iqrLine.q1Pos,y1:r,x2:o.iqrLine.q3Pos,y2:r,stroke:o.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:o.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},y("med")))}return e.jsx("g",{children:n},m)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(g=t.style.opacity)&&void 0!==g?g:.5},m);case"trapezoid":{const o=t,n=o.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:n,fill:Co(o.style.fill,"#999"),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},m)}default:return null}}(t,o,wt)).filter(Boolean)]})]}),e.jsx(xi,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:n,showAxes:ge,showCategoryTicks:fe,oLabel:Bt,rLabel:Et,oFormat:Nt,rFormat:$t,rTickValues:je,tickLabelEdgeAlign:Ae,axisExtent:Se,showGrid:Te,title:Ye,legend:Re,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:De,legendLayout:He,foregroundGraphics:Ge(mt,null===(a=io.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:Pe,svgAnnotationRules:Le,annotationFrame:0,xAccessor:Eo,yAccessor:Ho,annotationData:Io(null==t?void 0:t.getData())}),Ve&&"radial"===T&&e.jsx("div",{style:{position:"absolute",left:ft.left+pt/2,top:ft.top+yt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ve})]})}return e.jsxs("div",{ref:ht,className:"stream-ordinal-frame"+(qe?" "+qe:""),role:"group","aria-label":it||("string"==typeof Ye?Ye:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:B?"100%":gt[0],height:E?"100%":gt[1],overflow:"visible"},onKeyDown:bo,children:[nt&&e.jsx(un,{tableId:wt}),nt&&e.jsx(an,{scene:null!==(c=null===(l=io.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:m+" chart",tableId:wt,chartTitle:"string"==typeof Ye?Ye:void 0}),e.jsx(cn,{summary:st}),e.jsxs("div",{role:"img","aria-label":it||("string"==typeof Ye?Ye:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:eo?xo:void 0,onMouseLeave:eo?po:void 0,children:[vt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:gt[0],height:gt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${ft.left},${ft.top})`,children:vt})}),e.jsx(vi,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:Gt,showAxes:ge,showGrid:Te,rFormat:$t,rTickValues:je,axisExtent:Se}),e.jsx("canvas",{ref:Dt,"aria-label":qo(null!==(d=null===(u=io.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],m+" chart"),style:{position:"absolute",top:0,left:0,width:gt[0],height:gt[1]}}),e.jsx(dn,{hoverPoint:zt}),e.jsx(xi,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:Gt,showAxes:ge,showCategoryTicks:fe,oLabel:Bt,rLabel:Et,oFormat:Nt,rFormat:$t,rTickValues:je,axisExtent:Se,showGrid:Te,title:Ye,legend:Re,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:De,legendLayout:He,foregroundGraphics:Ge(mt,Qt),annotations:Pe,svgAnnotationRules:Le,annotationFrame:Xt,xAccessor:Eo,yAccessor:Ho,annotationData:Io(null===(h=io.current)||void 0===h?void 0:h.getData()),underlayRendered:!0}),(tt||ot)&&"radial"!==T&&e.jsx(ki,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:Gt,onBrush:ot||(()=>{})}),Ve&&"radial"===T&&e.jsx("div",{style:{position:"absolute",left:ft.left+pt/2,top:ft.top+yt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ve}),(null==et?void 0:et.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===et.badgePosition?{top:4,left:4}:"bottom-left"===et.badgePosition?{bottom:4,left:4}:"bottom-right"===et.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.jsx(gn,{active:yo.current>=0,hoverPoint:zt,margin:ft,size:gt,shape:null===(g=mo.current)||void 0===g?void 0:g.shape,width:null===(f=mo.current)||void 0===f?void 0:f.w,height:null===(y=mo.current)||void 0===y?void 0:y.h}),Lo]})]})});Yi.displayName="StreamOrdinalFrame";const Gi={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},qi={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Xi{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?Vi(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 Vi(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,u,d,h]=e[a];Ui(c,u,d,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;Ui(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function Ui(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+u*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+u*n.y}function Ki(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function Qi(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,d=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,i),d=!0):r[n]||(d=c(n));if(d)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(),d}function u(e,t){var o=[].concat(t).concat(e);n.push(o)}function d(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,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=u,i[t]=!0,u+=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]=u,i[p]=!0,u+=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=[],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]=d.length,b===t){l.length=f;break}}d.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>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:d,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=d(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 Zi(e){return e.y0-e.y1>0?"up":"down"}function Ji(e,t){return t(e.source)==t(e.target)}function er(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 tr(e){return e.target.x0-e.source.x1}function or(e,t){var o=ir(e),n=tr(t)/Math.tan(o);return"up"==Zi(e)?e.y1-n:e.y1+n}function nr(e,t){var o=ir(e),n=tr(t)/Math.tan(o);return"up"==Zi(e)?e.y1+n:e.y1-n}function ir(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function rr(e,t){return t(e)}function sr(e){return lr(e.source)}function ar(e){return lr(e.target)}function lr(e){return(e.y0+e.y1)/2}function cr(e){return e.virtual?0:e.value}function ur(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Ji(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Ji(e,t)?n+1:n}),o+n}function dr(e){return e.target.depth}function hr(e,t){return e.sourceLinks.length?e.depth:t-1}function gr(e,t){return e.y0-t.y0}function fr(e,t){return t.y0-e.y0}function pr(e,t){return e.y1-t.y1}function yr(e,t){return t.y1-e.y1}function mr(e,t){return br(e.source,t.source)||e.index-t.index}function vr(e,t){return br(e.target,t.target)||e.index-t.index}function br(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function xr(e,t){return kr(e)==kr(t)?"bottom"==e.circularLinkType?fr(e,t):gr(e,t):kr(t)-kr(e)}function kr(e){return e.target.column-e.source.column}function wr(e,t){return jr(e)==jr(t)}function jr(e){return e.y0-e.y1>0?"up":"down"}function Ar(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 l=a.min(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=r.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),Sr(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),Sr(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,Ji(e,t)&&er(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,a=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==a});c.sort("bottom"==e.circularLinkType?fr:gr);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==a})).sort("bottom"==e.circularLinkType?yr:pr),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=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=l-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 Sr(e,t,o){e.sort(xr);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(Ji(e,t)&&er(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&&Or(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 Or(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Mr(e){return function(){return e}}function Cr(e){return e.index}function _r(e){return e.nodes}function Pr(e){return e.links}function Lr(e,t,o){var n=a.groups(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+=lr(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=lr(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?ur(t,o)-ur(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==ur(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 Tr(e,t,o,n,i,r){var s=a.groups(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 l=1,c=r;c>0;--c)u(l*=.99,o),d();function u(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var l;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&ur(i,o)>0){var c=a.mean(i.sourceLinks,ar),u=a.mean(i.targetLinks,sr),d=c&&u?(c+u)/2:c||u;if(d){var h=(d-lr(i))*t*.3;i.y0+=h,i.y1+=h}}else if(0==s&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)l=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+l;else{var g=a.mean(i.sourceLinks,ar),f=a.mean(i.targetLinks,sr),p=((g&&f?(g+f)/2:g||f)-lr(i))*t;i.y0+=p,i.y1+=p}})})}function d(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||br),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 Rr(e){e.nodes.forEach(function(e){e.sourceLinks.sort(vr),e.targetLinks.sort(mr)}),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 Br(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,l=Cr,c=hr,u=void 0,d=32,h=2,g=_r,f=Pr;function p(){var p={nodes:g.apply(null,arguments),links:f.apply(null,arguments)};return function(g){g.x0=e,g.y0=t,g.x1=o,g.y1=n,g.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 a.group(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=Ki(o,n)),"object"!=typeof i&&(i=e.target=Ki(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(g,l),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=Qi(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[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++)})}(g,u),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){rr(e,t)!=rr(i.source,t)&&rr(e,t)!=rr(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),Ji(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(g,l),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(a.sum(e.sourceLinks,cr),a.sum(e.targetLinks,cr)),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)})})}(g),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})}(g,u,c);var f=r;if(null!==s){var p=a.groups(g.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),y=a.max(p,function(e){return e.length});y>1&&(f=Math.max(1,(n-t)*s/(y-1)))}(function(e,t,o){var n=a.groups(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=a.min(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/a.sum(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=a.max(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})})(g,f,i),Lr(g,u,l),Tr(g,u,l,f,f,d),Rr(g),Ar(g,l,h,10,8),Lr(g,u,l),Tr(g,u,l,f,f,d),Rr(g),Ar(g,l,h,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 rr(o.source,t)==rr(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(!wr(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=or(t,e);return e.y1-o}if(t.target.column>e.target.column)return or(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}})})}(g,l),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return rr(o.target,t)==rr(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(!wr(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=nr(t,e);return e.y0-o}if(t.source.column>e.source.column)return nr(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}})})}(g,l),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=a.min(t,function(e){return e.y0}),s=a.max(t,function(e){return e.y1}),l=(e.y1-e.y0)/(s-r);function c(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>l?(t.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1)}),o.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1),e.width=e.width*l})):t.forEach(function(e){var t=e.y1-e.y0,o=c(e.y0)-e.y0;e.y0=c(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})})}}(g),Ar(g,l,h,10,8)}(p),p}return p.update=function(e){return Rr(e),Ar(e,l,h,10,8),e},p.nodeWidth=function(e){return arguments.length?(i=+e,p):i},p.nodePadding=function(e){return arguments.length?(r=+e,p):r},p.nodePaddingRatio=function(e){return arguments.length?(s=+e,p):s},p.nodes=function(e){return arguments.length?(g="function"==typeof e?e:Mr(e),p):g},p.links=function(e){return arguments.length?(f="function"==typeof e?e:Mr(e),p):f},p.nodeId=function(e){return arguments.length?(l="function"==typeof e?e:Mr(e),p):l},p.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Mr(e),p):c},p.nodeSort=function(e){return arguments.length?(u=e,p):u},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.circularLinkGap=function(e){return arguments.length?(h=+e,p):h},p.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],p):[[e,t],[o,n]]},p.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],p):[o-e,n-t]},p}function Er(e){const{sx:t,sTop:o,sBot:n,tx:i,tTop:r,tBot:s,cp1X:a,cp2X:l}=e,c=(o+n)/2,u=(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:u},{x:i,y:u}],halfWidth:(n-o)/2}}}const Nr=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=u.interpolateNumber(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,h=u.interpolateNumber(e.source.x1,e.target.x0),{pathD:g}=Er({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:h(.5),cp2X:h(.5)});return g};function $r(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,u=i.leftFullExtent,d=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},${d+h*n-h*g}L${c+n-g},${d+h*n}L${u-n+g},${d+h*n}L${u-n},${d+h*n-h*g}L${u-n},${l-h*o+h*g}L${u-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${u+n},${l+h*o}L${u+n},${d-h*n}L${c-n},${d-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const Dr=new Set,Hr=new WeakMap;function Ir(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Hr.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Hr.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}`;Dr.has(e)||(Dr.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 Fr={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(dr))-1:0},justify:hr};function Wr(e){return"string"==typeof e?e:e.id}const zr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,u;if(0===e.length)return;const d="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)),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"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Br().extent(v).links(m).nodes(y).nodeAlign(Fr[h]||hr).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 m){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,u=n[0],d=n[1];if(r>0&&s>0&&(0>e||0>o||t>u||i>d)){const t=Math.min(u/r,d/s),n=-e*t+(u-r*t)/2,i=-o*t+(d-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 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 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 m){const t=Wr(e.source),o=Wr(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!==(u=e.width)&&void 0!==u?u: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=d;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 u="vertical"===o.orientation?"down":"right",d=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:K,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,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=d?d(Ir(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"),m.push("down"===u?{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 u=h?h(Ir(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=u.fill||i;v.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=u.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),v.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=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?$r(e):Nr(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};v.push({type:"bezier",pathD:d,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"===u?(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"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},Yr={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 u=0;const h=[];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?u++:o?(t.x=o.x,t.y=o.y,u++):h.push(t)}const g=u>0&&.3>=(e.length>0?h.length/e.length:1);if(g){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of h){const n=Gr(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=qr(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=qr(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 f=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),p=0===o.iterations?0:g?40:f,y=Xr(o.nodeSize,o.nodeSizeRange,e),m=e=>y(e);if(p>0){const o=d.forceLink().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=d.forceSimulation().force("charge",d.forceManyBody().strength(e=>-25*m(e))).force("center",d.forceCenter(a,l).strength(.8)).force("x",d.forceX(a).strength(.15)).force("y",d.forceY(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}));o.links(e),n.force("link",o)}g?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;p>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=m(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,u;const d=o.nodeStyle,h=o.edgeStyle,g=Xr(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:K,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(Ir(t,"nodeSize")),n=d?d(Ir(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(Ir(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!==(u=i.opacity)&&void 0!==u?u:.6};m.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(Ir(o,"nodeSize"));v.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function Gr(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 qr(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 Xr(e,t,o){var n,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const s=t||[5,20],l=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===l.length)return()=>s[0];const c=null!==(n=a.min(l))&&void 0!==n?n:0,u=null!==(r=a.max(l))&&void 0!==r?r:1;if(c===u)return()=>(s[0]+s[1])/2;const d=i.scaleLinear().domain([c,u]).range(s).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?s[0]:d(n)}}const Vr=K,Ur={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:a}=o,l=Math.min(n[0],n[1])/2,c=l-r,u=n[0]/2,d=n[1]/2,g=(f=o.valueAccessor)?"function"==typeof f?f:e=>{var t;return null!==(t=e[f])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var f;const p=new Map;for(let t=0;e.length>t;t++)p.set(e[t].id,t);const y=e.length,m=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=p.get("string"==typeof e.source?e.source:e.source.id),n=p.get(t);if(void 0===o||void 0===n)continue;const i=g(e);m[o][n]=i}const v=h.chord().padAngle(i);a&&v.sortGroups(a);const b=v(m),x=b.groups,k=s.arc().innerRadius(c).outerRadius(l);for(const t of x){const o=e[t.index],n=k.centroid({innerRadius:c,outerRadius:l,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+u,o.y=n[1]+d,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const w=new Map;for(const t of e)w.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=w.get("string"==typeof e.source?e.source:e.source.id),n=w.get(t);o&&(e.source=o),n&&(e.target=n)}const j=new Map;for(const e of t)j.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 b){const o=e[t.source.index].id,n=e[t.target.index].id,i=j.get(`${o}\0${n}`)||j.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,u=Math.min(n[0],n[1])/2,d=u-l,g=n[0]/2,f=n[1]/2,p=o.nodeStyle,y=o.edgeStyle,m=o.edgeColorBy||"source",v=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Vr,b=new Map;e.forEach((e,t)=>{b.set(e.id,v[t%v.length])});const x=h.ribbon().radius(d),k=[],w=[],j=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=p?p(Ir(o,"nodeStyle")).fill||b.get(o.id)||v[t%v.length]:b.get(o.id)||v[t%v.length];const s=p?p(Ir(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};k.push({type:"arc",cx:g,cy:f,innerR:d,outerR:u,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=x(t);if(!n)continue;const i=Kr(n,g,f);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(y)l=y(Ir(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===m&&o?l=b.get(o.id)||l:t&&(l=b.get(t.id)||l)}const u=y?y(Ir(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};w.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==o.showLabels){const t=(A=o.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=u+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;j.push({x:g+Math.cos(s)*n,y:f+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:k,sceneEdges:w,labels:j}}};function Kr(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 Qr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Zr(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 Jr(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 es(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 ts(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Qr}function os(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 ns(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 is={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),c=o.hierarchySum,u="function"==typeof c?c:"string"==typeof c?e=>Number(e[c])||0:e=>Number(e.value)||0,d=l.hierarchy(r,a);d.sum(u),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[h,g]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=l.tree();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,h,g);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=l.cluster();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,h,g);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,c=l.treemap().size([o,n]).tile(l.treemapBinary).padding(s);a>0&&c.paddingTop(a),c(e)}(d,o,h,g);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;l.pack().size([o,n]).padding(r)(e)}(d,o,h,g);break;case"partition":!function(e,t,o,n){var i;l.partition().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(d,o,h,g)}const f=d.descendants();e.length=0,t.length=0;const p=new Map;for(let t=0;f.length>t;t++){const n=f[t],r={id:Jr(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?rs(r,n,o):"treemap"===s||"partition"===s?ss(r,n):"circlepack"===s&&as(r,n),r.__hierarchyNode=n,e.push(r),p.set(n,r)}if("tree"===s||"cluster"===s)for(const e of f)if(e.parent){const o=p.get(e.parent),n=p.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,u,d,h,g;const f=[],p=[],y=[],m=o.treeOrientation||"vertical",v="radial"===m,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;v&&(e+=b,n+=x);const r=i(Ir(t,"nodeStyle"));let l=r.fill||os(o);if(o.colorByDepth&&void 0!==t.depth){const e=ts(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 j=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;v&&(i+=b,s+=x,a+=b,l+=x);const g=ns(i,s,a,l,m),f=r(Ir(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=o.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:j};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=es(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(v&&(s+=b,a+=x),v){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"===m?((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=[],u=[];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(Ir(o,"nodeStyle"));let l=a.fill||os(t);if(t.colorByDepth&&void 0!==o.depth){const e=ts(t);l=e[o.depth%e.length]}const u={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:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=es(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)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)>d)continue;let f=n(Ir(c,"nodeStyle")).fill||os(t);if(t.colorByDepth&&void 0!==c.depth){const e=ts(t);f=e[c.depth%e.length]}const p="string"==typeof f?Zr(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/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:u}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,u,d,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(Ir(o,"nodeStyle"));let c=l.fill||os(t);if(t.colorByDepth&&void 0!==o.depth){const e=ts(t);c=e[o.depth%e.length]}const u={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:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=es(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(Ir(i,"nodeStyle")).fill||os(t);if(t.colorByDepth&&void 0!==i.depth){const e=ts(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?Zr(a):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#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 rs(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 ss(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 as(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 ls(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const cs={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,a;const l=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),c=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),u=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,h=null!==(a=o.orbitEccentricity)&&void 0!==a?a:1,g="number"==typeof d?()=>d:d,f="number"==typeof h?()=>h:h,p=ls(o);p.metaMap.clear(),n.length=0,i.length=0;const y=new Map;function m(e){var t;const o=null!==(t=y.get(e))&&void 0!==t?t:0;return y.set(e,o+1),0===o?e:`${e}__${o}`}const v=t[0]/2,b=t[1]/2,x=Math.min(t[0],t[1])/2*.85,k=m(c(e));n.push({id:k,x:v,y:b,x0:v,x1:v,y0:b,y1:b,width:0,height:0,value:0,depth:0,data:e}),p.metaMap.set(k,{ring:x,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,a,d,h,y){const v=l(t);if(!(null==v?void 0:v.length))return;const b=v.length;let x=0,k=0,w=0;for(;b>k;)k+=u[Math.min(w,u.length-1)],w++,x++;let j=0;for(let b=0;x>b;b++){const k=u[Math.min(b,u.length-1)],w=v.slice(j,j+k);if(!w.length)break;const A=(b+1)/x,S={id:o,depth:h,data:t,parentId:o},O=y?d/g(S)*A:d*A,M=s.pie().value(e=>{var t;return(null===(t=l(e))||void 0===t?void 0:t.length)?4:1}).sort(null),C=M(w),_=f(S);for(let t=0;w.length>t;t++){const s=(C[t].startAngle+C[t].endAngle)/2,l=w[t],u=m(c(l)),d=r+O*Math.sin(s),g=a+O*Math.cos(s)*_;n.push({id:u,x:d,y:g,x0:d,x1:d,y0:g,y1:g,width:0,height:0,value:0,depth:h,data:l}),p.metaMap.set(u,{ring:O,angle:s,depth:h,parentId:o,eccentricity:_}),i.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(l,u,d,g,O,h+1,!0)}j+=k}}(e,k,v,b,x,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=ls(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(Ir(t,"nodeSize")),n=d?d(Ir(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 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),o="object"==typeof e.target?e.target:m.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(Ir(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(u=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==u?u: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=ls(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)},us={sankey:zr,force:Yr,chord:Ur,tree:is,cluster:is,treemap:is,circlepack:is,partition:is,orbit:cs};function ds(e){return us[e]}class hs{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({},Gi),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Xi(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({},Gi),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new Xi(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],u="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({},gs(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=u(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({},gs(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},gs(i)),{data:o}));const d=`${n}\0${i}\0${e}`,h={source:n,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:d};o&&"object"==typeof o&&fs(o.bezier)&&(h.bezier=o.bezier),this.edges.set(d,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,gs(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,gs(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=ds(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of u)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(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[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,u=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=u.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)&&u.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=ci(this.config.colorScheme,this.config.themeCategorical,K),u={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:ui(c),config:null!==(o=this.config.layoutConfig)&&void 0!==o?o:{}};let d;try{d=this.config.customNetworkLayout(u)}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=d.sceneNodes)&&void 0!==n?n:[],this.sceneEdges=null!==(i=d.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=d.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(s=d.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const c=ds(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(a,l,this.config,e);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const e=ds(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=ds(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=Me(e,this.transition),o=Oe(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Ce(e._prevX0,e._targetX0,o),e.x1=Ce(e._prevX1,e._targetX1,o),e.y0=Ce(e._prevY0,e._targetY0,o),e.y1=Ce(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=Ce(e._prevY0,e._targetY0,o),e.y1=Ce(e._prevY1,e._targetY1,o),e.sankeyWidth=Ce(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=u.interpolateNumber(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=u.interpolateNumber(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 u=e-c;a>u&&(t._pulseIntensity=1-u/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=Ae(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 gs(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 fs(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(!ps(e))return!1;return!0}return ps(t.points)}function ps(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 ys(e,t,o,n,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=ms(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){if(!1===e.interactive)continue;const t=ws(e,o,n);t&&s>t.distance&&(r=t,s=t.distance)}return r}function ms(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>Xe(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=qe(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=Ke(Math.atan2(i,n)),a=Ke(e.startAngle),l=Ke(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 vs=null,bs=null;function xs(){return bs||(vs=document.createElement("canvas"),vs.width=1,vs.height=1,bs=vs.getContext("2d")),bs}function ks(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 ws(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=ks(e),i=xs();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);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=ks(e),i=xs();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 js(t){const{width:o,height:n,totalWidth:i,totalHeight:r,margin:s,labels:a,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",legendLayout:y,foregroundGraphics:m,sceneNodes:v,annotations:b,svgAnnotationRules:x}=t;return e.jsxs(e.Fragment,{children:[e.jsxs("svg",{role:"img",width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsx("title",{children:"string"==typeof l?l:"Network Chart"}),e.jsx("desc",{children:"string"==typeof l?l+" — network data visualization":"Network data visualization"}),e.jsxs("g",{transform:`translate(${s.left},${s.top})`,children:[a.map((t,o)=>e.jsx("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)),b&&b.filter(e=>"widget"!==e.type).map((t,i)=>{if(x){const r=x(t,i,{width:o,height:n,sceneNodes:v});if(r)return e.jsx(p.Fragment,{children:r},"annotation-"+i)}return null}),m]}),l&&"string"==typeof l?e.jsx("text",{x:i/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:l}):l?e.jsx("foreignObject",{x:0,y:0,width:i,height:s.top,children:l}):null,Ht({legend:c,totalWidth:i,totalHeight:r,margin:s,legendPosition:f,title:l,legendLayout:y,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})]}),null==b?void 0:b.filter(e=>"widget"===e.type&&e.nodeId&&v).map((t,o)=>{var n,i,r,a,l,c,u,d,h;const g=v.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=s.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=s.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(a=g.y)&&void 0!==a?a:0),y=null!==(l=t.dx)&&void 0!==l?l:0,m=null!==(c=t.dy)&&void 0!==c?c:-16,b=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e.jsx("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e.jsx("div",{style:{position:"absolute",left:f+y-b/2,top:p+m-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+o)})]})}function As(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Ss(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=As(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=rt(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&&rt(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=rt(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 Os(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=rt(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 Ms(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=As(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&rt(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=rt(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 Cs(e,t){var o,n;if(!t.pathD)return;e.save();const i=As(t),r=t.style.stroke||"#999";e.strokeStyle=rt(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&&rt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}js.displayName="NetworkSVGOverlay";const _s={top:20,right:80,bottom:20,left:80},Ps={top:40,right:40,bottom:40,left:40},Ls=new Set(["chord","force","circlepack","orbit"]),Ts=[800,600],Rs={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 Bs({data:t}){var o,n,i,r,s,a;if("edge"===t.nodeOrEdge){const o=t.data;return o?e.jsxs("div",{className:"semiotic-tooltip",style:Rs,children:[e.jsxs("div",{style:{fontWeight:600},children:["object"==typeof o.source?o.source.id:o.source," → ","object"==typeof o.target?o.target.id:o.target]}),null!=o.value&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof o.value?o.value.toLocaleString():o.value+""]})]}):null}const l=t.data;if(!l)return null;const c=l.__hierarchyNode;if(c){const t=[];let s=c;for(;s;){const e=null!==(r=null!==(n=null===(o=s.data)||void 0===o?void 0:o.name)&&void 0!==n?n:null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==r?r:l.id;null!=e&&t.unshift(e+""),s=s.parent}t.length>1&&t.shift();const a=t.length-1;return e.jsxs("div",{className:"semiotic-tooltip",style:Rs,children:[e.jsx("div",{children:t.map((t,o)=>e.jsxs("span",{children:[o>0&&e.jsx("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===a?e.jsx("strong",{children:t}):e.jsx("span",{style:{opacity:.7},children:t})]},o))}),null!=l.value&&l.value>0&&e.jsx("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof l.value?l.value.toLocaleString():l.value+""})]})}const u=((null===(s=l.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(a=l.targetLinks)||void 0===a?void 0:a.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.jsxs("div",{className:"semiotic-tooltip",style:Rs,children:[e.jsx("div",{style:{fontWeight:600},children:l.id}),null!=l.value&&l.value>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""]}),u>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`]})]})}Bs.ownsChrome=!0;const Es=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,h,g,f,p,y,m,v,b,x,w,j;const{chartType:A,nodes:O,edges:M,data:C,initialEdges:_,nodeIDAccessor:P="id",sourceAccessor:L="source",targetAccessor:T="target",valueAccessor:R="value",edgeIdAccessor:B,childrenAccessor:E,hierarchySum:N,orientation:$="horizontal",nodeAlign:D="justify",nodePaddingRatio:H=.05,nodeWidth:I=15,iterations:F=300,forceStrength:W=.1,padAngle:z=.01,groupWidth:Y=20,sortGroups:G,edgeSort:q,treeOrientation:X="vertical",edgeType:V="curve",padding:U,paddingTop:K,tensionConfig:Q,showParticles:Z=!1,particleStyle:J,nodeStyle:ee,edgeStyle:te,colorBy:oe,colorScheme:ne="category10",edgeColorBy:ie="source",edgeOpacity:re=.5,colorByDepth:se=!1,nodeSize:ae=8,nodeSizeRange:le=[5,20],nodeLabel:ce,showLabels:ue=!0,labelMode:de,size:he=Ts,responsiveWidth:ge,responsiveHeight:fe,margin:pe,className:ye,background:ve,enableHover:be=!0,tooltipContent:xe,customHoverBehavior:ke,customClickBehavior:we,onObservation:je,chartId:Ae,onTopologyChange:Se,annotations:Oe,svgAnnotationRules:Me,legend:Ce,legendPosition:_e,legendLayout:Pe,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Re,legendIsolatedCategories:Be,title:Ee,foregroundGraphics:Ne,backgroundGraphics:$e,decay:De,pulse:He,transition:Ie,animate:Fe,staleness:We,thresholds:ze,accessibleTable:Ye=!0,description:qe,summary:Xe,orbitMode:Ve,orbitSize:Ue,orbitSpeed:Ke,orbitRevolution:Qe,orbitRevolutionStyle:Ze,orbitEccentricity:Je,orbitShowRings:et,orbitAnimated:tt,customNetworkLayout:ot,layoutConfig:nt}=o,it=Ls.has(A)?Ps:_s,st=t.useRef(!0),at=Mn({sizeProp:he,responsiveWidth:ge,responsiveHeight:fe,userMargin:pe,marginDefault:it,foregroundGraphics:Ne,backgroundGraphics:$e,animate:Fe,transitionProp:Ie,themeDirtyRef:st}),{reducedMotionRef:lt,responsiveRef:ct,size:ut,margin:dt,adjustedWidth:ht,adjustedHeight:gt,resolvedForeground:ft,resolvedBackground:pt,transition:yt,introEnabled:mt,tableId:vt,rafRef:bt,renderFnRef:xt,scheduleRender:kt,currentTheme:wt}=at,Ot=To(),Ct=No(),Pt=t.useMemo(()=>k(O),[O]),Lt=t.useMemo(()=>Array.isArray(M)?k(M):M,[M]),Tt=t.useMemo(()=>Object.assign(Object.assign({},Gi),Q),[Q]),Rt=t.useMemo(()=>Object.assign(Object.assign({},qi),J),[J]),Bt=t.useMemo(()=>{var e;return{chartType:A,nodeIDAccessor:P,sourceAccessor:L,targetAccessor:T,valueAccessor:R,edgeIdAccessor:B,childrenAccessor:E,hierarchySum:N,orientation:$,nodeAlign:D,nodePaddingRatio:H,nodeWidth:I,iterations:F,forceStrength:W,padAngle:z,groupWidth:Y,sortGroups:G,edgeSort:q,treeOrientation:X,edgeType:V,padding:U,paddingTop:K,tensionConfig:Tt,showParticles:Z,particleStyle:Rt,nodeStyle:ee,edgeStyle:te,nodeLabel:ce,showLabels:ue,labelMode:de,colorBy:oe,colorScheme:ne,themeCategorical:null===(e=null==wt?void 0:wt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(wt),edgeColorBy:ie,edgeOpacity:re,colorByDepth:se,nodeSize:ae,nodeSizeRange:le,decay:De,pulse:He,transition:yt,introAnimation:mt,staleness:We,thresholds:ze,orbitMode:Ve,orbitSize:Ue,orbitSpeed:Ke,orbitRevolution:Qe,orbitRevolutionStyle:Ze,orbitEccentricity:Je,orbitShowRings:et,orbitAnimated:tt,customNetworkLayout:ot,layoutConfig:nt}},[A,P,L,T,R,E,N,$,D,H,I,F,W,z,Y,G,q,X,V,U,K,Tt,Z,Rt,ee,te,ce,ue,de,oe,ne,ie,re,se,ae,le,De,He,null==yt?void 0:yt.duration,null==yt?void 0:yt.easing,mt,We,ze,Ve,Ue,Ke,Qe,Ze,Je,et,tt,wt,ot,nt]),Et=Do(Bt),Nt=t.useRef(null),$t=t.useRef(0),Dt=t.useRef(0),Ht=t.useRef(!1),It=t.useRef(null);It.current||(It.current=new hs(Et));const[Ft,Wt]=t.useState(null),[zt,Yt]=t.useState(0),[Gt,qt]=t.useState(0),[Xt,Vt]=t.useState(!1),[Ut,Kt]=t.useState(null),Qt=t.useRef(null),Zt=t.useRef(new Map),Jt=t.useRef(0),eo=t.useCallback(e=>{if("function"==typeof oe)return oe(e)+"";if("string"==typeof oe&&e.data){const t=e.data[oe];if(void 0!==t){if(!Zt.current.has(t+"")){const e=Array.isArray(ne)?ne:me;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(ne)?ne:me,o=oe?t[Jt.current++%t.length]:t[0];return Zt.current.set(e.id,o),o},[oe,ne]),to=(null===(i=null==wt?void 0:wt.colors)||void 0===i?void 0:i.border)||(null===(r=null==wt?void 0:wt.colors)||void 0===r?void 0:r.secondary)||(null===(a=null==wt?void 0:wt.colors)||void 0===a?void 0:a.primary)||"#999",oo=t.useCallback(e=>{var t,o;return e?"object"==typeof e?e:null!==(o=null===(t=It.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==o?o:null:null},[]),no=t.useCallback(e=>{if("function"==typeof ie)return ie(e);const t=oo(e.source),o=oo(e.target);return"target"===ie&&o?eo(o):t?eo(t):to},[ie,eo,to,oo]),io=t.useCallback(e=>{if("function"==typeof Rt.color){const t=oo(e.source);return t?Rt.color(e,t):to}if(!(null==J?void 0:J.colorBy))return no(e);const t=Rt.colorBy,o=oo(e.source),n=oo(e.target);return"target"===t&&n?eo(n):o?eo(o):to},[null==J?void 0:J.colorBy,Rt.color,Rt.colorBy,eo,no,to,oo]),ro=("sankey"===A||!!ot)&&Z||!!He||null!==(c=null===(l=It.current)||void 0===l?void 0:l.isAnimating)&&void 0!==c&&c;t.useEffect(()=>{var e;null===(e=It.current)||void 0===e||e.updateConfig(Et),st.current=!0,kt()},[Et,kt]);const so=t.useCallback(()=>{var e,t;Kt(null!==(t=null===(e=It.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);t.useEffect(()=>{var e;const t=It.current;if(t){t.buildScene([ht,gt]),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);st.current=!0,kt()}},[wt,ht,gt,kt,so]);const ao=t.useCallback(()=>{var e;const t=It.current;if(!t)return;t.runLayout([ht,gt]),t.buildScene([ht,gt]),so(),st.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(ne)?ne:me,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,Yt(t.layoutVersion),Se){const{nodes:e,edges:o}=t.getLayoutData();Se(e,o)}},[ht,gt,Se,ne,so]),lo=t.useCallback(e=>{if(null==e||"object"!=typeof e)return;const t=It.current;t&&(t.ingestEdge(e)&&ao(),kt())},[ao,kt]),co=t.useCallback(e=>{const t=It.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&ao(),kt()},[ao,kt]),uo=t.useCallback(()=>{var e;null===(e=It.current)||void 0===e||e.clear(),Zt.current.clear(),Jt.current=0,Yt(0),Wt(null),Qt.current=null,st.current=!0,kt()},[kt]),ho=t.useCallback(()=>{const e=It.current;e&&(e.tension+=999,ao(),kt())},[ao,kt]);t.useImperativeHandle(n,()=>({push:lo,pushMany:co,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=It.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 P?P(Qt.current.data):Qt.current.data[P]:void 0;Qt.current&&"node"===Qt.current.nodeOrEdge&&t===e&&(Qt.current=null,Wt(null)),Zt.current.delete(e),ao(),st.current=!0,kt()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=It.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:!B||!o||("function"==typeof B?B:e=>null==e?void 0:e[B])(o)===e,n&&(Qt.current=null,Wt(null))}ao(),st.current=!0,kt()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=It.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(st.current=!0,kt()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=It.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(ao(),st.current=!0,kt()),r},clear:uo,getTopology:()=>{var e,t;return null!==(t=null===(e=It.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=It.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:ho,getTension:()=>{var e,t;return null!==(t=null===(e=It.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[lo,co,uo,ho,ao,kt]);const go=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),fo=go?C||(Array.isArray(M)?void 0:M):void 0;t.useEffect(()=>{var e;const t=It.current;if(t)if(go&&fo)t.ingestHierarchy(fo,[ht,gt]),t.buildScene([ht,gt]),so(),st.current=!0,kt();else{const o=Pt,n=Array.isArray(Lt)?Lt:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[ht,gt]),t.buildScene([ht,gt]),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(ne)?ne:me,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,st.current=!0,kt()}},[Pt,Lt,C,fo,go,ht,gt,Et,kt,ne,so]),t.useEffect(()=>{_&&_.length>0&&co(_)},[]);const po=t.useCallback(e=>{if(ke&&ke(e),je){const t=Date.now();je(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae})}},[ke,je,Ae]),yo=t.useCallback(e=>{if(we&&we(e),je){const t=Date.now();je(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae})}},[we,je,Ae]),{hoverHandlerRef:mo,hoverLeaveRef:vo,onPointerMove:bo,onPointerLeave:xo}=at;mo.current=e=>{if(!be)return;const t=Nt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-dt.left,i=e.clientY-o.top-dt.top;if(0>n||n>ht||0>i||i>gt)return void(Qt.current&&(Qt.current=null,Wt(null),po&&(po(null),st.current=!0),kt()));const r=It.current;if(!r)return;const s=ys(r.sceneNodes,r.sceneEdges,n,i);if(!s)return void(Qt.current&&(Qt.current=null,Wt(null),po&&(po(null),st.current=!0),kt()));const a=pn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Qt.current=a,Wt(a),po&&(po(a),st.current=!0),kt()},vo.current=()=>{Qt.current&&(Qt.current=null,Wt(null),po&&(po(null),st.current=!0),kt())};const ko=t.useRef(()=>{});ko.current=e=>{if(!we&&!je)return;const t=Nt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-dt.left,i=e.clientY-o.top-dt.top;if(0>n||n>ht||0>i||i>gt)return;const r=It.current;if(!r)return;const s=ys(r.sceneNodes,r.sceneEdges,n,i);yo(s?pn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const wo=t.useCallback(e=>ko.current(e),[]),jo=t.useRef(-1),Ao=t.useRef(null),So=t.useRef(-1),Oo=t.useCallback(e=>{var t;const o=It.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=jt(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,So.current=-1;const t=i.flat[0];Ao.current={shape:t.shape,w:t.w,h:t.h};const o=pn(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Qt.current=o,Wt(o),po&&(po(o),st.current=!0),void kt()}const s=At(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return St(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 u=a*a+l*l;i>u&&(i=u,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=Mt(t.source),s=Mt(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=St(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:[],So);if(null===a)return;if(e.preventDefault(),0>a)return jo.current=-1,Ao.current=null,So.current=-1,Qt.current=null,Wt(null),po&&(po(null),st.current=!0),void kt();jo.current=a;const l=i.flat[a];Ao.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,Wt(c),po&&(po(c),st.current=!0),kt()},[po,kt]),_o=t.useCallback(e=>{jo.current=-1,Ao.current=null,bo(e)},[bo]);xt.current=()=>{var e,t,o,n,i,r,s;bt.current=0;const a=Nt.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=It.current;if(!c)return;const u=performance.now(),d=$t.current?Math.min((u-$t.current)/1e3,.1):.016;$t.current=u;const h=c.advanceTransition(lt.current?u+1e6:u),g=!lt.current&&h,f=!lt.current&&c.tickAnimation([ht,gt],d);(h||st.current||f)&&c.buildScene([ht,gt]);const p=_n();if(!Cn(a,ut,dt,p))return;if(l.clearRect(-dt.left,-dt.top,ut[0],ut[1]),ve){const e=rt(l,ve);e&&(l.fillStyle=e,l.fillRect(0,0,ht,gt))}De&&c.applyDecay(),He&&c.applyPulse(u),ze&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==We?void 0:We.threshold)&&void 0!==e?e:5e3,m=We&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==We?void 0:We.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":Ss(e,o);break;case"line":Os(e,o);break;case"ribbon":Ms(e,o);break;case"curved":Cs(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&&rt(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=rt(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)),Bn(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&&rt(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=rt(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()),En(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&&rt(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=rt(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),Z&&c.particlePool&&!m){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:qi.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:qi.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 u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,d,Rt);const t=.5*(null!==(o=Rt.speedMultiplier)&&void 0!==o?o:1);let n;if(Rt.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(d,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:qi.radius,l=null!==(s=n.opacity)&&void 0!==s?s:qi.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=rt(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,Rt,io)}}m&&(l.globalAlpha=1);const v=st.current;if(st.current=!1,v||g||f){const e=Nt.current;e&&e.setAttribute("aria-label",Xo(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=v||g||f||Ht.current;b&&u-Dt.current>=33?(qt(e=>e+1),Dt.current=u,Ht.current=!1):Ht.current=!!b,(ro||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Ht.current)&&(bt.current=requestAnimationFrame(()=>xt.current()))},$o({hydrated:Ot,wasHydratingFromSSR:Ct,storeRef:It,dirtyRef:st,renderFnRef:xt}),t.useEffect(()=>{st.current=!0,kt()},[A,ht,gt,ve,kt]),_t(We,It,st,kt,Xt,Vt);const Lo=be&&Ft?e.jsx(wn,{x:Ft.x,y:Ft.y,containerWidth:ht,containerHeight:gt,margin:dt,className:"stream-network-tooltip",zIndex:2,children:xe?xe(Ft):e.jsx(Bs,{data:Ft})}):null;if(Po||!Ot&&Ct){const t=It.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),o=e?C||(Array.isArray(M)?void 0:M):void 0;if(e&&o)t.ingestHierarchy(o,[ht,gt]),t.buildScene([ht,gt]);else{const e=Pt,o=Array.isArray(Lt)?Lt:[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[ht,gt]),t.buildScene([ht,gt]))}}const o=null!==(u=null==t?void 0:t.sceneNodes)&&void 0!==u?u:[],n=null!==(d=null==t?void 0:t.sceneEdges)&&void 0!==d?d:[],i=null!==(h=null==t?void 0:t.labels)&&void 0!==h?h:[];return e.jsxs("div",{ref:ct,className:"stream-network-frame"+(ye?" "+ye:""),role:"img","aria-label":qe||("string"==typeof Ee?Ee:"Network chart"),style:{position:"relative",width:ge?"100%":ut[0],height:fe?"100%":ut[1]},children:[e.jsx(cn,{summary:Xe}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:ut[0],height:ut[1],style:{position:"absolute",left:0,top:0},children:[pt&&e.jsx("g",{transform:`translate(${dt.left},${dt.top})`,children:pt}),e.jsxs("g",{transform:`translate(${dt.left},${dt.top})`,children:[ve&&e.jsx("rect",{x:0,y:0,width:ht,height:gt,fill:ve}),n.map((t,o)=>function(t,o){switch(t.type){case"line":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e.jsx("path",{d:n.pathD,fill:Co(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.jsx("path",{d:n.pathD,fill:Co(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.jsx("path",{d:n.pathD,fill:Co(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),o.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e.jsx("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:Co(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.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:Co(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=s.arc().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(Mo)||"";return e.jsx("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:Co(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),i.map((t,o)=>function(t,o){return e.jsx("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.jsx(js,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,labels:i,sceneNodes:o,title:Ee,legend:Ce,legendPosition:_e,legendLayout:Pe,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Re,legendIsolatedCategories:Be,foregroundGraphics:Ge(ft,null===(g=It.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:Oe,svgAnnotationRules:Me,annotationFrame:0})]})}const Ro=It.current;return e.jsxs("div",{ref:ct,className:"stream-network-frame"+(ye?" "+ye:""),role:"group","aria-label":qe||("string"==typeof Ee?Ee:"Network chart"),tabIndex:0,style:{position:"relative",width:ge?"100%":ut[0],height:fe?"100%":ut[1],overflow:"visible"},onKeyDown:Oo,children:[Ye&&e.jsx(un,{tableId:vt}),Ye&&e.jsx(ln,{nodes:null!==(f=null==Ro?void 0:Ro.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==Ro?void 0:Ro.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:vt,chartTitle:"string"==typeof Ee?Ee:void 0}),e.jsx(cn,{summary:Xe}),e.jsxs("div",{role:"img","aria-label":qe||("string"==typeof Ee?Ee:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:be?_o:void 0,onMouseLeave:be?xo:void 0,onClick:we||je?wo:void 0,children:[pt&&e.jsx("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ut[0],height:ut[1],pointerEvents:"none",overflow:"visible"},children:e.jsx("g",{transform:`translate(${dt.left},${dt.top})`,children:pt})}),e.jsx("canvas",{ref:Nt,"aria-label":Xo(null!==(m=null===(y=null==Ro?void 0:Ro.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==Ro?void 0:Ro.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.jsx(dn,{hoverPoint:Ft}),e.jsx(js,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,labels:(null==Ro?void 0:Ro.labels)||[],sceneNodes:null==Ro?void 0:Ro.sceneNodes,title:Ee,legend:Ce,legendPosition:_e,legendLayout:Pe,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Re,legendIsolatedCategories:Be,foregroundGraphics:Ge(ft,Ut),annotations:Oe,svgAnnotationRules:Me,annotationFrame:Gt}),e.jsx(gn,{active:jo.current>=0,hoverPoint:Ft,margin:dt,size:ut,shape:null===(x=Ao.current)||void 0===x?void 0:x.shape,width:null===(w=Ao.current)||void 0===w?void 0:w.w,height:null===(j=Ao.current)||void 0===j?void 0:j.h}),Lo,(null==We?void 0:We.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===We.badgePosition?{top:4,left:4}:"bottom-left"===We.badgePosition?{bottom:4,left:4}:"bottom-right"===We.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{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 Ns(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 $s(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 Ds(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:kn(t)||o}}function Hs(e){return"string"==typeof e?e:"value"}function Is(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Fs(e,t){if(!t)return Is(e);try{const o=t(e);return null==o?Is(e):o}catch(t){return Is(e)}}function Ws(e,t){return"function"==typeof t?t(e):e[t]}function zs(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,n)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";o.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y0)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),o.push({label:i,accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y1)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),o}function Ys(t){const o=t.find(e=>"title"===e.role),n=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const r=o?Fs(Ws(i,o.accessor),o.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[null!=r&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((t,o)=>{const n=Fs(Ws(i,t.accessor),t.format);return e.jsxs("div",{style:o>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:n})]},o)})]})}}function Gs({categoryAccessor:t,valueAccessor:o,groupAccessor:n,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=Ws(c,t),d=Ws(c,o),h=n?Ws(c,n):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[e.jsx("div",{style:{fontWeight:"bold"},children:Is(u)}),e.jsx("div",{style:{marginTop:4},children:Fs(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||Hs(n),": ",Is(h)]})]})}}Es.displayName="StreamNetworkFrame";const qs=t.createContext(null);function Xs({colors:o,categories:n,colorScheme:i="category10",children:r}){const s=t.useMemo(()=>{if(o)return o;if(n){const e=Array.isArray(i)?i:ye[i]||me,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[o,n,i]);return e.jsx(qs.Provider,{value:s,children:r})}function Vs(){return t.useContext(qs)}function Us(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 Ks(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Us(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Qs(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}Xs.displayName="CategoryColorProvider";const[Zs,Js]=j(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Qs(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=Qs(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}})}})),[ea,ta]=j(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 oa(e){const o=t.useId(),n=e.clientId||o,{name:i}=e,r=Js(e=>e.selections.get(i)),s=Js(e=>e.setClause),a=Js(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?Ks(r,n):()=>!0,[r,n]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(i,{clientId:n,type:"point",fields:t})},[n,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(i,{clientId:n,type:"interval",fields:t})},[n,i,s]),clear:t.useCallback(()=>{a(i,n)},[a,i,n]),clientId:n}}function na(e){const o=e.name||"hover",{fields:n}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=oa({name:o});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&s(t)},[n,s,a,o]),predicate:i,isActive:r}}function ia(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function ra(e){const{name:o,xField:n,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=oa({name:o}),c=n&&i?"xyBrush":n?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&ia(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&ia(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}function sa(e={}){const{limit:o=50,types:n,chartId:i}=e,r=ta(e=>e.version),s=ta(e=>e.observations),a=ta(e=>e.clearObservations),l=t.useMemo(()=>{let e=s;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return i&&(e=e.filter(e=>e.chartId===i)),e.length>o&&(e=e.slice(e.length-o)),e},[s,n,i,o,r]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const aa=t.createContext(!1),la=t.createContext(null),ca="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function ua(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function da(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 ha(e){const o=t.useContext(la),n=t.useId(),i=ua(e),r=t.useRef([]);da(r.current,i)||(r.current=i);const s=r.current;ca(()=>{if(o)return()=>o.unregisterCategories(n)},[o,n]),ca(()=>{o&&o.registerCategories(n,s)},[o,n,s])}function ga({selections:e}){const o=Js(e=>e.setResolution);return t.useEffect(()=>{for(const[t,n]of Object.entries(e))n.resolution&&o(t,n.resolution)},[e,o]),null}function fa({categoryColors:o,interaction:n,selectionName:i,field:r}){const s=Object.entries(o),a=s.map(([e])=>e),l=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:s.map(([e,t])=>({label:e,color:t})),label:""}],c=na({name:i,fields:[r]}),u=oa({name:i,clientId:"__linked-legend-isolate__"}),[d,h]=t.useState(new Set),[g,f]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===n&&(d.size>0?p.current({[r]:Array.from(d)}):y.current())},[n,d,r]);const m=t.useCallback(e=>{"highlight"===n&&(e?(f(e.label),c.onHover({[r]:e.label})):(f(null),c.onHover(null)))},[n,r,c]),v=t.useCallback(e=>{"isolate"===n&&h(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===a.length?new Set:o})},[n,a.length]),[b,[x]]=An([0,0],!0,!1),k=t.useMemo(()=>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}(s.map(([e])=>e),x),[s,x]);return 0===s.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(Nt,{legendGroups:l,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===n?m:void 0,customClickBehavior:"isolate"===n?v:void 0,highlightedCategory:g,isolatedCategories:d})})})}function pa({children:o,selections:n,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:a="legend",legendField:l="category"}){const c=Vs(),[u,d]=t.useState({}),h=t.useRef({}),g=t.useMemo(()=>({registerCategories:(e,t)=>{const o=ua(t);d(t=>{var n;return da(null!==(n=t[e])&&void 0!==n?n:[],o)?t:Object.assign(Object.assign({},t),{[e]:o})})},unregisterCategories:e=>{d(t=>{if(!(e in t))return t;const o=Object.assign({},t);return delete o[e],o})}}),[]),f=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const o of t)e.push(o);return ua(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},o=h.current;let n=Object.keys(t).length+Object.keys(o).length;for(const e of f)t[e]||o[e]||(o[e]=me[n%me.length],n++);const i=Object.assign({},t);for(const n of f)i[n]=null!==(e=t[n])&&void 0!==e?e:o[n];return i},[c,f]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(Zs,{children:e.jsxs(ea,{children:[n&&e.jsx(ga,{selections:n}),e.jsx(la.Provider,{value:g,children:e.jsx(Xs,{colors:p,children:e.jsxs(aa.Provider,{value:m,children:[y&&"top"===r&&e.jsx(fa,{categoryColors:p,interaction:s,selectionName:a,field:l}),o,y&&"bottom"===r&&e.jsx(fa,{categoryColors:p,interaction:s,selectionName:a,field:l})]})})})]})})}function ya({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):ve[r%ve.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 ma(e){return e?"string"==typeof e?{name:e}:e:null}function va(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 ba={light:C,dark:_,"high-contrast":P,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 xa(e){return ba[e]}const ka=p.createContext(void 0),wa="undefined"==typeof window?p.useEffect:p.useLayoutEffect;function ja(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return xa(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Aa({theme:e}){const t=R(e=>e.setTheme),o=R(e=>e.theme),n=p.useRef(o);n.current=o;const i=p.useRef(null);p.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(i.current=n.current===P?C:n.current,t("high-contrast")),jn(o,e=>{var o,r;e.matches?(i.current=n.current===P?null!==(o=i.current)&&void 0!==o?o:C:n.current,t("high-contrast")):(function(e,t){e(t===C?"light":t===_?"dark":t===P?"high-contrast":t)}(t,null!==(r=i.current)&&void 0!==r?r:C),i.current=null)})},[e,t]);const r=p.useRef(!1);return wa(()=>{r.current?void 0!==e&&t(ja(e)):r.current=!0},[e,t]),null}function Sa({children:t}){var o,n,i,r,s;const a=R(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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":a.colors.background,"--semiotic-text":a.colors.text,"--semiotic-text-secondary":a.colors.textSecondary,"--semiotic-grid":a.colors.grid,"--semiotic-border":a.colors.border,"--semiotic-cell-border":a.colors.cellBorder||a.colors.border,"--semiotic-primary":a.colors.primary,"--semiotic-font-family":a.typography.fontFamily},a.colors.focus?{"--semiotic-focus":a.colors.focus}:{}),(null===(o=a.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":a.tooltip.background}:{}),(null===(n=a.tooltip)||void 0===n?void 0:n.text)?{"--semiotic-tooltip-text":a.tooltip.text}:{}),(null===(i=a.tooltip)||void 0===i?void 0:i.borderRadius)?{"--semiotic-tooltip-radius":a.tooltip.borderRadius}:{}),(null===(r=a.tooltip)||void 0===r?void 0:r.fontSize)?{"--semiotic-tooltip-font-size":a.tooltip.fontSize}:{}),(null===(s=a.tooltip)||void 0===s?void 0:s.shadow)?{"--semiotic-tooltip-shadow":a.tooltip.shadow}:{}),a.borderRadius?{"--semiotic-border-radius":a.borderRadius}:{}),a.colors.selection?{"--semiotic-selection-color":a.colors.selection}:{}),null!=a.colors.selectionOpacity?{"--semiotic-selection-opacity":a.colors.selectionOpacity+""}:{}),a.colors.diverging?{"--semiotic-diverging":a.colors.diverging}:{}),a.colors.annotation?{"--semiotic-annotation-color":a.colors.annotation}:{}),null!=a.typography.legendSize?{"--semiotic-legend-font-size":a.typography.legendSize+"px"}:{}),null!=a.typography.titleFontSize?{"--semiotic-title-font-size":a.typography.titleFontSize+"px"}:{}),null!=a.typography.tickFontFamily?{"--semiotic-tick-font-family":a.typography.tickFontFamily}:{}),null!=a.typography.tickSize?{"--semiotic-tick-font-size":a.typography.tickSize+"px"}:{}),null!=a.typography.labelSize?{"--semiotic-axis-label-font-size":a.typography.labelSize+"px"}:{}),{"--semiotic-secondary":a.colors.secondary||a.colors.primary,"--semiotic-surface":a.colors.surface||a.colors.background}),a.colors.success?{"--semiotic-success":a.colors.success}:{}),a.colors.danger?{"--semiotic-danger":a.colors.danger}:{}),a.colors.warning?{"--semiotic-warning":a.colors.warning}:{}),a.colors.error?{"--semiotic-error":a.colors.error}:{}),a.colors.info?{"--semiotic-info":a.colors.info}:{}),c=p.useContext(ka),u={};return c&&(u["data-semiotic-theme"]=c),e.jsx("div",Object.assign({style:l},u,{children:t}))}function Oa(){return R(e=>e.theme)}const Ma="#007bff";function Ca(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 _a(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 Pa(){var e;const t=Oa(),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 La(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=ye[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]:Ma}function Ta(e,o,n){const i=Vs(),r=Pa();return t.useMemo(()=>{var t;if(!o)return;const s=null!==(t=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof o){const t=Array.from(new Set(e.map(e=>o(e)+"")));if(i&&Object.keys(i).length>0){const e=we(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return we(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=we(e,o,s);return e=>i[e]||t(e)}return we(e,o,s)}if(i&&Object.keys(i).length>0){const e=we([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,o,n,i,r])}function Ra(e,o,n){return t.useMemo(()=>{if(!o||"auto"===o||"function"==typeof o)return e;const t=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(n);return t.sort("asc"===o?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,o,n])}function Ba({selection:e,linkedHover:o,fallbackFields:n=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(o,n),g=oa({name:(null==e?void 0:e.name)||"__unused__"}),f=na({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||n||[]}),p=ta(e=>e.pushObservation),y=e?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=t.useState(null),b=u||n[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[c,m,b]),k=t.useCallback(e=>{var t,n;if(o)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const o=Ca(e,t,h.xField);null!=o&&function(e,t,o){const n=to.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(to={positions:new Map(to.positions).set(e,{xValue:t,sourceId:o})},no())}(h.name||"hover",o,d)}"x-position"!==(null==h?void 0:h.mode)&&f.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&io(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&f.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[b];v(null!=o?o+"":null)}else v(null);if(r||p){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=_a(e),s=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});r&&r(e),p&&p(e)}}},[o,f,h,d,r,s,a,p,c,b]),w=t.useCallback(e=>{var t,o,n,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=Ca(e,t,h.xField);null!=o&&function(e,t,o){const n=to.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(to.positions);return t.delete(e),to={positions:t},no(),!1}to={positions:new Map(to.positions).set(e,{xValue:t,sourceId:o,locked:!0})},no()}(h.name||"hover",o,d)}if(e&&l){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),l(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(r||p){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const o=_a(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),p&&p(e)}}},[l,r,p,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{ro(e,d),io(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function Ea(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 Na({data:e,colorBy:o,colorScale:n,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(aa),u=null!==t.useContext(la),d=void 0!==i?i:!c&&!!o,h=!!o&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const n of e){const e="function"==typeof o?o(n):n[o];null!=e&&t.add(e+"")}return Array.from(t)},[l,o,e,h]);ha(u&&o?g:[]);const f=t.useMemo(()=>{if(!d||!o)return;const t=ya({data:e,colorBy:o,colorScale:n,getColor:ke,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,o,e,n,g]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const o=e[t];return"number"==typeof o?o:a[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[a,s,f,r]);return{legend:f,margin:p,legendPosition:r}}function $a(e,o,n){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(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]),u=t.useMemo(()=>{if(!e||"none"===e||!o)return null;const t="string"==typeof o?o:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof o?o(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=t?e[t]:"function"==typeof o?o(e):null;return s.has(n)}}:null},[e,o,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}const Da={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 Ha(e,t,o){var n,i,r,s,a,l,c;const u=Da[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Ia(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Ia(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 Fa({componentName:t,message:o,diagnosticHint:n,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),n&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}class Wa extends p.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.jsx(Fa,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var za;const Ya="undefined"!=typeof process&&"production"!==(null===(za=process.env)||void 0===za?void 0:za.NODE_ENV);function Ga({componentName:t,width:o,height:n,children:i}){return e.jsx(Wa,{fallback:i=>e.jsx(Fa,{componentName:t,message:i.message,width:o,height:n}),children:i})}const qa={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"},Xa={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Va(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},qa),{width:o,height:n}),children:i||"No data available"}):null}function Ua(t,o,n,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:o,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(n/40)),s=Math.max(8,Math.floor(n/(3*r))),a=Math.max(6,Math.floor(n/(2.5*r))),l=Math.floor((n-(r*(s+a)-a))/2);return e.jsx("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:r},(t,n)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Xa),{position:"absolute",top:l+n*(s+a),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:s,opacity:.5+n%2*.2})},n))})}function Ka(e,t,o,n){if(!Ya)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 Qa(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 Za(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Ja(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=Qa(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function el({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=Za(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=Ja(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function tl({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 ol({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=Za(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=Ja(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function nl(e){const o=R(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,n;if(void 0!==e||void 0!==o)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:o})},[e,o])}function il(e){const{data:o,rawData:n,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,loadingContent:w,emptyContent:j,width:A,height:S}=e,O=void 0===n,M=t.useMemo(()=>k(o),[o]),[C,_]=t.useState([]),P=t.useCallback(e=>{_(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:R,customHoverBehavior:B,customClickBehavior:E,crosshairSourceId:N}=Ba({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:L}),$=Ea(c,N),D=Ta(M,i,r),H=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const o="function"==typeof i?i(t):t[i];null!=o&&e.add(o+"")}return Array.from(e)},[M,i]),I=t.useMemo(()=>O&&C.length>0?C:H,[O,C,H]),F=$a(s,i,I),W=t.useMemo(()=>R||(F.legendSelectionHook?F.legendSelectionHook:T),[R,F.legendSelectionHook,T]),z=nl(l),Y=Pa(),G=Vs(),q=t.useMemo(()=>{if(D)return D;if(!i||0===I.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Y&&Y.length>0?Y:ve,t="__streamCat",o=we(I.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||o(e)||"#999"},[D,i,I,r,Y,G]),{legend:X,margin:V,legendPosition:U}=Na({data:M,colorBy:i,colorScale:q,showLegend:p,legendPosition:a,userMargin:y,defaults:m,categories:I}),K=t.useMemo(()=>{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),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[X,U,s,F.onLegendHover,F.onLegendClick,F.highlightedCategory,F.isolatedCategories,O,i,P]),Q=Array.isArray(n)?k(n):n,Z=Ua(x,A,S,w),J=Z?null:Va(Q,A,S,j);return{data:M,colorScale:D,allCategories:I,legendState:F,effectiveSelectionHook:W,activeSelectionHook:T,customHoverBehavior:B,customClickBehavior:E,legend:X,margin:V,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:K,crosshairProps:$,resolvedSelection:z}}function rl(e,o){const{variant:n,frameRef:i,overrides:r,deps:s}=o;t.useImperativeHandle(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:[]}}}(n,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}function sl(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 al(e){const{colorBy:o,colorScale:n,color:i,pointRadius:r=5,radiusFn:s,fillOpacity:a=1,fallbackFill:l,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=t.useMemo(()=>e=>{const t="function"==typeof c?c(e):c,u=t?Object.assign({},t):{};if(void 0===u.fillOpacity&&(u.fillOpacity=a),void 0===u.fill)if(o){if(n){const t=p?p(e):e;u.fill=ke(t,o,n)}}else u.fill=l?l(e):i||Ma;return void 0===u.r&&(u.r=s?s(e):r),u},[o,n,i,r,s,a,l,c,p]),m=t.useMemo(()=>sl(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return t.useMemo(()=>va(m,null!=g?g:null,f),[m,g,f])}function ll(e){const{accessor:o,data:n,isPushMode:i}=e,r=t.useRef(null),[s,a]=t.useState(0),l=t.useCallback(e=>{if(!i||!o)return;let t=!1;for(const n of e){const e="function"==typeof o?o(n):n[o];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,t=!0),i>r.current[1]&&(r.current[1]=i,t=!0)):(r.current=[i,i],t=!0))}t&&a(e=>e+1)},[i,o]),c=t.useCallback(()=>{i&&(r.current=null,a(e=>e+1))},[i]),u=t.useMemo(()=>{var e;if(i)return null!==(e=r.current)&&void 0!==e?e:void 0;if(!o||0===n.length)return;const t="function"==typeof o?o:e=>e[o];let s=1/0,a=-1/0;for(const e of n){const o=t(e);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(s>n&&(s=n),n>a&&(a=n))}return Number.isFinite(s)&&Number.isFinite(a)?[s,a]:void 0},[n,o,i,s]);return{domain:u,trackPushed:l,reset:c}}function cl(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})}function ul(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}function dl(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 hl="__forecastSegment";let gl=null;function fl(){return dl(this,void 0,void 0,function*(){return gl||(gl=yield Promise.resolve().then(function(){return rd})),gl})}const pl="__semiotic_resolvedX",yl="__semiotic_resolvedY";function ml(e){const{data:o,xAccessor:n,yAccessor:i,forecast:r,anomaly:s,groupBy:a}=e,l="string"==typeof n?n:pl,c="string"==typeof i?i:yl,u=t.useMemo(()=>{if(!r&&!s)return o;const e="function"==typeof n,t="function"==typeof i;return e||t?o.map(o=>{const r=Object.assign({},o);return e&&(r[pl]=n(o)),t&&(r[yl]=i(o)),r}):o},[o,r,s,n,i]),[d,h]=t.useState(null),[g,f]=t.useState([]),p=t.useRef(r),y=t.useRef(s);return t.useEffect(()=>{if(!r&&!s)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=s));let e=!1;const t=r!==p.current||s!==y.current;if(p.current=r,y.current=s,t&&(h(null),f([])),r){const t=a&&"string"==typeof a&&"object"==typeof r?Object.assign(Object.assign({},r),{_groupBy:a}):r;(function(...e){return dl(this,void 0,void 0,function*(){return(yield fl()).buildForecast(...e)})})(u,l,c,t,s).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else s&&function(...e){return dl(this,void 0,void 0,function*(){return(yield fl()).buildAnomalyAnnotations(...e)})}(s).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[u,r,s,l,c,a]),{effectiveData:d?d.processedData:o,statisticalAnnotations:g,hasForecast:!!d,xAccessorKey:l,yAccessorKey:c}}const vl=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xScaleType:g,yScaleType:f,colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:w=.8,tooltip:j,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:M,forecast:C,anomaly:_,xExtent:P,yExtent:L,frameProps:T={},selection:R,linkedHover:B,linkedBrush:E,onObservation:N,onClick:$,hoverHighlight:D,chartId:H,loading:I,loadingContent:F,emptyContent:W,legendInteraction:z,legendPosition:Y,color:G,stroke:q,strokeWidth:X,opacity:V}=o,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:oe,accessibleTable:ne,xLabel:ie,yLabel:re}=r,se=t.useMemo(()=>k(s),[s]),ae=void 0===s,{domain:le,trackPushed:ce,reset:ue}=ll({accessor:v,data:se,isPushMode:ae}),de=t.useCallback(e=>{var t;ce([e]),null===(t=i.current)||void 0===t||t.push(e)},[ce]),he=t.useCallback(e=>{var t;ce(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[ce]);rl(n,{variant:"xy",frameRef:i,overrides:{push:de,pushMany:he,clear:()=>{var e;ue(),null===(e=i.current)||void 0===e||e.clear()}},deps:[de,he,ue]});const ge=il({data:se,rawData:s,colorBy:y,colorScheme:m,legendInteraction:z,legendPosition:Y,selection:R,linkedHover:B,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:N,onClick:$,hoverHighlight:D,chartType:"Scatterplot",chartId:H,showLegend:J,userMargin:a,marginDefaults:r.marginDefaults,loading:I,loadingContent:F,emptyContent:W,width:U,height:K}),fe=ma(E),pe=ra({name:(null==fe?void 0:fe.name)||"__unused_brush__",xField:(null==fe?void 0:fe.xField)||("string"==typeof d?d:void 0),yField:(null==fe?void 0:fe.yField)||("string"==typeof h?h:void 0)}),ye=fe?"xyBrush"===pe.brushInteraction.brush?"xy":"xBrush"===pe.brushInteraction.brush?"x":"y":void 0,me=p.useRef(pe.brushInteraction);me.current=pe.brushInteraction;const ve=t.useCallback(e=>{const t=me.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(ge.earlyReturn)return ge.earlyReturn;Ka("Scatterplot",se,"xAccessor",d),Ka("Scatterplot",se,"yAccessor",h);const be=t.useMemo(()=>v?null!=le?le:[0,1]:void 0,[v,le]),xe=t.useMemo(()=>v?e=>je(e,v,b,be):void 0,[v,b,be]),ke=al({colorBy:y,colorScale:ge.colorScale,color:G,pointRadius:x,fillOpacity:w,radiusFn:xe,stroke:q,strokeWidth:X,opacity:V,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection}),we=t.useMemo(()=>Ys([{label:ie||Hs(d),accessor:d,role:"x",format:c},{label:re||Hs(h),accessor:h,role:"y",format:u},...y?[{label:Hs(y),accessor:y,role:"color"}]:[],...v?[{label:Hs(v),accessor:v,role:"size"}]:[]]),[d,h,ie,re,y,v,c,u]),{effectiveData:Ae,statisticalAnnotations:Se}=ml({data:se,xAccessor:d,yAccessor:h,forecast:C,anomaly:_}),Oe=t.useMemo(()=>{const e=cl(M);return e||0!==Se.length?[...e?[e]:[],...O||[],...Se]:O},[M,O,Se]),Me=el({componentName:"Scatterplot",data:s,accessors:{xAccessor:d,yAccessor:h}});if(Me)return e.jsx(Fa,{componentName:"Scatterplot",message:Me,width:U,height:K});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({chartType:"scatter"},null!=s&&{data:Ae}),{xAccessor:d,yAccessor:h,xScaleType:g,yScaleType:f,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:ke,colorScheme:m,size:[U,K],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:ie,yLabel:re,xFormat:c,yFormat:u,enableHover:Q,showGrid:Z}),ge.legendBehaviorProps),Ns({title:ee,description:te,summary:oe,accessibleTable:ne,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:j,defaultTooltipContent:we})),$s({linkedHover:B,onObservation:N,onClick:$,hoverHighlight:D,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),Oe&&Oe.length>0&&{annotations:Oe}),P&&{xExtent:P}),L&&{yExtent:L}),fe&&{brush:{dimension:ye},onBrush:ve}),ge.crosshairProps),T);return e.jsx(Ga,{componentName:"Scatterplot",width:U,height:K,children:e.jsx(si,Object.assign({ref:i},Ce))})});function bl(e,t){return ne(1===t?.5:e/(t-1))}vl.displayName="Scatterplot";const xl=t.forwardRef(function(o,n){var i,r;const s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const a=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,regression:k,forecast:w,anomaly:j,xExtent:A,yExtent:S,frameProps:O={},selection:M,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:T,loading:R,loadingContent:B,emptyContent:E,legendInteraction:N,stroke:$,strokeWidth:D,opacity:H}=o,{width:I,height:F,enableHover:W,showGrid:z,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V,yLabel:U}=a,K=l||[],{safeData:Q,orderMap:Z}=t.useMemo(()=>{const e="function"==typeof g?g:e=>e[g],t="function"==typeof f?f:e=>e[f];let o=K;if(p&&K.length>0){const e="function"==typeof p?p:e=>e[p];o=[...K].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}},[K,p,g,f]);Ka("ConnectedScatterplot",Q,"xAccessor",g),Ka("ConnectedScatterplot",Q,"yAccessor",f);const J=il({data:Q,rawData:l,colorBy:void 0,colorScheme:void 0,legendInteraction:N,selection:M,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"ConnectedScatterplot",chartId:T,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:R,loadingContent:B,emptyContent:E,width:I,height:F}),ee=null!==(r=null===(i=J.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==r?r:.5,te=t.useMemo(()=>(e,t)=>{var o,n,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(o=J.effectiveSelectionHook)||void 0===o?void 0:o.isActive,l=null===(n=J.effectiveSelectionHook)||void 0===n?void 0:n.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const o=s[t],n=s[t+1],d=bl(t,u),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:ee:1;c&&(e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle=d,e.lineWidth=m,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[m,J.effectiveSelectionHook,ee]),oe=t.useMemo(()=>[te],[te]),ne=t.useMemo(()=>(t,o,n)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const a=s.length,l=100>a,c=[];for(let t=0;a-1>t;t++){const o=s[t],n=s[t+1],u=bl(t,a),d="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,h="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,g=Math.min(d,h);l&&c.push(e.jsx("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),c.push(e.jsx("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:g},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),ie=t.useMemo(()=>[ne],[ne]),re=t.useMemo(()=>e=>{var t,o;const n=Z.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?bl(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,Z]),se=al({colorScale:void 0,baseStyleExtras:re,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ae=y||("string"==typeof p?p:"Order"),le=t.useMemo(()=>Ys([{label:V||Hs(g),accessor:g,role:"x",format:d},{label:U||Hs(f),accessor:f,role:"y",format:h},...p?[{label:ae,accessor:p,role:"group"}]:[]]),[g,f,V,U,p,ae,d,h]),ce=el({componentName:"ConnectedScatterplot",data:l,accessors:{xAccessor:g,yAccessor:f}}),{effectiveData:ue,statisticalAnnotations:de}=ml({data:Q,xAccessor:g,yAccessor:f,forecast:w,anomaly:j}),he=cl(k),ge=he||de.length>0?[...he?[he]:[],...x||[],...de]:x,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:ue}),{xAccessor:g,yAccessor:f,pointStyle:se,size:[I,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:d,yFormat:h,enableHover:W,showGrid:z}),Ns({title:Y,description:G,summary:q,accessibleTable:X,className:u,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:v,defaultTooltipContent:le})),$s({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:oe,svgPreRenderers:ie}),ge&&ge.length>0&&{annotations:ge}),A&&{xExtent:A}),S&&{yExtent:S}),J.crosshairProps),O);return J.earlyReturn?J.earlyReturn:ce?e.jsx(Fa,{componentName:"ConnectedScatterplot",message:ce,width:I,height:F}):e.jsx(Ga,{componentName:"ConnectedScatterplot",width:I,height:F,children:e.jsx(si,Object.assign({ref:s},fe))})});function kl(e){const{lineWidth:o=2,colorBy:n,colorScale:i,color:r,resolveStroke:s,fillArea:a,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g}=e,f=t.useMemo(()=>(e,t)=>{const c={strokeWidth:o},u=!0===a||Array.isArray(a)&&null!=t&&a.includes(t);let d;return s?d=s(e,t):n?i&&(d=ke(e,n,i)):d=r||Ma,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=l)),c},[o,n,i,r,s,a,l]),p=t.useMemo(()=>sl(f,{stroke:c,strokeWidth:u,opacity:d}),[f,c,u,d]);return t.useMemo(()=>va(p,null!=h?h:null,g),[p,h,g])}xl.displayName="ConnectedScatterplot";const wl=t.forwardRef(function(o,n){var i,r;const s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const a=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,summary:o.summary,accessibleTable:o.accessibleTable,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,axisExtent:g,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="linear",showPoints:w=!1,pointRadius:j=3,fillArea:A=!1,areaOpacity:S=.3,lineWidth:O=2,lineGradient:M,tooltip:C,pointIdAccessor:_,annotations:P,directLabel:L,gapStrategy:T="break",anomaly:R,forecast:B,band:E,xExtent:N,yExtent:$,frameProps:D={},selection:H,linkedHover:I,onObservation:F,onClick:W,hoverHighlight:z,hoverRadius:Y,chartId:G,loading:q,loadingContent:X,emptyContent:V,legendInteraction:U,legendPosition:K,xScaleType:Q,yScaleType:Z,color:J,stroke:ee,strokeWidth:te,opacity:oe}=o,{width:ne,height:ie,enableHover:re,showGrid:se,showLegend:ae,title:le,description:ce,summary:ue,accessibleTable:de,xLabel:he,yLabel:ge}=a,fe=t.useMemo(()=>k(l),[l]);Ka("LineChart",fe,"xAccessor",f),Ka("LineChart",fe,"yAccessor",p);const{effectiveData:pe,statisticalAnnotations:ye}=ml({data:fe,xAccessor:f,yAccessor:p,forecast:B,anomaly:R,groupBy:y}),me="__compoundGroup",ve=!(!B||!y),be=ve?me:B?hl:y,xe=t.useMemo(()=>{if(!ve)return pe;const e="function"==typeof y?y:e=>e[y];return pe.map(t=>{const o=Object.assign({},t);return o[me]=`${e(t)}__${t[hl]||"observed"}`,o})},[pe,ve,y]),we=ve?xe:pe,je=v||y,Ae=t.useMemo(()=>{if(!B)return;const e=B.upperBounds,t=B.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=pe;for(const e of s){const t="function"==typeof p?p(e):+e[p];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},[B,pe,p]),Se=t.useCallback(e=>{const t="function"==typeof f?f(e):e[f],o="function"==typeof p?p(e):e[p];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[f,p]),Oe=void 0!==(null===(i=we[0])||void 0===i?void 0:i[m]),Me=t.useMemo(()=>{if(Oe)return we;if(be){const e=we.reduce((e,t)=>{const o="function"==typeof be?be(t):t[be];if(!e[o]){const n={[m]:[]};"string"==typeof be&&(n[be]=o),ve&&(n[hl]=t[hl],"string"==typeof y&&(n[y]=t[y])),e[o]=n}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:we}]},[we,be,m,Oe]),{gapProcessedLineData:Ce,hasGaps:_e}=t.useMemo(()=>{if("interpolate"===T){let e=!1;const t=[];for(const o of Me){const n=(o[m]||[]).filter(t=>!Se(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[m]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const o of Me){const n=o[m]||[];let i=[],r=0;const s=be&&"string"==typeof be?o[be]:void 0;for(const a of n)if(Se(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[m]: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),{[m]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof p?p:"y",o=[];for(const n of Me){const i=n[m]||[],r=[];for(const o of i)Se(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[m]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Me,hasGaps:!1}},[Me,T,m,Se,be,p]),Pe="object"==typeof L?L:{},Le=Pe.position||"end",Te=Pe.fontSize||11,Re=t.useMemo(()=>{var e;if(!L||!je)return[];const t="function"==typeof je?je:e=>e[je],o=new Set;for(const n of Ce){const i=n[m]||[];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)},[L,je,Ce,m,Le]),Be=t.useMemo(()=>{if(!L)return a.marginDefaults;const e=Re.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0)+10,t="end"===Le?"right":"left";return Object.assign(Object.assign({},a.marginDefaults),{[t]:Math.max(a.marginDefaults[t]||0,e)})},[L,Re,Te,Le,a.marginDefaults]),Ee=il({data:pe,rawData:l,colorBy:je,colorScheme:b,legendInteraction:U,legendPosition:K,selection:H,linkedHover:I,fallbackFields:je?["string"==typeof je?je:""]:[],unwrapData:!1,onObservation:F,onClick:W,hoverHighlight:z,chartType:"LineChart",chartId:G,showLegend:(!L||void 0!==ae)&&ae,userMargin:c,marginDefaults:Be,loading:q,loadingContent:X,emptyContent:V,width:ne,height:ie}),Ne=Ee.colorScale,$e=Ee.customHoverBehavior,De=Ee.customClickBehavior,He=Ee.crosshairProps,Ie=kl({lineWidth:O,colorBy:je,colorScale:Ne,color:J,fillArea:A,areaOpacity:S,stroke:ee,strokeWidth:te,opacity:oe,effectiveSelectionHook:Ee.effectiveSelectionHook,resolvedSelection:Ee.resolvedSelection}),[Fe,We]=t.useState(null);t.useEffect(()=>{if(!B)return void We(null);let e=!1;return function(...e){return dl(this,void 0,void 0,function*(){return(yield fl()).createSegmentLineStyle(...e)})}(Ie,B).then(t=>{e||We(()=>t)}).catch(()=>{e||We(null)}),()=>{e=!0}},[Ie,B]);const ze=Fe||Ie,Ye=t.useMemo(()=>{if(w)return e=>{const t={r:j,fillOpacity:1};return je?Ne&&(t.fill=ke(e.parentLine||e,je,Ne)):t.fill=J||Ma,t}},[w,j,je,Ne,J]),Ge=Array.isArray(A)?"mixed":A?"area":"line",qe=t.useMemo(()=>{var e;if(!L||!je)return[];const t="function"==typeof f?f:e=>e[f],o="function"==typeof p?p:e=>e[p],n="function"==typeof je?je:e=>e[je],i=new Map;for(const t of Ce){const o=t[m]||[];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 f?f:"x"]:t(n),["string"==typeof p?p:"y"]:o(n),dx:"end"===Le?6:-6,dy:0,color:Ne?Ne(e):Ma,fontSize:Te}));r.sort((e,t)=>{const o="string"==typeof p?p:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof p?p:"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},[L,je,Ne,Ce,m,f,p,Le,Te]),Xe=Ee.margin,Ve=y||v,Ue=t.useMemo(()=>Ys([{label:he||Hs(f),accessor:f,role:"x",format:d},{label:ge||Hs(p),accessor:p,role:"y",format:h},...Ve?[{label:Hs(Ve),accessor:Ve,role:"group"}]:[],...zs(E,h)]),[f,p,he,ge,Ve,d,h,E]),Ke=el({componentName:"LineChart",data:Oe?(null===(r=pe[0])||void 0===r?void 0:r[m])||[]:l,accessors:{xAccessor:f,yAccessor:p}}),Qe=t.useMemo(()=>Oe||be||_e?Ce.flatMap(e=>{const t=e[m]||[];return be&&"string"==typeof be?t.map(t=>Object.assign(Object.assign({},t),{[be]:e[be]})):t}):we,[Ce,m,Oe,be,we,_e]),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(Object.assign(Object.assign({chartType:Ge},Array.isArray(A)&&{areaGroups:A}),M&&{lineGradient:M}),null!=Y&&{hoverRadius:Y}),null!=l&&{data:Qe}),{xAccessor:f,yAccessor:p,xScaleType:Q,yScaleType:Z}),N&&{xExtent:N}),!$||null==$[0]&&null==$[1]?Ae?{yExtent:Ae}:{}:{yExtent:$}),{groupAccessor:"break"===T&&_e?"_gapSegment":be||void 0}),E&&{band:E}),{curve:x,lineStyle:ze}),w&&{pointStyle:Ye}),{size:[ne,ie],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Xe,showAxes:a.showAxes,xLabel:he,yLabel:ge,xFormat:d,yFormat:h}),void 0!==g&&{axisExtent:g}),{enableHover:re,showGrid:se}),Ee.legendBehaviorProps),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===C?()=>null:"multi"===C?xn():kn(C)||Ue}),"multi"===C&&{tooltipMode:"multi"}),(I||F||W||z)&&{customHoverBehavior:$e}),(F||W||I)&&{customClickBehavior:De}),_&&{pointIdAccessor:_}),((null==P?void 0:P.length)||ye.length||qe.length)&&{annotations:[...P||[],...ye,...qe]}),He),D);return Ee.earlyReturn?Ee.earlyReturn:Ke?e.jsx(Fa,{componentName:"LineChart",message:Ke,width:ne,height:ie}):e.jsx(Ga,{componentName:"LineChart",width:ne,height:ie,children:e.jsx(si,Object.assign({ref:s},Ze))})});function jl(e){var o;const{safeData:n,data:i,areaBy:r,lineDataAccessor:s,colorBy:a,colorScale:l,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:j,xFormat:A,yFormat:S,groupField:O}=e,M=void 0!==(null===(o=n[0])||void 0===o?void 0:o[s]),C=t.useMemo(()=>{if(null==i)return[];if(!M&&!r)return n;let e;if(M)e=n;else{const t=r,o=n.reduce((e,o)=>{const n="function"==typeof t?t(o):o[t];if(!e[n]){const o={[s]:[]};"string"==typeof t&&(o[t]=n),e[n]=o}return e[n][s].push(o),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[s]||[];return r&&"string"==typeof r?t.map(t=>Object.assign(Object.assign({},t),{[r]:e[r]})):t})},[i,n,r,s,M]),_=t.useMemo(()=>e=>{const t={};if(a){if(l){const o=ke(e,a,l);t.fill=o,y?(t.stroke=o,t.strokeWidth=m):t.stroke="none"}}else{const e=c||Ma;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=t.useMemo(()=>sl(_,{stroke:u,strokeWidth:d,opacity:h}),[_,u,d,h]);return{flattenedData:C,lineStyle:t.useMemo(()=>va(P,null!=g?g:null,f),[P,g,f]),pointStyle:t.useMemo(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return a?l&&(t.fill=ke(e.parentLine||e,a,l)):t.fill=c||Ma,t}},[v,b,a,l,c]),defaultTooltipContent:t.useMemo(()=>Ys([{label:w||Hs(x),accessor:x,role:"x",format:A},{label:j||Hs(k),accessor:k,role:"y",format:S},...O?[{label:Hs(O),accessor:O,role:"group"}]:[],...zs(e.band,S)]),[x,k,w,j,O,A,S,e.band])}}function Al(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}wl.displayName="LineChart";const Sl=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"xy",frameRef:i});const r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,y0Accessor:f,gradientFill:p=!1,semanticGradient:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="monotoneX",areaOpacity:w=.7,lineGradient:j,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:M=3,tooltip:C,annotations:_,forecast:P,anomaly:L,band:T,xExtent:R,yExtent:B,frameProps:E={},selection:N,linkedHover:$,onObservation:D,onClick:H,hoverHighlight:I,chartId:F,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:K}=o,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:oe,description:ne,summary:ie,accessibleTable:re,xLabel:se,yLabel:ae}=r,le=t.useMemo(()=>k(s),[s]),ce=v||g,ue=t.useMemo(()=>{return y&&y.length>0?{colorStops:(e=y,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Al(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[y,p]);Ka("AreaChart",le,"xAccessor",d),Ka("AreaChart",le,"yAccessor",h);const de=il({data:le,rawData:s,colorBy:ce,colorScheme:b,legendInteraction:G,legendPosition:q,selection:N,linkedHover:$,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:D,onClick:H,hoverHighlight:I,chartType:"AreaChart",chartId:F,showLegend:te,userMargin:a,marginDefaults:r.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:Q,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=ml({data:le,xAccessor:d,yAccessor:h,forecast:P,anomaly:L,groupBy:g}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:me}=jl({safeData:he,data:s,areaBy:g,lineDataAccessor:m,colorBy:ce,colorScale:de.colorScale,color:X,stroke:V,strokeWidth:U,opacity:K,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:w,showLine:A,lineWidth:S,showPoints:O,pointRadius:M,xAccessor:d,yAccessor:h,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,groupField:g||v,band:T}),ve=el({componentName:"AreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=s&&{data:fe}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0}),f&&{y0Accessor:f}),T&&{band:T}),ue&&{gradientFill:ue}),j&&{lineGradient:j}),{curve:x,lineStyle:pe}),O&&ye&&{pointStyle:ye}),{size:[Q,Z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:de.margin,showAxes:r.showAxes,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,enableHover:J}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),Ns({title:oe,description:ne,summary:ie,accessibleTable:re,className:l,animate:o.animate,axisExtent:o.axisExtent})),"multi"===C?{tooltipContent:xn(),tooltipMode:"multi"}:Ds({tooltip:C,defaultTooltipContent:me})),$s({linkedHover:$,onObservation:D,onClick:H,hoverHighlight:I,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(_&&_.length>0||ge.length>0)&&{annotations:[..._||[],...ge]}),R&&{xExtent:R}),B&&{yExtent:B}),de.crosshairProps),E);return de.earlyReturn?de.earlyReturn:ve?e.jsx(Fa,{componentName:"AreaChart",message:ve,width:Q,height:Z}):e.jsx(Ga,{componentName:"AreaChart",width:Q,height:Z,children:e.jsx(si,Object.assign({ref:i},be))})});function Ol(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}Sl.displayName="AreaChart";const Ml=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",seriesAAccessor:h="a",seriesBAccessor:g="b",seriesALabel:f="A",seriesBLabel:p="B",seriesAColor:y="var(--semiotic-danger, #dc2626)",seriesBColor:m="var(--semiotic-info, #2563eb)",showLines:v=!0,lineWidth:b=1.5,showPoints:x=!1,pointRadius:w=3,curve:j="linear",areaOpacity:A=.6,gradientFill:S,tooltip:O,annotations:M,xExtent:C,yExtent:_,frameProps:P={},selection:L,linkedHover:T,onObservation:R,onClick:B,hoverHighlight:E,chartId:N,loading:$,loadingContent:D,emptyContent:H,legendInteraction:I,legendPosition:F,pointIdAccessor:W,windowSize:z}=o,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=t.useMemo(()=>"function"==typeof d?e=>Ol(d(e)):e=>Ol(e[d]),[d]),oe=t.useMemo(()=>"function"==typeof h?e=>Ol(h(e)):e=>Ol(e[h]),[h]),ne=t.useMemo(()=>"function"==typeof g?e=>Ol(g(e)):e=>Ol(e[g]),[g]),[ie,re]=t.useState([]),se=t.useRef([]),ae=null==s,le=t.useMemo(()=>k(ae?ie:s),[ae,ie,s]),ce=t.useMemo(()=>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 u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(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 m=u(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 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:d(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(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:d(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:d(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}(le,te,oe,ne),[le,te,oe,ne]),ue=t.useMemo(()=>v?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}(le,te,oe,ne):[],[v,le,te,oe,ne]),de=t.useMemo(()=>[...ce,...ue],[ce,ue]),he=t.useMemo(()=>{const e=new Set;for(const t of ce)e.add(t.__diffSegment);return Array.from(e)},[ce]);t.useImperativeHandle(n,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;se.current=t,re(t)},t=W?"function"==typeof W?W:e=>e[W]:null;return{push:t=>e([...se.current,t]),pushMany:t=>e([...se.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of se.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=se.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:()=>ae?se.current:le,getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[ae,le,W,z]);const ge=il({data:le,rawData:s,colorBy:"__diffWinner",colorScheme:[y,m],legendInteraction:I,legendPosition:F,selection:L,linkedHover:T,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:R,onClick:B,hoverHighlight:E,chartType:"DifferenceChart",chartId:N,showLegend:V,userMargin:a,marginDefaults:r.marginDefaults,loading:$,loadingContent:D,emptyContent:H,width:Y,height:G}),fe=t.useMemo(()=>{if(!1!==V)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:f,color:y},{label:p,color:m}]}]}},[V,f,p,y,m]),pe=t.useCallback(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?y:m,stroke:"none",fillOpacity:A}},[y,m,A]),ye=t.useCallback(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,strokeWidth:b,fill:"none"}),[y,m,b]),me=t.useCallback(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,r:w}),[y,m,w]),ve=t.useCallback(t=>{var o;const n=t.data,i=t.allSeries,r=null!==(o=t.xValue)&&void 0!==o?o:null==n?void 0:n.__x;let s=null==n?void 0:n.__valA,a=null==n?void 0:n.__valB;if(i&&i.length>0){const e=i.find(e=>"line-A"===e.group),t=i.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(s=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(a=t.value)}if(null!=r&&(null==s||null==a)){const e=le.find(e=>te(e)===r);e&&(null==s&&(s=oe(e)),null==a&&(a=ne(e)))}const l=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=c&&null!=r?c(r):null!=r?r+"":"";return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:u}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[f,": ",l(s)]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[p,": ",l(a)]})]}),null!=s&&null!=a&&Number.isFinite(s)&&Number.isFinite(a)&&e.jsxs("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",l(s-a)]})]})},[le,te,oe,ne,c,y,m,f,p]),be="multi"===O,xe=t.useMemo(()=>!1===O?()=>null:be?ve:kn(O)||ve,[O,be,ve]),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:"mixed",data:de,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:he,curve:j,areaStyle:pe,lineStyle:ye},x&&{pointStyle:me}),{size:[Y,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:q,showGrid:X}),S&&{gradientFill:!0===S?{topOpacity:.85,bottomOpacity:.15}:S}),fe&&{legend:fe,legendPosition:ge.legendPosition}),Ns({title:U,description:K,summary:Q,accessibleTable:Z,className:l,animate:o.animate,axisExtent:o.axisExtent})),{tooltipContent:xe}),be&&{tooltipMode:"multi"}),$s({linkedHover:T,onObservation:R,onClick:B,hoverHighlight:E,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior})),M&&M.length>0&&{annotations:M}),C&&{xExtent:C}),_&&{yExtent:_}),ge.crosshairProps),P);return ge.earlyReturn?ge.earlyReturn:e.jsx(Ga,{componentName:"DifferenceChart",width:Y,height:G,children:e.jsx(si,Object.assign({ref:i},ke))})});"function"==typeof Ml&&(Ml.displayName="DifferenceChart");const Cl=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,curve:m="monotoneX",areaOpacity:v=.7,showLine:b=!0,lineWidth:x=2,showPoints:w=!1,pointRadius:j=3,normalize:A=!1,baseline:S="zero",stackOrder:O,tooltip:M,annotations:C,xExtent:_,yExtent:P,frameProps:L={},selection:T,linkedHover:R,onObservation:B,onClick:E,hoverHighlight:N,chartId:$,loading:D,loadingContent:H,emptyContent:I,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=o,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=r,ie=t.useMemo(()=>k(s),[s]),re=p||g;rl(n,{variant:"xy",frameRef:i});const se=il({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:F,legendPosition:W,selection:T,linkedHover:R,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:B,onClick:E,hoverHighlight:N,chartType:"StackedAreaChart",chartId:$,showLegend:Q,userMargin:a,marginDefaults:r.marginDefaults,loading:D,loadingContent:H,emptyContent:I,width:X,height:V}),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=jl({safeData:ie,data:s,areaBy:g,lineDataAccessor:f,colorBy:re,colorScale:se.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,areaOpacity:v,showLine:b,lineWidth:x,showPoints:w,pointRadius:j,xAccessor:d,yAccessor:h,xLabel:oe,yLabel:ne,xFormat:c,yFormat:u,groupField:g||p}),de=el({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),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!=s&&{data:ae}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0,curve:m,normalize:A,baseline:A?"zero":S,stackOrder:O,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:se.margin,showAxes:r.showAxes,xLabel:oe,yLabel:ne,xFormat:c,yFormat:u,enableHover:U}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:K}),se.legendBehaviorProps),Ns({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:o.animate,axisExtent:o.axisExtent})),"multi"===M?{tooltipContent:xn(),tooltipMode:"multi"}:Ds({tooltip:M,defaultTooltipContent:ue})),$s({linkedHover:R,onObservation:B,onClick:E,hoverHighlight:N,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),C&&C.length>0&&{annotations:C}),_&&{xExtent:_}),P&&{yExtent:P}),se.crosshairProps),L);return se.earlyReturn?se.earlyReturn:de?e.jsx(Fa,{componentName:"StackedAreaChart",message:de,width:X,height:V}):e.jsx(Ga,{componentName:"StackedAreaChart",width:X,height:V,children:e.jsx(si,Object.assign({ref:i},he))})});Cl.displayName="StackedAreaChart";const _l=t.forwardRef(function(o,n){var r;const s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const a=Ha(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:w,xExtent:j,yExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,showLegend:E,legendPosition:N,legendInteraction:$}=o,{width:D,height:H,enableHover:I,title:F,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=a,X=Ua(T,D,H,R),V=X?null:Va(l,D,H,B),U=t.useMemo(()=>k(l),[l]),K=function(){var e;const t=Oa();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),ce=null!==(r=null!=y?y:K)&&void 0!==r?r:"blues",ue=null!=E&&E,de=null!=N?N:"right",{margin:he}=Na({data:U,colorBy:ue?"value":void 0,colorScale:void 0,showLegend:ue,legendPosition:de,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:ge,customClickBehavior:fe,crosshairSourceId:pe}=Ba({selection:O,linkedHover:M,fallbackFields:[],onObservation:C,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});nl(O);const ye=Ea(M,pe);$a($,void 0,[]);const me=t.useMemo(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ve=t.useMemo(()=>{const e=U.map(me);return[Math.min(...e),Math.max(...e)]},[U,me]),be=t.useMemo(()=>"custom"===ce&&m?m:i.scaleSequential({blues:Q,reds:Z,greens:J,viridis:ne,oranges:ee,purples:te,greys:oe,plasma:ie,inferno:re,magma:se,cividis:ae,turbo:le}[ce]||Q).domain(ve),[ce,m,ve]),xe=t.useMemo(()=>Ys([{label:G||Hs(d),accessor:d,role:"x",format:f},{label:q||Hs(h),accessor:h,role:"y",format:p},{label:Hs(g),accessor:g,role:"value",format:b}]),[d,h,G,q,g,f,p,b]),ke=el({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),we=t.useMemo(()=>{if(ue)return{gradient:{colorFn:e=>be(e),domain:ve,label:"string"==typeof g?g:"value",format:b}}},[ue,be,ve,g,b]),je=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:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==ce?ce:void 0,showValues:v,heatmapValueFormat:b,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:he,showAxes:a.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:I}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),we&&{legend:we,legendPosition:de}),Ns({title:F,description:W,summary:z,accessibleTable:Y,className:u,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:xe})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ge,customClickBehavior:fe})),w&&w.length>0&&{annotations:w}),j&&{xExtent:j}),A&&{yExtent:A}),ye),S);return X||V||(ke?e.jsx(Fa,{componentName:"Heatmap",message:ke,width:D,height:H}):e.jsx(Ga,{componentName:"Heatmap",width:D,height:H,children:e.jsx(si,Object.assign({ref:s},je))}))});_l.displayName="Heatmap";const Pl=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",sizeBy:g,sizeRange:f=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:v=1,bubbleStrokeColor:b="white",tooltip:x,marginalGraphics:w,pointIdAccessor:j,annotations:A,regression:S,xExtent:O,yExtent:M,frameProps:C={},selection:_,linkedHover:P,linkedBrush:L,onObservation:T,onClick:R,hoverHighlight:B,chartId:E,loading:N,loadingContent:$,emptyContent:D,legendInteraction:H,legendPosition:I,color:F,stroke:W,strokeWidth:z,opacity:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=t.useMemo(()=>k(s),[s]),ne=void 0===s,ie=il({data:oe,rawData:s,colorBy:p,colorScheme:y,legendInteraction:H,legendPosition:I,selection:_,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:B,chartType:"BubbleChart",chartId:E,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:N,loadingContent:$,emptyContent:D,width:G,height:q}),{domain:re,trackPushed:se,reset:ae}=ll({accessor:g,data:oe,isPushMode:ne}),le=t.useCallback(e=>{var t;se([e]),null===(t=i.current)||void 0===t||t.push(e)},[se]),ce=t.useCallback(e=>{var t;se(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[se]);rl(n,{variant:"xy",frameRef:i,overrides:{push:le,pushMany:ce,clear:()=>{var e;ae(),null===(e=i.current)||void 0===e||e.clear()}},deps:[le,ce,ae]});const ue=ma(L);ra({name:(null==ue?void 0:ue.name)||"__unused_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof d?d:void 0),yField:(null==ue?void 0:ue.yField)||("string"==typeof h?h:void 0)});const de=t.useMemo(()=>({stroke:b,strokeWidth:v}),[b,v]),he=t.useMemo(()=>null!=re?re:[0,1],[re]),ge=t.useCallback(e=>je(e,g,f,he),[g,f,he]),fe=al({colorBy:p,colorScale:ie.colorScale,color:F,fillOpacity:m,radiusFn:ge,baseStyleExtras:de,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),pe=t.useMemo(()=>Ys([{label:ee||Hs(d),accessor:d,role:"x",format:c},{label:te||Hs(h),accessor:h,role:"y",format:u},{label:Hs(g),accessor:g,role:"size"},...p?[{label:Hs(p),accessor:p,role:"color"}]:[]]),[d,h,ee,te,g,p,c,u]),ye=el({componentName:"BubbleChart",data:s,accessors:{xAccessor:d,yAccessor:h},requiredProps:{sizeBy:g}});if(ye)return e.jsx(Fa,{componentName:"BubbleChart",message:ye,width:G,height:q});const me=cl(S),ve=me?[me,...A||[]]:A,be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:oe}),{xAccessor:d,yAccessor:h,colorAccessor:p||void 0,sizeAccessor:g,sizeRange:f,pointStyle:fe,colorScheme:y,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),ie.legendBehaviorProps),Ns({title:K,description:Q,summary:Z,accessibleTable:J,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:pe})),$s({linkedHover:P,onObservation:T,onClick:R,hoverHighlight:B,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),ve&&ve.length>0&&{annotations:ve}),O&&{xExtent:O}),M&&{yExtent:M}),ie.crosshairProps),C);return ie.earlyReturn?ie.earlyReturn:e.jsx(Ga,{componentName:"BubbleChart",width:G,height:q,children:e.jsx(si,Object.assign({ref:i},be))})});Pl.displayName="BubbleChart";const Ll="__splomIdx",Tl={top:4,bottom:4,left:4,right:4};function Rl({frameRef:i,cellSize:r,onBrush:s}){const a=t.useRef(null),l=r-Tl.left-Tl.right,c=r-Tl.top-Tl.bottom;return t.useEffect(()=>{if(!a.current)return;const e=o.select(a.current).select(".brush-g"),t=n.brush().extent([[0,0],[l,c]]).on("brush end",e=>{var t;const o=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void s(null);const[[n,r],[a,l]]=e.selection,c=[[o.x.invert(n),o.y.invert(r)],[o.x.invert(a),o.y.invert(l)]];s(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,c,i,s]),e.jsx("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${Tl.left},${Tl.top})`})})}function Bl({data:o,xField:n,yField:i,cellSize:r,pointRadius:s,pointOpacity:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,unselectedOpacity:h,mode:g,onPointHover:f}){const p=t.useRef(null),y=oa({name:u,clientId:`splom-${n}-${i}`}),m=ra({name:u,xField:n,yField:i}),v=oa({name:d,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==f||f(null));const t=e.data,o=null==t?void 0:t[Ll];void 0!==o&&(b({[Ll]:[o]}),null==f||f(t,e.x+Tl.left,e.y+Tl.top))},[b,f]),w=t.useCallback(e=>{const t={opacity:a,r:s};return t.fill=l?ke(e,l,c):Ma,"hover"===g?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*a):y.isActive&&!y.predicate(e)&&(t.opacity=h),t},[l,c,a,s,g,y.isActive,y.predicate,v.isActive,v.predicate,h]);return e.jsxs("div",{style:{position:"relative",width:r,height:r},children:[e.jsx(si,{ref:p,chartType:"scatter",data:o,size:[r,r],xAccessor:n,yAccessor:i,pointStyle:w,margin:Tl,showAxes:!1,enableHover:"hover"===g,customHoverBehavior:"hover"===g?k:void 0,tooltipContent:"hover"===g?()=>null:void 0}),"brush"===g&&e.jsx(Rl,{frameRef:p,cellSize:r,xField:n,yField:i,onBrush:x})]})}function El({data:o,field:n,label:i,cellSize:r,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=oa({name:c,clientId:"splom-diag-"+n}),g=oa({name:u,clientId:`splom-diag-${n}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.predicate,m=t.useMemo(()=>{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)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(o.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(s).fill(0),h=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),f=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const r=Math.min(Math.floor((o-t)/i),s-1);if(d[r]++,p&&!y(e)||h[r]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[r][t]++,p&&!y(e)||f[r][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:o,category:c[n]};return o+=i,a})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:o,category:c[n]};return o+=i,a})});return{bars:d.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[o,n,s,r,p,y,a]);return e.jsxs("svg",{width:r,height:r,style:{overflow:"hidden"},children:[e.jsx("text",{x:r/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.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ma,opacity:p?.3:.6},`bg-${o}-${n}`))):m.bars.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Ma,opacity:p?.3:.6},"bg-"+o)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,o)=>t.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ma,opacity:.7},`sel-${o}-${n}`))):m.selectedBars.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Ma,opacity:.7},"sel-"+o)))]})}function Nl({label:t,cellSize:o}){return e.jsx("svg",{width:o,height:o,children:e.jsx("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function $l(o){const{data:n,fields:i,fieldLabels:r={},colorBy:s,colorScheme:a,cellSize:l=150,cellGap:c=4,pointRadius:u=2,pointOpacity:d=.5,diagonal:h="histogram",histogramBins:g=20,brushMode:f="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:j,chartId:A}=o,S="splom",O="splom-hover",M=y?"hover":f?"brush":"hover",C=Js(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(O),P(null)},[C,O]),T=t.useMemo(()=>(n||[]).map((e,t)=>void 0!==e[Ll]?e:Object.assign(Object.assign({},e),{[Ll]:t})),[n]),R=Ta(T,s,a),B=void 0!==x?x:!!s,E=t.useMemo(()=>{if(!B||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:R?R(e+""):Ma})):null},[B,s,T,R]),N=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>l+"px").join(" "),gridTemplateRows:i.map(()=>l+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,l,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[E&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:E.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:N,onMouseLeave:"hover"===M?L:void 0,children:[i.map((t,o)=>e.jsxs(p.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t}),i.map((n,i)=>o===i?"label"===h?e.jsx(Nl,{label:r[t]||t,cellSize:l},"diag-"+t):e.jsx(El,{data:T,field:t,label:r[t]||t,cellSize:l,bins:g,colorBy:s,colorScale:R,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,mode:M},"diag-"+t):e.jsx(Bl,{data:T,xField:n,yField:t,fieldLabels:r,cellSize:l,pointRadius:u,pointOpacity:d,colorBy:s,colorScale:R,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,showGrid:v,tooltip:b,mode:M,onPointHover:"hover"===M?(e,r,s)=>{e?(P({datum:e,xField:n,yField:t,colIndex:i,rowIndex:o,px:null!=r?r:0,py:null!=s?s:0}),j&&j({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})):(P(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A}))}:void 0},`cell-${t}-${n}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t},"col-label-"+t))]}),_&&"hover"===M&&(()=>{const t=_.datum,o=r[_.xField]||_.xField,n=r[_.yField]||_.yField,i=s?"function"==typeof s?s(t):t[s]:null,a=k?"function"==typeof k?k(t):t[k]:"Row "+t[Ll];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(l+c)+_.px,top:_.rowIndex*(l+c)+_.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.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),e.jsxs("div",{children:[o,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[n,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof s?s:"group",": ",i+""]})]})})()]})}function Dl(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e.jsx(pa,{selections:i,children:e.jsx($l,Object.assign({},t))})}function Hl({width:i,height:r,margin:s,scales:a,brushDirection:l,extent:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(!1),f=i+s.left+s.right,p=r+s.top+s.bottom;return t.useEffect(()=>{if(!d.current||!a)return;const e=o.select(d.current).select(".brush-group"),t="x"===l?n.brushX().extent([[0,0],[i,r]]):n.brushY().extent([[0,0],[i,r]]);return t.on("brush end",e=>{if(g.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const o=("x"===l?a.x:a.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];u(n)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,i,r,l,u]),t.useEffect(()=>{if(!h.current||!a||!d.current)return;const e=o.select(d.current).select(".brush-group"),t="x"===l?a.x:a.y;if(g.current=!0,c){const o=[t(c[0]),t(c[1])];e.call(h.current.move,o)}else e.call(h.current.move,null);g.current=!1},[c,a,l]),e.jsx("svg",{ref:d,width:f,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${s.left},${s.top})`})})}function Il(o){var n,i;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,description:d,summary:h,xLabel:g,yLabel:f,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:v="y",lineBy:b,lineDataAccessor:x="coordinates",colorBy:w,colorScheme:j,curve:A="linear",lineWidth:S=2,fillArea:O=!1,areaOpacity:M=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:T,legendPosition:R,tooltip:B,minimap:E={},renderBefore:N=!1,onBrush:$,brushExtent:D,yExtent:H,frameProps:I={},loading:F,loadingContent:W,emptyContent:z}=o,Y=Ua(F,s,a,W),G=Y?null:Va(r,s,a,z),q=t.useMemo(()=>k(r),[r]),[X,V]=t.useState(null),U=null!=D?D:X,K=t.useCallback(e=>{D||V(e),null==$||$(e)},[D,$]),Q=t.useRef(null),[Z,J]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=Q.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?J(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[r]);const ee=void 0!==(null===(n=q[0])||void 0===n?void 0:n[x]),te=t.useMemo(()=>{if(ee)return q;if(b){const e=q.reduce((e,t)=>{const o="function"==typeof b?b(t):t[b];if(!e[o]){const t={[x]:[]};"string"==typeof b&&(t[b]=o),e[o]=t}return e[o][x].push(t),e},{});return Object.values(e)}return[{[x]:q}]},[q,b,x,ee]),oe=t.useMemo(()=>ee||b?te.flatMap(e=>{const t=e[x]||[];return b&&"string"==typeof b?t.map(t=>Object.assign(Object.assign({},t),{[b]:e[b]})):t}):q,[te,x,ee,b,q]),ne=Ta(q,w,j),ie=kl({lineWidth:S,colorBy:w,colorScale:ne,fillArea:O,areaOpacity:M}),re=t.useMemo(()=>{if(E.lineStyle)return E.lineStyle},[E.lineStyle]),se=kl({lineWidth:1,colorBy:w,colorScale:ne}),ae=null!=re?re:se,le=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?ke(e.parentLine||e,w,ne):Ma,t}},[C,_,w,ne]),{legend:ce,margin:ue,legendPosition:de}=Na({data:te,colorBy:w,colorScale:ne,showLegend:T,legendPosition:R,userMargin:l}),he=E.height||60,ge=t.useMemo(()=>{var e,t,o,n,i,r,s,a;return{top:null!==(t=null===(e=E.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(n=null===(o=E.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(r=null===(i=E.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ue.left,right:null!==(a=null===(s=E.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[E.margin,ue]),fe=E.brushDirection||"x",pe=el({componentName:"MinimapChart",data:r,accessors:{xAccessor:m,yAccessor:v}});if(pe)return e.jsx(Fa,{componentName:"MinimapChart",message:pe,width:s,height:a});const ye=O?"area":"line",me=t.useMemo(()=>Ys([{label:g||Hs(m),accessor:m,role:"x",format:p},{label:f||Hs(v),accessor:v,role:"y",format:y}]),[m,v,g,f,p,y]),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ye,data:oe,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:A,lineStyle:ie},C&&{pointStyle:le}),{size:[s,a],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue,showAxes:!0,xLabel:g,yLabel:f,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),ce&&{legend:ce,legendPosition:de}),u&&{title:u}),d&&{description:d}),h&&{summary:h}),{tooltipContent:!1===B?()=>null:kn(B)||me}),U&&{xExtent:U}),H&&{yExtent:H}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),I),be=Object.assign({chartType:ye,data:oe,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:A,lineStyle:ae,size:[s,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(i=E.showAxes)&&void 0!==i&&i,background:E.background,enableHover:!1},H&&{yExtent:H}),xe=e.jsxs("div",{style:{position:"relative",width:s,overflow:"hidden"},children:[e.jsx(si,Object.assign({ref:Q},be)),e.jsx(Hl,{width:s-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:fe,extent:U,onBrush:K})]},"minimap"),we=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(si,Object.assign({},ve))},"main");return Y||G||e.jsx(Ga,{componentName:"MinimapChart",width:s,height:a,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[N?xe:we,N?we:xe]})})}Dl.displayName="ScatterplotMatrix",Il.displayName="MinimapChart";const Fl=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"xy",frameRef:i});const r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xCenter:g,yCenter:f,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:v=12,colorBy:b,colorScheme:x,sizeBy:w,sizeRange:j=[3,15],pointRadius:A=5,pointOpacity:S=.8,tooltip:O,pointIdAccessor:M,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:T,onClick:R,hoverHighlight:B,chartId:E,loading:N,loadingContent:$,emptyContent:D,legendInteraction:H,legendPosition:I,color:F,stroke:W,strokeWidth:z,opacity:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=t.useMemo(()=>k(s),[s]),ne=il({data:oe,rawData:s,colorBy:b,colorScheme:x,legendInteraction:H,legendPosition:I,selection:P,linkedHover:L,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:B,chartType:"QuadrantChart",chartId:E,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:N,loadingContent:$,emptyContent:D,width:G,height:q});Ka("QuadrantChart",oe,"xAccessor",d),Ka("QuadrantChart",oe,"yAccessor",h);const ie=t.useMemo(()=>{if(!oe.length)return;const e="function"==typeof d?d:e=>+e[d],t="function"==typeof h?h:e=>+e[h];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of oe){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!=g&&isFinite(g)&&(o>g&&(o=g),g>n&&(n=g)),null!=f&&isFinite(f)&&(i>f&&(i=f),f>r&&(r=f)),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]}},[oe,d,h,g,f]),re=t.useMemo(()=>{if(!w||0===oe.length)return;const e=oe.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[oe,w]),se=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),ae=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),le=t.useMemo(()=>e=>{const t=se(e),o=ae(e),n=null!=g?t>=g:void 0,i=null!=f?o>=f:void 0;return void 0===i||void 0===n?F||Ma:i&&n?p.topRight.color:i&&!n?p.topLeft.color:!i&&n?p.bottomRight.color:p.bottomLeft.color},[se,ae,g,f,p,F]),ce=t.useMemo(()=>w?e=>je(e,w,j,re):void 0,[w,j,re]),ue=al({colorBy:b,colorScale:ne.colorScale,color:F,pointRadius:A,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),de=t.useMemo(()=>{if(!oe.length)return;const e=new Set;"string"==typeof d&&e.add(d),"string"==typeof h&&e.add(h),"string"==typeof b&&e.add(b),"string"==typeof w&&e.add(w);const t=oe[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[oe,d,h,b,w]),he=t.useMemo(()=>Ys([...de?[{label:de,accessor:de,role:"title"}]:[],{label:ee||Hs(d),accessor:d,role:"x",format:c},{label:te||Hs(h),accessor:h,role:"y",format:u},...b?[{label:Hs(b),accessor:b,role:"color"}]:[],...w?[{label:Hs(w),accessor:w,role:"size"}]:[]]),[de,d,h,ee,te,b,w,c,u]),ge=el({componentName:"QuadrantChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),fe=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.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!=g?n.x(g):s/2,c=null!=f?n.y(f):a/2;if(null!=g&&!isFinite(l))return;if(null!=f&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:p.topLeft,x:0,y:0,w:u,h:d},{config:p.topRight,x:u,y:0,w:s-u,h:d},{config:p.bottomLeft,x:0,y:d,w:u,h:a-d},{config:p.bottomRight,x:u,y:d,w:s-u,h:a-d}];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(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[g,f,p,y]),pe=t.useMemo(()=>m?[...fe,(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!=g?o.x(g):i/2,a=null!=f?o.y(f):r/2;(null==g||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${v}px sans-serif`,e.globalAlpha=.5,e.fillStyle=p.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(p.topLeft.label,8,8),e.fillStyle=p.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(p.topRight.label,i-8,8),e.fillStyle=p.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(p.bottomLeft.label,8,r-8),e.fillStyle=p.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(p.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:fe,[fe,m,v,p,g,f]),ye=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...pe,...e]},[pe,_.canvasPreRenderers]),me=t.useMemo(()=>{var t;const o={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,n,i)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return null;const r=i.width,s=i.height,a=null!=g?n.x(g):r/2,l=null!=f?n.y(f):s/2;if(null!=g&&!isFinite(a))return null;if(null!=f&&!isFinite(l))return null;const c=Math.max(0,Math.min(r,a)),u=Math.max(0,Math.min(s,l));return e.jsxs(e.Fragment,{children:[[{config:p.topLeft,x:0,y:0,w:c,h:u},{config:p.topRight,x:c,y:0,w:r-c,h:u},{config:p.bottomLeft,x:0,y:u,w:c,h:s-u},{config:p.bottomRight,x:c,y:u,w:r-c,h:s-u}].map((t,o)=>{var n;return t.w>0&&t.h>0?e.jsx("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.jsx("line",{x1:c,y1:0,x2:c,y2:s,stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.dashArray}),e.jsx("line",{x1:0,y1:u,x2:r,y2:u,stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+v,fill:p.topLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:p.topLeft.label}),e.jsx("text",{x:r-8,y:8+v,fill:p.topRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:p.topRight.label}),e.jsx("text",{x:8,y:s-8,fill:p.bottomLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:p.bottomLeft.label}),e.jsx("text",{x:r-8,y:s-8,fill:p.bottomRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:p.bottomRight.label})]})]})}]},[g,f,p,y,m,v]),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=s&&{data:oe}),{xAccessor:d,yAccessor:h,colorAccessor:b||void 0,sizeAccessor:w||void 0,sizeRange:j,pointStyle:ue,colorScheme:x,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),ie&&{xExtent:ie.xExtent,yExtent:ie.yExtent}),ne.legendBehaviorProps),K&&{title:K}),Q&&{description:Q}),Z&&{summary:Z}),void 0!==J&&{accessibleTable:J}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:!1===O?()=>null:!0===O||void 0===O?he:kn(O)||he}),(L||T||R||B)&&{customHoverBehavior:ne.customHoverBehavior}),(T||R||L)&&{customClickBehavior:ne.customClickBehavior}),M&&{pointIdAccessor:M}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:ye}),ne.crosshairProps),_),ye.length>0&&{canvasPreRenderers:ye}),{svgPreRenderers:me});return ne.earlyReturn?ne.earlyReturn:ge?e.jsx(Fa,{componentName:"QuadrantChart",message:ge,width:G,height:q}):e.jsx(Ga,{componentName:"QuadrantChart",width:G,height:q,children:e.jsx(si,Object.assign({ref:i},ve))})});Fl.displayName="QuadrantChart";const Wl="__ma_unitized",zl="__ma_series";function Yl(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Gl(e,t){return t[0]+e*(t[1]-t[0])}const ql=t.forwardRef(function(o,n){var i;const r=t.useRef(null),s=t.useRef([]),a=t.useRef(o.series);a.current=o.series,t.useImperativeHandle(n,()=>{const e=()=>{var e;return(null!==(e=a.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!r.current)return;const o=e(),n=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],i=t.extent||s.current[e];if(!i)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(n);null!=a&&isFinite(a)&&r.current.push(Object.assign(Object.assign({},n),{[Wl]:Yl(a,i),[zl]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!r.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||s.current[t];if(!r)continue;const a=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=a&&isFinite(a)&&n.push(Object.assign(Object.assign({},e),{[Wl]:Yl(a,r),[zl]:i.label||"Series "+(t+1)}))}r.current.pushMany(n)},remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const l=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:d,xFormat:h,xAccessor:g="x",series:f,colorScheme:y,curve:m="monotoneX",lineWidth:v=2,tooltip:b,annotations:x,frameProps:w={},selection:j,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,stroke:B,strokeWidth:E,opacity:N}=o,{width:$,height:D,enableHover:H,showGrid:I,showLegend:F=!0,title:W,description:z,summary:Y,accessibleTable:G,xLabel:q}=l,X=t.useMemo(()=>k(c),[c]),V=t.useMemo(()=>k(f),[f]),U=V,K=2===V.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||K||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${V.length}. Rendering as a standard multi-line chart.`);const Q=Ua(_,$,D,P),Z=Q?null:Va(c,$,D,L),J=Pa(),ee=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(J&&J.length>0)e=J;else{const t=ye[y];e=Array.isArray(t)?t:me}return U.map((t,o)=>t.color||e[o%e.length])},[U,y,J]),te=t.useMemo(()=>V.map((e,t)=>e.label||"Series "+(t+1)),[V]),{unitizedData:oe,extents:ne}=t.useMemo(()=>{if(0===X.length){const e=V.map(e=>e.extent||null).filter(Boolean);return e.length===V.length&&(s.current=e),{unitizedData:[],extents:e.length===V.length?e:[]}}const e=V.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]}(X,e.yAccessor));if(s.current=e,!K){const t=[];for(const e of X)for(let o=0;V.length>o;o++){const n=V[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Wl]:i,[zl]:te[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of X)for(let n=0;2>n;n++){const i=V[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[Wl]:Yl(r,e[n]),[zl]:te[n]}))}return{unitizedData:t,extents:e}},[X,V,K,te]),ie=t.useMemo(()=>{if(K&&ne.length>=2)return[{orient:"left",label:te[0],tickFormat:V[0].format||(e=>{const t=Gl(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:te[1],tickFormat:V[1].format||(e=>{const t=Gl(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[K,ne,V,te]),re=il({data:t.useMemo(()=>oe.length>0?oe:te.map(e=>({[zl]:e})),[oe,te]),rawData:c,colorBy:zl,colorScheme:ee,legendInteraction:T,legendPosition:R,selection:j,linkedHover:A,fallbackFields:[zl],unwrapData:!1,onObservation:S,onClick:O,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:C,showLegend:F,userMargin:u,marginDefaults:K?Object.assign(Object.assign({},l.marginDefaults),{left:70,right:70}):l.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:$,height:D});if(re.earlyReturn)return re.earlyReturn;const se=t.useMemo(()=>{const e=new Map;return te.forEach((t,o)=>e.set(t,ee[o])),e},[te,ee]),ae=kl({lineWidth:v,resolveStroke:t.useCallback(e=>se.get(e[zl])||ee[0],[se,ee]),stroke:B,strokeWidth:E,opacity:N,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),le=t.useMemo(()=>{if(!1===b)return()=>null;return kn(b)||(e=>{var t;const o=e.data||e,n=o[zl],i=te.indexOf(n),r=o[Wl],s=K&&i>=0&&ne[i]?Gl(r,ne[i]):r,a=i>=0&&(null===(t=V[i])||void 0===t?void 0:t.format)?V[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),l="function"==typeof g?g(o):o[g];return p.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},p.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ee[i]||"inherit"}},n),p.createElement("div",null,`${"string"==typeof g?g:"x"}: ${l}`),p.createElement("div",null,`${n}: ${a(s)}`))})},[b,te,ee,ne,K,V,g]),ce=el({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),ue=K?[0,1]:void 0,de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:oe}),{xAccessor:g,yAccessor:Wl,groupAccessor:zl,lineStyle:ae,colorScheme:ee,size:[$,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re.margin,showAxes:l.showAxes}),ie&&{axes:ie}),{xLabel:q}),K?{}:{yLabel:te[0]}),{xFormat:h}),K&&ue&&{yExtent:ue}),{enableHover:H}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:I,curve:m}),re.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:le}),x&&{annotations:x}),(A||S||O||M)&&{customHoverBehavior:re.customHoverBehavior}),(S||O||A)&&{customClickBehavior:re.customClickBehavior}),re.crosshairProps),w);return Q||Z||(ce?e.jsx(Fa,{componentName:"MultiAxisLineChart",message:ce,width:$,height:D}):e.jsx(Ga,{componentName:"MultiAxisLineChart",width:$,height:D,children:e.jsx(si,Object.assign({ref:r},de))}))});function Xl(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}ql.displayName="MultiAxisLineChart";const Vl=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"xy",frameRef:i});const r=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,description:o.description,summary:o.summary,accessibleTable:o.accessibleTable}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",highAccessor:h="high",lowAccessor:g="low",openAccessor:f,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:v,xExtent:b,yExtent:x,frameProps:w={},selection:j,linkedHover:A,onObservation:S,onClick:O,chartId:M,loading:C,loadingContent:_,emptyContent:P}=o,{width:L,height:T,enableHover:R,showGrid:B,title:E,description:N,summary:$,accessibleTable:D,xLabel:H,yLabel:I}=r,F=Ua(C,L,T,_),W=F?null:Va(s,L,T,P),z=t.useMemo(()=>k(s),[s]),Y=null==f||null==p;Ka("CandlestickChart",z,"xAccessor",d),Ka("CandlestickChart",z,"highAccessor",h),Ka("CandlestickChart",z,"lowAccessor",g),Y||(Ka("CandlestickChart",z,"openAccessor",f),Ka("CandlestickChart",z,"closeAccessor",p));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=Ba({selection:j,linkedHover:A,onObservation:S,onClick:O,chartType:"CandlestickChart",chartId:M}),V=Ea(A,X),U=t.useMemo(()=>{const e=r.marginDefaults,t="sparkline"===o.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?t:Object.assign(Object.assign({},t),Xl(a))},[a,r.marginDefaults,o.mode]),K=t.useMemo(()=>{const e=[{label:H||Hs(d),accessor:d,role:"x",format:c}];return Y?(e.push({label:"High",accessor:h,role:"y",format:u}),e.push({label:"Low",accessor:g,format:u})):(e.push({label:"Open",accessor:f,format:u}),e.push({label:"High",accessor:h,format:u}),e.push({label:"Low",accessor:g,format:u}),e.push({label:"Close",accessor:p,format:u})),Ys(e)},[d,H,c,u,h,g,f,p,Y]),Q=el({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:d,highAccessor:h,lowAccessor:g},!Y&&{openAccessor:f,closeAccessor:p})}),Z=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!=s&&{data:z}),{xAccessor:d,yAccessor:h,highAccessor:h,lowAccessor:g}),!Y&&{openAccessor:f,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U,showAxes:r.showAxes,xLabel:H,yLabel:I,xFormat:c,yFormat:u,enableHover:R,showGrid:B}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),Ns({title:E,description:N,summary:$,accessibleTable:D,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:K})),$s({linkedHover:A,onObservation:S,onClick:O,customHoverBehavior:G,customClickBehavior:q})),v&&v.length>0&&{annotations:v}),b&&{xExtent:b}),x&&{yExtent:x}),V),w);return F||W||(Q?e.jsx(Fa,{componentName:"CandlestickChart",message:Q,width:L,height:T}):e.jsx(Ga,{componentName:"CandlestickChart",width:L,height:T,children:e.jsx(si,Object.assign({ref:i},ee))}))});function Ul(e){const o=t.useRef(null);return rl(e.imperativeRef,{variant:e.imperativeVariant,frameRef:o}),{frameRef:o,resolved:Ha(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>Xl(e.margin),[e.margin])}}function Kl(e){var t;const o=Ul(e),{resolved:n,normalizedMargin:i}=o,r=il({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return Object.assign(Object.assign({},o),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}Vl.displayName="CandlestickChart";const Ql=t.forwardRef(function(t,o){const{data:n,layout:i,layoutConfig:r,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:g,selection:f,linkedHover:p,chartId:y,loading:m,loadingContent:v,emptyContent:b,colorScheme:x,frameProps:k={}}=t,{frameRef:w,resolved:j,safeData:A,setup:S,earlyReturn:O}=Kl({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorScheme:x,selection:f,linkedHover:p,onObservation:h,onClick:g,chartId:y,loading:m,loadingContent:v,emptyContent:b,margin:c,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel});if(O)return O;const{width:M,height:C,enableHover:_,showGrid:P,title:L,description:T,summary:R,accessibleTable:B,xLabel:E,yLabel:N}=j,$=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:A}),{customLayout:i,layoutConfig:r,xExtent:s,yExtent:a,colorScheme:x,size:[M,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:S.margin,showAxes:l,xLabel:E,yLabel:N,enableHover:_,showGrid:P}),S.legendBehaviorProps),Ns({title:L,description:T,summary:R,accessibleTable:B,className:u,animate:t.animate,axisExtent:t.axisExtent})),null!=t.tooltip&&{tooltipContent:t.tooltip}),$s({linkedHover:p,onObservation:h,onClick:g,hoverHighlight:!1,customHoverBehavior:S.customHoverBehavior,customClickBehavior:S.customClickBehavior})),d&&d.length>0&&{annotations:d}),S.crosshairProps),k);return e.jsx(Ga,{componentName:"XYCustomChart",width:M,height:C,children:e.jsx(si,Object.assign({ref:w},$))})});Ql.displayName="XYCustomChart";const Zl=t.forwardRef(function(o,n){const{nodes:i,edges:r,layout:s,layoutConfig:a,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:u="target",margin:d,className:h,colorScheme:g,frameProps:f={}}=o,{frameRef:p,resolved:y,normalizedMargin:m}=Ul({imperativeRef:n,imperativeVariant:"network",margin:d,width:o.width,height:o.height,enableHover:o.enableHover,title:o.title,mode:o.mode}),v=t.useMemo(()=>k(null!=i?i:[]),[i]),b=t.useMemo(()=>k(null!=r?r:[]),[r]),{width:x,height:w,enableHover:j,title:A,description:S,summary:O,accessibleTable:M}=y,C=Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=i&&{nodes:v}),null!=r&&{edges:b}),{customNetworkLayout:s,layoutConfig:a,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,colorScheme:g,size:[x,w],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:m,className:h,title:A,description:S,summary:O,accessibleTable:M,enableHover:j}),f);return e.jsx(Ga,{componentName:"NetworkCustomChart",width:x,height:w,children:e.jsx(Es,Object.assign({ref:p},C))})});Zl.displayName="NetworkCustomChart";const Jl=t.forwardRef(function(t,o){const{data:n,layout:i,layoutConfig:r,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorScheme:g,showAxes:f=!1,annotations:p,onObservation:y,onClick:m,selection:v,linkedHover:b,chartId:x,loading:k,loadingContent:w,emptyContent:j,frameProps:A={}}=t,{frameRef:S,resolved:O,safeData:M,setup:C,earlyReturn:_}=Kl({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorScheme:g,selection:v,linkedHover:b,onObservation:y,onClick:m,chartId:x,loading:k,loadingContent:w,emptyContent:j,margin:d,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,mode:t.mode});if(_)return _;const{width:P,height:L,enableHover:T,showGrid:R,title:B,description:E,summary:N,accessibleTable:$}=O,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:M}),{customLayout:i,layoutConfig:r,oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorScheme:g,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:C.margin,enableHover:T,showAxes:f,showGrid:R,annotations:p}),Ns({title:B,description:E,summary:N,accessibleTable:$,className:h,animate:t.animate,axisExtent:t.axisExtent})),$s({linkedHover:b,onObservation:y,onClick:m,hoverHighlight:!1,customHoverBehavior:C.customHoverBehavior,customClickBehavior:C.customClickBehavior})),A);return e.jsx(Ga,{componentName:"OrdinalCustomChart",width:P,height:L,children:e.jsx(Yi,Object.assign({ref:S},D))})});function ec({ref:e,frameRef:o,setup:n}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[o]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function tc(e){const{colorBy:o,colorScale:n,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=t.useMemo(()=>(e,t)=>{const l="function"==typeof p?p(e,t):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(o){if(!n)return c;c.fill=ke(e,o,n)}else c.fill=La(i,r,s,f?t:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[o,n,i,r,s,a,f,p,y]),v=t.useMemo(()=>sl(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:u,opacity:d}),[m,l,c,u,d]);return t.useMemo(()=>va(v,null!=h?h:null,g),[v,h,g])}Jl.displayName="OrdinalCustomChart";const oc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sort:p=!1,barPadding:y=40,roundedTop:m,gradientFill:v=!1,baselinePadding:b=!1,tooltip:x,annotations:w,regression:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,color:$,stroke:D,strokeWidth:H,opacity:I,showCategoryTicks:F,categoryFormat:W,dataIdAccessor:z}=o,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>k(s),[s]),oe=il({data:te,rawData:s,colorBy:g,colorScheme:f,legendInteraction:E,legendPosition:N,selection:O,linkedHover:M,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:B,width:Y,height:G}),{effectiveLegendProps:ne,effectiveMargin:ie}=ec({ref:n,frameRef:r,setup:oe});if(oe.earlyReturn)return oe.earlyReturn;Ka("BarChart",te,"categoryAccessor",c),Ka("BarChart",te,"valueAccessor",u);const re=Ra(te,p,u),se=Pa(),ae=t.useMemo(()=>new Map,[te]),le=tc({colorBy:g,colorScale:oe.colorScale,color:$,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),ce=t.useMemo(()=>Gs({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ue=el({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(Fa,{componentName:"BarChart",message:ue,width:Y,height:G});const de=cl(j),he=de?[de,...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!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie,barPadding:y}),null!=m&&{roundedTop:m}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),z&&{dataIdAccessor:z}),{baselinePadding:b,enableHover:q,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:F,oSort:p}),ne),Ns({title:U,description:K,summary:Q,accessibleTable:Z,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:ce})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),he&&he.length>0&&{annotations:he}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"BarChart",width:Y,height:G,children:e.jsx(Yi,Object.assign({ref:r},ge))})});oc.displayName="BarChart";const nc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,normalize:y=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,color:$,stroke:D,strokeWidth:H,opacity:I,categoryFormat:F}=o,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=f||u,te=il({data:J,rawData:s,colorBy:ee,colorScheme:p,legendInteraction:E,legendPosition:N,selection:O,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:B,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const oe=Pa(),ne=t.useMemo(()=>new Map,[J]),ie=tc({colorBy:ee,colorScale:te.colorScale,color:$,themeCategorical:oe,colorScheme:p,categoryIndexMap:ne,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),se=el({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=ec({ref:n,frameRef:r,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!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:G}),ae),Ns({title:X,description:V,summary:U,accessibleTable:K,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:w,defaultTooltipContent:re})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),j&&j.length>0&&{annotations:j}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(Fa,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(Ga,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(Yi,Object.assign({ref:r},ce))})});nc.displayName="StackedBarChart";const ic={RdBu:ce,PiYG:ue,PRGn:de,BrBG:he,RdYlBu:ge,RdYlGn:fe,Spectral:pe},rc="__likert_neutral_neg",sc="__likert_neutral_pos";function ac(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function lc(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 cc(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:rc,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:sc,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function uc(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===rc?r=o:o.__likertLevel===sc?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 dc=new Map,hc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:h="count",levels:g,orientation:f="horizontal",colorScheme:y,barPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,categoryFormat:B,stroke:E,strokeWidth:N,opacity:$}=o,{width:D,height:H,enableHover:I,showGrid:F,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=i,U="horizontal"===f,K=void 0===s,Q=!d,Z=function(){var e;const t=Oa();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),J=t.useMemo(()=>y&&Array.isArray(y)&&y.length>=g.length?y:function(e,t){if(0>=e)return[];if(t){const o=ic[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}(g.length,Z),[y,g.length,Z]),ee=t.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],J[t]||"#888");return e},[g,J]),{processedData:te,reAggregate:oe,accumulatorRef:ne}=function({data:e,levels:o,categoryAccessor:n,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>ac(n,"question"),[n]),d=t.useMemo(()=>c?ac(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:ac(r,"level"),[c,r]),g=t.useMemo(()=>c?null:ac(s,"count"),[c,s]),f=e||[],p=t.useRef([]),y=t.useMemo(()=>{if(0===f.length)return[];let e=lc(f,o,u,d,h,g);return a&&(e=cc(e,o),e=uc(e,o)),e},[f,o,u,d,h,g,a]),m=t.useCallback(e=>{var t;let n=lc(e,o,u,d,h,g);a&&(n=cc(n,o),n=uc(n,o)),null===(t=l.current)||void 0===t||t.replace(n)},[o,u,d,h,g,a,l]);return{processedData:y,reAggregate:m,accumulatorRef:p}}({data:s,levels:g,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:h,isDiverging:U,frameRef:r}),ie="__likertLevelLabel",re=function({isPushMode:e,colorBy:o,colorScheme:n,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=Vs(),d=Pa(),h=t.useCallback(e=>{const t=e[o];return null!=t?t+"":null},[o]),g=t.useCallback(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),n=!0)}n&&c(e=>e+1)},[e,o,h]),f=t.useCallback(t=>{if(!e||!o)return;const n=Array.from(new Set(t.map(String))),i=a.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(s.current=new Set(n),a.current=n,c(e=>e+1))},[e,o]),p=t.useCallback(e=>t=>{g([t]),e(t)},[g]),y=t.useCallback(e=>t=>{g(t),e(t)},[g]),m=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);ha(e&&o?a.current:[]);const v=t.useMemo(()=>{if(!e||!o||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:d&&d.length>0?d:ve,s=o,l=t.map(e=>({[s]:e})),c=we(l,s,r);return ya({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:ke})},[e,o,i,n,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:p,wrapPushMany:y,resetCategories:m,categories:a.current,categoryDomainProps:e&&o?{legendCategoryAccessor:o,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:K,colorBy:ie,colorScheme:J,showLegend:W,legendPosition:R}),se=t.useCallback(re.wrapPush(e=>{ne.current.push(e),oe(ne.current)}),[re.wrapPush,oe,ne]),ae=t.useCallback(re.wrapPushMany(e=>{ne.current.push(...e),oe(ne.current)}),[re.wrapPushMany,oe,ne]);t.useImperativeHandle(n,()=>({push:se,pushMany:ae,remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;ne.current=[],re.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[se,ae,re.resetCategories,ne]);const le=il({data:te,rawData:s,colorBy:ie,colorScheme:J,legendInteraction:T,legendPosition:R,selection:w,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:D,height:H});if(le.earlyReturn)return le.earlyReturn;const ce=t.useMemo(()=>{const e=g.length;return e%2!=0&&ee.get(g[Math.floor(e/2)])||"#888"},[g,ee]),ue=tc({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:dc,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:E,strokeWidth:N,opacity:$,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.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===rc||i===sc)return{fill:ce};const r=n||i;return r&&ee.has(r)?{fill:ee.get(r)}:{fill:"#888"}}}),de=t.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),he=t.useMemo(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===rc||o===sc?de:o,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=o===rc||o===sc?2*r:r,a=t.__likertCount||0;return p.createElement("div",{className:"semiotic-tooltip",style:yn},p.createElement("div",{style:{fontWeight:"bold"}},i),p.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[de]),ge=t.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return Q?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),h&&(e.countAccessor=h)),el({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,u,d,h,g,Q]),fe=t.useMemo(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,ee]),pe=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},le.legendBehaviorProps),{legend:{legendGroups:fe},legendPosition:R||le.legendPosition||"bottom"}):le.legendBehaviorProps,[le.legendBehaviorProps,le.legendPosition,R,W,fe]),ye=t.useMemo(()=>{const e=Object.assign({},le.margin);if(K&&!1!==W){const t=R||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(re.streamingMarginAdjust)for(const[t,o]of Object.entries(re.streamingMarginAdjust))o>e[t]&&(e[t]=o);return U&&100>e.left&&(e.left=100),e},[le.margin,re.streamingMarginAdjust,U,K,W,R]),me=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:te}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:ue,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ye,barPadding:m,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V||(U?void 0:"Percentage"),rFormat:me}),B&&{oFormat:B}),{showGrid:F}),pe),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:!1===v?()=>null:!0===v?he:kn(v)||he}),(j||A||S||O)&&{customHoverBehavior:le.customHoverBehavior}),(A||S||j)&&{customClickBehavior:le.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(Fa,{componentName:"LikertChart",message:ge,width:D,height:H}):e.jsx(Ga,{componentName:"LikertChart",width:D,height:H,children:e.jsx(Yi,Object.assign({ref:r},be))})});function gc({brushProp:e,onBrushProp:o,linkedBrush:n,valueAccessor:i}){const r=ma("string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0),s=ra({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),a=t.useRef(s.brushInteraction);a.current=s.brushInteraction;const l=t.useCallback(e=>{if(r){a.current.end(e?e.r:null)}null==o||o(e)},[o,r]),c=!!(e||n||o);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}hc.displayName="LikertChart";const fc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sizeBy:p,sizeRange:y=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:w,valueExtent:j,brush:A,onBrush:S,linkedBrush:O,frameProps:M={},selection:C,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,chartId:R,loading:B,loadingContent:E,emptyContent:N,legendInteraction:$,legendPosition:D,color:H,stroke:I,strokeWidth:F,opacity:W,showCategoryTicks:z,categoryFormat:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=i,oe=t.useMemo(()=>k(s),[s]),ne=il({data:oe,rawData:s,colorBy:g,colorScheme:f,legendInteraction:$,legendPosition:D,selection:C,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:R,showLegend:U,userMargin:a,marginDefaults:i.marginDefaults,loading:B,loadingContent:E,emptyContent:N,width:G,height:q}),ie=gc({brushProp:A,onBrushProp:S,linkedBrush:O,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const re=t.useMemo(()=>{if(!p)return;const e=oe.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[oe,p]),se=Pa(),ae=t.useMemo(()=>new Map,[oe]),le=tc({colorBy:g,colorScale:ne.colorScale,color:H,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==M?void 0:M.pieceStyle,stroke:I,strokeWidth:F,opacity:W,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:p?je(e,p,y,re):m})}),ce=t.useMemo(()=>Gs({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),ue=el({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(Fa,{componentName:"SwarmPlot",message:ue,width:G,height:q});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne.margin,barPadding:b,enableHover:X}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:ee,rLabel:te,rFormat:h}),Y&&{oFormat:Y}),{showGrid:V,showCategoryTicks:z}),ne.legendBehaviorProps),Ns({title:K,description:Q,summary:Z,accessibleTable:J,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:ce})),$s({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),w&&w.length>0&&{annotations:w}),j&&{rExtent:j}),ie.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"SwarmPlot",width:G,height:q,children:e.jsx(Yi,Object.assign({ref:r},de))})});function pc(t){return o=>{var n;const i=o.category||o.data&&(null===(n=o.data[0])||void 0===n?void 0:n.category)||"",r=o.stats||(o.data||o).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const n=t.valueAccessor,r=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:yn,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}fc.displayName="SwarmPlot";const yc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,showOutliers:p=!0,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,frameProps:x={},selection:w,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:R,stroke:B,strokeWidth:E,opacity:N,showCategoryTicks:$,categoryFormat:D}=o,{width:H,height:I,enableHover:F,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=i,K=t.useMemo(()=>k(s),[s]),Q=il({data:K,rawData:s,colorBy:g,colorScheme:f,legendInteraction:L,legendPosition:T,selection:w,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:H,height:I});if(Q.earlyReturn)return Q.earlyReturn;const Z=Pa(),J=t.useMemo(()=>new Map,[K]),ee=tc({colorBy:g,colorScale:Q.colorScale,color:R,themeCategorical:Z,colorScheme:f,categoryIndexMap:J,userPieceStyle:void 0,stroke:B,strokeWidth:E,opacity:N,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>pc(),[]),oe=el({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(Fa,{componentName:"BoxPlot",message:oe,width:H,height:I});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:"boxplot"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:p,size:[H,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,barPadding:y,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:U,rFormat:h}),D&&{oFormat:D}),{showGrid:W,showCategoryTicks:$}),Q.legendBehaviorProps),Ns({title:Y,description:G,summary:q,accessibleTable:X,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:te})),$s({linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),v&&v.length>0&&{annotations:v}),b&&{rExtent:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"BoxPlot",width:H,height:I,children:e.jsx(Yi,Object.assign({ref:r},ne))})});yc.displayName="BoxPlot";const mc=t.forwardRef(function(o,n){const i=Ha(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"}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:f,colorScheme:p,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,brush:x,onBrush:w,linkedBrush:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:B,legendPosition:E,color:N,stroke:$,strokeWidth:D,opacity:H,showCategoryTicks:I,categoryFormat:F}=o,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=il({data:J,rawData:s,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:E,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:W,height:z}),te=gc({brushProp:x,onBrushProp:w,linkedBrush:j,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const oe=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];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,u]),ne=Pa(),ie=t.useMemo(()=>new Map,[J]),re=tc({colorBy:f,colorScale:ee.colorScale,color:N,themeCategorical:ne,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const o=t.data||t,n=o.category||t.category||"",i=o.count,r=o.range;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[n&&e.jsx("div",{style:{fontWeight:"bold"},children:n+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]),ae=el({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(Fa,{componentName:"Histogram",message:ae,width:W,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),b?{rExtent:b}:oe&&{rExtent:oe}),{size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:I}),ee.legendBehaviorProps),Ns({title:X,description:V,summary:U,accessibleTable:K,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:se})),$s({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),v&&v.length>0&&{annotations:v}),te.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"Histogram",width:W,height:z,children:e.jsx(Yi,Object.assign({ref:r},le))})});mc.displayName="Histogram";const vc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:j,linkedBrush:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,color:$,stroke:D,strokeWidth:H,opacity:I,showCategoryTicks:F,categoryFormat:W}=o,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=i,ee=t.useMemo(()=>k(s),[s]),te=il({data:ee,rawData:s,colorBy:p,colorScheme:y,legendInteraction:E,legendPosition:N,selection:O,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:B,width:z,height:Y}),oe=gc({brushProp:w,onBrushProp:j,linkedBrush:A,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const ne=Pa(),ie=t.useMemo(()=>new Map,[ee]),re=tc({colorBy:p,colorScale:te.colorScale,color:$,themeCategorical:ne,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>pc({valueAccessor:u}),[u]),ae=el({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(Fa,{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!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[z,Y],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te.margin,barPadding:m,enableHover:G}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),Ns({title:V,description:U,summary:K,accessibleTable:Q,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:v,defaultTooltipContent:se})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"ViolinPlot",width:z,height:Y,children:e.jsx(Yi,Object.assign({ref:r},le))})});vc.displayName="ViolinPlot";const bc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=5,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:j,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:B,stroke:E,strokeWidth:N,opacity:$,showCategoryTicks:D,categoryFormat:H}=o,{width:I,height:F,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=i,Q=t.useMemo(()=>k(s),[s]),Z=il({data:Q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:T,legendPosition:R,selection:j,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:I,height:F});if(Z.earlyReturn)return Z.earlyReturn;const J=Pa(),ee=t.useMemo(()=>new Map,[Q]),te=tc({colorBy:p,colorScale:Z.colorScale,color:B,themeCategorical:J,colorScheme:y,categoryIndexMap:ee,userPieceStyle:void 0,stroke:E,strokeWidth:N,opacity:$,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),oe=t.useMemo(()=>pc(),[]),ne=el({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(Fa,{componentName:"RidgelinePlot",message:ne,width:I,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({chartType:"ridgeline"},null!=s&&{data:Q}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[I,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:W}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:D,oSort:!1,amplitude:g}),Z.legendBehaviorProps),Ns({title:G,description:q,summary:X,accessibleTable:V,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:v,defaultTooltipContent:oe})),$s({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"RidgelinePlot",width:I,height:F,children:e.jsx(Yi,Object.assign({ref:r},ie))})});bc.displayName="RidgelinePlot";const xc=t.forwardRef(function(o,n){const i=Ha(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}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:f="horizontal",connectorOpacity:p=.3,showLabels:y=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:B,opacity:E,categoryFormat:N}=o,$="vertical"===f,{width:D,height:H,enableHover:I,showLegend:F,title:W,description:z,summary:Y,accessibleTable:G}=i,q=$?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>k(s),[s]),V=h||d,U=!V,K=il({data:X,rawData:s,colorBy:V,colorScheme:g,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"FunnelChart",chartId:O,showLegend:F,userMargin:a,marginDefaults:q,loading:M,loadingContent:C,emptyContent:_,width:D,height:H});if(K.earlyReturn)return K.earlyReturn;Ka("FunnelChart",X,"stepAccessor",c),Ka("FunnelChart",X,"valueAccessor",u);const Q=Pa(),Z=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(U)return T||((null==Q?void 0:Q[0])?Q[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[U,T,Q,g]),ee=tc({colorBy:J?void 0:V,colorScale:K.colorScale,color:null!=J?J:T,themeCategorical:Q,colorScheme:g,categoryIndexMap:Z,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:B,opacity:E,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection}),te=t.useMemo(()=>t=>{var o,n,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(n=null!==(o=null==l?void 0:l.__funnelValue)&&void 0!==o?o:null==l?void 0:l.__barFunnelValue)&&void 0!==n?n:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),f&&f!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:f+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",p]})]})},[]),oe=el({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(oe)return e.jsx(Fa,{componentName:"FunnelChart",message:oe,width:D,height:H});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:$?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:$?"vertical":"horizontal",barPadding:$?40:0,pieceStyle:ee,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:$,showCategoryTicks:$}),N&&{oFormat:N}),{showGrid:$}),!$&&{connectorOpacity:p}),{showLabels:y}),K.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?te:kn(m)||te}),(w||j||A||S)&&{customHoverBehavior:K.customHoverBehavior}),(j||A||w)&&{customClickBehavior:K.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"FunnelChart",width:D,height:H,children:e.jsx(Yi,Object.assign({ref:r},ne))})});xc.displayName="FunnelChart";const kc=t.forwardRef(function(o,n){var i;const r=Ha(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,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:o.orientation}),s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,sort:y="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,regression:w,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:B,legendPosition:E,color:N,stroke:$,strokeWidth:D,opacity:H,categoryFormat:I}=o,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=r,Z=t.useMemo(()=>k(a),[a]),J=il({data:Z,rawData:a,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:E,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:F,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=Ra(Z,y,d),te=Pa(),oe=t.useMemo(()=>new Map,[Z]),ne=tc({colorBy:f,colorScale:J.colorScale,color:N,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),ie=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),re=el({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(Fa,{componentName:"DotPlot",message:re,width:F,height:W});const se=cl(w),ae=se?[se,...x||[]]:x,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!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:r.showAxes,oLabel:K,rLabel:Q,rFormat:g}),I&&{oFormat:I}),{showGrid:Y,oSort:y}),J.legendBehaviorProps),Ns({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:b,defaultTooltipContent:ie})),$s({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"DotPlot",width:F,height:W,children:e.jsx(Yi,Object.assign({ref:s},le))})});kc.displayName="DotPlot";const wc=t.forwardRef(function(o,n){var i,r;const s=Ha(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(r=o.height)&&void 0!==r?r:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,showLegend:H,title:I,description:F,summary:W,accessibleTable:z}=s,Y=t.useMemo(()=>k(l),[l]),G=g||d,q=il({data:Y,rawData:l,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:H,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:N,height:$});if(q.earlyReturn)return q.earlyReturn;const X=Pa(),V=t.useMemo(()=>new Map,[Y]),U=tc({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:f,categoryIndexMap:V,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:B,opacity:E,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>Gs({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),Q=el({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:Z,effectiveMargin:J}=ec({ref:n,frameRef:a,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!=l&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:U,startAngle:p}),null!=y&&{cornerRadius:y}),{size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Z),Ns({title:I,description:F,summary:W,accessibleTable:z,className:u,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:K})),$s({linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return Q?e.jsx(Fa,{componentName:"PieChart",message:Q,width:N,height:$}):e.jsx(Ga,{componentName:"PieChart",width:N,height:$,children:e.jsx(Yi,Object.assign({ref:a},ee))})});wc.displayName="PieChart";const jc=t.forwardRef(function(o,n){const i=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,showLegend:H,title:I,description:F,summary:W,accessibleTable:z}=i,Y=t.useMemo(()=>k(s),[s]),G=g||c,q=il({data:Y,rawData:s,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"DonutChart",chartId:O,showLegend:H,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:N,height:$});if(q.earlyReturn)return q.earlyReturn;const X=null!=d?d:Math.max(2,.15*Math.min(N,$)),V=Pa(),U=t.useMemo(()=>new Map,[Y]),K=tc({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:f,categoryIndexMap:U,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:B,opacity:E,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=t.useMemo(()=>Gs({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),Z=el({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=ec({ref:n,frameRef:r,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!=s&&{data:Y}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:K,innerRadius:X,startAngle:p}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),J),Ns({title:I,description:F,summary:W,accessibleTable:z,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:Q})),$s({linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return Z?e.jsx(Fa,{componentName:"DonutChart",message:Z,width:N,height:$}):e.jsx(Ga,{componentName:"DonutChart",width:N,height:$,children:e.jsx(Yi,Object.assign({ref:r},te))})});function Ac(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}}function Sc(e){return Math.max(0,Math.min(1,e))}function Oc(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 o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function Mc(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Cc(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Sc(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=Sc(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],i=o[e+1];if(t.offset>n||n>i.offset)continue;const r=i.offset-t.offset,s=r>0?(n-t.offset)/r:0,a=Oc(t.color),l=Oc(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,g,f]=l;return Mc(c+(h-c)*s,u+(g-u)*s,d+(f-d)*s)}return o[o.length-1].color}function _c(e,t,o){return`${e}-${t}`}jc.displayName="DonutChart";const Pc=t.forwardRef(function(o,n){const i=Ha(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}),r=t.useRef(null),s="context"===o.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:g,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,cornerRadius:y,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!a,sweep:w=240,fillZones:j=!0,tooltip:A,annotations:S,frameProps:O={},className:M,stroke:C,strokeWidth:_,opacity:P}=o,{width:L,height:T,title:R,description:B,summary:E,accessibleTable:N}=i,$=h&&"object"==typeof h?h:void 0,D=Math.max(c,Math.min(u,l)),H=u-c||1,I=(D-c)/H,{gaugeData:F,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:o,value:n,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:o,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(o,e.value))})),o>g[g.length-1].value&&g.push({value:o,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=_c("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(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(Cc(c.colorStops,e*(t+.5)/o));const i=_c("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:n}}),y.set(i,{fill:n[0]||s})}}else{let e=t;for(let o=0;g.length>o;o++){const n=g[o],i=(n.value-e)/d,r=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=_c("fill",o);p.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),y.set(e,{fill:n.color})}if(u>0){const e=_c("bg",o);p.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&o>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:c,max:u,value:l,thresholds:d,fillColor:g,backgroundColor:f,fillZones:j,showScaleLabels:k,gradientFill:$}),[l,c,u,d,g,f,k,j,$]),Y=t.useMemo(()=>sl(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:G,startAngleDeg:q}=Ac(w),X=function(e=240){const{sweepRad:t,offsetRad:o}=Ac(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}}(w),V=Math.min(10,Math.max(1,Math.min(L,T)/12)),U=X.cx,K=X.cy,Q=Math.max(4,Math.min((L-2*V)/X.width,(T-2*V)/X.height)-2),Z=Math.max(0,Math.min(Q-1.5,Q*(1-p))),J=L/2-U*Q,ee=T/2-K*Q,te=2*(Q+4),oe=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(D,c,u):b;const t=x?x(D):Math.round(D)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*Q),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),k&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,D,c,u,x,k,Q,a]),ne=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(D):Math.round(D)+""}:null,[s,b,D,x]),ie=t.useMemo(()=>{if(!m)return null;const e=-Math.PI/2+q*Math.PI/180+I*G,t=Z>20?Z-8:Q-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,I,q,G,Z,v]),re=t.useMemo(()=>(t,o,n)=>{if("gauge-needle"===t.type){const i=(n.width||L)/2,r=(n.height||T)/2,s=Math.max(1,Q-Z),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+o)}if("gauge-label"===t.type){const i=-Math.PI/2+q*Math.PI/180+(t.value-c)/H*G,r=(n.width||L)/2,s=(n.height||T)/2,a=Z-1,l=Q+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,g=Math.sin(i)*l,f=Q+10,p=Math.cos(i)*f,y=Math.sin(i)*f,m=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return m>=11||1>m?(v="middle",b="auto"):m>=1&&5>m?(v="start",b="middle"):m>=5&&7>m?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:g,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:p,y:y,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+o)}return"gauge-value"===t.type?e.jsx("text",{x:(n.width||L)/2,y:(n.height||T)/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:t.text},"gauge-value-"+o):null},[L,T,c,H,q,G,Z,Q]),se=t.useMemo(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),ne&&e.push(ne),e},[z,S,ie,ne]),ae=t.useMemo(()=>t=>{var o;const n=(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o[0])||(null==t?void 0:t.data)||t,i=null==n?void 0:n._isFill;return e.jsxs("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==n?void 0:n._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(D):"Remaining"})]})},[D]);if(0===F.length)return e.jsx(Fa,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});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:w},null!=y&&{cornerRadius:y}),{centerContent:oe,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ee-te/2,bottom:T-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:kn(A)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),R&&{title:R}),B&&{description:B}),E&&{summary:E}),void 0!==N&&{accessibleTable:N}),M&&{className:M}),null!=o.animate&&{animate:o.animate}),O);return e.jsx(Ga,{componentName:"GaugeChart",width:L,height:T,children:e.jsx(Yi,Object.assign({ref:r},le))})});Pc.displayName="GaugeChart";const Lc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:w,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:B,legendPosition:E,color:N,stroke:$,strokeWidth:D,opacity:H,categoryFormat:I}=o,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=i,Z=t.useMemo(()=>k(s),[s]),J=f||u,ee=il({data:Z,rawData:s,colorBy:J,colorScheme:p,legendInteraction:B,legendPosition:E,selection:S,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:F,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=Pa(),oe=t.useMemo(()=>new Map,[Z]),ne=tc({colorBy:J,colorScale:ee.colorScale,color:N,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:A.pieceStyle,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),re=el({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=ec({ref:n,frameRef:r,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!=s&&{data:Z}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Q,rFormat:g}),I&&{oFormat:I}),{showGrid:Y}),se),Ns({title:q,description:X,summary:V,accessibleTable:U,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:ie})),$s({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return re?e.jsx(Fa,{componentName:"GroupedBarChart",message:re,width:F,height:W}):e.jsx(Ga,{componentName:"GroupedBarChart",width:F,height:W,children:e.jsx(Yi,Object.assign({ref:r},le))})});Lc.displayName="GroupedBarChart";const Tc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,barPadding:y,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:j={},selection:A,linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:R,legendPosition:B,color:E,stroke:N,strokeWidth:$,opacity:D,categoryFormat:H,rTickValues:I,tickLabelEdgeAlign:F,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=o,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:oe,valueLabel:ne}=i,ie=t.useMemo(()=>k(s),[s]),re=f||u,se=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==o.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?V:X)-2*t)/(t-1))):1},[y,o.mode,ie,c,h,X,V]),ae=il({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:R,legendPosition:B,selection:A,linkedHover:S,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:Q,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:X,height:V}),le=gc({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:d});if(ae.earlyReturn)return ae.earlyReturn;const ce=Pa(),ue=t.useMemo(()=>new Map,[ie]),de=tc({colorBy:re,colorScale:ae.colorScale,color:E,themeCategorical:ce,colorScheme:p,categoryIndexMap:ue,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:N,strokeWidth:$,opacity:D,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ge=el({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:fe,effectiveMargin:pe}=ec({ref:n,frameRef:r,setup:ae}),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!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:pe,barPadding:se,enableHover:U}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:oe,rLabel:ne,rFormat:g}),I&&{rTickValues:I}),null!=F&&{tickLabelEdgeAlign:F}),H&&{oFormat:H}),void 0!==W&&{showCategoryTicks:W}),{showGrid:K}),fe),Ns({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:he})),$s({linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),v&&v.length>0&&{annotations:v}),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(j).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(Fa,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e.jsx(Ga,{componentName:"SwimlaneChart",width:X,height:V,children:e.jsx(Yi,Object.assign({ref:r},ye))})});function Rc(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 Bc(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 Ec(e){return"function"==typeof e?e:t=>t[e]||1}function Nc({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=ke(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=ke(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 $c(e){const{nodes:o,edges:n,inferNodes:i=!0,sourceAccessor:r="source",targetAccessor:s="target",colorBy:a,colorScheme:l,showLegend:c,legendPosition:u,legendInteraction:d,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:w,loading:j,loadingContent:A,emptyContent:S,emptyDataKey:O="edges"}=e,M=t.useMemo(()=>k(n),[n]),C=t.useMemo(()=>k(o),[o]),_=Ua(j,x,w,A),P=_?null:Va("nodes"===O?void 0===o?void 0:C:void 0===n?void 0:M,x,w,S),L=t.useMemo(()=>i?Bc(C,M,r,s):C,[i,C,M,r,s]),T=Ta(L,a,l),R=Pa(),B=t.useMemo(()=>{if(Array.isArray(l))return l;if(R&&R.length>0)return R;if("string"==typeof l){const e=ye[l];if(Array.isArray(e)&&e.length>0)return e}return me},[l,R]),E=t.useMemo(()=>{if(!a)return[];const e=new Set;for(const t of L){const o="function"==typeof a?a(t):t[a];null!=o&&e.add(o+"")}return Array.from(e)},[L,a]),N=$a(d,a,E),{legend:$,margin:D,legendPosition:H}=Na({data:L,colorBy:a,colorScale:T,showLegend:c,legendPosition:u,userMargin:b,defaults:v,categories:E}),I=Ba({selection:h,linkedHover:g,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:F,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G}=I;return{safeNodes:L,safeEdges:M,colorScale:T,effectivePalette:B,themeCategorical:R,allCategories:E,legendState:N,legend:$,margin:D,legendPosition:H,customHoverBehavior:F,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G,loadingEl:_,emptyEl:P}}Tc.displayName="SwimlaneChart";const Dc=t.forwardRef(function(o,n){var i;const r=t.useRef(null);rl(n,{variant:"network",frameRef:r});const s=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:u,nodeIdAccessor:d,nodeIDAccessor:h,sourceAccessor:g="source",targetAccessor:f="target",nodeLabel:p,colorBy:y,colorScheme:m,nodeSize:v=8,nodeSizeRange:b=[5,20],edgeWidth:x=1,edgeColor:k="#999",edgeOpacity:w=.6,iterations:j=300,forceStrength:A=.1,tooltip:S,frameProps:O={},onObservation:M,onClick:C,chartId:_,selection:P,linkedHover:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,stroke:$,strokeWidth:D,opacity:H}=o,I=null!==(i=null!=d?d:h)&&void 0!==i?i:"id",{width:F,height:W,enableHover:z,showLegend:Y,showLabels:G=!1,title:q,description:X,summary:V,accessibleTable:U}=s,K=$c({nodes:a,edges:l,inferNodes:!1,sourceAccessor:g,targetAccessor:f,colorBy:y,colorScheme:m,showLegend:Y,legendPosition:N,legendInteraction:E,selection:P,linkedHover:L,onObservation:M,onClick:C,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:s.marginDefaults,userMargin:c,width:F,height:W,loading:T,loadingContent:R,emptyContent:B,emptyDataKey:"nodes"}),Q=t.useMemo(()=>new Map,[]),Z=t.useMemo(()=>e=>{const t={};return t.fill=y?ke(e.data||e,y,K.colorScale):La(void 0,K.themeCategorical,m,void 0,Q),"number"==typeof v&&(t.r=v),t},[y,K.colorScale,v,K.themeCategorical,m,Q]),J=t.useMemo(()=>sl(Z,{stroke:$,strokeWidth:D,opacity:H}),[Z,$,D,H]),ee=t.useMemo(()=>e=>({stroke:k,strokeWidth:"number"==typeof x?x:"function"==typeof x?x(e):e[x]||1,opacity:w}),[x,k,w]),te=t.useMemo(()=>sl(ee,{stroke:$,strokeWidth:D,opacity:H}),[ee,$,D,H]),oe=t.useMemo(()=>{if(G&&p)return"function"==typeof p?p:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[p])&&void 0!==o?o:e[p])&&void 0!==n?n:e.id}},[G,p]),ne=ol({componentName:"ForceDirectedGraph",nodes:a,edges:l,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:I}});return ne?e.jsx(Fa,{componentName:"ForceDirectedGraph",message:ne,width:F,height:W}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:e.jsx(Ga,{componentName:"ForceDirectedGraph",width:F,height:W,children:e.jsx(Es,Object.assign({ref:r,chartType:"force"},null!=a&&{nodes:K.safeNodes},null!=l&&{edges:K.safeEdges},{size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,nodeIDAccessor:I,sourceAccessor:g,targetAccessor:f,iterations:j,forceStrength:A,nodeStyle:J,edgeStyle:te,colorBy:y,colorScheme:K.effectivePalette,nodeSize:v,nodeSizeRange:b,nodeLabel:oe,showLabels:G,enableHover:z,tooltipContent:!1===S?()=>null:kn(S)||void 0,customHoverBehavior:L||M||C?K.customHoverBehavior:void 0,customClickBehavior:M||C?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!=o.animate&&{animate:o.animate},O))})});Dc.displayName="ForceDirectedGraph";const Hc=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=i.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!==n?n:[]}}});const r=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,edgeOpacity:k=.5,tooltip:w,frameProps:j={},onObservation:A,onClick:S,chartId:O,selection:M,linkedHover:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,showLabels:H=!0,title:I,description:F,summary:W,accessibleTable:z}=r,Y=$c({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:!1,legendInteraction:T,selection:M,linkedHover:C,onObservation:A,onClick:S,chartType:"ChordDiagram",chartId:O,marginDefaults:r.marginDefaults,userMargin:l,width:N,height:$,loading:_,loadingContent:P,emptyContent:L}),G=t.useMemo(()=>new Map,[]),q=Y.safeNodes.length>0,X=t.useMemo(()=>{if(q)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(f)i.fill=ke(e.data||e,f,Y.colorScale);else{const r=Array.isArray(p)?p:ye[p]||me,s=Array.isArray(r)?r:me,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,f,Y.colorScale,p]),V=t.useMemo(()=>X?sl(X,{stroke:R,strokeWidth:B,opacity:E}):void 0,[X,R,B,E]),U=t.useMemo(()=>{if(q)return Nc({edgeColorBy:y,colorBy:f,colorScale:Y.colorScale,nodeStyleFn:V||(e=>({fill:La(void 0,Y.themeCategorical,p,void 0,G)})),edgeOpacity:k,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:k}})},[q,y,f,Y.colorScale,V,k,Y.themeCategorical,p,G]),K=t.useMemo(()=>U?sl(U,{stroke:R,strokeWidth:B,opacity:E}):void 0,[U,R,B,E]),Q=t.useMemo(()=>{if(!H)return;const e=x||g;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}},[H,x,g]),Z=ol({componentName:"ChordDiagram",edges:a,edgesRequired:!0});return Z?e.jsx(Fa,{componentName:"ChordDiagram",message:Z,width:N,height:$}):Y.loadingEl?Y.loadingEl:Y.emptyEl?Y.emptyEl:e.jsx(Ga,{componentName:"ChordDiagram",width:N,height:$,children:e.jsx(Es,Object.assign({ref:i,chartType:"chord"},Y.safeNodes.length>0&&{nodes:Y.safeNodes},null!=a&&{edges:Y.safeEdges},{size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:V,edgeStyle:K,colorBy:f,colorScheme:Y.effectivePalette,edgeColorBy:y,edgeOpacity:k,nodeLabel:Q,showLabels:H,enableHover:D,tooltipContent:!1===w?()=>null:kn(w)||void 0,customHoverBehavior:C||A||S?Y.customHoverBehavior:void 0,customClickBehavior:A||S?Y.customClickBehavior:void 0},T&&"none"!==T&&{legendHoverBehavior:Y.legendState.onLegendHover,legendClickBehavior:Y.legendState.onLegendClick,legendHighlightedCategory:Y.legendState.highlightedCategory,legendIsolatedCategories:Y.legendState.isolatedCategories},{className:c,title:I,description:F,summary:W,accessibleTable:z},null!=o.animate&&{animate:o.animate},j))})});Hc.displayName="ChordDiagram";const Ic=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=i.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!==n?n:[]}}});const r=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:k,edgeOpacity:w=.5,edgeSort:j,tooltip:A,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,emptyContent:R,showLegend:B,legendPosition:E,legendInteraction:N,stroke:$,strokeWidth:D,opacity:H}=o,{width:I,height:F,enableHover:W,showLabels:z=!0,title:Y,description:G,summary:q,accessibleTable:X}=r,V=$c({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:B,legendPosition:E,legendInteraction:N,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"SankeyDiagram",chartId:C,marginDefaults:r.marginDefaults,userMargin:l,width:I,height:F,loading:L,loadingContent:T,emptyContent:R}),U=t.useMemo(()=>new Map,[]),K=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?ke(e.data||e,f,V.colorScale):La(void 0,V.themeCategorical,p,void 0,U),t},[f,V.colorScale,V.themeCategorical,p,U]),Q=t.useMemo(()=>sl(K,{stroke:$,strokeWidth:D,opacity:H}),[K,$,D,H]),Z=t.useMemo(()=>Nc({edgeColorBy:y,colorBy:f,colorScale:V.colorScale,nodeStyleFn:Q,edgeOpacity:w,baseStyle:{stroke:"none",strokeWidth:0}}),[y,f,V.colorScale,Q,w]),J=t.useMemo(()=>sl(Z,{stroke:$,strokeWidth:D,opacity:H}),[Z,$,D,H]),ee=t.useMemo(()=>{if(!z)return;const e=k||g;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}},[z,k,g]),te=ol({componentName:"SankeyDiagram",edges:a,edgesRequired:!0});return te?e.jsx(Fa,{componentName:"SankeyDiagram",message:te,width:I,height:F}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:e.jsx(Ga,{componentName:"SankeyDiagram",width:I,height:F,children:e.jsx(Es,Object.assign({ref:i,chartType:"sankey"},V.safeNodes.length>0&&{nodes:V.safeNodes},null!=a&&{edges:V.safeEdges},{size:[I,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:V.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:Q,edgeStyle:J,colorBy:f,colorScheme:V.effectivePalette,edgeColorBy:y,edgeOpacity:w,edgeSort:j,nodeLabel:ee,showLabels:z,enableHover:W,tooltipContent:!1===A?()=>null:kn(A)||void 0,customHoverBehavior:P||O||M?V.customHoverBehavior:void 0,customClickBehavior:O||M?V.customClickBehavior:void 0,legend:V.legend,legendPosition:V.legendPosition},N&&"none"!==N&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},{className:c,title:Y,description:G,summary:q,accessibleTable:X},null!=o.animate&&{animate:o.animate},S))})});function Fc(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,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u: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!==u&&(f.push({time:u,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 m=0,v=0,b=0,x=0,k=0;const w=[],j=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;j.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 A=[];let S=0;for(;w.length>S;){let e=S;for(;w.length>e+1&&w[e+1].t===w[S].t;)e++;A.push(w[S]);for(let t=S+1;e>=t;t++){const e=A[A.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||A.push(w[t])}S=e+1}const O=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let M=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===M||M>e.systemInTime)&&(M=e.systemInTime);let C=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===C||e.systemOutTime>C)&&(C=e.systemOutTime);if(A.length>0){const e=A[A.length-1],t=Math.max(null!=O?O:-1/0,null!=C?C:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&A.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=A[0],n=Math.min(null!=c?c:1/0,null!=M?M:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&A.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:A,peak:b,topPeak:x,botPeak:k,localAttachments:j}}function Wc(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function zc(e,t){return e.map(e=>({t:Wc(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Yc(e,t,o){const n=e.value*o;if("out"===e.kind){const i=e.sideMassBefore*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}const i=e.sideMassAfter*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}function Gc(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 qc(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 Xc(e,t){return 1e3*Gc(e,t)+qc(e,t)}function Vc(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function Uc(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=Vc(e,t),s=Xc(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]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=Xc(t,o);if(s>d)s=d,r=Vc(e,t);else if(d===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=Xc(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=Xc(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(),u=1/0;const d=()=>{for(const e of r)l[e]=a[i[e]];const e=Xc(l,o);u>e&&(u=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};d();const g=Array(n).fill(0);let f=0;for(;n>f;)f>g[f]?(h(f%2==0?0:g[f],f),d(),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 Kc(e,t,o,n,i){var r,s,a,l,c,u,d,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]=o[t.id].topPeak||0,x[t.id]=o[t.id].botPeak||0;const k="half"===v,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),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 n.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 j={},A=[];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 d=[];for(const t of e)0===(null!==(s=i.get(t.id))&&void 0!==s?s:0)&&d.push(t.id);for(;d.length;){const e=d.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)&&d.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;A.length>e;e++){const n=A[e].occupants[A[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(A.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=A.length-1),A[o].occupants.push({id:e.id,end:null!==(u=null==t?void 0:t.end)&&void 0!==u?u:-1/0}),A[o].peak.topPeak=Math.max(A[o].peak.topPeak,b[e.id]),A[o].peak.botPeak=Math.max(A[o].peak.botPeak,x[e.id]),j[e.id]=o}}else e.forEach((e,t)=>{var o,n;A.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]}}),j[e.id]=t});let S=null,O=null,M=null,C=null;const _=()=>{S=Gc(j,t),M=qc(j,t)},P=()=>{O=Gc(j,t),C=qc(j,t)};"crossing-min"===m?(_(),Uc(A,j,t),P()):"inside-out"===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]),u=new Map;r.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(A,j),P()):"crossing-min+inside-out"===m&&(_(),Uc(A,j,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=Xc(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 u=new Map;for(let e=0;n>e;e++)u.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)u.set(e,e-1);u.set(i,l)}else{for(let e=l;i>e;e++)u.set(e,e+1);u.set(i,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=Xc(t,o);if(d>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=d}}(A,j,t),P());const L=A.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},R=[];for(let e=0;A.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)}R.push(i)}const B=[];let E=f+(null!==(h=null===(d=A[0])||void 0===d?void 0:d.peak.topPeak)&&void 0!==h?h:0)*p;A.length>0&&B.push(E);for(let e=1;A.length>e;e++)E+=R[e-1]*p+f,B.push(E);if(A.length>0&&(E+=A[A.length-1].peak.botPeak*p+f),E>g){const e=g/E;for(let t=0;B.length>t;t++)B[t]*=e}const N=0===A.length?0:A[0].peak.topPeak+R.reduce((e,t)=>e+t,0)+A[A.length-1].peak.botPeak,$={};for(const t of e)$[t.id]=B[j[t.id]];return{effectiveSlotsHeight:N,centerlines:$,laneLifetime:w,slots:A,slotByNode:j,slotCenter:B,crossingsBefore:S,crossingsAfter:O,lengthBefore:M,lengthAfter:C}}Ic.displayName="SankeyDiagram";const Qc=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)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];s.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of n)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!==(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 Zc(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function Jc(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function eu(e,t){return"function"==typeof e?e(t):t[e]}const tu=t.forwardRef(function(o,n){const{nodes:r,edges:s,domain:a,axisTicks:l=[],nodeIdAccessor:c="id",sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",startTimeAccessor:g="startTime",endTimeAccessor:f="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:y,xExtentAccessor:m="xExtent",edgeIdAccessor:v="id",colorBy:b,colorScheme:x,showLegend:w,legendPosition:j="right",pairing:A="temporal",packing:S="reuse",laneOrder:O="crossing-min",ribbonLane:M="both",lifetimeMode:C="half",showLaneRails:_=!1,showQualityReadout:P=!1,showLabels:L=!0,width:T=600,height:R=400,margin:B,title:E,description:N,summary:$,accessibleTable:D,responsiveWidth:H,responsiveHeight:I,loading:F,loadingContent:W,emptyContent:z,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={}}=o,[te,oe]=t.useState([]),[ne,ie]=t.useState([]),re=t.useRef(te),se=t.useRef(ne);re.current=te,se.current=ne;const ae=t.useCallback(e=>{re.current=e,oe(e)},[]),le=t.useCallback(e=>{se.current=e,ie(e)},[]),ce=void 0!==s,ue=k(ce?s:te),de=t.useMemo(()=>{const e=k(null!=r?r:[]),t=ne;if(0===e.length&&0===t.length)return Bc([],ue,u,d);const o=new Set,n=[];for(const t of e){const e=eu(c,t)+"";o.has(e)||(o.add(e),n.push(t))}for(const e of t){const t=eu(c,e)+"";o.has(t)||(o.add(t),n.push(e))}const i=Bc([],ue,u,d);for(const e of i)o.has(e.id)||(o.add(e.id),n.push(e));return n},[r,ne,ue,c,u,d]),he=t.useRef(null),ge=t.useCallback((e,t)=>{const o=eu(v,e);return null!=o?o+"":`${eu(u,e)}-${eu(d,e)}-${t}`},[v,u,d]),fe=t.useCallback(e=>{if(null==e)return!1;const t=e;return null!=eu(u,t)&&null!=eu(d,t)},[u,d]);rl(n,{variant:"network",frameRef:he,overrides:{push(e){if(fe(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)fe(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=eu(c,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=eu(c,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!=ue?ue:[],getScales:()=>null},deps:[ce,fe,ge,c,ue,ae,le]});const pe=ge,ye=t.useCallback(e=>eu(c,e)+"",[c]),{nodes:me,edges:ve,domain:be,rawNodeById:xe,rawEdgeById:we}=t.useMemo(()=>{const e=(null!=de?de:[]).map(e=>{const t={id:ye(e),__raw:e},o=m?eu(m,e):null;if(Array.isArray(o)&&2===o.length){const e=Jc(o[0]),n=Jc(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(null!=ue?ue:[]).map((e,t)=>{const o={id:pe(e,t),source:eu(u,e)+"",target:eu(d,e)+"",value:Number(eu(h,e)),startTime:Jc(eu(g,e)),endTime:Jc(eu(f,e)),__raw:e};if(p){const t=Jc(eu(p,e));Number.isFinite(t)&&(o.systemInTime=t)}if(y){const t=Jc(eu(y,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[Jc(a[0]),Jc(a[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}},[de,ue,a,ye,pe,m,u,d,h,g,f,p,y]),je=$c({nodes:de,edges:ue,inferNodes:!1,sourceAccessor:u,targetAccessor:d,colorBy:b,colorScheme:x,showLegend:!1,legendPosition:j,selection:void 0,linkedHover:void 0,onObservation:U,onClick:K,chartType:"ProcessSankey",chartId:J,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:B,width:T,height:R,loading:F,loadingContent:W,emptyContent:z}),Ae=(null!=w?w:!!b)&&!!b,Se=t.useCallback(e=>null!=B&&("number"==typeof B||null!=B[e]),[B]),Oe=t.useMemo(()=>{const e=Object.assign({},je.margin);return Ae&&("right"===j&&!Se("right")&&140>e.right?e.right=140:"bottom"===j&&!Se("bottom")&&80>e.bottom&&(e.bottom=80)),e},[je.margin,Ae,j,Se]),Me=T-Oe.left-Oe.right,Ce=R-Oe.top-Oe.bottom,_e=t.useMemo(()=>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,ve,be),[me,ve,be]),Pe=t.useMemo(()=>_e.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),u=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 d={};for(const t of e)d[t.id]=Fc(t,c,u);const h=Kc(e,t,d,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=u.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=>u.get(e.id).sourceSide)),i=new Set(o.map(e=>u.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]&&(u.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]&&(u.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"===u.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===u.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)&&u.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(u.get(l[0].id).sourceSide=t,!0)};let r=o.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=Fc(t,c,u);const f=Kc(e,t,d,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)),m=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,v=Kc(e,t,d,c,{plotH:i,padding:y,valueScale:m,packing:s,laneOrder:a,lifetimeMode:l});return{nodeData:d,sides:u,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}}(me,ve,{plotH:Ce,pairing:A,packing:S,laneOrder:O,lifetimeMode:C}),[_e,me,ve,Ce,A,S,O,C]),Le=t.useMemo(()=>i.scaleTime().domain(be).range([0,Me]),[be,Me]),Te=t.useCallback((e,t)=>{if(b&&de){const t=xe.get(e);if(t)return ke(t,b,je.colorScale)}return je.effectivePalette[t%je.effectivePalette.length]||"#475569"},[b,de,xe,je.colorScale,je.effectivePalette]),Re=t.useMemo(()=>{const e=new Map;return me.forEach((t,o)=>e.set(t.id,o)),e},[me]),Be=t.useMemo(()=>{if(!Pe)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Pe,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=zc(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,Le,be);if(!l)return;const c=zc(a.samples,be),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=e[i.id]+(u.botMass-u.topMass)*o/2,h=Te(i.id,r),g=null!==(s=xe.get(i.id))&&void 0!==s?s:i,f=function(e,t,o,n,i){const r=o.nodeData[e];if(!r||0===r.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=zc(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=n(c.t),h=n(u.t),g=e=>n(Wc(e,i)),f=[],p=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=r.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=g(o.systemInTime),n=g(o.startTime),i=t-20,r=Math.max(d,i);if(n>r){const[o,l]=Yc(e,a,s);f.push({pathD:p(r,o,n,l),x0:i,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=r.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=g(o.systemOutTime),n=g(o.endTime),i=t+20,r=Math.min(h,i);if(r>n){const[o,l]=Yc(e,a,s);f.push({pathD:p(n,o,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,ve,Pe,Le,be);n.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:Le(u.t)-4,labelY:d,labelText:i.id}))}),ve.forEach(n=>{var r,s,a,l;const c=null===(r=t[n.source])||void 0===r?void 0:r.localAttachments.get(n.id),u=null===(s=t[n.target])||void 0===s?void 0:s.localAttachments.get(n.id);if(!c||!u)return;const d=null!==(a=Re.get(n.source))&&void 0!==a?a:0,h=Te(n.source,d),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,u=r(c(e.time)),d=r(c(o.time)),h=e.value*l,g=o.value*l,f=e.sideMassBefore*l,p=o.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===o.side?(v=n-p,b=v+g):(b=n+p,v=b-g);const x="source"===s?u+.85*(d-u):"target"===s?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:y,sBot:m,tx:d,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[n.source],u,e[n.target],o,Le,M,be),{pathD:f,bezier:p}=Er(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}},[Pe,me,ve,Le,be,Te,xe,we,M,Y,Re]),Ee=t.useMemo(()=>({bands:Be.bands,ribbons:Be.ribbons,showLabels:L}),[Be,L]),Ne=t.useMemo(()=>{if(!Ae||!b)return;const e=new Map;(null!=de?de:[]).forEach((t,o)=>{const n=eu(b,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:Te(ye(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},[Ae,b,de,Te,ye]),$e=t.useMemo(()=>!1!==X&&V?void 0===X||!0===X?null:kn(X)||null:null,[X,V]),De=t.useCallback(e=>G?G(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[G]),He=t.useCallback(e=>q?q(e):e+"",[q]),Ie=t.useCallback(t=>{if(!t||!t.data)return null;const o=t.data;if(!Zc(o))return null;const n=o.data;if($e)return $e(n);if("band"===o.__kind){const t=o.id,n=Pe?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}(Pe.nodeData[t]):[],i=5,r=n.length>i?n.length:null,s=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,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:t}),s.length>0&&e.jsxs("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{opacity:.6},children:[e.jsx("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e.jsx("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=r&&e.jsx("th",{})]})}),e.jsx("tbody",{children:s.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:{paddingRight:8},children:De(t.t)}),e.jsx("td",{style:{textAlign:"right"},children:He(t.total)}),null!=r&&e.jsx("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:t.mark})]},o))})]}),null!=r&&e.jsxs("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",r," samples"]})]})}const i=n,r=eu(u,i),s=eu(d,i),a=eu(h,i),l=eu(g,i),c=eu(f,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:[r+""," → ",s+""]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"value"}),e.jsx("span",{style:{textAlign:"right"},children:He(Number(a))})]}),null!=l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"start"}),e.jsx("span",{style:{textAlign:"right"},children:De(Jc(l))})]}),null!=c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"end"}),e.jsx("span",{style:{textAlign:"right"},children:De(Jc(c))})]})]})]})},[Pe,$e,De,He,u,d,h,g,f]),Fe=t.useMemo(()=>{if(!Pe)return null;const{centerlines:t,laneLifetime:o,nodeData:n,valueScale:i,compressedPadding:r,crossingsBefore:s,crossingsAfter:a,lengthBefore:c,lengthAfter:u}=Pe;let d=null,h=null;for(const e of me){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=Le(t.start),i=Le(t.end);(null===d||d>n)&&(d=n),(null===h||i>h)&&(h=i)}const g=e=>Math.max(0,Math.min(Me,e)),f=g(null!=d?d:0),p=Math.max(f,g(null!=h?h:Me));return e.jsxs("g",{children:[P&&null!==(null!=a?a:null)&&e.jsxs("text",{x:Me,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",a," ","edge length: ",Math.round(c)," → ",Math.round(u)]}),r&&e.jsx("text",{x:Me,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((t,o)=>{const n=Le(Jc(t.date));return f-.5>n||n>p+.5?null:e.jsx("line",{x1:n,y1:0,x2:n,y2:Ce,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+o)}),_&&me.map((r,s)=>{const a=o[r.id];if(!a||null===a.start)return null;const l=n[r.id],c=l?{topPeak:l.topPeak,botPeak:l.botPeak}:{topPeak:0,botPeak:0},u=t[r.id]+(c.botPeak-c.topPeak)*i/2,d=Le(a.start),h=Le(a.end),g=Te(r.id,s);return e.jsxs("g",{children:[e.jsx("line",{x1:d,y1:u,x2:h,y2:u,stroke:g,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e.jsx("line",{x1:d,y1:u-4,x2:d,y2:u+4,stroke:g,strokeOpacity:.5}),e.jsx("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:g,strokeOpacity:.5})]},"lane-"+r.id)}),e.jsx("line",{x1:f,y1:Ce+4,x2:p,y2:Ce+4,stroke:"#94a3b8"}),l.map((t,o)=>{const n=Jc(t.date),i=Le(n);if(f-.5>i||i>p+.5)return null;const r=null!=t.label?t.label:G?G(new Date(n)):"";return e.jsxs("g",{transform:`translate(${i},${Ce+4})`,children:[e.jsx("line",{y2:6,stroke:"#94a3b8"}),e.jsx("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:r})]},o)})]})},[Pe,l,Le,Me,Ce,_,me,Te,P,G]),We=t.useMemo(()=>(null!=de?de:[]).map(e=>({id:ye(e),data:e})),[de,ye]),ze=t.useMemo(()=>{const e=new Map;for(const t of Be.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Be]),Ye=t.useMemo(()=>(null!=ue?ue:[]).map((e,t)=>{const o=pe(e,t),n=Number(eu(h,e));return{id:o,source:eu(u,e)+"",target:eu(d,e)+"",value:Number.isFinite(n)?n:0,bezier:ze.get(o),data:e}}),[ue,pe,u,d,h,ze]),Ge=je.loadingEl,qe=je.emptyEl;return _e.length>0?e.jsxs("svg",{width:T,height:R,role:"img","aria-label":null!=E?E:"Process Sankey validation failed",children:[e.jsx("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),_e.map((t,o)=>{return e.jsx("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})]}):Ge||qe||e.jsx(Es,Object.assign({ref:he,chartType:"force",nodes:We,edges:Ye,customNetworkLayout:Qc,layoutConfig:Ee,size:[T,R],responsiveWidth:H,responsiveHeight:I,margin:Oe,title:E,description:null!=N?N:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:$,accessibleTable:D,enableHover:V,tooltipContent:!1===X?()=>null:Ie,backgroundGraphics:Fe,showParticles:Q,particleStyle:Z,legend:Ne,legendPosition:j,onObservation:U,customClickBehavior:K?e=>{if(!e||!e.data)return;const t=e.data;Zc(t)&&K(t.data,{x:e.x,y:e.y})}:void 0,chartId:J,colorScheme:Array.isArray(x)?x:void 0},ee))});function ou(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="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:j,linkedHover:A,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=o,{width:L,height:T,enableHover:R,showLabels:B=!0,title:E,description:N,summary:$,accessibleTable:D}=n,H=$c({nodes:t.useMemo(()=>Rc(null!=i?i:null,c),[i,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:M,selection:j,linkedHover:A,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:n.marginDefaults,userMargin:r,width:L,height:T,loading:S,loadingContent:O}),I=t.useMemo(()=>new Map,[]),F=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?be[(e.depth||0)%be.length]:h?ke(e.data||e,h,H.colorScale):La(void 0,H.themeCategorical,g,void 0,I),t},[h,f,H.colorScale,H.themeCategorical,g,I]),W=t.useMemo(()=>sl(F,{stroke:C,strokeWidth:_,opacity:P}),[F,C,_,P]),z=t.useMemo(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=t.useMemo(()=>sl(z,{stroke:C,strokeWidth:_,opacity:P}),[z,C,_,P]),G=t.useMemo(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return Ec(u)},[a,u]),q=tl({componentName:"TreeDiagram",data:i});return q?e.jsx(Fa,{componentName:"TreeDiagram",message:q,width:L,height:T}):H.loadingEl?H.loadingEl:e.jsx(Ga,{componentName:"TreeDiagram",width:L,height:T,children:e.jsx(Es,Object.assign({chartType:a},null!=i&&{data:i},{size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:H.margin,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:H.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:B?y||d:void 0,showLabels:B,enableHover:R,tooltipContent:!1===v?()=>null:kn(v)||void 0,customHoverBehavior:A||x||k?H.customHoverBehavior:void 0,customClickBehavior:x||k?H.customClickBehavior:void 0},M&&"none"!==M&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:s,title:E,description:N,summary:$,accessibleTable:D},null!=o.animate&&{animate:o.animate},b))})}function nu(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,labelMode:g="leaf",nodeLabel:f,padding:p=4,paddingTop:y,nodeStyle:m,tooltip:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:j,chartId:A,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=o,{nodeStyle:L}=b,T=ul(b,["nodeStyle"]),{width:R,height:B,enableHover:E,showLabels:N=!0,title:$,description:D,summary:H,accessibleTable:I}=n,F=$c({nodes:t.useMemo(()=>Rc(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:M,selection:x,linkedHover:k,onObservation:w,onClick:j,chartType:"Treemap",chartId:A,marginDefaults:n.marginDefaults,userMargin:r,width:R,height:B,loading:S,loadingContent:O}),W=nl(x),z=F.customHoverBehavior,Y=t.useCallback(e=>{if(!e)return z(null);const t=e.data||e;z({data:(null==t?void 0:t.data)||t})},[z]),G=t.useMemo(()=>new Map,[]),q=t.useMemo(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=h?be[(e.depth||0)%be.length]:u?ke(e.data||e,u,F.colorScale):La(void 0,F.themeCategorical,d,void 0,G),t},[u,h,F.colorScale,F.themeCategorical,d,G]),X=t.useMemo(()=>m||L?e=>{var t,o;return Object.assign(Object.assign(Object.assign({},q(e)),L&&null!==(t=L(e))&&void 0!==t?t:{}),m&&null!==(o=m(e))&&void 0!==o?o:{})}:q,[q,m,L]),V=t.useMemo(()=>sl(X,{stroke:C,strokeWidth:_,opacity:P}),[X,C,_,P]),U=t.useMemo(()=>F.activeSelectionHook?e=>{var t;const o=Object.assign({},V(e));if(F.activeSelectionHook.isActive)if(F.activeSelectionHook.predicate(e.data||e))(null==W?void 0:W.selectedStyle)&&Object.assign(o,W.selectedStyle);else{const e=null!==(t=null==W?void 0:W.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==W?void 0:W.unselectedStyle)&&Object.assign(o,W.unselectedStyle)}return o}:V,[V,F.activeSelectionHook,W]),K=t.useMemo(()=>Ec(l),[l]),Q=void 0!==y?y:!N||"parent"!==g&&"all"!==g?void 0:18,Z=tl({componentName:"Treemap",data:i});return Z?e.jsx(Fa,{componentName:"Treemap",message:Z,width:R,height:B}):F.loadingEl?F.loadingEl:e.jsx(Ga,{componentName:"Treemap",width:R,height:B,children:e.jsx(Es,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[R,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:F.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:K,padding:p,paddingTop:Q,nodeStyle:U,colorBy:u,colorScheme:F.effectivePalette,colorByDepth:h,nodeLabel:N?f||c:void 0,showLabels:N,labelMode:g,enableHover:E,tooltipContent:!1===v?()=>null:kn(v)||void 0},(k||w||j)&&{customHoverBehavior:Y},(w||j)&&{customClickBehavior:F.customClickBehavior},M&&"none"!==M&&{legendHoverBehavior:F.legendState.onLegendHover,legendClickBehavior:F.legendState.onLegendClick,legendHighlightedCategory:F.legendState.highlightedCategory,legendIsolatedCategories:F.legendState.isolatedCategories},{className:s,title:$,description:D,summary:H,accessibleTable:I},null!=o.animate&&{animate:o.animate},T))})}function iu(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,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:j,loadingContent:A,legendInteraction:S,stroke:O,strokeWidth:M,opacity:C}=o,{width:_,height:P,enableHover:L,showLabels:T=!0,title:R,description:B,summary:E,accessibleTable:N}=n,$=$c({nodes:t.useMemo(()=>Rc(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:S,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:r,width:_,height:P,loading:j,loadingContent:A}),D=t.useMemo(()=>new Map,[]),H=t.useMemo(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?be[(e.depth||0)%be.length]:u?ke(e.data||e,u,$.colorScale):La(void 0,$.themeCategorical,d,void 0,D),t},[u,h,$.colorScale,f,$.themeCategorical,d,D]),I=t.useMemo(()=>sl(H,{stroke:O,strokeWidth:M,opacity:C}),[H,O,M,C]),F=t.useMemo(()=>Ec(l),[l]),W=tl({componentName:"CirclePack",data:i});return W?e.jsx(Fa,{componentName:"CirclePack",message:W,width:_,height:P}):$.loadingEl?$.loadingEl:e.jsx(Ga,{componentName:"CirclePack",width:_,height:P,children:e.jsx(Es,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[_,P],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:$.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:F,padding:p,nodeStyle:I,colorBy:u,colorScheme:$.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:kn(y)||void 0,customHoverBehavior:w||v||b?$.customHoverBehavior:void 0,customClickBehavior:v||b?$.customClickBehavior:void 0},S&&"none"!==S&&{legendHoverBehavior:$.legendState.onLegendHover,legendClickBehavior:$.legendState.onLegendClick,legendHighlightedCategory:$.legendState.highlightedCategory,legendIsolatedCategories:$.legendState.isolatedCategories},{className:s,title:R,description:B,summary:E,accessibleTable:N},null!=o.animate&&{animate:o.animate},m))})}tu.displayName="ProcessSankey",ou.displayName="TreeDiagram",nu.displayName="Treemap",iu.displayName="CirclePack";const ru=be;function su(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!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:j,annotations:A,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,title:H,description:I,summary:F,accessibleTable:W}=n,z=$c({nodes:t.useMemo(()=>Rc(i,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:d?void 0:c,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"OrbitDiagram",chartId:C,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:N,height:$,loading:L,loadingContent:T}),Y=t.useMemo(()=>new Map,[]),G=t.useMemo(()=>{if(Array.isArray(u))return u;const e=ye[u];return Array.isArray(e)?e:me},[u]),q=t.useMemo(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=d?n?G[0]:ru[(e.depth||0)%ru.length]:c?ke(e.data||e,c,z.colorScale):La(void 0,z.themeCategorical,u,void 0,Y),o.opacity=n?1:.85,o},[c,d,z.colorScale,G,z.themeCategorical,u,Y]),X=t.useMemo(()=>sl(q,{stroke:R,strokeWidth:B,opacity:E}),[q,R,B,E]),V=t.useMemo(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),U=t.useMemo(()=>{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=t.useMemo(()=>{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]),Q=tl({componentName:"OrbitDiagram",data:i});return Q?e.jsx(Fa,{componentName:"OrbitDiagram",message:Q,width:N,height:$}):z.loadingEl?z.loadingEl:e.jsx(Ga,{componentName:"OrbitDiagram",width:N,height:$,children:e.jsx(Es,Object.assign({chartType:"orbit"},null!=i&&{data:i},{size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:X,edgeStyle:V,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&D,tooltipContent:k?void 0:!1===w?()=>null:kn(w)||void 0,customHoverBehavior:P||O||M?U:void 0,customClickBehavior:O||M?K:void 0,foregroundGraphics:j,annotations:A,className:s,title:H,description:I,summary:F,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=o.animate&&{animate:o.animate},S))})}su.displayName="OrbitDiagram";const au={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"},lu={opacity:.7,marginRight:4};function cu(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function uu(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function du(t={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s;const a=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,l=cu(a,o,"time"),c=cu(a,n,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:au,children:[e.jsxs("div",{children:[e.jsxs("span",{style:lu,children:[i,":"]}),uu(l)]}),e.jsxs("div",{children:[e.jsxs("span",{style:lu,children:[r,":"]}),uu(c)]})]})}}function hu(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 gu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,stroke:w="#007bff",strokeWidth:j=2,strokeDasharray:A,opacity:S,background:O,tooltipContent:M,tooltip:C,onHover:_,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,transition:$,linkedHover:D,selection:H,onObservation:I,chartId:F,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=o,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,K=null!=u?u:[c.width,c.height],Q=null!==(l=null!=M?M:C)&&void 0!==l?l:du({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=Ba({selection:H,linkedHover:D,unwrapData:!0,onObservation:I,chartType:"RealtimeLineChart",chartId:F}),ee=t.useCallback(e=>{_&&_(e),J(e)},[_,J]);t.useImperativeHandle(n,()=>({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=Ua(W,K[0],K[1],z),oe=te?null:Va(y,K[0],K[1],Y),ne={stroke:w,strokeWidth:j,strokeDasharray:A};null!=S&&(ne.opacity=S);const ie=hu(p,y);return te||oe||e.jsx(si,{ref:Z,chartType:"line",runtimeMode:"streaming",size:K,margin:U,className:G?`${h||""} semiotic-emphasis-${G}`.trim():h,arrowOfTime:g,windowMode:f,windowSize:ie,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,lineStyle:ne,showAxes:X,background:O,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,transition:$,pointIdAccessor:o.pointIdAccessor,legendPosition:q})});function fu(e,t,o){const n="function"==typeof t?t(e):e[null!=t?t:o];if(null==n)return null;if(n instanceof Date)return n.getTime();if("string"==typeof n&&""===n.trim())return null;const i=Number(n);return Number.isFinite(i)?i:null}gu.displayName="RealtimeLineChart";const pu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,showAxes:o.showAxes,enableHover:null!=o.enableHover?!!o.enableHover:void 0,linkedHover:o.linkedHover}),{binSize:u,size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y,data:m,timeAccessor:v,valueAccessor:b,direction:x="up",timeExtent:k,valueExtent:w,extentPadding:j,categoryAccessor:A,colors:S,fill:O,stroke:M,strokeWidth:C,opacity:_,gap:P,background:L,tooltipContent:T,tooltip:R,onHover:B,annotations:E,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:D,linkedHover:H,selection:I,decay:F,pulse:W,staleness:z,transition:Y,onObservation:G,chartId:q,loading:X,loadingContent:V,emptyContent:U,emphasis:K,legendPosition:Q,brush:Z,onBrush:J,linkedBrush:ee}=o,te=c.showAxes,oe=c.enableHover,ne=null!=h?h:c.marginDefaults,ie=null!=d?d:[c.width,c.height],re=null!==(l=null!=T?T:R)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n}=t;return t=>{var i;const r=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null;if(null==(null==r?void 0:r.binStart)||null==(null==r?void 0:r.binEnd)){const t=cu(r,o,"time"),i=cu(r,n,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:au,children:[e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"x:"}),uu(t)]}),e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"y:"}),uu(i)]})]})}return e.jsxs("div",{className:"semiotic-tooltip",style:au,children:[e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"range:"}),uu(r.binStart),"–",uu(r.binEnd)]}),null!=r.total&&e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"count:"}),uu(r.total)]}),null!=r.category&&e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"category:"}),uu(r.category)]})]})}}({timeAccessor:v,valueAccessor:b}),se=t.useRef(null),{customHoverBehavior:ae}=Ba({selection:I,linkedHover:H,unwrapData:!0,onObservation:G,chartType:"RealtimeHistogram",chartId:q}),le=t.useCallback(e=>{B&&B(e),ae(e)},[B,ae]),ce=!0===Z?{dimension:"x",snap:"bin"}:"x"===Z?{dimension:"x"}:"object"==typeof Z?Z:void 0,ue=ma(ee),de=ra(Object.assign({name:(null==ue?void 0:ue.name)||"__unused_hist_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof v?v:"time")},(null==ue?void 0:ue.yField)?{yField:ue.yField}:{})),he=t.useRef(de.brushInteraction);he.current=de.brushInteraction;const ge=t.useCallback(e=>{if(J&&J(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:q}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:q}),ue){const t=he.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)}},[J,G,q,ue]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=se.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=se.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=se.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const fe=Ua(X,ie[0],ie[1],V),pe=fe?null:Va(m,ie[0],ie[1],U),ye={};null!=O&&(ye.fill=O),null!=M&&(ye.stroke=M),null!=C&&(ye.strokeWidth=C),null!=_&&(ye.opacity=_),null!=P&&(ye.gap=P);const me=K?`${g||""} semiotic-emphasis-${K}`.trim():g,ve=hu(y,m),be=t.useMemo(()=>"down"!==x?w:function({data:e,valueAccessor:t,timeAccessor:o,binSize:n,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=fu(i,o,"time"),r=fu(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/n)*n;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:m,valueAccessor:b,timeAccessor:v,binSize:u,valueExtent:w,extentPadding:j}),[x,m,b,v,u,w,j]);return fe||pe||e.jsx(si,{ref:se,chartType:"bar",runtimeMode:"streaming",size:ie,margin:ne,className:me,arrowOfTime:f,windowMode:p,windowSize:ve,data:m,timeAccessor:v,valueAccessor:b,xExtent:k,yExtent:be,extentPadding:j,binSize:u,categoryAccessor:A,barColors:S,barStyle:ye,showAxes:te,background:L,hoverAnnotation:oe,tooltipContent:re,customHoverBehavior:le,annotations:E,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:D,decay:F,pulse:W,staleness:z,transition:Y,pointIdAccessor:o.pointIdAccessor,legendPosition:Q,brush:ce||(ee?{dimension:"x"}:void 0),onBrush:ce||ee?ge:void 0})});function yu(t){return e.jsx(pu,Object.assign({},t,{windowMode:"growing"}))}pu.displayName="RealtimeHistogram",yu.displayName="TemporalHistogram";const mu=pu,vu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,categoryAccessor:w,colors:j,radius:A,fill:S,opacity:O,stroke:M,strokeWidth:C,background:_,tooltipContent:P,tooltip:L,onHover:T,annotations:R,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:N,linkedHover:$,selection:D,onObservation:H,chartId:I,loading:F,loadingContent:W,emptyContent:z,emphasis:Y,legendPosition:G}=o,q=c.showAxes,X=c.enableHover,V=null!=d?d:c.marginDefaults,U=null!=u?u:[c.width,c.height],K=null!==(l=null!=P?P:L)&&void 0!==l?l:du({timeAccessor:m,valueAccessor:v}),Q=t.useRef(null),{customHoverBehavior:Z}=Ba({selection:D,linkedHover:$,unwrapData:!0,onObservation:H,chartType:"RealtimeSwarmChart",chartId:I}),J=t.useCallback(e=>{T&&T(e),Z(e)},[T,Z]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Q.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ee=Ua(F,U[0],U[1],W),te=ee?null:Va(y,U[0],U[1],z),oe={};null!=A&&(oe.radius=A),null!=S&&(oe.fill=S),null!=O&&(oe.opacity=O),null!=M&&(oe.stroke=M),null!=C&&(oe.strokeWidth=C);const ne=Y?`${h||""} semiotic-emphasis-${Y}`.trim():h,ie=hu(p,y);return ee||te||e.jsx(si,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:ne,arrowOfTime:g,windowMode:f,windowSize:ie,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,categoryAccessor:w,barColors:j,swarmStyle:oe,showAxes:q,background:_,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:R,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:N,legendPosition:G,pointIdAccessor:o.pointIdAccessor})});vu.displayName="RealtimeSwarmChart";const bu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,positiveColor:w,negativeColor:j,connectorStroke:A,connectorWidth:S,gap:O,stroke:M,strokeWidth:C,opacity:_,background:P,tooltipContent:L,tooltip:T,onHover:R,annotations:B,svgAnnotationRules:E,tickFormatTime:N,tickFormatValue:$,linkedHover:D,selection:H,onObservation:I,chartId:F,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=o,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,K=null!=u?u:[c.width,c.height],Q=null!==(l=null!=L?L:T)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n}=t;return t=>{var i,r;const s=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null,a=cu(s,o,"time"),l=null!==(r=null==s?void 0:s.delta)&&void 0!==r?r:cu(s,n,"value"),c=null==s?void 0:s.cumEnd,u="number"==typeof l?0>l?uu(l):"+"+uu(l):uu(l);return e.jsxs("div",{className:"semiotic-tooltip",style:au,children:[e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"x:"}),uu(a)]}),e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"Δ:"}),u]}),null!=c&&e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"total:"}),uu(c)]})]})}}({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=Ba({selection:H,linkedHover:D,unwrapData:!0,onObservation:I,chartType:"RealtimeWaterfallChart",chartId:F}),ee=t.useCallback(e=>{R&&R(e),J(e)},[R,J]);t.useImperativeHandle(n,()=>({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=Ua(W,K[0],K[1],z),oe=te?null:Va(y,K[0],K[1],Y),ne={};null!=w&&(ne.positiveColor=w),null!=j&&(ne.negativeColor=j),null!=A&&(ne.connectorStroke=A),null!=S&&(ne.connectorWidth=S),null!=O&&(ne.gap=O),null!=M&&(ne.stroke=M),null!=C&&(ne.strokeWidth=C),null!=_&&(ne.opacity=_);const ie=G?`${h||""} semiotic-emphasis-${G}`.trim():h,re=hu(p,y);return te||oe||e.jsx(si,{ref:Z,chartType:"waterfall",runtimeMode:"streaming",size:K,margin:U,className:ie,arrowOfTime:g,windowMode:f,windowSize:re,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,waterfallStyle:ne,showAxes:X,background:P,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:B,svgAnnotationRules:E,tickFormatTime:N,tickFormatValue:$,legendPosition:q,pointIdAccessor:o.pointIdAccessor})});bu.displayName="RealtimeWaterfallChart";const xu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,heatmapXBins:j=20,heatmapYBins:A=20,aggregation:S="count",background:O,tooltipContent:M,tooltip:C,onHover:_,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,linkedHover:$,selection:D,onObservation:H,chartId:I,loading:F,loadingContent:W,emptyContent:z,emphasis:Y,legendPosition:G}=o,q=c.showAxes,X=c.enableHover,V=null!=d?d:c.marginDefaults,U=null!=u?u:[c.width,c.height],K=null!==(l=null!=M?M:C)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s,a,l,c;const u=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,d=null!==(a=null==u?void 0:u.xCenter)&&void 0!==a?a:cu(u,o,"time"),h=null!==(l=null==u?void 0:u.yCenter)&&void 0!==l?l:cu(u,n,"value"),g=null==u?void 0:u.count,f=null==u?void 0:u.sum,p=null==u?void 0:u.value,y=null!==(c=null==u?void 0:u.agg)&&void 0!==c?c:"count";return e.jsxs("div",{className:"semiotic-tooltip",style:au,children:[e.jsxs("div",{children:[e.jsxs("span",{style:lu,children:[i,":"]}),uu(d)]}),e.jsxs("div",{children:[e.jsxs("span",{style:lu,children:[r,":"]}),uu(h)]}),null!=g&&e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"count:"}),uu(g)]}),"sum"===y&&null!=f&&e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"sum:"}),uu(f)]}),"mean"===y&&null!=p&&e.jsxs("div",{children:[e.jsx("span",{style:lu,children:"mean:"}),uu(p)]})]})}}({timeAccessor:m,valueAccessor:v}),Q=t.useRef(null),{customHoverBehavior:Z}=Ba({selection:D,linkedHover:$,unwrapData:!0,onObservation:H,chartType:"RealtimeHeatmap",chartId:I}),J=t.useCallback(e=>{_&&_(e),Z(e)},[_,Z]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Q.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ee=Ua(F,U[0],U[1],W),te=ee?null:Va(y,U[0],U[1],z),oe=Y?`${h||""} semiotic-emphasis-${Y}`.trim():h,ne=hu(p,y);return ee||te||e.jsx(si,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:oe,arrowOfTime:g,windowMode:f,windowSize:ne,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,xExtent:x,yExtent:k,extentPadding:w,heatmapXBins:j,heatmapYBins:A,heatmapAggregation:S,showAxes:q,background:O,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,legendPosition:G,pointIdAccessor:o.pointIdAccessor})});xu.displayName="RealtimeHeatmap";const ku=864e5;function wu(e){return 10>e?"0"+e:e+""}const ju=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Au(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)*(1-t)),i=Math.round(parseInt(o[2],16)*(1-t)),r=Math.round(parseInt(o[3],16)*(1-t));return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Su(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),i=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),r=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Ou(e,t){return dl(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"),Mu(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);Cu(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 u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{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?(Cu(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 Mu(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++)Mu(n[e],i[e])}function Cu(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 _u={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"}},Pu={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Lu={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Tu=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Ru=["vertical","horizontal"],Bu={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_u),Pu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tu},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({},_u),Pu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tu},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({},_u),Pu),{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:Tu},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({},_u),Pu),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tu},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({},_u),Pu),{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({},_u),Pu),{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({},_u),Pu),{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({},_u),Pu),{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({},_u),Pu),{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({},_u),Pu),{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({},_u),Pu),{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({},_u),Lu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ru},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({},_u),Lu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ru},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({},_u),Lu),{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:Ru},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_u),Lu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ru},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({},_u),Lu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ru},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({},_u),Lu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ru},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_u),Lu),{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({},_u),Lu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ru},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({},_u),Lu),{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({},_u),Lu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ru},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({},_u),{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({},_u),{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({},_u),{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({},_u),Lu),{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({},_u),Lu),{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({},_u),{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({},_u),{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:Ru},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({},_u),{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({},_u),{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({},_u),{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({},_u),{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({},_u),{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({},_u),{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({},_u),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},_u),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},_u),{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({},_u),{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({},_u),{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({},_u),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}},Eu=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"]),Nu=new Set(["data","nodes","edges"]),$u="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Du(e){return dl(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?Hu(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 Hu(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 Iu(e){return"nominal"===e||"ordinal"===e}function Fu(e){return"quantitative"===e||"temporal"===e}const Wu={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"},zu={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"},Yu={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Gu(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 qu(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}function Xu(){const t=function(){const e=p.useContext(Wo);return e?()=>e.setVisible(e=>!e):null}();return t?e.jsx("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:Zu,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const Vu={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 Uu({height:t}){return e.jsx("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 Ku({error:t}){return e.jsx("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e.jsx("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const Qu=p.forwardRef(function({title:t,subtitle:o,children:n,width:i="100%",height:r=400,actions:s,chartConfig:a,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:f,style:y},m){const v=p.useRef(null),b=p.useRef(null),[x,k]=p.useState(!1),w=!1!==(null==s?void 0:s.export)&&void 0!==(null==s?void 0:s.export),j=!1!==(null==s?void 0:s.fullscreen)&&void 0!==(null==s?void 0:s.fullscreen),A=!1!==(null==s?void 0:s.copyConfig)&&void 0!==(null==s?void 0:s.copyConfig)&&a,S=!0===(null==s?void 0:s.dataSummary),O="object"==typeof(null==s?void 0:s.export)?s.export:{},M="object"==typeof(null==s?void 0:s.copyConfig)?s.copyConfig.format:"json",C=p.useCallback(e=>dl(this,void 0,void 0,function*(){b.current&&(yield Ou(b.current,Object.assign(Object.assign({},O),e)))}),[O]),_=p.useCallback(()=>{v.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):v.current.requestFullscreen().catch(()=>{}))},[]),P=p.useCallback(e=>dl(this,void 0,void 0,function*(){a&&(yield Du(a,e||M||"json"))}),[a,M]);p.useEffect(()=>{const e=()=>{k(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),p.useImperativeHandle(m,()=>({export:C,toggleFullscreen:_,copyConfig:P,element:v.current}),[C,_,P]);const L=t||o||l||w||j||A||S||h,T=c?e.jsx(Uu,{height:r}):u?e.jsx(Ku,{error:u}):d?e.jsx(Wa,{children:n}):n;return R=e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.jsxs("div",{ref:v,className:"semiotic-chart-container"+(f?" "+f:""),style:Object.assign(Object.assign({width:i,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"},x?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),y),children:[L&&e.jsxs("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:[e.jsxs("div",{className:"semiotic-chart-title-area",children:[t&&e.jsx("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:t}),o&&e.jsx("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0},children:o})]}),e.jsxs("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[l,w&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>C(),title:"Export chart","aria-label":"Export chart",style:Zu,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.jsx("path",{d:"M2 12h10"})]})}),S&&e.jsx(Xu,{}),j&&e.jsx("button",{className:"semiotic-chart-action",onClick:_,title:x?"Exit fullscreen":"Fullscreen","aria-label":x?"Exit fullscreen":"Enter fullscreen",style:Zu,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsxs(e.Fragment,x?{children:[e.jsx("path",{d:"M9 1v4h4"}),e.jsx("path",{d:"M5 13V9H1"}),e.jsx("path",{d:"M13 5H9V1"}),e.jsx("path",{d:"M1 9h4v4"})]}:{children:[e.jsx("path",{d:"M1 5V1h4"}),e.jsx("path",{d:"M13 9v4H9"}),e.jsx("path",{d:"M9 1h4v4"}),e.jsx("path",{d:"M5 13H1V9"})]})})}),A&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Copy config","aria-label":"Copy chart configuration",style:Zu,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.jsx("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),h&&e.jsx("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:Vu[h].bg,color:Vu[h].color,lineHeight:"18px"},children:h})]})]}),e.jsxs("div",{className:"semiotic-chart-body",ref:b,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},x?{flex:1}:{height:r}),children:[T,g]})]})]}),S?e.jsx(zo,{children:R}):R;var R}),Zu={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 Ju({children:t,columns:o="auto",minCellWidth:n=300,gap:i=16,className:r,style:s}){const a="number"==typeof o?o:void 0;return e.jsx("div",{className:"semiotic-chart-grid"+(r?" "+r:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${n}px, 1fr))`:`repeat(${o}, 1fr)`,gap:i,width:"100%"},s),children:p.Children.map(t,t=>p.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==a&&2>a?t:e.jsx("div",{style:{gridColumn:"span 2"},children:t}):t)})}function ed({children:t,context:o,position:n="right",contextSize:i=250,gap:r=12,className:s,style:a}){const l="left"===n||"right"===n,c="left"===n||"top"===n,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:r,width:"100%"},a),d=l?{flex:`0 0 ${i}px`,width:i,minHeight:0}:{flex:`0 0 ${i}px`,height:i,minWidth:0};return e.jsxs("div",{className:"semiotic-context-layout"+(s?" "+s:""),style:u,children:[e.jsx("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:t}),e.jsx("div",{style:d,children:o})]})}Ju.displayName="ChartGrid",ed.displayName="ContextLayout";function td({children:o,position:n="right",size:i=300,trigger:r="click",chartId:s,observation:a,dismissOnEmpty:l=!0,showClose:c=!0,onToggle:u,className:d,style:h}){const[g,f]=t.useState(null),[p,y]=t.useState(null),[m,v]=t.useState(!1),[b,x]=t.useState(!1),k=t.useRef(null),w=t.useRef(void 0),j="click"===r?["click","click-end"]:["hover","hover-end"],{latest:A}=sa({types:j,chartId:s,limit:1}),S=void 0!==a?a:A;t.useEffect(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;f(e.datum),y(e),m||(v(!0),x(!0),clearTimeout(w.current),w.current=setTimeout(()=>x(!1),200))}else!l||"click-end"!==S.type&&"hover-end"!==S.type||O()},[S]),t.useEffect(()=>{null==u||u(m)},[m,u]);const O=t.useCallback(()=>{x(!0),v(!1),clearTimeout(w.current),w.current=setTimeout(()=>{x(!1),f(null),y(null)},200)},[]);if(t.useEffect(()=>()=>clearTimeout(w.current),[]),!g&&!b)return null;const M=g&&p?o(g,p):null;if(null===M&&!b)return null;const C=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,i,m,b);return e.jsxs("div",{ref:k,className:`semiotic-details-panel semiotic-details-${n}${d?" "+d:""}`,style:Object.assign(Object.assign({},C),h),children:[c&&e.jsx("button",{className:"semiotic-details-close",onClick:O,"aria-label":"Close details",style:od,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e.jsx("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e.jsx("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:M})]})}const od={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};td.displayName="DetailsPanel";const nd="__forecastSegment";function id(e,t){return"function"==typeof t?t(e):!!e[t]}const rd=Object.freeze({__proto__:null,SEGMENT_FIELD:nd,buildAnomalyAnnotations:function(e){var t,o,n;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(o=e.bandOpacity)&&void 0!==o?o:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(n=e.anomalyRadius)&&void 0!==n?n:6,label:e.label}]},buildForecast:function(e,t,o,n,i){return(r=n).isTraining||r.isForecast||r.isAnomaly||r.upperBounds||r.lowerBounds?function(e,t,o,n,i){var r,s,a,l;const{isTraining:c,isForecast:u,isAnomaly:d,upperBounds:h,lowerBounds:g,color:f="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=n,b=e.map(e=>{let t="observed";return u&&id(e,u)?t="forecast":c&&id(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[nd]:t})}),x=n._groupBy,k=[];if(x){const e=new Map;for(const t of b){const o=null!==(r=t[x])&&void 0!==r?r:"__default";e.has(o)||e.set(o,[]),e.get(o).push(t)}const t=[];for(const[,o]of e)for(let e=0;o.length-1>e;e++)o[e][nd]!==o[e+1][nd]&&(t.push(Object.assign(Object.assign({},o[e+1]),{[nd]:o[e][nd]})),t.push(Object.assign(Object.assign({},o[e]),{[nd]:o[e+1][nd]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][nd]!==b[e+1][nd]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[nd]:b[e][nd]})),k.push(Object.assign(Object.assign({},b[e]),{[nd]:b[e+1][nd]})));if(n.trainUnderline){const e=[];for(const t of k)"training"===t[nd]&&e.push(Object.assign(Object.assign({},t),{[nd]:"training-base"}));k.unshift(...e)}const w=[];if(h&&g){const e="string"==typeof h?h:"__envUpper",t="string"==typeof g?g:"__envLower";if("function"==typeof h||"function"==typeof g)for(const o of k)"function"==typeof h&&(o[e]=h(o)),"function"==typeof g&&(o[t]=g(o));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:f,fillOpacity:p,label:v})}if(d){const e=n.anomalyStyle,t={type:"highlight",filter:e=>id(e,d)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(a=i.bandOpacity)&&void 0!==a?a:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,n,i):function(e,t,o,n,i){var r,s,a;const{trainEnd:l,steps:c=10,confidence:u=.95,color:d="#6366f1",bandOpacity:h=.15,label:g}=n;if(null==l)return{processedData:e,annotations:[]};const f=[],p=[];for(const o of e)o[t]>l?p.push(Object.assign(Object.assign({},o),{[nd]:"observed"})):f.push(Object.assign(Object.assign({},o),{[nd]:"training"}));const y=f.map(e=>[e[t],e[o]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const n=y.length;let i=0,r=0,s=0,a=0;for(const[e,t]of y)i+=e,r+=t,s+=e*e,a+=e*t;const l=n*s-i*i;if(Math.abs(l)>1e-12){const s=(n*a-i*r)/l,f=(r-s*i)/n,p=e=>f+s*e,b=y.map(([e,t])=>t-p(e)).reduce((e,t)=>e+t*t,0),x=Math.sqrt(b/Math.max(n-2,1)),k=y.reduce((e,t)=>e+t[0],0)/n,w=y.reduce((e,t)=>e+Math.pow(t[0]-k,2),0),j=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,A=e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e)),S=Math.max(...A),O=y.length>1?(y[n-1][0]-y[0][0])/(n-1):1;for(let e=1;c>=e;e++){const i=S+e*O,r=p(i),s=x*Math.sqrt(1+1/n+(w>0?Math.pow(i-k,2)/w:0))*j;v.push({[t]:i,[o]:r,[nd]:"forecast",__forecastUpper:r+s,__forecastLower:r-s})}m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:d,fillOpacity:h,label:g})}}m.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(s=i.bandOpacity)&&void 0!==s?s:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label});const b=[];if(b.push(...f),f.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},f[f.length-1]),{[nd]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:f[f.length-1];e&&b.push(Object.assign(Object.assign({},e),{[nd]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,o,n,i);var r},createSegmentLineStyle:function(e,t){var o,n;const i=null!==(o=t.trainDasharray)&&void 0!==o?o:"8,4",r=null!==(n=t.forecastDasharray)&&void 0!==n?n:"4,4",s=t.color||"#6366f1",a=t.trainOpacity,l=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,d=t.trainUnderline;return t=>{const o=e(t),n=t[nd];if("training"===n){let e=o.stroke;return"darken"===c?e=Au(o.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},o),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=a&&{strokeOpacity:a})}if("training-base"===n){let e=o.stroke||"#666";return"lighten"===d&&(e=Su(e,.4)),Object.assign(Object.assign({},o),{stroke:e,strokeDasharray:void 0})}return"forecast"===n?Object.assign(Object.assign(Object.assign({},o),{stroke:s,strokeDasharray:r}),null!=l&&{strokeOpacity:l}):o}},darkenColor:Au,lightenColor:Su});exports.AreaChart=Sl,exports.BarChart=oc,exports.BoxPlot=yc,exports.BubbleChart=Pl,exports.CARBON_ALERT={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},exports.CARBON_CATEGORICAL_14=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],exports.COLOR_BLIND_SAFE_CATEGORICAL=M,exports.CandlestickChart=Vl,exports.CategoryColorProvider=Xs,exports.ChartContainer=Qu,exports.ChartErrorBoundary=Wa,exports.ChartGrid=Ju,exports.ChordDiagram=Hc,exports.CirclePack=iu,exports.ConnectedScatterplot=xl,exports.ContextLayout=ed,exports.DARK_THEME=_,exports.DetailsPanel=td,exports.DifferenceChart=Ml,exports.DonutChart=jc,exports.DotPlot=kc,exports.ForceDirectedGraph=Dc,exports.FunnelChart=xc,exports.GaugeChart=Pc,exports.GroupedBarChart=Lc,exports.HIGH_CONTRAST_THEME=P,exports.Heatmap=_l,exports.Histogram=mc,exports.IncrementalExtent=E,exports.LIGHT_THEME=C,exports.LikertChart=hc,exports.LineChart=wl,exports.LinkedCharts=pa,exports.MinimapChart=Il,exports.MultiAxisLineChart=ql,exports.MultiLineTooltip=function(t={}){const{fields:o=[],title:n,format:i,style:r={},className:s="",showLabels:a=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(n){const e=mn(t,n);c.push({value:vn(e,i)})}o&&Array.isArray(o)&&o.length>0?o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=vn(mn(t,n),r);c.push({label:a?o:void 0,value:s})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:a?e:void 0,value:vn(t[e],i)})});const u=Object.assign(Object.assign({},yn),r);return Array.isArray(c)&&0!==c.length?e.jsx("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:u,children:c.map((t,o)=>e.jsxs("div",{style:{marginBottom:c.length-1>o?"4px":0},children:[t.label&&e.jsxs("strong",{children:[t.label,l]}),t.value]},o))}):null}},exports.NetworkCustomChart=Zl,exports.OrbitDiagram=su,exports.OrdinalCustomChart=Jl,exports.PieChart=wc,exports.ProcessSankey=tu,exports.QuadrantChart=Fl,exports.RealtimeHeatmap=xu,exports.RealtimeHistogram=pu,exports.RealtimeLineChart=gu,exports.RealtimeSwarmChart=vu,exports.RealtimeTemporalHistogram=mu,exports.RealtimeWaterfallChart=bu,exports.RidgelinePlot=bc,exports.RingBuffer=B,exports.SankeyDiagram=Ic,exports.Scatterplot=vl,exports.ScatterplotMatrix=Dl,exports.StackedAreaChart=Cl,exports.StackedBarChart=nc,exports.StreamNetworkFrame=Es,exports.StreamOrdinalFrame=Yi,exports.StreamXYFrame=si,exports.SwarmPlot=fc,exports.SwimlaneChart=Tc,exports.THEME_PRESETS=ba,exports.TemporalHistogram=yu,exports.ThemeProvider=function({theme:t,children:o}){const n="string"==typeof t&&xa(t)?t:void 0,i=p.useMemo(()=>function(e){return void 0!==e?L(C,ja(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?P:C}(t),[t]);return e.jsx(T,{initialState:{theme:i},children:e.jsxs(ka.Provider,{value:n,children:[e.jsx(Aa,{theme:t}),e.jsx(Sa,{children:o})]})})},exports.Tooltip=bn,exports.TreeDiagram=ou,exports.Treemap=nu,exports.ViolinPlot=vc,exports.XYCustomChart=Ql,exports.adaptiveTimeTicks=function(e){let t,o=e;return(n,i,r)=>{const s=n instanceof Date?n:new Date(n);e||!r||2>r.length||r===t||(t=r,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 12e4>o?"seconds":72e5>o?"minutes":2*ku>o?"hours":60*ku>o?"days":400*ku>o?"months":"years"}(r));const a=o||"days";return null!=i&&0!==i&&r&&0!==r.length?function(e,t,o){const n=e.getUTCFullYear()!==t.getUTCFullYear(),i=n||e.getUTCMonth()!==t.getUTCMonth(),r=i||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=ju[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=wu(e.getUTCHours()),h=wu(e.getUTCMinutes()),g=wu(e.getUTCSeconds());switch(o){case"seconds":return n?`${l} ${c}, ${u} ${d}:${h}:${g}`:r?`${l} ${c} ${d}:${h}:${g}`:s?`${d}:${h}:${g}`:a?`${h}:${g}`:":"+g;case"minutes":return n?`${l} ${c}, ${u} ${d}:${h}`:r?`${l} ${c} ${d}:${h}`:s?`${d}:${h}`:":"+h;case"hours":return n?`${l} ${c}, ${u} ${d}:00`:i?`${l} ${c} ${d}:${h}`:r?`${l} ${c} ${d}:00`:d+":00";case"days":return n?`${l} ${c}, ${u}`:i?`${l} ${c}`:""+c;case"months":return n?`${l} ${u}`:""+l;case"years":return""+u}}(s,new Date(r[i-1]),a):function(e,t){const o=ju[e.getUTCMonth()],n=e.getUTCDate(),i=e.getUTCFullYear(),r=wu(e.getUTCHours()),s=wu(e.getUTCMinutes()),a=wu(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${n}, ${i} ${r}:${s}:${a}`;case"minutes":case"hours":return`${o} ${n}, ${i} ${r}:${s}`;case"days":return`${o} ${n}, ${i}`;case"months":return`${o} ${i}`;case"years":return""+i}}(s,a)}},exports.configToJSX=Hu,exports.copyConfig=Du,exports.createHatchPattern=Ri,exports.darkenColor=Au,exports.deserializeSelections=function(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},exports.exportChart=Ou,exports.fromConfig=function(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Bu[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)}},exports.fromURL=function(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)},exports.fromVegaLite=function(e){var t,o,n,i,r,s,a,l,c,u,d,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:ul(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 j;(null===(t=e.data)||void 0===t?void 0:t.values)?j=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.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 A={};e.width&&(A.width=e.width),e.height&&(A.height=e.height);const S=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(S&&(A.title=S),(null==b?void 0:b.field)&&(A.colorBy=b.field,null===(n=b.scale)||void 0===n?void 0:n.scheme)){const e=Wu[b.scale.scheme];e&&(A.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(A.pointOpacity=w.value);const O=null==m?void 0:m.aggregate,M=null==v?void 0:v.aggregate;if(j&&(O||M)){const e=M?v:m,t=M?m:v,o=Yu[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)j=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}(j,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&j){const e=new Map;for(const o of j){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}j=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";j&&(A.data=j),(null==m?void 0:m.bin)?(A.valueAccessor=m.field,(null==v?void 0:v.field)&&(A.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(A.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(A.valueAccessor=v.field,(null==m?void 0:m.field)&&(A.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(A.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),o="object"==typeof t?t.maxbins:void 0;return o&&(A.bins=o),qu(e,A,g)}let C;switch(f){case"bar":C=function(e,t,o,n,i,r,s){var a,l,c,u,d,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",Iu(null==e?void 0:e.type)&&Fu(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)):Fu(null==e?void 0:e.type)&&Iu(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===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.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===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.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}(m,v,b,A,j,O,M);break;case"line":if(C="LineChart",Gu(m,v,A,O,M),(null==b?void 0:b.field)&&(A.lineBy=b.field),p.interpolate){const e=zu[p.interpolate];e&&(A.curve=e)}!0===p.point&&(A.showPoints=!0),j&&(A.data=j);break;case"area":if((null==b?void 0:b.field)?(C="StackedAreaChart",A.areaBy=b.field):C="AreaChart",Gu(m,v,A,O,M),p.interpolate){const e=zu[p.interpolate];e&&(A.curve=e)}void 0!==p.opacity&&(A.areaOpacity=p.opacity),j&&(A.data=j);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(C="BubbleChart",A.sizeBy=x.field,(null===(s=x.scale)||void 0===s?void 0:s.range)&&(A.sizeRange=x.scale.range)):C="Scatterplot",Gu(m,v,A,O,M),j&&(A.data=j);break;case"rect":C="Heatmap",(null==m?void 0:m.field)&&(A.xAccessor=m.field),(null==v?void 0:v.field)&&(A.yAccessor=v.field),(null==b?void 0:b.field)&&(A.valueAccessor=b.field,delete A.colorBy),(null===(a=null==m?void 0:m.axis)||void 0===a?void 0:a.title)&&(A.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(A.yLabel=v.axis.title),j&&(A.data=j);break;case"arc":p.innerRadius&&p.innerRadius>0?(C="DonutChart",A.innerRadius=p.innerRadius):C="PieChart",(null==k?void 0:k.field)?A.valueAccessor=k.field:(null==v?void 0:v.field)&&(A.valueAccessor=M?"value":v.field),(null==b?void 0:b.field)&&(A.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(A.categoryAccessor=m.field),j&&(A.data=j);break;case"tick":C="DotPlot",Iu(null==m?void 0:m.type)?(A.categoryAccessor=m.field,(null==v?void 0:v.field)&&(A.valueAccessor=M?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(A.categoryLabel=m.axis.title),(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(A.valueLabel=v.axis.title)):Iu(null==v?void 0:v.type)?(A.categoryAccessor=v.field,(null==m?void 0:m.field)&&(A.valueAccessor=O?"value":m.field),A.orientation="horizontal",(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(A.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(A.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(A.categoryAccessor=m.field),(null==v?void 0:v.field)&&(A.valueAccessor=M?"value":v.field)),j&&(A.data=j);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),C="Scatterplot",Gu(m,v,A,O,M),j&&(A.data=j)}return qu(C,A,g)},exports.lightenColor=Su,exports.normalizeTooltip=kn,exports.resolveThemePreset=xa,exports.serializeSelections=function(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},exports.smartTickFormat=function(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"},exports.themeToCSS=function(e,t=":root"){var o,n,i,r,s;const a=[];return a.push(` --semiotic-bg: ${e.colors.background};`),a.push(` --semiotic-text: ${e.colors.text};`),a.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),a.push(` --semiotic-grid: ${e.colors.grid};`),a.push(` --semiotic-border: ${e.colors.border};`),a.push(` --semiotic-primary: ${e.colors.primary};`),a.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&a.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&a.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&a.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&a.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(o=e.tooltip)||void 0===o?void 0:o.background)&&a.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(n=e.tooltip)||void 0===n?void 0:n.text)&&a.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&a.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&a.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(s=e.tooltip)||void 0===s?void 0:s.shadow)&&a.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&a.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&a.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&a.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&a.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&a.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&a.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&a.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),a.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),a.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&a.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&a.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&a.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&a.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&a.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${a.join("\n")}\n}`},exports.themeToTokens=function(e){var t,o,n,i,r,s;return{semiotic:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.text)||e.colors.text,$type:"color"},radius:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(s=e.colors.selectionOpacity)&&void 0!==s?s:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{}),null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{}),null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{}),{secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"}}),e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{}),e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{}),e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{}),e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{}),e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{})}},exports.toConfig=function(e,t,o){if(!Bu[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Bu).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(Eu.has(e)||!n&&Nu.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=$u(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})},exports.toURL=function(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},exports.useBrushSelection=ra,exports.useCategoryColors=Vs,exports.useChartObserver=sa,exports.useFilteredData=function(e,o,n){const i=Js(e=>e.selections.get(o));return t.useMemo(()=>{if(!i||0===i.clauses.size)return e;const t=Ks(i,n);return e.filter(t)},[e,i,n])},exports.useLinkedHover=na,exports.useSelection=oa,exports.useTheme=Oa;
2
+ "use strict";const e=require("react/jsx-runtime"),t=require("react"),o=require("d3-selection"),n=require("d3-brush"),i=require("d3-scale"),r=require("d3-quadtree"),s=require("d3-shape"),a=require("d3-array"),l=require("d3-hierarchy"),c=require("regression"),u=require("d3-interpolate"),d=require("d3-force"),h=require("d3-chord");function g(e){return e&&e.__esModule?e:{default:e}}function f(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const o in e)if("default"!==o){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}return t.default=e,Object.freeze(t)}const p=f(t),y=g(c);function m(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 v(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 b({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:y}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(d);k.current=d;const w=t.useRef(u);w.current=u;const j=t.useMemo(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),A=t.useRef(j);A.current=j;const S=t.useRef(!1),O=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=o.select(b.current).select(".brush-g"),t="x"===c?n.brushX():"y"===c?n.brushY():n.brush();return t.extent([[0,0],[i,r]]),t.on("brush end",o=>{if(S.current)return;const n=w.current;if(!n)return;if(!o.selection)return O.current=null,void k.current(null);let s,a;if("x"===c){const[e,t]=o.selection;s=[n.x.invert(e),n.x.invert(t)],a=[n.y.invert(r),n.y.invert(0)]}else if("y"===c){const[e,t]=o.selection;s=[n.x.invert(0),n.x.invert(i)],a=[n.y.invert(t),n.y.invert(e)]}else{const[[e,t],[i,r]]=o.selection;s=[n.x.invert(e),n.x.invert(i)],a=[n.y.invert(r),n.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===o.type||"brush"===o.type&&p)){const i=A.current;i&&i.length>0?s=function(e,t){return 0===t.length?e:[m(e[0],t),v(e[1],t)]}(s,i):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const r=n.x(s[0]),a=n.x(s[1]);if(S.current=!0,"x"===c)e.call(t.move,[r,a]);else if("xy"===c){const n=o.selection;e.call(t.move,[[r,n[0][1]],[a,n[1][1]]])}S.current=!1}const l={x:s,y:a};O.current=l,k.current(l)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,r,c,g,h,p]),t.useEffect(()=>{if(!(y&&u&&x.current&&O.current))return;if(!b.current)return;if("y"===c)return;const e=O.current,t=u.x.domain()[0],n=o.select(b.current).select(".brush-g");if(t>=e.x[1])return S.current=!0,n.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);let i=e.x[0],r=!1;if(t>e.x[0]){if(i=t,"bin"===g){const e=A.current;e&&e.length>0?i=v(t,e):h&&h>0&&(i=Math.ceil(t/h)*h)}if(i>=e.x[1])return S.current=!0,n.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);r=!0}const s=u.x(i),a=u.x(e.x[1]);if(S.current=!0,"x"===c)n.call(x.current.move,[s,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(x.current.move,[[s,t],[a,o]])}if(S.current=!1,r){const t={x:[i,e.x[1]],y:e.y};O.current=t,k.current(t)}},[u,y,c,g,h]),e.jsx("svg",{ref:b,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}const x=Object.freeze([]);function k(e){if(!e)return x;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class w{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=k(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=k(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 j(o){let n=null;const i=()=>(n||(n=t.createContext(null)),n),r=A(o);return[function({children:n,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>A(o,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:n})},e=>{var o;const n=i(),s=null!==(o=t.useContext(n))&&void 0!==o?o:r,a=t.useRef(e);a.current=e;const l=t.useCallback(()=>a.current(s.getState()),[s]),c=t.useCallback(()=>a.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,l,c)}]}function A(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 S(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 O(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:M})})),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 M=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],C={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}},_={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}},P={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:M,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 L(e,t){if("light"===t)return C;if("dark"===t)return _;if("high-contrast"===t)return P;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?_:C;return O(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 O(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[T,R]=j(e=>({theme:C,setTheme(t){e(e=>({theme:L(e.theme,t)}))}}));class B{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 E{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function N(e,t,o,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 $(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 D(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),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function H(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,u=0;for(const e of t){const t=o(e,s)||0;l+=(2*u+t)*(t-(o(e,r)||0)),c+=t,u+=t}const d=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,d-(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 I(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 F(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 W(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 z(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Y(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function G(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function X(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function V(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function U(e){const t=e.map(X),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return V(e,o,n)}if(e>=1){const[e,n,i]=t[o];return V(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return V(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const K=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Q=U(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Z=U(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),J=U(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ee=U(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),te=U(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),oe=U(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ne=U(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ie=U(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),re=U(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),se=U(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ae=U(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),le=U(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),ce=U(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ue=U(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),de=U(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),he=U(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ge=U(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),fe=U(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),pe=U(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ye={category10:K,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:Q,reds:Z,greens:J,oranges:ee,purples:te,viridis:ne,plasma:ie},me=K,ve=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],be=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],xe=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 ke(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")||xe.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):me[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))%me.length]}function we(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+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return i.scaleOrdinal().domain(n).range(o).unknown("#999");const s=ye[o]||ye.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:me;return i.scaleOrdinal().domain(n).range(e).unknown("#999")}}function je(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 Ae(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 Se(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 Oe(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Me(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Ce(e,t,o){return e+(t-e)*o}function _e(){return"undefined"!=typeof performance?performance.now():Date.now()}function Pe(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 Le(e,t,o,n){return"function"==typeof t.style?t.style(n||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,n)}function Te(e,t,o,n){if(!e.scales)return null;const i=[],r=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=n.getTop(o),a=n.getBottom(o);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),r.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:Le(e,n,o,t[0]),datum:t,group:o,interactive:n.interactive}}function Re(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const n of e)n.perSeries?t.push(n):o.push(n);return{perSeries:t,aggregate:o}}function Be(e,t,o){const n=[];for(const i of o){const o=Te(e,t,"__ribbon_aggregate",i);o&&n.push(o)}return n}function Ee(e,t,o,n){const i=[];for(const r of n){const n=Te(e,t,o,r);n&&i.push(n)}return i}function Ne(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const n of t){if("band"!==n.kind)continue;const t=n.getTop(e),i=n.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&o.push({y0:i,y1:t})}return 0===o.length?e:Object.assign(Object.assign({},e),{band:o[0],bands:o})}function $e(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=I(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const De={topOpacity:.8,bottomOpacity:.05};function He(e){var t,o;if(e)return!0===e?De:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:De.topOpacity,bottomOpacity:null!==(o=e.bottomOpacity)&&void 0!==o?o:De.bottomOpacity}}const Ie={blues:Q,reds:Z,greens:J,viridis:ne,oranges:ee,purples:te,greys:oe,plasma:ie,inferno:re,magma:se,cividis:ae,turbo:le},Fe=new Map;function We(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function ze(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,n=We(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=Y(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:We(e.y1Accessor,"y1"),getBottom:We(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Ye{constructor(e){if(this.xExtent=new E,this.yExtent=new E,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 B(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Y(e.timeAccessor||e.xAccessor,"time"),this.getY=Y(e.valueAccessor||e.yAccessor,"value")):(this.getX=Y(e.xAccessor,"x"),this.getY=Y(e.yAccessor,"y")),this.getGroup=q(e.groupAccessor),this.getCategory=q(e.categoryAccessor),this.getSize=e.sizeAccessor?Y(e.sizeAccessor,"size"):void 0,this.getColor=q(e.colorAccessor),this.getY0=e.y0Accessor?Y(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=ze(e),this.getPointId=q(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Y(e.openAccessor,"open"):void 0,this.getHigh=Y(e.highAccessor,"high"),this.getLow=Y(e.lowAccessor,"low"),this.getClose=o?Y(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new B(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 o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(n)&&this.yExtent.push(n)}}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?Y(this.config.timeAccessor||this.config.xAccessor,"time"):Y(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)if(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));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}}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);if(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));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}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 o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(n)&&this.yExtent.evict(n)}}}return!0}computeScene(e){var t,o,n,r,s,a,l,c,u,d,h,g,f,p;const{config:y,buffer:m}=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(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(o=y.xExtent[0])&&void 0!==o?o:b[0],null!==(n=y.xExtent[1])&&void 0!==n?n:b[1]]:b,w=y.yExtent?[null!==(r=y.yExtent[0])&&void 0!==r?r:x[0],null!==(s=y.yExtent[1])&&void 0!==s?s:x[1]]:x;const j=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1],A="exact"===y.axisExtent;if("stackedarea"===y.chartType&&!j&&m.size>0)if(y.normalize)w=[0,A?1:1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(a=y.baseline)&&void 0!==a?a:"zero"}:${null!==(l=y.stackOrder)&&void 0!==l?l:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=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!==(c=y.stackOrder)&&void 0!==c?c:"key",l=(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:l(e,t)}),o=[],n=[];let i=0,r=0;for(const t of e)r>i?(o.push(t),i+=null!==(u=s.get(t))&&void 0!==u?u: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:l(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:l(e,t)}):t.map(e=>e.key).sort(l);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(n).sort((e,t)=>e-t),t=H(e,f,(e,t)=>{var n;return(null===(n=o.get(e))||void 0===n?void 0:n.get(t))||0},y.baseline);let i=1/0,s=-1/0;for(const o of e){const e=null!==(h=t.get(o))&&void 0!==h?h:0,n=null!==(g=r.get(o))&&void 0!==g?g: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=A?0:a>0?a*y.extentPadding:1;w=[i-l,s+l]}else w=[0,i+(A?0:i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!j&&m.size>0){const[,e]=function(e,t,o,n,i){const r=N(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]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,A?e:e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!j&&m.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]}(m,this.getY),o=t-e,n=A?0:o>0?o*y.extentPadding:1;w=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!j&&w[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of v)for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&(w[0]>o&&(w[0]=o),o>w[1]&&(w[1]=o)),Number.isFinite(n)&&(w[0]>n&&(w[0]=n),n>w[1]&&(w[1]=n))}const e=w[1]-w[0],t=A?0:e>0?e*y.extentPadding:1,o=null===(f=y.yExtent)||void 0===f?void 0:f[0],n=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=o?w[0]:w[0]-t,null!=n?w[1]:w[1]+t],"log"!==y.yScaleType||w[0]>0||0>=x[0]||A||(w[0]=null!=o?w[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!j){const e=y.yExtent[0],t=y.yExtent[1];null==e&&null==t||(w=[null!=e?e:w[0],null!=t?t:w[1]])}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const S="streaming"===y.runtimeMode,O=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(S)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[O,e.width-O]:[e.width-O,O];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-O,O])}}else{const t="down"===y.arrowOfTime?[O,e.height-O]:[e.height-O,O];this.scales={x:i.scaleLinear().domain(w).range([O,e.width-O]),y:i.scaleLinear().domain(k).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 i.scaleLog().domain(e).range(o).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(o):i.scaleLinear().domain(t).range(o)};this.scales={x:t(y.xScaleType,k,[O,e.width-O]),y:t(y.yScaleType,w,[e.height-O,O])}}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,Ye.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=r.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(),r=this.scales.y.domain(),s=this.scales.x.range(),a=this.scales.y.range(),l=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(o).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(o):i.scaleLinear().domain(t).range(o)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=a[1]>a[0];this.scales={x:l(this.config.xScaleType,n,s[0]>s[1]?[e.width-c,c]:[c,e.width-c]),y:l(this.config.yScaleType,r,u?[c,e.height-c]:[e.height-c,c])},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:u}=this;if(!u)return[];if(c.customLayout){const l=null!==(o=c.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,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:ve},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(d)}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 d={scales:u,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 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.ribbons&&e.ribbons.length>0){const{perSeries:o,aggregate:r}=Re(e.ribbons);if(r.length>0&&i.push(...Be(e,t,r)),o.length>0)for(const t of n)i.push(...Ee(e,t.data,t.key,o))}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=$(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 $e(e,n,i),i}(d,t);case"area":return function(e,t){const o=e.groupData(t),n=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Re(e.ribbons);if(r.length>0&&n.push(...Be(e,t,r)),i.length>0)for(const t of o)n.push(...Ee(e,t.data,t.key,i))}const 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=D(t.data,e.scales,e.getX,e.getY,i,o,t.key,r),a=He(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),n.push(s)}return $e(e,o,n),n}(d,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Re(e.ribbons);if(r.length>0&&n.push(...Be(e,t,r)),i.length>0)for(const t of o)n.push(...Ee(e,t.data,t.key,i))}const 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=D(t.data,e.scales,e.getX,e.getY,r,o,t.key,s),a=He(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),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=$(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 $e(e,o,n),n}(d,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,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,o,n,i,r,s,a="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).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 d){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=H(d,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,m=new Map;for(const e of d)m.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 d){let i=e.get(o)||0;const s=m.get(o);r&&(i/=g.get(o));const c=s+i,u=t.x(o);a.push([u,t.y(s)]),n.push([u,t.y(c)]),m.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,u),g=d;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)};$e(e,s,g,o)}return g}(d,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,u=I(o,e.scales,e.getX,e.getY,r,t,c);u&&n.push(u)}return n}(d,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=Y(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||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 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-u)/f),s-1),d=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(n);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=o.width/s,j=o.height/a,A=e.config.showValues,S=e.config.heatmapValueFormat,O=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===m[n])continue;let i;switch(l){case"sum":i=v[n];break;case"mean":i=v[n]/m[n];break;default:i=m[n]}const r=(i-b)/k;O.push(W(o*w,(a-1-e)*j,w,j,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:m[n],sum:v[n],xCenter:u+(o+.5)*f,yCenter:h+(e+.5)*p,agg:l},A?{value:i,showValues:!0,valueFormat:S}:void 0))}}return O}(e,t,o);if(0===t.length)return[];const n=Y(e.config.valueAccessor,"value"),i=G(e.config.xAccessor,"x"),r=G(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),u=r(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)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 o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=n(o),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=o}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 j=function(e){const t=e in Ie?e:"blues";let o=Fe.get(t);if(o)return o;o=Array(256);const n=Ie[t]||Q;for(let e=0;256>e;e++)o[e]=n(e/255);return Fe.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),S=o.width/u,O=o.height/d,M=e.config.showValues,C=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const o=y[e],n=o%u;_.push(W(n*S,(d-1-(o-n)/u)*O,S,O,j[Math.min((t-k)*A+.5|0,255)],v[e],M?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(d,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=N(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(),u=e.config.barStyle,d=null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.opacity=u.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),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 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==u?void 0:u.fill)||d||"#4e79a7";s.push(F(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)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(F(v,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==u?void 0:u.fill)||d||"#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)}}(d,t);return this._barCategoryCache=null!==(l=d.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||{},u=null!==(o=c.radius)&&void 0!==o?o:3,d=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=d;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:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(d,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const u=[],d=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 u;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,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 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=d.x(i),c=0!==a?d.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 j=d.y(x),A=d.y(s),S=Math.min(j,A),O=Math.abs(j-A),M={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(M.opacity=b),u.push(F(k,S,w,O,M,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 u}(d,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",u=i?a:s.wickColor||"#333",d=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:u,wickWidth:d,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(d,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?Ae(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]=Ae(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]=Ae(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=Ae(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=Ae(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=Se(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=Se(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],u=Pe(e,c,l);u&&("point"===c.type?o.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.set(u,{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(u,{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(u,{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(u,{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=Pe(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,u,d,h,g,f,p,y,m,v,b,x,k,w,j,A,S,O,M,C,_,P,L,T,R,B,E,N,$,D,H,I,F,W,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=Pe(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!==(u=r.style.opacity)&&void 0!==u?u: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!==(d=L.r)&&void 0!==d?d: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!==(A=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==A?A: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!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(O=L.highY)&&void 0!==O?O:r.highY,r.lowY=null!==(M=L.lowY)&&void 0!==M?M:r.lowY,X=!0)}else r._targetOpacity=null!==(_=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_: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!==(R=t.opacity)&&void 0!==R?R: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!==(B=t.w)&&void 0!==B?B:0,h:null!==(E=t.h)&&void 0!==E?E:0,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N: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!==($=t.w)&&void 0!==$?$:0,h:null!==(D=t.h)&&void 0!==D?D:0,fill:"#999",datum:null,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(I=t.openY)&&void 0!==I?I:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(F=t.closeY)&&void 0!==F?F:n,highY:null!==(W=t.highY)&&void 0!==W?W:n,lowY:null!==(z=t.lowY)&&void 0!==z?z: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:_e(),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 u=Me(e,o.activeTransition),d=Oe(u,"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=Ce(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==e._targetR&&void 0!==o.r&&(e.r=Ce(o.r,e._targetR,d))}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=Ce(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,d)),void 0!==o.h&&(e.h=Ce(o.h,e._targetH,d))}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:Ce(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,d)),void 0!==o.h&&(e.h=Ce(o.h,e._targetH,d))}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:Ce(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),void 0!==o.openY&&(e.openY=Ce(o.openY,e._targetOpenY,d)),void 0!==o.closeY&&(e.closeY=Ce(o.closeY,e._targetCloseY,d)),void 0!==o.highY&&(e.highY=Ce(o.highY,e._targetHighY,d)),void 0!==o.lowY&&(e.lowY=Ce(o.lowY,e._targetLowY,d))}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:Ce(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);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]=Ce(t[n][0],o[n][0],d),e.path[n][1]=Ce(t[n][1],o[n][1],d)}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:Ce(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);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]=Ce(t[o][0],n[o][0],d),e.topPath[o][1]=Ce(t[o][1],n[o][1],d);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Ce(o[t][0],i[t][0],d),e.bottomPath[t][1]=Ce(o[t][1],i[t][1],d)}}if(u>=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||ve,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)||ve;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Ye.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||"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||!z(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),u=l||!z(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Y(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Y(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Y(this.config.xAccessor,"x"),this.getY=Y(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=ze(this.config)),s=!0,a=!0)}if("groupAccessor"in e&&!z(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?q(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!z(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?q(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!z(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Y(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!z(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!z(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Y(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),("boundsAccessor"in e&&!z(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=ze(this.config),s=!0,a=!0),"pointIdAccessor"in e&&!z(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?q(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!z(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!z(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!z(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!z(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Y(this.config.openAccessor,"open"):void 0,this.getHigh=Y(this.config.highAccessor,"high"),this.getLow=Y(this.config.lowAccessor,"low"),this.getClose=t?Y(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 Ge(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:p.createElement(p.Fragment,null,...t)}function qe(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 Xe(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Ve(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ue(e,t){const o=Ve(e);if(!o)return!1;const n=Ve(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function Ke(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Qe(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 u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);Xe(e.r,n)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}Ye.GROUP_COLOR_MAP_CAP=1e3,Ye.QUADTREE_THRESHOLD=500;const Ze=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Je=new WeakMap;let et=0,tt=!1,ot=null,nt=null,it=null;function rt(e,t){var o,n;if(!t)return t;const i=Ze.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(tt)return;if("undefined"==typeof window||"undefined"==typeof document)return;tt=!0;const e=()=>{et++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ot=new MutationObserver(e),ot.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{nt=window.matchMedia("(prefers-color-scheme: dark)"),it=e,"function"==typeof nt.addEventListener?nt.addEventListener("change",it):"function"==typeof nt.addListener&&nt.addListener(it)}catch(e){}}();let s=Je.get(r);s&&s.version===et||(s={version:et,map:new Map},Je.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 st(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 at(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function lt(e,t,o){return null==t?o:"string"!=typeof t?t:rt(e,t)||o}function ct(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)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,i,r,s),[h,g,f]=st(e,o);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function ut(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 dt=new WeakMap;function ht(e,t){const o=at(t);if(!o)return e;const n=dt.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,u]=i;for(let i=1;o>=i;i++){const d=i/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,r){i=[o,r],n.push([o,r])}};return s.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),n}(e,o);return dt.set(e,i),i}function gt(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Qe(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=pt(r,t,o,n);break;case"line":e=yt(r,t,o,n);break;case"rect":if(null==r.datum)break;e=vt(r,t,o);break;case"heatcell":e=bt(r,t,o);break;case"area":if(!1===r.interactive)break;e=kt(r,t,o);break;case"candlestick":e=xt(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ft(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=wt(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 pt(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Xe(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function yt(e,t,o,n=30){var i,r;if(0===e.path.length)return null;const s=wt(e.path,t);if(0>s)return null;const[a,l]=e.path[s];let c;if(e.path.length>1){let n=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=mt(t,o,i,r,a,l);n>c&&(n=c)}c=n}else{const e=t-a,n=o-l;c=Math.sqrt(e*e+n*n)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:a,y:l,distance:c}}function mt(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 u=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-u,2))}function vt(e,t,o){const n=qe(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function bt(e,t,o){const n=qe(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function xt(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 kt(e,t,o){if(0===e.topPath.length)return null;const n=wt(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 wt(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 jt(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 At(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 St(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?Ot(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Ot(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 Ot(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 Mt(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Ct(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function _t(e,o,n,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=o.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}const Pt={fill:(t,o)=>e.jsx("rect",{style:t,width:o,height:o}),line:(t,o)=>e.jsx("line",{style:t,x1:0,y1:0,x2:o,y2:o})};function Lt(e,t,o,n,i){let r;return r="function"==typeof o?o(e):(0,Pt[o])(n(e,t),i),r}function Tt({swatchSize:t}){return e.jsx("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 Rt(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Bt=(t,o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0;const m=!(!o&&!n),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:k}=d;return f.forEach((t,u)=>{const d=Lt(t,u,h,g,b),w=Rt(t,i,r),j=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${y})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?l===s&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?j||!1:void 0,"aria-current":m&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:m?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{c(l,u),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,j&&e.jsx(Tt,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k}),p};function Et({config:t,orientation:o="vertical",width:n=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+p.useId();if("horizontal"===o){const t=12,o=Math.min(n,200),a=Math.max(0,(n-o)/2),u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[0]+o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:o,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+o,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[1]-o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function Nt(t){const{legendGroups:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,g=function(e){var t,o,n,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!==(o=null==e?void 0:e.rowHeight)&&void 0!==o?o:22);return{swatchSize:s,labelGap:Math.max(0,null!==(n=null==e?void 0:e.labelGap)&&void 0!==n?n: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}}(h),[f,y]=p.useState(0),[m,v]=p.useState(0),b=p.useCallback((e,t)=>{y(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:o,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e.jsx("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.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:Bt(t,n,i,r,s,a,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:o||[],width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}):(({legendGroups:t,height:o,width:n,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var g;let f=0;const p=[];t.forEach((t,o)=>{var g;let y=0;t.label&&(y+=16);const m=((t,o,n,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=t,y=[],{swatchSize:m,labelGap:v,itemGap:b,rowHeight:x,align:k}=d,w=!(!o&&!n),j="isolate"===u||void 0===u&&null!=r,A=p.map(e=>m+v+7*e.label.length),S=[];let O=0,M=0;A.forEach((e,t)=>{const o=0===M?e:M+b+e;h&&h>0&&M>0&&o>h?(S.push({start:O,end:t,width:M}),O=t,M=e):M=o}),p.length>0&&S.push({start:O,end:p.length,width:M}),S.forEach((t,u)=>{let d="center"===k?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===k?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=p[h],k=Lt(t,h,g,f,m),S=Rt(t,i,r),O=r&&r.size>0&&r.has(t.label);y.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?l===s&&h===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&j?O||!1:void 0,"aria-current":w&&!j&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:w?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:w?e=>{c(l,h),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+v+2+7*t.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,O&&e.jsx(Tt,{swatchSize:m}),e.jsx("text",{y:m/2,x:m+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=A[h]+b}});const C=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,o,u,d,h,null!==(g=h.maxWidth)&&void 0!==g?g:n);y+=m.offset+5,p.push(Object.assign(Object.assign({label:t.label},m),{offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight})),f+=y+12});const y=null!==(g=h.maxWidth)&&void 0!==g?g:n;let m=f>y?0:"center"===h.align?Math.max(0,(y-f)/2):"end"===h.align?Math.max(0,y-f):0;const v=[];return p.forEach((n,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${m},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)),m+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+i)),m+=n.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),m+=12}),e.jsx("g",{children:v})})({legendGroups:o||[],title:l,height:u,width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}),k=!(!n&&!i);return e.jsxs("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),x]})}function $t(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Dt(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Ht(t){var o;const{legend:n,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!n)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(o=null==l?void 0:l.maxWidth)&&void 0!==o?o: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.jsx("g",{transform:`translate(${v}, ${b})`,children:Dt(n)?e.jsx(Et,{config:n.gradient,orientation:p?"horizontal":"vertical",width:m}):$t(n)?e.jsx(Nt,{legendGroups:n.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):n})}function It(e){return"string"==typeof e?{type:e}:e}function Ft({orient:o,config:n,values:i,scale:r,size:s,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),u="top"===o||"bottom"===o,d=t.useMemo(()=>{if(0===i.length)return null;const t=r.domain(),n=s-8;if("boxplot"===c.type){const t=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(!t)return null;const{q1:s,median:a,q3:l,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*n,20),f=(n-g)/2+4;if(u){const t=r(s),n=r(l),i=r(a),u=r(d),p=r(h),y="top"===o?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+o,children:[e.jsx("line",{x1:u,y1:m+y*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*f,x2:u,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,n),y:"top"===o?m-f-g:m+f,width:Math.abs(n-t),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===o?m-f-g:m+f,x2:i,y2:"top"===o?m-f:m+f+g,stroke:c.fill,strokeWidth:2})]})}{const t=r(s),n=r(l),i=r(a),u=r(d),p=r(h),y="left"===o?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+o,children:[e.jsx("line",{x1:m+y*(f+g/2),y1:u,x2:m+y*(f+g/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:u,x2:m+y*(f+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===o?m-f-g:m+f,y:Math.min(t,n),width:g,height:Math.abs(n-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===o?m-f-g:m+f,y1:i,x2:"left"===o?m-f:m+f+g,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=a.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+o,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/h*n;if(u){const n=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:n,y:"top"===o?-4-s:4,width:Math.max(a,.5),height:s,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const n=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:"left"===o?-4-s:4,y:Math.min(n,n+a),width:s,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=n/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const s=e.length/h*(n/2),a=r((e.x0+e.x1)/2);i.push(u?`${a},${"top"===o?-(t-s):t-s}`:`${"left"===o?-(t-s):t-s},${a}`)}for(let e=d.length-1;e>=0;e--){const s=d[e];if(null==s.x0||null==s.x1)continue;const a=s.length/h*(n/2),l=r((s.x0+s.x1)/2);i.push(u?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+o,children:e.jsx("polygon",{points:i.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(u){const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*n,s=r((e.x0+e.x1)/2);t.push(`L${s},${"top"===o?-i-4:i+4}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*n,s=r((e.x0+e.x1)/2);t.push(`L${"left"===o?-i-4:i+4},${s}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${e},${s}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+o,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,r,c,s,l,o,u,4]);return d?e.jsx("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:d}):null}function Wt(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 zt(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 Yt(t,o,n,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(o)>Math.abs(n)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>o?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>o?"end":"start";const f=16,p=s?u?[s]:Wt(s,c):[],y=r?u?[r]:Wt(r,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:p.map((t,o)=>e.jsx("tspan",{x:m,dy:0===o?0:f,children:t},o))},"annotation-note-title")),v=p.length*f),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,o)=>e.jsx("tspan",{x:m,dy:0===o?0:f,children:t},o))},"annotation-note-label"));let k=null;if((s||r)&&(0!==o||0!==n))if("topBottom"===d){const t=Math.min(c,120);let o=0,n=t;"end"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),k=e.jsx("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*f+(y.length>0?f:0);let o=0,n=t;"bottom"===h?(o=-t,n=0):"middle"===h&&(o=-t/2,n=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*f;let j=0;return"topBottom"===d?j=0>n?-(w+2):18:"leftRight"===d&&(j="middle"===h?-(w+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${o},${n})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),k]})}function Gt(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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("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.jsx("path",{d:zt((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.jsx("g",{className:"annotation-subject",children:a})}function qt(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),u=e/2,d=n/2,h=t*d>o*u?u/t:d/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.jsx("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.jsx("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.jsx("g",{className:"annotation-connector",children:a})}function Xt(t){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-o),null!=a&&(b=a-n);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!m.has("connector")&&qt(v,b,c,h,x,u),!m.has("subject")&&Gt(x,u,h,o,n),!m.has("note")&&Yt(l,v,b,h)]}))}function Vt(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.jsx(Xt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(Xt,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ut(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 Kt(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 Qt(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,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(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=Ut(e,o),c=Kt(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 Zt(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Jt={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};function eo(t){return function(t,o,n){var i,r,a,c,u,d,h,g,f,p,m,v,b,x,k,w,j,A,S,O,M,C,_,P,L,T,R,B,E,N,$,D,H,I,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee;switch(t.type){case"label":{const i=Qt(t,o,n);if(!i)return null;const{x:r,y:s}=i;return Zt(r,s,n)?e.jsx(Vt,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"callout":{const i=Qt(t,o,n);if(!i)return null;const{x:r,y:s}=i;return Zt(r,s,n)?e.jsx(Vt,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"x-threshold":{const i=Ut(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(n.height||0)-4:"center"===s?(n.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:n.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"y-threshold":{const i=Kt(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(n.width||0)/2,l="middle"):(a=(n.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:n.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Ut(Object.assign(Object.assign({},e),{type:"point"}),n),y:Kt(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=l.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Ut(Object.assign(Object.assign({},e),{type:"point"}),n),y:Kt(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),l=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"highlight":{const i=n.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((o,i)=>{const r=Ut(o,n),a=Kt(o,n);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(o):t.r||6,c="function"==typeof t.style?t.style(o):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+o)}case"bracket":{const i=Ut(t,n),r=Kt(t,n);return e.jsx(Vt,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+o)}case"trend":{const s=n.data||[];if(2>s.length)return null;const l=n.xAccessor||"x",g=n.yAccessor||"y",f="ordinal"===n.frameType,p="horizontal"===n.projection,m=f?l:null,v=f?g:null;let b;const x=[],k=new Map;if(f&&m&&v){for(const e of s){const t=e[m];if(null==t)continue;const o=t+"";k.has(o)||(k.set(o,x.length),x.push(o))}b=s.map(e=>{const t=e[m],o=e[v];if(null==t||null==o)return null;const n=k.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else b=s.map(e=>[e[l],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(r=null===(i=n.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(a=n.scales)||void 0===a?void 0:a.time,j=null!==(u=null===(c=n.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=n.scales)||void 0===d?void 0:d.value;if(!w||!j)return null;const A=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},S=w,O=j;let M;if(f)if(p){const e=A(O);M=(t,o)=>[S(o),e(t)]}else{const e=A(S);M=(t,o)=>[e(t),O(o)]}else M=(e,t)=>[S(e),O(t)];const C=t.method||"linear";let _;_="loess"===C?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 u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===C?y.default.polynomial(b,{order:t.order||2}):y.default.linear(b)).points;const P=_.map(([e,t])=>{const[o,n]=M(e,t);return`${o},${n}`}).join(" "),L=t.color||"#6366f1",T=_[_.length-1],[R,B]=M(T[0],T[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:R+4,y:B-4,fill:L,fontSize:11,children:t.label})]},"ann-"+o)}case"band":{const i=null!==(f=null===(g=n.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(p=n.scales)||void 0===p?void 0:p.value,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,s=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:n.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:n.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+o)}case"envelope":{const i=n.data||[];if(2>i.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(k=n.scales)||void 0===k?void 0:k.time,l=null!==(j=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==j?j:null===(A=n.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=Jt[n.curve||"linear"]||s.curveLinear,f=s.area().x(e=>a(e[r])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:p,fillOpacity:null!==(S=t.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][r])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"anomaly-band":{const i=n.data||[];if(2>i.length)return null;const r=n.yAccessor||"y",s=null!==(M=null===(O=n.scales)||void 0===O?void 0:O.x)&&void 0!==M?M:null===(C=n.scales)||void 0===C?void 0:C.time,a=null!==(P=null===(_=n.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=n.scales)||void 0===L?void 0:L.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(T=t.threshold)&&void 0!==T?T:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(R=t.fillOpacity)&&void 0!==R?R:.1,m=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B:6,b=a(c+h*d),x=a(g),k=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[f&&e.jsx("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,o)=>{const i=Ut(t,n),r=Kt(t,n);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"forecast":{const i=n.data||[];if(3>i.length)return null;const r=n.xAccessor||"x",s=n.yAccessor||"y",a=null!==(N=null===(E=n.scales)||void 0===E?void 0:E.x)&&void 0!==N?N:null===($=n.scales)||void 0===$?void 0:$.time,l=null!==(H=null===(D=n.scales)||void 0===D?void 0:D.y)&&void 0!==H?H:null===(I=n.scales)||void 0===I?void 0:I.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=y.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=c.length;let t=0,o=0,n=0,i=0;for(const[e,r]of c)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 d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(F=t.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(W=t.steps)&&void 0!==W?W:5,x=c[d-1][0],k=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=u(e),o=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-f,2)/p:0))*v;j.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const A=`M${j.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),O=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(z=t.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e.jsx("polyline",{points:`${O} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:a(j[j.length-1].x)+4,y:l(j[j.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+o)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Qt(t,o,n);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!Zt(i,r,n))return null;const s=null!==(q=t.dx)&&void 0!==q?q:0,a=null!==(X=t.dy)&&void 0!==X?X:0,l=null!==(V=t.width)&&void 0!==V?V:32,c=null!==(U=t.height)&&void 0!==U?U:32,u=null!==(K=t.content)&&void 0!==K?K:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const i=Qt(t,o,n);if(!i)return null;const{x:r,y:s}=i;return e.jsx("text",{x:r+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+o)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(Q=n.scales)||void 0===Q?void 0:Q.o,a=null===(Z=n.scales)||void 0===Z?void 0:Z.x,l=null===(J=n.scales)||void 0===J?void 0:J.y,c=r(s)?s:r(a)?a:r(l)?l:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",g=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,f=t.label;return e.jsxs("g",(n.projection?"vertical"===n.projection:c===a)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:n.height||0,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:u,width:n.width||0,height:d,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+o)}default:return null}}}let to={positions:new Map};const oo=new Set;function no(){for(const e of oo)e()}function io(e,t){const o=to.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(to.positions);n.delete(e),to={positions:n},no()}function ro(e,t){const o=to.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(to.positions);n.delete(e),to={positions:n},no()}function so(){return to}function ao(e){return oo.add(e),()=>oo.delete(e)}const lo={positions:new Map};function co(){return()=>{}}function uo(){return lo}function ho(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 go(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function fo(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function po(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const n of e)t>n.pixel&&(t=n.pixel),n.pixel>o&&(o=n.pixel);return{min:t,max:o}}function yo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function mo(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 vo(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g,axisExtent:f}=o,p=t.useMemo(()=>{var e,t;if(!l)return[];const o=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==o?void 0:o.tickFormat)||h||bo,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:ho(l.x,"exact"===f?Math.max(2,s):Math.min(s,r),f),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:l.x(e),label:i(e,t,c)})),g=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 xo(d,Math.max(55,g+8))},[l,u,h,n,f]),y=t.useMemo(()=>{var e,t;if(!l)return[];const o=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||g||bo,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;return xo((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:ho(l.y,"exact"===f?Math.max(2,s):Math.min(s,r),f)).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,i,f]),m=d&&l,v=c&&l;if(!m&&!v)return null;const b=null==u?void 0:u.find(e=>"bottom"===e.orient),x=null==u?void 0:u.find(e=>"left"===e.orient),k=v&&(!b||!1!==b.baseline),w=v&&(!x||!1!==x.baseline),j=(null==b?void 0:b.jaggedBase)||!1,A=(null==x?void 0:x.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&(()=>{var t,o;const r=yo(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=yo(null===(o=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[p.map((t,o)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+o)),y.map((t,o)=>e.jsx("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+o))]})})(),k&&!j&&e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:S,strokeWidth:1}),j&&e.jsx("path",{d:mo("bottom",n,i),fill:"none",stroke:S,strokeWidth:1}),w&&!A&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:S,strokeWidth:1}),A&&e.jsx("path",{d:mo("left",n,i),fill:"none",stroke:S,strokeWidth:1})]})})}function bo(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function xo(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 ko(o){var n,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,axes:h,xLabel:g,yLabel:f,yLabelRight:p,xFormat:y,yFormat:m,axisExtent:v,showGrid:b,title:x,legend:k,legendHoverBehavior:w,legendClickBehavior:j,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:O="right",legendLayout:M,foregroundGraphics:C,marginalGraphics:_,xValues:P,yValues:L,annotations:T,svgAnnotationRules:R,xAccessor:B,yAccessor:E,annotationData:N,pointNodes:$,curve:D,underlayRendered:H,canvasObscuresUnderlay:I=!0,linkedCrosshairName:F,linkedCrosshairSourceId:W,children:z}=o,Y=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"bottom"===e.orient),n=(null==o?void 0:o.tickFormat)||y||bo,i=Math.max(2,Math.floor(r/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:ho(u.x,"exact"===v?Math.max(2,s):Math.min(s,i),v),l=a.map(e=>e.valueOf()),c=a.map((e,t)=>({value:e,pixel:u.x(e),label:n(e,t,l)})),g=c.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),f=(null==o?void 0:o.autoRotate)?Math.max(20,Math.min(g+8,55)):Math.max(55,g+8);let p=xo(c,f);if(p.length>1&&(p=p.filter((e,t)=>0===t||e.label+""!=p[t-1].label+"")),(null==o?void 0:o.includeMax)&&p.length>0&&"exact"!==v&&!(null==o?void 0:o.tickValues)){const e=u.x.domain()[1],t=u.x(e),o=p[p.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,p.length,l);f>t-o&&p.length>1&&(p=p.slice(0,-1)),p.push({value:e,pixel:t,label:i})}}return p},[d,u,h,y,r,v]),G=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||m||bo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;let a=xo((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:ho(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.y(e),label:n(e)})),22);if(a.length>1&&(a=a.filter((e,t)=>0===t||e.label+""!=a[t-1].label+"")),(null==o?void 0:o.includeMax)&&a.length>0&&"exact"!==v&&!(null==o?void 0:o.tickValues)){const e=u.y.domain()[1],t=u.y(e),o=a[a.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&a.length>1&&(a=a.slice(0,-1)),a.push({value:e,pixel:t,label:i})}}return a},[d,u,h,m,s,v]),q=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"right"===e.orient);if(!o)return[];const n=o.tickFormat||m||bo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=o.ticks)&&void 0!==e?e:5;return xo((null!==(t=o.tickValues)&&void 0!==t?t:ho(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.y(e),label:n(e)})),22)},[d,u,h,m,s,v]),X=t.useRef(new Map),V=t.useRef(null!==(n=null==T?void 0:T.length)&&void 0!==n?n:0),U=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;V.current!==U&&(V.current=U,X.current=new Map);const K=t.useMemo(()=>{if(!T||0===T.length)return null;const e=eo(),t={scales:u?{x:u.x,y:u.y,time:u.x,value:u.y}:null,timeAxis:"x",xAccessor:B,yAccessor:E,width:r,height:s,data:N,frameType:"xy",pointNodes:$,curve:D,stickyPositionCache:X.current};return T.map((o,n)=>{if(R){const i=R(o,n,t);return null!=i?i:e(o,n,t)}return e(o,n,t)}).filter(Boolean)},[T,R,r,s,B,E,N,u,$,D]),Q=function(e){var o;const n=t.useSyncExternalStore(e?ao:co,e?so:uo,e?so:uo);return e&&null!==(o=n.positions.get(e))&&void 0!==o?o:null}(F);return t.useEffect(()=>{if(!(null==Q?void 0:Q.locked)||!F)return;const e=e=>{"Escape"===e.key&&ro(F)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Q?void 0:Q.locked,F]),d||x||k||C||_||K&&K.length>0||b||z||Q?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof x?x:"XY Chart"}),e.jsx("desc",{children:"string"==typeof x?x+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[b&&u&&(!H||I)&&(()=>{var t,o;const n=yo(null===(t=null==h?void 0:h.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=yo(null===(o=null==h?void 0:h.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[Y.map((t,o)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"xgrid-"+o)),G.map((t,o)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+o))]})})(),d&&u&&(()=>{const t=null==h?void 0:h.find(e=>"left"===e.orient),o=null==h?void 0:h.find(e=>"bottom"===e.orient),n=!t||!1!==t.baseline,i=!o||!1!==o.baseline,a=(null==t?void 0:t.jaggedBase)||!1,l=(null==o?void 0:o.jaggedBase)||!1,u=null==o?void 0:o.landmarkTicks,d=null==t?void 0:t.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",v="var(--semiotic-text, #333)",b=!!(null==o?void 0:o.autoRotate)&&Y.length>1&&(()=>{const e=r/Math.max(Y.length-1,1);return Y.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 10px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},w={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},j=null==o?void 0:o.tickAnchor,A=null==t?void 0:t.tickAnchor,S=po(Y),O=po(G);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||I)&&i&&!l&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:y,strokeWidth:1}),(!H||I)&&l&&e.jsx("path",{d:mo("bottom",r,s),fill:"none",stroke:y,strokeWidth:1}),Y.map((t,o)=>{const n=!!u&&("function"==typeof u?u(t.value,o):Ue(t.value,o>0?Y[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":go(j,t.pixel===S.min,t.pixel===S.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n?k:x),transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+o)}),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:v,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||I)&&n&&!a&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:y,strokeWidth:1}),(!H||I)&&a&&e.jsx("path",{d:mo("left",r,s),fill:"none",stroke:y,strokeWidth:1}),G.map((t,o)=>{const n=!!d&&("function"==typeof d?d(t.value,o):Ue(t.value,o>0?G[o-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:fo(A,t.pixel===O.min,t.pixel===O.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n?k:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+o)}),(()=>{const o=(null==t?void 0:t.label)||f;return o?e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:o}):null})()]}),(()=>{const t=null==h?void 0:h.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const o=!1!==t.baseline,n=t.landmarkTicks,i=t.label||p,a=t.tickAnchor,l=po(q);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e.jsx("line",{x1:r,y1:0,x2:r,y2:s,stroke:y,strokeWidth:1}),q.map((t,o)=>{const i=!!n&&("function"==typeof n?n(t.value,o):Ue(t.value,o>0?q[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:fo(a,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+o)}),i&&e.jsx("text",{x:r+c.right-15,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(90, ${r+c.right-15}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:i})]})})()]})})(),K,_&&u&&P&&L&&e.jsxs(e.Fragment,{children:[_.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Ft,{orient:"top",config:It(_.top),values:P,scale:u.x,size:c.top,length:r})}),_.bottom&&e.jsx("g",{transform:`translate(0, ${s})`,children:e.jsx(Ft,{orient:"bottom",config:It(_.bottom),values:P,scale:u.x,size:c.bottom,length:r})}),_.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Ft,{orient:"left",config:It(_.left),values:L,scale:u.y,size:c.left,length:s})}),_.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(Ft,{orient:"right",config:It(_.right),values:L,scale:u.y,size:c.right,length:s})})]}),C,Q&&Q.sourceId!==W&&(null==u?void 0:u.x)&&(()=>{const t=u.x(Q.xValue);if(null==t||0>t||t>r)return null;const o=Q.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:s,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"})})(),z]}),x&&e.jsx("text",{x:a/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 x?x:null}),Ht({legend:k,totalWidth:a,totalHeight:l,margin:c,legendPosition:O,title:x,legendLayout:M,legendHoverBehavior:w,legendClickBehavior:j,legendHighlightedCategory:A,legendIsolatedCategories:S})]}):null}function wo(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 jo(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 Ao=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function So(e){var t,o;const{innerRadius:n,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=n;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=Ao(i,r),t=Ao(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=Ao(i,r),t=Ao(i,s),o=Ao(n,s),l=Ao(n,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${o.x},${o.y} A${n},${n} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(o=e.cornerRadius)&&void 0!==o?o:0,(i-n)/2));if(0===l)return So(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))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,n+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return So(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?u:0),v=s-(f?u:0),b=Ao(i,p),x=Ao(i,y),k=(i-l)*Math.cos(c),w=Ao(k,r),j=Ao(k,s),A=a?null:Ao(n,v),S=a?null:Ao(n,m),O=a?0:(n+l)*Math.cos(u),M=a?null:Ao(O,r),C=a?null:Ao(O,s),_=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=Ao(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Ao(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=Ao(n,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${n},${n} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=Ao(n,r);L+=` A${n},${n} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Oo(e){const t=So({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let i=0;n.length>i;i++)o.push({d:So({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:n[i]})}return{clipPath:t,slices:o}}const Mo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Co(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function _o(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const Po="undefined"==typeof window||"undefined"==typeof document,Lo="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function To(){const[e,o]=t.useState(!1);return Lo(()=>{o(!0)},[]),e}const Ro=()=>()=>{},Bo=()=>!1,Eo=()=>!0;function No(){const e=t.useSyncExternalStore(Ro,Bo,Eo);return t.useRef(e).current}function $o(e){const{hydrated:o,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Lo(()=>{var e,t;o&&n&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[o,n]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}function Do(e){const o=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Io(e,t);if(!Fo(e)||!Fo(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(!Io(o,i))return!1}else{if(!Fo(o)||!Fo(i))return!1;if(!Ho(o,i))return!1}}return!0}(o.current,e)||(o.current=e),o.current}function Ho(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 Io(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 Fo(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 Wo=p.createContext(null);function zo({children:t}){const[o,n]=p.useState(!1),i=p.useMemo(()=>({visible:o,setVisible:n}),[o]);return e.jsx(Wo.Provider,{value:i,children:t})}function Yo(){return p.useContext(Wo)}const Go={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function qo(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";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 Xo(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 Vo=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Uo="semiotic-accessible-data-table",Ko=Uo+" semiotic-accessible-data-table-hidden",Qo=Uo+" semiotic-accessible-data-table-visible",Zo=Qo+" semiotic-accessible-data-table-network",Jo={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"},en={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, 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-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)"},on={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},nn={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))"},rn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},sn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function an({scene:t,chartType:o,tableId:n,chartTitle:i}){var r;const[s,a]=p.useState(!1),l=Yo(),c=null!==(r=null==l?void 0:l.visible)&&void 0!==r&&r,u=s||c,d=p.useRef(null),h=i?"Data summary for "+i:n?`Data summary for ${o} ${n}`:"Data summary for "+o,g=p.useCallback(()=>{s||c||a(!0)},[s,c]),f=p.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return n?e.jsx("span",{id:n,tabIndex:-1,style:Go}):null;if(!u)return e.jsx("div",{id:n,className:Ko,tabIndex:-1,onFocus:g,style:Go,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,j,A,S;const O=[];if(!Array.isArray(e))return O;for(const M of e)if(M&&"object"==typeof M&&null!==M.datum)try{switch(M.type){case"point":O.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&O.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&O.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;O.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":O.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":O.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=M.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":O.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=M.cx)&&void 0!==g?g:M.x,y:null!==(f=M.cy)&&void 0!==f?f:M.y}});break;case"arc":O.push({label:"Arc",values:{id:null!==(y=null===(p=M.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(v=M.cy)&&void 0!==v?v:M.y}});break;case"candlestick":O.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":O.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=M.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=M.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(S=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==S?S:""}})}}catch(e){}return O}(t),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}(y),v=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Vo(e.min)} to ${Vo(e.max)}, mean ${Vo(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(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const k=Array.from(x);return e.jsxs("div",{ref:d,id:n,className:Qo,tabIndex:-1,onBlur:f,style:Jo,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:tn,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:en,children:v}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+o,style:on,children:[e.jsxs("caption",{className:"semiotic-accessible-data-table-caption",style:sn,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:nn,children:"type"}),k.map(t=>e.jsx("th",{style:nn,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:rn,children:t.label}),k.map(o=>{return e.jsx("td",{style:rn,children:(n=t.values[o],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Vo(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},o);var n})]},o))})]})]})}function ln({nodes:t,edges:o,chartType:n,tableId:i,chartTitle:r}){var s,a,l,c,u,d,h,g,f,y,m,v,b,x;const[k,w]=p.useState(!1),j=Yo(),A=null!==(s=null==j?void 0:j.visible)&&void 0!==s&&s,S=k||A,O=r?"Data summary for "+r:i?`Data summary for ${n} ${i}`:"Data summary for "+n,M=p.useRef(null),C=p.useCallback(()=>{k||A||w(!0)},[k,A]),_=p.useCallback(e=>{var t;A||(null===(t=M.current)||void 0===t?void 0:t.contains(e.relatedTarget))||w(!1)},[A]);if(!t||0===t.length)return i?e.jsx("span",{id:i,tabIndex:-1,style:Go}):null;if(!S)return e.jsx("div",{id:i,className:Ko,tabIndex:-1,onFocus:C,style:Go,role:"region","aria-label":O,children:e.jsxs("button",{type:"button",onClick:()=>w(!0),children:["View data summary (",t.length," nodes, ",o.length," edges)"]})});const P=Array.isArray(t)?t:[],L=Array.isArray(o)?o:[],T=new Map,R=new Map,B=new Map,E=new Map;for(const e of L){if(!e||"object"!=typeof e)continue;const t=null!==(a=e.datum)&&void 0!==a?a:e,o="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,n="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";R.set(e,(null!==(u=R.get(e))&&void 0!==u?u:0)+1),E.set(e,(null!==(d=E.get(e))&&void 0!==d?d:0)+i)}if(null!=n&&""!==n){const e=n+"";T.set(e,(null!==(h=T.get(e))&&void 0!==h?h:0)+1),B.set(e,(null!==(g=B.get(e))&&void 0!==g?g:0)+i)}}const N=[];for(let e=0;P.length>e;e++){const t=P[e];if(!t||"object"!=typeof t)continue;const o=null!==(y=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:t.id,n=null!=o?o+"":"node-"+e,i=null!==(m=T.get(n))&&void 0!==m?m:0,r=null!==(v=R.get(n))&&void 0!==v?v:0,s=null!==(b=B.get(n))&&void 0!==b?b:0,a=null!==(x=E.get(n))&&void 0!==x?x:0;N.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}N.sort((e,t)=>t.degree-e.degree);let $=0,D=0;if(N.length>0){let e=0;for(const t of N)e+=t.degree,t.degree>D&&(D=t.degree);$=e/N.length}const H=L.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)}),I=[`${N.length} nodes, ${L.length} edges.`];N.length>0&&I.push(`Mean degree: ${Vo($)}, max degree: ${D}.`);const F=N.slice(0,5);return e.jsxs("div",{ref:M,id:i,className:Zo,tabIndex:-1,onBlur:_,style:Jo,role:"region","aria-label":O,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{A&&j&&j.setVisible(!1),w(!1)},"aria-label":"Close data summary",style:tn,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:en,children:I.join(" ")}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:on,children:[e.jsxs("caption",{className:"semiotic-accessible-data-table-caption",style:sn,children:["Top ",F.length," of ",N.length," nodes by degree"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:nn,children:"id"}),e.jsx("th",{style:nn,children:"degree"}),e.jsx("th",{style:nn,children:"in"}),e.jsx("th",{style:nn,children:"out"}),H&&e.jsx("th",{style:nn,children:"w. degree"}),H&&e.jsx("th",{style:nn,children:"w. in"}),H&&e.jsx("th",{style:nn,children:"w. out"})]})}),e.jsx("tbody",{children:F.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:rn,children:t.id}),e.jsx("td",{style:rn,children:t.degree}),e.jsx("td",{style:rn,children:t.inDeg}),e.jsx("td",{style:rn,children:t.outDeg}),H&&e.jsx("td",{style:rn,children:Vo(t.wDegree)}),H&&e.jsx("td",{style:rn,children:Vo(t.wInDeg)}),H&&e.jsx("td",{style:rn,children:Vo(t.wOutDeg)})]},o))})]})]})}function cn({summary:t}){return t?e.jsx("div",{role:"note",style:Go,children:t}):null}function un({tableId:t}){return e.jsx("a",{href:"#"+t,style:Go,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,Go)},children:"Skip to data table"})}function dn({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.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Go,children:o})}const hn="var(--semiotic-focus, #005fcc)";function gn({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 u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:hn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:hn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:hn,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function fn(e){return Array.isArray(e)?e[0]:e}function pn(e,t,o,n){return Object.assign({data:fn(e),x:t,y:o,__semioticHoverData:!0},n)}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 mn(e,t){return"function"==typeof t?t(e):e[t]}function vn(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 bn(t={}){const{fields:o,title:n,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(n){const e=mn(t,n);a=vn(e,i)}if(o&&o.length>0)o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=mn(t,n);l.push({label:o,value:vn(s,r)})});else if(!n){const e=["value","y","name","id","label"];for(const o of e)if(void 0!==t[o]){a=vn(t[o],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=vn(t[e[0]],i))}}const c=Object.assign(Object.assign({},yn),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,o)=>e.jsxs("div",{style:{marginTop:0===o&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},o))]})}}function xn(){return t=>{var o,n,i,r,s,a,l;const c=t.allSeries;if(!c||0===c.length){const r=null!==(n=null===(o=t.data)||void 0===o?void 0:o.value)&&void 0!==n?n:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:yn,children:e.jsx("div",{children:vn(r)})})}const u=null!==(a=null!==(r=t.xValue)&&void 0!==r?r:null===(s=t.data)||void 0===s?void 0:s.time)&&void 0!==a?a:null===(l=t.data)||void 0===l?void 0:l.x;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:vn(u)}),c.map((t,o)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:vn(t.value)})]},o))]})}}function kn(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=fn(!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.jsx("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)?bn(t):bn())}}function wn({x:t,y:o,containerWidth:n,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(o),u=p.useRef(null),[d,h]=p.useState(null);p.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,n,i]);let g;g=d?`translate(${d.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*i>o?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!p.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if("string"==typeof o.className&&o.className.trim().length>0)return!0;const n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor)return!0}return!1}(s),y=f?null:yn;return c?e.jsx("div",{ref:u,className:f?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:r.left+t,top:r.top+o,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function jn(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}function An(e,o,n){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!o&&!n)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;s(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return t.observe(e),()=>t.disconnect()},[o,n]),[i,[o&&r?r.w:e[0],n&&r?r.h:e[1]]]}const Sn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function On(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Mn(e){const o=function(){const[e,o]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return o(e.matches),jn(e,e=>o(e.matches))},[]),e}(),n=t.useRef(o);n.current=o;const[i,r]=An(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=On(e.foregroundGraphics,r,s),u=On(e.backgroundGraphics,r,s),d=R(e=>e.theme),{transition:h,introEnabled:g}=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),f="semiotic-table-"+p.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),j=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(j))},[j]),S=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const O=e.themeDirtyRef;return Sn(()=>{O&&(et++,O.current=!0,v())},[d,v,O]),{reducedMotion:o,reducedMotionRef:n,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:g,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:S}}function Cn(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 _n(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Pn(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 Ln(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 Tn=(e,t,o,n)=>{var i,r;const a=t.filter(e=>"line"===e.type);for(const l of a){if(2>l.path.length)continue;const c=l._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,n.width*c,n.height),e.clip());const u=l.style.stroke||"#007bff",d=rt(e,u)||u,h=l.style.strokeWidth||2,g=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=h,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const v=null!==(i=l.style.opacity)&&void 0!==i?i:1;Ln(e,l.path,d,h,v,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=at(l.curve),y=g&&g.length>0&&f&&f.length===l.path.length,m=l._decayOpacities;if(m&&m.length===l.path.length&&!y){e.strokeStyle=d;const b=null!==(r=l.style.opacity)&&void 0!==r?r:1;for(let x=0;l.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(l.path[x][0],l.path[x][1]),e.lineTo(l.path[x+1][0],l.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,j=null,A=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function M(){S&&(e.stroke(),S=!1)}for(let C=0;l.path.length>C;C++){const[_,P]=l.path[C],L=f[C],T=Pn(L,g,d);if(null!==k&&null!==A&&null!==j){if(T===A)e.lineTo(_,P);else{const R=[];for(const B of g){const E=B.value;(j>E||E>L)&&(E>j||L>E)||j===E||L===E||R.push({t:(E-j)/(L-j)})}R.sort((e,t)=>e.t-t.t);for(const N of R){const $=k+(_-k)*N.t,D=w+(P-w)*N.t,H=Pn(j+(L-j)*Math.min(N.t+1e-4,1),g,d);e.lineTo($,D),M(),O(H,$,D)}e.lineTo(_,P)}k=_,w=P,j=L,A=T}else O(T,_,P),k=_,w=P,j=L,A=T}M()}else{e.beginPath();const I=l.strokeGradient&&l.path.length>=2?ut(e,l.strokeGradient,l.path[0][0],0,l.path[l.path.length-1][0],0):null;if(e.strokeStyle=I||d,p)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[F,W]=l.path[0];e.moveTo(F,W);for(let z=1;l.path.length>z;z++)e.lineTo(l.path[z][0],l.path[z][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=lt(e,l.style.fill,l.style.fill),p&&!y)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[G,q]=l.path[0];e.moveTo(G,q);for(let X=1;l.path.length>X;X++)e.lineTo(l.path[X][0],l.path[X][1])}const Y=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Rn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Bn(e,t,o=.3){Rn(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 En(e,t,o=.6){var n,i,r,s,a;if(!Rn(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function Nn(e,t,o,n=.35){Rn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function $n(e,t){const o=at(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=s.area().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 Dn=(e,t,o,n)=>{var i,r,a;const l=t.filter(e=>"area"===e.type);for(const t of l){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 l=t._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,n.width*l,n.height),e.clip());const c=lt(e,t.style.fill,"#4e79a7"),u=t._decayOpacities;if(u&&u.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(u[n]+u[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=rt(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*(u[o]+u[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($n(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=ct(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,o,0,n);e.fillStyle=i||c,e.globalAlpha=d}else{const o=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=o*d,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&($n(e,t),Nn(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const o=t.strokeGradient&&t.topPath.length>=2?ut(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=at(t.curve);if(e.beginPath(),n)s.line().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!==l&&1>l&&e.restore(),o&&e.restore(),e.globalAlpha=1}},Hn=(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=lt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=lt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),En(e,t),e.globalAlpha=1}}finally{e.restore()}}};function In(e,t){const{x:o,y:n,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=jo(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 Fn(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 Wn=(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)zn(e,t);else if(t.cornerRadii&&wo(t.cornerRadii)){const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=Fn(t),i=t.fillGradient&&"string"==typeof o?ct(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,In(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=Fn(t),i=t.fillGradient&&"string"==typeof o?ct(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=Fn(t),i=t.fillGradient&&"string"==typeof o?ct(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Bn(e,t),e.globalAlpha=1}};function zn(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 Yn(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 Gn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const qn=(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=rt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Bn(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):Gn(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=Yn(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}},Xn=(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=rt(e,t.wickColor)||t.wickColor,c=60>n.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),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=rt(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&&d(),e.restore()}};function Vn(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 Un(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 Kn(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 Qn(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 Zn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Jn(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`${Zn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${Zn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const ei={line:[Dn,Tn,Hn],area:[Dn,Hn],stackedarea:[Dn,Hn],scatter:[Hn],bubble:[Hn],heatmap:[qn],bar:[Wn],swarm:[Hn],waterfall:[(e,t,o,n)=>{var i;Wn(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=rt(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 n=r[t],i=r[t+1],s=n.datum,a=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==a?void 0:a.baseline))continue;const l=o.y(s.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Xn],mixed:[Dn,Tn,Hn],custom:[Dn,Wn,qn,Tn,Hn,Xn]},ti={top:20,right:20,bottom:30,left:40},oi={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 ni(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 ii={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 ri({hover:t}){var o,n,i;const r=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(o=t.data)&&void 0!==o?o:{},a=null!==(n=s.y)&&void 0!==n?n:s.value,l=null!==(i=s.x)&&void 0!==i?i:s.time;return e.jsxs("div",{className:"semiotic-tooltip",style:ii,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:r(a)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:r(l)})]})}ri.ownsChrome=!0;const si=t.forwardRef(function(o,n){var i,r,s,a,l,c,u,d,h,g,f,y,m;const{chartType:v,runtimeMode:x,data:j,chunkThreshold:A,chunkSize:O,xAccessor:M,yAccessor:C,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:T,curve:R,normalize:B,baseline:E,stackOrder:N,binSize:$,valueAccessor:D,arrowOfTime:H="right",windowMode:I="sliding",windowSize:F=200,timeAccessor:W,xExtent:z,yExtent:Y,extentPadding:G=.1,scalePadding:q,sizeRange:X,size:V=[500,300],responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,lineStyle:ee,pointStyle:te,areaStyle:oe,barStyle:ne,waterfallStyle:ie,swarmStyle:re,barColors:se,colorScheme:ae,boundsAccessor:le,boundsStyle:ce,y0Accessor:ue,band:de,gradientFill:he,lineGradient:ge,areaGroups:fe,openAccessor:pe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,showAxes:xe=!0,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:Se,yFormat:Oe,axisExtent:Me,tickFormatTime:Ce,tickFormatValue:_e,hoverAnnotation:Pe,tooltipContent:Le,customHoverBehavior:Te,customClickBehavior:Re,enableHover:Be,hoverRadius:Ee=30,tooltipMode:$e,annotations:De,svgAnnotationRules:He,showGrid:Ie,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:qe,legendIsolatedCategories:Xe,legendPosition:Ve,legendLayout:Ue,legendCategoryAccessor:Ke,onCategoriesChange:Qe,backgroundGraphics:Ze,foregroundGraphics:Je,canvasPreRenderers:et,svgPreRenderers:tt,title:ot,categoryAccessor:nt,brush:it,onBrush:st,decay:at,pulse:lt,transition:ct,animate:ut,staleness:dt,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,marginalGraphics:xt,pointIdAccessor:kt,xScaleType:Ot,yScaleType:Mt,accessibleTable:Pt=!0,description:Lt,summary:Tt,linkedCrosshairName:Rt,linkedCrosshairSourceId:Bt,customLayout:Et,layoutConfig:Nt}=o,$t=t.useId().replace(/:/g,""),Dt=t.useRef(!1),Ht=Mn({sizeProp:V,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:ti,animate:ut,transitionProp:ct,themeDirtyRef:Dt}),It=To(),Ft=No(),{reducedMotionRef:Wt,responsiveRef:zt,size:Yt,currentTheme:Gt,transition:qt,introEnabled:Xt,tableId:Vt,rafRef:Ut,renderFnRef:Kt,scheduleRender:Qt}=Ht;let Zt=Ht.margin;if(xt){const e=60,t=Object.assign({},Ht.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),Zt=t}const Jt="function"==typeof Je?Je({size:Yt,margin:Zt}):Je,eo="function"==typeof Ze?Ze({size:Yt,margin:Zt}):Ze,to=Yt[0]-Zt.left-Zt.right,oo=Yt[1]-Zt.top-Zt.bottom,no=t.useMemo(()=>k(j),[j]),io=null!=Pe?Pe:Be,ro=t.useRef(null),so=t.useRef(null),[ao,lo]=t.useState(0),[co,uo]=t.useState(null),ho=t.useRef(null),go=t.useRef(null),[fo,po]=t.useState(null),yo=t.useRef(oi.primary),mo=t.useRef([]),bo=t.useRef(Ke),xo=t.useRef(Qe);bo.current=Ke,xo.current=Qe;const[wo,jo]=t.useState(!1),[Ao,So]=t.useState([]),[Oo,Mo]=t.useState([]),_o="streaming"===x||["bar","swarm","waterfall"].includes(v),Lo=t.useMemo(()=>{var e,t,o;return{chartType:v,runtimeMode:_o?"streaming":"bounded",windowSize:F,windowMode:I,arrowOfTime:_o?H:"right",extentPadding:G,scalePadding:q,axisExtent:Me,xAccessor:M,yAccessor:C,timeAccessor:_o?W:void 0,valueAccessor:D,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(T?"_lineGroup":void 0),categoryAccessor:nt,lineDataAccessor:T,xScaleType:Ot,yScaleType:Mt,xExtent:z,yExtent:Y,sizeRange:X,binSize:$,normalize:B,baseline:E,stackOrder:N,boundsAccessor:le,boundsStyle:ce,y0Accessor:ue,band:de,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:fe?new Set(fe):void 0,lineGradient:ge,openAccessor:pe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,lineStyle:ee,pointStyle:te,areaStyle:oe,swarmStyle:re,waterfallStyle:ie,colorScheme:ae,barColors:se,barStyle:ne,annotations:De,decay:at,pulse:lt,transition:qt,introAnimation:Xt,staleness:dt,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,pointIdAccessor:kt,curve:R,themeCategorical:null===(e=null==Gt?void 0:Gt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(Gt),themeSequential:null===(t=null==Gt?void 0:Gt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Gt?void 0:Gt.colors)||void 0===o?void 0:o.diverging,customLayout:Et,layoutConfig:Nt,layoutMargin:Zt}},[v,F,I,H,G,q,Me,M,C,W,D,Ot,Mt,_,P,L,nt,T,z,Y,X,$,B,E,N,le,ce,ue,de,he,ge,fe,pe,ye,me,ve,be,ee,te,oe,re,ie,ne,ae,se,De,at,lt,null==qt?void 0:qt.duration,null==qt?void 0:qt.easing,Xt,dt,pt,yt,mt,vt,bt,_o,kt,R,Gt,Et,Nt,Zt]),Ro=Do(Lo),Bo=t.useRef(null);Bo.current||(Bo.current=new Ye(Ro));const Eo=t.useCallback(()=>{var e,t;const o=bo.current,n=xo.current;if(!n||!o)return;const i=Vn(null!==(t=null===(e=Bo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Un(i,mo.current)||(mo.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=Bo.current)||void 0===e||e.updateConfig(Ro),Dt.current=!0,Qt()},[Ro,Qt]);const Ho=t.useRef(null);Ho.current||(Ho.current=new w(e=>{const t=Bo.current;t&&t.ingest(e)&&(Dt.current=!0,Qt())},{chunkThreshold:A,chunkSize:O})),t.useEffect(()=>{var e;null===(e=Ho.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:O})},[A,O]);const Io=t.useCallback(e=>{var t;null===(t=Ho.current)||void 0===t||t.push(e)},[]),Fo=t.useCallback(e=>{var t;null===(t=Ho.current)||void 0===t||t.pushMany(e)},[]),Wo=t.useCallback(()=>{var e,t;null===(e=Ho.current)||void 0===e||e.clear(),null===(t=Bo.current)||void 0===t||t.clear(),Dt.current=!0,Qt()},[Qt]);t.useImperativeHandle(n,()=>({push:Io,pushMany:Fo,remove:e=>{var t,o,n;null===(t=Ho.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&&(ho.current&&i.some(e=>{var t;return e===(null===(t=ho.current)||void 0===t?void 0:t.data)})&&(ho.current=null,po(null)),Dt.current=!0,Qt()),i},update:(e,t)=>{var o,n,i;null===(o=Ho.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&&(Dt.current=!0,Qt()),r},clear:Wo,getData:()=>{var e,t,o;return null===(e=Ho.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}}),[Io,Fo,Wo,Qt]),t.useEffect(()=>{var e,t;if(j){if(T&&no.length>0&&"object"==typeof no[0]&&null!==no[0]){const t="string"==typeof T?T:"coordinates";if(Array.isArray(no[0][t])){const o=[];for(const e of no){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=Ho.current)||void 0===e||e.setBoundedData(o))}}null===(t=Ho.current)||void 0===t||t.setBoundedData(no)}},[j,no,T]);const{hoverHandlerRef:zo,hoverLeaveRef:Yo,onPointerMove:Go,onPointerLeave:Xo}=Ht;zo.current=e=>{var t,o;if(!io)return;const n=ro.current;if(!n)return;const i=n.getBoundingClientRect(),r=e.clientX-i.left-Zt.left,s=e.clientY-i.top-Zt.top;if(0>r||r>to||0>s||s>oo)return void(ho.current&&(ho.current=null,go.current=null,po(null),Te&&(Te(null),Dt.current=!0),Qt()));const a=Bo.current;if(!a||0===a.scene.length)return;const l=gt(a.scene,r,s,Ee,a.quadtree,a.maxPointRadius),c="multi"===$e,u=()=>{ho.current&&(ho.current=null,go.current=null,po(null),Te&&Te(null),Qt())};if(!l&&!c)return void u();const d=c||!l?r:l.x,h=c||!l?s:l.y;let g=pn((null==l?void 0:l.datum)?Ne(l.datum,a.resolvedRibbons):{},d,h);if(c&&a.scene.length>0&&a.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=ft(ht(e.path,e.curve),t,o);if(null===r)continue;const s=wt(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=ht(e.topPath,e.curve),s=ht(e.bottomPath,e.curve),a=ft(r,t,o);if(null===a)continue;const l=ft(s,t,o),c=wt(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}(a.scene,d,Math.max(Ee,to));if(e.length>0){const t=a.scales.y.invert,o=a.scales.x.invert,n=yo.current,i=o?o(d):d;if(l)g.xValue=i,g.xPx=d;else{const e={xValue:i};"string"==typeof M&&(e[M]=i),g=pn(e,d,h,{xValue:i,xPx:d})}g.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"===v&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:Ne(e.datum,a.resolvedRibbons)}})}}l||(null===(t=g.allSeries)||void 0===t?void 0:t.length)?(ho.current=g,go.current=null!==(o=null==l?void 0:l.node)&&void 0!==o?o:null,po(g),Te&&(Te(g),Dt.current=!0),Qt()):u()},Yo.current=()=>{ho.current&&(ho.current=null,go.current=null,po(null),Te&&(Te(null),Dt.current=!0),Qt())};const Vo=t.useRef(()=>{});Vo.current=e=>{if(!Re)return;const t=ro.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Zt.left,i=e.clientY-o.top-Zt.top;if(0>n||n>to||0>i||i>oo)return void Re(null);const r=Bo.current;if(!r||0===r.scene.length)return void Re(null);const s=gt(r.scene,n,i,Ee,r.quadtree,r.maxPointRadius);Re(s?pn(s.datum||{},s.x,s.y):null)};const Uo=t.useCallback(e=>Vo.current(e),[]),Ko=t.useRef(-1),Qo=t.useRef(null),Zo=t.useRef(null),Jo=t.useCallback(e=>{const t=Bo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Zo.current&&Zo.current.version===o)n=Zo.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=jt(e),Zo.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 o=n.flat[0];Qo.current={shape:o.shape,w:o.w,h:o.h};const i=Ct(Object.assign(Object.assign({},o),{datum:Ne(o.datum,t.resolvedRibbons)}));return ho.current=i,po(i),Te&&Te(i),void Qt()}const r=At(n,i),s=St(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Ko.current=-1,Qo.current=null,ho.current=null,go.current=null,po(null),Te&&Te(null),void Qt();Ko.current=s;const a=n.flat[s];Qo.current={shape:a.shape,w:a.w,h:a.h};const l=Ct(Object.assign(Object.assign({},a),{datum:Ne(a.datum,t.resolvedRibbons)}));ho.current=l,po(l),Te&&Te(l),Qt()},[Te,Qt]),en=t.useCallback(e=>{Ko.current=-1,Qo.current=null,Go(e)},[Go]);Kt.current=()=>{var e,t;Ut.current=0;const o=ro.current,n=so.current;if(!o||!n)return;const i=Bo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Wt.current?r+1e6:r),a=!Wt.current&&s,l=Dt.current||s;l&&!a&&(i.computeScene({width:to,height:oo}),Eo());const c=_n(),u=function(e){if(!e)return oi;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||oi.axisStroke,tickText:s||oi.tickText,crosshair:s?ni(s,"66"):oi.crosshair,hoverFill:c?ni(c,"4D"):oi.hoverFill,hoverStroke:s?ni(s,"99"):oi.hoverStroke,pointRing:c||oi.pointRing,primary:r||oi.primary}:oi}(o);yo.current=u.primary;const d=null!==(e=null==dt?void 0:dt.threshold)&&void 0!==e?e:5e3,h=dt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=Cn(o,Yt,Zt,c);if(e){if(e.clearRect(-Zt.left,-Zt.top,Yt[0],Yt[1]),h&&(e.globalAlpha=null!==(t=null==dt?void 0:dt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==J&&!Ze){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=J||(t&&"transparent"!==t?t:null),i=n?rt(e,n):null;i&&(e.fillStyle=i,e.fillRect(-Zt.left,-Zt.top,Yt[0],Yt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,to,oo),e.clip()),et&&i.scales)for(const t of et)e.save(),t(e,i.scene,i.scales,{width:to,height:oo}),e.restore();const n=Et?ei.custom:ei[v];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:to,height:oo});e.restore(),h&&(e.globalAlpha=1)}}{const e=Cn(n,Yt,Zt,c);if(e&&(e.clearRect(-Zt.left,-Zt.top,Yt[0],Yt[1]),io&&ho.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,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u: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(u,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,ho.current,to,oo,"object"==typeof io?io:{},go.current,u),go.current&&Array.isArray(Pe))){const t=Pe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s="group"in o?o.group:void 0;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,go.current,t,u)}}l&&o&&o.setAttribute("aria-label",qo(i.scene,v+" chart"));const g=Dt.current;if(Dt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!co||e(co.x.domain()[0])!==e(i.scales.x.domain()[0])||e(co.x.domain()[1])!==e(i.scales.x.domain()[1])||e(co.y.domain()[0])!==e(i.scales.y.domain()[0])||e(co.y.domain()[1])!==e(i.scales.y.domain()[1])||co.x.range()[0]!==i.scales.x.range()[0]||co.x.range()[1]!==i.scales.x.range()[1]||co.y.range()[0]!==i.scales.y.range()[0]||co.y.range()[1]!==i.scales.y.range()[1])&&uo(i.scales),xt){const e=i.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof C?C:e=>e[C||"y"];So(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&&De&&De.length>0&&lo(e=>e+1),(null==dt?void 0:dt.showBadge)&&jo(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Ut.current=requestAnimationFrame(()=>Kt.current()))},$o({hydrated:It,wasHydratingFromSSR:Ft,storeRef:Bo,dirtyRef:Dt,renderFnRef:Kt,cleanup:()=>{var e;return null===(e=Ho.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Dt.current=!0,Qt()},[v,to,oo,xe,J,ee,et,Qt]),_t(dt,Bo,Dt,Qt,wo,jo);const tn=t.useMemo(()=>{if(Se||Ce)return;const e=Bo.current;return(null==e?void 0:e.xIsDate)&&co?Jn(co.x.domain()):void 0},[Se,Ce,co]),on=Se||Ce||tn,nn=io&&fo?Le?Le(fo):e.jsx(ri,{hover:fo}):null,rn=nn?e.jsx(wn,{x:fo.x,y:fo.y,containerWidth:to,containerHeight:oo,margin:Zt,className:"stream-frame-tooltip",children:nn}):null,sn=Qo.current,ln=e.jsx(gn,{active:Ko.current>=0,hoverPoint:fo,margin:Zt,size:Yt,shape:null==sn?void 0:sn.shape,width:null==sn?void 0:sn.w,height:null==sn?void 0:sn.h}),hn=Kn(M,W,"__semiotic_resolvedX","__semiotic_resolvedTime"),fn=Kn(C,D,"__semiotic_resolvedY","__semiotic_resolvedValue"),yn=hn.key,mn=fn.key,vn=Qn(hn,fn,De&&De.length>0||!1);if(Po||!It&&Ft){const t=Bo.current;t&&j&&(t.ingest({inserts:no,bounded:!0}),t.computeScene({width:to,height:oo}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,a=on||(()=>{if((null==t?void 0:t.xIsDate)&&n)return Jn(n.x.domain())})();return e.jsxs("div",{ref:zt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"img","aria-label":Lt||("string"==typeof ot?ot:"XY chart"),style:{position:"relative",width:U?"100%":Yt[0],height:K?"100%":Yt[1]},children:[e.jsx(cn,{summary:Tt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Yt[0],height:Yt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:eo}),e.jsxs("g",{transform:`translate(${Zt.left},${Zt.top})`,children:[J&&e.jsx("rect",{x:0,y:0,width:to,height:oo,fill:J}),tt&&n&&tt.map((t,i)=>e.jsx(p.Fragment,{children:t(o,n,{width:to,height:oo})},"svgpre-"+i)),o.map((t,o)=>function(t,o,n){var i,r,s,a,l;switch(t.type){case"line":{const n=t;if(0===n.path.length)return null;const i="M"+n.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity},"line-"+o)}case"area":{const l=t;if(0===l.topPath.length)return null;const c=`M${l.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...l.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(l.clipRect){const t=`${n?n+"-":""}area-clip-${o}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:l.clipRect.x,y:l.clipRect.y,width:l.clipRect.width,height:l.clipRect.height})})}),e.jsx("path",{d:c,fill:Co(l.style.fill),fillOpacity:null!==(r=null!==(i=l.style.fillOpacity)&&void 0!==i?i:l.style.opacity)&&void 0!==r?r:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+o)}return e.jsx("path",{d:c,fill:Co(l.style.fill),fillOpacity:null!==(a=null!==(s=l.style.fillOpacity)&&void 0!==s?s:l.style.opacity)&&void 0!==a?a:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth},"area-"+o)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:Co(n.style.fill),opacity:null!==(l=n.style.opacity)&&void 0!==l?l:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"point-"+o)}case"rect":{const n=t;return e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:Co(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"rect-"+o)}case"heatcell":{const n=t;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const t=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[i,r,s]=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]}(n.fill),a=.299*i+.587*r+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),e.jsx("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:t})]},"heatcell-"+o)}return e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+o)}case"candlestick":{const n=t,i=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),s=n.isUp?n.upColor:n.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),e.jsx("rect",{x:n.x-n.bodyWidth/2,y:i,width:n.bodyWidth,height:r,fill:s,stroke:s,strokeWidth:1})]},"candle-"+o)}default:return null}}(t,o,$t)).filter(Boolean)]})]}),e.jsx(ko,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,scales:n,showAxes:xe,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:a,yFormat:Oe||_e,axisExtent:Me,showGrid:Ie,title:ot,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:qe,legendIsolatedCategories:Xe,legendPosition:Ve,legendLayout:Ue,foregroundGraphics:Ge(Jt,null===(s=Bo.current)||void 0===s?void 0:s.customLayoutOverlays),marginalGraphics:xt,xValues:[],yValues:[],annotations:De,svgAnnotationRules:He,annotationFrame:0,xAccessor:yn,yAccessor:mn,annotationData:vn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,linkedCrosshairName:Rt,linkedCrosshairSourceId:Bt})]})}return e.jsxs("div",{ref:zt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"group","aria-label":Lt||("string"==typeof ot?ot:"XY chart"),tabIndex:0,style:{position:"relative",width:U?"100%":Yt[0],height:K?"100%":Yt[1],overflow:"visible"},onKeyDown:Jo,children:[Pt&&e.jsx(un,{tableId:Vt}),Pt&&e.jsx(an,{scene:null!==(l=null===(a=Bo.current)||void 0===a?void 0:a.scene)&&void 0!==l?l:[],chartType:v+" chart",tableId:Vt,chartTitle:"string"==typeof ot?ot:void 0}),e.jsx(cn,{summary:Tt}),e.jsxs("div",{role:"img","aria-label":Lt||("string"==typeof ot?ot:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:io?en:void 0,onMouseLeave:io?Xo:void 0,onClick:Re?Uo:void 0,children:[eo&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Yt[0],height:Yt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:eo})}),e.jsx(vo,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,scales:co,showAxes:xe,axes:ke,showGrid:Ie,xFormat:on,yFormat:Oe||_e,axisExtent:Me}),e.jsx("canvas",{ref:ro,"aria-label":qo(null!==(u=null===(c=Bo.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],v+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:so,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(dn,{hoverPoint:fo}),e.jsx(ko,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,scales:co,showAxes:xe,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:on,yFormat:Oe||_e,axisExtent:Me,showGrid:Ie,title:ot,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:qe,legendIsolatedCategories:Xe,legendPosition:Ve,legendLayout:Ue,foregroundGraphics:Ge(Jt,null===(d=Bo.current)||void 0===d?void 0:d.customLayoutOverlays),marginalGraphics:xt,xValues:Ao,yValues:Oo,annotations:De,svgAnnotationRules:He,annotationFrame:ao,xAccessor:yn,yAccessor:mn,annotationData:vn(null===(h=Bo.current)||void 0===h?void 0:h.getData()),pointNodes:null===(g=Bo.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==J&&!Ze,linkedCrosshairName:Rt,linkedCrosshairSourceId:Bt}),(it||st)&&e.jsx(b,{width:to,height:oo,totalWidth:Yt[0],totalHeight:Yt[1],margin:Zt,dimension:null!==(f=null==it?void 0:it.dimension)&&void 0!==f?f:"xy",scales:co,onBrush:null!=st?st:()=>{},binSize:$,snap:null==it?void 0:it.snap,binBoundaries:null!==(y=null==it?void 0:it.binBoundaries)&&void 0!==y?y:"bar"===v?null===(m=Bo.current)||void 0===m?void 0:m.getBinBoundaries():void 0,snapDuring:null==it?void 0:it.snapDuring,streaming:"streaming"===x}),(null==dt?void 0:dt.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===dt.badgePosition?{top:4,left:4}:"bottom-left"===dt.badgePosition?{bottom:4,left:4}:"bottom-right"===dt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:wo?"#dc3545":"#28a745",color:"white"}),children:wo?"STALE":"LIVE"}),ln,rn]})]})});function ai(e,t){var o;const{columns:n,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,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(n),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=d&&!g&&h.length>1&&(null!==(o=i.cornerRadius)&&void 0!==o?o:0)>0;for(let e=0;h.length>e;e++){const t=h[e],o=t.pieceData[0],n="number"==typeof(null==o?void 0:o._pctStart)?o._pctStart:t.pctStart,d=c+n*u,g=c+(n+("number"==typeof(null==o?void 0:o._pct)?o._pct:t.pct))*u,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:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==o?void 0:o._nonInteractive)?null:t.pieceData,category:t.name});(null==o?void 0:o._roundedEnds)?v.roundedEnds=o._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==o?void 0:o._gradientBand)&&(v._gradientBand=o._gradientBand),s.push(v)}return s}function li(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=a.quantile(e,.25))&&void 0!==t?t:r,median:null!==(o=a.quantile(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=a.quantile(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function ci(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ye[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function ui(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"}}si.displayName="StreamXYFrame";const di={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,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 o of t.pieceData){const t=c(o);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 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 m){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(F(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(F(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=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!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n: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 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(v?(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(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:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="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(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(F(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(F(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,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),u=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,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales: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),u=r(n,e.name),d=u.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:d,style:u,datum:n})}}return l},pie:ai,donut:ai,boxplot:function(e,t){var o,n,i,r,s,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:p}=c,y=[],m="vertical"===p,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],p=null!==(o=a.quantile(c,.25))&&void 0!==o?o:u,b=null!==(n=a.quantile(c,.5))&&void 0!==n?n:(u+d)/2,x=null!==(i=a.quantile(c,.75))&&void 0!==i?i:d,k=x-p,w=p-1.5*k,j=x+1.5*k,A=null!==(r=c.find(e=>e>=w))&&void 0!==r?r:u,S=null!==(s=[...c].reverse().find(e=>j>=e))&&void 0!==s?s:d,O=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const o=h(e);if(w>o||o>j){const n=m?t.middle:f(o),i=m?f(o):t.middle;M.push({px:n,py:i,value:o,datum:e})}}if(y.push({type:"boxplot",x:m?t.middle:0,y:m?0:t.middle,projection:m?"vertical":"horizontal",columnWidth:.6*t.width,minPos:f(A),q1Pos:f(p),medianPos:f(b),q3Pos:f(x),maxPos:f(S),stats:{n:c.length,min:A,q1:p,median:b,q3:x,max:S,mean:c.reduce((e,t)=>e+t,0)/c.length},style:O,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],l=(s-r)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-r)/l),p-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(f){b=`M ${e.middle} ${d(r)}`;for(let t=0;p>t;t++){const o=d(r+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${o}`}b+=` L ${e.middle} ${d(s)}`;for(let t=p-1;t>=0;t--){const o=d(r+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${o}`}b+=" Z"}else{b=`M ${d(r)} ${e.middle}`;for(let t=0;p>t;t++)b+=` L ${d(r+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)b+=` L ${d(r+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const l=null!==(o=a.quantile(t,.25))&&void 0!==o?o:r,c=null!==(n=a.quantile(t,.5))&&void 0!==n?n:(r+s)/2,u=null!==(i=a.quantile(t,.75))&&void 0!==i?i:s;k={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:f}}const w=f?{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};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:k,stats:li(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=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)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(F(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,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-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(n)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${o}`}m+=` L ${t} ${l(i)} Z`}const v=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))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:li(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},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,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(F(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(F(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var o,n,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const k=b.length>1&&"_default"!==b[0],w=[];let j=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=g?g(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(n);i.total+=r,i.pieces.push(n),o+=r}w.push({col:e,groups:t,stepTotal:o}),k||o>j&&(j=o)}if(k)for(const e of w){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>j&&(j=n)}if(0===j)return p;const A=new Map;for(const e of b){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=w[0].stepTotal,O=k?.95*y:.9*t.width,M=i.scaleLinear().domain([0,j]).range([0,O]),C=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let _=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,i=0===t,d=n.width,h=.55*d,g=n.x+(d-h)/2,v=new Map;if(k){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=M(n.total))}let t=y,r=y;for(let s=0;b.length>s;s++){const l=b[s],c=o.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const k=f(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,j=w>0?c.total/w*100:0,S=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:n.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});m&&(0===s&&(S.__funnelStepLabel=n.name,S.__funnelStepLabelX=y,S.__funnelStepLabelY=g,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+u/2,S.__funnelValueLabelY=g,S.__funnelBarW=u),p.push(F(x,g,u,h,k,S,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=o.stepTotal,t=M(e),a=y-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=o.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:n.pieceData[0],d=c?l:n.name,x=f(u,d),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:i,category:c?l:n.name});m&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=y,w.__funnelStepLabelY=g,w.__funnelRowWidth=t,w.__funnelValueLabelX=y,w.__funnelValueLabelY=g,w.__funnelBarW=t),p.push(F(a,g,t,h,x,w,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&_.size>0){const t=k?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return f(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),a={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===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=o.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:n.pieceData[0],category:"_default"===i?n.name:i};p.push(a)}}_=v}return p},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],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 m=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);m.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const v=u.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,u=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,j=n?0:Math.max(0,w-y),A=o.x+e*a+l/2,S=v(y),O=v(0)-S,M=c(f.pieces[0],p?h:o.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(y+j)});if(d.push(F(A,S,u,O,M,C,p?h:o.name)),j>0){const e=v(y+j),t=S-e,n=Object.assign({},M),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:j,__barFunnelPercent:b>0?j/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(F(A,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"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=d?F(s,o.x,a,o.width,n,null,"__track__"):F(o.x,s,o.width,a,n,null,"__track__");u.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=u.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(d){const r=l(t),s=l(t+n);f=F(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=F(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=n}if(p>0&&u.length>o){const e=u.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:d?(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 u}};class hi{constructor(e){this.rExtent=new E,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 B(e.windowSize),this.getO=q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new E)):(this.getR=Y(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(e.connectorAccessor),this.getDataId=q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new B(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(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(n),a=this.computeValueDomain(n,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=i.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;h=i.scaleLinear().domain(a).range([n,o])}else l?(d=i.scaleBand().domain(s).range([0,e.height]).padding(u),h=i.scaleLinear().domain(a).range([0,e.width])):(d=i.scaleBand().domain(s).range([0,e.width]).padding(u),h=i.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(o,n);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?i.scaleLinear().domain([c,u]).range([0,e.width]):i.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=n;this.rAccessors.length>1&&(g=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(g,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,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,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=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>u&&(u=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>u&&(u=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>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(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>u&&(u=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,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 u=null;if(c&&"radial"!==n){u=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),u.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 u)u.set(t,o/e*r)}let d=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;u?(c=h,g=u.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:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){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=di[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,u=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)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(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=ci(r.colorScheme,r.themeCategorical,ve),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:ui(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||ve,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?Ae(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,hi.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=r.quadtree().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 u=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;u||(u=this.getCategoryIndexMap(t));const n=u.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,u,d,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 j=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(j.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(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)d?(j.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,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(d)j.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!j.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const 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!==(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: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:_e(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=Me(e,this.activeTransition),s=Oe(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=Ce(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=Ce(n.x,e._targetX,s),e.y=Ce(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=Ce(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=Ce(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,s),e.y=Ce(o.y,e._targetY,s),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,s),e.h=Ce(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:Ce(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=Ce(o.startAngle,e._targetStartAngle,s),e.endAngle=Ce(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&&!z(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!z(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!z(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(z(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!z(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new E)):(this.getR=Y(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!z(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!z(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!z(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function gi(e,t,o){const n=qe(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function fi(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Xe(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function pi(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=Ke(Math.atan2(i,n)),a=Ke(e.startAngle),l=Ke(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function yi(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 mi(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 vi(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=o,{rTickValues:h,axisExtent:g}=o,f="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),y=t.useMemo(()=>!l||f?[]:(h||ho(l.r,5,g)).map(e=>({value:e,pixel:l.r(e),label:(d||bi)(e)})),[l,d,f,h,g]),m=u&&l&&!f,v=c&&l&&!f;return m||v?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&e.jsx("g",{className:"ordinal-grid",children:y.map((t,o)=>e.jsx("line",{x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:n,y2:p?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,p?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function bi(e){return Math.round(100*e)/100+""}function xi(o){var n,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showCategoryTicks:h,oLabel:g,rLabel:f,oFormat:p,rFormat:y,showGrid:m,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:j,legendPosition:A="right",legendLayout:S,foregroundGraphics:O,annotations:M,svgAnnotationRules:C,xAccessor:_,yAccessor:P,annotationData:L,underlayRendered:T,children:R}=o,B="radial"===(null==u?void 0:u.projection),E="horizontal"===(null==u?void 0:u.projection),N=!1!==h,$=t.useMemo(()=>d&&N&&u&&!B?u.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=u.o(e))&&void 0!==o?o:0)+u.o.bandwidth()/2,label:p?p(e,t):e}}):[],[d,N,u,p,B]),D=o.rTickValues,H=o.tickLabelEdgeAlign,I=o.axisExtent,F=t.useMemo(()=>d&&u&&!B?(D||ho(u.r,5,I)).map(e=>({value:e,pixel:u.r(e),label:(y||bi)(e)})):[],[d,u,y,B,D,I]),W=t.useRef(new Map),z=t.useRef(null!==(n=null==M?void 0:M.length)&&void 0!==n?n:0),Y=null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0;z.current!==Y&&(z.current=Y,W.current=new Map);const G=t.useMemo(()=>{if(!M||0===M.length)return null;const e=eo(),t="horizontal"===(null==u?void 0:u.projection),o=(null==u?void 0:u.o)?e=>{var t;return(null!==(t=u.o(e))&&void 0!==t?t:0)+u.o.bandwidth()/2}:null,n={scales:u?{x:t?u.r:o||u.r,y:t&&o||u.r,time:u.r,value:u.r,o:u.o}:null,timeAxis:"x",xAccessor:_,yAccessor:P,width:r,height:s,data:L,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:W.current};return M.map((t,o)=>{if(C){const i=C(t,o,n);return null!=i?i:e(t,o,n)}return e(t,o,n)}).filter(Boolean)},[M,C,r,s,u,_,P,L]);return d||v||b||O||G&&G.length>0||m||R?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof v?v:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof v?v+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[m&&u&&!B&&!T&&e.jsx("g",{className:"ordinal-grid",children:F.map((t,o)=>e.jsx("line",{x1:E?t.pixel:0,y1:E?0:t.pixel,x2:E?t.pixel:r,y2:E?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),d&&u&&!B&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 10px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,E?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!T&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((o,n)=>e.jsxs("g",{transform:`translate(0,${o.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},t),children:o.label})})]},"cat-"+n)),g&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!T&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!T&&(null==u?void 0:u.r)&&(()=>{const t=u.r(0);return t>1&&r-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),F.map((o,n)=>{const i=H?0===n?"start":n===F.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${o.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label})]},"val-"+n)}),f&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:f})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!T&&(()=>{const t=(null==u?void 0:u.r)?u.r(0):s,o=0>t||t>s?s:t;return e.jsx("line",{x1:0,y1:o,x2:r,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),$.map((o,n)=>e.jsxs("g",{transform:`translate(${o.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},t),children:o.label})})]},"cat-"+n)),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!T&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((o,n)=>e.jsxs("g",{transform:`translate(0,${o.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label})]},"val-"+n)),f&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:f})]})]})})})(),G,O,R]}),v&&e.jsx("text",{x:a/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 v?v:null}),Ht({legend:b,totalWidth:a,totalHeight:l,margin:c,legendPosition:A,title:v,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:j})]}):null}function ki({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,scales:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(u);g.current=u;const f=t.useRef(c);f.current=c;const p=t.useRef(!1),y=t.useRef(null),m="horizontal"===(null==c?void 0:c.projection),v=t.useRef(m);return v.current=m,t.useEffect(()=>{if(!d.current)return;const e=o.select(d.current).select(".brush-g"),t=m?n.brushX():n.brushY();return t.extent([[0,0],[i,r]]),t.on("brush end",e=>{if(p.current)return;const t=f.current;if(!t)return;if(!e.selection)return y.current=null,void g.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};y.current=r,g.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[i,r,m]),t.useEffect(()=>{if(!c||!h.current||!y.current)return;if(!d.current)return;const e=y.current,t=o.select(d.current).select(".brush-g"),n=c.r(e.r[0]),i=c.r(e.r[1]);m?(p.current=!0,t.call(h.current.move,[n,i]),p.current=!1):(p.current=!0,t.call(h.current.move,[i,n]),p.current=!1)},[c,m]),e.jsx("svg",{ref:d,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`,style:{pointerEvents:"all"}})})}function wi(e,t){var o,n,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=Oo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(n=null===(o=t.roundedEnds)||void 0===o?void 0:o.start)||void 0===n||n,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=rt(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function ji(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 Ai(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=s.arc().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(n);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}hi.QUADTREE_THRESHOLD=500;const Si=(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;if(e.globalAlpha=o*n,t._gradientBand&&t._gradientBand.colors.length>0)wi(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(ji(e,t),Nn(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?rt(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=So({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 n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Ai(e,t)):(ji(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(ji(e,t),Nn(e,t)),e.globalAlpha=1}}},Oi=(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=rt(e,"var(--semiotic-primary, #007bff)"),a=rt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?rt(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?rt(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),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()}},Mi=(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?rt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(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()}},Ci=(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=rt(e,o.style.stroke)||("string"==typeof o.style.fill?rt(e,o.style.fill):o.style.fill)||rt(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}},_i=(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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Pi(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 Li(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Ti=null;function Ri(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):(Ti||(Ti=document.createElement("canvas")),Ti.width=e,Ti.height=e,Ti)}(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 u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Bi=new Map;function Ei(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Bi.get(o);if(void 0!==n)return n;const i=Ri({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Bi.set(o,i),i}function Ni(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 $i(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 Di(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Hi=e=>[Ci,...e],Ii={bar:Hi([Wn]),clusterbar:Hi([Wn]),point:Hi([Hn]),swarm:Hi([Hn]),pie:[Si],donut:[Si],boxplot:Hi([Oi,Hn]),violin:Hi([Mi]),histogram:Hi([Wn]),ridgeline:Hi([Mi]),timeline:Hi([Wn]),funnel:[Wn,_i,(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?Pi(i):null!=r?`${Pi(i)} (${Li(r)})`:Pi(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=Pi(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(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,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Wn,(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)||rt(e,"var(--semiotic-border, #999)"),n=Ei(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]=st(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,rt(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,u=r?Di(i):"",d=$i(n);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,m=y-f/2,v=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(),Ni(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Ni(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(u,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3))}e.lineWidth=1}],swimlane:Hi([Wn]),custom:Hi([Wn,Hn,Si,Oi,Mi,_i])},Fi={top:50,right:40,bottom:60,left:70},Wi={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 zi({hover:t}){var o,n,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(o=l[0])||void 0===o?void 0:o.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[n," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:Wi,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(a=null!==(s=null!==(r=null!==(i=null!==(n=l.__aggregateValue)&&void 0!==n?n:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:Wi,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:Wi,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==p&&e.jsx("div",{children:"number"==typeof p?p.toLocaleString():p+""})]})}zi.ownsChrome=!0;const Yi=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,h,g,f,y;const{chartType:m,runtimeMode:v,data:b,oAccessor:x="category",rAccessor:j="value",colorAccessor:A,stackBy:O,groupBy:M,multiAxis:C,timeAccessor:_,valueAccessor:P,categoryAccessor:L,projection:T="vertical",size:R=[600,400],responsiveWidth:B,responsiveHeight:E,margin:N,barPadding:$,roundedTop:D,gradientFill:H,trackFill:I,baselinePadding:F,innerRadius:W,cornerRadius:z,normalize:Y,startAngle:G,sweepAngle:q,dynamicColumnWidth:X,bins:V,showOutliers:U,showIQR:K,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:ee,connectorStyle:te,dataIdAccessor:oe,rExtent:ne,oExtent:ie,extentPadding:re=.05,oSort:se,windowMode:ae="sliding",windowSize:le=200,pieceStyle:ce,summaryStyle:ue,colorScheme:de,barColors:he,showAxes:ge=!0,showCategoryTicks:fe,categoryLabel:pe,valueLabel:ye,categoryFormat:me,valueFormat:ve,oLabel:be,rLabel:xe,oFormat:ke,rFormat:we,rTickValues:je,tickLabelEdgeAlign:Ae,axisExtent:Se,enableHover:Oe=!0,hoverAnnotation:Me,tooltipContent:Ce,customHoverBehavior:_e,annotations:Pe,svgAnnotationRules:Le,showGrid:Te=!1,legend:Re,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:De,legendLayout:He,legendCategoryAccessor:Ie,onCategoriesChange:Fe,backgroundGraphics:We,foregroundGraphics:ze,title:Ye,className:qe,background:Xe,centerContent:Ve,decay:Ue,pulse:Ke,transition:Ze,animate:Je,staleness:et,brush:tt,onBrush:ot,accessibleTable:nt=!0,description:it,summary:st,customLayout:at,layoutConfig:lt}=o,ct=t.useRef(!0),ut=Mn({sizeProp:R,responsiveWidth:B,responsiveHeight:E,userMargin:N,marginDefault:Fi,foregroundGraphics:ze,backgroundGraphics:We,animate:Je,transitionProp:Ze,themeDirtyRef:ct}),{reducedMotionRef:dt,responsiveRef:ht,size:gt,margin:ft,adjustedWidth:pt,adjustedHeight:yt,resolvedForeground:mt,resolvedBackground:vt,currentTheme:bt,transition:xt,introEnabled:kt,tableId:wt,rafRef:Ot,renderFnRef:Mt,scheduleRender:Pt}=ut,Lt=To(),Tt=No(),Rt=t.useMemo(()=>k(b),[b]),Bt=null!=pe?pe:be,Et=null!=ye?ye:xe,Nt=null!=me?me:ke,$t=null!=ve?ve:we,Dt=t.useRef(null),Ht=t.useRef(null),It=t.useRef([]),Ft=t.useRef(Ie),Wt=t.useRef(Fe);Ft.current=Ie,Wt.current=Fe;const[zt,Yt]=t.useState(null),[Gt,qt]=t.useState(null),[Xt,Vt]=t.useState(0),[Ut,Kt]=t.useState(!1),[Qt,Zt]=t.useState(null),Jt=t.useCallback(()=>{var e,t;Zt(null!==(t=null===(e=io.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),eo=Oe||Me,to="streaming"===v,oo=t.useMemo(()=>{var e,t,o;return{chartType:m,runtimeMode:to?"streaming":"bounded",windowSize:le,windowMode:ae,extentPadding:re,projection:T,oAccessor:to?void 0:x,rAccessor:to?void 0:j,colorAccessor:A,stackBy:O,groupBy:M,multiAxis:C,timeAccessor:to?_:void 0,valueAccessor:to?P||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:to?L||x:void 0,rExtent:ne,oExtent:ie,axisExtent:Se,barPadding:$,roundedTop:D,gradientFill:H,trackFill:I,baselinePadding:F,innerRadius:W,cornerRadius:z,normalize:Y,startAngle:G,sweepAngle:q,dynamicColumnWidth:X,bins:V,showOutliers:U,showIQR:K,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:ee,connectorStyle:te,dataIdAccessor:oe,oSort:se,pieceStyle:ce,summaryStyle:ue,colorScheme:de,themeCategorical:null===(e=null==bt?void 0:bt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(bt),themeSequential:null===(t=null==bt?void 0:bt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==bt?void 0:bt.colors)||void 0===o?void 0:o.diverging,barColors:he,decay:Ue,pulse:Ke,transition:xt,introAnimation:kt,staleness:et,customLayout:at,layoutConfig:lt,layoutMargin:ft}},[m,le,ae,re,T,x,j,A,O,M,C,_,P,L,ne,ie,Se,$,D,H,I,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee,te,oe,se,ce,ue,de,he,Ue,Ke,null==xt?void 0:xt.duration,null==xt?void 0:xt.easing,kt,et,to,bt,at,lt,ft]),no=Do(oo),io=t.useRef(null);io.current||(io.current=new hi(no));const ro=t.useCallback(()=>{var e,t;const o=Ft.current,n=Wt.current;if(!n||!o)return;const i=Vn(null!==(t=null===(e=io.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Un(i,It.current)||(It.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=io.current)||void 0===e||e.updateConfig(no),ct.current=!0,Pt()},[no,Pt]);const so=t.useRef(null);so.current||(so.current=new w(e=>{const t=io.current;t&&t.ingest(e)&&(ct.current=!0,Pt())}));const ao=t.useCallback(e=>{var t;null===(t=so.current)||void 0===t||t.push(e)},[]),lo=t.useCallback(e=>{var t;null===(t=so.current)||void 0===t||t.pushMany(e)},[]),co=t.useCallback(()=>{var e,t;null===(e=so.current)||void 0===e||e.clear(),null===(t=io.current)||void 0===t||t.clear(),ct.current=!0,Pt()},[Pt]),uo=t.useCallback(e=>{var t,o;null===(t=so.current)||void 0===t||t.clearLastData(),null===(o=so.current)||void 0===o||o.setReplacementData(e)},[]);t.useImperativeHandle(n,()=>({push:ao,pushMany:lo,replace:uo,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=Ht.current)||void 0===i?void 0:i.data;!!Ht.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Ht.current=null,Yt(null)),ct.current=!0,Pt()}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&&(ct.current=!0,Pt()),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,uo,co,Pt]),t.useEffect(()=>{var e;b&&(null===(e=so.current)||void 0===e||e.setBoundedData(Rt))},[b,Rt]);const{hoverHandlerRef:ho,hoverLeaveRef:go,onPointerMove:fo,onPointerLeave:po}=ut;ho.current=e=>{if(!eo)return;const t=Dt.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(Ht.current&&(Ht.current=null,Yt(null),_e&&_e(null),Pt()));const r=io.current;if(!r||0===r.scene.length)return;const s="radial"===T,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Qe(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=gi(r,t,o);break;case"point":if(i)break;e=fi(r,t,o,n);break;case"wedge":if(null===r.datum)break;e=pi(r,t,o);break;case"boxplot":e=yi(r,t,o);break;case"violin":e=mi(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-pt/2:n,s?i-yt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Ht.current&&(Ht.current=null,Yt(null),_e&&_e(null),Pt()));const l=pn(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 x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m}));Ht.current=l,Yt(l),_e&&(_e(l),ct.current=!0),Pt()},go.current=()=>{Ht.current&&(Ht.current=null,Yt(null),_e&&(_e(null),ct.current=!0),Pt())};const yo=t.useRef(-1),mo=t.useRef(null),vo=t.useRef(null),bo=t.useCallback(e=>{const t=io.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(vo.current&&vo.current.version===o)n=vo.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){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;n=jt(e),vo.current={version:o,graph:n}}const i=yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),yo.current=0;const t=n.flat[0];mo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Ct(t)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});return Ht.current=o,Yt(o),_e&&_e(o),void Pt()}const r=At(n,i),s=St(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return yo.current=-1,mo.current=null,Ht.current=null,Yt(null),_e&&_e(null),void Pt();yo.current=s;const a=n.flat[s];mo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Ct(a)),{__oAccessor:"string"==typeof x?x:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:m});Ht.current=l,Yt(l),_e&&_e(l),Pt()},[_e,Pt]),xo=t.useCallback(e=>{yo.current=-1,mo.current=null,fo(e)},[fo]);Mt.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(dt.current?r+1e6:r),a=!dt.current&&s,l=ct.current;l&&!s&&(i.computeScene({width:pt,height:yt}),ro(),Jt(),ct.current=!1),(l||a)&&o.setAttribute("aria-label",qo(i.scene,m+" chart"));const c=_n(),u=gt[0]*c,d=gt[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=gt[0]+"px",o.style.height=gt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,gt[0],gt[1]);const h=null!==(e=null==et?void 0:et.threshold)&&void 0!==e?e:5e3,g=et&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==et?void 0:et.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Xe&&!We){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Xe||(e&&"transparent"!==e?e:null),i=t?rt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,gt[0],gt[1]))}const f="radial"===T;n.save(),n.beginPath(),n.rect(ft.left,ft.top,pt,yt),n.clip(),f?(n.save(),n.translate(ft.left+pt/2,ft.top+yt/2)):n.translate(ft.left,ft.top);const p=at?Ii.custom:Ii[m]||[],y={width:pt,height:yt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(qt(i.scales),Vt(e=>e+1)),(null==et?void 0:et.showBadge)&&Kt(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Ot.current=requestAnimationFrame(()=>Mt.current()))},$o({hydrated:Lt,wasHydratingFromSSR:Tt,storeRef:io,dirtyRef:ct,renderFnRef:Mt,cleanup:()=>{var e;return null===(e=so.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{ct.current=!0,Pt()},[m,pt,yt,ge,Xe,Pt]),_t(et,io,ct,Pt,Ut,Kt);const ko=eo&&zt?Ce?Ce(zt):e.jsx(zi,{hover:zt}):null,Ao="radial"===T,Lo=ko?e.jsx(wn,{x:zt?Ao?zt.x+pt/2:zt.x:0,y:zt?Ao?zt.y+yt/2:zt.y:0,containerWidth:pt,containerHeight:yt,margin:ft,className:"stream-ordinal-tooltip",children:ko}):null,Ro=Kn(x,void 0,"__semiotic_resolvedO",""),Bo=Kn(j,void 0,"__semiotic_resolvedR",""),Eo=Ro.key,Ho=Bo.key,Io=Qn(Ro,Bo,Pe&&Pe.length>0||!1);if(Po||!Lt&&Tt){const t=io.current;t&&b&&(t.ingest({inserts:Rt,bounded:!0}),t.computeScene({width:pt,height:yt}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===T,c=l?ft.left+pt/2:ft.left,u=l?ft.top+yt/2:ft.top;return e.jsxs("div",{ref:ht,className:"stream-ordinal-frame"+(qe?" "+qe:""),role:"img","aria-label":it||("string"==typeof Ye?Ye:"Ordinal chart"),style:{position:"relative",width:B?"100%":gt[0],height:E?"100%":gt[1]},children:[e.jsx(cn,{summary:st}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:gt[0],height:gt[1],style:{position:"absolute",left:0,top:0},children:[vt&&e.jsx("g",{transform:`translate(${ft.left},${ft.top})`,children:vt}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[Xe&&e.jsx("rect",{x:0,y:0,width:pt,height:yt,fill:Xe}),o.map((t,o)=>function(t,o,n){var i,r,a,l,c,u,d,h,g;const f=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",y=e=>`ord-${t.type}-${f}-${o}-${e}`,m=`ord-${t.type}-${f}-${o}`;switch(t.type){case"rect":{const o=t,n=_o(m)+"-grad",i=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.jsx("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=Co(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(o,n),r=i?`url(#${n})`:Co(o.style.fill);if(o.cornerRadii&&wo(o.cornerRadii)){const t=function(e){const{x:t,y:o,w:n,h:i}=e,{tl:r,tr:s,br:a,bl:l}=jo(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}(o);return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}if(o.roundedTop&&o.roundedTop>0){const t=Math.min(o.roundedTop,o.w/2,o.h/2),{x:n,y:s,w:a,h:l}=o;let c;switch(o.roundedEdge){case"right":c=`M${n},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n},${s+l} Z`;break;case"left":c=`M${n+a},${s} L${n+t},${s} A${t},${t} 0 0 0 ${n},${s+t} L${n},${s+l-t} A${t},${t} 0 0 0 ${n+t},${s+l} L${n+a},${s+l} Z`;break;case"bottom":c=`M${n},${s} L${n+a},${s} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n+t},${s+l} A${t},${t} 0 0 1 ${n},${s+l-t} Z`;break;default:c=`M${n},${s+l} L${n},${s+t} A${t},${t} 0 0 1 ${n+t},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l} Z`}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Co(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},m)}case"wedge":{const i=t;if(i._gradientBand&&i._gradientBand.colors.length>0){const t=_o(`${n?n+"-":""}gauge-grad-${i.category||m}-${o}`),{clipPath:s,slices:u}=Oo({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:null===(a=null===(r=i.roundedEnds)||void 0===r?void 0:r.start)||void 0===a||a,roundEnd:null===(c=null===(l=i.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:i._gradientBand.colors});return e.jsxs("g",{transform:`translate(${i.cx},${i.cy})`,opacity:i.style.opacity,fillOpacity:i.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:s})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,o)=>e.jsx("path",{d:t.d,fill:Co(t.color)},o))}),i.style.stroke&&"none"!==i.style.stroke&&e.jsx("path",{d:s,fill:"none",stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}let u;if(i.roundedEnds)u=So({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:i.roundedEnds.start,roundEnd:i.roundedEnds.end});else{const e=s.arc().innerRadius(i.innerRadius).outerRadius(i.outerRadius).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2);i.cornerRadius&&e.cornerRadius(i.cornerRadius),u=e(Mo)||""}return e.jsx("path",{d:u,transform:`translate(${i.cx},${i.cy})`,fill:Co(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},m)}case"boxplot":{const o=t,n=o.columnWidth/2;return e.jsxs("g","vertical"===o.projection?{children:[e.jsx("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:o.x-n,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Co(o.style.fill),fillOpacity:null!==(u=o.style.fillOpacity)&&void 0!==u?u:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-n,y1:o.medianPos,x2:o.x+n,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.x-.5*n,y1:o.minPos,x2:o.x+.5*n,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-.5*n,y1:o.maxPos,x2:o.x+.5*n,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-n,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Co(o.style.fill),fillOpacity:null!==(d=o.style.fillOpacity)&&void 0!==d?d:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.medianPos,y1:o.y-n,x2:o.medianPos,y2:o.y+n,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.minPos,y1:o.y-.5*n,x2:o.minPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.maxPos,y1:o.y-.5*n,x2:o.maxPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const o=t,n=[e.jsx("path",{d:o.pathString,transform:o.translateX||o.translateY?`translate(${o.translateX},${o.translateY})`:void 0,fill:Co(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:o.style.strokeWidth||1},y("path"))];if(o.iqrLine&&o.bounds){const t=o.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?n.push(e.jsx("line",{x1:i,y1:o.iqrLine.q1Pos,x2:i,y2:o.iqrLine.q3Pos,stroke:o.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:i,cy:o.iqrLine.medianPos,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},y("med"))):n.push(e.jsx("line",{x1:o.iqrLine.q1Pos,y1:r,x2:o.iqrLine.q3Pos,y2:r,stroke:o.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:o.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},y("med")))}return e.jsx("g",{children:n},m)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(g=t.style.opacity)&&void 0!==g?g:.5},m);case"trapezoid":{const o=t,n=o.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:n,fill:Co(o.style.fill,"#999"),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},m)}default:return null}}(t,o,wt)).filter(Boolean)]})]}),e.jsx(xi,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:n,showAxes:ge,showCategoryTicks:fe,oLabel:Bt,rLabel:Et,oFormat:Nt,rFormat:$t,rTickValues:je,tickLabelEdgeAlign:Ae,axisExtent:Se,showGrid:Te,title:Ye,legend:Re,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:De,legendLayout:He,foregroundGraphics:Ge(mt,null===(a=io.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:Pe,svgAnnotationRules:Le,annotationFrame:0,xAccessor:Eo,yAccessor:Ho,annotationData:Io(null==t?void 0:t.getData())}),Ve&&"radial"===T&&e.jsx("div",{style:{position:"absolute",left:ft.left+pt/2,top:ft.top+yt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ve})]})}return e.jsxs("div",{ref:ht,className:"stream-ordinal-frame"+(qe?" "+qe:""),role:"group","aria-label":it||("string"==typeof Ye?Ye:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:B?"100%":gt[0],height:E?"100%":gt[1],overflow:"visible"},onKeyDown:bo,children:[nt&&e.jsx(un,{tableId:wt}),nt&&e.jsx(an,{scene:null!==(c=null===(l=io.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:m+" chart",tableId:wt,chartTitle:"string"==typeof Ye?Ye:void 0}),e.jsx(cn,{summary:st}),e.jsxs("div",{role:"img","aria-label":it||("string"==typeof Ye?Ye:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:eo?xo:void 0,onMouseLeave:eo?po:void 0,children:[vt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:gt[0],height:gt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${ft.left},${ft.top})`,children:vt})}),e.jsx(vi,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:Gt,showAxes:ge,showGrid:Te,rFormat:$t,rTickValues:je,axisExtent:Se}),e.jsx("canvas",{ref:Dt,"aria-label":qo(null!==(d=null===(u=io.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],m+" chart"),style:{position:"absolute",top:0,left:0,width:gt[0],height:gt[1]}}),e.jsx(dn,{hoverPoint:zt}),e.jsx(xi,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:Gt,showAxes:ge,showCategoryTicks:fe,oLabel:Bt,rLabel:Et,oFormat:Nt,rFormat:$t,rTickValues:je,axisExtent:Se,showGrid:Te,title:Ye,legend:Re,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:De,legendLayout:He,foregroundGraphics:Ge(mt,Qt),annotations:Pe,svgAnnotationRules:Le,annotationFrame:Xt,xAccessor:Eo,yAccessor:Ho,annotationData:Io(null===(h=io.current)||void 0===h?void 0:h.getData()),underlayRendered:!0}),(tt||ot)&&"radial"!==T&&e.jsx(ki,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,scales:Gt,onBrush:ot||(()=>{})}),Ve&&"radial"===T&&e.jsx("div",{style:{position:"absolute",left:ft.left+pt/2,top:ft.top+yt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ve}),(null==et?void 0:et.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===et.badgePosition?{top:4,left:4}:"bottom-left"===et.badgePosition?{bottom:4,left:4}:"bottom-right"===et.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.jsx(gn,{active:yo.current>=0,hoverPoint:zt,margin:ft,size:gt,shape:null===(g=mo.current)||void 0===g?void 0:g.shape,width:null===(f=mo.current)||void 0===f?void 0:f.w,height:null===(y=mo.current)||void 0===y?void 0:y.h}),Lo]})]})});Yi.displayName="StreamOrdinalFrame";const Gi={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},qi={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Xi{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?Vi(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 Vi(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,u,d,h]=e[a];Ui(c,u,d,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;Ui(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function Ui(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+u*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+u*n.y}function Ki(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function Qi(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,d=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,i),d=!0):r[n]||(d=c(n));if(d)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(),d}function u(e,t){var o=[].concat(t).concat(e);n.push(o)}function d(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,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=u,i[t]=!0,u+=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]=u,i[p]=!0,u+=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=[],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]=d.length,b===t){l.length=f;break}}d.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>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:d,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=d(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 Zi(e){return e.y0-e.y1>0?"up":"down"}function Ji(e,t){return t(e.source)==t(e.target)}function er(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 tr(e){return e.target.x0-e.source.x1}function or(e,t){var o=ir(e),n=tr(t)/Math.tan(o);return"up"==Zi(e)?e.y1-n:e.y1+n}function nr(e,t){var o=ir(e),n=tr(t)/Math.tan(o);return"up"==Zi(e)?e.y1+n:e.y1-n}function ir(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function rr(e,t){return t(e)}function sr(e){return lr(e.source)}function ar(e){return lr(e.target)}function lr(e){return(e.y0+e.y1)/2}function cr(e){return e.virtual?0:e.value}function ur(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Ji(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Ji(e,t)?n+1:n}),o+n}function dr(e){return e.target.depth}function hr(e,t){return e.sourceLinks.length?e.depth:t-1}function gr(e,t){return e.y0-t.y0}function fr(e,t){return t.y0-e.y0}function pr(e,t){return e.y1-t.y1}function yr(e,t){return t.y1-e.y1}function mr(e,t){return br(e.source,t.source)||e.index-t.index}function vr(e,t){return br(e.target,t.target)||e.index-t.index}function br(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function xr(e,t){return kr(e)==kr(t)?"bottom"==e.circularLinkType?fr(e,t):gr(e,t):kr(t)-kr(e)}function kr(e){return e.target.column-e.source.column}function wr(e,t){return jr(e)==jr(t)}function jr(e){return e.y0-e.y1>0?"up":"down"}function Ar(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 l=a.min(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=r.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),Sr(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),Sr(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,Ji(e,t)&&er(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,a=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==a});c.sort("bottom"==e.circularLinkType?fr:gr);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==a})).sort("bottom"==e.circularLinkType?yr:pr),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=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=l-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 Sr(e,t,o){e.sort(xr);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(Ji(e,t)&&er(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&&Or(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 Or(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Mr(e){return function(){return e}}function Cr(e){return e.index}function _r(e){return e.nodes}function Pr(e){return e.links}function Lr(e,t,o){var n=a.groups(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+=lr(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=lr(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?ur(t,o)-ur(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==ur(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 Tr(e,t,o,n,i,r){var s=a.groups(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 l=1,c=r;c>0;--c)u(l*=.99,o),d();function u(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var l;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&ur(i,o)>0){var c=a.mean(i.sourceLinks,ar),u=a.mean(i.targetLinks,sr),d=c&&u?(c+u)/2:c||u;if(d){var h=(d-lr(i))*t*.3;i.y0+=h,i.y1+=h}}else if(0==s&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)l=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+l;else{var g=a.mean(i.sourceLinks,ar),f=a.mean(i.targetLinks,sr),p=((g&&f?(g+f)/2:g||f)-lr(i))*t;i.y0+=p,i.y1+=p}})})}function d(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||br),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 Rr(e){e.nodes.forEach(function(e){e.sourceLinks.sort(vr),e.targetLinks.sort(mr)}),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 Br(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,l=Cr,c=hr,u=void 0,d=32,h=2,g=_r,f=Pr;function p(){var p={nodes:g.apply(null,arguments),links:f.apply(null,arguments)};return function(g){g.x0=e,g.y0=t,g.x1=o,g.y1=n,g.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 a.group(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=Ki(o,n)),"object"!=typeof i&&(i=e.target=Ki(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(g,l),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=Qi(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[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++)})}(g,u),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){rr(e,t)!=rr(i.source,t)&&rr(e,t)!=rr(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),Ji(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(g,l),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(a.sum(e.sourceLinks,cr),a.sum(e.targetLinks,cr)),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)})})}(g),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})}(g,u,c);var f=r;if(null!==s){var p=a.groups(g.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),y=a.max(p,function(e){return e.length});y>1&&(f=Math.max(1,(n-t)*s/(y-1)))}(function(e,t,o){var n=a.groups(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=a.min(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/a.sum(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=a.max(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})})(g,f,i),Lr(g,u,l),Tr(g,u,l,f,f,d),Rr(g),Ar(g,l,h,10,8),Lr(g,u,l),Tr(g,u,l,f,f,d),Rr(g),Ar(g,l,h,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 rr(o.source,t)==rr(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(!wr(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=or(t,e);return e.y1-o}if(t.target.column>e.target.column)return or(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}})})}(g,l),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return rr(o.target,t)==rr(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(!wr(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=nr(t,e);return e.y0-o}if(t.source.column>e.source.column)return nr(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}})})}(g,l),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=a.min(t,function(e){return e.y0}),s=a.max(t,function(e){return e.y1}),l=(e.y1-e.y0)/(s-r);function c(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>l?(t.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1)}),o.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1),e.width=e.width*l})):t.forEach(function(e){var t=e.y1-e.y0,o=c(e.y0)-e.y0;e.y0=c(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})})}}(g),Ar(g,l,h,10,8)}(p),p}return p.update=function(e){return Rr(e),Ar(e,l,h,10,8),e},p.nodeWidth=function(e){return arguments.length?(i=+e,p):i},p.nodePadding=function(e){return arguments.length?(r=+e,p):r},p.nodePaddingRatio=function(e){return arguments.length?(s=+e,p):s},p.nodes=function(e){return arguments.length?(g="function"==typeof e?e:Mr(e),p):g},p.links=function(e){return arguments.length?(f="function"==typeof e?e:Mr(e),p):f},p.nodeId=function(e){return arguments.length?(l="function"==typeof e?e:Mr(e),p):l},p.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Mr(e),p):c},p.nodeSort=function(e){return arguments.length?(u=e,p):u},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.circularLinkGap=function(e){return arguments.length?(h=+e,p):h},p.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],p):[[e,t],[o,n]]},p.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],p):[o-e,n-t]},p}function Er(e){const{sx:t,sTop:o,sBot:n,tx:i,tTop:r,tBot:s,cp1X:a,cp2X:l}=e,c=(o+n)/2,u=(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:u},{x:i,y:u}],halfWidth:(n-o)/2}}}const Nr=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=u.interpolateNumber(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,h=u.interpolateNumber(e.source.x1,e.target.x0),{pathD:g}=Er({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:h(.5),cp2X:h(.5)});return g};function $r(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,u=i.leftFullExtent,d=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},${d+h*n-h*g}L${c+n-g},${d+h*n}L${u-n+g},${d+h*n}L${u-n},${d+h*n-h*g}L${u-n},${l-h*o+h*g}L${u-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${u+n},${l+h*o}L${u+n},${d-h*n}L${c-n},${d-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const Dr=new Set,Hr=new WeakMap;function Ir(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Hr.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Hr.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}`;Dr.has(e)||(Dr.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 Fr={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(dr))-1:0},justify:hr};function Wr(e){return"string"==typeof e?e:e.id}const zr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,u;if(0===e.length)return;const d="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)),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"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Br().extent(v).links(m).nodes(y).nodeAlign(Fr[h]||hr).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 m){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,u=n[0],d=n[1];if(r>0&&s>0&&(0>e||0>o||t>u||i>d)){const t=Math.min(u/r,d/s),n=-e*t+(u-r*t)/2,i=-o*t+(d-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 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 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 m){const t=Wr(e.source),o=Wr(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!==(u=e.width)&&void 0!==u?u: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=d;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 u="vertical"===o.orientation?"down":"right",d=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:K,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,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=d?d(Ir(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"),m.push("down"===u?{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 u=h?h(Ir(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=u.fill||i;v.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=u.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),v.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=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?$r(e):Nr(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};v.push({type:"bezier",pathD:d,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"===u?(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"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},Yr={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 u=0;const h=[];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?u++:o?(t.x=o.x,t.y=o.y,u++):h.push(t)}const g=u>0&&.3>=(e.length>0?h.length/e.length:1);if(g){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of h){const n=Gr(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=qr(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=qr(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 f=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),p=0===o.iterations?0:g?40:f,y=Xr(o.nodeSize,o.nodeSizeRange,e),m=e=>y(e);if(p>0){const o=d.forceLink().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=d.forceSimulation().force("charge",d.forceManyBody().strength(e=>-25*m(e))).force("center",d.forceCenter(a,l).strength(.8)).force("x",d.forceX(a).strength(.15)).force("y",d.forceY(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}));o.links(e),n.force("link",o)}g?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;p>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=m(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,u;const d=o.nodeStyle,h=o.edgeStyle,g=Xr(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:K,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(Ir(t,"nodeSize")),n=d?d(Ir(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(Ir(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!==(u=i.opacity)&&void 0!==u?u:.6};m.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(Ir(o,"nodeSize"));v.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function Gr(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 qr(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 Xr(e,t,o){var n,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const s=t||[5,20],l=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===l.length)return()=>s[0];const c=null!==(n=a.min(l))&&void 0!==n?n:0,u=null!==(r=a.max(l))&&void 0!==r?r:1;if(c===u)return()=>(s[0]+s[1])/2;const d=i.scaleLinear().domain([c,u]).range(s).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?s[0]:d(n)}}const Vr=K,Ur={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:a}=o,l=Math.min(n[0],n[1])/2,c=l-r,u=n[0]/2,d=n[1]/2,g=(f=o.valueAccessor)?"function"==typeof f?f:e=>{var t;return null!==(t=e[f])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var f;const p=new Map;for(let t=0;e.length>t;t++)p.set(e[t].id,t);const y=e.length,m=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=p.get("string"==typeof e.source?e.source:e.source.id),n=p.get(t);if(void 0===o||void 0===n)continue;const i=g(e);m[o][n]=i}const v=h.chord().padAngle(i);a&&v.sortGroups(a);const b=v(m),x=b.groups,k=s.arc().innerRadius(c).outerRadius(l);for(const t of x){const o=e[t.index],n=k.centroid({innerRadius:c,outerRadius:l,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+u,o.y=n[1]+d,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const w=new Map;for(const t of e)w.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=w.get("string"==typeof e.source?e.source:e.source.id),n=w.get(t);o&&(e.source=o),n&&(e.target=n)}const j=new Map;for(const e of t)j.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 b){const o=e[t.source.index].id,n=e[t.target.index].id,i=j.get(`${o}\0${n}`)||j.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,u=Math.min(n[0],n[1])/2,d=u-l,g=n[0]/2,f=n[1]/2,p=o.nodeStyle,y=o.edgeStyle,m=o.edgeColorBy||"source",v=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Vr,b=new Map;e.forEach((e,t)=>{b.set(e.id,v[t%v.length])});const x=h.ribbon().radius(d),k=[],w=[],j=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=p?p(Ir(o,"nodeStyle")).fill||b.get(o.id)||v[t%v.length]:b.get(o.id)||v[t%v.length];const s=p?p(Ir(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};k.push({type:"arc",cx:g,cy:f,innerR:d,outerR:u,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=x(t);if(!n)continue;const i=Kr(n,g,f);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(y)l=y(Ir(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===m&&o?l=b.get(o.id)||l:t&&(l=b.get(t.id)||l)}const u=y?y(Ir(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};w.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==o.showLabels){const t=(A=o.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=u+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;j.push({x:g+Math.cos(s)*n,y:f+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:k,sceneEdges:w,labels:j}}};function Kr(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 Qr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Zr(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 Jr(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 es(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 ts(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Qr}function os(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 ns(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 is={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),c=o.hierarchySum,u="function"==typeof c?c:"string"==typeof c?e=>Number(e[c])||0:e=>Number(e.value)||0,d=l.hierarchy(r,a);d.sum(u),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[h,g]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=l.tree();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,h,g);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=l.cluster();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,h,g);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,c=l.treemap().size([o,n]).tile(l.treemapBinary).padding(s);a>0&&c.paddingTop(a),c(e)}(d,o,h,g);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;l.pack().size([o,n]).padding(r)(e)}(d,o,h,g);break;case"partition":!function(e,t,o,n){var i;l.partition().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(d,o,h,g)}const f=d.descendants();e.length=0,t.length=0;const p=new Map;for(let t=0;f.length>t;t++){const n=f[t],r={id:Jr(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?rs(r,n,o):"treemap"===s||"partition"===s?ss(r,n):"circlepack"===s&&as(r,n),r.__hierarchyNode=n,e.push(r),p.set(n,r)}if("tree"===s||"cluster"===s)for(const e of f)if(e.parent){const o=p.get(e.parent),n=p.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,u,d,h,g;const f=[],p=[],y=[],m=o.treeOrientation||"vertical",v="radial"===m,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;v&&(e+=b,n+=x);const r=i(Ir(t,"nodeStyle"));let l=r.fill||os(o);if(o.colorByDepth&&void 0!==t.depth){const e=ts(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 j=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;v&&(i+=b,s+=x,a+=b,l+=x);const g=ns(i,s,a,l,m),f=r(Ir(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=o.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:j};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=es(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(v&&(s+=b,a+=x),v){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"===m?((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=[],u=[];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(Ir(o,"nodeStyle"));let l=a.fill||os(t);if(t.colorByDepth&&void 0!==o.depth){const e=ts(t);l=e[o.depth%e.length]}const u={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:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=es(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)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)>d)continue;let f=n(Ir(c,"nodeStyle")).fill||os(t);if(t.colorByDepth&&void 0!==c.depth){const e=ts(t);f=e[c.depth%e.length]}const p="string"==typeof f?Zr(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/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:u}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,u,d,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(Ir(o,"nodeStyle"));let c=l.fill||os(t);if(t.colorByDepth&&void 0!==o.depth){const e=ts(t);c=e[o.depth%e.length]}const u={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:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=es(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(Ir(i,"nodeStyle")).fill||os(t);if(t.colorByDepth&&void 0!==i.depth){const e=ts(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?Zr(a):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#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 rs(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 ss(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 as(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 ls(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const cs={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,a;const l=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),c=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),u=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,h=null!==(a=o.orbitEccentricity)&&void 0!==a?a:1,g="number"==typeof d?()=>d:d,f="number"==typeof h?()=>h:h,p=ls(o);p.metaMap.clear(),n.length=0,i.length=0;const y=new Map;function m(e){var t;const o=null!==(t=y.get(e))&&void 0!==t?t:0;return y.set(e,o+1),0===o?e:`${e}__${o}`}const v=t[0]/2,b=t[1]/2,x=Math.min(t[0],t[1])/2*.85,k=m(c(e));n.push({id:k,x:v,y:b,x0:v,x1:v,y0:b,y1:b,width:0,height:0,value:0,depth:0,data:e}),p.metaMap.set(k,{ring:x,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,a,d,h,y){const v=l(t);if(!(null==v?void 0:v.length))return;const b=v.length;let x=0,k=0,w=0;for(;b>k;)k+=u[Math.min(w,u.length-1)],w++,x++;let j=0;for(let b=0;x>b;b++){const k=u[Math.min(b,u.length-1)],w=v.slice(j,j+k);if(!w.length)break;const A=(b+1)/x,S={id:o,depth:h,data:t,parentId:o},O=y?d/g(S)*A:d*A,M=s.pie().value(e=>{var t;return(null===(t=l(e))||void 0===t?void 0:t.length)?4:1}).sort(null),C=M(w),_=f(S);for(let t=0;w.length>t;t++){const s=(C[t].startAngle+C[t].endAngle)/2,l=w[t],u=m(c(l)),d=r+O*Math.sin(s),g=a+O*Math.cos(s)*_;n.push({id:u,x:d,y:g,x0:d,x1:d,y0:g,y1:g,width:0,height:0,value:0,depth:h,data:l}),p.metaMap.set(u,{ring:O,angle:s,depth:h,parentId:o,eccentricity:_}),i.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(l,u,d,g,O,h+1,!0)}j+=k}}(e,k,v,b,x,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=ls(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(Ir(t,"nodeSize")),n=d?d(Ir(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 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),o="object"==typeof e.target?e.target:m.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(Ir(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(u=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==u?u: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=ls(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)},us={sankey:zr,force:Yr,chord:Ur,tree:is,cluster:is,treemap:is,circlepack:is,partition:is,orbit:cs};function ds(e){return us[e]}class hs{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({},Gi),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Xi(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({},Gi),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new Xi(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],u="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({},gs(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=u(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({},gs(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},gs(i)),{data:o}));const d=`${n}\0${i}\0${e}`,h={source:n,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:d};o&&"object"==typeof o&&fs(o.bezier)&&(h.bezier=o.bezier),this.edges.set(d,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,gs(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,gs(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=ds(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of u)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(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[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,u=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=u.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)&&u.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=ci(this.config.colorScheme,this.config.themeCategorical,K),u={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:ui(c),config:null!==(o=this.config.layoutConfig)&&void 0!==o?o:{}};let d;try{d=this.config.customNetworkLayout(u)}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=d.sceneNodes)&&void 0!==n?n:[],this.sceneEdges=null!==(i=d.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=d.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(s=d.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const c=ds(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(a,l,this.config,e);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const e=ds(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=ds(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=Me(e,this.transition),o=Oe(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Ce(e._prevX0,e._targetX0,o),e.x1=Ce(e._prevX1,e._targetX1,o),e.y0=Ce(e._prevY0,e._targetY0,o),e.y1=Ce(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=Ce(e._prevY0,e._targetY0,o),e.y1=Ce(e._prevY1,e._targetY1,o),e.sankeyWidth=Ce(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=u.interpolateNumber(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=u.interpolateNumber(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 u=e-c;a>u&&(t._pulseIntensity=1-u/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=Ae(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 gs(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 fs(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(!ps(e))return!1;return!0}return ps(t.points)}function ps(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 ys(e,t,o,n,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=ms(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){if(!1===e.interactive)continue;const t=ws(e,o,n);t&&s>t.distance&&(r=t,s=t.distance)}return r}function ms(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>Xe(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=qe(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=Ke(Math.atan2(i,n)),a=Ke(e.startAngle),l=Ke(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 vs=null,bs=null;function xs(){return bs||(vs=document.createElement("canvas"),vs.width=1,vs.height=1,bs=vs.getContext("2d")),bs}function ks(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 ws(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=ks(e),i=xs();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);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=ks(e),i=xs();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 js(t){const{width:o,height:n,totalWidth:i,totalHeight:r,margin:s,labels:a,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",legendLayout:y,foregroundGraphics:m,sceneNodes:v,annotations:b,svgAnnotationRules:x}=t;return e.jsxs(e.Fragment,{children:[e.jsxs("svg",{role:"img",width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsx("title",{children:"string"==typeof l?l:"Network Chart"}),e.jsx("desc",{children:"string"==typeof l?l+" — network data visualization":"Network data visualization"}),e.jsxs("g",{transform:`translate(${s.left},${s.top})`,children:[a.map((t,o)=>e.jsx("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)),b&&b.filter(e=>"widget"!==e.type).map((t,i)=>{if(x){const r=x(t,i,{width:o,height:n,sceneNodes:v});if(r)return e.jsx(p.Fragment,{children:r},"annotation-"+i)}return null}),m]}),l&&"string"==typeof l?e.jsx("text",{x:i/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:l}):l?e.jsx("foreignObject",{x:0,y:0,width:i,height:s.top,children:l}):null,Ht({legend:c,totalWidth:i,totalHeight:r,margin:s,legendPosition:f,title:l,legendLayout:y,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})]}),null==b?void 0:b.filter(e=>"widget"===e.type&&e.nodeId&&v).map((t,o)=>{var n,i,r,a,l,c,u,d,h;const g=v.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=s.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=s.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(a=g.y)&&void 0!==a?a:0),y=null!==(l=t.dx)&&void 0!==l?l:0,m=null!==(c=t.dy)&&void 0!==c?c:-16,b=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e.jsx("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e.jsx("div",{style:{position:"absolute",left:f+y-b/2,top:p+m-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+o)})]})}function As(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Ss(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=As(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=rt(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&&rt(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=rt(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 Os(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=rt(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 Ms(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=As(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&rt(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=rt(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 Cs(e,t){var o,n;if(!t.pathD)return;e.save();const i=As(t),r=t.style.stroke||"#999";e.strokeStyle=rt(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&&rt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}js.displayName="NetworkSVGOverlay";const _s={top:20,right:80,bottom:20,left:80},Ps={top:40,right:40,bottom:40,left:40},Ls=new Set(["chord","force","circlepack","orbit"]),Ts=[800,600],Rs={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 Bs({data:t}){var o,n,i,r,s,a;if("edge"===t.nodeOrEdge){const o=t.data;return o?e.jsxs("div",{className:"semiotic-tooltip",style:Rs,children:[e.jsxs("div",{style:{fontWeight:600},children:["object"==typeof o.source?o.source.id:o.source," → ","object"==typeof o.target?o.target.id:o.target]}),null!=o.value&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof o.value?o.value.toLocaleString():o.value+""]})]}):null}const l=t.data;if(!l)return null;const c=l.__hierarchyNode;if(c){const t=[];let s=c;for(;s;){const e=null!==(r=null!==(n=null===(o=s.data)||void 0===o?void 0:o.name)&&void 0!==n?n:null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==r?r:l.id;null!=e&&t.unshift(e+""),s=s.parent}t.length>1&&t.shift();const a=t.length-1;return e.jsxs("div",{className:"semiotic-tooltip",style:Rs,children:[e.jsx("div",{children:t.map((t,o)=>e.jsxs("span",{children:[o>0&&e.jsx("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===a?e.jsx("strong",{children:t}):e.jsx("span",{style:{opacity:.7},children:t})]},o))}),null!=l.value&&l.value>0&&e.jsx("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof l.value?l.value.toLocaleString():l.value+""})]})}const u=((null===(s=l.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(a=l.targetLinks)||void 0===a?void 0:a.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.jsxs("div",{className:"semiotic-tooltip",style:Rs,children:[e.jsx("div",{style:{fontWeight:600},children:l.id}),null!=l.value&&l.value>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""]}),u>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`]})]})}Bs.ownsChrome=!0;const Es=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,h,g,f,p,y,m,v,b,x,w,j;const{chartType:A,nodes:O,edges:M,data:C,initialEdges:_,nodeIDAccessor:P="id",sourceAccessor:L="source",targetAccessor:T="target",valueAccessor:R="value",edgeIdAccessor:B,childrenAccessor:E,hierarchySum:N,orientation:$="horizontal",nodeAlign:D="justify",nodePaddingRatio:H=.05,nodeWidth:I=15,iterations:F=300,forceStrength:W=.1,padAngle:z=.01,groupWidth:Y=20,sortGroups:G,edgeSort:q,treeOrientation:X="vertical",edgeType:V="curve",padding:U,paddingTop:K,tensionConfig:Q,showParticles:Z=!1,particleStyle:J,nodeStyle:ee,edgeStyle:te,colorBy:oe,colorScheme:ne="category10",edgeColorBy:ie="source",edgeOpacity:re=.5,colorByDepth:se=!1,nodeSize:ae=8,nodeSizeRange:le=[5,20],nodeLabel:ce,showLabels:ue=!0,labelMode:de,size:he=Ts,responsiveWidth:ge,responsiveHeight:fe,margin:pe,className:ye,background:ve,enableHover:be=!0,tooltipContent:xe,customHoverBehavior:ke,customClickBehavior:we,onObservation:je,chartId:Ae,onTopologyChange:Se,annotations:Oe,svgAnnotationRules:Me,legend:Ce,legendPosition:_e,legendLayout:Pe,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Re,legendIsolatedCategories:Be,title:Ee,foregroundGraphics:Ne,backgroundGraphics:$e,decay:De,pulse:He,transition:Ie,animate:Fe,staleness:We,thresholds:ze,accessibleTable:Ye=!0,description:qe,summary:Xe,orbitMode:Ve,orbitSize:Ue,orbitSpeed:Ke,orbitRevolution:Qe,orbitRevolutionStyle:Ze,orbitEccentricity:Je,orbitShowRings:et,orbitAnimated:tt,customNetworkLayout:ot,layoutConfig:nt}=o,it=Ls.has(A)?Ps:_s,st=t.useRef(!0),at=Mn({sizeProp:he,responsiveWidth:ge,responsiveHeight:fe,userMargin:pe,marginDefault:it,foregroundGraphics:Ne,backgroundGraphics:$e,animate:Fe,transitionProp:Ie,themeDirtyRef:st}),{reducedMotionRef:lt,responsiveRef:ct,size:ut,margin:dt,adjustedWidth:ht,adjustedHeight:gt,resolvedForeground:ft,resolvedBackground:pt,transition:yt,introEnabled:mt,tableId:vt,rafRef:bt,renderFnRef:xt,scheduleRender:kt,currentTheme:wt}=at,Ot=To(),Ct=No(),Pt=t.useMemo(()=>k(O),[O]),Lt=t.useMemo(()=>Array.isArray(M)?k(M):M,[M]),Tt=t.useMemo(()=>Object.assign(Object.assign({},Gi),Q),[Q]),Rt=t.useMemo(()=>Object.assign(Object.assign({},qi),J),[J]),Bt=t.useMemo(()=>{var e;return{chartType:A,nodeIDAccessor:P,sourceAccessor:L,targetAccessor:T,valueAccessor:R,edgeIdAccessor:B,childrenAccessor:E,hierarchySum:N,orientation:$,nodeAlign:D,nodePaddingRatio:H,nodeWidth:I,iterations:F,forceStrength:W,padAngle:z,groupWidth:Y,sortGroups:G,edgeSort:q,treeOrientation:X,edgeType:V,padding:U,paddingTop:K,tensionConfig:Tt,showParticles:Z,particleStyle:Rt,nodeStyle:ee,edgeStyle:te,nodeLabel:ce,showLabels:ue,labelMode:de,colorBy:oe,colorScheme:ne,themeCategorical:null===(e=null==wt?void 0:wt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(wt),edgeColorBy:ie,edgeOpacity:re,colorByDepth:se,nodeSize:ae,nodeSizeRange:le,decay:De,pulse:He,transition:yt,introAnimation:mt,staleness:We,thresholds:ze,orbitMode:Ve,orbitSize:Ue,orbitSpeed:Ke,orbitRevolution:Qe,orbitRevolutionStyle:Ze,orbitEccentricity:Je,orbitShowRings:et,orbitAnimated:tt,customNetworkLayout:ot,layoutConfig:nt}},[A,P,L,T,R,E,N,$,D,H,I,F,W,z,Y,G,q,X,V,U,K,Tt,Z,Rt,ee,te,ce,ue,de,oe,ne,ie,re,se,ae,le,De,He,null==yt?void 0:yt.duration,null==yt?void 0:yt.easing,mt,We,ze,Ve,Ue,Ke,Qe,Ze,Je,et,tt,wt,ot,nt]),Et=Do(Bt),Nt=t.useRef(null),$t=t.useRef(0),Dt=t.useRef(0),Ht=t.useRef(!1),It=t.useRef(null);It.current||(It.current=new hs(Et));const[Ft,Wt]=t.useState(null),[zt,Yt]=t.useState(0),[Gt,qt]=t.useState(0),[Xt,Vt]=t.useState(!1),[Ut,Kt]=t.useState(null),Qt=t.useRef(null),Zt=t.useRef(new Map),Jt=t.useRef(0),eo=t.useCallback(e=>{if("function"==typeof oe)return oe(e)+"";if("string"==typeof oe&&e.data){const t=e.data[oe];if(void 0!==t){if(!Zt.current.has(t+"")){const e=Array.isArray(ne)?ne:me;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(ne)?ne:me,o=oe?t[Jt.current++%t.length]:t[0];return Zt.current.set(e.id,o),o},[oe,ne]),to=(null===(i=null==wt?void 0:wt.colors)||void 0===i?void 0:i.border)||(null===(r=null==wt?void 0:wt.colors)||void 0===r?void 0:r.secondary)||(null===(a=null==wt?void 0:wt.colors)||void 0===a?void 0:a.primary)||"#999",oo=t.useCallback(e=>{var t,o;return e?"object"==typeof e?e:null!==(o=null===(t=It.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==o?o:null:null},[]),no=t.useCallback(e=>{if("function"==typeof ie)return ie(e);const t=oo(e.source),o=oo(e.target);return"target"===ie&&o?eo(o):t?eo(t):to},[ie,eo,to,oo]),io=t.useCallback(e=>{if("function"==typeof Rt.color){const t=oo(e.source);return t?Rt.color(e,t):to}if(!(null==J?void 0:J.colorBy))return no(e);const t=Rt.colorBy,o=oo(e.source),n=oo(e.target);return"target"===t&&n?eo(n):o?eo(o):to},[null==J?void 0:J.colorBy,Rt.color,Rt.colorBy,eo,no,to,oo]),ro=("sankey"===A||!!ot)&&Z||!!He||null!==(c=null===(l=It.current)||void 0===l?void 0:l.isAnimating)&&void 0!==c&&c;t.useEffect(()=>{var e;null===(e=It.current)||void 0===e||e.updateConfig(Et),st.current=!0,kt()},[Et,kt]);const so=t.useCallback(()=>{var e,t;Kt(null!==(t=null===(e=It.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);t.useEffect(()=>{var e;const t=It.current;if(t){t.buildScene([ht,gt]),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);st.current=!0,kt()}},[wt,ht,gt,kt,so]);const ao=t.useCallback(()=>{var e;const t=It.current;if(!t)return;t.runLayout([ht,gt]),t.buildScene([ht,gt]),so(),st.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(ne)?ne:me,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,Yt(t.layoutVersion),Se){const{nodes:e,edges:o}=t.getLayoutData();Se(e,o)}},[ht,gt,Se,ne,so]),lo=t.useCallback(e=>{if(null==e||"object"!=typeof e)return;const t=It.current;t&&(t.ingestEdge(e)&&ao(),kt())},[ao,kt]),co=t.useCallback(e=>{const t=It.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&ao(),kt()},[ao,kt]),uo=t.useCallback(()=>{var e;null===(e=It.current)||void 0===e||e.clear(),Zt.current.clear(),Jt.current=0,Yt(0),Wt(null),Qt.current=null,st.current=!0,kt()},[kt]),ho=t.useCallback(()=>{const e=It.current;e&&(e.tension+=999,ao(),kt())},[ao,kt]);t.useImperativeHandle(n,()=>({push:lo,pushMany:co,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=It.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 P?P(Qt.current.data):Qt.current.data[P]:void 0;Qt.current&&"node"===Qt.current.nodeOrEdge&&t===e&&(Qt.current=null,Wt(null)),Zt.current.delete(e),ao(),st.current=!0,kt()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=It.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:!B||!o||("function"==typeof B?B:e=>null==e?void 0:e[B])(o)===e,n&&(Qt.current=null,Wt(null))}ao(),st.current=!0,kt()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=It.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(st.current=!0,kt()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=It.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(ao(),st.current=!0,kt()),r},clear:uo,getTopology:()=>{var e,t;return null!==(t=null===(e=It.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=It.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:ho,getTension:()=>{var e,t;return null!==(t=null===(e=It.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[lo,co,uo,ho,ao,kt]);const go=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),fo=go?C||(Array.isArray(M)?void 0:M):void 0;t.useEffect(()=>{var e;const t=It.current;if(t)if(go&&fo)t.ingestHierarchy(fo,[ht,gt]),t.buildScene([ht,gt]),so(),st.current=!0,kt();else{const o=Pt,n=Array.isArray(Lt)?Lt:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[ht,gt]),t.buildScene([ht,gt]),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(ne)?ne:me,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,st.current=!0,kt()}},[Pt,Lt,C,fo,go,ht,gt,Et,kt,ne,so]),t.useEffect(()=>{_&&_.length>0&&co(_)},[]);const po=t.useCallback(e=>{if(ke&&ke(e),je){const t=Date.now();je(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae})}},[ke,je,Ae]),yo=t.useCallback(e=>{if(we&&we(e),je){const t=Date.now();je(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ae})}},[we,je,Ae]),{hoverHandlerRef:mo,hoverLeaveRef:vo,onPointerMove:bo,onPointerLeave:xo}=at;mo.current=e=>{if(!be)return;const t=Nt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-dt.left,i=e.clientY-o.top-dt.top;if(0>n||n>ht||0>i||i>gt)return void(Qt.current&&(Qt.current=null,Wt(null),po&&(po(null),st.current=!0),kt()));const r=It.current;if(!r)return;const s=ys(r.sceneNodes,r.sceneEdges,n,i);if(!s)return void(Qt.current&&(Qt.current=null,Wt(null),po&&(po(null),st.current=!0),kt()));const a=pn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Qt.current=a,Wt(a),po&&(po(a),st.current=!0),kt()},vo.current=()=>{Qt.current&&(Qt.current=null,Wt(null),po&&(po(null),st.current=!0),kt())};const ko=t.useRef(()=>{});ko.current=e=>{if(!we&&!je)return;const t=Nt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-dt.left,i=e.clientY-o.top-dt.top;if(0>n||n>ht||0>i||i>gt)return;const r=It.current;if(!r)return;const s=ys(r.sceneNodes,r.sceneEdges,n,i);yo(s?pn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const wo=t.useCallback(e=>ko.current(e),[]),jo=t.useRef(-1),Ao=t.useRef(null),So=t.useRef(-1),Oo=t.useCallback(e=>{var t;const o=It.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=jt(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,So.current=-1;const t=i.flat[0];Ao.current={shape:t.shape,w:t.w,h:t.h};const o=pn(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Qt.current=o,Wt(o),po&&(po(o),st.current=!0),void kt()}const s=At(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return St(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 u=a*a+l*l;i>u&&(i=u,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=Mt(t.source),s=Mt(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=St(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:[],So);if(null===a)return;if(e.preventDefault(),0>a)return jo.current=-1,Ao.current=null,So.current=-1,Qt.current=null,Wt(null),po&&(po(null),st.current=!0),void kt();jo.current=a;const l=i.flat[a];Ao.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,Wt(c),po&&(po(c),st.current=!0),kt()},[po,kt]),_o=t.useCallback(e=>{jo.current=-1,Ao.current=null,bo(e)},[bo]);xt.current=()=>{var e,t,o,n,i,r,s;bt.current=0;const a=Nt.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=It.current;if(!c)return;const u=performance.now(),d=$t.current?Math.min((u-$t.current)/1e3,.1):.016;$t.current=u;const h=c.advanceTransition(lt.current?u+1e6:u),g=!lt.current&&h,f=!lt.current&&c.tickAnimation([ht,gt],d);(h||st.current||f)&&c.buildScene([ht,gt]);const p=_n();if(!Cn(a,ut,dt,p))return;if(l.clearRect(-dt.left,-dt.top,ut[0],ut[1]),ve){const e=rt(l,ve);e&&(l.fillStyle=e,l.fillRect(0,0,ht,gt))}De&&c.applyDecay(),He&&c.applyPulse(u),ze&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==We?void 0:We.threshold)&&void 0!==e?e:5e3,m=We&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==We?void 0:We.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":Ss(e,o);break;case"line":Os(e,o);break;case"ribbon":Ms(e,o);break;case"curved":Cs(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&&rt(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=rt(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)),Bn(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&&rt(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=rt(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()),En(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&&rt(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=rt(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),Z&&c.particlePool&&!m){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:qi.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:qi.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 u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,d,Rt);const t=.5*(null!==(o=Rt.speedMultiplier)&&void 0!==o?o:1);let n;if(Rt.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(d,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:qi.radius,l=null!==(s=n.opacity)&&void 0!==s?s:qi.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=rt(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,Rt,io)}}m&&(l.globalAlpha=1);const v=st.current;if(st.current=!1,v||g||f){const e=Nt.current;e&&e.setAttribute("aria-label",Xo(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=v||g||f||Ht.current;b&&u-Dt.current>=33?(qt(e=>e+1),Dt.current=u,Ht.current=!1):Ht.current=!!b,(ro||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Ht.current)&&(bt.current=requestAnimationFrame(()=>xt.current()))},$o({hydrated:Ot,wasHydratingFromSSR:Ct,storeRef:It,dirtyRef:st,renderFnRef:xt}),t.useEffect(()=>{st.current=!0,kt()},[A,ht,gt,ve,kt]),_t(We,It,st,kt,Xt,Vt);const Lo=be&&Ft?e.jsx(wn,{x:Ft.x,y:Ft.y,containerWidth:ht,containerHeight:gt,margin:dt,className:"stream-network-tooltip",zIndex:2,children:xe?xe(Ft):e.jsx(Bs,{data:Ft})}):null;if(Po||!Ot&&Ct){const t=It.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),o=e?C||(Array.isArray(M)?void 0:M):void 0;if(e&&o)t.ingestHierarchy(o,[ht,gt]),t.buildScene([ht,gt]);else{const e=Pt,o=Array.isArray(Lt)?Lt:[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[ht,gt]),t.buildScene([ht,gt]))}}const o=null!==(u=null==t?void 0:t.sceneNodes)&&void 0!==u?u:[],n=null!==(d=null==t?void 0:t.sceneEdges)&&void 0!==d?d:[],i=null!==(h=null==t?void 0:t.labels)&&void 0!==h?h:[];return e.jsxs("div",{ref:ct,className:"stream-network-frame"+(ye?" "+ye:""),role:"img","aria-label":qe||("string"==typeof Ee?Ee:"Network chart"),style:{position:"relative",width:ge?"100%":ut[0],height:fe?"100%":ut[1]},children:[e.jsx(cn,{summary:Xe}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:ut[0],height:ut[1],style:{position:"absolute",left:0,top:0},children:[pt&&e.jsx("g",{transform:`translate(${dt.left},${dt.top})`,children:pt}),e.jsxs("g",{transform:`translate(${dt.left},${dt.top})`,children:[ve&&e.jsx("rect",{x:0,y:0,width:ht,height:gt,fill:ve}),n.map((t,o)=>function(t,o){switch(t.type){case"line":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e.jsx("path",{d:n.pathD,fill:Co(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.jsx("path",{d:n.pathD,fill:Co(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.jsx("path",{d:n.pathD,fill:Co(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),o.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e.jsx("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:Co(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.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:Co(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=s.arc().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(Mo)||"";return e.jsx("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:Co(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),i.map((t,o)=>function(t,o){return e.jsx("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.jsx(js,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,labels:i,sceneNodes:o,title:Ee,legend:Ce,legendPosition:_e,legendLayout:Pe,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Re,legendIsolatedCategories:Be,foregroundGraphics:Ge(ft,null===(g=It.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:Oe,svgAnnotationRules:Me,annotationFrame:0})]})}const Ro=It.current;return e.jsxs("div",{ref:ct,className:"stream-network-frame"+(ye?" "+ye:""),role:"group","aria-label":qe||("string"==typeof Ee?Ee:"Network chart"),tabIndex:0,style:{position:"relative",width:ge?"100%":ut[0],height:fe?"100%":ut[1],overflow:"visible"},onKeyDown:Oo,children:[Ye&&e.jsx(un,{tableId:vt}),Ye&&e.jsx(ln,{nodes:null!==(f=null==Ro?void 0:Ro.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==Ro?void 0:Ro.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:vt,chartTitle:"string"==typeof Ee?Ee:void 0}),e.jsx(cn,{summary:Xe}),e.jsxs("div",{role:"img","aria-label":qe||("string"==typeof Ee?Ee:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:be?_o:void 0,onMouseLeave:be?xo:void 0,onClick:we||je?wo:void 0,children:[pt&&e.jsx("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ut[0],height:ut[1],pointerEvents:"none",overflow:"visible"},children:e.jsx("g",{transform:`translate(${dt.left},${dt.top})`,children:pt})}),e.jsx("canvas",{ref:Nt,"aria-label":Xo(null!==(m=null===(y=null==Ro?void 0:Ro.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==Ro?void 0:Ro.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.jsx(dn,{hoverPoint:Ft}),e.jsx(js,{width:ht,height:gt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,labels:(null==Ro?void 0:Ro.labels)||[],sceneNodes:null==Ro?void 0:Ro.sceneNodes,title:Ee,legend:Ce,legendPosition:_e,legendLayout:Pe,legendHoverBehavior:Le,legendClickBehavior:Te,legendHighlightedCategory:Re,legendIsolatedCategories:Be,foregroundGraphics:Ge(ft,Ut),annotations:Oe,svgAnnotationRules:Me,annotationFrame:Gt}),e.jsx(gn,{active:jo.current>=0,hoverPoint:Ft,margin:dt,size:ut,shape:null===(x=Ao.current)||void 0===x?void 0:x.shape,width:null===(w=Ao.current)||void 0===w?void 0:w.w,height:null===(j=Ao.current)||void 0===j?void 0:j.h}),Lo,(null==We?void 0:We.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===We.badgePosition?{top:4,left:4}:"bottom-left"===We.badgePosition?{bottom:4,left:4}:"bottom-right"===We.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{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 Ns(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 $s(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 Ds(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:kn(t)||o}}function Hs(e){return"string"==typeof e?e:"value"}function Is(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Fs(e,t){if(!t)return Is(e);try{const o=t(e);return null==o?Is(e):o}catch(t){return Is(e)}}function Ws(e,t){return"function"==typeof t?t(e):e[t]}function zs(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,n)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";o.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y0)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),o.push({label:i,accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y1)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),o}function Ys(t){const o=t.find(e=>"title"===e.role),n=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const r=o?Fs(Ws(i,o.accessor),o.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[null!=r&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((t,o)=>{const n=Fs(Ws(i,t.accessor),t.format);return e.jsxs("div",{style:o>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:n})]},o)})]})}}function Gs({categoryAccessor:t,valueAccessor:o,groupAccessor:n,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=Ws(c,t),d=Ws(c,o),h=n?Ws(c,n):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[e.jsx("div",{style:{fontWeight:"bold"},children:Is(u)}),e.jsx("div",{style:{marginTop:4},children:Fs(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||Hs(n),": ",Is(h)]})]})}}Es.displayName="StreamNetworkFrame";const qs=t.createContext(null);function Xs({colors:o,categories:n,colorScheme:i="category10",children:r}){const s=t.useMemo(()=>{if(o)return o;if(n){const e=Array.isArray(i)?i:ye[i]||me,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[o,n,i]);return e.jsx(qs.Provider,{value:s,children:r})}function Vs(){return t.useContext(qs)}function Us(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 Ks(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Us(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Qs(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}Xs.displayName="CategoryColorProvider";const[Zs,Js]=j(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Qs(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=Qs(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}})}})),[ea,ta]=j(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 oa(e){const o=t.useId(),n=e.clientId||o,{name:i}=e,r=Js(e=>e.selections.get(i)),s=Js(e=>e.setClause),a=Js(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?Ks(r,n):()=>!0,[r,n]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(i,{clientId:n,type:"point",fields:t})},[n,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(i,{clientId:n,type:"interval",fields:t})},[n,i,s]),clear:t.useCallback(()=>{a(i,n)},[a,i,n]),clientId:n}}function na(e){const o=e.name||"hover",{fields:n}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=oa({name:o});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&s(t)},[n,s,a,o]),predicate:i,isActive:r}}function ia(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function ra(e){const{name:o,xField:n,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=oa({name:o}),c=n&&i?"xyBrush":n?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&ia(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&ia(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}function sa(e={}){const{limit:o=50,types:n,chartId:i}=e,r=ta(e=>e.version),s=ta(e=>e.observations),a=ta(e=>e.clearObservations),l=t.useMemo(()=>{let e=s;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return i&&(e=e.filter(e=>e.chartId===i)),e.length>o&&(e=e.slice(e.length-o)),e},[s,n,i,o,r]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const aa=t.createContext(!1),la=t.createContext(null),ca="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function ua(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function da(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 ha(e){const o=t.useContext(la),n=t.useId(),i=ua(e),r=t.useRef([]);da(r.current,i)||(r.current=i);const s=r.current;ca(()=>{if(o)return()=>o.unregisterCategories(n)},[o,n]),ca(()=>{o&&o.registerCategories(n,s)},[o,n,s])}function ga({selections:e}){const o=Js(e=>e.setResolution);return t.useEffect(()=>{for(const[t,n]of Object.entries(e))n.resolution&&o(t,n.resolution)},[e,o]),null}function fa({categoryColors:o,interaction:n,selectionName:i,field:r}){const s=Object.entries(o),a=s.map(([e])=>e),l=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:s.map(([e,t])=>({label:e,color:t})),label:""}],c=na({name:i,fields:[r]}),u=oa({name:i,clientId:"__linked-legend-isolate__"}),[d,h]=t.useState(new Set),[g,f]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===n&&(d.size>0?p.current({[r]:Array.from(d)}):y.current())},[n,d,r]);const m=t.useCallback(e=>{"highlight"===n&&(e?(f(e.label),c.onHover({[r]:e.label})):(f(null),c.onHover(null)))},[n,r,c]),v=t.useCallback(e=>{"isolate"===n&&h(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===a.length?new Set:o})},[n,a.length]),[b,[x]]=An([0,0],!0,!1),k=t.useMemo(()=>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}(s.map(([e])=>e),x),[s,x]);return 0===s.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(Nt,{legendGroups:l,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===n?m:void 0,customClickBehavior:"isolate"===n?v:void 0,highlightedCategory:g,isolatedCategories:d})})})}function pa({children:o,selections:n,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:a="legend",legendField:l="category"}){const c=Vs(),[u,d]=t.useState({}),h=t.useRef({}),g=t.useMemo(()=>({registerCategories:(e,t)=>{const o=ua(t);d(t=>{var n;return da(null!==(n=t[e])&&void 0!==n?n:[],o)?t:Object.assign(Object.assign({},t),{[e]:o})})},unregisterCategories:e=>{d(t=>{if(!(e in t))return t;const o=Object.assign({},t);return delete o[e],o})}}),[]),f=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const o of t)e.push(o);return ua(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},o=h.current;let n=Object.keys(t).length+Object.keys(o).length;for(const e of f)t[e]||o[e]||(o[e]=me[n%me.length],n++);const i=Object.assign({},t);for(const n of f)i[n]=null!==(e=t[n])&&void 0!==e?e:o[n];return i},[c,f]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(Zs,{children:e.jsxs(ea,{children:[n&&e.jsx(ga,{selections:n}),e.jsx(la.Provider,{value:g,children:e.jsx(Xs,{colors:p,children:e.jsxs(aa.Provider,{value:m,children:[y&&"top"===r&&e.jsx(fa,{categoryColors:p,interaction:s,selectionName:a,field:l}),o,y&&"bottom"===r&&e.jsx(fa,{categoryColors:p,interaction:s,selectionName:a,field:l})]})})})]})})}function ya({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):ve[r%ve.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 ma(e){return e?"string"==typeof e?{name:e}:e:null}function va(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 ba={light:C,dark:_,"high-contrast":P,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 xa(e){return ba[e]}const ka=p.createContext(void 0),wa="undefined"==typeof window?p.useEffect:p.useLayoutEffect;function ja(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return xa(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Aa({theme:e}){const t=R(e=>e.setTheme),o=R(e=>e.theme),n=p.useRef(o);n.current=o;const i=p.useRef(null);p.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(i.current=n.current===P?C:n.current,t("high-contrast")),jn(o,e=>{var o,r;e.matches?(i.current=n.current===P?null!==(o=i.current)&&void 0!==o?o:C:n.current,t("high-contrast")):(function(e,t){e(t===C?"light":t===_?"dark":t===P?"high-contrast":t)}(t,null!==(r=i.current)&&void 0!==r?r:C),i.current=null)})},[e,t]);const r=p.useRef(!1);return wa(()=>{r.current?void 0!==e&&t(ja(e)):r.current=!0},[e,t]),null}function Sa({children:t}){var o,n,i,r,s;const a=R(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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":a.colors.background,"--semiotic-text":a.colors.text,"--semiotic-text-secondary":a.colors.textSecondary,"--semiotic-grid":a.colors.grid,"--semiotic-border":a.colors.border,"--semiotic-cell-border":a.colors.cellBorder||a.colors.border,"--semiotic-primary":a.colors.primary,"--semiotic-font-family":a.typography.fontFamily},a.colors.focus?{"--semiotic-focus":a.colors.focus}:{}),(null===(o=a.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":a.tooltip.background}:{}),(null===(n=a.tooltip)||void 0===n?void 0:n.text)?{"--semiotic-tooltip-text":a.tooltip.text}:{}),(null===(i=a.tooltip)||void 0===i?void 0:i.borderRadius)?{"--semiotic-tooltip-radius":a.tooltip.borderRadius}:{}),(null===(r=a.tooltip)||void 0===r?void 0:r.fontSize)?{"--semiotic-tooltip-font-size":a.tooltip.fontSize}:{}),(null===(s=a.tooltip)||void 0===s?void 0:s.shadow)?{"--semiotic-tooltip-shadow":a.tooltip.shadow}:{}),a.borderRadius?{"--semiotic-border-radius":a.borderRadius}:{}),a.colors.selection?{"--semiotic-selection-color":a.colors.selection}:{}),null!=a.colors.selectionOpacity?{"--semiotic-selection-opacity":a.colors.selectionOpacity+""}:{}),a.colors.diverging?{"--semiotic-diverging":a.colors.diverging}:{}),a.colors.annotation?{"--semiotic-annotation-color":a.colors.annotation}:{}),null!=a.typography.legendSize?{"--semiotic-legend-font-size":a.typography.legendSize+"px"}:{}),null!=a.typography.titleFontSize?{"--semiotic-title-font-size":a.typography.titleFontSize+"px"}:{}),null!=a.typography.tickFontFamily?{"--semiotic-tick-font-family":a.typography.tickFontFamily}:{}),null!=a.typography.tickSize?{"--semiotic-tick-font-size":a.typography.tickSize+"px"}:{}),null!=a.typography.labelSize?{"--semiotic-axis-label-font-size":a.typography.labelSize+"px"}:{}),{"--semiotic-secondary":a.colors.secondary||a.colors.primary,"--semiotic-surface":a.colors.surface||a.colors.background}),a.colors.success?{"--semiotic-success":a.colors.success}:{}),a.colors.danger?{"--semiotic-danger":a.colors.danger}:{}),a.colors.warning?{"--semiotic-warning":a.colors.warning}:{}),a.colors.error?{"--semiotic-error":a.colors.error}:{}),a.colors.info?{"--semiotic-info":a.colors.info}:{}),c=p.useContext(ka),u={};return c&&(u["data-semiotic-theme"]=c),e.jsx("div",Object.assign({style:l},u,{children:t}))}function Oa(){return R(e=>e.theme)}const Ma="#007bff";function Ca(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 _a(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 Pa(){var e;const t=Oa(),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 La(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=ye[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]:Ma}function Ta(e,o,n){const i=Vs(),r=Pa();return t.useMemo(()=>{var t;if(!o)return;const s=null!==(t=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof o){const t=Array.from(new Set(e.map(e=>o(e)+"")));if(i&&Object.keys(i).length>0){const e=we(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return we(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=we(e,o,s);return e=>i[e]||t(e)}return we(e,o,s)}if(i&&Object.keys(i).length>0){const e=we([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,o,n,i,r])}function Ra(e,o,n){return t.useMemo(()=>{if(!o||"auto"===o||"function"==typeof o)return e;const t=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(n);return t.sort("asc"===o?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,o,n])}function Ba({selection:e,linkedHover:o,fallbackFields:n=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(o,n),g=oa({name:(null==e?void 0:e.name)||"__unused__"}),f=na({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||n||[]}),p=ta(e=>e.pushObservation),y=e?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=t.useState(null),b=u||n[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[c,m,b]),k=t.useCallback(e=>{var t,n;if(o)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const o=Ca(e,t,h.xField);null!=o&&function(e,t,o){const n=to.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(to={positions:new Map(to.positions).set(e,{xValue:t,sourceId:o})},no())}(h.name||"hover",o,d)}"x-position"!==(null==h?void 0:h.mode)&&f.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&io(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&f.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[b];v(null!=o?o+"":null)}else v(null);if(r||p){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=_a(e),s=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});r&&r(e),p&&p(e)}}},[o,f,h,d,r,s,a,p,c,b]),w=t.useCallback(e=>{var t,o,n,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=Ca(e,t,h.xField);null!=o&&function(e,t,o){const n=to.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(to.positions);return t.delete(e),to={positions:t},no(),!1}to={positions:new Map(to.positions).set(e,{xValue:t,sourceId:o,locked:!0})},no()}(h.name||"hover",o,d)}if(e&&l){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),l(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(r||p){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const o=_a(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),p&&p(e)}}},[l,r,p,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{ro(e,d),io(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function Ea(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 Na({data:e,colorBy:o,colorScale:n,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(aa),u=null!==t.useContext(la),d=void 0!==i?i:!c&&!!o,h=!!o&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const n of e){const e="function"==typeof o?o(n):n[o];null!=e&&t.add(e+"")}return Array.from(t)},[l,o,e,h]);ha(u&&o?g:[]);const f=t.useMemo(()=>{if(!d||!o)return;const t=ya({data:e,colorBy:o,colorScale:n,getColor:ke,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,o,e,n,g]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const o=e[t];return"number"==typeof o?o:a[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[a,s,f,r]);return{legend:f,margin:p,legendPosition:r}}function $a(e,o,n){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(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]),u=t.useMemo(()=>{if(!e||"none"===e||!o)return null;const t="string"==typeof o?o:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof o?o(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=t?e[t]:"function"==typeof o?o(e):null;return s.has(n)}}:null},[e,o,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}const Da={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 Ha(e,t,o){var n,i,r,s,a,l,c;const u=Da[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Ia(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Ia(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 Fa({componentName:t,message:o,diagnosticHint:n,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),n&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}class Wa extends p.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.jsx(Fa,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var za;const Ya="undefined"!=typeof process&&"production"!==(null===(za=process.env)||void 0===za?void 0:za.NODE_ENV);function Ga({componentName:t,width:o,height:n,children:i}){return e.jsx(Wa,{fallback:i=>e.jsx(Fa,{componentName:t,message:i.message,width:o,height:n}),children:i})}const qa={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"},Xa={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Va(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},qa),{width:o,height:n}),children:i||"No data available"}):null}function Ua(t,o,n,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:o,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(n/40)),s=Math.max(8,Math.floor(n/(3*r))),a=Math.max(6,Math.floor(n/(2.5*r))),l=Math.floor((n-(r*(s+a)-a))/2);return e.jsx("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:r},(t,n)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Xa),{position:"absolute",top:l+n*(s+a),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:s,opacity:.5+n%2*.2})},n))})}function Ka(e,t,o,n){if(!Ya)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 Qa(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 Za(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Ja(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=Qa(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function el({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=Za(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=Ja(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function tl({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 ol({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=Za(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=Ja(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function nl(e){const o=R(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,n;if(void 0!==e||void 0!==o)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:o})},[e,o])}function il(e){const{data:o,rawData:n,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,loadingContent:w,emptyContent:j,width:A,height:S}=e,O=void 0===n,M=t.useMemo(()=>k(o),[o]),[C,_]=t.useState([]),P=t.useCallback(e=>{_(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:R,customHoverBehavior:B,customClickBehavior:E,crosshairSourceId:N}=Ba({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:L}),$=Ea(c,N),D=Ta(M,i,r),H=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const o="function"==typeof i?i(t):t[i];null!=o&&e.add(o+"")}return Array.from(e)},[M,i]),I=t.useMemo(()=>O&&C.length>0?C:H,[O,C,H]),F=$a(s,i,I),W=t.useMemo(()=>R||(F.legendSelectionHook?F.legendSelectionHook:T),[R,F.legendSelectionHook,T]),z=nl(l),Y=Pa(),G=Vs(),q=t.useMemo(()=>{if(D)return D;if(!i||0===I.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Y&&Y.length>0?Y:ve,t="__streamCat",o=we(I.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||o(e)||"#999"},[D,i,I,r,Y,G]),{legend:X,margin:V,legendPosition:U}=Na({data:M,colorBy:i,colorScale:q,showLegend:p,legendPosition:a,userMargin:y,defaults:m,categories:I}),K=t.useMemo(()=>{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),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[X,U,s,F.onLegendHover,F.onLegendClick,F.highlightedCategory,F.isolatedCategories,O,i,P]),Q=Array.isArray(n)?k(n):n,Z=Ua(x,A,S,w),J=Z?null:Va(Q,A,S,j);return{data:M,colorScale:D,allCategories:I,legendState:F,effectiveSelectionHook:W,activeSelectionHook:T,customHoverBehavior:B,customClickBehavior:E,legend:X,margin:V,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:K,crosshairProps:$,resolvedSelection:z}}function rl(e,o){const{variant:n,frameRef:i,overrides:r,deps:s}=o;t.useImperativeHandle(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:[]}}}(n,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}function sl(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 al(e){const{colorBy:o,colorScale:n,color:i,pointRadius:r=5,radiusFn:s,fillOpacity:a=1,fallbackFill:l,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=t.useMemo(()=>e=>{const t="function"==typeof c?c(e):c,u=t?Object.assign({},t):{};if(void 0===u.fillOpacity&&(u.fillOpacity=a),void 0===u.fill)if(o){if(n){const t=p?p(e):e;u.fill=ke(t,o,n)}}else u.fill=l?l(e):i||Ma;return void 0===u.r&&(u.r=s?s(e):r),u},[o,n,i,r,s,a,l,c,p]),m=t.useMemo(()=>sl(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return t.useMemo(()=>va(m,null!=g?g:null,f),[m,g,f])}function ll(e){const{accessor:o,data:n,isPushMode:i}=e,r=t.useRef(null),[s,a]=t.useState(0),l=t.useCallback(e=>{if(!i||!o)return;let t=!1;for(const n of e){const e="function"==typeof o?o(n):n[o];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,t=!0),i>r.current[1]&&(r.current[1]=i,t=!0)):(r.current=[i,i],t=!0))}t&&a(e=>e+1)},[i,o]),c=t.useCallback(()=>{i&&(r.current=null,a(e=>e+1))},[i]),u=t.useMemo(()=>{var e;if(i)return null!==(e=r.current)&&void 0!==e?e:void 0;if(!o||0===n.length)return;const t="function"==typeof o?o:e=>e[o];let s=1/0,a=-1/0;for(const e of n){const o=t(e);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(s>n&&(s=n),n>a&&(a=n))}return Number.isFinite(s)&&Number.isFinite(a)?[s,a]:void 0},[n,o,i,s]);return{domain:u,trackPushed:l,reset:c}}function cl(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})}function ul(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}function dl(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 hl="__forecastSegment";let gl=null;function fl(){return dl(this,void 0,void 0,function*(){return gl||(gl=yield Promise.resolve().then(function(){return hd})),gl})}const pl="__semiotic_resolvedX",yl="__semiotic_resolvedY";function ml(e){const{data:o,xAccessor:n,yAccessor:i,forecast:r,anomaly:s,groupBy:a}=e,l="string"==typeof n?n:pl,c="string"==typeof i?i:yl,u=t.useMemo(()=>{if(!r&&!s)return o;const e="function"==typeof n,t="function"==typeof i;return e||t?o.map(o=>{const r=Object.assign({},o);return e&&(r[pl]=n(o)),t&&(r[yl]=i(o)),r}):o},[o,r,s,n,i]),[d,h]=t.useState(null),[g,f]=t.useState([]),p=t.useRef(r),y=t.useRef(s);return t.useEffect(()=>{if(!r&&!s)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=s));let e=!1;const t=r!==p.current||s!==y.current;if(p.current=r,y.current=s,t&&(h(null),f([])),r){const t=a&&"string"==typeof a&&"object"==typeof r?Object.assign(Object.assign({},r),{_groupBy:a}):r;(function(...e){return dl(this,void 0,void 0,function*(){return(yield fl()).buildForecast(...e)})})(u,l,c,t,s).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else s&&function(...e){return dl(this,void 0,void 0,function*(){return(yield fl()).buildAnomalyAnnotations(...e)})}(s).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[u,r,s,l,c,a]),{effectiveData:d?d.processedData:o,statisticalAnnotations:g,hasForecast:!!d,xAccessorKey:l,yAccessorKey:c}}const vl=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xScaleType:g,yScaleType:f,colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:w=.8,tooltip:j,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:M,forecast:C,anomaly:_,xExtent:P,yExtent:L,frameProps:T={},selection:R,linkedHover:B,linkedBrush:E,onObservation:N,onClick:$,hoverHighlight:D,chartId:H,loading:I,loadingContent:F,emptyContent:W,legendInteraction:z,legendPosition:Y,color:G,stroke:q,strokeWidth:X,opacity:V}=o,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:oe,accessibleTable:ne,xLabel:ie,yLabel:re}=r,se=t.useMemo(()=>k(s),[s]),ae=void 0===s,{domain:le,trackPushed:ce,reset:ue}=ll({accessor:v,data:se,isPushMode:ae}),de=t.useCallback(e=>{var t;ce([e]),null===(t=i.current)||void 0===t||t.push(e)},[ce]),he=t.useCallback(e=>{var t;ce(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[ce]);rl(n,{variant:"xy",frameRef:i,overrides:{push:de,pushMany:he,clear:()=>{var e;ue(),null===(e=i.current)||void 0===e||e.clear()}},deps:[de,he,ue]});const ge=il({data:se,rawData:s,colorBy:y,colorScheme:m,legendInteraction:z,legendPosition:Y,selection:R,linkedHover:B,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:N,onClick:$,hoverHighlight:D,chartType:"Scatterplot",chartId:H,showLegend:J,userMargin:a,marginDefaults:r.marginDefaults,loading:I,loadingContent:F,emptyContent:W,width:U,height:K}),fe=ma(E),pe=ra({name:(null==fe?void 0:fe.name)||"__unused_brush__",xField:(null==fe?void 0:fe.xField)||("string"==typeof d?d:void 0),yField:(null==fe?void 0:fe.yField)||("string"==typeof h?h:void 0)}),ye=fe?"xyBrush"===pe.brushInteraction.brush?"xy":"xBrush"===pe.brushInteraction.brush?"x":"y":void 0,me=p.useRef(pe.brushInteraction);me.current=pe.brushInteraction;const ve=t.useCallback(e=>{const t=me.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(ge.earlyReturn)return ge.earlyReturn;Ka("Scatterplot",se,"xAccessor",d),Ka("Scatterplot",se,"yAccessor",h);const be=t.useMemo(()=>v?null!=le?le:[0,1]:void 0,[v,le]),xe=t.useMemo(()=>v?e=>je(e,v,b,be):void 0,[v,b,be]),ke=al({colorBy:y,colorScale:ge.colorScale,color:G,pointRadius:x,fillOpacity:w,radiusFn:xe,stroke:q,strokeWidth:X,opacity:V,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection}),we=t.useMemo(()=>Ys([{label:ie||Hs(d),accessor:d,role:"x",format:c},{label:re||Hs(h),accessor:h,role:"y",format:u},...y?[{label:Hs(y),accessor:y,role:"color"}]:[],...v?[{label:Hs(v),accessor:v,role:"size"}]:[]]),[d,h,ie,re,y,v,c,u]),{effectiveData:Ae,statisticalAnnotations:Se}=ml({data:se,xAccessor:d,yAccessor:h,forecast:C,anomaly:_}),Oe=t.useMemo(()=>{const e=cl(M);return e||0!==Se.length?[...e?[e]:[],...O||[],...Se]:O},[M,O,Se]),Me=el({componentName:"Scatterplot",data:s,accessors:{xAccessor:d,yAccessor:h}});if(Me)return e.jsx(Fa,{componentName:"Scatterplot",message:Me,width:U,height:K});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({chartType:"scatter"},null!=s&&{data:Ae}),{xAccessor:d,yAccessor:h,xScaleType:g,yScaleType:f,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:ke,colorScheme:m,size:[U,K],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:ie,yLabel:re,xFormat:c,yFormat:u,enableHover:Q,showGrid:Z}),ge.legendBehaviorProps),Ns({title:ee,description:te,summary:oe,accessibleTable:ne,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:j,defaultTooltipContent:we})),$s({linkedHover:B,onObservation:N,onClick:$,hoverHighlight:D,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),Oe&&Oe.length>0&&{annotations:Oe}),P&&{xExtent:P}),L&&{yExtent:L}),fe&&{brush:{dimension:ye},onBrush:ve}),ge.crosshairProps),T);return e.jsx(Ga,{componentName:"Scatterplot",width:U,height:K,children:e.jsx(si,Object.assign({ref:i},Ce))})});function bl(e,t){return ne(1===t?.5:e/(t-1))}vl.displayName="Scatterplot";const xl=t.forwardRef(function(o,n){var i,r;const s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const a=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,regression:k,forecast:w,anomaly:j,xExtent:A,yExtent:S,frameProps:O={},selection:M,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:T,loading:R,loadingContent:B,emptyContent:E,legendInteraction:N,stroke:$,strokeWidth:D,opacity:H}=o,{width:I,height:F,enableHover:W,showGrid:z,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V,yLabel:U}=a,K=l||[],{safeData:Q,orderMap:Z}=t.useMemo(()=>{const e="function"==typeof g?g:e=>e[g],t="function"==typeof f?f:e=>e[f];let o=K;if(p&&K.length>0){const e="function"==typeof p?p:e=>e[p];o=[...K].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}},[K,p,g,f]);Ka("ConnectedScatterplot",Q,"xAccessor",g),Ka("ConnectedScatterplot",Q,"yAccessor",f);const J=il({data:Q,rawData:l,colorBy:void 0,colorScheme:void 0,legendInteraction:N,selection:M,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"ConnectedScatterplot",chartId:T,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:R,loadingContent:B,emptyContent:E,width:I,height:F}),ee=null!==(r=null===(i=J.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==r?r:.5,te=t.useMemo(()=>(e,t)=>{var o,n,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(o=J.effectiveSelectionHook)||void 0===o?void 0:o.isActive,l=null===(n=J.effectiveSelectionHook)||void 0===n?void 0:n.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const o=s[t],n=s[t+1],d=bl(t,u),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:ee:1;c&&(e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle=d,e.lineWidth=m,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[m,J.effectiveSelectionHook,ee]),oe=t.useMemo(()=>[te],[te]),ne=t.useMemo(()=>(t,o,n)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const a=s.length,l=100>a,c=[];for(let t=0;a-1>t;t++){const o=s[t],n=s[t+1],u=bl(t,a),d="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,h="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,g=Math.min(d,h);l&&c.push(e.jsx("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),c.push(e.jsx("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:g},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),ie=t.useMemo(()=>[ne],[ne]),re=t.useMemo(()=>e=>{var t,o;const n=Z.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?bl(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,Z]),se=al({colorScale:void 0,baseStyleExtras:re,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ae=y||("string"==typeof p?p:"Order"),le=t.useMemo(()=>Ys([{label:V||Hs(g),accessor:g,role:"x",format:d},{label:U||Hs(f),accessor:f,role:"y",format:h},...p?[{label:ae,accessor:p,role:"group"}]:[]]),[g,f,V,U,p,ae,d,h]),ce=el({componentName:"ConnectedScatterplot",data:l,accessors:{xAccessor:g,yAccessor:f}}),{effectiveData:ue,statisticalAnnotations:de}=ml({data:Q,xAccessor:g,yAccessor:f,forecast:w,anomaly:j}),he=cl(k),ge=he||de.length>0?[...he?[he]:[],...x||[],...de]:x,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:ue}),{xAccessor:g,yAccessor:f,pointStyle:se,size:[I,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:d,yFormat:h,enableHover:W,showGrid:z}),Ns({title:Y,description:G,summary:q,accessibleTable:X,className:u,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:v,defaultTooltipContent:le})),$s({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:oe,svgPreRenderers:ie}),ge&&ge.length>0&&{annotations:ge}),A&&{xExtent:A}),S&&{yExtent:S}),J.crosshairProps),O);return J.earlyReturn?J.earlyReturn:ce?e.jsx(Fa,{componentName:"ConnectedScatterplot",message:ce,width:I,height:F}):e.jsx(Ga,{componentName:"ConnectedScatterplot",width:I,height:F,children:e.jsx(si,Object.assign({ref:s},fe))})});function kl(e){const{lineWidth:o=2,colorBy:n,colorScale:i,color:r,resolveStroke:s,fillArea:a,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g}=e,f=t.useMemo(()=>(e,t)=>{const c={strokeWidth:o},u=!0===a||Array.isArray(a)&&null!=t&&a.includes(t);let d;return s?d=s(e,t):n?i&&(d=ke(e,n,i)):d=r||Ma,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=l)),c},[o,n,i,r,s,a,l]),p=t.useMemo(()=>sl(f,{stroke:c,strokeWidth:u,opacity:d}),[f,c,u,d]);return t.useMemo(()=>va(p,null!=h?h:null,g),[p,h,g])}xl.displayName="ConnectedScatterplot";const wl=t.forwardRef(function(o,n){var i,r;const s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const a=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,summary:o.summary,accessibleTable:o.accessibleTable,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,axisExtent:g,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="linear",showPoints:w=!1,pointRadius:j=3,fillArea:A=!1,areaOpacity:S=.3,lineWidth:O=2,lineGradient:M,tooltip:C,pointIdAccessor:_,annotations:P,directLabel:L,gapStrategy:T="break",anomaly:R,forecast:B,band:E,xExtent:N,yExtent:$,frameProps:D={},selection:H,linkedHover:I,onObservation:F,onClick:W,hoverHighlight:z,hoverRadius:Y,chartId:G,loading:q,loadingContent:X,emptyContent:V,legendInteraction:U,legendPosition:K,xScaleType:Q,yScaleType:Z,color:J,stroke:ee,strokeWidth:te,opacity:oe}=o,{width:ne,height:ie,enableHover:re,showGrid:se,showLegend:ae,title:le,description:ce,summary:ue,accessibleTable:de,xLabel:he,yLabel:ge}=a,fe=t.useMemo(()=>k(l),[l]);Ka("LineChart",fe,"xAccessor",f),Ka("LineChart",fe,"yAccessor",p);const{effectiveData:pe,statisticalAnnotations:ye}=ml({data:fe,xAccessor:f,yAccessor:p,forecast:B,anomaly:R,groupBy:y}),me="__compoundGroup",ve=!(!B||!y),be=ve?me:B?hl:y,xe=t.useMemo(()=>{if(!ve)return pe;const e="function"==typeof y?y:e=>e[y];return pe.map(t=>{const o=Object.assign({},t);return o[me]=`${e(t)}__${t[hl]||"observed"}`,o})},[pe,ve,y]),we=ve?xe:pe,je=v||y,Ae=t.useMemo(()=>{if(!B)return;const e=B.upperBounds,t=B.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=pe;for(const e of s){const t="function"==typeof p?p(e):+e[p];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},[B,pe,p]),Se=t.useCallback(e=>{const t="function"==typeof f?f(e):e[f],o="function"==typeof p?p(e):e[p];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[f,p]),Oe=void 0!==(null===(i=we[0])||void 0===i?void 0:i[m]),Me=t.useMemo(()=>{if(Oe)return we;if(be){const e=we.reduce((e,t)=>{const o="function"==typeof be?be(t):t[be];if(!e[o]){const n={[m]:[]};"string"==typeof be&&(n[be]=o),ve&&(n[hl]=t[hl],"string"==typeof y&&(n[y]=t[y])),e[o]=n}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:we}]},[we,be,m,Oe]),{gapProcessedLineData:Ce,hasGaps:_e}=t.useMemo(()=>{if("interpolate"===T){let e=!1;const t=[];for(const o of Me){const n=(o[m]||[]).filter(t=>!Se(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[m]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const o of Me){const n=o[m]||[];let i=[],r=0;const s=be&&"string"==typeof be?o[be]:void 0;for(const a of n)if(Se(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[m]: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),{[m]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof p?p:"y",o=[];for(const n of Me){const i=n[m]||[],r=[];for(const o of i)Se(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[m]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Me,hasGaps:!1}},[Me,T,m,Se,be,p]),Pe="object"==typeof L?L:{},Le=Pe.position||"end",Te=Pe.fontSize||11,Re=t.useMemo(()=>{var e;if(!L||!je)return[];const t="function"==typeof je?je:e=>e[je],o=new Set;for(const n of Ce){const i=n[m]||[];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)},[L,je,Ce,m,Le]),Be=t.useMemo(()=>{if(!L)return a.marginDefaults;const e=Re.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0)+10,t="end"===Le?"right":"left";return Object.assign(Object.assign({},a.marginDefaults),{[t]:Math.max(a.marginDefaults[t]||0,e)})},[L,Re,Te,Le,a.marginDefaults]),Ee=il({data:pe,rawData:l,colorBy:je,colorScheme:b,legendInteraction:U,legendPosition:K,selection:H,linkedHover:I,fallbackFields:je?["string"==typeof je?je:""]:[],unwrapData:!1,onObservation:F,onClick:W,hoverHighlight:z,chartType:"LineChart",chartId:G,showLegend:(!L||void 0!==ae)&&ae,userMargin:c,marginDefaults:Be,loading:q,loadingContent:X,emptyContent:V,width:ne,height:ie}),Ne=Ee.colorScale,$e=Ee.customHoverBehavior,De=Ee.customClickBehavior,He=Ee.crosshairProps,Ie=kl({lineWidth:O,colorBy:je,colorScale:Ne,color:J,fillArea:A,areaOpacity:S,stroke:ee,strokeWidth:te,opacity:oe,effectiveSelectionHook:Ee.effectiveSelectionHook,resolvedSelection:Ee.resolvedSelection}),[Fe,We]=t.useState(null);t.useEffect(()=>{if(!B)return void We(null);let e=!1;return function(...e){return dl(this,void 0,void 0,function*(){return(yield fl()).createSegmentLineStyle(...e)})}(Ie,B).then(t=>{e||We(()=>t)}).catch(()=>{e||We(null)}),()=>{e=!0}},[Ie,B]);const ze=Fe||Ie,Ye=t.useMemo(()=>{if(w)return e=>{const t={r:j,fillOpacity:1};return je?Ne&&(t.fill=ke(e.parentLine||e,je,Ne)):t.fill=J||Ma,t}},[w,j,je,Ne,J]),Ge=Array.isArray(A)?"mixed":A?"area":"line",qe=t.useMemo(()=>{var e;if(!L||!je)return[];const t="function"==typeof f?f:e=>e[f],o="function"==typeof p?p:e=>e[p],n="function"==typeof je?je:e=>e[je],i=new Map;for(const t of Ce){const o=t[m]||[];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 f?f:"x"]:t(n),["string"==typeof p?p:"y"]:o(n),dx:"end"===Le?6:-6,dy:0,color:Ne?Ne(e):Ma,fontSize:Te}));r.sort((e,t)=>{const o="string"==typeof p?p:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof p?p:"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},[L,je,Ne,Ce,m,f,p,Le,Te]),Xe=Ee.margin,Ve=y||v,Ue=t.useMemo(()=>Ys([{label:he||Hs(f),accessor:f,role:"x",format:d},{label:ge||Hs(p),accessor:p,role:"y",format:h},...Ve?[{label:Hs(Ve),accessor:Ve,role:"group"}]:[],...zs(E,h)]),[f,p,he,ge,Ve,d,h,E]),Ke=el({componentName:"LineChart",data:Oe?(null===(r=pe[0])||void 0===r?void 0:r[m])||[]:l,accessors:{xAccessor:f,yAccessor:p}}),Qe=t.useMemo(()=>Oe||be||_e?Ce.flatMap(e=>{const t=e[m]||[];return be&&"string"==typeof be?t.map(t=>Object.assign(Object.assign({},t),{[be]:e[be]})):t}):we,[Ce,m,Oe,be,we,_e]),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(Object.assign(Object.assign({chartType:Ge},Array.isArray(A)&&{areaGroups:A}),M&&{lineGradient:M}),null!=Y&&{hoverRadius:Y}),null!=l&&{data:Qe}),{xAccessor:f,yAccessor:p,xScaleType:Q,yScaleType:Z}),N&&{xExtent:N}),!$||null==$[0]&&null==$[1]?Ae?{yExtent:Ae}:{}:{yExtent:$}),{groupAccessor:"break"===T&&_e?"_gapSegment":be||void 0}),E&&{band:E}),{curve:x,lineStyle:ze}),w&&{pointStyle:Ye}),{size:[ne,ie],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Xe,showAxes:a.showAxes,xLabel:he,yLabel:ge,xFormat:d,yFormat:h}),void 0!==g&&{axisExtent:g}),{enableHover:re,showGrid:se}),Ee.legendBehaviorProps),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===C?()=>null:"multi"===C?xn():kn(C)||Ue}),"multi"===C&&{tooltipMode:"multi"}),(I||F||W||z)&&{customHoverBehavior:$e}),(F||W||I)&&{customClickBehavior:De}),_&&{pointIdAccessor:_}),((null==P?void 0:P.length)||ye.length||qe.length)&&{annotations:[...P||[],...ye,...qe]}),He),D);return Ee.earlyReturn?Ee.earlyReturn:Ke?e.jsx(Fa,{componentName:"LineChart",message:Ke,width:ne,height:ie}):e.jsx(Ga,{componentName:"LineChart",width:ne,height:ie,children:e.jsx(si,Object.assign({ref:s},Ze))})});function jl(e){var o;const{safeData:n,data:i,areaBy:r,lineDataAccessor:s,colorBy:a,colorScale:l,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:j,xFormat:A,yFormat:S,groupField:O}=e,M=void 0!==(null===(o=n[0])||void 0===o?void 0:o[s]),C=t.useMemo(()=>{if(null==i)return[];if(!M&&!r)return n;let e;if(M)e=n;else{const t=r,o=n.reduce((e,o)=>{const n="function"==typeof t?t(o):o[t];if(!e[n]){const o={[s]:[]};"string"==typeof t&&(o[t]=n),e[n]=o}return e[n][s].push(o),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[s]||[];return r&&"string"==typeof r?t.map(t=>Object.assign(Object.assign({},t),{[r]:e[r]})):t})},[i,n,r,s,M]),_=t.useMemo(()=>e=>{const t={};if(a){if(l){const o=ke(e,a,l);t.fill=o,y?(t.stroke=o,t.strokeWidth=m):t.stroke="none"}}else{const e=c||Ma;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=t.useMemo(()=>sl(_,{stroke:u,strokeWidth:d,opacity:h}),[_,u,d,h]);return{flattenedData:C,lineStyle:t.useMemo(()=>va(P,null!=g?g:null,f),[P,g,f]),pointStyle:t.useMemo(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return a?l&&(t.fill=ke(e.parentLine||e,a,l)):t.fill=c||Ma,t}},[v,b,a,l,c]),defaultTooltipContent:t.useMemo(()=>Ys([{label:w||Hs(x),accessor:x,role:"x",format:A},{label:j||Hs(k),accessor:k,role:"y",format:S},...O?[{label:Hs(O),accessor:O,role:"group"}]:[],...zs(e.band,S)]),[x,k,w,j,O,A,S,e.band])}}function Al(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}wl.displayName="LineChart";const Sl=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"xy",frameRef:i});const r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,y0Accessor:f,gradientFill:p=!1,semanticGradient:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="monotoneX",areaOpacity:w=.7,lineGradient:j,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:M=3,tooltip:C,annotations:_,forecast:P,anomaly:L,band:T,xExtent:R,yExtent:B,frameProps:E={},selection:N,linkedHover:$,onObservation:D,onClick:H,hoverHighlight:I,chartId:F,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:K}=o,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:oe,description:ne,summary:ie,accessibleTable:re,xLabel:se,yLabel:ae}=r,le=t.useMemo(()=>k(s),[s]),ce=v||g,ue=t.useMemo(()=>{return y&&y.length>0?{colorStops:(e=y,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Al(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[y,p]);Ka("AreaChart",le,"xAccessor",d),Ka("AreaChart",le,"yAccessor",h);const de=il({data:le,rawData:s,colorBy:ce,colorScheme:b,legendInteraction:G,legendPosition:q,selection:N,linkedHover:$,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:D,onClick:H,hoverHighlight:I,chartType:"AreaChart",chartId:F,showLegend:te,userMargin:a,marginDefaults:r.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:Q,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=ml({data:le,xAccessor:d,yAccessor:h,forecast:P,anomaly:L,groupBy:g}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:me}=jl({safeData:he,data:s,areaBy:g,lineDataAccessor:m,colorBy:ce,colorScale:de.colorScale,color:X,stroke:V,strokeWidth:U,opacity:K,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:w,showLine:A,lineWidth:S,showPoints:O,pointRadius:M,xAccessor:d,yAccessor:h,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,groupField:g||v,band:T}),ve=el({componentName:"AreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=s&&{data:fe}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0}),f&&{y0Accessor:f}),T&&{band:T}),ue&&{gradientFill:ue}),j&&{lineGradient:j}),{curve:x,lineStyle:pe}),O&&ye&&{pointStyle:ye}),{size:[Q,Z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:de.margin,showAxes:r.showAxes,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,enableHover:J}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),Ns({title:oe,description:ne,summary:ie,accessibleTable:re,className:l,animate:o.animate,axisExtent:o.axisExtent})),"multi"===C?{tooltipContent:xn(),tooltipMode:"multi"}:Ds({tooltip:C,defaultTooltipContent:me})),$s({linkedHover:$,onObservation:D,onClick:H,hoverHighlight:I,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(_&&_.length>0||ge.length>0)&&{annotations:[..._||[],...ge]}),R&&{xExtent:R}),B&&{yExtent:B}),de.crosshairProps),E);return de.earlyReturn?de.earlyReturn:ve?e.jsx(Fa,{componentName:"AreaChart",message:ve,width:Q,height:Z}):e.jsx(Ga,{componentName:"AreaChart",width:Q,height:Z,children:e.jsx(si,Object.assign({ref:i},be))})});function Ol(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}Sl.displayName="AreaChart";const Ml=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",seriesAAccessor:h="a",seriesBAccessor:g="b",seriesALabel:f="A",seriesBLabel:p="B",seriesAColor:y="var(--semiotic-danger, #dc2626)",seriesBColor:m="var(--semiotic-info, #2563eb)",showLines:v=!0,lineWidth:b=1.5,showPoints:x=!1,pointRadius:w=3,curve:j="linear",areaOpacity:A=.6,gradientFill:S,tooltip:O,annotations:M,xExtent:C,yExtent:_,frameProps:P={},selection:L,linkedHover:T,onObservation:R,onClick:B,hoverHighlight:E,chartId:N,loading:$,loadingContent:D,emptyContent:H,legendInteraction:I,legendPosition:F,pointIdAccessor:W,windowSize:z}=o,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=t.useMemo(()=>"function"==typeof d?e=>Ol(d(e)):e=>Ol(e[d]),[d]),oe=t.useMemo(()=>"function"==typeof h?e=>Ol(h(e)):e=>Ol(e[h]),[h]),ne=t.useMemo(()=>"function"==typeof g?e=>Ol(g(e)):e=>Ol(e[g]),[g]),[ie,re]=t.useState([]),se=t.useRef([]),ae=null==s,le=t.useMemo(()=>k(ae?ie:s),[ae,ie,s]),ce=t.useMemo(()=>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 u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(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 m=u(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 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:d(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(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:d(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:d(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}(le,te,oe,ne),[le,te,oe,ne]),ue=t.useMemo(()=>v?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}(le,te,oe,ne):[],[v,le,te,oe,ne]),de=t.useMemo(()=>[...ce,...ue],[ce,ue]),he=t.useMemo(()=>{const e=new Set;for(const t of ce)e.add(t.__diffSegment);return Array.from(e)},[ce]);t.useImperativeHandle(n,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;se.current=t,re(t)},t=W?"function"==typeof W?W:e=>e[W]:null;return{push:t=>e([...se.current,t]),pushMany:t=>e([...se.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of se.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=se.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:()=>ae?se.current:le,getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[ae,le,W,z]);const ge=il({data:le,rawData:s,colorBy:"__diffWinner",colorScheme:[y,m],legendInteraction:I,legendPosition:F,selection:L,linkedHover:T,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:R,onClick:B,hoverHighlight:E,chartType:"DifferenceChart",chartId:N,showLegend:V,userMargin:a,marginDefaults:r.marginDefaults,loading:$,loadingContent:D,emptyContent:H,width:Y,height:G}),fe=t.useMemo(()=>{if(!1!==V)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:f,color:y},{label:p,color:m}]}]}},[V,f,p,y,m]),pe=t.useCallback(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?y:m,stroke:"none",fillOpacity:A}},[y,m,A]),ye=t.useCallback(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,strokeWidth:b,fill:"none"}),[y,m,b]),me=t.useCallback(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,r:w}),[y,m,w]),ve=t.useCallback(t=>{var o;const n=t.data,i=t.allSeries,r=null!==(o=t.xValue)&&void 0!==o?o:null==n?void 0:n.__x;let s=null==n?void 0:n.__valA,a=null==n?void 0:n.__valB;if(i&&i.length>0){const e=i.find(e=>"line-A"===e.group),t=i.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(s=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(a=t.value)}if(null!=r&&(null==s||null==a)){const e=le.find(e=>te(e)===r);e&&(null==s&&(s=oe(e)),null==a&&(a=ne(e)))}const l=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=c&&null!=r?c(r):null!=r?r+"":"";return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:u}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[f,": ",l(s)]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[p,": ",l(a)]})]}),null!=s&&null!=a&&Number.isFinite(s)&&Number.isFinite(a)&&e.jsxs("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",l(s-a)]})]})},[le,te,oe,ne,c,y,m,f,p]),be="multi"===O,xe=t.useMemo(()=>!1===O?()=>null:be?ve:kn(O)||ve,[O,be,ve]),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:"mixed",data:de,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:he,curve:j,areaStyle:pe,lineStyle:ye},x&&{pointStyle:me}),{size:[Y,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:q,showGrid:X}),S&&{gradientFill:!0===S?{topOpacity:.85,bottomOpacity:.15}:S}),fe&&{legend:fe,legendPosition:ge.legendPosition}),Ns({title:U,description:K,summary:Q,accessibleTable:Z,className:l,animate:o.animate,axisExtent:o.axisExtent})),{tooltipContent:xe}),be&&{tooltipMode:"multi"}),$s({linkedHover:T,onObservation:R,onClick:B,hoverHighlight:E,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior})),M&&M.length>0&&{annotations:M}),C&&{xExtent:C}),_&&{yExtent:_}),ge.crosshairProps),P);return ge.earlyReturn?ge.earlyReturn:e.jsx(Ga,{componentName:"DifferenceChart",width:Y,height:G,children:e.jsx(si,Object.assign({ref:i},ke))})});"function"==typeof Ml&&(Ml.displayName="DifferenceChart");const Cl=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,curve:m="monotoneX",areaOpacity:v=.7,showLine:b=!0,lineWidth:x=2,showPoints:w=!1,pointRadius:j=3,normalize:A=!1,baseline:S="zero",stackOrder:O,tooltip:M,annotations:C,xExtent:_,yExtent:P,frameProps:L={},selection:T,linkedHover:R,onObservation:B,onClick:E,hoverHighlight:N,chartId:$,loading:D,loadingContent:H,emptyContent:I,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=o,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=r,ie=t.useMemo(()=>k(s),[s]),re=p||g;rl(n,{variant:"xy",frameRef:i});const se=il({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:F,legendPosition:W,selection:T,linkedHover:R,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:B,onClick:E,hoverHighlight:N,chartType:"StackedAreaChart",chartId:$,showLegend:Q,userMargin:a,marginDefaults:r.marginDefaults,loading:D,loadingContent:H,emptyContent:I,width:X,height:V}),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=jl({safeData:ie,data:s,areaBy:g,lineDataAccessor:f,colorBy:re,colorScale:se.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,areaOpacity:v,showLine:b,lineWidth:x,showPoints:w,pointRadius:j,xAccessor:d,yAccessor:h,xLabel:oe,yLabel:ne,xFormat:c,yFormat:u,groupField:g||p}),de=el({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),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!=s&&{data:ae}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0,curve:m,normalize:A,baseline:A?"zero":S,stackOrder:O,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:se.margin,showAxes:r.showAxes,xLabel:oe,yLabel:ne,xFormat:c,yFormat:u,enableHover:U}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:K}),se.legendBehaviorProps),Ns({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:o.animate,axisExtent:o.axisExtent})),"multi"===M?{tooltipContent:xn(),tooltipMode:"multi"}:Ds({tooltip:M,defaultTooltipContent:ue})),$s({linkedHover:R,onObservation:B,onClick:E,hoverHighlight:N,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),C&&C.length>0&&{annotations:C}),_&&{xExtent:_}),P&&{yExtent:P}),se.crosshairProps),L);return se.earlyReturn?se.earlyReturn:de?e.jsx(Fa,{componentName:"StackedAreaChart",message:de,width:X,height:V}):e.jsx(Ga,{componentName:"StackedAreaChart",width:X,height:V,children:e.jsx(si,Object.assign({ref:i},he))})});Cl.displayName="StackedAreaChart";const _l=t.forwardRef(function(o,n){var r;const s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const a=Ha(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:w,xExtent:j,yExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,showLegend:E,legendPosition:N,legendInteraction:$}=o,{width:D,height:H,enableHover:I,title:F,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=a,X=Ua(T,D,H,R),V=X?null:Va(l,D,H,B),U=t.useMemo(()=>k(l),[l]),K=function(){var e;const t=Oa();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),ce=null!==(r=null!=y?y:K)&&void 0!==r?r:"blues",ue=null!=E&&E,de=null!=N?N:"right",{margin:he}=Na({data:U,colorBy:ue?"value":void 0,colorScale:void 0,showLegend:ue,legendPosition:de,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:ge,customClickBehavior:fe,crosshairSourceId:pe}=Ba({selection:O,linkedHover:M,fallbackFields:[],onObservation:C,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});nl(O);const ye=Ea(M,pe);$a($,void 0,[]);const me=t.useMemo(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ve=t.useMemo(()=>{const e=U.map(me);return[Math.min(...e),Math.max(...e)]},[U,me]),be=t.useMemo(()=>"custom"===ce&&m?m:i.scaleSequential({blues:Q,reds:Z,greens:J,viridis:ne,oranges:ee,purples:te,greys:oe,plasma:ie,inferno:re,magma:se,cividis:ae,turbo:le}[ce]||Q).domain(ve),[ce,m,ve]),xe=t.useMemo(()=>Ys([{label:G||Hs(d),accessor:d,role:"x",format:f},{label:q||Hs(h),accessor:h,role:"y",format:p},{label:Hs(g),accessor:g,role:"value",format:b}]),[d,h,G,q,g,f,p,b]),ke=el({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),we=t.useMemo(()=>{if(ue)return{gradient:{colorFn:e=>be(e),domain:ve,label:"string"==typeof g?g:"value",format:b}}},[ue,be,ve,g,b]),je=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:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==ce?ce:void 0,showValues:v,heatmapValueFormat:b,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:he,showAxes:a.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:I}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),we&&{legend:we,legendPosition:de}),Ns({title:F,description:W,summary:z,accessibleTable:Y,className:u,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:xe})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ge,customClickBehavior:fe})),w&&w.length>0&&{annotations:w}),j&&{xExtent:j}),A&&{yExtent:A}),ye),S);return X||V||(ke?e.jsx(Fa,{componentName:"Heatmap",message:ke,width:D,height:H}):e.jsx(Ga,{componentName:"Heatmap",width:D,height:H,children:e.jsx(si,Object.assign({ref:s},je))}))});_l.displayName="Heatmap";const Pl=t.forwardRef(function(o,n){const i=t.useRef(null),r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",sizeBy:g,sizeRange:f=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:v=1,bubbleStrokeColor:b="white",tooltip:x,marginalGraphics:w,pointIdAccessor:j,annotations:A,regression:S,xExtent:O,yExtent:M,frameProps:C={},selection:_,linkedHover:P,linkedBrush:L,onObservation:T,onClick:R,hoverHighlight:B,chartId:E,loading:N,loadingContent:$,emptyContent:D,legendInteraction:H,legendPosition:I,color:F,stroke:W,strokeWidth:z,opacity:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=t.useMemo(()=>k(s),[s]),ne=void 0===s,ie=il({data:oe,rawData:s,colorBy:p,colorScheme:y,legendInteraction:H,legendPosition:I,selection:_,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:B,chartType:"BubbleChart",chartId:E,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:N,loadingContent:$,emptyContent:D,width:G,height:q}),{domain:re,trackPushed:se,reset:ae}=ll({accessor:g,data:oe,isPushMode:ne}),le=t.useCallback(e=>{var t;se([e]),null===(t=i.current)||void 0===t||t.push(e)},[se]),ce=t.useCallback(e=>{var t;se(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[se]);rl(n,{variant:"xy",frameRef:i,overrides:{push:le,pushMany:ce,clear:()=>{var e;ae(),null===(e=i.current)||void 0===e||e.clear()}},deps:[le,ce,ae]});const ue=ma(L);ra({name:(null==ue?void 0:ue.name)||"__unused_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof d?d:void 0),yField:(null==ue?void 0:ue.yField)||("string"==typeof h?h:void 0)});const de=t.useMemo(()=>({stroke:b,strokeWidth:v}),[b,v]),he=t.useMemo(()=>null!=re?re:[0,1],[re]),ge=t.useCallback(e=>je(e,g,f,he),[g,f,he]),fe=al({colorBy:p,colorScale:ie.colorScale,color:F,fillOpacity:m,radiusFn:ge,baseStyleExtras:de,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),pe=t.useMemo(()=>Ys([{label:ee||Hs(d),accessor:d,role:"x",format:c},{label:te||Hs(h),accessor:h,role:"y",format:u},{label:Hs(g),accessor:g,role:"size"},...p?[{label:Hs(p),accessor:p,role:"color"}]:[]]),[d,h,ee,te,g,p,c,u]),ye=el({componentName:"BubbleChart",data:s,accessors:{xAccessor:d,yAccessor:h},requiredProps:{sizeBy:g}});if(ye)return e.jsx(Fa,{componentName:"BubbleChart",message:ye,width:G,height:q});const me=cl(S),ve=me?[me,...A||[]]:A,be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:oe}),{xAccessor:d,yAccessor:h,colorAccessor:p||void 0,sizeAccessor:g,sizeRange:f,pointStyle:fe,colorScheme:y,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),ie.legendBehaviorProps),Ns({title:K,description:Q,summary:Z,accessibleTable:J,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:pe})),$s({linkedHover:P,onObservation:T,onClick:R,hoverHighlight:B,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),ve&&ve.length>0&&{annotations:ve}),O&&{xExtent:O}),M&&{yExtent:M}),ie.crosshairProps),C);return ie.earlyReturn?ie.earlyReturn:e.jsx(Ga,{componentName:"BubbleChart",width:G,height:q,children:e.jsx(si,Object.assign({ref:i},be))})});Pl.displayName="BubbleChart";const Ll="__splomIdx",Tl={top:4,bottom:4,left:4,right:4};function Rl({frameRef:i,cellSize:r,onBrush:s}){const a=t.useRef(null),l=r-Tl.left-Tl.right,c=r-Tl.top-Tl.bottom;return t.useEffect(()=>{if(!a.current)return;const e=o.select(a.current).select(".brush-g"),t=n.brush().extent([[0,0],[l,c]]).on("brush end",e=>{var t;const o=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void s(null);const[[n,r],[a,l]]=e.selection,c=[[o.x.invert(n),o.y.invert(r)],[o.x.invert(a),o.y.invert(l)]];s(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,c,i,s]),e.jsx("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${Tl.left},${Tl.top})`})})}function Bl({data:o,xField:n,yField:i,cellSize:r,pointRadius:s,pointOpacity:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,unselectedOpacity:h,mode:g,onPointHover:f}){const p=t.useRef(null),y=oa({name:u,clientId:`splom-${n}-${i}`}),m=ra({name:u,xField:n,yField:i}),v=oa({name:d,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==f||f(null));const t=e.data,o=null==t?void 0:t[Ll];void 0!==o&&(b({[Ll]:[o]}),null==f||f(t,e.x+Tl.left,e.y+Tl.top))},[b,f]),w=t.useCallback(e=>{const t={opacity:a,r:s};return t.fill=l?ke(e,l,c):Ma,"hover"===g?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*a):y.isActive&&!y.predicate(e)&&(t.opacity=h),t},[l,c,a,s,g,y.isActive,y.predicate,v.isActive,v.predicate,h]);return e.jsxs("div",{style:{position:"relative",width:r,height:r},children:[e.jsx(si,{ref:p,chartType:"scatter",data:o,size:[r,r],xAccessor:n,yAccessor:i,pointStyle:w,margin:Tl,showAxes:!1,enableHover:"hover"===g,customHoverBehavior:"hover"===g?k:void 0,tooltipContent:"hover"===g?()=>null:void 0}),"brush"===g&&e.jsx(Rl,{frameRef:p,cellSize:r,xField:n,yField:i,onBrush:x})]})}function El({data:o,field:n,label:i,cellSize:r,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=oa({name:c,clientId:"splom-diag-"+n}),g=oa({name:u,clientId:`splom-diag-${n}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.predicate,m=t.useMemo(()=>{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)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(o.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(s).fill(0),h=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),f=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const r=Math.min(Math.floor((o-t)/i),s-1);if(d[r]++,p&&!y(e)||h[r]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[r][t]++,p&&!y(e)||f[r][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:o,category:c[n]};return o+=i,a})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:o,category:c[n]};return o+=i,a})});return{bars:d.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[o,n,s,r,p,y,a]);return e.jsxs("svg",{width:r,height:r,style:{overflow:"hidden"},children:[e.jsx("text",{x:r/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.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ma,opacity:p?.3:.6},`bg-${o}-${n}`))):m.bars.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Ma,opacity:p?.3:.6},"bg-"+o)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,o)=>t.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ma,opacity:.7},`sel-${o}-${n}`))):m.selectedBars.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Ma,opacity:.7},"sel-"+o)))]})}function Nl({label:t,cellSize:o}){return e.jsx("svg",{width:o,height:o,children:e.jsx("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function $l(o){const{data:n,fields:i,fieldLabels:r={},colorBy:s,colorScheme:a,cellSize:l=150,cellGap:c=4,pointRadius:u=2,pointOpacity:d=.5,diagonal:h="histogram",histogramBins:g=20,brushMode:f="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:j,chartId:A}=o,S="splom",O="splom-hover",M=y?"hover":f?"brush":"hover",C=Js(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(O),P(null)},[C,O]),T=t.useMemo(()=>(n||[]).map((e,t)=>void 0!==e[Ll]?e:Object.assign(Object.assign({},e),{[Ll]:t})),[n]),R=Ta(T,s,a),B=void 0!==x?x:!!s,E=t.useMemo(()=>{if(!B||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:R?R(e+""):Ma})):null},[B,s,T,R]),N=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>l+"px").join(" "),gridTemplateRows:i.map(()=>l+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,l,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[E&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:E.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:N,onMouseLeave:"hover"===M?L:void 0,children:[i.map((t,o)=>e.jsxs(p.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t}),i.map((n,i)=>o===i?"label"===h?e.jsx(Nl,{label:r[t]||t,cellSize:l},"diag-"+t):e.jsx(El,{data:T,field:t,label:r[t]||t,cellSize:l,bins:g,colorBy:s,colorScale:R,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,mode:M},"diag-"+t):e.jsx(Bl,{data:T,xField:n,yField:t,fieldLabels:r,cellSize:l,pointRadius:u,pointOpacity:d,colorBy:s,colorScale:R,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,showGrid:v,tooltip:b,mode:M,onPointHover:"hover"===M?(e,r,s)=>{e?(P({datum:e,xField:n,yField:t,colIndex:i,rowIndex:o,px:null!=r?r:0,py:null!=s?s:0}),j&&j({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})):(P(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A}))}:void 0},`cell-${t}-${n}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t},"col-label-"+t))]}),_&&"hover"===M&&(()=>{const t=_.datum,o=r[_.xField]||_.xField,n=r[_.yField]||_.yField,i=s?"function"==typeof s?s(t):t[s]:null,a=k?"function"==typeof k?k(t):t[k]:"Row "+t[Ll];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(l+c)+_.px,top:_.rowIndex*(l+c)+_.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.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),e.jsxs("div",{children:[o,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[n,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof s?s:"group",": ",i+""]})]})})()]})}function Dl(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e.jsx(pa,{selections:i,children:e.jsx($l,Object.assign({},t))})}function Hl({width:i,height:r,margin:s,scales:a,brushDirection:l,extent:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(!1),f=i+s.left+s.right,p=r+s.top+s.bottom;return t.useEffect(()=>{if(!d.current||!a)return;const e=o.select(d.current).select(".brush-group"),t="x"===l?n.brushX().extent([[0,0],[i,r]]):n.brushY().extent([[0,0],[i,r]]);return t.on("brush end",e=>{if(g.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const o=("x"===l?a.x:a.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];u(n)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,i,r,l,u]),t.useEffect(()=>{if(!h.current||!a||!d.current)return;const e=o.select(d.current).select(".brush-group"),t="x"===l?a.x:a.y;if(g.current=!0,c){const o=[t(c[0]),t(c[1])];e.call(h.current.move,o)}else e.call(h.current.move,null);g.current=!1},[c,a,l]),e.jsx("svg",{ref:d,width:f,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${s.left},${s.top})`})})}function Il(o){var n,i;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,description:d,summary:h,xLabel:g,yLabel:f,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:v="y",lineBy:b,lineDataAccessor:x="coordinates",colorBy:w,colorScheme:j,curve:A="linear",lineWidth:S=2,fillArea:O=!1,areaOpacity:M=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:T,legendPosition:R,tooltip:B,minimap:E={},renderBefore:N=!1,onBrush:$,brushExtent:D,yExtent:H,frameProps:I={},loading:F,loadingContent:W,emptyContent:z}=o,Y=Ua(F,s,a,W),G=Y?null:Va(r,s,a,z),q=t.useMemo(()=>k(r),[r]),[X,V]=t.useState(null),U=null!=D?D:X,K=t.useCallback(e=>{D||V(e),null==$||$(e)},[D,$]),Q=t.useRef(null),[Z,J]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=Q.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?J(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[r]);const ee=void 0!==(null===(n=q[0])||void 0===n?void 0:n[x]),te=t.useMemo(()=>{if(ee)return q;if(b){const e=q.reduce((e,t)=>{const o="function"==typeof b?b(t):t[b];if(!e[o]){const t={[x]:[]};"string"==typeof b&&(t[b]=o),e[o]=t}return e[o][x].push(t),e},{});return Object.values(e)}return[{[x]:q}]},[q,b,x,ee]),oe=t.useMemo(()=>ee||b?te.flatMap(e=>{const t=e[x]||[];return b&&"string"==typeof b?t.map(t=>Object.assign(Object.assign({},t),{[b]:e[b]})):t}):q,[te,x,ee,b,q]),ne=Ta(q,w,j),ie=kl({lineWidth:S,colorBy:w,colorScale:ne,fillArea:O,areaOpacity:M}),re=t.useMemo(()=>{if(E.lineStyle)return E.lineStyle},[E.lineStyle]),se=kl({lineWidth:1,colorBy:w,colorScale:ne}),ae=null!=re?re:se,le=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?ke(e.parentLine||e,w,ne):Ma,t}},[C,_,w,ne]),{legend:ce,margin:ue,legendPosition:de}=Na({data:te,colorBy:w,colorScale:ne,showLegend:T,legendPosition:R,userMargin:l}),he=E.height||60,ge=t.useMemo(()=>{var e,t,o,n,i,r,s,a;return{top:null!==(t=null===(e=E.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(n=null===(o=E.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(r=null===(i=E.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ue.left,right:null!==(a=null===(s=E.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[E.margin,ue]),fe=E.brushDirection||"x",pe=el({componentName:"MinimapChart",data:r,accessors:{xAccessor:m,yAccessor:v}});if(pe)return e.jsx(Fa,{componentName:"MinimapChart",message:pe,width:s,height:a});const ye=O?"area":"line",me=t.useMemo(()=>Ys([{label:g||Hs(m),accessor:m,role:"x",format:p},{label:f||Hs(v),accessor:v,role:"y",format:y}]),[m,v,g,f,p,y]),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ye,data:oe,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:A,lineStyle:ie},C&&{pointStyle:le}),{size:[s,a],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue,showAxes:!0,xLabel:g,yLabel:f,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),ce&&{legend:ce,legendPosition:de}),u&&{title:u}),d&&{description:d}),h&&{summary:h}),{tooltipContent:!1===B?()=>null:kn(B)||me}),U&&{xExtent:U}),H&&{yExtent:H}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),I),be=Object.assign({chartType:ye,data:oe,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:A,lineStyle:ae,size:[s,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(i=E.showAxes)&&void 0!==i&&i,background:E.background,enableHover:!1},H&&{yExtent:H}),xe=e.jsxs("div",{style:{position:"relative",width:s,overflow:"hidden"},children:[e.jsx(si,Object.assign({ref:Q},be)),e.jsx(Hl,{width:s-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:fe,extent:U,onBrush:K})]},"minimap"),we=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(si,Object.assign({},ve))},"main");return Y||G||e.jsx(Ga,{componentName:"MinimapChart",width:s,height:a,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[N?xe:we,N?we:xe]})})}Dl.displayName="ScatterplotMatrix",Il.displayName="MinimapChart";const Fl={label:"Low / High",color:"#E9C46A",opacity:.08},Wl={label:"High / High",color:"#2A9D8F",opacity:.08},zl={label:"Low / Low",color:"#E76F51",opacity:.08},Yl={label:"High / Low",color:"#86BBD8",opacity:.08};function Gl(e,t){var o,n,i;return{label:null!==(o=null==t?void 0:t.label)&&void 0!==o?o:e.label,color:null!==(n=null==t?void 0:t.color)&&void 0!==n?n:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const ql=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"xy",frameRef:i});const r=Ha(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xCenter:g,yCenter:f,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:v=12,colorBy:b,colorScheme:x,sizeBy:w,sizeRange:j=[3,15],pointRadius:A=5,pointOpacity:S=.8,tooltip:O,pointIdAccessor:M,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:T,onClick:R,hoverHighlight:B,chartId:E,loading:N,loadingContent:$,emptyContent:D,legendInteraction:H,legendPosition:I,color:F,stroke:W,strokeWidth:z,opacity:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=t.useMemo(()=>({topLeft:Gl(Fl,null==p?void 0:p.topLeft),topRight:Gl(Wl,null==p?void 0:p.topRight),bottomLeft:Gl(zl,null==p?void 0:p.bottomLeft),bottomRight:Gl(Yl,null==p?void 0:p.bottomRight)}),[p]),ne=t.useMemo(()=>k(s),[s]),ie=il({data:ne,rawData:s,colorBy:b,colorScheme:x,legendInteraction:H,legendPosition:I,selection:P,linkedHover:L,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:B,chartType:"QuadrantChart",chartId:E,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:N,loadingContent:$,emptyContent:D,width:G,height:q});Ka("QuadrantChart",ne,"xAccessor",d),Ka("QuadrantChart",ne,"yAccessor",h);const re=t.useMemo(()=>{if(!ne.length)return;const e="function"==typeof d?d:e=>+e[d],t="function"==typeof h?h:e=>+e[h];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!=g&&isFinite(g)&&(o>g&&(o=g),g>n&&(n=g)),null!=f&&isFinite(f)&&(i>f&&(i=f),f>r&&(r=f)),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,d,h,g,f]),se=t.useMemo(()=>{if(!w||0===ne.length)return;const e=ne.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[ne,w]),ae=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),le=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),ce=t.useMemo(()=>e=>{const t=ae(e),o=le(e),n=null!=g?t>=g:void 0,i=null!=f?o>=f:void 0;return void 0===i||void 0===n?F||Ma:i&&n?oe.topRight.color:i&&!n?oe.topLeft.color:!i&&n?oe.bottomRight.color:oe.bottomLeft.color},[ae,le,g,f,oe,F]),ue=t.useMemo(()=>w?e=>je(e,w,j,se):void 0,[w,j,se]),de=al({colorBy:b,colorScale:ie.colorScale,color:F,pointRadius:A,fillOpacity:S,radiusFn:ue,fallbackFill:ce,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),he=t.useMemo(()=>{if(!ne.length)return;const e=new Set;"string"==typeof d&&e.add(d),"string"==typeof h&&e.add(h),"string"==typeof b&&e.add(b),"string"==typeof w&&e.add(w);const t=ne[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ne,d,h,b,w]),ge=t.useMemo(()=>Ys([...he?[{label:he,accessor:he,role:"title"}]:[],{label:ee||Hs(d),accessor:d,role:"x",format:c},{label:te||Hs(h),accessor:h,role:"y",format:u},...b?[{label:Hs(b),accessor:b,role:"color"}]:[],...w?[{label:Hs(w),accessor:w,role:"size"}]:[]]),[he,d,h,ee,te,b,w,c,u]),fe=el({componentName:"QuadrantChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),pe=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.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!=g?n.x(g):s/2,c=null!=f?n.y(f):a/2;if(null!=g&&!isFinite(l))return;if(null!=f&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:oe.topLeft,x:0,y:0,w:u,h:d},{config:oe.topRight,x:u,y:0,w:s-u,h:d},{config:oe.bottomLeft,x:0,y:d,w:u,h:a-d},{config:oe.bottomRight,x:u,y:d,w:s-u,h:a-d}];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(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[g,f,oe,y]),ye=t.useMemo(()=>m?[...pe,(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!=g?o.x(g):i/2,a=null!=f?o.y(f):r/2;(null==g||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${v}px sans-serif`,e.globalAlpha=.5,e.fillStyle=oe.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(oe.topLeft.label,8,8),e.fillStyle=oe.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(oe.topRight.label,i-8,8),e.fillStyle=oe.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(oe.bottomLeft.label,8,r-8),e.fillStyle=oe.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(oe.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:pe,[pe,m,v,oe,g,f]),me=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...ye,...e]},[ye,_.canvasPreRenderers]),ve=t.useMemo(()=>{var t;const o={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,n,i)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return null;const r=i.width,s=i.height,a=null!=g?n.x(g):r/2,l=null!=f?n.y(f):s/2;if(null!=g&&!isFinite(a))return null;if(null!=f&&!isFinite(l))return null;const c=Math.max(0,Math.min(r,a)),u=Math.max(0,Math.min(s,l));return e.jsxs(e.Fragment,{children:[[{config:oe.topLeft,x:0,y:0,w:c,h:u},{config:oe.topRight,x:c,y:0,w:r-c,h:u},{config:oe.bottomLeft,x:0,y:u,w:c,h:s-u},{config:oe.bottomRight,x:c,y:u,w:r-c,h:s-u}].map((t,o)=>{var n;return t.w>0&&t.h>0?e.jsx("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.jsx("line",{x1:c,y1:0,x2:c,y2:s,stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.dashArray}),e.jsx("line",{x1:0,y1:u,x2:r,y2:u,stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+v,fill:oe.topLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:oe.topLeft.label}),e.jsx("text",{x:r-8,y:8+v,fill:oe.topRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:oe.topRight.label}),e.jsx("text",{x:8,y:s-8,fill:oe.bottomLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:oe.bottomLeft.label}),e.jsx("text",{x:r-8,y:s-8,fill:oe.bottomRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:oe.bottomRight.label})]})]})}]},[g,f,oe,y,m,v]),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:ne}),{xAccessor:d,yAccessor:h,colorAccessor:b||void 0,sizeAccessor:w||void 0,sizeRange:j,pointStyle:de,colorScheme:x,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),re&&{xExtent:re.xExtent,yExtent:re.yExtent}),ie.legendBehaviorProps),K&&{title:K}),Q&&{description:Q}),Z&&{summary:Z}),void 0!==J&&{accessibleTable:J}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:!1===O?()=>null:!0===O||void 0===O?ge:kn(O)||ge}),(L||T||R||B)&&{customHoverBehavior:ie.customHoverBehavior}),(T||R||L)&&{customClickBehavior:ie.customClickBehavior}),M&&{pointIdAccessor:M}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:me}),ie.crosshairProps),_),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:ve});return ie.earlyReturn?ie.earlyReturn:fe?e.jsx(Fa,{componentName:"QuadrantChart",message:fe,width:G,height:q}):e.jsx(Ga,{componentName:"QuadrantChart",width:G,height:q,children:e.jsx(si,Object.assign({ref:i},be))})});ql.displayName="QuadrantChart";const Xl="__ma_unitized",Vl="__ma_series";function Ul(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Kl(e,t){return t[0]+e*(t[1]-t[0])}const Ql=t.forwardRef(function(o,n){var i;const r=t.useRef(null),s=t.useRef([]),a=t.useRef(o.series);a.current=o.series,t.useImperativeHandle(n,()=>{const e=()=>{var e;return(null!==(e=a.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!r.current)return;const o=e(),n=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],i=t.extent||s.current[e];if(!i)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(n);null!=a&&isFinite(a)&&r.current.push(Object.assign(Object.assign({},n),{[Xl]:Ul(a,i),[Vl]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!r.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||s.current[t];if(!r)continue;const a=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=a&&isFinite(a)&&n.push(Object.assign(Object.assign({},e),{[Xl]:Ul(a,r),[Vl]:i.label||"Series "+(t+1)}))}r.current.pushMany(n)},remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const l=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:d,xFormat:h,xAccessor:g="x",series:f,colorScheme:y,curve:m="monotoneX",lineWidth:v=2,tooltip:b,annotations:x,frameProps:w={},selection:j,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,stroke:B,strokeWidth:E,opacity:N}=o,{width:$,height:D,enableHover:H,showGrid:I,showLegend:F=!0,title:W,description:z,summary:Y,accessibleTable:G,xLabel:q}=l,X=t.useMemo(()=>k(c),[c]),V=t.useMemo(()=>k(f),[f]),U=V,K=2===V.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||K||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${V.length}. Rendering as a standard multi-line chart.`);const Q=Ua(_,$,D,P),Z=Q?null:Va(c,$,D,L),J=Pa(),ee=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(J&&J.length>0)e=J;else{const t=ye[y];e=Array.isArray(t)?t:me}return U.map((t,o)=>t.color||e[o%e.length])},[U,y,J]),te=t.useMemo(()=>V.map((e,t)=>e.label||"Series "+(t+1)),[V]),{unitizedData:oe,extents:ne}=t.useMemo(()=>{if(0===X.length){const e=V.map(e=>e.extent||null).filter(Boolean);return e.length===V.length&&(s.current=e),{unitizedData:[],extents:e.length===V.length?e:[]}}const e=V.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]}(X,e.yAccessor));if(s.current=e,!K){const t=[];for(const e of X)for(let o=0;V.length>o;o++){const n=V[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Xl]:i,[Vl]:te[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of X)for(let n=0;2>n;n++){const i=V[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[Xl]:Ul(r,e[n]),[Vl]:te[n]}))}return{unitizedData:t,extents:e}},[X,V,K,te]),ie=t.useMemo(()=>{if(K&&ne.length>=2)return[{orient:"left",label:te[0],tickFormat:V[0].format||(e=>{const t=Kl(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:te[1],tickFormat:V[1].format||(e=>{const t=Kl(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[K,ne,V,te]),re=il({data:t.useMemo(()=>oe.length>0?oe:te.map(e=>({[Vl]:e})),[oe,te]),rawData:c,colorBy:Vl,colorScheme:ee,legendInteraction:T,legendPosition:R,selection:j,linkedHover:A,fallbackFields:[Vl],unwrapData:!1,onObservation:S,onClick:O,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:C,showLegend:F,userMargin:u,marginDefaults:K?Object.assign(Object.assign({},l.marginDefaults),{left:70,right:70}):l.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:$,height:D});if(re.earlyReturn)return re.earlyReturn;const se=t.useMemo(()=>{const e=new Map;return te.forEach((t,o)=>e.set(t,ee[o])),e},[te,ee]),ae=kl({lineWidth:v,resolveStroke:t.useCallback(e=>se.get(e[Vl])||ee[0],[se,ee]),stroke:B,strokeWidth:E,opacity:N,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),le=t.useMemo(()=>{if(!1===b)return()=>null;return kn(b)||(e=>{var t;const o=e.data||e,n=o[Vl],i=te.indexOf(n),r=o[Xl],s=K&&i>=0&&ne[i]?Kl(r,ne[i]):r,a=i>=0&&(null===(t=V[i])||void 0===t?void 0:t.format)?V[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),l="function"==typeof g?g(o):o[g];return p.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},p.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ee[i]||"inherit"}},n),p.createElement("div",null,`${"string"==typeof g?g:"x"}: ${l}`),p.createElement("div",null,`${n}: ${a(s)}`))})},[b,te,ee,ne,K,V,g]),ce=el({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),ue=K?[0,1]:void 0,de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:oe}),{xAccessor:g,yAccessor:Xl,groupAccessor:Vl,lineStyle:ae,colorScheme:ee,size:[$,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re.margin,showAxes:l.showAxes}),ie&&{axes:ie}),{xLabel:q}),K?{}:{yLabel:te[0]}),{xFormat:h}),K&&ue&&{yExtent:ue}),{enableHover:H}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:I,curve:m}),re.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:le}),x&&{annotations:x}),(A||S||O||M)&&{customHoverBehavior:re.customHoverBehavior}),(S||O||A)&&{customClickBehavior:re.customClickBehavior}),re.crosshairProps),w);return Q||Z||(ce?e.jsx(Fa,{componentName:"MultiAxisLineChart",message:ce,width:$,height:D}):e.jsx(Ga,{componentName:"MultiAxisLineChart",width:$,height:D,children:e.jsx(si,Object.assign({ref:r},de))}))});function Zl(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}Ql.displayName="MultiAxisLineChart";const Jl=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"xy",frameRef:i});const r=Ha(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,description:o.description,summary:o.summary,accessibleTable:o.accessibleTable}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",highAccessor:h="high",lowAccessor:g="low",openAccessor:f,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:v,xExtent:b,yExtent:x,frameProps:w={},selection:j,linkedHover:A,onObservation:S,onClick:O,chartId:M,loading:C,loadingContent:_,emptyContent:P}=o,{width:L,height:T,enableHover:R,showGrid:B,title:E,description:N,summary:$,accessibleTable:D,xLabel:H,yLabel:I}=r,F=Ua(C,L,T,_),W=F?null:Va(s,L,T,P),z=t.useMemo(()=>k(s),[s]),Y=null==f||null==p;Ka("CandlestickChart",z,"xAccessor",d),Ka("CandlestickChart",z,"highAccessor",h),Ka("CandlestickChart",z,"lowAccessor",g),Y||(Ka("CandlestickChart",z,"openAccessor",f),Ka("CandlestickChart",z,"closeAccessor",p));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=Ba({selection:j,linkedHover:A,onObservation:S,onClick:O,chartType:"CandlestickChart",chartId:M}),V=Ea(A,X),U=t.useMemo(()=>{const e=r.marginDefaults,t="sparkline"===o.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?t:Object.assign(Object.assign({},t),Zl(a))},[a,r.marginDefaults,o.mode]),K=t.useMemo(()=>{const e=[{label:H||Hs(d),accessor:d,role:"x",format:c}];return Y?(e.push({label:"High",accessor:h,role:"y",format:u}),e.push({label:"Low",accessor:g,format:u})):(e.push({label:"Open",accessor:f,format:u}),e.push({label:"High",accessor:h,format:u}),e.push({label:"Low",accessor:g,format:u}),e.push({label:"Close",accessor:p,format:u})),Ys(e)},[d,H,c,u,h,g,f,p,Y]),Q=el({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:d,highAccessor:h,lowAccessor:g},!Y&&{openAccessor:f,closeAccessor:p})}),Z=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!=s&&{data:z}),{xAccessor:d,yAccessor:h,highAccessor:h,lowAccessor:g}),!Y&&{openAccessor:f,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U,showAxes:r.showAxes,xLabel:H,yLabel:I,xFormat:c,yFormat:u,enableHover:R,showGrid:B}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),Ns({title:E,description:N,summary:$,accessibleTable:D,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:K})),$s({linkedHover:A,onObservation:S,onClick:O,customHoverBehavior:G,customClickBehavior:q})),v&&v.length>0&&{annotations:v}),b&&{xExtent:b}),x&&{yExtent:x}),V),w);return F||W||(Q?e.jsx(Fa,{componentName:"CandlestickChart",message:Q,width:L,height:T}):e.jsx(Ga,{componentName:"CandlestickChart",width:L,height:T,children:e.jsx(si,Object.assign({ref:i},ee))}))});function ec(e){const o=t.useRef(null);return rl(e.imperativeRef,{variant:e.imperativeVariant,frameRef:o}),{frameRef:o,resolved:Ha(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>Zl(e.margin),[e.margin])}}function tc(e){var t;const o=ec(e),{resolved:n,normalizedMargin:i}=o,r=il({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return Object.assign(Object.assign({},o),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}Jl.displayName="CandlestickChart";const oc=t.forwardRef(function(t,o){const{data:n,layout:i,layoutConfig:r,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:g,selection:f,linkedHover:p,chartId:y,loading:m,loadingContent:v,emptyContent:b,colorScheme:x,frameProps:k={}}=t,{frameRef:w,resolved:j,safeData:A,setup:S,earlyReturn:O}=tc({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorScheme:x,selection:f,linkedHover:p,onObservation:h,onClick:g,chartId:y,loading:m,loadingContent:v,emptyContent:b,margin:c,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel});if(O)return O;const{width:M,height:C,enableHover:_,showGrid:P,title:L,description:T,summary:R,accessibleTable:B,xLabel:E,yLabel:N}=j,$=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:A}),{customLayout:i,layoutConfig:r,xExtent:s,yExtent:a,colorScheme:x,size:[M,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:S.margin,showAxes:l,xLabel:E,yLabel:N,enableHover:_,showGrid:P}),S.legendBehaviorProps),Ns({title:L,description:T,summary:R,accessibleTable:B,className:u,animate:t.animate,axisExtent:t.axisExtent})),null!=t.tooltip&&{tooltipContent:t.tooltip}),$s({linkedHover:p,onObservation:h,onClick:g,hoverHighlight:!1,customHoverBehavior:S.customHoverBehavior,customClickBehavior:S.customClickBehavior})),d&&d.length>0&&{annotations:d}),S.crosshairProps),k);return e.jsx(Ga,{componentName:"XYCustomChart",width:M,height:C,children:e.jsx(si,Object.assign({ref:w},$))})});oc.displayName="XYCustomChart";const nc=t.forwardRef(function(o,n){const{nodes:i,edges:r,layout:s,layoutConfig:a,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:u="target",margin:d,className:h,colorScheme:g,frameProps:f={}}=o,{frameRef:p,resolved:y,normalizedMargin:m}=ec({imperativeRef:n,imperativeVariant:"network",margin:d,width:o.width,height:o.height,enableHover:o.enableHover,title:o.title,mode:o.mode}),v=t.useMemo(()=>k(null!=i?i:[]),[i]),b=t.useMemo(()=>k(null!=r?r:[]),[r]),{width:x,height:w,enableHover:j,title:A,description:S,summary:O,accessibleTable:M}=y,C=Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=i&&{nodes:v}),null!=r&&{edges:b}),{customNetworkLayout:s,layoutConfig:a,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,colorScheme:g,size:[x,w],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:m,className:h,title:A,description:S,summary:O,accessibleTable:M,enableHover:j}),f);return e.jsx(Ga,{componentName:"NetworkCustomChart",width:x,height:w,children:e.jsx(Es,Object.assign({ref:p},C))})});nc.displayName="NetworkCustomChart";const ic=t.forwardRef(function(t,o){const{data:n,layout:i,layoutConfig:r,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorScheme:g,showAxes:f=!1,annotations:p,onObservation:y,onClick:m,selection:v,linkedHover:b,chartId:x,loading:k,loadingContent:w,emptyContent:j,frameProps:A={}}=t,{frameRef:S,resolved:O,safeData:M,setup:C,earlyReturn:_}=tc({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorScheme:g,selection:v,linkedHover:b,onObservation:y,onClick:m,chartId:x,loading:k,loadingContent:w,emptyContent:j,margin:d,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,mode:t.mode});if(_)return _;const{width:P,height:L,enableHover:T,showGrid:R,title:B,description:E,summary:N,accessibleTable:$}=O,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:M}),{customLayout:i,layoutConfig:r,oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorScheme:g,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:C.margin,enableHover:T,showAxes:f,showGrid:R,annotations:p}),Ns({title:B,description:E,summary:N,accessibleTable:$,className:h,animate:t.animate,axisExtent:t.axisExtent})),$s({linkedHover:b,onObservation:y,onClick:m,hoverHighlight:!1,customHoverBehavior:C.customHoverBehavior,customClickBehavior:C.customClickBehavior})),A);return e.jsx(Ga,{componentName:"OrdinalCustomChart",width:P,height:L,children:e.jsx(Yi,Object.assign({ref:S},D))})});function rc({ref:e,frameRef:o,setup:n}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[o]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function sc(e){const{colorBy:o,colorScale:n,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=t.useMemo(()=>(e,t)=>{const l="function"==typeof p?p(e,t):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(o){if(!n)return c;c.fill=ke(e,o,n)}else c.fill=La(i,r,s,f?t:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[o,n,i,r,s,a,f,p,y]),v=t.useMemo(()=>sl(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:u,opacity:d}),[m,l,c,u,d]);return t.useMemo(()=>va(v,null!=h?h:null,g),[v,h,g])}ic.displayName="OrdinalCustomChart";const ac=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sort:p=!1,barPadding:y=40,roundedTop:m,gradientFill:v=!1,baselinePadding:b=!1,tooltip:x,annotations:w,regression:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,color:$,stroke:D,strokeWidth:H,opacity:I,showCategoryTicks:F,categoryFormat:W,dataIdAccessor:z}=o,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>k(s),[s]),oe=il({data:te,rawData:s,colorBy:g,colorScheme:f,legendInteraction:E,legendPosition:N,selection:O,linkedHover:M,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:B,width:Y,height:G}),{effectiveLegendProps:ne,effectiveMargin:ie}=rc({ref:n,frameRef:r,setup:oe});if(oe.earlyReturn)return oe.earlyReturn;Ka("BarChart",te,"categoryAccessor",c),Ka("BarChart",te,"valueAccessor",u);const re=Ra(te,p,u),se=Pa(),ae=t.useMemo(()=>new Map,[te]),le=sc({colorBy:g,colorScale:oe.colorScale,color:$,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),ce=t.useMemo(()=>Gs({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ue=el({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(Fa,{componentName:"BarChart",message:ue,width:Y,height:G});const de=cl(j),he=de?[de,...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!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie,barPadding:y}),null!=m&&{roundedTop:m}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),z&&{dataIdAccessor:z}),{baselinePadding:b,enableHover:q,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:F,oSort:p}),ne),Ns({title:U,description:K,summary:Q,accessibleTable:Z,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:ce})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),he&&he.length>0&&{annotations:he}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"BarChart",width:Y,height:G,children:e.jsx(Yi,Object.assign({ref:r},ge))})});ac.displayName="BarChart";const lc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,normalize:y=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,color:$,stroke:D,strokeWidth:H,opacity:I,categoryFormat:F}=o,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=f||u,te=il({data:J,rawData:s,colorBy:ee,colorScheme:p,legendInteraction:E,legendPosition:N,selection:O,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:B,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const oe=Pa(),ne=t.useMemo(()=>new Map,[J]),ie=sc({colorBy:ee,colorScale:te.colorScale,color:$,themeCategorical:oe,colorScheme:p,categoryIndexMap:ne,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),se=el({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=rc({ref:n,frameRef:r,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!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:G}),ae),Ns({title:X,description:V,summary:U,accessibleTable:K,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:w,defaultTooltipContent:re})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),j&&j.length>0&&{annotations:j}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(Fa,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(Ga,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(Yi,Object.assign({ref:r},ce))})});lc.displayName="StackedBarChart";const cc={RdBu:ce,PiYG:ue,PRGn:de,BrBG:he,RdYlBu:ge,RdYlGn:fe,Spectral:pe},uc="__likert_neutral_neg",dc="__likert_neutral_pos";function hc(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function gc(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 fc(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:uc,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:dc,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function pc(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===uc?r=o:o.__likertLevel===dc?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 yc=["Very Low","Low","Neutral","High","Very High"],mc=new Map,vc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:h="count",levels:g=yc,orientation:f="horizontal",colorScheme:y,barPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,categoryFormat:B,stroke:E,strokeWidth:N,opacity:$}=o,{width:D,height:H,enableHover:I,showGrid:F,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=i,U="horizontal"===f,K=void 0===s,Q=!d,Z=function(){var e;const t=Oa();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),J=t.useMemo(()=>y&&Array.isArray(y)&&y.length>=g.length?y:function(e,t){if(0>=e)return[];if(t){const o=cc[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}(g.length,Z),[y,g.length,Z]),ee=t.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],J[t]||"#888");return e},[g,J]),{processedData:te,reAggregate:oe,accumulatorRef:ne}=function({data:e,levels:o,categoryAccessor:n,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>hc(n,"question"),[n]),d=t.useMemo(()=>c?hc(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:hc(r,"level"),[c,r]),g=t.useMemo(()=>c?null:hc(s,"count"),[c,s]),f=e||[],p=t.useRef([]),y=t.useMemo(()=>{if(0===f.length)return[];let e=gc(f,o,u,d,h,g);return a&&(e=fc(e,o),e=pc(e,o)),e},[f,o,u,d,h,g,a]),m=t.useCallback(e=>{var t;let n=gc(e,o,u,d,h,g);a&&(n=fc(n,o),n=pc(n,o)),null===(t=l.current)||void 0===t||t.replace(n)},[o,u,d,h,g,a,l]);return{processedData:y,reAggregate:m,accumulatorRef:p}}({data:s,levels:g,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:h,isDiverging:U,frameRef:r}),ie="__likertLevelLabel",re=function({isPushMode:e,colorBy:o,colorScheme:n,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=Vs(),d=Pa(),h=t.useCallback(e=>{const t=e[o];return null!=t?t+"":null},[o]),g=t.useCallback(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),n=!0)}n&&c(e=>e+1)},[e,o,h]),f=t.useCallback(t=>{if(!e||!o)return;const n=Array.from(new Set(t.map(String))),i=a.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(s.current=new Set(n),a.current=n,c(e=>e+1))},[e,o]),p=t.useCallback(e=>t=>{g([t]),e(t)},[g]),y=t.useCallback(e=>t=>{g(t),e(t)},[g]),m=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);ha(e&&o?a.current:[]);const v=t.useMemo(()=>{if(!e||!o||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:d&&d.length>0?d:ve,s=o,l=t.map(e=>({[s]:e})),c=we(l,s,r);return ya({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:ke})},[e,o,i,n,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:p,wrapPushMany:y,resetCategories:m,categories:a.current,categoryDomainProps:e&&o?{legendCategoryAccessor:o,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:K,colorBy:ie,colorScheme:J,showLegend:W,legendPosition:R}),se=t.useCallback(re.wrapPush(e=>{ne.current.push(e),oe(ne.current)}),[re.wrapPush,oe,ne]),ae=t.useCallback(re.wrapPushMany(e=>{ne.current.push(...e),oe(ne.current)}),[re.wrapPushMany,oe,ne]);t.useImperativeHandle(n,()=>({push:se,pushMany:ae,remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;ne.current=[],re.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[se,ae,re.resetCategories,ne]);const le=il({data:te,rawData:s,colorBy:ie,colorScheme:J,legendInteraction:T,legendPosition:R,selection:w,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:D,height:H});if(le.earlyReturn)return le.earlyReturn;const ce=t.useMemo(()=>{const e=g.length;return e%2!=0&&ee.get(g[Math.floor(e/2)])||"#888"},[g,ee]),ue=sc({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:mc,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:E,strokeWidth:N,opacity:$,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.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===uc||i===dc)return{fill:ce};const r=n||i;return r&&ee.has(r)?{fill:ee.get(r)}:{fill:"#888"}}}),de=t.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),he=t.useMemo(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===uc||o===dc?de:o,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=o===uc||o===dc?2*r:r,a=t.__likertCount||0;return p.createElement("div",{className:"semiotic-tooltip",style:yn},p.createElement("div",{style:{fontWeight:"bold"}},i),p.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[de]),ge=t.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return Q?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),h&&(e.countAccessor=h)),el({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,u,d,h,g,Q]),fe=t.useMemo(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,ee]),pe=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},le.legendBehaviorProps),{legend:{legendGroups:fe},legendPosition:R||le.legendPosition||"bottom"}):le.legendBehaviorProps,[le.legendBehaviorProps,le.legendPosition,R,W,fe]),ye=t.useMemo(()=>{const e=Object.assign({},le.margin);if(K&&!1!==W){const t=R||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(re.streamingMarginAdjust)for(const[t,o]of Object.entries(re.streamingMarginAdjust))o>e[t]&&(e[t]=o);return U&&100>e.left&&(e.left=100),e},[le.margin,re.streamingMarginAdjust,U,K,W,R]),me=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:te}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:ue,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ye,barPadding:m,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V||(U?void 0:"Percentage"),rFormat:me}),B&&{oFormat:B}),{showGrid:F}),pe),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),{tooltipContent:!1===v?()=>null:!0===v?he:kn(v)||he}),(j||A||S||O)&&{customHoverBehavior:le.customHoverBehavior}),(A||S||j)&&{customClickBehavior:le.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(Fa,{componentName:"LikertChart",message:ge,width:D,height:H}):e.jsx(Ga,{componentName:"LikertChart",width:D,height:H,children:e.jsx(Yi,Object.assign({ref:r},be))})});function bc({brushProp:e,onBrushProp:o,linkedBrush:n,valueAccessor:i}){const r=ma("string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0),s=ra({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),a=t.useRef(s.brushInteraction);a.current=s.brushInteraction;const l=t.useCallback(e=>{if(r){a.current.end(e?e.r:null)}null==o||o(e)},[o,r]),c=!!(e||n||o);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}vc.displayName="LikertChart";const xc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sizeBy:p,sizeRange:y=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:w,valueExtent:j,brush:A,onBrush:S,linkedBrush:O,frameProps:M={},selection:C,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,chartId:R,loading:B,loadingContent:E,emptyContent:N,legendInteraction:$,legendPosition:D,color:H,stroke:I,strokeWidth:F,opacity:W,showCategoryTicks:z,categoryFormat:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=i,oe=t.useMemo(()=>k(s),[s]),ne=il({data:oe,rawData:s,colorBy:g,colorScheme:f,legendInteraction:$,legendPosition:D,selection:C,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:R,showLegend:U,userMargin:a,marginDefaults:i.marginDefaults,loading:B,loadingContent:E,emptyContent:N,width:G,height:q}),ie=bc({brushProp:A,onBrushProp:S,linkedBrush:O,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const re=t.useMemo(()=>{if(!p)return;const e=oe.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[oe,p]),se=Pa(),ae=t.useMemo(()=>new Map,[oe]),le=sc({colorBy:g,colorScale:ne.colorScale,color:H,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==M?void 0:M.pieceStyle,stroke:I,strokeWidth:F,opacity:W,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:p?je(e,p,y,re):m})}),ce=t.useMemo(()=>Gs({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),ue=el({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(Fa,{componentName:"SwarmPlot",message:ue,width:G,height:q});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne.margin,barPadding:b,enableHover:X}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:ee,rLabel:te,rFormat:h}),Y&&{oFormat:Y}),{showGrid:V,showCategoryTicks:z}),ne.legendBehaviorProps),Ns({title:K,description:Q,summary:Z,accessibleTable:J,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:ce})),$s({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),w&&w.length>0&&{annotations:w}),j&&{rExtent:j}),ie.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"SwarmPlot",width:G,height:q,children:e.jsx(Yi,Object.assign({ref:r},de))})});function kc(t){return o=>{var n;const i=o.category||o.data&&(null===(n=o.data[0])||void 0===n?void 0:n.category)||"",r=o.stats||(o.data||o).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const n=t.valueAccessor,r=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:yn,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}xc.displayName="SwarmPlot";const wc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,showOutliers:p=!0,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,frameProps:x={},selection:w,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:R,stroke:B,strokeWidth:E,opacity:N,showCategoryTicks:$,categoryFormat:D}=o,{width:H,height:I,enableHover:F,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=i,K=t.useMemo(()=>k(s),[s]),Q=il({data:K,rawData:s,colorBy:g,colorScheme:f,legendInteraction:L,legendPosition:T,selection:w,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:H,height:I});if(Q.earlyReturn)return Q.earlyReturn;const Z=Pa(),J=t.useMemo(()=>new Map,[K]),ee=sc({colorBy:g,colorScale:Q.colorScale,color:R,themeCategorical:Z,colorScheme:f,categoryIndexMap:J,userPieceStyle:void 0,stroke:B,strokeWidth:E,opacity:N,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>kc(),[]),oe=el({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(Fa,{componentName:"BoxPlot",message:oe,width:H,height:I});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:"boxplot"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:p,size:[H,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,barPadding:y,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:U,rFormat:h}),D&&{oFormat:D}),{showGrid:W,showCategoryTicks:$}),Q.legendBehaviorProps),Ns({title:Y,description:G,summary:q,accessibleTable:X,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:te})),$s({linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),v&&v.length>0&&{annotations:v}),b&&{rExtent:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"BoxPlot",width:H,height:I,children:e.jsx(Yi,Object.assign({ref:r},ne))})});wc.displayName="BoxPlot";const jc=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},Ac=t.forwardRef(function(o,n){const i=Ha(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"}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c=jc,valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:f,colorScheme:p,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,brush:x,onBrush:w,linkedBrush:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:B,legendPosition:E,color:N,stroke:$,strokeWidth:D,opacity:H,showCategoryTicks:I,categoryFormat:F}=o,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=il({data:J,rawData:s,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:E,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:W,height:z}),te=bc({brushProp:x,onBrushProp:w,linkedBrush:j,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const oe=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];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,u]),ne=Pa(),ie=t.useMemo(()=>new Map,[J]),re=sc({colorBy:f,colorScale:ee.colorScale,color:N,themeCategorical:ne,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const o=t.data||t,n=o.category||t.category||"",i=o.count,r=o.range;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[n&&e.jsx("div",{style:{fontWeight:"bold"},children:n+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]),ae=el({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(Fa,{componentName:"Histogram",message:ae,width:W,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),b?{rExtent:b}:oe&&{rExtent:oe}),{size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:I}),ee.legendBehaviorProps),Ns({title:X,description:V,summary:U,accessibleTable:K,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:se})),$s({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),v&&v.length>0&&{annotations:v}),te.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"Histogram",width:W,height:z,children:e.jsx(Yi,Object.assign({ref:r},le))})});Ac.displayName="Histogram";const Sc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:j,linkedBrush:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,color:$,stroke:D,strokeWidth:H,opacity:I,showCategoryTicks:F,categoryFormat:W}=o,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=i,ee=t.useMemo(()=>k(s),[s]),te=il({data:ee,rawData:s,colorBy:p,colorScheme:y,legendInteraction:E,legendPosition:N,selection:O,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:B,width:z,height:Y}),oe=bc({brushProp:w,onBrushProp:j,linkedBrush:A,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const ne=Pa(),ie=t.useMemo(()=>new Map,[ee]),re=sc({colorBy:p,colorScale:te.colorScale,color:$,themeCategorical:ne,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>kc({valueAccessor:u}),[u]),ae=el({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(Fa,{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!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[z,Y],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te.margin,barPadding:m,enableHover:G}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),Ns({title:V,description:U,summary:K,accessibleTable:Q,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:v,defaultTooltipContent:se})),$s({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"ViolinPlot",width:z,height:Y,children:e.jsx(Yi,Object.assign({ref:r},le))})});Sc.displayName="ViolinPlot";const Oc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=5,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:j,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:B,stroke:E,strokeWidth:N,opacity:$,showCategoryTicks:D,categoryFormat:H}=o,{width:I,height:F,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=i,Q=t.useMemo(()=>k(s),[s]),Z=il({data:Q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:T,legendPosition:R,selection:j,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:I,height:F});if(Z.earlyReturn)return Z.earlyReturn;const J=Pa(),ee=t.useMemo(()=>new Map,[Q]),te=sc({colorBy:p,colorScale:Z.colorScale,color:B,themeCategorical:J,colorScheme:y,categoryIndexMap:ee,userPieceStyle:void 0,stroke:E,strokeWidth:N,opacity:$,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),oe=t.useMemo(()=>kc(),[]),ne=el({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(Fa,{componentName:"RidgelinePlot",message:ne,width:I,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({chartType:"ridgeline"},null!=s&&{data:Q}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[I,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:W}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:D,oSort:!1,amplitude:g}),Z.legendBehaviorProps),Ns({title:G,description:q,summary:X,accessibleTable:V,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:v,defaultTooltipContent:oe})),$s({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"RidgelinePlot",width:I,height:F,children:e.jsx(Yi,Object.assign({ref:r},ie))})});Oc.displayName="RidgelinePlot";const Mc=t.forwardRef(function(o,n){const i=Ha(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}),r=t.useRef(null);rl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:f="horizontal",connectorOpacity:p=.3,showLabels:y=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:B,opacity:E,categoryFormat:N}=o,$="vertical"===f,{width:D,height:H,enableHover:I,showLegend:F,title:W,description:z,summary:Y,accessibleTable:G}=i,q=$?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>k(s),[s]),V=h||d,U=!V,K=il({data:X,rawData:s,colorBy:V,colorScheme:g,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"FunnelChart",chartId:O,showLegend:F,userMargin:a,marginDefaults:q,loading:M,loadingContent:C,emptyContent:_,width:D,height:H});if(K.earlyReturn)return K.earlyReturn;Ka("FunnelChart",X,"stepAccessor",c),Ka("FunnelChart",X,"valueAccessor",u);const Q=Pa(),Z=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(U)return T||((null==Q?void 0:Q[0])?Q[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[U,T,Q,g]),ee=sc({colorBy:J?void 0:V,colorScale:K.colorScale,color:null!=J?J:T,themeCategorical:Q,colorScheme:g,categoryIndexMap:Z,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:B,opacity:E,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection}),te=t.useMemo(()=>t=>{var o,n,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(n=null!==(o=null==l?void 0:l.__funnelValue)&&void 0!==o?o:null==l?void 0:l.__barFunnelValue)&&void 0!==n?n:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:yn,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),f&&f!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:f+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",p]})]})},[]),oe=el({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(oe)return e.jsx(Fa,{componentName:"FunnelChart",message:oe,width:D,height:H});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:$?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:$?"vertical":"horizontal",barPadding:$?40:0,pieceStyle:ee,size:[D,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:$,showCategoryTicks:$}),N&&{oFormat:N}),{showGrid:$}),!$&&{connectorOpacity:p}),{showLabels:y}),K.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?te:kn(m)||te}),(w||j||A||S)&&{customHoverBehavior:K.customHoverBehavior}),(j||A||w)&&{customClickBehavior:K.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"FunnelChart",width:D,height:H,children:e.jsx(Yi,Object.assign({ref:r},ne))})});Mc.displayName="FunnelChart";const Cc=t.forwardRef(function(o,n){var i;const r=Ha(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,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:o.orientation}),s=t.useRef(null);rl(n,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,sort:y="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,regression:w,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:B,legendPosition:E,color:N,stroke:$,strokeWidth:D,opacity:H,categoryFormat:I}=o,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=r,Z=t.useMemo(()=>k(a),[a]),J=il({data:Z,rawData:a,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:E,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:F,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=Ra(Z,y,d),te=Pa(),oe=t.useMemo(()=>new Map,[Z]),ne=sc({colorBy:f,colorScale:J.colorScale,color:N,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),ie=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),re=el({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(Fa,{componentName:"DotPlot",message:re,width:F,height:W});const se=cl(w),ae=se?[se,...x||[]]:x,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!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:r.showAxes,oLabel:K,rLabel:Q,rFormat:g}),I&&{oFormat:I}),{showGrid:Y,oSort:y}),J.legendBehaviorProps),Ns({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:b,defaultTooltipContent:ie})),$s({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(Ga,{componentName:"DotPlot",width:F,height:W,children:e.jsx(Yi,Object.assign({ref:s},le))})});Cc.displayName="DotPlot";const _c=t.forwardRef(function(o,n){var i,r;const s=Ha(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(r=o.height)&&void 0!==r?r:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,showLegend:H,title:I,description:F,summary:W,accessibleTable:z}=s,Y=t.useMemo(()=>k(l),[l]),G=g||d,q=il({data:Y,rawData:l,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:H,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:N,height:$});if(q.earlyReturn)return q.earlyReturn;const X=Pa(),V=t.useMemo(()=>new Map,[Y]),U=sc({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:f,categoryIndexMap:V,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:B,opacity:E,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>Gs({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),Q=el({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:Z,effectiveMargin:J}=rc({ref:n,frameRef:a,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!=l&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:U,startAngle:p}),null!=y&&{cornerRadius:y}),{size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Z),Ns({title:I,description:F,summary:W,accessibleTable:z,className:u,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:K})),$s({linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return Q?e.jsx(Fa,{componentName:"PieChart",message:Q,width:N,height:$}):e.jsx(Ga,{componentName:"PieChart",width:N,height:$,children:e.jsx(Yi,Object.assign({ref:a},ee))})});_c.displayName="PieChart";const Pc=t.forwardRef(function(o,n){const i=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,showLegend:H,title:I,description:F,summary:W,accessibleTable:z}=i,Y=t.useMemo(()=>k(s),[s]),G=g||c,q=il({data:Y,rawData:s,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"DonutChart",chartId:O,showLegend:H,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:N,height:$});if(q.earlyReturn)return q.earlyReturn;const X=null!=d?d:Math.max(2,.15*Math.min(N,$)),V=Pa(),U=t.useMemo(()=>new Map,[Y]),K=sc({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:f,categoryIndexMap:U,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:B,opacity:E,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=t.useMemo(()=>Gs({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),Z=el({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=rc({ref:n,frameRef:r,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!=s&&{data:Y}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:K,innerRadius:X,startAngle:p}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),J),Ns({title:I,description:F,summary:W,accessibleTable:z,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:Q})),$s({linkedHover:w,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return Z?e.jsx(Fa,{componentName:"DonutChart",message:Z,width:N,height:$}):e.jsx(Ga,{componentName:"DonutChart",width:N,height:$,children:e.jsx(Yi,Object.assign({ref:r},te))})});function Lc(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}}function Tc(e){return Math.max(0,Math.min(1,e))}function Rc(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 o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function Bc(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Ec(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Tc(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=Tc(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],i=o[e+1];if(t.offset>n||n>i.offset)continue;const r=i.offset-t.offset,s=r>0?(n-t.offset)/r:0,a=Rc(t.color),l=Rc(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,g,f]=l;return Bc(c+(h-c)*s,u+(g-u)*s,d+(f-d)*s)}return o[o.length-1].color}function Nc(e,t,o){return`${e}-${t}`}Pc.displayName="DonutChart";const $c=t.forwardRef(function(o,n){const i=Ha(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}),r=t.useRef(null),s="context"===o.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:g,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,cornerRadius:y,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!a,sweep:w=240,fillZones:j=!0,tooltip:A,annotations:S,frameProps:O={},className:M,stroke:C,strokeWidth:_,opacity:P}=o,{width:L,height:T,title:R,description:B,summary:E,accessibleTable:N}=i,$=h&&"object"==typeof h?h:void 0,D=Math.max(c,Math.min(u,l)),H=u-c||1,I=(D-c)/H,{gaugeData:F,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:o,value:n,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:o,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(o,e.value))})),o>g[g.length-1].value&&g.push({value:o,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=Nc("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(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(Ec(c.colorStops,e*(t+.5)/o));const i=Nc("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:n}}),y.set(i,{fill:n[0]||s})}}else{let e=t;for(let o=0;g.length>o;o++){const n=g[o],i=(n.value-e)/d,r=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=Nc("fill",o);p.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),y.set(e,{fill:n.color})}if(u>0){const e=Nc("bg",o);p.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&o>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:c,max:u,value:l,thresholds:d,fillColor:g,backgroundColor:f,fillZones:j,showScaleLabels:k,gradientFill:$}),[l,c,u,d,g,f,k,j,$]),Y=t.useMemo(()=>sl(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:G,startAngleDeg:q}=Lc(w),X=function(e=240){const{sweepRad:t,offsetRad:o}=Lc(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}}(w),V=Math.min(10,Math.max(1,Math.min(L,T)/12)),U=X.cx,K=X.cy,Q=Math.max(4,Math.min((L-2*V)/X.width,(T-2*V)/X.height)-2),Z=Math.max(0,Math.min(Q-1.5,Q*(1-p))),J=L/2-U*Q,ee=T/2-K*Q,te=2*(Q+4),oe=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(D,c,u):b;const t=x?x(D):Math.round(D)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*Q),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),k&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,D,c,u,x,k,Q,a]),ne=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(D):Math.round(D)+""}:null,[s,b,D,x]),ie=t.useMemo(()=>{if(!m)return null;const e=-Math.PI/2+q*Math.PI/180+I*G,t=Z>20?Z-8:Q-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,I,q,G,Z,v]),re=t.useMemo(()=>(t,o,n)=>{if("gauge-needle"===t.type){const i=(n.width||L)/2,r=(n.height||T)/2,s=Math.max(1,Q-Z),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+o)}if("gauge-label"===t.type){const i=-Math.PI/2+q*Math.PI/180+(t.value-c)/H*G,r=(n.width||L)/2,s=(n.height||T)/2,a=Z-1,l=Q+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,g=Math.sin(i)*l,f=Q+10,p=Math.cos(i)*f,y=Math.sin(i)*f,m=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return m>=11||1>m?(v="middle",b="auto"):m>=1&&5>m?(v="start",b="middle"):m>=5&&7>m?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:g,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:p,y:y,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+o)}return"gauge-value"===t.type?e.jsx("text",{x:(n.width||L)/2,y:(n.height||T)/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:t.text},"gauge-value-"+o):null},[L,T,c,H,q,G,Z,Q]),se=t.useMemo(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),ne&&e.push(ne),e},[z,S,ie,ne]),ae=t.useMemo(()=>t=>{var o;const n=(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o[0])||(null==t?void 0:t.data)||t,i=null==n?void 0:n._isFill;return e.jsxs("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==n?void 0:n._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(D):"Remaining"})]})},[D]);if(0===F.length)return e.jsx(Fa,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});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:w},null!=y&&{cornerRadius:y}),{centerContent:oe,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ee-te/2,bottom:T-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:kn(A)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),R&&{title:R}),B&&{description:B}),E&&{summary:E}),void 0!==N&&{accessibleTable:N}),M&&{className:M}),null!=o.animate&&{animate:o.animate}),O);return e.jsx(Ga,{componentName:"GaugeChart",width:L,height:T,children:e.jsx(Yi,Object.assign({ref:r},le))})});$c.displayName="GaugeChart";const Dc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:w,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:B,legendPosition:E,color:N,stroke:$,strokeWidth:D,opacity:H,categoryFormat:I}=o,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=i,Z=t.useMemo(()=>k(s),[s]),J=f||u,ee=il({data:Z,rawData:s,colorBy:J,colorScheme:p,legendInteraction:B,legendPosition:E,selection:S,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:F,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=Pa(),oe=t.useMemo(()=>new Map,[Z]),ne=sc({colorBy:J,colorScale:ee.colorScale,color:N,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:A.pieceStyle,stroke:$,strokeWidth:D,opacity:H,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),re=el({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=rc({ref:n,frameRef:r,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!=s&&{data:Z}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Q,rFormat:g}),I&&{oFormat:I}),{showGrid:Y}),se),Ns({title:q,description:X,summary:V,accessibleTable:U,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:x,defaultTooltipContent:ie})),$s({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return re?e.jsx(Fa,{componentName:"GroupedBarChart",message:re,width:F,height:W}):e.jsx(Ga,{componentName:"GroupedBarChart",width:F,height:W,children:e.jsx(Yi,Object.assign({ref:r},le))})});Dc.displayName="GroupedBarChart";const Hc=t.forwardRef(function(o,n){const i=Ha(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:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,barPadding:y,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:j={},selection:A,linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:R,legendPosition:B,color:E,stroke:N,strokeWidth:$,opacity:D,categoryFormat:H,rTickValues:I,tickLabelEdgeAlign:F,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=o,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:oe,valueLabel:ne}=i,ie=t.useMemo(()=>k(s),[s]),re=f||u,se=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==o.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?V:X)-2*t)/(t-1))):1},[y,o.mode,ie,c,h,X,V]),ae=il({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:R,legendPosition:B,selection:A,linkedHover:S,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:Q,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:X,height:V}),le=bc({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:d});if(ae.earlyReturn)return ae.earlyReturn;const ce=Pa(),ue=t.useMemo(()=>new Map,[ie]),de=sc({colorBy:re,colorScale:ae.colorScale,color:E,themeCategorical:ce,colorScheme:p,categoryIndexMap:ue,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:N,strokeWidth:$,opacity:D,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>Gs({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ge=el({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:fe,effectiveMargin:pe}=rc({ref:n,frameRef:r,setup:ae}),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!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:pe,barPadding:se,enableHover:U}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:oe,rLabel:ne,rFormat:g}),I&&{rTickValues:I}),null!=F&&{tickLabelEdgeAlign:F}),H&&{oFormat:H}),void 0!==W&&{showCategoryTicks:W}),{showGrid:K}),fe),Ns({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:o.animate,axisExtent:o.axisExtent})),Ds({tooltip:m,defaultTooltipContent:he})),$s({linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),v&&v.length>0&&{annotations:v}),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(j).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(Fa,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e.jsx(Ga,{componentName:"SwimlaneChart",width:X,height:V,children:e.jsx(Yi,Object.assign({ref:r},ye))})});function Ic(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 Fc(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 Wc(e){return"function"==typeof e?e:t=>t[e]||1}function zc({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=ke(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=ke(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 Yc(e){const{nodes:o,edges:n,inferNodes:i=!0,sourceAccessor:r="source",targetAccessor:s="target",colorBy:a,colorScheme:l,showLegend:c,legendPosition:u,legendInteraction:d,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:w,loading:j,loadingContent:A,emptyContent:S,emptyDataKey:O="edges"}=e,M=t.useMemo(()=>k(n),[n]),C=t.useMemo(()=>k(o),[o]),_=Ua(j,x,w,A),P=_?null:Va("nodes"===O?void 0===o?void 0:C:void 0===n?void 0:M,x,w,S),L=t.useMemo(()=>i?Fc(C,M,r,s):C,[i,C,M,r,s]),T=Ta(L,a,l),R=Pa(),B=t.useMemo(()=>{if(Array.isArray(l))return l;if(R&&R.length>0)return R;if("string"==typeof l){const e=ye[l];if(Array.isArray(e)&&e.length>0)return e}return me},[l,R]),E=t.useMemo(()=>{if(!a)return[];const e=new Set;for(const t of L){const o="function"==typeof a?a(t):t[a];null!=o&&e.add(o+"")}return Array.from(e)},[L,a]),N=$a(d,a,E),{legend:$,margin:D,legendPosition:H}=Na({data:L,colorBy:a,colorScale:T,showLegend:c,legendPosition:u,userMargin:b,defaults:v,categories:E}),I=Ba({selection:h,linkedHover:g,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:F,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G}=I;return{safeNodes:L,safeEdges:M,colorScale:T,effectivePalette:B,themeCategorical:R,allCategories:E,legendState:N,legend:$,margin:D,legendPosition:H,customHoverBehavior:F,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G,loadingEl:_,emptyEl:P}}Hc.displayName="SwimlaneChart";const Gc=t.forwardRef(function(o,n){var i;const r=t.useRef(null);rl(n,{variant:"network",frameRef:r});const s=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:u,nodeIdAccessor:d,nodeIDAccessor:h,sourceAccessor:g="source",targetAccessor:f="target",nodeLabel:p,colorBy:y,colorScheme:m,nodeSize:v=8,nodeSizeRange:b=[5,20],edgeWidth:x=1,edgeColor:k="#999",edgeOpacity:w=.6,iterations:j=300,forceStrength:A=.1,tooltip:S,frameProps:O={},onObservation:M,onClick:C,chartId:_,selection:P,linkedHover:L,loading:T,loadingContent:R,emptyContent:B,legendInteraction:E,legendPosition:N,stroke:$,strokeWidth:D,opacity:H}=o,I=null!==(i=null!=d?d:h)&&void 0!==i?i:"id",{width:F,height:W,enableHover:z,showLegend:Y,showLabels:G=!1,title:q,description:X,summary:V,accessibleTable:U}=s,K=Yc({nodes:a,edges:l,inferNodes:!1,sourceAccessor:g,targetAccessor:f,colorBy:y,colorScheme:m,showLegend:Y,legendPosition:N,legendInteraction:E,selection:P,linkedHover:L,onObservation:M,onClick:C,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:s.marginDefaults,userMargin:c,width:F,height:W,loading:T,loadingContent:R,emptyContent:B,emptyDataKey:"nodes"}),Q=t.useMemo(()=>new Map,[]),Z=t.useMemo(()=>e=>{const t={};return t.fill=y?ke(e.data||e,y,K.colorScale):La(void 0,K.themeCategorical,m,void 0,Q),"number"==typeof v&&(t.r=v),t},[y,K.colorScale,v,K.themeCategorical,m,Q]),J=t.useMemo(()=>sl(Z,{stroke:$,strokeWidth:D,opacity:H}),[Z,$,D,H]),ee=t.useMemo(()=>e=>({stroke:k,strokeWidth:"number"==typeof x?x:"function"==typeof x?x(e):e[x]||1,opacity:w}),[x,k,w]),te=t.useMemo(()=>sl(ee,{stroke:$,strokeWidth:D,opacity:H}),[ee,$,D,H]),oe=t.useMemo(()=>{if(G&&p)return"function"==typeof p?p:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[p])&&void 0!==o?o:e[p])&&void 0!==n?n:e.id}},[G,p]),ne=ol({componentName:"ForceDirectedGraph",nodes:a,edges:l,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:I}});return ne?e.jsx(Fa,{componentName:"ForceDirectedGraph",message:ne,width:F,height:W}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:e.jsx(Ga,{componentName:"ForceDirectedGraph",width:F,height:W,children:e.jsx(Es,Object.assign({ref:r,chartType:"force"},null!=a&&{nodes:K.safeNodes},null!=l&&{edges:K.safeEdges},{size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,nodeIDAccessor:I,sourceAccessor:g,targetAccessor:f,iterations:j,forceStrength:A,nodeStyle:J,edgeStyle:te,colorBy:y,colorScheme:K.effectivePalette,nodeSize:v,nodeSizeRange:b,nodeLabel:oe,showLabels:G,enableHover:z,tooltipContent:!1===S?()=>null:kn(S)||void 0,customHoverBehavior:L||M||C?K.customHoverBehavior:void 0,customClickBehavior:M||C?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!=o.animate&&{animate:o.animate},O))})});Gc.displayName="ForceDirectedGraph";const qc=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=i.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!==n?n:[]}}});const r=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,edgeOpacity:k=.5,tooltip:w,frameProps:j={},onObservation:A,onClick:S,chartId:O,selection:M,linkedHover:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,showLabels:H=!0,title:I,description:F,summary:W,accessibleTable:z}=r,Y=Yc({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:!1,legendInteraction:T,selection:M,linkedHover:C,onObservation:A,onClick:S,chartType:"ChordDiagram",chartId:O,marginDefaults:r.marginDefaults,userMargin:l,width:N,height:$,loading:_,loadingContent:P,emptyContent:L}),G=t.useMemo(()=>new Map,[]),q=Y.safeNodes.length>0,X=t.useMemo(()=>{if(q)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(f)i.fill=ke(e.data||e,f,Y.colorScale);else{const r=Array.isArray(p)?p:ye[p]||me,s=Array.isArray(r)?r:me,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,f,Y.colorScale,p]),V=t.useMemo(()=>X?sl(X,{stroke:R,strokeWidth:B,opacity:E}):void 0,[X,R,B,E]),U=t.useMemo(()=>{if(q)return zc({edgeColorBy:y,colorBy:f,colorScale:Y.colorScale,nodeStyleFn:V||(e=>({fill:La(void 0,Y.themeCategorical,p,void 0,G)})),edgeOpacity:k,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:k}})},[q,y,f,Y.colorScale,V,k,Y.themeCategorical,p,G]),K=t.useMemo(()=>U?sl(U,{stroke:R,strokeWidth:B,opacity:E}):void 0,[U,R,B,E]),Q=t.useMemo(()=>{if(!H)return;const e=x||g;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}},[H,x,g]),Z=ol({componentName:"ChordDiagram",edges:a,edgesRequired:!0});return Z?e.jsx(Fa,{componentName:"ChordDiagram",message:Z,width:N,height:$}):Y.loadingEl?Y.loadingEl:Y.emptyEl?Y.emptyEl:e.jsx(Ga,{componentName:"ChordDiagram",width:N,height:$,children:e.jsx(Es,Object.assign({ref:i,chartType:"chord"},Y.safeNodes.length>0&&{nodes:Y.safeNodes},null!=a&&{edges:Y.safeEdges},{size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:V,edgeStyle:K,colorBy:f,colorScheme:Y.effectivePalette,edgeColorBy:y,edgeOpacity:k,nodeLabel:Q,showLabels:H,enableHover:D,tooltipContent:!1===w?()=>null:kn(w)||void 0,customHoverBehavior:C||A||S?Y.customHoverBehavior:void 0,customClickBehavior:A||S?Y.customClickBehavior:void 0},T&&"none"!==T&&{legendHoverBehavior:Y.legendState.onLegendHover,legendClickBehavior:Y.legendState.onLegendClick,legendHighlightedCategory:Y.legendState.highlightedCategory,legendIsolatedCategories:Y.legendState.isolatedCategories},{className:c,title:I,description:F,summary:W,accessibleTable:z},null!=o.animate&&{animate:o.animate},j))})});qc.displayName="ChordDiagram";const Xc=t.forwardRef(function(o,n){const i=t.useRef(null);rl(n,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=i.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!==n?n:[]}}});const r=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:k,edgeOpacity:w=.5,edgeSort:j,tooltip:A,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,emptyContent:R,showLegend:B,legendPosition:E,legendInteraction:N,stroke:$,strokeWidth:D,opacity:H}=o,{width:I,height:F,enableHover:W,showLabels:z=!0,title:Y,description:G,summary:q,accessibleTable:X}=r,V=Yc({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:B,legendPosition:E,legendInteraction:N,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"SankeyDiagram",chartId:C,marginDefaults:r.marginDefaults,userMargin:l,width:I,height:F,loading:L,loadingContent:T,emptyContent:R}),U=t.useMemo(()=>new Map,[]),K=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?ke(e.data||e,f,V.colorScale):La(void 0,V.themeCategorical,p,void 0,U),t},[f,V.colorScale,V.themeCategorical,p,U]),Q=t.useMemo(()=>sl(K,{stroke:$,strokeWidth:D,opacity:H}),[K,$,D,H]),Z=t.useMemo(()=>zc({edgeColorBy:y,colorBy:f,colorScale:V.colorScale,nodeStyleFn:Q,edgeOpacity:w,baseStyle:{stroke:"none",strokeWidth:0}}),[y,f,V.colorScale,Q,w]),J=t.useMemo(()=>sl(Z,{stroke:$,strokeWidth:D,opacity:H}),[Z,$,D,H]),ee=t.useMemo(()=>{if(!z)return;const e=k||g;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}},[z,k,g]),te=ol({componentName:"SankeyDiagram",edges:a,edgesRequired:!0});return te?e.jsx(Fa,{componentName:"SankeyDiagram",message:te,width:I,height:F}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:e.jsx(Ga,{componentName:"SankeyDiagram",width:I,height:F,children:e.jsx(Es,Object.assign({ref:i,chartType:"sankey"},V.safeNodes.length>0&&{nodes:V.safeNodes},null!=a&&{edges:V.safeEdges},{size:[I,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:V.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:Q,edgeStyle:J,colorBy:f,colorScheme:V.effectivePalette,edgeColorBy:y,edgeOpacity:w,edgeSort:j,nodeLabel:ee,showLabels:z,enableHover:W,tooltipContent:!1===A?()=>null:kn(A)||void 0,customHoverBehavior:P||O||M?V.customHoverBehavior:void 0,customClickBehavior:O||M?V.customClickBehavior:void 0,legend:V.legend,legendPosition:V.legendPosition},N&&"none"!==N&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},{className:c,title:Y,description:G,summary:q,accessibleTable:X},null!=o.animate&&{animate:o.animate},S))})});function Vc(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,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u: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!==u&&(f.push({time:u,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 m=0,v=0,b=0,x=0,k=0;const w=[],j=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;j.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 A=[];let S=0;for(;w.length>S;){let e=S;for(;w.length>e+1&&w[e+1].t===w[S].t;)e++;A.push(w[S]);for(let t=S+1;e>=t;t++){const e=A[A.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||A.push(w[t])}S=e+1}const O=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let M=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===M||M>e.systemInTime)&&(M=e.systemInTime);let C=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===C||e.systemOutTime>C)&&(C=e.systemOutTime);if(A.length>0){const e=A[A.length-1],t=Math.max(null!=O?O:-1/0,null!=C?C:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&A.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=A[0],n=Math.min(null!=c?c:1/0,null!=M?M:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&A.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:A,peak:b,topPeak:x,botPeak:k,localAttachments:j}}function Uc(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function Kc(e,t){return e.map(e=>({t:Uc(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Qc(e,t,o){const n=e.value*o;if("out"===e.kind){const i=e.sideMassBefore*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}const i=e.sideMassAfter*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}function Zc(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 Jc(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 eu(e,t){return 1e3*Zc(e,t)+Jc(e,t)}function tu(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function ou(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=tu(e,t),s=eu(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]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=eu(t,o);if(s>d)s=d,r=tu(e,t);else if(d===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=eu(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=eu(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(),u=1/0;const d=()=>{for(const e of r)l[e]=a[i[e]];const e=eu(l,o);u>e&&(u=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};d();const g=Array(n).fill(0);let f=0;for(;n>f;)f>g[f]?(h(f%2==0?0:g[f],f),d(),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 nu(e,t,o,n,i){var r,s,a,l,c,u,d,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]=o[t.id].topPeak||0,x[t.id]=o[t.id].botPeak||0;const k="half"===v,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),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 n.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 j={},A=[];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 d=[];for(const t of e)0===(null!==(s=i.get(t.id))&&void 0!==s?s:0)&&d.push(t.id);for(;d.length;){const e=d.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)&&d.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;A.length>e;e++){const n=A[e].occupants[A[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(A.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=A.length-1),A[o].occupants.push({id:e.id,end:null!==(u=null==t?void 0:t.end)&&void 0!==u?u:-1/0}),A[o].peak.topPeak=Math.max(A[o].peak.topPeak,b[e.id]),A[o].peak.botPeak=Math.max(A[o].peak.botPeak,x[e.id]),j[e.id]=o}}else e.forEach((e,t)=>{var o,n;A.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]}}),j[e.id]=t});let S=null,O=null,M=null,C=null;const _=()=>{S=Zc(j,t),M=Jc(j,t)},P=()=>{O=Zc(j,t),C=Jc(j,t)};"crossing-min"===m?(_(),ou(A,j,t),P()):"inside-out"===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]),u=new Map;r.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(A,j),P()):"crossing-min+inside-out"===m&&(_(),ou(A,j,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=eu(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 u=new Map;for(let e=0;n>e;e++)u.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)u.set(e,e-1);u.set(i,l)}else{for(let e=l;i>e;e++)u.set(e,e+1);u.set(i,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=eu(t,o);if(d>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=d}}(A,j,t),P());const L=A.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},R=[];for(let e=0;A.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)}R.push(i)}const B=[];let E=f+(null!==(h=null===(d=A[0])||void 0===d?void 0:d.peak.topPeak)&&void 0!==h?h:0)*p;A.length>0&&B.push(E);for(let e=1;A.length>e;e++)E+=R[e-1]*p+f,B.push(E);if(A.length>0&&(E+=A[A.length-1].peak.botPeak*p+f),E>g){const e=g/E;for(let t=0;B.length>t;t++)B[t]*=e}const N=0===A.length?0:A[0].peak.topPeak+R.reduce((e,t)=>e+t,0)+A[A.length-1].peak.botPeak,$={};for(const t of e)$[t.id]=B[j[t.id]];return{effectiveSlotsHeight:N,centerlines:$,laneLifetime:w,slots:A,slotByNode:j,slotCenter:B,crossingsBefore:S,crossingsAfter:O,lengthBefore:M,lengthAfter:C}}Xc.displayName="SankeyDiagram";const iu=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)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];s.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of n)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!==(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 ru(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function su(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function au(e,t){return"function"==typeof e?e(t):t[e]}const lu=t.forwardRef(function(o,n){const{nodes:r,edges:s,domain:a,axisTicks:l=[],nodeIdAccessor:c="id",sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",startTimeAccessor:g="startTime",endTimeAccessor:f="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:y,xExtentAccessor:m="xExtent",edgeIdAccessor:v="id",colorBy:b,colorScheme:x,showLegend:w,legendPosition:j="right",pairing:A="temporal",packing:S="reuse",laneOrder:O="crossing-min",ribbonLane:M="both",lifetimeMode:C="half",showLaneRails:_=!1,showQualityReadout:P=!1,showLabels:L=!0,width:T=600,height:R=400,margin:B,title:E,description:N,summary:$,accessibleTable:D,responsiveWidth:H,responsiveHeight:I,loading:F,loadingContent:W,emptyContent:z,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={}}=o,[te,oe]=t.useState([]),[ne,ie]=t.useState([]),re=t.useRef(te),se=t.useRef(ne);re.current=te,se.current=ne;const ae=t.useCallback(e=>{re.current=e,oe(e)},[]),le=t.useCallback(e=>{se.current=e,ie(e)},[]),ce=void 0!==s,ue=k(ce?s:te),de=t.useMemo(()=>{const e=k(null!=r?r:[]),t=ne;if(0===e.length&&0===t.length)return Fc([],ue,u,d);const o=new Set,n=[];for(const t of e){const e=au(c,t)+"";o.has(e)||(o.add(e),n.push(t))}for(const e of t){const t=au(c,e)+"";o.has(t)||(o.add(t),n.push(e))}const i=Fc([],ue,u,d);for(const e of i)o.has(e.id)||(o.add(e.id),n.push(e));return n},[r,ne,ue,c,u,d]),he=t.useRef(null),ge=t.useCallback((e,t)=>{const o=au(v,e);return null!=o?o+"":`${au(u,e)}-${au(d,e)}-${t}`},[v,u,d]),fe=t.useCallback(e=>{if(null==e)return!1;const t=e;return null!=au(u,t)&&null!=au(d,t)},[u,d]);rl(n,{variant:"network",frameRef:he,overrides:{push(e){if(fe(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)fe(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=au(c,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=au(c,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!=ue?ue:[],getScales:()=>null},deps:[ce,fe,ge,c,ue,ae,le]});const pe=ge,ye=t.useCallback(e=>au(c,e)+"",[c]),{nodes:me,edges:ve,domain:be,rawNodeById:xe,rawEdgeById:we}=t.useMemo(()=>{const e=(null!=de?de:[]).map(e=>{const t={id:ye(e),__raw:e},o=m?au(m,e):null;if(Array.isArray(o)&&2===o.length){const e=su(o[0]),n=su(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(null!=ue?ue:[]).map((e,t)=>{const o={id:pe(e,t),source:au(u,e)+"",target:au(d,e)+"",value:Number(au(h,e)),startTime:su(au(g,e)),endTime:su(au(f,e)),__raw:e};if(p){const t=su(au(p,e));Number.isFinite(t)&&(o.systemInTime=t)}if(y){const t=su(au(y,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[su(a[0]),su(a[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}},[de,ue,a,ye,pe,m,u,d,h,g,f,p,y]),je=Yc({nodes:de,edges:ue,inferNodes:!1,sourceAccessor:u,targetAccessor:d,colorBy:b,colorScheme:x,showLegend:!1,legendPosition:j,selection:void 0,linkedHover:void 0,onObservation:U,onClick:K,chartType:"ProcessSankey",chartId:J,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:B,width:T,height:R,loading:F,loadingContent:W,emptyContent:z}),Ae=(null!=w?w:!!b)&&!!b,Se=t.useCallback(e=>null!=B&&("number"==typeof B||null!=B[e]),[B]),Oe=t.useMemo(()=>{const e=Object.assign({},je.margin);return Ae&&("right"===j&&!Se("right")&&140>e.right?e.right=140:"bottom"===j&&!Se("bottom")&&80>e.bottom&&(e.bottom=80)),e},[je.margin,Ae,j,Se]),Me=T-Oe.left-Oe.right,Ce=R-Oe.top-Oe.bottom,_e=t.useMemo(()=>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,ve,be),[me,ve,be]),Pe=t.useMemo(()=>_e.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),u=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 d={};for(const t of e)d[t.id]=Vc(t,c,u);const h=nu(e,t,d,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=u.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=>u.get(e.id).sourceSide)),i=new Set(o.map(e=>u.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]&&(u.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]&&(u.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"===u.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===u.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)&&u.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(u.get(l[0].id).sourceSide=t,!0)};let r=o.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=Vc(t,c,u);const f=nu(e,t,d,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)),m=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,v=nu(e,t,d,c,{plotH:i,padding:y,valueScale:m,packing:s,laneOrder:a,lifetimeMode:l});return{nodeData:d,sides:u,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}}(me,ve,{plotH:Ce,pairing:A,packing:S,laneOrder:O,lifetimeMode:C}),[_e,me,ve,Ce,A,S,O,C]),Le=t.useMemo(()=>i.scaleTime().domain(be).range([0,Me]),[be,Me]),Te=t.useCallback((e,t)=>{if(b&&de){const t=xe.get(e);if(t)return ke(t,b,je.colorScale)}return je.effectivePalette[t%je.effectivePalette.length]||"#475569"},[b,de,xe,je.colorScale,je.effectivePalette]),Re=t.useMemo(()=>{const e=new Map;return me.forEach((t,o)=>e.set(t.id,o)),e},[me]),Be=t.useMemo(()=>{if(!Pe)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Pe,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=Kc(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,Le,be);if(!l)return;const c=Kc(a.samples,be),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=e[i.id]+(u.botMass-u.topMass)*o/2,h=Te(i.id,r),g=null!==(s=xe.get(i.id))&&void 0!==s?s:i,f=function(e,t,o,n,i){const r=o.nodeData[e];if(!r||0===r.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=Kc(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=n(c.t),h=n(u.t),g=e=>n(Uc(e,i)),f=[],p=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=r.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=g(o.systemInTime),n=g(o.startTime),i=t-20,r=Math.max(d,i);if(n>r){const[o,l]=Qc(e,a,s);f.push({pathD:p(r,o,n,l),x0:i,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=r.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=g(o.systemOutTime),n=g(o.endTime),i=t+20,r=Math.min(h,i);if(r>n){const[o,l]=Qc(e,a,s);f.push({pathD:p(n,o,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,ve,Pe,Le,be);n.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:Le(u.t)-4,labelY:d,labelText:i.id}))}),ve.forEach(n=>{var r,s,a,l;const c=null===(r=t[n.source])||void 0===r?void 0:r.localAttachments.get(n.id),u=null===(s=t[n.target])||void 0===s?void 0:s.localAttachments.get(n.id);if(!c||!u)return;const d=null!==(a=Re.get(n.source))&&void 0!==a?a:0,h=Te(n.source,d),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,u=r(c(e.time)),d=r(c(o.time)),h=e.value*l,g=o.value*l,f=e.sideMassBefore*l,p=o.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===o.side?(v=n-p,b=v+g):(b=n+p,v=b-g);const x="source"===s?u+.85*(d-u):"target"===s?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:y,sBot:m,tx:d,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[n.source],u,e[n.target],o,Le,M,be),{pathD:f,bezier:p}=Er(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}},[Pe,me,ve,Le,be,Te,xe,we,M,Y,Re]),Ee=t.useMemo(()=>({bands:Be.bands,ribbons:Be.ribbons,showLabels:L}),[Be,L]),Ne=t.useMemo(()=>{if(!Ae||!b)return;const e=new Map;(null!=de?de:[]).forEach((t,o)=>{const n=au(b,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:Te(ye(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},[Ae,b,de,Te,ye]),$e=t.useMemo(()=>!1!==X&&V?void 0===X||!0===X?null:kn(X)||null:null,[X,V]),De=t.useCallback(e=>G?G(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[G]),He=t.useCallback(e=>q?q(e):e+"",[q]),Ie=t.useCallback(t=>{if(!t||!t.data)return null;const o=t.data;if(!ru(o))return null;const n=o.data;if($e)return $e(n);if("band"===o.__kind){const t=o.id,n=Pe?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}(Pe.nodeData[t]):[],i=5,r=n.length>i?n.length:null,s=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,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:t}),s.length>0&&e.jsxs("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{opacity:.6},children:[e.jsx("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e.jsx("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=r&&e.jsx("th",{})]})}),e.jsx("tbody",{children:s.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:{paddingRight:8},children:De(t.t)}),e.jsx("td",{style:{textAlign:"right"},children:He(t.total)}),null!=r&&e.jsx("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:t.mark})]},o))})]}),null!=r&&e.jsxs("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",r," samples"]})]})}const i=n,r=au(u,i),s=au(d,i),a=au(h,i),l=au(g,i),c=au(f,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:[r+""," → ",s+""]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"value"}),e.jsx("span",{style:{textAlign:"right"},children:He(Number(a))})]}),null!=l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"start"}),e.jsx("span",{style:{textAlign:"right"},children:De(su(l))})]}),null!=c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"end"}),e.jsx("span",{style:{textAlign:"right"},children:De(su(c))})]})]})]})},[Pe,$e,De,He,u,d,h,g,f]),Fe=t.useMemo(()=>{if(!Pe)return null;const{centerlines:t,laneLifetime:o,nodeData:n,valueScale:i,compressedPadding:r,crossingsBefore:s,crossingsAfter:a,lengthBefore:c,lengthAfter:u}=Pe;let d=null,h=null;for(const e of me){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=Le(t.start),i=Le(t.end);(null===d||d>n)&&(d=n),(null===h||i>h)&&(h=i)}const g=e=>Math.max(0,Math.min(Me,e)),f=g(null!=d?d:0),p=Math.max(f,g(null!=h?h:Me));return e.jsxs("g",{children:[P&&null!==(null!=a?a:null)&&e.jsxs("text",{x:Me,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",a," ","edge length: ",Math.round(c)," → ",Math.round(u)]}),r&&e.jsx("text",{x:Me,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((t,o)=>{const n=Le(su(t.date));return f-.5>n||n>p+.5?null:e.jsx("line",{x1:n,y1:0,x2:n,y2:Ce,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+o)}),_&&me.map((r,s)=>{const a=o[r.id];if(!a||null===a.start)return null;const l=n[r.id],c=l?{topPeak:l.topPeak,botPeak:l.botPeak}:{topPeak:0,botPeak:0},u=t[r.id]+(c.botPeak-c.topPeak)*i/2,d=Le(a.start),h=Le(a.end),g=Te(r.id,s);return e.jsxs("g",{children:[e.jsx("line",{x1:d,y1:u,x2:h,y2:u,stroke:g,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e.jsx("line",{x1:d,y1:u-4,x2:d,y2:u+4,stroke:g,strokeOpacity:.5}),e.jsx("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:g,strokeOpacity:.5})]},"lane-"+r.id)}),e.jsx("line",{x1:f,y1:Ce+4,x2:p,y2:Ce+4,stroke:"#94a3b8"}),l.map((t,o)=>{const n=su(t.date),i=Le(n);if(f-.5>i||i>p+.5)return null;const r=null!=t.label?t.label:G?G(new Date(n)):"";return e.jsxs("g",{transform:`translate(${i},${Ce+4})`,children:[e.jsx("line",{y2:6,stroke:"#94a3b8"}),e.jsx("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:r})]},o)})]})},[Pe,l,Le,Me,Ce,_,me,Te,P,G]),We=t.useMemo(()=>(null!=de?de:[]).map(e=>({id:ye(e),data:e})),[de,ye]),ze=t.useMemo(()=>{const e=new Map;for(const t of Be.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Be]),Ye=t.useMemo(()=>(null!=ue?ue:[]).map((e,t)=>{const o=pe(e,t),n=Number(au(h,e));return{id:o,source:au(u,e)+"",target:au(d,e)+"",value:Number.isFinite(n)?n:0,bezier:ze.get(o),data:e}}),[ue,pe,u,d,h,ze]),Ge=je.loadingEl,qe=je.emptyEl;return _e.length>0?e.jsxs("svg",{width:T,height:R,role:"img","aria-label":null!=E?E:"Process Sankey validation failed",children:[e.jsx("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),_e.map((t,o)=>{return e.jsx("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})]}):Ge||qe||e.jsx(Es,Object.assign({ref:he,chartType:"force",nodes:We,edges:Ye,customNetworkLayout:iu,layoutConfig:Ee,size:[T,R],responsiveWidth:H,responsiveHeight:I,margin:Oe,title:E,description:null!=N?N:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:$,accessibleTable:D,enableHover:V,tooltipContent:!1===X?()=>null:Ie,backgroundGraphics:Fe,showParticles:Q,particleStyle:Z,legend:Ne,legendPosition:j,onObservation:U,customClickBehavior:K?e=>{if(!e||!e.data)return;const t=e.data;ru(t)&&K(t.data,{x:e.x,y:e.y})}:void 0,chartId:J,colorScheme:Array.isArray(x)?x:void 0},ee))});function cu(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="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:j,linkedHover:A,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=o,{width:L,height:T,enableHover:R,showLabels:B=!0,title:E,description:N,summary:$,accessibleTable:D}=n,H=Yc({nodes:t.useMemo(()=>Ic(null!=i?i:null,c),[i,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:M,selection:j,linkedHover:A,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:n.marginDefaults,userMargin:r,width:L,height:T,loading:S,loadingContent:O}),I=t.useMemo(()=>new Map,[]),F=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?be[(e.depth||0)%be.length]:h?ke(e.data||e,h,H.colorScale):La(void 0,H.themeCategorical,g,void 0,I),t},[h,f,H.colorScale,H.themeCategorical,g,I]),W=t.useMemo(()=>sl(F,{stroke:C,strokeWidth:_,opacity:P}),[F,C,_,P]),z=t.useMemo(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=t.useMemo(()=>sl(z,{stroke:C,strokeWidth:_,opacity:P}),[z,C,_,P]),G=t.useMemo(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return Wc(u)},[a,u]),q=tl({componentName:"TreeDiagram",data:i});return q?e.jsx(Fa,{componentName:"TreeDiagram",message:q,width:L,height:T}):H.loadingEl?H.loadingEl:e.jsx(Ga,{componentName:"TreeDiagram",width:L,height:T,children:e.jsx(Es,Object.assign({chartType:a},null!=i&&{data:i},{size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:H.margin,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:H.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:B?y||d:void 0,showLabels:B,enableHover:R,tooltipContent:!1===v?()=>null:kn(v)||void 0,customHoverBehavior:A||x||k?H.customHoverBehavior:void 0,customClickBehavior:x||k?H.customClickBehavior:void 0},M&&"none"!==M&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:s,title:E,description:N,summary:$,accessibleTable:D},null!=o.animate&&{animate:o.animate},b))})}function uu(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,labelMode:g="leaf",nodeLabel:f,padding:p=4,paddingTop:y,nodeStyle:m,tooltip:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:j,chartId:A,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=o,{nodeStyle:L}=b,T=ul(b,["nodeStyle"]),{width:R,height:B,enableHover:E,showLabels:N=!0,title:$,description:D,summary:H,accessibleTable:I}=n,F=Yc({nodes:t.useMemo(()=>Ic(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:M,selection:x,linkedHover:k,onObservation:w,onClick:j,chartType:"Treemap",chartId:A,marginDefaults:n.marginDefaults,userMargin:r,width:R,height:B,loading:S,loadingContent:O}),W=nl(x),z=F.customHoverBehavior,Y=t.useCallback(e=>{if(!e)return z(null);const t=e.data||e;z({data:(null==t?void 0:t.data)||t})},[z]),G=t.useMemo(()=>new Map,[]),q=t.useMemo(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=h?be[(e.depth||0)%be.length]:u?ke(e.data||e,u,F.colorScale):La(void 0,F.themeCategorical,d,void 0,G),t},[u,h,F.colorScale,F.themeCategorical,d,G]),X=t.useMemo(()=>m||L?e=>{var t,o;return Object.assign(Object.assign(Object.assign({},q(e)),L&&null!==(t=L(e))&&void 0!==t?t:{}),m&&null!==(o=m(e))&&void 0!==o?o:{})}:q,[q,m,L]),V=t.useMemo(()=>sl(X,{stroke:C,strokeWidth:_,opacity:P}),[X,C,_,P]),U=t.useMemo(()=>F.activeSelectionHook?e=>{var t;const o=Object.assign({},V(e));if(F.activeSelectionHook.isActive)if(F.activeSelectionHook.predicate(e.data||e))(null==W?void 0:W.selectedStyle)&&Object.assign(o,W.selectedStyle);else{const e=null!==(t=null==W?void 0:W.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==W?void 0:W.unselectedStyle)&&Object.assign(o,W.unselectedStyle)}return o}:V,[V,F.activeSelectionHook,W]),K=t.useMemo(()=>Wc(l),[l]),Q=void 0!==y?y:!N||"parent"!==g&&"all"!==g?void 0:18,Z=tl({componentName:"Treemap",data:i});return Z?e.jsx(Fa,{componentName:"Treemap",message:Z,width:R,height:B}):F.loadingEl?F.loadingEl:e.jsx(Ga,{componentName:"Treemap",width:R,height:B,children:e.jsx(Es,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[R,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:F.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:K,padding:p,paddingTop:Q,nodeStyle:U,colorBy:u,colorScheme:F.effectivePalette,colorByDepth:h,nodeLabel:N?f||c:void 0,showLabels:N,labelMode:g,enableHover:E,tooltipContent:!1===v?()=>null:kn(v)||void 0},(k||w||j)&&{customHoverBehavior:Y},(w||j)&&{customClickBehavior:F.customClickBehavior},M&&"none"!==M&&{legendHoverBehavior:F.legendState.onLegendHover,legendClickBehavior:F.legendState.onLegendClick,legendHighlightedCategory:F.legendState.highlightedCategory,legendIsolatedCategories:F.legendState.isolatedCategories},{className:s,title:$,description:D,summary:H,accessibleTable:I},null!=o.animate&&{animate:o.animate},T))})}function du(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,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:j,loadingContent:A,legendInteraction:S,stroke:O,strokeWidth:M,opacity:C}=o,{width:_,height:P,enableHover:L,showLabels:T=!0,title:R,description:B,summary:E,accessibleTable:N}=n,$=Yc({nodes:t.useMemo(()=>Ic(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:S,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:r,width:_,height:P,loading:j,loadingContent:A}),D=t.useMemo(()=>new Map,[]),H=t.useMemo(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?be[(e.depth||0)%be.length]:u?ke(e.data||e,u,$.colorScale):La(void 0,$.themeCategorical,d,void 0,D),t},[u,h,$.colorScale,f,$.themeCategorical,d,D]),I=t.useMemo(()=>sl(H,{stroke:O,strokeWidth:M,opacity:C}),[H,O,M,C]),F=t.useMemo(()=>Wc(l),[l]),W=tl({componentName:"CirclePack",data:i});return W?e.jsx(Fa,{componentName:"CirclePack",message:W,width:_,height:P}):$.loadingEl?$.loadingEl:e.jsx(Ga,{componentName:"CirclePack",width:_,height:P,children:e.jsx(Es,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[_,P],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:$.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:F,padding:p,nodeStyle:I,colorBy:u,colorScheme:$.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:kn(y)||void 0,customHoverBehavior:w||v||b?$.customHoverBehavior:void 0,customClickBehavior:v||b?$.customClickBehavior:void 0},S&&"none"!==S&&{legendHoverBehavior:$.legendState.onLegendHover,legendClickBehavior:$.legendState.onLegendClick,legendHighlightedCategory:$.legendState.highlightedCategory,legendIsolatedCategories:$.legendState.isolatedCategories},{className:s,title:R,description:B,summary:E,accessibleTable:N},null!=o.animate&&{animate:o.animate},m))})}lu.displayName="ProcessSankey",cu.displayName="TreeDiagram",uu.displayName="Treemap",du.displayName="CirclePack";const hu=be;function gu(o){const n=Ha(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!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:j,annotations:A,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,stroke:R,strokeWidth:B,opacity:E}=o,{width:N,height:$,enableHover:D,title:H,description:I,summary:F,accessibleTable:W}=n,z=Yc({nodes:t.useMemo(()=>Ic(i,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:d?void 0:c,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"OrbitDiagram",chartId:C,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:N,height:$,loading:L,loadingContent:T}),Y=t.useMemo(()=>new Map,[]),G=t.useMemo(()=>{if(Array.isArray(u))return u;const e=ye[u];return Array.isArray(e)?e:me},[u]),q=t.useMemo(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=d?n?G[0]:hu[(e.depth||0)%hu.length]:c?ke(e.data||e,c,z.colorScale):La(void 0,z.themeCategorical,u,void 0,Y),o.opacity=n?1:.85,o},[c,d,z.colorScale,G,z.themeCategorical,u,Y]),X=t.useMemo(()=>sl(q,{stroke:R,strokeWidth:B,opacity:E}),[q,R,B,E]),V=t.useMemo(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),U=t.useMemo(()=>{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=t.useMemo(()=>{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]),Q=tl({componentName:"OrbitDiagram",data:i});return Q?e.jsx(Fa,{componentName:"OrbitDiagram",message:Q,width:N,height:$}):z.loadingEl?z.loadingEl:e.jsx(Ga,{componentName:"OrbitDiagram",width:N,height:$,children:e.jsx(Es,Object.assign({chartType:"orbit"},null!=i&&{data:i},{size:[N,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:X,edgeStyle:V,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&D,tooltipContent:k?void 0:!1===w?()=>null:kn(w)||void 0,customHoverBehavior:P||O||M?U:void 0,customClickBehavior:O||M?K:void 0,foregroundGraphics:j,annotations:A,className:s,title:H,description:I,summary:F,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=o.animate&&{animate:o.animate},S))})}gu.displayName="OrbitDiagram";const fu={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"},pu={opacity:.7,marginRight:4};function yu(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function mu(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function vu(t={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s;const a=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,l=yu(a,o,"time"),c=yu(a,n,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:fu,children:[e.jsxs("div",{children:[e.jsxs("span",{style:pu,children:[i,":"]}),mu(l)]}),e.jsxs("div",{children:[e.jsxs("span",{style:pu,children:[r,":"]}),mu(c)]})]})}}function bu(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 xu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,stroke:w="#007bff",strokeWidth:j=2,strokeDasharray:A,opacity:S,background:O,tooltipContent:M,tooltip:C,onHover:_,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,transition:$,linkedHover:D,selection:H,onObservation:I,chartId:F,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=o,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,K=null!=u?u:[c.width,c.height],Q=null!==(l=null!=M?M:C)&&void 0!==l?l:vu({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=Ba({selection:H,linkedHover:D,unwrapData:!0,onObservation:I,chartType:"RealtimeLineChart",chartId:F}),ee=t.useCallback(e=>{_&&_(e),J(e)},[_,J]);t.useImperativeHandle(n,()=>({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=Ua(W,K[0],K[1],z),oe=te?null:Va(y,K[0],K[1],Y),ne={stroke:w,strokeWidth:j,strokeDasharray:A};null!=S&&(ne.opacity=S);const ie=bu(p,y);return te||oe||e.jsx(si,{ref:Z,chartType:"line",runtimeMode:"streaming",size:K,margin:U,className:G?`${h||""} semiotic-emphasis-${G}`.trim():h,arrowOfTime:g,windowMode:f,windowSize:ie,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,lineStyle:ne,showAxes:X,background:O,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,transition:$,pointIdAccessor:o.pointIdAccessor,legendPosition:q})});function ku(e,t,o){const n="function"==typeof t?t(e):e[null!=t?t:o];if(null==n)return null;if(n instanceof Date)return n.getTime();if("string"==typeof n&&""===n.trim())return null;const i=Number(n);return Number.isFinite(i)?i:null}xu.displayName="RealtimeLineChart";const wu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,showAxes:o.showAxes,enableHover:null!=o.enableHover?!!o.enableHover:void 0,linkedHover:o.linkedHover}),{binSize:u,size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y,data:m,timeAccessor:v,valueAccessor:b,direction:x="up",timeExtent:k,valueExtent:w,extentPadding:j,categoryAccessor:A,colors:S,fill:O,stroke:M,strokeWidth:C,opacity:_,gap:P,background:L,tooltipContent:T,tooltip:R,onHover:B,annotations:E,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:D,linkedHover:H,selection:I,decay:F,pulse:W,staleness:z,transition:Y,onObservation:G,chartId:q,loading:X,loadingContent:V,emptyContent:U,emphasis:K,legendPosition:Q,brush:Z,onBrush:J,linkedBrush:ee}=o,te=c.showAxes,oe=c.enableHover,ne=null!=h?h:c.marginDefaults,ie=null!=d?d:[c.width,c.height],re=null!==(l=null!=T?T:R)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n}=t;return t=>{var i;const r=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null;if(null==(null==r?void 0:r.binStart)||null==(null==r?void 0:r.binEnd)){const t=yu(r,o,"time"),i=yu(r,n,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:fu,children:[e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"x:"}),mu(t)]}),e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"y:"}),mu(i)]})]})}return e.jsxs("div",{className:"semiotic-tooltip",style:fu,children:[e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"range:"}),mu(r.binStart),"–",mu(r.binEnd)]}),null!=r.total&&e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"count:"}),mu(r.total)]}),null!=r.category&&e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"category:"}),mu(r.category)]})]})}}({timeAccessor:v,valueAccessor:b}),se=t.useRef(null),{customHoverBehavior:ae}=Ba({selection:I,linkedHover:H,unwrapData:!0,onObservation:G,chartType:"RealtimeHistogram",chartId:q}),le=t.useCallback(e=>{B&&B(e),ae(e)},[B,ae]),ce=!0===Z?{dimension:"x",snap:"bin"}:"x"===Z?{dimension:"x"}:"object"==typeof Z?Z:void 0,ue=ma(ee),de=ra(Object.assign({name:(null==ue?void 0:ue.name)||"__unused_hist_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof v?v:"time")},(null==ue?void 0:ue.yField)?{yField:ue.yField}:{})),he=t.useRef(de.brushInteraction);he.current=de.brushInteraction;const ge=t.useCallback(e=>{if(J&&J(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:q}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:q}),ue){const t=he.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)}},[J,G,q,ue]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=se.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=se.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=se.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const fe=Ua(X,ie[0],ie[1],V),pe=fe?null:Va(m,ie[0],ie[1],U),ye={};null!=O&&(ye.fill=O),null!=M&&(ye.stroke=M),null!=C&&(ye.strokeWidth=C),null!=_&&(ye.opacity=_),null!=P&&(ye.gap=P);const me=K?`${g||""} semiotic-emphasis-${K}`.trim():g,ve=bu(y,m),be=t.useMemo(()=>"down"!==x?w:function({data:e,valueAccessor:t,timeAccessor:o,binSize:n,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=ku(i,o,"time"),r=ku(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/n)*n;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:m,valueAccessor:b,timeAccessor:v,binSize:u,valueExtent:w,extentPadding:j}),[x,m,b,v,u,w,j]);return fe||pe||e.jsx(si,{ref:se,chartType:"bar",runtimeMode:"streaming",size:ie,margin:ne,className:me,arrowOfTime:f,windowMode:p,windowSize:ve,data:m,timeAccessor:v,valueAccessor:b,xExtent:k,yExtent:be,extentPadding:j,binSize:u,categoryAccessor:A,barColors:S,barStyle:ye,showAxes:te,background:L,hoverAnnotation:oe,tooltipContent:re,customHoverBehavior:le,annotations:E,svgAnnotationRules:N,tickFormatTime:$,tickFormatValue:D,decay:F,pulse:W,staleness:z,transition:Y,pointIdAccessor:o.pointIdAccessor,legendPosition:Q,brush:ce||(ee?{dimension:"x"}:void 0),onBrush:ce||ee?ge:void 0})});function ju(t){return e.jsx(wu,Object.assign({},t,{windowMode:"growing"}))}wu.displayName="RealtimeHistogram",ju.displayName="TemporalHistogram";const Au=wu,Su=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,categoryAccessor:w,colors:j,radius:A,fill:S,opacity:O,stroke:M,strokeWidth:C,background:_,tooltipContent:P,tooltip:L,onHover:T,annotations:R,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:N,linkedHover:$,selection:D,onObservation:H,chartId:I,loading:F,loadingContent:W,emptyContent:z,emphasis:Y,legendPosition:G}=o,q=c.showAxes,X=c.enableHover,V=null!=d?d:c.marginDefaults,U=null!=u?u:[c.width,c.height],K=null!==(l=null!=P?P:L)&&void 0!==l?l:vu({timeAccessor:m,valueAccessor:v}),Q=t.useRef(null),{customHoverBehavior:Z}=Ba({selection:D,linkedHover:$,unwrapData:!0,onObservation:H,chartType:"RealtimeSwarmChart",chartId:I}),J=t.useCallback(e=>{T&&T(e),Z(e)},[T,Z]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Q.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ee=Ua(F,U[0],U[1],W),te=ee?null:Va(y,U[0],U[1],z),oe={};null!=A&&(oe.radius=A),null!=S&&(oe.fill=S),null!=O&&(oe.opacity=O),null!=M&&(oe.stroke=M),null!=C&&(oe.strokeWidth=C);const ne=Y?`${h||""} semiotic-emphasis-${Y}`.trim():h,ie=bu(p,y);return ee||te||e.jsx(si,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:ne,arrowOfTime:g,windowMode:f,windowSize:ie,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,categoryAccessor:w,barColors:j,swarmStyle:oe,showAxes:q,background:_,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:R,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:N,legendPosition:G,pointIdAccessor:o.pointIdAccessor})});Su.displayName="RealtimeSwarmChart";const Ou=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,positiveColor:w,negativeColor:j,connectorStroke:A,connectorWidth:S,gap:O,stroke:M,strokeWidth:C,opacity:_,background:P,tooltipContent:L,tooltip:T,onHover:R,annotations:B,svgAnnotationRules:E,tickFormatTime:N,tickFormatValue:$,linkedHover:D,selection:H,onObservation:I,chartId:F,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=o,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,K=null!=u?u:[c.width,c.height],Q=null!==(l=null!=L?L:T)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n}=t;return t=>{var i,r;const s=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null,a=yu(s,o,"time"),l=null!==(r=null==s?void 0:s.delta)&&void 0!==r?r:yu(s,n,"value"),c=null==s?void 0:s.cumEnd,u="number"==typeof l?0>l?mu(l):"+"+mu(l):mu(l);return e.jsxs("div",{className:"semiotic-tooltip",style:fu,children:[e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"x:"}),mu(a)]}),e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"Δ:"}),u]}),null!=c&&e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"total:"}),mu(c)]})]})}}({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=Ba({selection:H,linkedHover:D,unwrapData:!0,onObservation:I,chartType:"RealtimeWaterfallChart",chartId:F}),ee=t.useCallback(e=>{R&&R(e),J(e)},[R,J]);t.useImperativeHandle(n,()=>({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=Ua(W,K[0],K[1],z),oe=te?null:Va(y,K[0],K[1],Y),ne={};null!=w&&(ne.positiveColor=w),null!=j&&(ne.negativeColor=j),null!=A&&(ne.connectorStroke=A),null!=S&&(ne.connectorWidth=S),null!=O&&(ne.gap=O),null!=M&&(ne.stroke=M),null!=C&&(ne.strokeWidth=C),null!=_&&(ne.opacity=_);const ie=G?`${h||""} semiotic-emphasis-${G}`.trim():h,re=bu(p,y);return te||oe||e.jsx(si,{ref:Z,chartType:"waterfall",runtimeMode:"streaming",size:K,margin:U,className:ie,arrowOfTime:g,windowMode:f,windowSize:re,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,waterfallStyle:ne,showAxes:X,background:P,hoverAnnotation:V,tooltipContent:Q,customHoverBehavior:ee,annotations:B,svgAnnotationRules:E,tickFormatTime:N,tickFormatValue:$,legendPosition:q,pointIdAccessor:o.pointIdAccessor})});Ou.displayName="RealtimeWaterfallChart";const Mu=t.forwardRef(function(o,n){var i,r,s,a,l;const c=Ha(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,heatmapXBins:j=20,heatmapYBins:A=20,aggregation:S="count",background:O,tooltipContent:M,tooltip:C,onHover:_,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,linkedHover:$,selection:D,onObservation:H,chartId:I,loading:F,loadingContent:W,emptyContent:z,emphasis:Y,legendPosition:G}=o,q=c.showAxes,X=c.enableHover,V=null!=d?d:c.marginDefaults,U=null!=u?u:[c.width,c.height],K=null!==(l=null!=M?M:C)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s,a,l,c;const u=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,d=null!==(a=null==u?void 0:u.xCenter)&&void 0!==a?a:yu(u,o,"time"),h=null!==(l=null==u?void 0:u.yCenter)&&void 0!==l?l:yu(u,n,"value"),g=null==u?void 0:u.count,f=null==u?void 0:u.sum,p=null==u?void 0:u.value,y=null!==(c=null==u?void 0:u.agg)&&void 0!==c?c:"count";return e.jsxs("div",{className:"semiotic-tooltip",style:fu,children:[e.jsxs("div",{children:[e.jsxs("span",{style:pu,children:[i,":"]}),mu(d)]}),e.jsxs("div",{children:[e.jsxs("span",{style:pu,children:[r,":"]}),mu(h)]}),null!=g&&e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"count:"}),mu(g)]}),"sum"===y&&null!=f&&e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"sum:"}),mu(f)]}),"mean"===y&&null!=p&&e.jsxs("div",{children:[e.jsx("span",{style:pu,children:"mean:"}),mu(p)]})]})}}({timeAccessor:m,valueAccessor:v}),Q=t.useRef(null),{customHoverBehavior:Z}=Ba({selection:D,linkedHover:$,unwrapData:!0,onObservation:H,chartType:"RealtimeHeatmap",chartId:I}),J=t.useCallback(e=>{_&&_(e),Z(e)},[_,Z]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Q.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ee=Ua(F,U[0],U[1],W),te=ee?null:Va(y,U[0],U[1],z),oe=Y?`${h||""} semiotic-emphasis-${Y}`.trim():h,ne=bu(p,y);return ee||te||e.jsx(si,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:oe,arrowOfTime:g,windowMode:f,windowSize:ne,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,xExtent:x,yExtent:k,extentPadding:w,heatmapXBins:j,heatmapYBins:A,heatmapAggregation:S,showAxes:q,background:O,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:P,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:R,decay:B,pulse:E,staleness:N,legendPosition:G,pointIdAccessor:o.pointIdAccessor})});Mu.displayName="RealtimeHeatmap";const Cu=864e5;function _u(e){return 10>e?"0"+e:e+""}const Pu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Lu(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)*(1-t)),i=Math.round(parseInt(o[2],16)*(1-t)),r=Math.round(parseInt(o[3],16)*(1-t));return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Tu(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),i=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),r=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Ru(e,t){return dl(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"),Bu(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);Eu(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 u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{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?(Eu(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 Bu(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++)Bu(n[e],i[e])}function Eu(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 Nu={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"}},$u={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Du={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Hu=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Iu=["vertical","horizontal"],Fu={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Nu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Hu},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({},Nu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Hu},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({},Nu),$u),{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:Hu},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({},Nu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Hu},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({},Nu),$u),{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({},Nu),$u),{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({},Nu),$u),{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:[],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Nu),$u),{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({},Nu),$u),{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({},Nu),$u),{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({},Nu),$u),{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({},Nu),Du),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Iu},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({},Nu),Du),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Iu},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Nu),Du),{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:Iu},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nu),Du),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Iu},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({},Nu),Du),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Iu},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({},Nu),Du),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Iu},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nu),Du),{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({},Nu),Du),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Iu},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({},Nu),Du),{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({},Nu),Du),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Iu},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({},Nu),{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({},Nu),{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({},Nu),{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({},Nu),Du),{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({},Nu),Du),{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({},Nu),{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({},Nu),{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:Iu},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({},Nu),{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({},Nu),{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({},Nu),{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({},Nu),{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({},Nu),{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({},Nu),{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({},Nu),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Nu),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Nu),{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({},Nu),{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({},Nu),{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({},Nu),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}},Wu=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"]),zu=new Set(["data","nodes","edges"]),Yu="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Gu(e){return dl(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?qu(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 qu(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 Xu(e){return"nominal"===e||"ordinal"===e}function Vu(e){return"quantitative"===e||"temporal"===e}const Uu={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"},Ku={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"},Qu={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Zu(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 Ju(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}function ed(){const t=function(){const e=p.useContext(Wo);return e?()=>e.setVisible(e=>!e):null}();return t?e.jsx("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:rd,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const td={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 od({height:t}){return e.jsx("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 nd({error:t}){return e.jsx("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e.jsx("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const id=p.forwardRef(function({title:t,subtitle:o,children:n,width:i="100%",height:r=400,actions:s,chartConfig:a,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:f,style:y},m){const v=p.useRef(null),b=p.useRef(null),[x,k]=p.useState(!1),w=!1!==(null==s?void 0:s.export)&&void 0!==(null==s?void 0:s.export),j=!1!==(null==s?void 0:s.fullscreen)&&void 0!==(null==s?void 0:s.fullscreen),A=!1!==(null==s?void 0:s.copyConfig)&&void 0!==(null==s?void 0:s.copyConfig)&&a,S=!0===(null==s?void 0:s.dataSummary),O="object"==typeof(null==s?void 0:s.export)?s.export:{},M="object"==typeof(null==s?void 0:s.copyConfig)?s.copyConfig.format:"json",C=p.useCallback(e=>dl(this,void 0,void 0,function*(){b.current&&(yield Ru(b.current,Object.assign(Object.assign({},O),e)))}),[O]),_=p.useCallback(()=>{v.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):v.current.requestFullscreen().catch(()=>{}))},[]),P=p.useCallback(e=>dl(this,void 0,void 0,function*(){a&&(yield Gu(a,e||M||"json"))}),[a,M]);p.useEffect(()=>{const e=()=>{k(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),p.useImperativeHandle(m,()=>({export:C,toggleFullscreen:_,copyConfig:P,element:v.current}),[C,_,P]);const L=t||o||l||w||j||A||S||h,T=c?e.jsx(od,{height:r}):u?e.jsx(nd,{error:u}):d?e.jsx(Wa,{children:n}):n;return R=e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.jsxs("div",{ref:v,className:"semiotic-chart-container"+(f?" "+f:""),style:Object.assign(Object.assign({width:i,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"},x?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),y),children:[L&&e.jsxs("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:[e.jsxs("div",{className:"semiotic-chart-title-area",children:[t&&e.jsx("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:t}),o&&e.jsx("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0},children:o})]}),e.jsxs("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[l,w&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>C(),title:"Export chart","aria-label":"Export chart",style:rd,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.jsx("path",{d:"M2 12h10"})]})}),S&&e.jsx(ed,{}),j&&e.jsx("button",{className:"semiotic-chart-action",onClick:_,title:x?"Exit fullscreen":"Fullscreen","aria-label":x?"Exit fullscreen":"Enter fullscreen",style:rd,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsxs(e.Fragment,x?{children:[e.jsx("path",{d:"M9 1v4h4"}),e.jsx("path",{d:"M5 13V9H1"}),e.jsx("path",{d:"M13 5H9V1"}),e.jsx("path",{d:"M1 9h4v4"})]}:{children:[e.jsx("path",{d:"M1 5V1h4"}),e.jsx("path",{d:"M13 9v4H9"}),e.jsx("path",{d:"M9 1h4v4"}),e.jsx("path",{d:"M5 13H1V9"})]})})}),A&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Copy config","aria-label":"Copy chart configuration",style:rd,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.jsx("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),h&&e.jsx("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:td[h].bg,color:td[h].color,lineHeight:"18px"},children:h})]})]}),e.jsxs("div",{className:"semiotic-chart-body",ref:b,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},x?{flex:1}:{height:r}),children:[T,g]})]})]}),S?e.jsx(zo,{children:R}):R;var R}),rd={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 sd({children:t,columns:o="auto",minCellWidth:n=300,gap:i=16,className:r,style:s}){const a="number"==typeof o?o:void 0;return e.jsx("div",{className:"semiotic-chart-grid"+(r?" "+r:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${n}px, 1fr))`:`repeat(${o}, 1fr)`,gap:i,width:"100%"},s),children:p.Children.map(t,t=>p.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==a&&2>a?t:e.jsx("div",{style:{gridColumn:"span 2"},children:t}):t)})}function ad({children:t,context:o,position:n="right",contextSize:i=250,gap:r=12,className:s,style:a}){const l="left"===n||"right"===n,c="left"===n||"top"===n,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:r,width:"100%"},a),d=l?{flex:`0 0 ${i}px`,width:i,minHeight:0}:{flex:`0 0 ${i}px`,height:i,minWidth:0};return e.jsxs("div",{className:"semiotic-context-layout"+(s?" "+s:""),style:u,children:[e.jsx("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:t}),e.jsx("div",{style:d,children:o})]})}sd.displayName="ChartGrid",ad.displayName="ContextLayout";function ld({children:o,position:n="right",size:i=300,trigger:r="click",chartId:s,observation:a,dismissOnEmpty:l=!0,showClose:c=!0,onToggle:u,className:d,style:h}){const[g,f]=t.useState(null),[p,y]=t.useState(null),[m,v]=t.useState(!1),[b,x]=t.useState(!1),k=t.useRef(null),w=t.useRef(void 0),j="click"===r?["click","click-end"]:["hover","hover-end"],{latest:A}=sa({types:j,chartId:s,limit:1}),S=void 0!==a?a:A;t.useEffect(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;f(e.datum),y(e),m||(v(!0),x(!0),clearTimeout(w.current),w.current=setTimeout(()=>x(!1),200))}else!l||"click-end"!==S.type&&"hover-end"!==S.type||O()},[S]),t.useEffect(()=>{null==u||u(m)},[m,u]);const O=t.useCallback(()=>{x(!0),v(!1),clearTimeout(w.current),w.current=setTimeout(()=>{x(!1),f(null),y(null)},200)},[]);if(t.useEffect(()=>()=>clearTimeout(w.current),[]),!g&&!b)return null;const M=g&&p?o(g,p):null;if(null===M&&!b)return null;const C=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,i,m,b);return e.jsxs("div",{ref:k,className:`semiotic-details-panel semiotic-details-${n}${d?" "+d:""}`,style:Object.assign(Object.assign({},C),h),children:[c&&e.jsx("button",{className:"semiotic-details-close",onClick:O,"aria-label":"Close details",style:cd,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e.jsx("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e.jsx("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:M})]})}const cd={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};ld.displayName="DetailsPanel";const ud="__forecastSegment";function dd(e,t){return"function"==typeof t?t(e):!!e[t]}const hd=Object.freeze({__proto__:null,SEGMENT_FIELD:ud,buildAnomalyAnnotations:function(e){var t,o,n;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(o=e.bandOpacity)&&void 0!==o?o:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(n=e.anomalyRadius)&&void 0!==n?n:6,label:e.label}]},buildForecast:function(e,t,o,n,i){return(r=n).isTraining||r.isForecast||r.isAnomaly||r.upperBounds||r.lowerBounds?function(e,t,o,n,i){var r,s,a,l;const{isTraining:c,isForecast:u,isAnomaly:d,upperBounds:h,lowerBounds:g,color:f="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=n,b=e.map(e=>{let t="observed";return u&&dd(e,u)?t="forecast":c&&dd(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[ud]:t})}),x=n._groupBy,k=[];if(x){const e=new Map;for(const t of b){const o=null!==(r=t[x])&&void 0!==r?r:"__default";e.has(o)||e.set(o,[]),e.get(o).push(t)}const t=[];for(const[,o]of e)for(let e=0;o.length-1>e;e++)o[e][ud]!==o[e+1][ud]&&(t.push(Object.assign(Object.assign({},o[e+1]),{[ud]:o[e][ud]})),t.push(Object.assign(Object.assign({},o[e]),{[ud]:o[e+1][ud]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][ud]!==b[e+1][ud]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[ud]:b[e][ud]})),k.push(Object.assign(Object.assign({},b[e]),{[ud]:b[e+1][ud]})));if(n.trainUnderline){const e=[];for(const t of k)"training"===t[ud]&&e.push(Object.assign(Object.assign({},t),{[ud]:"training-base"}));k.unshift(...e)}const w=[];if(h&&g){const e="string"==typeof h?h:"__envUpper",t="string"==typeof g?g:"__envLower";if("function"==typeof h||"function"==typeof g)for(const o of k)"function"==typeof h&&(o[e]=h(o)),"function"==typeof g&&(o[t]=g(o));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:f,fillOpacity:p,label:v})}if(d){const e=n.anomalyStyle,t={type:"highlight",filter:e=>dd(e,d)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(a=i.bandOpacity)&&void 0!==a?a:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,n,i):function(e,t,o,n,i){var r,s,a;const{trainEnd:l,steps:c=10,confidence:u=.95,color:d="#6366f1",bandOpacity:h=.15,label:g}=n;if(null==l)return{processedData:e,annotations:[]};const f=[],p=[];for(const o of e)o[t]>l?p.push(Object.assign(Object.assign({},o),{[ud]:"observed"})):f.push(Object.assign(Object.assign({},o),{[ud]:"training"}));const y=f.map(e=>[e[t],e[o]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const n=y.length;let i=0,r=0,s=0,a=0;for(const[e,t]of y)i+=e,r+=t,s+=e*e,a+=e*t;const l=n*s-i*i;if(Math.abs(l)>1e-12){const s=(n*a-i*r)/l,f=(r-s*i)/n,p=e=>f+s*e,b=y.map(([e,t])=>t-p(e)).reduce((e,t)=>e+t*t,0),x=Math.sqrt(b/Math.max(n-2,1)),k=y.reduce((e,t)=>e+t[0],0)/n,w=y.reduce((e,t)=>e+Math.pow(t[0]-k,2),0),j=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,A=e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e)),S=Math.max(...A),O=y.length>1?(y[n-1][0]-y[0][0])/(n-1):1;for(let e=1;c>=e;e++){const i=S+e*O,r=p(i),s=x*Math.sqrt(1+1/n+(w>0?Math.pow(i-k,2)/w:0))*j;v.push({[t]:i,[o]:r,[ud]:"forecast",__forecastUpper:r+s,__forecastLower:r-s})}m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:d,fillOpacity:h,label:g})}}m.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(s=i.bandOpacity)&&void 0!==s?s:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label});const b=[];if(b.push(...f),f.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},f[f.length-1]),{[ud]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:f[f.length-1];e&&b.push(Object.assign(Object.assign({},e),{[ud]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,o,n,i);var r},createSegmentLineStyle:function(e,t){var o,n;const i=null!==(o=t.trainDasharray)&&void 0!==o?o:"8,4",r=null!==(n=t.forecastDasharray)&&void 0!==n?n:"4,4",s=t.color||"#6366f1",a=t.trainOpacity,l=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,d=t.trainUnderline;return t=>{const o=e(t),n=t[ud];if("training"===n){let e=o.stroke;return"darken"===c?e=Lu(o.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},o),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=a&&{strokeOpacity:a})}if("training-base"===n){let e=o.stroke||"#666";return"lighten"===d&&(e=Tu(e,.4)),Object.assign(Object.assign({},o),{stroke:e,strokeDasharray:void 0})}return"forecast"===n?Object.assign(Object.assign(Object.assign({},o),{stroke:s,strokeDasharray:r}),null!=l&&{strokeOpacity:l}):o}},darkenColor:Lu,lightenColor:Tu});exports.AreaChart=Sl,exports.BarChart=ac,exports.BoxPlot=wc,exports.BubbleChart=Pl,exports.CARBON_ALERT={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},exports.CARBON_CATEGORICAL_14=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],exports.COLOR_BLIND_SAFE_CATEGORICAL=M,exports.CandlestickChart=Jl,exports.CategoryColorProvider=Xs,exports.ChartContainer=id,exports.ChartErrorBoundary=Wa,exports.ChartGrid=sd,exports.ChordDiagram=qc,exports.CirclePack=du,exports.ConnectedScatterplot=xl,exports.ContextLayout=ad,exports.DARK_THEME=_,exports.DetailsPanel=ld,exports.DifferenceChart=Ml,exports.DonutChart=Pc,exports.DotPlot=Cc,exports.ForceDirectedGraph=Gc,exports.FunnelChart=Mc,exports.GaugeChart=$c,exports.GroupedBarChart=Dc,exports.HIGH_CONTRAST_THEME=P,exports.Heatmap=_l,exports.Histogram=Ac,exports.IncrementalExtent=E,exports.LIGHT_THEME=C,exports.LikertChart=vc,exports.LineChart=wl,exports.LinkedCharts=pa,exports.MinimapChart=Il,exports.MultiAxisLineChart=Ql,exports.MultiLineTooltip=function(t={}){const{fields:o=[],title:n,format:i,style:r={},className:s="",showLabels:a=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(n){const e=mn(t,n);c.push({value:vn(e,i)})}o&&Array.isArray(o)&&o.length>0?o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=vn(mn(t,n),r);c.push({label:a?o:void 0,value:s})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:a?e:void 0,value:vn(t[e],i)})});const u=Object.assign(Object.assign({},yn),r);return Array.isArray(c)&&0!==c.length?e.jsx("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:u,children:c.map((t,o)=>e.jsxs("div",{style:{marginBottom:c.length-1>o?"4px":0},children:[t.label&&e.jsxs("strong",{children:[t.label,l]}),t.value]},o))}):null}},exports.NetworkCustomChart=nc,exports.OrbitDiagram=gu,exports.OrdinalCustomChart=ic,exports.PieChart=_c,exports.ProcessSankey=lu,exports.QuadrantChart=ql,exports.RealtimeHeatmap=Mu,exports.RealtimeHistogram=wu,exports.RealtimeLineChart=xu,exports.RealtimeSwarmChart=Su,exports.RealtimeTemporalHistogram=Au,exports.RealtimeWaterfallChart=Ou,exports.RidgelinePlot=Oc,exports.RingBuffer=B,exports.SankeyDiagram=Xc,exports.Scatterplot=vl,exports.ScatterplotMatrix=Dl,exports.StackedAreaChart=Cl,exports.StackedBarChart=lc,exports.StreamNetworkFrame=Es,exports.StreamOrdinalFrame=Yi,exports.StreamXYFrame=si,exports.SwarmPlot=xc,exports.SwimlaneChart=Hc,exports.THEME_PRESETS=ba,exports.TemporalHistogram=ju,exports.ThemeProvider=function({theme:t,children:o}){const n="string"==typeof t&&xa(t)?t:void 0,i=p.useMemo(()=>function(e){return void 0!==e?L(C,ja(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?P:C}(t),[t]);return e.jsx(T,{initialState:{theme:i},children:e.jsxs(ka.Provider,{value:n,children:[e.jsx(Aa,{theme:t}),e.jsx(Sa,{children:o})]})})},exports.Tooltip=bn,exports.TreeDiagram=cu,exports.Treemap=uu,exports.ViolinPlot=Sc,exports.XYCustomChart=oc,exports.adaptiveTimeTicks=function(e){let t,o=e;return(n,i,r)=>{const s=n instanceof Date?n:new Date(n);e||!r||2>r.length||r===t||(t=r,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 12e4>o?"seconds":72e5>o?"minutes":2*Cu>o?"hours":60*Cu>o?"days":400*Cu>o?"months":"years"}(r));const a=o||"days";return null!=i&&0!==i&&r&&0!==r.length?function(e,t,o){const n=e.getUTCFullYear()!==t.getUTCFullYear(),i=n||e.getUTCMonth()!==t.getUTCMonth(),r=i||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=Pu[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=_u(e.getUTCHours()),h=_u(e.getUTCMinutes()),g=_u(e.getUTCSeconds());switch(o){case"seconds":return n?`${l} ${c}, ${u} ${d}:${h}:${g}`:r?`${l} ${c} ${d}:${h}:${g}`:s?`${d}:${h}:${g}`:a?`${h}:${g}`:":"+g;case"minutes":return n?`${l} ${c}, ${u} ${d}:${h}`:r?`${l} ${c} ${d}:${h}`:s?`${d}:${h}`:":"+h;case"hours":return n?`${l} ${c}, ${u} ${d}:00`:i?`${l} ${c} ${d}:${h}`:r?`${l} ${c} ${d}:00`:d+":00";case"days":return n?`${l} ${c}, ${u}`:i?`${l} ${c}`:""+c;case"months":return n?`${l} ${u}`:""+l;case"years":return""+u}}(s,new Date(r[i-1]),a):function(e,t){const o=Pu[e.getUTCMonth()],n=e.getUTCDate(),i=e.getUTCFullYear(),r=_u(e.getUTCHours()),s=_u(e.getUTCMinutes()),a=_u(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${n}, ${i} ${r}:${s}:${a}`;case"minutes":case"hours":return`${o} ${n}, ${i} ${r}:${s}`;case"days":return`${o} ${n}, ${i}`;case"months":return`${o} ${i}`;case"years":return""+i}}(s,a)}},exports.configToJSX=qu,exports.copyConfig=Gu,exports.createHatchPattern=Ri,exports.darkenColor=Lu,exports.deserializeSelections=function(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},exports.exportChart=Ru,exports.fromConfig=function(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Fu[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Yu(e.props)}},exports.fromURL=function(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)},exports.fromVegaLite=function(e){var t,o,n,i,r,s,a,l,c,u,d,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:ul(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 j;(null===(t=e.data)||void 0===t?void 0:t.values)?j=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.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 A={};e.width&&(A.width=e.width),e.height&&(A.height=e.height);const S=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(S&&(A.title=S),(null==b?void 0:b.field)&&(A.colorBy=b.field,null===(n=b.scale)||void 0===n?void 0:n.scheme)){const e=Uu[b.scale.scheme];e&&(A.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(A.pointOpacity=w.value);const O=null==m?void 0:m.aggregate,M=null==v?void 0:v.aggregate;if(j&&(O||M)){const e=M?v:m,t=M?m:v,o=Qu[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)j=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}(j,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&j){const e=new Map;for(const o of j){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}j=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";j&&(A.data=j),(null==m?void 0:m.bin)?(A.valueAccessor=m.field,(null==v?void 0:v.field)&&(A.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(A.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(A.valueAccessor=v.field,(null==m?void 0:m.field)&&(A.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(A.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),o="object"==typeof t?t.maxbins:void 0;return o&&(A.bins=o),Ju(e,A,g)}let C;switch(f){case"bar":C=function(e,t,o,n,i,r,s){var a,l,c,u,d,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",Xu(null==e?void 0:e.type)&&Vu(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)):Vu(null==e?void 0:e.type)&&Xu(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===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.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===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.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}(m,v,b,A,j,O,M);break;case"line":if(C="LineChart",Zu(m,v,A,O,M),(null==b?void 0:b.field)&&(A.lineBy=b.field),p.interpolate){const e=Ku[p.interpolate];e&&(A.curve=e)}!0===p.point&&(A.showPoints=!0),j&&(A.data=j);break;case"area":if((null==b?void 0:b.field)?(C="StackedAreaChart",A.areaBy=b.field):C="AreaChart",Zu(m,v,A,O,M),p.interpolate){const e=Ku[p.interpolate];e&&(A.curve=e)}void 0!==p.opacity&&(A.areaOpacity=p.opacity),j&&(A.data=j);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(C="BubbleChart",A.sizeBy=x.field,(null===(s=x.scale)||void 0===s?void 0:s.range)&&(A.sizeRange=x.scale.range)):C="Scatterplot",Zu(m,v,A,O,M),j&&(A.data=j);break;case"rect":C="Heatmap",(null==m?void 0:m.field)&&(A.xAccessor=m.field),(null==v?void 0:v.field)&&(A.yAccessor=v.field),(null==b?void 0:b.field)&&(A.valueAccessor=b.field,delete A.colorBy),(null===(a=null==m?void 0:m.axis)||void 0===a?void 0:a.title)&&(A.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(A.yLabel=v.axis.title),j&&(A.data=j);break;case"arc":p.innerRadius&&p.innerRadius>0?(C="DonutChart",A.innerRadius=p.innerRadius):C="PieChart",(null==k?void 0:k.field)?A.valueAccessor=k.field:(null==v?void 0:v.field)&&(A.valueAccessor=M?"value":v.field),(null==b?void 0:b.field)&&(A.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(A.categoryAccessor=m.field),j&&(A.data=j);break;case"tick":C="DotPlot",Xu(null==m?void 0:m.type)?(A.categoryAccessor=m.field,(null==v?void 0:v.field)&&(A.valueAccessor=M?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(A.categoryLabel=m.axis.title),(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(A.valueLabel=v.axis.title)):Xu(null==v?void 0:v.type)?(A.categoryAccessor=v.field,(null==m?void 0:m.field)&&(A.valueAccessor=O?"value":m.field),A.orientation="horizontal",(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(A.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(A.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(A.categoryAccessor=m.field),(null==v?void 0:v.field)&&(A.valueAccessor=M?"value":v.field)),j&&(A.data=j);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),C="Scatterplot",Zu(m,v,A,O,M),j&&(A.data=j)}return Ju(C,A,g)},exports.lightenColor=Tu,exports.normalizeTooltip=kn,exports.resolveThemePreset=xa,exports.serializeSelections=function(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},exports.smartTickFormat=function(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"},exports.themeToCSS=function(e,t=":root"){var o,n,i,r,s;const a=[];return a.push(` --semiotic-bg: ${e.colors.background};`),a.push(` --semiotic-text: ${e.colors.text};`),a.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),a.push(` --semiotic-grid: ${e.colors.grid};`),a.push(` --semiotic-border: ${e.colors.border};`),a.push(` --semiotic-primary: ${e.colors.primary};`),a.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&a.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&a.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&a.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&a.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(o=e.tooltip)||void 0===o?void 0:o.background)&&a.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(n=e.tooltip)||void 0===n?void 0:n.text)&&a.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&a.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&a.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(s=e.tooltip)||void 0===s?void 0:s.shadow)&&a.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&a.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&a.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&a.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&a.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&a.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&a.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&a.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),a.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),a.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&a.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&a.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&a.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&a.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&a.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${a.join("\n")}\n}`},exports.themeToTokens=function(e){var t,o,n,i,r,s;return{semiotic:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.text)||e.colors.text,$type:"color"},radius:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(s=e.colors.selectionOpacity)&&void 0!==s?s:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{}),null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{}),null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{}),{secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"}}),e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{}),e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{}),e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{}),e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{}),e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{})}},exports.toConfig=function(e,t,o){if(!Fu[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Fu).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(Wu.has(e)||!n&&zu.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=Yu(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})},exports.toURL=function(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},exports.useBrushSelection=ra,exports.useCategoryColors=Vs,exports.useChartObserver=sa,exports.useFilteredData=function(e,o,n){const i=Js(e=>e.selections.get(o));return t.useMemo(()=>{if(!i||0===i.clauses.size)return e;const t=Ks(i,n);return e.filter(t)},[e,i,n])},exports.useLinkedHover=na,exports.useSelection=oa,exports.useTheme=Oa;